ai 6.0.0-beta.55 → 6.0.0-beta.57
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/CHANGELOG.md +16 -0
 - package/README.md +4 -4
 - package/dist/index.d.mts +21 -16
 - package/dist/index.d.ts +21 -16
 - package/dist/index.js +118 -49
 - package/dist/index.js.map +1 -1
 - package/dist/index.mjs +118 -51
 - package/dist/index.mjs.map +1 -1
 - package/dist/internal/index.js +112 -41
 - package/dist/internal/index.js.map +1 -1
 - package/dist/internal/index.mjs +112 -41
 - package/dist/internal/index.mjs.map +1 -1
 - package/package.json +4 -4
 
    
        package/CHANGELOG.md
    CHANGED
    
    | 
         @@ -1,5 +1,21 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # ai
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            ## 6.0.0-beta.57
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            ### Patch Changes
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            - 61f7b0f: chore(agent): rename BasicAgent to ToolLoopAgent
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            ## 6.0.0-beta.56
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            ### Patch Changes
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            - 3794514: feat: flexible tool output content support
         
     | 
| 
      
 14 
     | 
    
         
            +
            - Updated dependencies [3794514]
         
     | 
| 
      
 15 
     | 
    
         
            +
              - @ai-sdk/provider-utils@4.0.0-beta.19
         
     | 
| 
      
 16 
     | 
    
         
            +
              - @ai-sdk/provider@3.0.0-beta.8
         
     | 
| 
      
 17 
     | 
    
         
            +
              - @ai-sdk/gateway@2.0.0-beta.35
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
       3 
19 
     | 
    
         
             
            ## 6.0.0-beta.55
         
     | 
| 
       4 
20 
     | 
    
         | 
| 
       5 
21 
     | 
    
         
             
            ### Patch Changes
         
     | 
    
        package/README.md
    CHANGED
    
    | 
         @@ -69,9 +69,9 @@ const { object } = await generateObject({ 
     | 
|
| 
       69 
69 
     | 
    
         
             
            ### Agents
         
     | 
| 
       70 
70 
     | 
    
         | 
| 
       71 
71 
     | 
    
         
             
            ```ts
         
     | 
| 
       72 
     | 
    
         
            -
            import {  
     | 
| 
      
 72 
     | 
    
         
            +
            import { ToolLoopAgent } from 'ai';
         
     | 
| 
       73 
73 
     | 
    
         | 
| 
       74 
     | 
    
         
            -
            const sandboxAgent = new  
     | 
| 
      
 74 
     | 
    
         
            +
            const sandboxAgent = new ToolLoopAgent({
         
     | 
| 
       75 
75 
     | 
    
         
             
              model: 'openai/gpt-5-codex',
         
     | 
| 
       76 
76 
     | 
    
         
             
              system: 'You are an agent with access to a shell environment.',
         
     | 
| 
       77 
77 
     | 
    
         
             
              tools: {
         
     | 
| 
         @@ -101,9 +101,9 @@ npm install @ai-sdk/react 
     | 
|
| 
       101 
101 
     | 
    
         | 
| 
       102 
102 
     | 
    
         
             
            ```ts
         
     | 
| 
       103 
103 
     | 
    
         
             
            import { openai } from '@ai-sdk/openai';
         
     | 
| 
       104 
     | 
    
         
            -
            import {  
     | 
| 
      
 104 
     | 
    
         
            +
            import { ToolLoopAgent, InferAgentUIMessage } from 'ai';
         
     | 
| 
       105 
105 
     | 
    
         | 
| 
       106 
     | 
    
         
            -
            export const imageGenerationAgent = new  
     | 
| 
      
 106 
     | 
    
         
            +
            export const imageGenerationAgent = new ToolLoopAgent({
         
     | 
| 
       107 
107 
     | 
    
         
             
              model: openai('gpt-5'),
         
     | 
| 
       108 
108 
     | 
    
         
             
              tools: {
         
     | 
| 
       109 
109 
     | 
    
         
             
                image_generation: openai.tools.imageGeneration({
         
     | 
    
        package/dist/index.d.mts
    CHANGED
    
    | 
         @@ -2375,8 +2375,11 @@ type TextStreamPart<TOOLS extends ToolSet> = { 
     | 
|
| 
       2375 
2375 
     | 
    
         
             
            };
         
     | 
| 
       2376 
2376 
     | 
    
         | 
| 
       2377 
2377 
     | 
    
         
             
            /**
         
     | 
| 
       2378 
     | 
    
         
            -
             * An  
     | 
| 
       2379 
     | 
    
         
            -
             *  
     | 
| 
      
 2378 
     | 
    
         
            +
             * An Agent receives a prompt (text or messages) and generates or streams an output
         
     | 
| 
      
 2379 
     | 
    
         
            +
             * that consists of steps, tool calls, data parts, etc.
         
     | 
| 
      
 2380 
     | 
    
         
            +
             *
         
     | 
| 
      
 2381 
     | 
    
         
            +
             * You can implement your own Agent by implementing the `Agent` interface,
         
     | 
| 
      
 2382 
     | 
    
         
            +
             * or use the `ToolLoopAgent` class.
         
     | 
| 
       2380 
2383 
     | 
    
         
             
             */
         
     | 
| 
       2381 
2384 
     | 
    
         
             
            interface Agent<TOOLS extends ToolSet = {}, OUTPUT = never, OUTPUT_PARTIAL = never> {
         
     | 
| 
       2382 
2385 
     | 
    
         
             
                /**
         
     | 
| 
         @@ -2408,7 +2411,7 @@ Callback that is set using the `onFinish` option. 
     | 
|
| 
       2408 
2411 
     | 
    
         | 
| 
       2409 
2412 
     | 
    
         
             
            @param event - The event that is passed to the callback.
         
     | 
| 
       2410 
2413 
     | 
    
         
             
             */
         
     | 
| 
       2411 
     | 
    
         
            -
            type  
     | 
| 
      
 2414 
     | 
    
         
            +
            type ToolLoopAgentOnFinishCallback<TOOLS extends ToolSet = {}> = (event: StepResult<TOOLS> & {
         
     | 
| 
       2412 
2415 
     | 
    
         
             
                /**
         
     | 
| 
       2413 
2416 
     | 
    
         
             
            Details for all steps.
         
     | 
| 
       2414 
2417 
     | 
    
         
             
               */
         
     | 
| 
         @@ -2424,12 +2427,12 @@ Callback that is set using the `onStepFinish` option. 
     | 
|
| 
       2424 
2427 
     | 
    
         | 
| 
       2425 
2428 
     | 
    
         
             
            @param stepResult - The result of the step.
         
     | 
| 
       2426 
2429 
     | 
    
         
             
             */
         
     | 
| 
       2427 
     | 
    
         
            -
            type  
     | 
| 
      
 2430 
     | 
    
         
            +
            type ToolLoopAgentOnStepFinishCallback<TOOLS extends ToolSet = {}> = (stepResult: StepResult<TOOLS>) => Promise<void> | void;
         
     | 
| 
       2428 
2431 
     | 
    
         | 
| 
       2429 
2432 
     | 
    
         
             
            /**
         
     | 
| 
       2430 
2433 
     | 
    
         
             
             * Configuration options for an agent.
         
     | 
| 
       2431 
2434 
     | 
    
         
             
             */
         
     | 
| 
       2432 
     | 
    
         
            -
            type  
     | 
| 
      
 2435 
     | 
    
         
            +
            type ToolLoopAgentSettings<TOOLS extends ToolSet = {}, OUTPUT = never, OUTPUT_PARTIAL = never> = CallSettings & {
         
     | 
| 
       2433 
2436 
     | 
    
         
             
                /**
         
     | 
| 
       2434 
2437 
     | 
    
         
             
                 * The id of the agent.
         
     | 
| 
       2435 
2438 
     | 
    
         
             
                 */
         
     | 
| 
         @@ -2485,11 +2488,11 @@ type BasicAgentSettings<TOOLS extends ToolSet = {}, OUTPUT = never, OUTPUT_PARTI 
     | 
|
| 
       2485 
2488 
     | 
    
         
             
                /**
         
     | 
| 
       2486 
2489 
     | 
    
         
             
                 * Callback that is called when each step (LLM call) is finished, including intermediate steps.
         
     | 
| 
       2487 
2490 
     | 
    
         
             
                 */
         
     | 
| 
       2488 
     | 
    
         
            -
                onStepFinish?:  
     | 
| 
      
 2491 
     | 
    
         
            +
                onStepFinish?: ToolLoopAgentOnStepFinishCallback<NoInfer<TOOLS>>;
         
     | 
| 
       2489 
2492 
     | 
    
         
             
                /**
         
     | 
| 
       2490 
2493 
     | 
    
         
             
                 * Callback that is called when all steps are finished and the response is complete.
         
     | 
| 
       2491 
2494 
     | 
    
         
             
                 */
         
     | 
| 
       2492 
     | 
    
         
            -
                onFinish?:  
     | 
| 
      
 2495 
     | 
    
         
            +
                onFinish?: ToolLoopAgentOnFinishCallback<NoInfer<TOOLS>>;
         
     | 
| 
       2493 
2496 
     | 
    
         
             
                /**
         
     | 
| 
       2494 
2497 
     | 
    
         
             
              Additional provider-specific options. They are passed through
         
     | 
| 
       2495 
2498 
     | 
    
         
             
              to the provider from the AI SDK and enable provider-specific
         
     | 
| 
         @@ -2507,17 +2510,19 @@ type BasicAgentSettings<TOOLS extends ToolSet = {}, OUTPUT = never, OUTPUT_PARTI 
     | 
|
| 
       2507 
2510 
     | 
    
         
             
            };
         
     | 
| 
       2508 
2511 
     | 
    
         | 
| 
       2509 
2512 
     | 
    
         
             
            /**
         
     | 
| 
       2510 
     | 
    
         
            -
             *  
     | 
| 
       2511 
     | 
    
         
            -
             * and  
     | 
| 
       2512 
     | 
    
         
            -
             *
         
     | 
| 
       2513 
     | 
    
         
            -
             * It handles the agent loop for you, allowing the LLM to call tools multiple times in
         
     | 
| 
       2514 
     | 
    
         
            -
             * sequence to accomplish complex tasks.
         
     | 
| 
      
 2513 
     | 
    
         
            +
             * A tool loop agent is an agent that runs tools in a loop. In each step,
         
     | 
| 
      
 2514 
     | 
    
         
            +
             * it calls the LLM, and if there are tool calls, it executes the tools
         
     | 
| 
      
 2515 
     | 
    
         
            +
             * and calls the LLM again in a new step with the tool results.
         
     | 
| 
       2515 
2516 
     | 
    
         
             
             *
         
     | 
| 
       2516 
     | 
    
         
            -
             *  
     | 
| 
      
 2517 
     | 
    
         
            +
             * The loop continues until:
         
     | 
| 
      
 2518 
     | 
    
         
            +
             * - A finish reasoning other than tool-calls is returned, or
         
     | 
| 
      
 2519 
     | 
    
         
            +
             * - A tool that is invoked does not have an execute function, or
         
     | 
| 
      
 2520 
     | 
    
         
            +
             * - A tool call needs approval, or
         
     | 
| 
      
 2521 
     | 
    
         
            +
             * - A stop condition is met (default stop condition is stepCountIs(20))
         
     | 
| 
       2517 
2522 
     | 
    
         
             
             */
         
     | 
| 
       2518 
     | 
    
         
            -
            declare class  
     | 
| 
      
 2523 
     | 
    
         
            +
            declare class ToolLoopAgent<TOOLS extends ToolSet = {}, OUTPUT = never, OUTPUT_PARTIAL = never> implements Agent<TOOLS, OUTPUT, OUTPUT_PARTIAL> {
         
     | 
| 
       2519 
2524 
     | 
    
         
             
                private readonly settings;
         
     | 
| 
       2520 
     | 
    
         
            -
                constructor(settings:  
     | 
| 
      
 2525 
     | 
    
         
            +
                constructor(settings: ToolLoopAgentSettings<TOOLS, OUTPUT, OUTPUT_PARTIAL>);
         
     | 
| 
       2521 
2526 
     | 
    
         
             
                /**
         
     | 
| 
       2522 
2527 
     | 
    
         
             
                 * The id of the agent.
         
     | 
| 
       2523 
2528 
     | 
    
         
             
                 */
         
     | 
| 
         @@ -4906,4 +4911,4 @@ declare global { 
     | 
|
| 
       4906 
4911 
     | 
    
         
             
                var AI_SDK_LOG_WARNINGS: LogWarningsFunction | undefined | false;
         
     | 
| 
       4907 
4912 
     | 
    
         
             
            }
         
     | 
| 
       4908 
4913 
     | 
    
         | 
| 
       4909 
     | 
    
         
            -
            export { AbstractChat, Agent, AsyncIterableStream,  
     | 
| 
      
 4914 
     | 
    
         
            +
            export { AbstractChat, Agent, AsyncIterableStream, CallSettings, CallWarning, ChatAddToolApproveResponseFunction, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreToolMessage, CoreUserMessage, CreateUIMessage, DataUIPart, DeepPartial, DefaultChatTransport, DownloadError, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelUsage, ErrorHandler, ToolLoopAgent as Experimental_Agent, ToolLoopAgentSettings as Experimental_AgentSettings, DownloadFunction as Experimental_DownloadFunction, GenerateImageResult as Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, InferAgentUIMessage as Experimental_InferAgentUIMessage, LogWarningsFunction as Experimental_LogWarningsFunction, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, Warning as Experimental_Warning, FileUIPart, FinishReason, GenerateObjectResult, GenerateTextOnFinishCallback, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedAudioFile, GeneratedFile, HttpChatTransport, HttpChatTransportInitOptions, ImageModel, ImageGenerationWarning as ImageModelCallWarning, ImageModelProviderMetadata, ImageModelResponseMetadata, InferAgentUIMessage, InferUIDataParts, InferUIMessageChunk, InferUITool, InferUITools, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolInputError, JSONRPCError, JSONRPCMessage, JSONRPCNotification, JSONRPCRequest, JSONRPCResponse, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelMiddleware, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, MCPClientError, MCPTransport, MessageConversionError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoOutputSpecifiedError, NoSpeechGeneratedError, NoSuchProviderError, NoSuchToolError, ObjectStreamPart, output as Output, PrepareReconnectToStreamRequest, PrepareSendMessagesRequest, PrepareStepFunction, PrepareStepResult, Prompt, Provider, ProviderMetadata, ProviderRegistryProvider, ReasoningOutput, ReasoningUIPart, RepairTextFunction, RetryError, SafeValidateUIMessagesResult, SerialJobExecutor, SourceDocumentUIPart, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, SpeechWarning, StaticToolCall, StaticToolError, StaticToolOutputDenied, StaticToolResult, StepResult, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, TelemetrySettings, TextStreamChatTransport, TextStreamPart, TextUIPart, ToolApprovalRequestOutput, ToolCallRepairError, ToolCallRepairFunction, ToolChoice, ToolLoopAgent, ToolLoopAgentOnFinishCallback, ToolLoopAgentOnStepFinishCallback, ToolLoopAgentSettings, ToolSet, ToolUIPart, TranscriptionModel, TranscriptionModelResponseMetadata, TranscriptionWarning, TypedToolCall, TypedToolError, TypedToolOutputDenied, TypedToolResult, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessageChunk, UIMessagePart, UIMessageStreamOnFinishCallback, UIMessageStreamOptions, UIMessageStreamWriter, UITool, UIToolInvocation, UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, UseCompletionOptions, assistantModelMessageSchema, callCompletionApi, consumeStream, convertFileListToFileUIParts, convertToCoreMessages, convertToModelMessages, coreAssistantMessageSchema, coreMessageSchema, coreSystemMessageSchema, coreToolMessageSchema, coreUserMessageSchema, cosineSimilarity, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultSettingsMiddleware, embed, embedMany, MCPClient as experimental_MCPClient, MCPClientConfig as experimental_MCPClientConfig, createMCPClient as experimental_createMCPClient, experimental_createProviderRegistry, experimental_customProvider, generateImage as experimental_generateImage, generateSpeech as experimental_generateSpeech, transcribe as experimental_transcribe, extractReasoningMiddleware, generateObject, generateText, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, hasToolCall, isDataUIPart, isDeepEqualData, isToolOrDynamicToolUIPart, isToolUIPart, lastAssistantMessageIsCompleteWithApprovalResponses, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parsePartialJson, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, pruneMessages, readUIMessageStream, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, stepCountIs, streamObject, streamText, systemModelMessageSchema, toolModelMessageSchema, uiMessageChunkSchema, userModelMessageSchema, validateUIMessages, wrapLanguageModel, wrapProvider };
         
     | 
    
        package/dist/index.d.ts
    CHANGED
    
    | 
         @@ -2375,8 +2375,11 @@ type TextStreamPart<TOOLS extends ToolSet> = { 
     | 
|
| 
       2375 
2375 
     | 
    
         
             
            };
         
     | 
| 
       2376 
2376 
     | 
    
         | 
| 
       2377 
2377 
     | 
    
         
             
            /**
         
     | 
| 
       2378 
     | 
    
         
            -
             * An  
     | 
| 
       2379 
     | 
    
         
            -
             *  
     | 
| 
      
 2378 
     | 
    
         
            +
             * An Agent receives a prompt (text or messages) and generates or streams an output
         
     | 
| 
      
 2379 
     | 
    
         
            +
             * that consists of steps, tool calls, data parts, etc.
         
     | 
| 
      
 2380 
     | 
    
         
            +
             *
         
     | 
| 
      
 2381 
     | 
    
         
            +
             * You can implement your own Agent by implementing the `Agent` interface,
         
     | 
| 
      
 2382 
     | 
    
         
            +
             * or use the `ToolLoopAgent` class.
         
     | 
| 
       2380 
2383 
     | 
    
         
             
             */
         
     | 
| 
       2381 
2384 
     | 
    
         
             
            interface Agent<TOOLS extends ToolSet = {}, OUTPUT = never, OUTPUT_PARTIAL = never> {
         
     | 
| 
       2382 
2385 
     | 
    
         
             
                /**
         
     | 
| 
         @@ -2408,7 +2411,7 @@ Callback that is set using the `onFinish` option. 
     | 
|
| 
       2408 
2411 
     | 
    
         | 
| 
       2409 
2412 
     | 
    
         
             
            @param event - The event that is passed to the callback.
         
     | 
| 
       2410 
2413 
     | 
    
         
             
             */
         
     | 
| 
       2411 
     | 
    
         
            -
            type  
     | 
| 
      
 2414 
     | 
    
         
            +
            type ToolLoopAgentOnFinishCallback<TOOLS extends ToolSet = {}> = (event: StepResult<TOOLS> & {
         
     | 
| 
       2412 
2415 
     | 
    
         
             
                /**
         
     | 
| 
       2413 
2416 
     | 
    
         
             
            Details for all steps.
         
     | 
| 
       2414 
2417 
     | 
    
         
             
               */
         
     | 
| 
         @@ -2424,12 +2427,12 @@ Callback that is set using the `onStepFinish` option. 
     | 
|
| 
       2424 
2427 
     | 
    
         | 
| 
       2425 
2428 
     | 
    
         
             
            @param stepResult - The result of the step.
         
     | 
| 
       2426 
2429 
     | 
    
         
             
             */
         
     | 
| 
       2427 
     | 
    
         
            -
            type  
     | 
| 
      
 2430 
     | 
    
         
            +
            type ToolLoopAgentOnStepFinishCallback<TOOLS extends ToolSet = {}> = (stepResult: StepResult<TOOLS>) => Promise<void> | void;
         
     | 
| 
       2428 
2431 
     | 
    
         | 
| 
       2429 
2432 
     | 
    
         
             
            /**
         
     | 
| 
       2430 
2433 
     | 
    
         
             
             * Configuration options for an agent.
         
     | 
| 
       2431 
2434 
     | 
    
         
             
             */
         
     | 
| 
       2432 
     | 
    
         
            -
            type  
     | 
| 
      
 2435 
     | 
    
         
            +
            type ToolLoopAgentSettings<TOOLS extends ToolSet = {}, OUTPUT = never, OUTPUT_PARTIAL = never> = CallSettings & {
         
     | 
| 
       2433 
2436 
     | 
    
         
             
                /**
         
     | 
| 
       2434 
2437 
     | 
    
         
             
                 * The id of the agent.
         
     | 
| 
       2435 
2438 
     | 
    
         
             
                 */
         
     | 
| 
         @@ -2485,11 +2488,11 @@ type BasicAgentSettings<TOOLS extends ToolSet = {}, OUTPUT = never, OUTPUT_PARTI 
     | 
|
| 
       2485 
2488 
     | 
    
         
             
                /**
         
     | 
| 
       2486 
2489 
     | 
    
         
             
                 * Callback that is called when each step (LLM call) is finished, including intermediate steps.
         
     | 
| 
       2487 
2490 
     | 
    
         
             
                 */
         
     | 
| 
       2488 
     | 
    
         
            -
                onStepFinish?:  
     | 
| 
      
 2491 
     | 
    
         
            +
                onStepFinish?: ToolLoopAgentOnStepFinishCallback<NoInfer<TOOLS>>;
         
     | 
| 
       2489 
2492 
     | 
    
         
             
                /**
         
     | 
| 
       2490 
2493 
     | 
    
         
             
                 * Callback that is called when all steps are finished and the response is complete.
         
     | 
| 
       2491 
2494 
     | 
    
         
             
                 */
         
     | 
| 
       2492 
     | 
    
         
            -
                onFinish?:  
     | 
| 
      
 2495 
     | 
    
         
            +
                onFinish?: ToolLoopAgentOnFinishCallback<NoInfer<TOOLS>>;
         
     | 
| 
       2493 
2496 
     | 
    
         
             
                /**
         
     | 
| 
       2494 
2497 
     | 
    
         
             
              Additional provider-specific options. They are passed through
         
     | 
| 
       2495 
2498 
     | 
    
         
             
              to the provider from the AI SDK and enable provider-specific
         
     | 
| 
         @@ -2507,17 +2510,19 @@ type BasicAgentSettings<TOOLS extends ToolSet = {}, OUTPUT = never, OUTPUT_PARTI 
     | 
|
| 
       2507 
2510 
     | 
    
         
             
            };
         
     | 
| 
       2508 
2511 
     | 
    
         | 
| 
       2509 
2512 
     | 
    
         
             
            /**
         
     | 
| 
       2510 
     | 
    
         
            -
             *  
     | 
| 
       2511 
     | 
    
         
            -
             * and  
     | 
| 
       2512 
     | 
    
         
            -
             *
         
     | 
| 
       2513 
     | 
    
         
            -
             * It handles the agent loop for you, allowing the LLM to call tools multiple times in
         
     | 
| 
       2514 
     | 
    
         
            -
             * sequence to accomplish complex tasks.
         
     | 
| 
      
 2513 
     | 
    
         
            +
             * A tool loop agent is an agent that runs tools in a loop. In each step,
         
     | 
| 
      
 2514 
     | 
    
         
            +
             * it calls the LLM, and if there are tool calls, it executes the tools
         
     | 
| 
      
 2515 
     | 
    
         
            +
             * and calls the LLM again in a new step with the tool results.
         
     | 
| 
       2515 
2516 
     | 
    
         
             
             *
         
     | 
| 
       2516 
     | 
    
         
            -
             *  
     | 
| 
      
 2517 
     | 
    
         
            +
             * The loop continues until:
         
     | 
| 
      
 2518 
     | 
    
         
            +
             * - A finish reasoning other than tool-calls is returned, or
         
     | 
| 
      
 2519 
     | 
    
         
            +
             * - A tool that is invoked does not have an execute function, or
         
     | 
| 
      
 2520 
     | 
    
         
            +
             * - A tool call needs approval, or
         
     | 
| 
      
 2521 
     | 
    
         
            +
             * - A stop condition is met (default stop condition is stepCountIs(20))
         
     | 
| 
       2517 
2522 
     | 
    
         
             
             */
         
     | 
| 
       2518 
     | 
    
         
            -
            declare class  
     | 
| 
      
 2523 
     | 
    
         
            +
            declare class ToolLoopAgent<TOOLS extends ToolSet = {}, OUTPUT = never, OUTPUT_PARTIAL = never> implements Agent<TOOLS, OUTPUT, OUTPUT_PARTIAL> {
         
     | 
| 
       2519 
2524 
     | 
    
         
             
                private readonly settings;
         
     | 
| 
       2520 
     | 
    
         
            -
                constructor(settings:  
     | 
| 
      
 2525 
     | 
    
         
            +
                constructor(settings: ToolLoopAgentSettings<TOOLS, OUTPUT, OUTPUT_PARTIAL>);
         
     | 
| 
       2521 
2526 
     | 
    
         
             
                /**
         
     | 
| 
       2522 
2527 
     | 
    
         
             
                 * The id of the agent.
         
     | 
| 
       2523 
2528 
     | 
    
         
             
                 */
         
     | 
| 
         @@ -4906,4 +4911,4 @@ declare global { 
     | 
|
| 
       4906 
4911 
     | 
    
         
             
                var AI_SDK_LOG_WARNINGS: LogWarningsFunction | undefined | false;
         
     | 
| 
       4907 
4912 
     | 
    
         
             
            }
         
     | 
| 
       4908 
4913 
     | 
    
         | 
| 
       4909 
     | 
    
         
            -
            export { AbstractChat, Agent, AsyncIterableStream,  
     | 
| 
      
 4914 
     | 
    
         
            +
            export { AbstractChat, Agent, AsyncIterableStream, CallSettings, CallWarning, ChatAddToolApproveResponseFunction, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreToolMessage, CoreUserMessage, CreateUIMessage, DataUIPart, DeepPartial, DefaultChatTransport, DownloadError, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelUsage, ErrorHandler, ToolLoopAgent as Experimental_Agent, ToolLoopAgentSettings as Experimental_AgentSettings, DownloadFunction as Experimental_DownloadFunction, GenerateImageResult as Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, InferAgentUIMessage as Experimental_InferAgentUIMessage, LogWarningsFunction as Experimental_LogWarningsFunction, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, Warning as Experimental_Warning, FileUIPart, FinishReason, GenerateObjectResult, GenerateTextOnFinishCallback, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedAudioFile, GeneratedFile, HttpChatTransport, HttpChatTransportInitOptions, ImageModel, ImageGenerationWarning as ImageModelCallWarning, ImageModelProviderMetadata, ImageModelResponseMetadata, InferAgentUIMessage, InferUIDataParts, InferUIMessageChunk, InferUITool, InferUITools, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolInputError, JSONRPCError, JSONRPCMessage, JSONRPCNotification, JSONRPCRequest, JSONRPCResponse, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelMiddleware, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, MCPClientError, MCPTransport, MessageConversionError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoOutputSpecifiedError, NoSpeechGeneratedError, NoSuchProviderError, NoSuchToolError, ObjectStreamPart, output as Output, PrepareReconnectToStreamRequest, PrepareSendMessagesRequest, PrepareStepFunction, PrepareStepResult, Prompt, Provider, ProviderMetadata, ProviderRegistryProvider, ReasoningOutput, ReasoningUIPart, RepairTextFunction, RetryError, SafeValidateUIMessagesResult, SerialJobExecutor, SourceDocumentUIPart, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, SpeechWarning, StaticToolCall, StaticToolError, StaticToolOutputDenied, StaticToolResult, StepResult, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, TelemetrySettings, TextStreamChatTransport, TextStreamPart, TextUIPart, ToolApprovalRequestOutput, ToolCallRepairError, ToolCallRepairFunction, ToolChoice, ToolLoopAgent, ToolLoopAgentOnFinishCallback, ToolLoopAgentOnStepFinishCallback, ToolLoopAgentSettings, ToolSet, ToolUIPart, TranscriptionModel, TranscriptionModelResponseMetadata, TranscriptionWarning, TypedToolCall, TypedToolError, TypedToolOutputDenied, TypedToolResult, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessageChunk, UIMessagePart, UIMessageStreamOnFinishCallback, UIMessageStreamOptions, UIMessageStreamWriter, UITool, UIToolInvocation, UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, UseCompletionOptions, assistantModelMessageSchema, callCompletionApi, consumeStream, convertFileListToFileUIParts, convertToCoreMessages, convertToModelMessages, coreAssistantMessageSchema, coreMessageSchema, coreSystemMessageSchema, coreToolMessageSchema, coreUserMessageSchema, cosineSimilarity, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultSettingsMiddleware, embed, embedMany, MCPClient as experimental_MCPClient, MCPClientConfig as experimental_MCPClientConfig, createMCPClient as experimental_createMCPClient, experimental_createProviderRegistry, experimental_customProvider, generateImage as experimental_generateImage, generateSpeech as experimental_generateSpeech, transcribe as experimental_transcribe, extractReasoningMiddleware, generateObject, generateText, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, hasToolCall, isDataUIPart, isDeepEqualData, isToolOrDynamicToolUIPart, isToolUIPart, lastAssistantMessageIsCompleteWithApprovalResponses, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parsePartialJson, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, pruneMessages, readUIMessageStream, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, stepCountIs, streamObject, streamText, systemModelMessageSchema, toolModelMessageSchema, uiMessageChunkSchema, userModelMessageSchema, validateUIMessages, wrapLanguageModel, wrapProvider };
         
     | 
    
        package/dist/index.js
    CHANGED
    
    | 
         @@ -23,11 +23,10 @@ __export(src_exports, { 
     | 
|
| 
       23 
23 
     | 
    
         
             
              AISDKError: () => import_provider18.AISDKError,
         
     | 
| 
       24 
24 
     | 
    
         
             
              APICallError: () => import_provider18.APICallError,
         
     | 
| 
       25 
25 
     | 
    
         
             
              AbstractChat: () => AbstractChat,
         
     | 
| 
       26 
     | 
    
         
            -
              BasicAgent: () => BasicAgent,
         
     | 
| 
       27 
26 
     | 
    
         
             
              DefaultChatTransport: () => DefaultChatTransport,
         
     | 
| 
       28 
27 
     | 
    
         
             
              DownloadError: () => DownloadError,
         
     | 
| 
       29 
28 
     | 
    
         
             
              EmptyResponseBodyError: () => import_provider18.EmptyResponseBodyError,
         
     | 
| 
       30 
     | 
    
         
            -
              Experimental_Agent: () =>  
     | 
| 
      
 29 
     | 
    
         
            +
              Experimental_Agent: () => ToolLoopAgent,
         
     | 
| 
       31 
30 
     | 
    
         
             
              HttpChatTransport: () => HttpChatTransport,
         
     | 
| 
       32 
31 
     | 
    
         
             
              InvalidArgumentError: () => InvalidArgumentError,
         
     | 
| 
       33 
32 
     | 
    
         
             
              InvalidDataContentError: () => InvalidDataContentError,
         
     | 
| 
         @@ -57,6 +56,7 @@ __export(src_exports, { 
     | 
|
| 
       57 
56 
     | 
    
         
             
              TextStreamChatTransport: () => TextStreamChatTransport,
         
     | 
| 
       58 
57 
     | 
    
         
             
              TooManyEmbeddingValuesForCallError: () => import_provider18.TooManyEmbeddingValuesForCallError,
         
     | 
| 
       59 
58 
     | 
    
         
             
              ToolCallRepairError: () => ToolCallRepairError,
         
     | 
| 
      
 59 
     | 
    
         
            +
              ToolLoopAgent: () => ToolLoopAgent,
         
     | 
| 
       60 
60 
     | 
    
         
             
              TypeValidationError: () => import_provider18.TypeValidationError,
         
     | 
| 
       61 
61 
     | 
    
         
             
              UI_MESSAGE_STREAM_HEADERS: () => UI_MESSAGE_STREAM_HEADERS,
         
     | 
| 
       62 
62 
     | 
    
         
             
              UnsupportedFunctionalityError: () => import_provider18.UnsupportedFunctionalityError,
         
     | 
| 
         @@ -870,7 +870,7 @@ function detectMediaType({ 
     | 
|
| 
       870 
870 
     | 
    
         
             
            var import_provider_utils2 = require("@ai-sdk/provider-utils");
         
     | 
| 
       871 
871 
     | 
    
         | 
| 
       872 
872 
     | 
    
         
             
            // src/version.ts
         
     | 
| 
       873 
     | 
    
         
            -
            var VERSION = true ? "6.0.0-beta. 
     | 
| 
      
 873 
     | 
    
         
            +
            var VERSION = true ? "6.0.0-beta.57" : "0.0.0-test";
         
     | 
| 
       874 
874 
     | 
    
         | 
| 
       875 
875 
     | 
    
         
             
            // src/util/download/download.ts
         
     | 
| 
       876 
876 
     | 
    
         
             
            var download = async ({ url }) => {
         
     | 
| 
         @@ -1120,7 +1120,7 @@ function convertToLanguageModelMessage({ 
     | 
|
| 
       1120 
1120 
     | 
    
         
             
                            type: "tool-result",
         
     | 
| 
       1121 
1121 
     | 
    
         
             
                            toolCallId: part.toolCallId,
         
     | 
| 
       1122 
1122 
     | 
    
         
             
                            toolName: part.toolName,
         
     | 
| 
       1123 
     | 
    
         
            -
                            output: part.output,
         
     | 
| 
      
 1123 
     | 
    
         
            +
                            output: mapToolResultOutput(part.output),
         
     | 
| 
       1124 
1124 
     | 
    
         
             
                            providerOptions
         
     | 
| 
       1125 
1125 
     | 
    
         
             
                          };
         
     | 
| 
       1126 
1126 
     | 
    
         
             
                        }
         
     | 
| 
         @@ -1136,7 +1136,7 @@ function convertToLanguageModelMessage({ 
     | 
|
| 
       1136 
1136 
     | 
    
         
             
                      type: "tool-result",
         
     | 
| 
       1137 
1137 
     | 
    
         
             
                      toolCallId: part.toolCallId,
         
     | 
| 
       1138 
1138 
     | 
    
         
             
                      toolName: part.toolName,
         
     | 
| 
       1139 
     | 
    
         
            -
                      output: part.output,
         
     | 
| 
      
 1139 
     | 
    
         
            +
                      output: mapToolResultOutput(part.output),
         
     | 
| 
       1140 
1140 
     | 
    
         
             
                      providerOptions: part.providerOptions
         
     | 
| 
       1141 
1141 
     | 
    
         
             
                    })),
         
     | 
| 
       1142 
1142 
     | 
    
         
             
                    providerOptions: message.providerOptions
         
     | 
| 
         @@ -1243,6 +1243,31 @@ function convertPartToLanguageModelPart(part, downloadedAssets) { 
     | 
|
| 
       1243 
1243 
     | 
    
         
             
                }
         
     | 
| 
       1244 
1244 
     | 
    
         
             
              }
         
     | 
| 
       1245 
1245 
     | 
    
         
             
            }
         
     | 
| 
      
 1246 
     | 
    
         
            +
            function mapToolResultOutput(output) {
         
     | 
| 
      
 1247 
     | 
    
         
            +
              if (output.type !== "content") {
         
     | 
| 
      
 1248 
     | 
    
         
            +
                return output;
         
     | 
| 
      
 1249 
     | 
    
         
            +
              }
         
     | 
| 
      
 1250 
     | 
    
         
            +
              return {
         
     | 
| 
      
 1251 
     | 
    
         
            +
                type: "content",
         
     | 
| 
      
 1252 
     | 
    
         
            +
                value: output.value.map((item) => {
         
     | 
| 
      
 1253 
     | 
    
         
            +
                  if (item.type !== "media") {
         
     | 
| 
      
 1254 
     | 
    
         
            +
                    return item;
         
     | 
| 
      
 1255 
     | 
    
         
            +
                  }
         
     | 
| 
      
 1256 
     | 
    
         
            +
                  if (item.mediaType.startsWith("image/")) {
         
     | 
| 
      
 1257 
     | 
    
         
            +
                    return {
         
     | 
| 
      
 1258 
     | 
    
         
            +
                      type: "image-data",
         
     | 
| 
      
 1259 
     | 
    
         
            +
                      data: item.data,
         
     | 
| 
      
 1260 
     | 
    
         
            +
                      mediaType: item.mediaType
         
     | 
| 
      
 1261 
     | 
    
         
            +
                    };
         
     | 
| 
      
 1262 
     | 
    
         
            +
                  }
         
     | 
| 
      
 1263 
     | 
    
         
            +
                  return {
         
     | 
| 
      
 1264 
     | 
    
         
            +
                    type: "file-data",
         
     | 
| 
      
 1265 
     | 
    
         
            +
                    data: item.data,
         
     | 
| 
      
 1266 
     | 
    
         
            +
                    mediaType: item.mediaType
         
     | 
| 
      
 1267 
     | 
    
         
            +
                  };
         
     | 
| 
      
 1268 
     | 
    
         
            +
                })
         
     | 
| 
      
 1269 
     | 
    
         
            +
              };
         
     | 
| 
      
 1270 
     | 
    
         
            +
            }
         
     | 
| 
       1246 
1271 
     | 
    
         | 
| 
       1247 
1272 
     | 
    
         
             
            // src/prompt/create-tool-model-output.ts
         
     | 
| 
       1248 
1273 
     | 
    
         
             
            var import_provider20 = require("@ai-sdk/provider");
         
     | 
| 
         @@ -1479,44 +1504,90 @@ var toolCallPartSchema = import_v44.z.object({ 
     | 
|
| 
       1479 
1504 
     | 
    
         
             
              providerOptions: providerMetadataSchema.optional(),
         
     | 
| 
       1480 
1505 
     | 
    
         
             
              providerExecuted: import_v44.z.boolean().optional()
         
     | 
| 
       1481 
1506 
     | 
    
         
             
            });
         
     | 
| 
       1482 
     | 
    
         
            -
            var outputSchema = import_v44.z.discriminatedUnion( 
     | 
| 
       1483 
     | 
    
         
            -
               
     | 
| 
       1484 
     | 
    
         
            -
             
     | 
| 
       1485 
     | 
    
         
            -
                 
     | 
| 
       1486 
     | 
    
         
            -
             
     | 
| 
       1487 
     | 
    
         
            -
             
     | 
| 
       1488 
     | 
    
         
            -
             
     | 
| 
       1489 
     | 
    
         
            -
                 
     | 
| 
       1490 
     | 
    
         
            -
             
     | 
| 
       1491 
     | 
    
         
            -
             
     | 
| 
       1492 
     | 
    
         
            -
             
     | 
| 
       1493 
     | 
    
         
            -
             
     | 
| 
       1494 
     | 
    
         
            -
             
     | 
| 
       1495 
     | 
    
         
            -
             
     | 
| 
       1496 
     | 
    
         
            -
             
     | 
| 
       1497 
     | 
    
         
            -
             
     | 
| 
       1498 
     | 
    
         
            -
             
     | 
| 
       1499 
     | 
    
         
            -
             
     | 
| 
       1500 
     | 
    
         
            -
                 
     | 
| 
       1501 
     | 
    
         
            -
             
     | 
| 
       1502 
     | 
    
         
            -
             
     | 
| 
       1503 
     | 
    
         
            -
             
     | 
| 
       1504 
     | 
    
         
            -
                 
     | 
| 
       1505 
     | 
    
         
            -
                 
     | 
| 
       1506 
     | 
    
         
            -
                  import_v44.z. 
     | 
| 
       1507 
     | 
    
         
            -
             
     | 
| 
       1508 
     | 
    
         
            -
             
     | 
| 
       1509 
     | 
    
         
            -
             
     | 
| 
       1510 
     | 
    
         
            -
             
     | 
| 
       1511 
     | 
    
         
            -
             
     | 
| 
       1512 
     | 
    
         
            -
             
     | 
| 
       1513 
     | 
    
         
            -
             
     | 
| 
       1514 
     | 
    
         
            -
                       
     | 
| 
       1515 
     | 
    
         
            -
             
     | 
| 
       1516 
     | 
    
         
            -
             
     | 
| 
       1517 
     | 
    
         
            -
             
     | 
| 
       1518 
     | 
    
         
            -
             
     | 
| 
       1519 
     | 
    
         
            -
             
     | 
| 
      
 1507 
     | 
    
         
            +
            var outputSchema = import_v44.z.discriminatedUnion(
         
     | 
| 
      
 1508 
     | 
    
         
            +
              "type",
         
     | 
| 
      
 1509 
     | 
    
         
            +
              [
         
     | 
| 
      
 1510 
     | 
    
         
            +
                import_v44.z.object({
         
     | 
| 
      
 1511 
     | 
    
         
            +
                  type: import_v44.z.literal("text"),
         
     | 
| 
      
 1512 
     | 
    
         
            +
                  value: import_v44.z.string(),
         
     | 
| 
      
 1513 
     | 
    
         
            +
                  providerOptions: providerMetadataSchema.optional()
         
     | 
| 
      
 1514 
     | 
    
         
            +
                }),
         
     | 
| 
      
 1515 
     | 
    
         
            +
                import_v44.z.object({
         
     | 
| 
      
 1516 
     | 
    
         
            +
                  type: import_v44.z.literal("json"),
         
     | 
| 
      
 1517 
     | 
    
         
            +
                  value: jsonValueSchema,
         
     | 
| 
      
 1518 
     | 
    
         
            +
                  providerOptions: providerMetadataSchema.optional()
         
     | 
| 
      
 1519 
     | 
    
         
            +
                }),
         
     | 
| 
      
 1520 
     | 
    
         
            +
                import_v44.z.object({
         
     | 
| 
      
 1521 
     | 
    
         
            +
                  type: import_v44.z.literal("execution-denied"),
         
     | 
| 
      
 1522 
     | 
    
         
            +
                  reason: import_v44.z.string().optional(),
         
     | 
| 
      
 1523 
     | 
    
         
            +
                  providerOptions: providerMetadataSchema.optional()
         
     | 
| 
      
 1524 
     | 
    
         
            +
                }),
         
     | 
| 
      
 1525 
     | 
    
         
            +
                import_v44.z.object({
         
     | 
| 
      
 1526 
     | 
    
         
            +
                  type: import_v44.z.literal("error-text"),
         
     | 
| 
      
 1527 
     | 
    
         
            +
                  value: import_v44.z.string(),
         
     | 
| 
      
 1528 
     | 
    
         
            +
                  providerOptions: providerMetadataSchema.optional()
         
     | 
| 
      
 1529 
     | 
    
         
            +
                }),
         
     | 
| 
      
 1530 
     | 
    
         
            +
                import_v44.z.object({
         
     | 
| 
      
 1531 
     | 
    
         
            +
                  type: import_v44.z.literal("error-json"),
         
     | 
| 
      
 1532 
     | 
    
         
            +
                  value: jsonValueSchema,
         
     | 
| 
      
 1533 
     | 
    
         
            +
                  providerOptions: providerMetadataSchema.optional()
         
     | 
| 
      
 1534 
     | 
    
         
            +
                }),
         
     | 
| 
      
 1535 
     | 
    
         
            +
                import_v44.z.object({
         
     | 
| 
      
 1536 
     | 
    
         
            +
                  type: import_v44.z.literal("content"),
         
     | 
| 
      
 1537 
     | 
    
         
            +
                  value: import_v44.z.array(
         
     | 
| 
      
 1538 
     | 
    
         
            +
                    import_v44.z.union([
         
     | 
| 
      
 1539 
     | 
    
         
            +
                      import_v44.z.object({
         
     | 
| 
      
 1540 
     | 
    
         
            +
                        type: import_v44.z.literal("text"),
         
     | 
| 
      
 1541 
     | 
    
         
            +
                        text: import_v44.z.string(),
         
     | 
| 
      
 1542 
     | 
    
         
            +
                        providerOptions: providerMetadataSchema.optional()
         
     | 
| 
      
 1543 
     | 
    
         
            +
                      }),
         
     | 
| 
      
 1544 
     | 
    
         
            +
                      import_v44.z.object({
         
     | 
| 
      
 1545 
     | 
    
         
            +
                        type: import_v44.z.literal("media"),
         
     | 
| 
      
 1546 
     | 
    
         
            +
                        data: import_v44.z.string(),
         
     | 
| 
      
 1547 
     | 
    
         
            +
                        mediaType: import_v44.z.string()
         
     | 
| 
      
 1548 
     | 
    
         
            +
                      }),
         
     | 
| 
      
 1549 
     | 
    
         
            +
                      import_v44.z.object({
         
     | 
| 
      
 1550 
     | 
    
         
            +
                        type: import_v44.z.literal("file-data"),
         
     | 
| 
      
 1551 
     | 
    
         
            +
                        data: import_v44.z.string(),
         
     | 
| 
      
 1552 
     | 
    
         
            +
                        mediaType: import_v44.z.string(),
         
     | 
| 
      
 1553 
     | 
    
         
            +
                        filename: import_v44.z.string().optional(),
         
     | 
| 
      
 1554 
     | 
    
         
            +
                        providerOptions: providerMetadataSchema.optional()
         
     | 
| 
      
 1555 
     | 
    
         
            +
                      }),
         
     | 
| 
      
 1556 
     | 
    
         
            +
                      import_v44.z.object({
         
     | 
| 
      
 1557 
     | 
    
         
            +
                        type: import_v44.z.literal("file-url"),
         
     | 
| 
      
 1558 
     | 
    
         
            +
                        url: import_v44.z.string(),
         
     | 
| 
      
 1559 
     | 
    
         
            +
                        providerOptions: providerMetadataSchema.optional()
         
     | 
| 
      
 1560 
     | 
    
         
            +
                      }),
         
     | 
| 
      
 1561 
     | 
    
         
            +
                      import_v44.z.object({
         
     | 
| 
      
 1562 
     | 
    
         
            +
                        type: import_v44.z.literal("file-id"),
         
     | 
| 
      
 1563 
     | 
    
         
            +
                        fileId: import_v44.z.union([import_v44.z.string(), import_v44.z.record(import_v44.z.string(), import_v44.z.string())]),
         
     | 
| 
      
 1564 
     | 
    
         
            +
                        providerOptions: providerMetadataSchema.optional()
         
     | 
| 
      
 1565 
     | 
    
         
            +
                      }),
         
     | 
| 
      
 1566 
     | 
    
         
            +
                      import_v44.z.object({
         
     | 
| 
      
 1567 
     | 
    
         
            +
                        type: import_v44.z.literal("image-data"),
         
     | 
| 
      
 1568 
     | 
    
         
            +
                        data: import_v44.z.string(),
         
     | 
| 
      
 1569 
     | 
    
         
            +
                        mediaType: import_v44.z.string(),
         
     | 
| 
      
 1570 
     | 
    
         
            +
                        providerOptions: providerMetadataSchema.optional()
         
     | 
| 
      
 1571 
     | 
    
         
            +
                      }),
         
     | 
| 
      
 1572 
     | 
    
         
            +
                      import_v44.z.object({
         
     | 
| 
      
 1573 
     | 
    
         
            +
                        type: import_v44.z.literal("image-url"),
         
     | 
| 
      
 1574 
     | 
    
         
            +
                        url: import_v44.z.string(),
         
     | 
| 
      
 1575 
     | 
    
         
            +
                        providerOptions: providerMetadataSchema.optional()
         
     | 
| 
      
 1576 
     | 
    
         
            +
                      }),
         
     | 
| 
      
 1577 
     | 
    
         
            +
                      import_v44.z.object({
         
     | 
| 
      
 1578 
     | 
    
         
            +
                        type: import_v44.z.literal("image-file-id"),
         
     | 
| 
      
 1579 
     | 
    
         
            +
                        fileId: import_v44.z.union([import_v44.z.string(), import_v44.z.record(import_v44.z.string(), import_v44.z.string())]),
         
     | 
| 
      
 1580 
     | 
    
         
            +
                        providerOptions: providerMetadataSchema.optional()
         
     | 
| 
      
 1581 
     | 
    
         
            +
                      }),
         
     | 
| 
      
 1582 
     | 
    
         
            +
                      import_v44.z.object({
         
     | 
| 
      
 1583 
     | 
    
         
            +
                        type: import_v44.z.literal("custom"),
         
     | 
| 
      
 1584 
     | 
    
         
            +
                        providerOptions: providerMetadataSchema.optional()
         
     | 
| 
      
 1585 
     | 
    
         
            +
                      })
         
     | 
| 
      
 1586 
     | 
    
         
            +
                    ])
         
     | 
| 
      
 1587 
     | 
    
         
            +
                  )
         
     | 
| 
      
 1588 
     | 
    
         
            +
                })
         
     | 
| 
      
 1589 
     | 
    
         
            +
              ]
         
     | 
| 
      
 1590 
     | 
    
         
            +
            );
         
     | 
| 
       1520 
1591 
     | 
    
         
             
            var toolResultPartSchema = import_v44.z.object({
         
     | 
| 
       1521 
1592 
     | 
    
         
             
              type: import_v44.z.literal("tool-result"),
         
     | 
| 
       1522 
1593 
     | 
    
         
             
              toolCallId: import_v44.z.string(),
         
     | 
| 
         @@ -6454,8 +6525,8 @@ function convertToModelMessages(messages, options) { 
     | 
|
| 
       6454 
6525 
     | 
    
         
             
            }
         
     | 
| 
       6455 
6526 
     | 
    
         
             
            var convertToCoreMessages = convertToModelMessages;
         
     | 
| 
       6456 
6527 
     | 
    
         | 
| 
       6457 
     | 
    
         
            -
            // src/agent/ 
     | 
| 
       6458 
     | 
    
         
            -
            var  
     | 
| 
      
 6528 
     | 
    
         
            +
            // src/agent/tool-loop-agent.ts
         
     | 
| 
      
 6529 
     | 
    
         
            +
            var ToolLoopAgent = class {
         
     | 
| 
       6459 
6530 
     | 
    
         
             
              constructor(settings) {
         
     | 
| 
       6460 
6531 
     | 
    
         
             
                this.settings = settings;
         
     | 
| 
       6461 
6532 
     | 
    
         
             
              }
         
     | 
| 
         @@ -6498,9 +6569,7 @@ var BasicAgent = class { 
     | 
|
| 
       6498 
6569 
     | 
    
         
             
               */
         
     | 
| 
       6499 
6570 
     | 
    
         
             
              respond(options) {
         
     | 
| 
       6500 
6571 
     | 
    
         
             
                return this.stream({
         
     | 
| 
       6501 
     | 
    
         
            -
                  prompt: convertToModelMessages(options.messages, {
         
     | 
| 
       6502 
     | 
    
         
            -
                    tools: this.tools
         
     | 
| 
       6503 
     | 
    
         
            -
                  })
         
     | 
| 
      
 6572 
     | 
    
         
            +
                  prompt: convertToModelMessages(options.messages, { tools: this.tools })
         
     | 
| 
       6504 
6573 
     | 
    
         
             
                }).toUIMessageStreamResponse();
         
     | 
| 
       6505 
6574 
     | 
    
         
             
              }
         
     | 
| 
       6506 
6575 
     | 
    
         
             
            };
         
     | 
| 
         @@ -11124,7 +11193,6 @@ function readUIMessageStream({ 
     | 
|
| 
       11124 
11193 
     | 
    
         
             
              AISDKError,
         
     | 
| 
       11125 
11194 
     | 
    
         
             
              APICallError,
         
     | 
| 
       11126 
11195 
     | 
    
         
             
              AbstractChat,
         
     | 
| 
       11127 
     | 
    
         
            -
              BasicAgent,
         
     | 
| 
       11128 
11196 
     | 
    
         
             
              DefaultChatTransport,
         
     | 
| 
       11129 
11197 
     | 
    
         
             
              DownloadError,
         
     | 
| 
       11130 
11198 
     | 
    
         
             
              EmptyResponseBodyError,
         
     | 
| 
         @@ -11158,6 +11226,7 @@ function readUIMessageStream({ 
     | 
|
| 
       11158 
11226 
     | 
    
         
             
              TextStreamChatTransport,
         
     | 
| 
       11159 
11227 
     | 
    
         
             
              TooManyEmbeddingValuesForCallError,
         
     | 
| 
       11160 
11228 
     | 
    
         
             
              ToolCallRepairError,
         
     | 
| 
      
 11229 
     | 
    
         
            +
              ToolLoopAgent,
         
     | 
| 
       11161 
11230 
     | 
    
         
             
              TypeValidationError,
         
     | 
| 
       11162 
11231 
     | 
    
         
             
              UI_MESSAGE_STREAM_HEADERS,
         
     | 
| 
       11163 
11232 
     | 
    
         
             
              UnsupportedFunctionalityError,
         
     |