ai 6.0.0-beta.64 → 6.0.0-beta.66
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 +15 -0
 - package/dist/index.d.mts +41 -27
 - package/dist/index.d.ts +41 -27
 - package/dist/index.js +24 -15
 - package/dist/index.js.map +1 -1
 - package/dist/index.mjs +24 -15
 - package/dist/index.mjs.map +1 -1
 - package/dist/internal/index.js +1 -1
 - package/dist/internal/index.mjs +1 -1
 - package/package.json +3 -3
 
    
        package/CHANGELOG.md
    CHANGED
    
    | 
         @@ -1,5 +1,20 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # ai
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            ## 6.0.0-beta.66
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            ### Patch Changes
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            - fca786b: feat(agent): configurable call options
         
     | 
| 
      
 8 
     | 
    
         
            +
            - Updated dependencies [fca786b]
         
     | 
| 
      
 9 
     | 
    
         
            +
              - @ai-sdk/provider-utils@4.0.0-beta.20
         
     | 
| 
      
 10 
     | 
    
         
            +
              - @ai-sdk/gateway@2.0.0-beta.36
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            ## 6.0.0-beta.65
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            ### Patch Changes
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            - dce4e7b: chore(agent): rename system to instructions
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
       3 
18 
     | 
    
         
             
            ## 6.0.0-beta.64
         
     | 
| 
       4 
19 
     | 
    
         | 
| 
       5 
20 
     | 
    
         
             
            ### Patch Changes
         
     | 
    
        package/dist/index.d.mts
    CHANGED
    
    | 
         @@ -1,6 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            export { createGateway, gateway } from '@ai-sdk/gateway';
         
     | 
| 
       2 
2 
     | 
    
         
             
            import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
         
     | 
| 
       3 
     | 
    
         
            -
            import { Tool, InferToolInput, InferToolOutput, AssistantModelMessage, ToolModelMessage, ReasoningPart, FlexibleSchema, InferSchema, ModelMessage, SystemModelMessage, UserModelMessage, ProviderOptions, IdGenerator, ToolCall, Resolvable, FetchFunction, DataContent } from '@ai-sdk/provider-utils';
         
     | 
| 
      
 3 
     | 
    
         
            +
            import { Tool, InferToolInput, InferToolOutput, AssistantModelMessage, ToolModelMessage, ReasoningPart, FlexibleSchema, InferSchema, ModelMessage, SystemModelMessage, UserModelMessage, ProviderOptions, IdGenerator, ToolCall, MaybePromiseLike, Resolvable, FetchFunction, DataContent } from '@ai-sdk/provider-utils';
         
     | 
| 
       4 
4 
     | 
    
         
             
            export { AssistantContent, AssistantModelMessage, DataContent, FilePart, FlexibleSchema, IdGenerator, ImagePart, InferSchema, InferToolInput, InferToolOutput, ModelMessage, Schema, SystemModelMessage, TextPart, Tool, ToolApprovalRequest, ToolApprovalResponse, ToolCallOptions, ToolCallPart, ToolContent, ToolExecuteFunction, ToolModelMessage, ToolResultPart, UserContent, UserModelMessage, asSchema, createIdGenerator, dynamicTool, generateId, jsonSchema, parseJsonEventStream, tool, zodSchema } from '@ai-sdk/provider-utils';
         
     | 
| 
       5 
5 
     | 
    
         
             
            import * as _ai_sdk_provider from '@ai-sdk/provider';
         
     | 
| 
       6 
6 
     | 
    
         
             
            import { EmbeddingModelV3, EmbeddingModelV2, EmbeddingModelV3Embedding, ImageModelV3, ImageModelV3CallWarning, ImageModelV3ProviderMetadata, JSONValue as JSONValue$1, LanguageModelV3, LanguageModelV2, LanguageModelV3FinishReason, LanguageModelV3CallWarning, LanguageModelV3Source, LanguageModelV3Middleware, SharedV3ProviderMetadata, SpeechModelV3, SpeechModelV2, SpeechModelV3CallWarning, TranscriptionModelV3, TranscriptionModelV2, TranscriptionModelV3CallWarning, LanguageModelV3Usage, LanguageModelV3CallOptions, AISDKError, LanguageModelV3ToolCall, JSONSchema7, JSONParseError, TypeValidationError, ProviderV3, ProviderV2, NoSuchModelError, JSONObject } from '@ai-sdk/provider';
         
     | 
| 
         @@ -2380,7 +2380,11 @@ type TextStreamPart<TOOLS extends ToolSet> = { 
     | 
|
| 
       2380 
2380 
     | 
    
         
             
                rawValue: unknown;
         
     | 
| 
       2381 
2381 
     | 
    
         
             
            };
         
     | 
| 
       2382 
2382 
     | 
    
         | 
| 
       2383 
     | 
    
         
            -
            type AgentCallParameters = {
         
     | 
| 
      
 2383 
     | 
    
         
            +
            type AgentCallParameters<CALL_OPTIONS> = ([CALL_OPTIONS] extends [never] ? {
         
     | 
| 
      
 2384 
     | 
    
         
            +
                options?: never;
         
     | 
| 
      
 2385 
     | 
    
         
            +
            } : {
         
     | 
| 
      
 2386 
     | 
    
         
            +
                options: CALL_OPTIONS;
         
     | 
| 
      
 2387 
     | 
    
         
            +
            }) & ({
         
     | 
| 
       2384 
2388 
     | 
    
         
             
                /**
         
     | 
| 
       2385 
2389 
     | 
    
         
             
                 * A prompt. It can be either a text prompt or a list of messages.
         
     | 
| 
       2386 
2390 
     | 
    
         
             
                 *
         
     | 
| 
         @@ -2406,7 +2410,7 @@ type AgentCallParameters = { 
     | 
|
| 
       2406 
2410 
     | 
    
         
             
                 * You can either use `prompt` or `messages` but not both.
         
     | 
| 
       2407 
2411 
     | 
    
         
             
                 */
         
     | 
| 
       2408 
2412 
     | 
    
         
             
                prompt?: never;
         
     | 
| 
       2409 
     | 
    
         
            -
            };
         
     | 
| 
      
 2413 
     | 
    
         
            +
            });
         
     | 
| 
       2410 
2414 
     | 
    
         
             
            /**
         
     | 
| 
       2411 
2415 
     | 
    
         
             
             * An Agent receives a prompt (text or messages) and generates or streams an output
         
     | 
| 
       2412 
2416 
     | 
    
         
             
             * that consists of steps, tool calls, data parts, etc.
         
     | 
| 
         @@ -2414,7 +2418,7 @@ type AgentCallParameters = { 
     | 
|
| 
       2414 
2418 
     | 
    
         
             
             * You can implement your own Agent by implementing the `Agent` interface,
         
     | 
| 
       2415 
2419 
     | 
    
         
             
             * or use the `ToolLoopAgent` class.
         
     | 
| 
       2416 
2420 
     | 
    
         
             
             */
         
     | 
| 
       2417 
     | 
    
         
            -
            interface Agent<TOOLS extends ToolSet = {}, OUTPUT extends Output = never> {
         
     | 
| 
      
 2421 
     | 
    
         
            +
            interface Agent<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends Output = never> {
         
     | 
| 
       2418 
2422 
     | 
    
         
             
                /**
         
     | 
| 
       2419 
2423 
     | 
    
         
             
                 * The specification version of the agent interface. This will enable
         
     | 
| 
       2420 
2424 
     | 
    
         
             
                 * us to evolve the agent interface and retain backwards compatibility.
         
     | 
| 
         @@ -2431,11 +2435,11 @@ interface Agent<TOOLS extends ToolSet = {}, OUTPUT extends Output = never> { 
     | 
|
| 
       2431 
2435 
     | 
    
         
             
                /**
         
     | 
| 
       2432 
2436 
     | 
    
         
             
                 * Generates an output from the agent (non-streaming).
         
     | 
| 
       2433 
2437 
     | 
    
         
             
                 */
         
     | 
| 
       2434 
     | 
    
         
            -
                generate(options: AgentCallParameters): PromiseLike<GenerateTextResult<TOOLS, InferGenerateOutput<OUTPUT>>>;
         
     | 
| 
      
 2438 
     | 
    
         
            +
                generate(options: AgentCallParameters<CALL_OPTIONS>): PromiseLike<GenerateTextResult<TOOLS, InferGenerateOutput<OUTPUT>>>;
         
     | 
| 
       2435 
2439 
     | 
    
         
             
                /**
         
     | 
| 
       2436 
2440 
     | 
    
         
             
                 * Streams an output from the agent (streaming).
         
     | 
| 
       2437 
2441 
     | 
    
         
             
                 */
         
     | 
| 
       2438 
     | 
    
         
            -
                stream(options: AgentCallParameters): StreamTextResult<TOOLS, InferStreamOutput<OUTPUT 
     | 
| 
      
 2442 
     | 
    
         
            +
                stream(options: AgentCallParameters<CALL_OPTIONS>): PromiseLike<StreamTextResult<TOOLS, InferStreamOutput<OUTPUT>>>;
         
     | 
| 
       2439 
2443 
     | 
    
         
             
            }
         
     | 
| 
       2440 
2444 
     | 
    
         | 
| 
       2441 
2445 
     | 
    
         
             
            /**
         
     | 
| 
         @@ -2464,15 +2468,15 @@ type ToolLoopAgentOnStepFinishCallback<TOOLS extends ToolSet = {}> = (stepResult 
     | 
|
| 
       2464 
2468 
     | 
    
         
             
            /**
         
     | 
| 
       2465 
2469 
     | 
    
         
             
             * Configuration options for an agent.
         
     | 
| 
       2466 
2470 
     | 
    
         
             
             */
         
     | 
| 
       2467 
     | 
    
         
            -
            type ToolLoopAgentSettings<TOOLS extends ToolSet = {}, OUTPUT extends Output = never> = CallSettings & {
         
     | 
| 
      
 2471 
     | 
    
         
            +
            type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends Output = never> = CallSettings & {
         
     | 
| 
       2468 
2472 
     | 
    
         
             
                /**
         
     | 
| 
       2469 
2473 
     | 
    
         
             
                 * The id of the agent.
         
     | 
| 
       2470 
2474 
     | 
    
         
             
                 */
         
     | 
| 
       2471 
2475 
     | 
    
         
             
                id?: string;
         
     | 
| 
       2472 
2476 
     | 
    
         
             
                /**
         
     | 
| 
       2473 
     | 
    
         
            -
                 * The  
     | 
| 
      
 2477 
     | 
    
         
            +
                 * The instructions for the agent.
         
     | 
| 
       2474 
2478 
     | 
    
         
             
                 */
         
     | 
| 
       2475 
     | 
    
         
            -
                 
     | 
| 
      
 2479 
     | 
    
         
            +
                instructions?: string;
         
     | 
| 
       2476 
2480 
     | 
    
         
             
                /**
         
     | 
| 
       2477 
2481 
     | 
    
         
             
              The language model to use.
         
     | 
| 
       2478 
2482 
     | 
    
         
             
                 */
         
     | 
| 
         @@ -2506,10 +2510,6 @@ type ToolLoopAgentSettings<TOOLS extends ToolSet = {}, OUTPUT extends Output = n 
     | 
|
| 
       2506 
2510 
     | 
    
         
             
                 */
         
     | 
| 
       2507 
2511 
     | 
    
         
             
                experimental_output?: OUTPUT;
         
     | 
| 
       2508 
2512 
     | 
    
         
             
                /**
         
     | 
| 
       2509 
     | 
    
         
            -
                 * @deprecated Use `prepareStep` instead.
         
     | 
| 
       2510 
     | 
    
         
            -
                 */
         
     | 
| 
       2511 
     | 
    
         
            -
                experimental_prepareStep?: PrepareStepFunction<NoInfer<TOOLS>>;
         
     | 
| 
       2512 
     | 
    
         
            -
                /**
         
     | 
| 
       2513 
2513 
     | 
    
         
             
              Optional function that you can use to provide different settings for a step.
         
     | 
| 
       2514 
2514 
     | 
    
         
             
                */
         
     | 
| 
       2515 
2515 
     | 
    
         
             
                prepareStep?: PrepareStepFunction<NoInfer<TOOLS>>;
         
     | 
| 
         @@ -2539,6 +2539,16 @@ type ToolLoopAgentSettings<TOOLS extends ToolSet = {}, OUTPUT extends Output = n 
     | 
|
| 
       2539 
2539 
     | 
    
         
             
                 * @default undefined
         
     | 
| 
       2540 
2540 
     | 
    
         
             
                 */
         
     | 
| 
       2541 
2541 
     | 
    
         
             
                experimental_context?: unknown;
         
     | 
| 
      
 2542 
     | 
    
         
            +
                /**
         
     | 
| 
      
 2543 
     | 
    
         
            +
                 * The schema for the call options.
         
     | 
| 
      
 2544 
     | 
    
         
            +
                 */
         
     | 
| 
      
 2545 
     | 
    
         
            +
                callOptionsSchema?: FlexibleSchema<CALL_OPTIONS>;
         
     | 
| 
      
 2546 
     | 
    
         
            +
                /**
         
     | 
| 
      
 2547 
     | 
    
         
            +
                 * Prepare the parameters for the generateText or streamText call.
         
     | 
| 
      
 2548 
     | 
    
         
            +
                 *
         
     | 
| 
      
 2549 
     | 
    
         
            +
                 * You can use this to have templates based on call options.
         
     | 
| 
      
 2550 
     | 
    
         
            +
                 */
         
     | 
| 
      
 2551 
     | 
    
         
            +
                prepareCall?: (options: AgentCallParameters<CALL_OPTIONS> & Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>, 'model' | 'tools' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'headers' | 'instructions' | 'stopWhen' | 'experimental_telemetry' | 'activeTools' | 'providerOptions' | 'experimental_context'>) => MaybePromiseLike<Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>, 'model' | 'tools' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'headers' | 'instructions' | 'stopWhen' | 'experimental_telemetry' | 'activeTools' | 'providerOptions' | 'experimental_context'> & Omit<Prompt, 'system'>>;
         
     | 
| 
       2542 
2552 
     | 
    
         
             
            };
         
     | 
| 
       2543 
2553 
     | 
    
         | 
| 
       2544 
2554 
     | 
    
         
             
            /**
         
     | 
| 
         @@ -2552,10 +2562,10 @@ type ToolLoopAgentSettings<TOOLS extends ToolSet = {}, OUTPUT extends Output = n 
     | 
|
| 
       2552 
2562 
     | 
    
         
             
             * - A tool call needs approval, or
         
     | 
| 
       2553 
2563 
     | 
    
         
             
             * - A stop condition is met (default stop condition is stepCountIs(20))
         
     | 
| 
       2554 
2564 
     | 
    
         
             
             */
         
     | 
| 
       2555 
     | 
    
         
            -
            declare class ToolLoopAgent<TOOLS extends ToolSet = {}, OUTPUT extends Output = never> implements Agent<TOOLS, OUTPUT> {
         
     | 
| 
      
 2565 
     | 
    
         
            +
            declare class ToolLoopAgent<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends Output = never> implements Agent<CALL_OPTIONS, TOOLS, OUTPUT> {
         
     | 
| 
       2556 
2566 
     | 
    
         
             
                readonly version = "agent-v1";
         
     | 
| 
       2557 
2567 
     | 
    
         
             
                private readonly settings;
         
     | 
| 
       2558 
     | 
    
         
            -
                constructor(settings: ToolLoopAgentSettings<TOOLS, OUTPUT>);
         
     | 
| 
      
 2568 
     | 
    
         
            +
                constructor(settings: ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>);
         
     | 
| 
       2559 
2569 
     | 
    
         
             
                /**
         
     | 
| 
       2560 
2570 
     | 
    
         
             
                 * The id of the agent.
         
     | 
| 
       2561 
2571 
     | 
    
         
             
                 */
         
     | 
| 
         @@ -2564,20 +2574,21 @@ declare class ToolLoopAgent<TOOLS extends ToolSet = {}, OUTPUT extends Output = 
     | 
|
| 
       2564 
2574 
     | 
    
         
             
                 * The tools that the agent can use.
         
     | 
| 
       2565 
2575 
     | 
    
         
             
                 */
         
     | 
| 
       2566 
2576 
     | 
    
         
             
                get tools(): TOOLS;
         
     | 
| 
      
 2577 
     | 
    
         
            +
                private prepareCall;
         
     | 
| 
       2567 
2578 
     | 
    
         
             
                /**
         
     | 
| 
       2568 
2579 
     | 
    
         
             
                 * Generates an output from the agent (non-streaming).
         
     | 
| 
       2569 
2580 
     | 
    
         
             
                 */
         
     | 
| 
       2570 
     | 
    
         
            -
                generate(options: AgentCallParameters): Promise<GenerateTextResult<TOOLS, InferGenerateOutput<OUTPUT>>>;
         
     | 
| 
      
 2581 
     | 
    
         
            +
                generate(options: AgentCallParameters<CALL_OPTIONS>): Promise<GenerateTextResult<TOOLS, InferGenerateOutput<OUTPUT>>>;
         
     | 
| 
       2571 
2582 
     | 
    
         
             
                /**
         
     | 
| 
       2572 
2583 
     | 
    
         
             
                 * Streams an output from the agent (streaming).
         
     | 
| 
       2573 
2584 
     | 
    
         
             
                 */
         
     | 
| 
       2574 
     | 
    
         
            -
                stream(options: AgentCallParameters): StreamTextResult<TOOLS, InferStreamOutput<OUTPUT 
     | 
| 
      
 2585 
     | 
    
         
            +
                stream(options: AgentCallParameters<CALL_OPTIONS>): Promise<StreamTextResult<TOOLS, InferStreamOutput<OUTPUT>>>;
         
     | 
| 
       2575 
2586 
     | 
    
         
             
            }
         
     | 
| 
       2576 
2587 
     | 
    
         | 
| 
       2577 
2588 
     | 
    
         
             
            /**
         
     | 
| 
       2578 
2589 
     | 
    
         
             
             * Infer the type of the tools of an agent.
         
     | 
| 
       2579 
2590 
     | 
    
         
             
             */
         
     | 
| 
       2580 
     | 
    
         
            -
            type InferAgentTools<AGENT> = AGENT extends Agent<infer TOOLS,  
     | 
| 
      
 2591 
     | 
    
         
            +
            type InferAgentTools<AGENT> = AGENT extends Agent<any, infer TOOLS, any> ? TOOLS : never;
         
     | 
| 
       2581 
2592 
     | 
    
         | 
| 
       2582 
2593 
     | 
    
         
             
            /**
         
     | 
| 
       2583 
2594 
     | 
    
         
             
             * Infer the UI message type of an agent.
         
     | 
| 
         @@ -2592,10 +2603,11 @@ type InferAgentUIMessage<AGENT> = UIMessage<never, never, InferUITools<InferAgen 
     | 
|
| 
       2592 
2603 
     | 
    
         
             
             *
         
     | 
| 
       2593 
2604 
     | 
    
         
             
             * @returns The response object.
         
     | 
| 
       2594 
2605 
     | 
    
         
             
             */
         
     | 
| 
       2595 
     | 
    
         
            -
            declare function createAgentUIStreamResponse<TOOLS extends ToolSet = {}, OUTPUT extends Output = never>({ headers, status, statusText, consumeSseStream, ...options }: {
         
     | 
| 
       2596 
     | 
    
         
            -
                agent: Agent<TOOLS, OUTPUT>;
         
     | 
| 
      
 2606 
     | 
    
         
            +
            declare function createAgentUIStreamResponse<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends Output = never, MESSAGE_METADATA = unknown>({ headers, status, statusText, consumeSseStream, ...options }: {
         
     | 
| 
      
 2607 
     | 
    
         
            +
                agent: Agent<CALL_OPTIONS, TOOLS, OUTPUT>;
         
     | 
| 
       2597 
2608 
     | 
    
         
             
                messages: unknown[];
         
     | 
| 
       2598 
     | 
    
         
            -
             
     | 
| 
      
 2609 
     | 
    
         
            +
                options?: CALL_OPTIONS;
         
     | 
| 
      
 2610 
     | 
    
         
            +
            } & UIMessageStreamResponseInit & UIMessageStreamOptions<UIMessage<MESSAGE_METADATA, never, InferUITools<TOOLS>>>): Promise<Response>;
         
     | 
| 
       2599 
2611 
     | 
    
         | 
| 
       2600 
2612 
     | 
    
         
             
            declare const getOriginalFetch: () => typeof fetch;
         
     | 
| 
       2601 
2613 
     | 
    
         
             
            declare function callCompletionApi({ api, prompt, credentials, headers, body, streamProtocol, setCompletion, setLoading, setError, setAbortController, onFinish, onError, fetch, }: {
         
     | 
| 
         @@ -3245,10 +3257,11 @@ declare const UI_MESSAGE_STREAM_HEADERS: { 
     | 
|
| 
       3245 
3257 
     | 
    
         
             
             *
         
     | 
| 
       3246 
3258 
     | 
    
         
             
             * @returns The UI message stream.
         
     | 
| 
       3247 
3259 
     | 
    
         
             
             */
         
     | 
| 
       3248 
     | 
    
         
            -
            declare function createAgentUIStream<TOOLS extends ToolSet = {}, OUTPUT extends Output = never>({ agent, messages, ...uiMessageStreamOptions }: {
         
     | 
| 
       3249 
     | 
    
         
            -
                agent: Agent<TOOLS, OUTPUT>;
         
     | 
| 
      
 3260 
     | 
    
         
            +
            declare function createAgentUIStream<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends Output = never, MESSAGE_METADATA = unknown>({ agent, messages, options, ...uiMessageStreamOptions }: {
         
     | 
| 
      
 3261 
     | 
    
         
            +
                agent: Agent<CALL_OPTIONS, TOOLS, OUTPUT>;
         
     | 
| 
       3250 
3262 
     | 
    
         
             
                messages: unknown[];
         
     | 
| 
       3251 
     | 
    
         
            -
             
     | 
| 
      
 3263 
     | 
    
         
            +
                options?: CALL_OPTIONS;
         
     | 
| 
      
 3264 
     | 
    
         
            +
            } & UIMessageStreamOptions<UIMessage<MESSAGE_METADATA, never, InferUITools<TOOLS>>>): Promise<AsyncIterableStream<InferUIMessageChunk<UIMessage<MESSAGE_METADATA, never, InferUITools<TOOLS>>>>>;
         
     | 
| 
       3252 
3265 
     | 
    
         | 
| 
       3253 
3266 
     | 
    
         
             
            /**
         
     | 
| 
       3254 
3267 
     | 
    
         
             
             * Pipes the agent UI message stream to a Node.js ServerResponse object.
         
     | 
| 
         @@ -3256,11 +3269,12 @@ declare function createAgentUIStream<TOOLS extends ToolSet = {}, OUTPUT extends 
     | 
|
| 
       3256 
3269 
     | 
    
         
             
             * @param agent - The agent to run.
         
     | 
| 
       3257 
3270 
     | 
    
         
             
             * @param messages - The input UI messages.
         
     | 
| 
       3258 
3271 
     | 
    
         
             
             */
         
     | 
| 
       3259 
     | 
    
         
            -
            declare function pipeAgentUIStreamToResponse<TOOLS extends ToolSet = {}, OUTPUT extends Output = never>({ response, headers, status, statusText, consumeSseStream, ...options }: {
         
     | 
| 
      
 3272 
     | 
    
         
            +
            declare function pipeAgentUIStreamToResponse<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends Output = never, MESSAGE_METADATA = unknown>({ response, headers, status, statusText, consumeSseStream, ...options }: {
         
     | 
| 
       3260 
3273 
     | 
    
         
             
                response: ServerResponse;
         
     | 
| 
       3261 
     | 
    
         
            -
                agent: Agent<TOOLS, OUTPUT>;
         
     | 
| 
      
 3274 
     | 
    
         
            +
                agent: Agent<CALL_OPTIONS, TOOLS, OUTPUT>;
         
     | 
| 
       3262 
3275 
     | 
    
         
             
                messages: unknown[];
         
     | 
| 
       3263 
     | 
    
         
            -
             
     | 
| 
      
 3276 
     | 
    
         
            +
                options?: CALL_OPTIONS;
         
     | 
| 
      
 3277 
     | 
    
         
            +
            } & UIMessageStreamResponseInit & UIMessageStreamOptions<UIMessage<MESSAGE_METADATA, never, InferUITools<TOOLS>>>): Promise<void>;
         
     | 
| 
       3264 
3278 
     | 
    
         | 
| 
       3265 
3279 
     | 
    
         
             
            /**
         
     | 
| 
       3266 
3280 
     | 
    
         
             
            The result of an `embed` call.
         
     | 
    
        package/dist/index.d.ts
    CHANGED
    
    | 
         @@ -1,6 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            export { createGateway, gateway } from '@ai-sdk/gateway';
         
     | 
| 
       2 
2 
     | 
    
         
             
            import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
         
     | 
| 
       3 
     | 
    
         
            -
            import { Tool, InferToolInput, InferToolOutput, AssistantModelMessage, ToolModelMessage, ReasoningPart, FlexibleSchema, InferSchema, ModelMessage, SystemModelMessage, UserModelMessage, ProviderOptions, IdGenerator, ToolCall, Resolvable, FetchFunction, DataContent } from '@ai-sdk/provider-utils';
         
     | 
| 
      
 3 
     | 
    
         
            +
            import { Tool, InferToolInput, InferToolOutput, AssistantModelMessage, ToolModelMessage, ReasoningPart, FlexibleSchema, InferSchema, ModelMessage, SystemModelMessage, UserModelMessage, ProviderOptions, IdGenerator, ToolCall, MaybePromiseLike, Resolvable, FetchFunction, DataContent } from '@ai-sdk/provider-utils';
         
     | 
| 
       4 
4 
     | 
    
         
             
            export { AssistantContent, AssistantModelMessage, DataContent, FilePart, FlexibleSchema, IdGenerator, ImagePart, InferSchema, InferToolInput, InferToolOutput, ModelMessage, Schema, SystemModelMessage, TextPart, Tool, ToolApprovalRequest, ToolApprovalResponse, ToolCallOptions, ToolCallPart, ToolContent, ToolExecuteFunction, ToolModelMessage, ToolResultPart, UserContent, UserModelMessage, asSchema, createIdGenerator, dynamicTool, generateId, jsonSchema, parseJsonEventStream, tool, zodSchema } from '@ai-sdk/provider-utils';
         
     | 
| 
       5 
5 
     | 
    
         
             
            import * as _ai_sdk_provider from '@ai-sdk/provider';
         
     | 
| 
       6 
6 
     | 
    
         
             
            import { EmbeddingModelV3, EmbeddingModelV2, EmbeddingModelV3Embedding, ImageModelV3, ImageModelV3CallWarning, ImageModelV3ProviderMetadata, JSONValue as JSONValue$1, LanguageModelV3, LanguageModelV2, LanguageModelV3FinishReason, LanguageModelV3CallWarning, LanguageModelV3Source, LanguageModelV3Middleware, SharedV3ProviderMetadata, SpeechModelV3, SpeechModelV2, SpeechModelV3CallWarning, TranscriptionModelV3, TranscriptionModelV2, TranscriptionModelV3CallWarning, LanguageModelV3Usage, LanguageModelV3CallOptions, AISDKError, LanguageModelV3ToolCall, JSONSchema7, JSONParseError, TypeValidationError, ProviderV3, ProviderV2, NoSuchModelError, JSONObject } from '@ai-sdk/provider';
         
     | 
| 
         @@ -2380,7 +2380,11 @@ type TextStreamPart<TOOLS extends ToolSet> = { 
     | 
|
| 
       2380 
2380 
     | 
    
         
             
                rawValue: unknown;
         
     | 
| 
       2381 
2381 
     | 
    
         
             
            };
         
     | 
| 
       2382 
2382 
     | 
    
         | 
| 
       2383 
     | 
    
         
            -
            type AgentCallParameters = {
         
     | 
| 
      
 2383 
     | 
    
         
            +
            type AgentCallParameters<CALL_OPTIONS> = ([CALL_OPTIONS] extends [never] ? {
         
     | 
| 
      
 2384 
     | 
    
         
            +
                options?: never;
         
     | 
| 
      
 2385 
     | 
    
         
            +
            } : {
         
     | 
| 
      
 2386 
     | 
    
         
            +
                options: CALL_OPTIONS;
         
     | 
| 
      
 2387 
     | 
    
         
            +
            }) & ({
         
     | 
| 
       2384 
2388 
     | 
    
         
             
                /**
         
     | 
| 
       2385 
2389 
     | 
    
         
             
                 * A prompt. It can be either a text prompt or a list of messages.
         
     | 
| 
       2386 
2390 
     | 
    
         
             
                 *
         
     | 
| 
         @@ -2406,7 +2410,7 @@ type AgentCallParameters = { 
     | 
|
| 
       2406 
2410 
     | 
    
         
             
                 * You can either use `prompt` or `messages` but not both.
         
     | 
| 
       2407 
2411 
     | 
    
         
             
                 */
         
     | 
| 
       2408 
2412 
     | 
    
         
             
                prompt?: never;
         
     | 
| 
       2409 
     | 
    
         
            -
            };
         
     | 
| 
      
 2413 
     | 
    
         
            +
            });
         
     | 
| 
       2410 
2414 
     | 
    
         
             
            /**
         
     | 
| 
       2411 
2415 
     | 
    
         
             
             * An Agent receives a prompt (text or messages) and generates or streams an output
         
     | 
| 
       2412 
2416 
     | 
    
         
             
             * that consists of steps, tool calls, data parts, etc.
         
     | 
| 
         @@ -2414,7 +2418,7 @@ type AgentCallParameters = { 
     | 
|
| 
       2414 
2418 
     | 
    
         
             
             * You can implement your own Agent by implementing the `Agent` interface,
         
     | 
| 
       2415 
2419 
     | 
    
         
             
             * or use the `ToolLoopAgent` class.
         
     | 
| 
       2416 
2420 
     | 
    
         
             
             */
         
     | 
| 
       2417 
     | 
    
         
            -
            interface Agent<TOOLS extends ToolSet = {}, OUTPUT extends Output = never> {
         
     | 
| 
      
 2421 
     | 
    
         
            +
            interface Agent<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends Output = never> {
         
     | 
| 
       2418 
2422 
     | 
    
         
             
                /**
         
     | 
| 
       2419 
2423 
     | 
    
         
             
                 * The specification version of the agent interface. This will enable
         
     | 
| 
       2420 
2424 
     | 
    
         
             
                 * us to evolve the agent interface and retain backwards compatibility.
         
     | 
| 
         @@ -2431,11 +2435,11 @@ interface Agent<TOOLS extends ToolSet = {}, OUTPUT extends Output = never> { 
     | 
|
| 
       2431 
2435 
     | 
    
         
             
                /**
         
     | 
| 
       2432 
2436 
     | 
    
         
             
                 * Generates an output from the agent (non-streaming).
         
     | 
| 
       2433 
2437 
     | 
    
         
             
                 */
         
     | 
| 
       2434 
     | 
    
         
            -
                generate(options: AgentCallParameters): PromiseLike<GenerateTextResult<TOOLS, InferGenerateOutput<OUTPUT>>>;
         
     | 
| 
      
 2438 
     | 
    
         
            +
                generate(options: AgentCallParameters<CALL_OPTIONS>): PromiseLike<GenerateTextResult<TOOLS, InferGenerateOutput<OUTPUT>>>;
         
     | 
| 
       2435 
2439 
     | 
    
         
             
                /**
         
     | 
| 
       2436 
2440 
     | 
    
         
             
                 * Streams an output from the agent (streaming).
         
     | 
| 
       2437 
2441 
     | 
    
         
             
                 */
         
     | 
| 
       2438 
     | 
    
         
            -
                stream(options: AgentCallParameters): StreamTextResult<TOOLS, InferStreamOutput<OUTPUT 
     | 
| 
      
 2442 
     | 
    
         
            +
                stream(options: AgentCallParameters<CALL_OPTIONS>): PromiseLike<StreamTextResult<TOOLS, InferStreamOutput<OUTPUT>>>;
         
     | 
| 
       2439 
2443 
     | 
    
         
             
            }
         
     | 
| 
       2440 
2444 
     | 
    
         | 
| 
       2441 
2445 
     | 
    
         
             
            /**
         
     | 
| 
         @@ -2464,15 +2468,15 @@ type ToolLoopAgentOnStepFinishCallback<TOOLS extends ToolSet = {}> = (stepResult 
     | 
|
| 
       2464 
2468 
     | 
    
         
             
            /**
         
     | 
| 
       2465 
2469 
     | 
    
         
             
             * Configuration options for an agent.
         
     | 
| 
       2466 
2470 
     | 
    
         
             
             */
         
     | 
| 
       2467 
     | 
    
         
            -
            type ToolLoopAgentSettings<TOOLS extends ToolSet = {}, OUTPUT extends Output = never> = CallSettings & {
         
     | 
| 
      
 2471 
     | 
    
         
            +
            type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends Output = never> = CallSettings & {
         
     | 
| 
       2468 
2472 
     | 
    
         
             
                /**
         
     | 
| 
       2469 
2473 
     | 
    
         
             
                 * The id of the agent.
         
     | 
| 
       2470 
2474 
     | 
    
         
             
                 */
         
     | 
| 
       2471 
2475 
     | 
    
         
             
                id?: string;
         
     | 
| 
       2472 
2476 
     | 
    
         
             
                /**
         
     | 
| 
       2473 
     | 
    
         
            -
                 * The  
     | 
| 
      
 2477 
     | 
    
         
            +
                 * The instructions for the agent.
         
     | 
| 
       2474 
2478 
     | 
    
         
             
                 */
         
     | 
| 
       2475 
     | 
    
         
            -
                 
     | 
| 
      
 2479 
     | 
    
         
            +
                instructions?: string;
         
     | 
| 
       2476 
2480 
     | 
    
         
             
                /**
         
     | 
| 
       2477 
2481 
     | 
    
         
             
              The language model to use.
         
     | 
| 
       2478 
2482 
     | 
    
         
             
                 */
         
     | 
| 
         @@ -2506,10 +2510,6 @@ type ToolLoopAgentSettings<TOOLS extends ToolSet = {}, OUTPUT extends Output = n 
     | 
|
| 
       2506 
2510 
     | 
    
         
             
                 */
         
     | 
| 
       2507 
2511 
     | 
    
         
             
                experimental_output?: OUTPUT;
         
     | 
| 
       2508 
2512 
     | 
    
         
             
                /**
         
     | 
| 
       2509 
     | 
    
         
            -
                 * @deprecated Use `prepareStep` instead.
         
     | 
| 
       2510 
     | 
    
         
            -
                 */
         
     | 
| 
       2511 
     | 
    
         
            -
                experimental_prepareStep?: PrepareStepFunction<NoInfer<TOOLS>>;
         
     | 
| 
       2512 
     | 
    
         
            -
                /**
         
     | 
| 
       2513 
2513 
     | 
    
         
             
              Optional function that you can use to provide different settings for a step.
         
     | 
| 
       2514 
2514 
     | 
    
         
             
                */
         
     | 
| 
       2515 
2515 
     | 
    
         
             
                prepareStep?: PrepareStepFunction<NoInfer<TOOLS>>;
         
     | 
| 
         @@ -2539,6 +2539,16 @@ type ToolLoopAgentSettings<TOOLS extends ToolSet = {}, OUTPUT extends Output = n 
     | 
|
| 
       2539 
2539 
     | 
    
         
             
                 * @default undefined
         
     | 
| 
       2540 
2540 
     | 
    
         
             
                 */
         
     | 
| 
       2541 
2541 
     | 
    
         
             
                experimental_context?: unknown;
         
     | 
| 
      
 2542 
     | 
    
         
            +
                /**
         
     | 
| 
      
 2543 
     | 
    
         
            +
                 * The schema for the call options.
         
     | 
| 
      
 2544 
     | 
    
         
            +
                 */
         
     | 
| 
      
 2545 
     | 
    
         
            +
                callOptionsSchema?: FlexibleSchema<CALL_OPTIONS>;
         
     | 
| 
      
 2546 
     | 
    
         
            +
                /**
         
     | 
| 
      
 2547 
     | 
    
         
            +
                 * Prepare the parameters for the generateText or streamText call.
         
     | 
| 
      
 2548 
     | 
    
         
            +
                 *
         
     | 
| 
      
 2549 
     | 
    
         
            +
                 * You can use this to have templates based on call options.
         
     | 
| 
      
 2550 
     | 
    
         
            +
                 */
         
     | 
| 
      
 2551 
     | 
    
         
            +
                prepareCall?: (options: AgentCallParameters<CALL_OPTIONS> & Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>, 'model' | 'tools' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'headers' | 'instructions' | 'stopWhen' | 'experimental_telemetry' | 'activeTools' | 'providerOptions' | 'experimental_context'>) => MaybePromiseLike<Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>, 'model' | 'tools' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'headers' | 'instructions' | 'stopWhen' | 'experimental_telemetry' | 'activeTools' | 'providerOptions' | 'experimental_context'> & Omit<Prompt, 'system'>>;
         
     | 
| 
       2542 
2552 
     | 
    
         
             
            };
         
     | 
| 
       2543 
2553 
     | 
    
         | 
| 
       2544 
2554 
     | 
    
         
             
            /**
         
     | 
| 
         @@ -2552,10 +2562,10 @@ type ToolLoopAgentSettings<TOOLS extends ToolSet = {}, OUTPUT extends Output = n 
     | 
|
| 
       2552 
2562 
     | 
    
         
             
             * - A tool call needs approval, or
         
     | 
| 
       2553 
2563 
     | 
    
         
             
             * - A stop condition is met (default stop condition is stepCountIs(20))
         
     | 
| 
       2554 
2564 
     | 
    
         
             
             */
         
     | 
| 
       2555 
     | 
    
         
            -
            declare class ToolLoopAgent<TOOLS extends ToolSet = {}, OUTPUT extends Output = never> implements Agent<TOOLS, OUTPUT> {
         
     | 
| 
      
 2565 
     | 
    
         
            +
            declare class ToolLoopAgent<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends Output = never> implements Agent<CALL_OPTIONS, TOOLS, OUTPUT> {
         
     | 
| 
       2556 
2566 
     | 
    
         
             
                readonly version = "agent-v1";
         
     | 
| 
       2557 
2567 
     | 
    
         
             
                private readonly settings;
         
     | 
| 
       2558 
     | 
    
         
            -
                constructor(settings: ToolLoopAgentSettings<TOOLS, OUTPUT>);
         
     | 
| 
      
 2568 
     | 
    
         
            +
                constructor(settings: ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>);
         
     | 
| 
       2559 
2569 
     | 
    
         
             
                /**
         
     | 
| 
       2560 
2570 
     | 
    
         
             
                 * The id of the agent.
         
     | 
| 
       2561 
2571 
     | 
    
         
             
                 */
         
     | 
| 
         @@ -2564,20 +2574,21 @@ declare class ToolLoopAgent<TOOLS extends ToolSet = {}, OUTPUT extends Output = 
     | 
|
| 
       2564 
2574 
     | 
    
         
             
                 * The tools that the agent can use.
         
     | 
| 
       2565 
2575 
     | 
    
         
             
                 */
         
     | 
| 
       2566 
2576 
     | 
    
         
             
                get tools(): TOOLS;
         
     | 
| 
      
 2577 
     | 
    
         
            +
                private prepareCall;
         
     | 
| 
       2567 
2578 
     | 
    
         
             
                /**
         
     | 
| 
       2568 
2579 
     | 
    
         
             
                 * Generates an output from the agent (non-streaming).
         
     | 
| 
       2569 
2580 
     | 
    
         
             
                 */
         
     | 
| 
       2570 
     | 
    
         
            -
                generate(options: AgentCallParameters): Promise<GenerateTextResult<TOOLS, InferGenerateOutput<OUTPUT>>>;
         
     | 
| 
      
 2581 
     | 
    
         
            +
                generate(options: AgentCallParameters<CALL_OPTIONS>): Promise<GenerateTextResult<TOOLS, InferGenerateOutput<OUTPUT>>>;
         
     | 
| 
       2571 
2582 
     | 
    
         
             
                /**
         
     | 
| 
       2572 
2583 
     | 
    
         
             
                 * Streams an output from the agent (streaming).
         
     | 
| 
       2573 
2584 
     | 
    
         
             
                 */
         
     | 
| 
       2574 
     | 
    
         
            -
                stream(options: AgentCallParameters): StreamTextResult<TOOLS, InferStreamOutput<OUTPUT 
     | 
| 
      
 2585 
     | 
    
         
            +
                stream(options: AgentCallParameters<CALL_OPTIONS>): Promise<StreamTextResult<TOOLS, InferStreamOutput<OUTPUT>>>;
         
     | 
| 
       2575 
2586 
     | 
    
         
             
            }
         
     | 
| 
       2576 
2587 
     | 
    
         | 
| 
       2577 
2588 
     | 
    
         
             
            /**
         
     | 
| 
       2578 
2589 
     | 
    
         
             
             * Infer the type of the tools of an agent.
         
     | 
| 
       2579 
2590 
     | 
    
         
             
             */
         
     | 
| 
       2580 
     | 
    
         
            -
            type InferAgentTools<AGENT> = AGENT extends Agent<infer TOOLS,  
     | 
| 
      
 2591 
     | 
    
         
            +
            type InferAgentTools<AGENT> = AGENT extends Agent<any, infer TOOLS, any> ? TOOLS : never;
         
     | 
| 
       2581 
2592 
     | 
    
         | 
| 
       2582 
2593 
     | 
    
         
             
            /**
         
     | 
| 
       2583 
2594 
     | 
    
         
             
             * Infer the UI message type of an agent.
         
     | 
| 
         @@ -2592,10 +2603,11 @@ type InferAgentUIMessage<AGENT> = UIMessage<never, never, InferUITools<InferAgen 
     | 
|
| 
       2592 
2603 
     | 
    
         
             
             *
         
     | 
| 
       2593 
2604 
     | 
    
         
             
             * @returns The response object.
         
     | 
| 
       2594 
2605 
     | 
    
         
             
             */
         
     | 
| 
       2595 
     | 
    
         
            -
            declare function createAgentUIStreamResponse<TOOLS extends ToolSet = {}, OUTPUT extends Output = never>({ headers, status, statusText, consumeSseStream, ...options }: {
         
     | 
| 
       2596 
     | 
    
         
            -
                agent: Agent<TOOLS, OUTPUT>;
         
     | 
| 
      
 2606 
     | 
    
         
            +
            declare function createAgentUIStreamResponse<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends Output = never, MESSAGE_METADATA = unknown>({ headers, status, statusText, consumeSseStream, ...options }: {
         
     | 
| 
      
 2607 
     | 
    
         
            +
                agent: Agent<CALL_OPTIONS, TOOLS, OUTPUT>;
         
     | 
| 
       2597 
2608 
     | 
    
         
             
                messages: unknown[];
         
     | 
| 
       2598 
     | 
    
         
            -
             
     | 
| 
      
 2609 
     | 
    
         
            +
                options?: CALL_OPTIONS;
         
     | 
| 
      
 2610 
     | 
    
         
            +
            } & UIMessageStreamResponseInit & UIMessageStreamOptions<UIMessage<MESSAGE_METADATA, never, InferUITools<TOOLS>>>): Promise<Response>;
         
     | 
| 
       2599 
2611 
     | 
    
         | 
| 
       2600 
2612 
     | 
    
         
             
            declare const getOriginalFetch: () => typeof fetch;
         
     | 
| 
       2601 
2613 
     | 
    
         
             
            declare function callCompletionApi({ api, prompt, credentials, headers, body, streamProtocol, setCompletion, setLoading, setError, setAbortController, onFinish, onError, fetch, }: {
         
     | 
| 
         @@ -3245,10 +3257,11 @@ declare const UI_MESSAGE_STREAM_HEADERS: { 
     | 
|
| 
       3245 
3257 
     | 
    
         
             
             *
         
     | 
| 
       3246 
3258 
     | 
    
         
             
             * @returns The UI message stream.
         
     | 
| 
       3247 
3259 
     | 
    
         
             
             */
         
     | 
| 
       3248 
     | 
    
         
            -
            declare function createAgentUIStream<TOOLS extends ToolSet = {}, OUTPUT extends Output = never>({ agent, messages, ...uiMessageStreamOptions }: {
         
     | 
| 
       3249 
     | 
    
         
            -
                agent: Agent<TOOLS, OUTPUT>;
         
     | 
| 
      
 3260 
     | 
    
         
            +
            declare function createAgentUIStream<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends Output = never, MESSAGE_METADATA = unknown>({ agent, messages, options, ...uiMessageStreamOptions }: {
         
     | 
| 
      
 3261 
     | 
    
         
            +
                agent: Agent<CALL_OPTIONS, TOOLS, OUTPUT>;
         
     | 
| 
       3250 
3262 
     | 
    
         
             
                messages: unknown[];
         
     | 
| 
       3251 
     | 
    
         
            -
             
     | 
| 
      
 3263 
     | 
    
         
            +
                options?: CALL_OPTIONS;
         
     | 
| 
      
 3264 
     | 
    
         
            +
            } & UIMessageStreamOptions<UIMessage<MESSAGE_METADATA, never, InferUITools<TOOLS>>>): Promise<AsyncIterableStream<InferUIMessageChunk<UIMessage<MESSAGE_METADATA, never, InferUITools<TOOLS>>>>>;
         
     | 
| 
       3252 
3265 
     | 
    
         | 
| 
       3253 
3266 
     | 
    
         
             
            /**
         
     | 
| 
       3254 
3267 
     | 
    
         
             
             * Pipes the agent UI message stream to a Node.js ServerResponse object.
         
     | 
| 
         @@ -3256,11 +3269,12 @@ declare function createAgentUIStream<TOOLS extends ToolSet = {}, OUTPUT extends 
     | 
|
| 
       3256 
3269 
     | 
    
         
             
             * @param agent - The agent to run.
         
     | 
| 
       3257 
3270 
     | 
    
         
             
             * @param messages - The input UI messages.
         
     | 
| 
       3258 
3271 
     | 
    
         
             
             */
         
     | 
| 
       3259 
     | 
    
         
            -
            declare function pipeAgentUIStreamToResponse<TOOLS extends ToolSet = {}, OUTPUT extends Output = never>({ response, headers, status, statusText, consumeSseStream, ...options }: {
         
     | 
| 
      
 3272 
     | 
    
         
            +
            declare function pipeAgentUIStreamToResponse<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends Output = never, MESSAGE_METADATA = unknown>({ response, headers, status, statusText, consumeSseStream, ...options }: {
         
     | 
| 
       3260 
3273 
     | 
    
         
             
                response: ServerResponse;
         
     | 
| 
       3261 
     | 
    
         
            -
                agent: Agent<TOOLS, OUTPUT>;
         
     | 
| 
      
 3274 
     | 
    
         
            +
                agent: Agent<CALL_OPTIONS, TOOLS, OUTPUT>;
         
     | 
| 
       3262 
3275 
     | 
    
         
             
                messages: unknown[];
         
     | 
| 
       3263 
     | 
    
         
            -
             
     | 
| 
      
 3276 
     | 
    
         
            +
                options?: CALL_OPTIONS;
         
     | 
| 
      
 3277 
     | 
    
         
            +
            } & UIMessageStreamResponseInit & UIMessageStreamOptions<UIMessage<MESSAGE_METADATA, never, InferUITools<TOOLS>>>): Promise<void>;
         
     | 
| 
       3264 
3278 
     | 
    
         | 
| 
       3265 
3279 
     | 
    
         
             
            /**
         
     | 
| 
       3266 
3280 
     | 
    
         
             
            The result of an `embed` call.
         
     | 
    
        package/dist/index.js
    CHANGED
    
    | 
         @@ -873,7 +873,7 @@ function detectMediaType({ 
     | 
|
| 
       873 
873 
     | 
    
         
             
            var import_provider_utils2 = require("@ai-sdk/provider-utils");
         
     | 
| 
       874 
874 
     | 
    
         | 
| 
       875 
875 
     | 
    
         
             
            // src/version.ts
         
     | 
| 
       876 
     | 
    
         
            -
            var VERSION = true ? "6.0.0-beta. 
     | 
| 
      
 876 
     | 
    
         
            +
            var VERSION = true ? "6.0.0-beta.66" : "0.0.0-test";
         
     | 
| 
       877 
877 
     | 
    
         | 
| 
       878 
878 
     | 
    
         
             
            // src/util/download/download.ts
         
     | 
| 
       879 
879 
     | 
    
         
             
            var download = async ({ url }) => {
         
     | 
| 
         @@ -6341,27 +6341,32 @@ var ToolLoopAgent = class { 
     | 
|
| 
       6341 
6341 
     | 
    
         
             
              get tools() {
         
     | 
| 
       6342 
6342 
     | 
    
         
             
                return this.settings.tools;
         
     | 
| 
       6343 
6343 
     | 
    
         
             
              }
         
     | 
| 
      
 6344 
     | 
    
         
            +
              async prepareCall(options) {
         
     | 
| 
      
 6345 
     | 
    
         
            +
                var _a17, _b, _c, _d;
         
     | 
| 
      
 6346 
     | 
    
         
            +
                const baseCallArgs = {
         
     | 
| 
      
 6347 
     | 
    
         
            +
                  ...this.settings,
         
     | 
| 
      
 6348 
     | 
    
         
            +
                  stopWhen: (_a17 = this.settings.stopWhen) != null ? _a17 : stepCountIs(20),
         
     | 
| 
      
 6349 
     | 
    
         
            +
                  ...options
         
     | 
| 
      
 6350 
     | 
    
         
            +
                };
         
     | 
| 
      
 6351 
     | 
    
         
            +
                const preparedCallArgs = (_d = await ((_c = (_b = this.settings).prepareCall) == null ? void 0 : _c.call(_b, baseCallArgs))) != null ? _d : baseCallArgs;
         
     | 
| 
      
 6352 
     | 
    
         
            +
                const { instructions, messages, prompt, ...callArgs } = preparedCallArgs;
         
     | 
| 
      
 6353 
     | 
    
         
            +
                return {
         
     | 
| 
      
 6354 
     | 
    
         
            +
                  ...callArgs,
         
     | 
| 
      
 6355 
     | 
    
         
            +
                  // restore prompt types
         
     | 
| 
      
 6356 
     | 
    
         
            +
                  ...{ system: instructions, messages, prompt }
         
     | 
| 
      
 6357 
     | 
    
         
            +
                };
         
     | 
| 
      
 6358 
     | 
    
         
            +
              }
         
     | 
| 
       6344 
6359 
     | 
    
         
             
              /**
         
     | 
| 
       6345 
6360 
     | 
    
         
             
               * Generates an output from the agent (non-streaming).
         
     | 
| 
       6346 
6361 
     | 
    
         
             
               */
         
     | 
| 
       6347 
6362 
     | 
    
         
             
              async generate(options) {
         
     | 
| 
       6348 
     | 
    
         
            -
                 
     | 
| 
       6349 
     | 
    
         
            -
                return generateText({
         
     | 
| 
       6350 
     | 
    
         
            -
                  ...this.settings,
         
     | 
| 
       6351 
     | 
    
         
            -
                  stopWhen: (_a17 = this.settings.stopWhen) != null ? _a17 : stepCountIs(20),
         
     | 
| 
       6352 
     | 
    
         
            -
                  ...options
         
     | 
| 
       6353 
     | 
    
         
            -
                });
         
     | 
| 
      
 6363 
     | 
    
         
            +
                return generateText(await this.prepareCall(options));
         
     | 
| 
       6354 
6364 
     | 
    
         
             
              }
         
     | 
| 
       6355 
6365 
     | 
    
         
             
              /**
         
     | 
| 
       6356 
6366 
     | 
    
         
             
               * Streams an output from the agent (streaming).
         
     | 
| 
       6357 
6367 
     | 
    
         
             
               */
         
     | 
| 
       6358 
     | 
    
         
            -
              stream(options) {
         
     | 
| 
       6359 
     | 
    
         
            -
                 
     | 
| 
       6360 
     | 
    
         
            -
                return streamText({
         
     | 
| 
       6361 
     | 
    
         
            -
                  ...this.settings,
         
     | 
| 
       6362 
     | 
    
         
            -
                  stopWhen: (_a17 = this.settings.stopWhen) != null ? _a17 : stepCountIs(20),
         
     | 
| 
       6363 
     | 
    
         
            -
                  ...options
         
     | 
| 
       6364 
     | 
    
         
            -
                });
         
     | 
| 
      
 6368 
     | 
    
         
            +
              async stream(options) {
         
     | 
| 
      
 6369 
     | 
    
         
            +
                return streamText(await this.prepareCall(options));
         
     | 
| 
       6365 
6370 
     | 
    
         
             
              }
         
     | 
| 
       6366 
6371 
     | 
    
         
             
            };
         
     | 
| 
       6367 
6372 
     | 
    
         | 
| 
         @@ -7084,6 +7089,7 @@ async function validateUIMessages({ 
     | 
|
| 
       7084 
7089 
     | 
    
         
             
            async function createAgentUIStream({
         
     | 
| 
       7085 
7090 
     | 
    
         
             
              agent,
         
     | 
| 
       7086 
7091 
     | 
    
         
             
              messages,
         
     | 
| 
      
 7092 
     | 
    
         
            +
              options,
         
     | 
| 
       7087 
7093 
     | 
    
         
             
              ...uiMessageStreamOptions
         
     | 
| 
       7088 
7094 
     | 
    
         
             
            }) {
         
     | 
| 
       7089 
7095 
     | 
    
         
             
              const validatedMessages = await validateUIMessages({
         
     | 
| 
         @@ -7093,7 +7099,10 @@ async function createAgentUIStream({ 
     | 
|
| 
       7093 
7099 
     | 
    
         
             
              const modelMessages = convertToModelMessages(validatedMessages, {
         
     | 
| 
       7094 
7100 
     | 
    
         
             
                tools: agent.tools
         
     | 
| 
       7095 
7101 
     | 
    
         
             
              });
         
     | 
| 
       7096 
     | 
    
         
            -
              const result = agent.stream({ 
     | 
| 
      
 7102 
     | 
    
         
            +
              const result = await agent.stream({
         
     | 
| 
      
 7103 
     | 
    
         
            +
                prompt: modelMessages,
         
     | 
| 
      
 7104 
     | 
    
         
            +
                options
         
     | 
| 
      
 7105 
     | 
    
         
            +
              });
         
     | 
| 
       7097 
7106 
     | 
    
         
             
              return result.toUIMessageStream(uiMessageStreamOptions);
         
     | 
| 
       7098 
7107 
     | 
    
         
             
            }
         
     | 
| 
       7099 
7108 
     | 
    
         |