ai 6.0.0-beta.62 → 6.0.0-beta.63
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 +6 -0
 - package/dist/index.d.mts +72 -66
 - package/dist/index.d.ts +72 -66
 - package/dist/index.js +1 -1
 - package/dist/index.js.map +1 -1
 - package/dist/index.mjs +1 -1
 - package/dist/index.mjs.map +1 -1
 - package/dist/internal/index.js +1 -1
 - package/dist/internal/index.mjs +1 -1
 - package/package.json +1 -1
 
    
        package/CHANGELOG.md
    CHANGED
    
    
    
        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,  
     | 
| 
      
 3 
     | 
    
         
            +
            import { Tool, InferToolInput, InferToolOutput, AssistantModelMessage, ToolModelMessage, ReasoningPart, FlexibleSchema, InferSchema, ModelMessage, SystemModelMessage, UserModelMessage, ProviderOptions, IdGenerator, ToolCall, 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';
         
     | 
| 
         @@ -637,6 +637,61 @@ interface GenerateTextResult<TOOLS extends ToolSet, OUTPUT> { 
     | 
|
| 
       637 
637 
     | 
    
         
             
                readonly experimental_output: OUTPUT;
         
     | 
| 
       638 
638 
     | 
    
         
             
            }
         
     | 
| 
       639 
639 
     | 
    
         | 
| 
      
 640 
     | 
    
         
            +
            /**
         
     | 
| 
      
 641 
     | 
    
         
            +
            Create a type from an object with all keys and nested keys set to optional.
         
     | 
| 
      
 642 
     | 
    
         
            +
            The helper supports normal objects and schemas (which are resolved automatically).
         
     | 
| 
      
 643 
     | 
    
         
            +
            It always recurses into arrays.
         
     | 
| 
      
 644 
     | 
    
         
            +
             
     | 
| 
      
 645 
     | 
    
         
            +
            Adopted from [type-fest](https://github.com/sindresorhus/type-fest/tree/main) PartialDeep.
         
     | 
| 
      
 646 
     | 
    
         
            +
             */
         
     | 
| 
      
 647 
     | 
    
         
            +
            type DeepPartial<T> = T extends FlexibleSchema ? DeepPartialInternal<InferSchema<T>> : DeepPartialInternal<T>;
         
     | 
| 
      
 648 
     | 
    
         
            +
            type DeepPartialInternal<T> = T extends null | undefined | string | number | boolean | symbol | bigint | void | Date | RegExp | ((...arguments_: any[]) => unknown) | (new (...arguments_: any[]) => unknown) ? T : T extends Map<infer KeyType, infer ValueType> ? PartialMap<KeyType, ValueType> : T extends Set<infer ItemType> ? PartialSet<ItemType> : T extends ReadonlyMap<infer KeyType, infer ValueType> ? PartialReadonlyMap<KeyType, ValueType> : T extends ReadonlySet<infer ItemType> ? PartialReadonlySet<ItemType> : T extends object ? T extends ReadonlyArray<infer ItemType> ? ItemType[] extends T ? readonly ItemType[] extends T ? ReadonlyArray<DeepPartialInternal<ItemType | undefined>> : Array<DeepPartialInternal<ItemType | undefined>> : PartialObject<T> : PartialObject<T> : unknown;
         
     | 
| 
      
 649 
     | 
    
         
            +
            type PartialMap<KeyType, ValueType> = {} & Map<DeepPartialInternal<KeyType>, DeepPartialInternal<ValueType>>;
         
     | 
| 
      
 650 
     | 
    
         
            +
            type PartialSet<T> = {} & Set<DeepPartialInternal<T>>;
         
     | 
| 
      
 651 
     | 
    
         
            +
            type PartialReadonlyMap<KeyType, ValueType> = {} & ReadonlyMap<DeepPartialInternal<KeyType>, DeepPartialInternal<ValueType>>;
         
     | 
| 
      
 652 
     | 
    
         
            +
            type PartialReadonlySet<T> = {} & ReadonlySet<DeepPartialInternal<T>>;
         
     | 
| 
      
 653 
     | 
    
         
            +
            type PartialObject<ObjectType extends object> = {
         
     | 
| 
      
 654 
     | 
    
         
            +
                [KeyType in keyof ObjectType]?: DeepPartialInternal<ObjectType[KeyType]>;
         
     | 
| 
      
 655 
     | 
    
         
            +
            };
         
     | 
| 
      
 656 
     | 
    
         
            +
             
     | 
| 
      
 657 
     | 
    
         
            +
            interface Output<OUTPUT = any, PARTIAL = any> {
         
     | 
| 
      
 658 
     | 
    
         
            +
                readonly type: 'object' | 'text';
         
     | 
| 
      
 659 
     | 
    
         
            +
                responseFormat: PromiseLike<LanguageModelV3CallOptions['responseFormat']>;
         
     | 
| 
      
 660 
     | 
    
         
            +
                parsePartial(options: {
         
     | 
| 
      
 661 
     | 
    
         
            +
                    text: string;
         
     | 
| 
      
 662 
     | 
    
         
            +
                }): Promise<{
         
     | 
| 
      
 663 
     | 
    
         
            +
                    partial: PARTIAL;
         
     | 
| 
      
 664 
     | 
    
         
            +
                } | undefined>;
         
     | 
| 
      
 665 
     | 
    
         
            +
                parseOutput(options: {
         
     | 
| 
      
 666 
     | 
    
         
            +
                    text: string;
         
     | 
| 
      
 667 
     | 
    
         
            +
                }, context: {
         
     | 
| 
      
 668 
     | 
    
         
            +
                    response: LanguageModelResponseMetadata;
         
     | 
| 
      
 669 
     | 
    
         
            +
                    usage: LanguageModelUsage;
         
     | 
| 
      
 670 
     | 
    
         
            +
                    finishReason: FinishReason;
         
     | 
| 
      
 671 
     | 
    
         
            +
                }): Promise<OUTPUT>;
         
     | 
| 
      
 672 
     | 
    
         
            +
            }
         
     | 
| 
      
 673 
     | 
    
         
            +
            declare const text: () => Output<string, string>;
         
     | 
| 
      
 674 
     | 
    
         
            +
            declare const object: <OUTPUT>({ schema: inputSchema, }: {
         
     | 
| 
      
 675 
     | 
    
         
            +
                schema: FlexibleSchema<OUTPUT>;
         
     | 
| 
      
 676 
     | 
    
         
            +
            }) => Output<OUTPUT, DeepPartial<OUTPUT>>;
         
     | 
| 
      
 677 
     | 
    
         
            +
            type InferGenerateOutput<OUTPUT extends Output> = OUTPUT extends Output<infer T, any> ? T : never;
         
     | 
| 
      
 678 
     | 
    
         
            +
            type InferStreamOutput<OUTPUT extends Output> = OUTPUT extends Output<any, infer P> ? P : never;
         
     | 
| 
      
 679 
     | 
    
         
            +
             
     | 
| 
      
 680 
     | 
    
         
            +
            type output_InferGenerateOutput<OUTPUT extends Output> = InferGenerateOutput<OUTPUT>;
         
     | 
| 
      
 681 
     | 
    
         
            +
            type output_InferStreamOutput<OUTPUT extends Output> = InferStreamOutput<OUTPUT>;
         
     | 
| 
      
 682 
     | 
    
         
            +
            type output_Output<OUTPUT = any, PARTIAL = any> = Output<OUTPUT, PARTIAL>;
         
     | 
| 
      
 683 
     | 
    
         
            +
            declare const output_object: typeof object;
         
     | 
| 
      
 684 
     | 
    
         
            +
            declare const output_text: typeof text;
         
     | 
| 
      
 685 
     | 
    
         
            +
            declare namespace output {
         
     | 
| 
      
 686 
     | 
    
         
            +
              export {
         
     | 
| 
      
 687 
     | 
    
         
            +
                output_InferGenerateOutput as InferGenerateOutput,
         
     | 
| 
      
 688 
     | 
    
         
            +
                output_InferStreamOutput as InferStreamOutput,
         
     | 
| 
      
 689 
     | 
    
         
            +
                output_Output as Output,
         
     | 
| 
      
 690 
     | 
    
         
            +
                output_object as object,
         
     | 
| 
      
 691 
     | 
    
         
            +
                output_text as text,
         
     | 
| 
      
 692 
     | 
    
         
            +
              };
         
     | 
| 
      
 693 
     | 
    
         
            +
            }
         
     | 
| 
      
 694 
     | 
    
         
            +
             
     | 
| 
       640 
695 
     | 
    
         
             
            type CallSettings = {
         
     | 
| 
       641 
696 
     | 
    
         
             
                /**
         
     | 
| 
       642 
697 
     | 
    
         
             
              Maximum number of tokens to generate.
         
     | 
| 
         @@ -806,55 +861,6 @@ type DownloadFunction = (options: Array<{ 
     | 
|
| 
       806 
861 
     | 
    
         
             
                mediaType: string | undefined;
         
     | 
| 
       807 
862 
     | 
    
         
             
            } | null>>;
         
     | 
| 
       808 
863 
     | 
    
         | 
| 
       809 
     | 
    
         
            -
            /**
         
     | 
| 
       810 
     | 
    
         
            -
            Create a type from an object with all keys and nested keys set to optional.
         
     | 
| 
       811 
     | 
    
         
            -
            The helper supports normal objects and schemas (which are resolved automatically).
         
     | 
| 
       812 
     | 
    
         
            -
            It always recurses into arrays.
         
     | 
| 
       813 
     | 
    
         
            -
             
     | 
| 
       814 
     | 
    
         
            -
            Adopted from [type-fest](https://github.com/sindresorhus/type-fest/tree/main) PartialDeep.
         
     | 
| 
       815 
     | 
    
         
            -
             */
         
     | 
| 
       816 
     | 
    
         
            -
            type DeepPartial<T> = T extends FlexibleSchema ? DeepPartialInternal<InferSchema<T>> : DeepPartialInternal<T>;
         
     | 
| 
       817 
     | 
    
         
            -
            type DeepPartialInternal<T> = T extends null | undefined | string | number | boolean | symbol | bigint | void | Date | RegExp | ((...arguments_: any[]) => unknown) | (new (...arguments_: any[]) => unknown) ? T : T extends Map<infer KeyType, infer ValueType> ? PartialMap<KeyType, ValueType> : T extends Set<infer ItemType> ? PartialSet<ItemType> : T extends ReadonlyMap<infer KeyType, infer ValueType> ? PartialReadonlyMap<KeyType, ValueType> : T extends ReadonlySet<infer ItemType> ? PartialReadonlySet<ItemType> : T extends object ? T extends ReadonlyArray<infer ItemType> ? ItemType[] extends T ? readonly ItemType[] extends T ? ReadonlyArray<DeepPartialInternal<ItemType | undefined>> : Array<DeepPartialInternal<ItemType | undefined>> : PartialObject<T> : PartialObject<T> : unknown;
         
     | 
| 
       818 
     | 
    
         
            -
            type PartialMap<KeyType, ValueType> = {} & Map<DeepPartialInternal<KeyType>, DeepPartialInternal<ValueType>>;
         
     | 
| 
       819 
     | 
    
         
            -
            type PartialSet<T> = {} & Set<DeepPartialInternal<T>>;
         
     | 
| 
       820 
     | 
    
         
            -
            type PartialReadonlyMap<KeyType, ValueType> = {} & ReadonlyMap<DeepPartialInternal<KeyType>, DeepPartialInternal<ValueType>>;
         
     | 
| 
       821 
     | 
    
         
            -
            type PartialReadonlySet<T> = {} & ReadonlySet<DeepPartialInternal<T>>;
         
     | 
| 
       822 
     | 
    
         
            -
            type PartialObject<ObjectType extends object> = {
         
     | 
| 
       823 
     | 
    
         
            -
                [KeyType in keyof ObjectType]?: DeepPartialInternal<ObjectType[KeyType]>;
         
     | 
| 
       824 
     | 
    
         
            -
            };
         
     | 
| 
       825 
     | 
    
         
            -
             
     | 
| 
       826 
     | 
    
         
            -
            interface Output<OUTPUT, PARTIAL> {
         
     | 
| 
       827 
     | 
    
         
            -
                readonly type: 'object' | 'text';
         
     | 
| 
       828 
     | 
    
         
            -
                responseFormat: PromiseLike<LanguageModelV3CallOptions['responseFormat']>;
         
     | 
| 
       829 
     | 
    
         
            -
                parsePartial(options: {
         
     | 
| 
       830 
     | 
    
         
            -
                    text: string;
         
     | 
| 
       831 
     | 
    
         
            -
                }): Promise<{
         
     | 
| 
       832 
     | 
    
         
            -
                    partial: PARTIAL;
         
     | 
| 
       833 
     | 
    
         
            -
                } | undefined>;
         
     | 
| 
       834 
     | 
    
         
            -
                parseOutput(options: {
         
     | 
| 
       835 
     | 
    
         
            -
                    text: string;
         
     | 
| 
       836 
     | 
    
         
            -
                }, context: {
         
     | 
| 
       837 
     | 
    
         
            -
                    response: LanguageModelResponseMetadata;
         
     | 
| 
       838 
     | 
    
         
            -
                    usage: LanguageModelUsage;
         
     | 
| 
       839 
     | 
    
         
            -
                    finishReason: FinishReason;
         
     | 
| 
       840 
     | 
    
         
            -
                }): Promise<OUTPUT>;
         
     | 
| 
       841 
     | 
    
         
            -
            }
         
     | 
| 
       842 
     | 
    
         
            -
            declare const text: () => Output<string, string>;
         
     | 
| 
       843 
     | 
    
         
            -
            declare const object: <OUTPUT>({ schema: inputSchema, }: {
         
     | 
| 
       844 
     | 
    
         
            -
                schema: FlexibleSchema<OUTPUT>;
         
     | 
| 
       845 
     | 
    
         
            -
            }) => Output<OUTPUT, DeepPartial<OUTPUT>>;
         
     | 
| 
       846 
     | 
    
         
            -
             
     | 
| 
       847 
     | 
    
         
            -
            type output_Output<OUTPUT, PARTIAL> = Output<OUTPUT, PARTIAL>;
         
     | 
| 
       848 
     | 
    
         
            -
            declare const output_object: typeof object;
         
     | 
| 
       849 
     | 
    
         
            -
            declare const output_text: typeof text;
         
     | 
| 
       850 
     | 
    
         
            -
            declare namespace output {
         
     | 
| 
       851 
     | 
    
         
            -
              export {
         
     | 
| 
       852 
     | 
    
         
            -
                output_Output as Output,
         
     | 
| 
       853 
     | 
    
         
            -
                output_object as object,
         
     | 
| 
       854 
     | 
    
         
            -
                output_text as text,
         
     | 
| 
       855 
     | 
    
         
            -
              };
         
     | 
| 
       856 
     | 
    
         
            -
            }
         
     | 
| 
       857 
     | 
    
         
            -
             
     | 
| 
       858 
864 
     | 
    
         
             
            /**
         
     | 
| 
       859 
865 
     | 
    
         
             
            Function that you can use to provide different settings for a step.
         
     | 
| 
       860 
866 
     | 
    
         | 
| 
         @@ -2381,7 +2387,7 @@ type TextStreamPart<TOOLS extends ToolSet> = { 
     | 
|
| 
       2381 
2387 
     | 
    
         
             
             * You can implement your own Agent by implementing the `Agent` interface,
         
     | 
| 
       2382 
2388 
     | 
    
         
             
             * or use the `ToolLoopAgent` class.
         
     | 
| 
       2383 
2389 
     | 
    
         
             
             */
         
     | 
| 
       2384 
     | 
    
         
            -
            interface Agent<TOOLS extends ToolSet = {}, OUTPUT  
     | 
| 
      
 2390 
     | 
    
         
            +
            interface Agent<TOOLS extends ToolSet = {}, OUTPUT extends Output = never> {
         
     | 
| 
       2385 
2391 
     | 
    
         
             
                /**
         
     | 
| 
       2386 
2392 
     | 
    
         
             
                 * The specification version of the agent interface. This will enable
         
     | 
| 
       2387 
2393 
     | 
    
         
             
                 * us to evolve the agent interface and retain backwards compatibility.
         
     | 
| 
         @@ -2398,11 +2404,11 @@ interface Agent<TOOLS extends ToolSet = {}, OUTPUT = never, OUTPUT_PARTIAL = nev 
     | 
|
| 
       2398 
2404 
     | 
    
         
             
                /**
         
     | 
| 
       2399 
2405 
     | 
    
         
             
                 * Generates an output from the agent (non-streaming).
         
     | 
| 
       2400 
2406 
     | 
    
         
             
                 */
         
     | 
| 
       2401 
     | 
    
         
            -
                generate(options: Prompt): PromiseLike<GenerateTextResult<TOOLS, OUTPUT 
     | 
| 
      
 2407 
     | 
    
         
            +
                generate(options: Prompt): PromiseLike<GenerateTextResult<TOOLS, InferGenerateOutput<OUTPUT>>>;
         
     | 
| 
       2402 
2408 
     | 
    
         
             
                /**
         
     | 
| 
       2403 
2409 
     | 
    
         
             
                 * Streams an output from the agent (streaming).
         
     | 
| 
       2404 
2410 
     | 
    
         
             
                 */
         
     | 
| 
       2405 
     | 
    
         
            -
                stream(options: Prompt): StreamTextResult<TOOLS,  
     | 
| 
      
 2411 
     | 
    
         
            +
                stream(options: Prompt): StreamTextResult<TOOLS, InferStreamOutput<OUTPUT>>;
         
     | 
| 
       2406 
2412 
     | 
    
         
             
            }
         
     | 
| 
       2407 
2413 
     | 
    
         | 
| 
       2408 
2414 
     | 
    
         
             
            /**
         
     | 
| 
         @@ -2431,7 +2437,7 @@ type ToolLoopAgentOnStepFinishCallback<TOOLS extends ToolSet = {}> = (stepResult 
     | 
|
| 
       2431 
2437 
     | 
    
         
             
            /**
         
     | 
| 
       2432 
2438 
     | 
    
         
             
             * Configuration options for an agent.
         
     | 
| 
       2433 
2439 
     | 
    
         
             
             */
         
     | 
| 
       2434 
     | 
    
         
            -
            type ToolLoopAgentSettings<TOOLS extends ToolSet = {}, OUTPUT  
     | 
| 
      
 2440 
     | 
    
         
            +
            type ToolLoopAgentSettings<TOOLS extends ToolSet = {}, OUTPUT extends Output = never> = CallSettings & {
         
     | 
| 
       2435 
2441 
     | 
    
         
             
                /**
         
     | 
| 
       2436 
2442 
     | 
    
         
             
                 * The id of the agent.
         
     | 
| 
       2437 
2443 
     | 
    
         
             
                 */
         
     | 
| 
         @@ -2471,7 +2477,7 @@ type ToolLoopAgentSettings<TOOLS extends ToolSet = {}, OUTPUT = never, OUTPUT_PA 
     | 
|
| 
       2471 
2477 
     | 
    
         
             
                /**
         
     | 
| 
       2472 
2478 
     | 
    
         
             
              Optional specification for parsing structured outputs from the LLM response.
         
     | 
| 
       2473 
2479 
     | 
    
         
             
                 */
         
     | 
| 
       2474 
     | 
    
         
            -
                experimental_output?:  
     | 
| 
      
 2480 
     | 
    
         
            +
                experimental_output?: OUTPUT;
         
     | 
| 
       2475 
2481 
     | 
    
         
             
                /**
         
     | 
| 
       2476 
2482 
     | 
    
         
             
                 * @deprecated Use `prepareStep` instead.
         
     | 
| 
       2477 
2483 
     | 
    
         
             
                 */
         
     | 
| 
         @@ -2519,10 +2525,10 @@ type ToolLoopAgentSettings<TOOLS extends ToolSet = {}, OUTPUT = never, OUTPUT_PA 
     | 
|
| 
       2519 
2525 
     | 
    
         
             
             * - A tool call needs approval, or
         
     | 
| 
       2520 
2526 
     | 
    
         
             
             * - A stop condition is met (default stop condition is stepCountIs(20))
         
     | 
| 
       2521 
2527 
     | 
    
         
             
             */
         
     | 
| 
       2522 
     | 
    
         
            -
            declare class ToolLoopAgent<TOOLS extends ToolSet = {}, OUTPUT  
     | 
| 
      
 2528 
     | 
    
         
            +
            declare class ToolLoopAgent<TOOLS extends ToolSet = {}, OUTPUT extends Output = never> implements Agent<TOOLS, OUTPUT> {
         
     | 
| 
       2523 
2529 
     | 
    
         
             
                readonly version = "agent-v1";
         
     | 
| 
       2524 
2530 
     | 
    
         
             
                private readonly settings;
         
     | 
| 
       2525 
     | 
    
         
            -
                constructor(settings: ToolLoopAgentSettings<TOOLS, OUTPUT 
     | 
| 
      
 2531 
     | 
    
         
            +
                constructor(settings: ToolLoopAgentSettings<TOOLS, OUTPUT>);
         
     | 
| 
       2526 
2532 
     | 
    
         
             
                /**
         
     | 
| 
       2527 
2533 
     | 
    
         
             
                 * The id of the agent.
         
     | 
| 
       2528 
2534 
     | 
    
         
             
                 */
         
     | 
| 
         @@ -2534,17 +2540,17 @@ declare class ToolLoopAgent<TOOLS extends ToolSet = {}, OUTPUT = never, OUTPUT_P 
     | 
|
| 
       2534 
2540 
     | 
    
         
             
                /**
         
     | 
| 
       2535 
2541 
     | 
    
         
             
                 * Generates an output from the agent (non-streaming).
         
     | 
| 
       2536 
2542 
     | 
    
         
             
                 */
         
     | 
| 
       2537 
     | 
    
         
            -
                generate(options: Prompt): Promise<GenerateTextResult<TOOLS, OUTPUT 
     | 
| 
      
 2543 
     | 
    
         
            +
                generate(options: Prompt): Promise<GenerateTextResult<TOOLS, InferGenerateOutput<OUTPUT>>>;
         
     | 
| 
       2538 
2544 
     | 
    
         
             
                /**
         
     | 
| 
       2539 
2545 
     | 
    
         
             
                 * Streams an output from the agent (streaming).
         
     | 
| 
       2540 
2546 
     | 
    
         
             
                 */
         
     | 
| 
       2541 
     | 
    
         
            -
                stream(options: Prompt): StreamTextResult<TOOLS,  
     | 
| 
      
 2547 
     | 
    
         
            +
                stream(options: Prompt): StreamTextResult<TOOLS, InferStreamOutput<OUTPUT>>;
         
     | 
| 
       2542 
2548 
     | 
    
         
             
            }
         
     | 
| 
       2543 
2549 
     | 
    
         | 
| 
       2544 
2550 
     | 
    
         
             
            /**
         
     | 
| 
       2545 
2551 
     | 
    
         
             
             * Infer the type of the tools of an agent.
         
     | 
| 
       2546 
2552 
     | 
    
         
             
             */
         
     | 
| 
       2547 
     | 
    
         
            -
            type InferAgentTools<AGENT> = AGENT extends Agent<infer TOOLS,  
     | 
| 
      
 2553 
     | 
    
         
            +
            type InferAgentTools<AGENT> = AGENT extends Agent<infer TOOLS, never> ? TOOLS : never;
         
     | 
| 
       2548 
2554 
     | 
    
         | 
| 
       2549 
2555 
     | 
    
         
             
            /**
         
     | 
| 
       2550 
2556 
     | 
    
         
             
             * Infer the UI message type of an agent.
         
     | 
| 
         @@ -2559,8 +2565,8 @@ type InferAgentUIMessage<AGENT> = UIMessage<never, never, InferUITools<InferAgen 
     | 
|
| 
       2559 
2565 
     | 
    
         
             
             *
         
     | 
| 
       2560 
2566 
     | 
    
         
             
             * @returns The response object.
         
     | 
| 
       2561 
2567 
     | 
    
         
             
             */
         
     | 
| 
       2562 
     | 
    
         
            -
            declare function createAgentUIStreamResponse<TOOLS extends ToolSet = {}, OUTPUT  
     | 
| 
       2563 
     | 
    
         
            -
                agent: Agent<TOOLS, OUTPUT 
     | 
| 
      
 2568 
     | 
    
         
            +
            declare function createAgentUIStreamResponse<TOOLS extends ToolSet = {}, OUTPUT extends Output = never>({ headers, status, statusText, consumeSseStream, ...options }: {
         
     | 
| 
      
 2569 
     | 
    
         
            +
                agent: Agent<TOOLS, OUTPUT>;
         
     | 
| 
       2564 
2570 
     | 
    
         
             
                messages: unknown[];
         
     | 
| 
       2565 
2571 
     | 
    
         
             
            } & UIMessageStreamResponseInit & UIMessageStreamOptions<UIMessage<never, never, InferUITools<TOOLS>>>): Promise<Response>;
         
     | 
| 
       2566 
2572 
     | 
    
         | 
| 
         @@ -3212,8 +3218,8 @@ declare const UI_MESSAGE_STREAM_HEADERS: { 
     | 
|
| 
       3212 
3218 
     | 
    
         
             
             *
         
     | 
| 
       3213 
3219 
     | 
    
         
             
             * @returns The UI message stream.
         
     | 
| 
       3214 
3220 
     | 
    
         
             
             */
         
     | 
| 
       3215 
     | 
    
         
            -
            declare function createAgentUIStream<TOOLS extends ToolSet = {}, OUTPUT  
     | 
| 
       3216 
     | 
    
         
            -
                agent: Agent<TOOLS, OUTPUT 
     | 
| 
      
 3221 
     | 
    
         
            +
            declare function createAgentUIStream<TOOLS extends ToolSet = {}, OUTPUT extends Output = never>({ agent, messages, ...uiMessageStreamOptions }: {
         
     | 
| 
      
 3222 
     | 
    
         
            +
                agent: Agent<TOOLS, OUTPUT>;
         
     | 
| 
       3217 
3223 
     | 
    
         
             
                messages: unknown[];
         
     | 
| 
       3218 
3224 
     | 
    
         
             
            } & UIMessageStreamOptions<UIMessage<never, never, InferUITools<TOOLS>>>): Promise<AsyncIterableStream<InferUIMessageChunk<UIMessage<never, never, InferUITools<TOOLS>>>>>;
         
     | 
| 
       3219 
3225 
     | 
    
         | 
| 
         @@ -3223,9 +3229,9 @@ declare function createAgentUIStream<TOOLS extends ToolSet = {}, OUTPUT = never, 
     | 
|
| 
       3223 
3229 
     | 
    
         
             
             * @param agent - The agent to run.
         
     | 
| 
       3224 
3230 
     | 
    
         
             
             * @param messages - The input UI messages.
         
     | 
| 
       3225 
3231 
     | 
    
         
             
             */
         
     | 
| 
       3226 
     | 
    
         
            -
            declare function pipeAgentUIStreamToResponse<TOOLS extends ToolSet = {}, OUTPUT  
     | 
| 
      
 3232 
     | 
    
         
            +
            declare function pipeAgentUIStreamToResponse<TOOLS extends ToolSet = {}, OUTPUT extends Output = never>({ response, headers, status, statusText, consumeSseStream, ...options }: {
         
     | 
| 
       3227 
3233 
     | 
    
         
             
                response: ServerResponse;
         
     | 
| 
       3228 
     | 
    
         
            -
                agent: Agent<TOOLS, OUTPUT 
     | 
| 
      
 3234 
     | 
    
         
            +
                agent: Agent<TOOLS, OUTPUT>;
         
     | 
| 
       3229 
3235 
     | 
    
         
             
                messages: unknown[];
         
     | 
| 
       3230 
3236 
     | 
    
         
             
            } & UIMessageStreamResponseInit & UIMessageStreamOptions<UIMessage<never, never, InferUITools<TOOLS>>>): Promise<void>;
         
     | 
| 
       3231 
3237 
     | 
    
         | 
    
        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,  
     | 
| 
      
 3 
     | 
    
         
            +
            import { Tool, InferToolInput, InferToolOutput, AssistantModelMessage, ToolModelMessage, ReasoningPart, FlexibleSchema, InferSchema, ModelMessage, SystemModelMessage, UserModelMessage, ProviderOptions, IdGenerator, ToolCall, 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';
         
     | 
| 
         @@ -637,6 +637,61 @@ interface GenerateTextResult<TOOLS extends ToolSet, OUTPUT> { 
     | 
|
| 
       637 
637 
     | 
    
         
             
                readonly experimental_output: OUTPUT;
         
     | 
| 
       638 
638 
     | 
    
         
             
            }
         
     | 
| 
       639 
639 
     | 
    
         | 
| 
      
 640 
     | 
    
         
            +
            /**
         
     | 
| 
      
 641 
     | 
    
         
            +
            Create a type from an object with all keys and nested keys set to optional.
         
     | 
| 
      
 642 
     | 
    
         
            +
            The helper supports normal objects and schemas (which are resolved automatically).
         
     | 
| 
      
 643 
     | 
    
         
            +
            It always recurses into arrays.
         
     | 
| 
      
 644 
     | 
    
         
            +
             
     | 
| 
      
 645 
     | 
    
         
            +
            Adopted from [type-fest](https://github.com/sindresorhus/type-fest/tree/main) PartialDeep.
         
     | 
| 
      
 646 
     | 
    
         
            +
             */
         
     | 
| 
      
 647 
     | 
    
         
            +
            type DeepPartial<T> = T extends FlexibleSchema ? DeepPartialInternal<InferSchema<T>> : DeepPartialInternal<T>;
         
     | 
| 
      
 648 
     | 
    
         
            +
            type DeepPartialInternal<T> = T extends null | undefined | string | number | boolean | symbol | bigint | void | Date | RegExp | ((...arguments_: any[]) => unknown) | (new (...arguments_: any[]) => unknown) ? T : T extends Map<infer KeyType, infer ValueType> ? PartialMap<KeyType, ValueType> : T extends Set<infer ItemType> ? PartialSet<ItemType> : T extends ReadonlyMap<infer KeyType, infer ValueType> ? PartialReadonlyMap<KeyType, ValueType> : T extends ReadonlySet<infer ItemType> ? PartialReadonlySet<ItemType> : T extends object ? T extends ReadonlyArray<infer ItemType> ? ItemType[] extends T ? readonly ItemType[] extends T ? ReadonlyArray<DeepPartialInternal<ItemType | undefined>> : Array<DeepPartialInternal<ItemType | undefined>> : PartialObject<T> : PartialObject<T> : unknown;
         
     | 
| 
      
 649 
     | 
    
         
            +
            type PartialMap<KeyType, ValueType> = {} & Map<DeepPartialInternal<KeyType>, DeepPartialInternal<ValueType>>;
         
     | 
| 
      
 650 
     | 
    
         
            +
            type PartialSet<T> = {} & Set<DeepPartialInternal<T>>;
         
     | 
| 
      
 651 
     | 
    
         
            +
            type PartialReadonlyMap<KeyType, ValueType> = {} & ReadonlyMap<DeepPartialInternal<KeyType>, DeepPartialInternal<ValueType>>;
         
     | 
| 
      
 652 
     | 
    
         
            +
            type PartialReadonlySet<T> = {} & ReadonlySet<DeepPartialInternal<T>>;
         
     | 
| 
      
 653 
     | 
    
         
            +
            type PartialObject<ObjectType extends object> = {
         
     | 
| 
      
 654 
     | 
    
         
            +
                [KeyType in keyof ObjectType]?: DeepPartialInternal<ObjectType[KeyType]>;
         
     | 
| 
      
 655 
     | 
    
         
            +
            };
         
     | 
| 
      
 656 
     | 
    
         
            +
             
     | 
| 
      
 657 
     | 
    
         
            +
            interface Output<OUTPUT = any, PARTIAL = any> {
         
     | 
| 
      
 658 
     | 
    
         
            +
                readonly type: 'object' | 'text';
         
     | 
| 
      
 659 
     | 
    
         
            +
                responseFormat: PromiseLike<LanguageModelV3CallOptions['responseFormat']>;
         
     | 
| 
      
 660 
     | 
    
         
            +
                parsePartial(options: {
         
     | 
| 
      
 661 
     | 
    
         
            +
                    text: string;
         
     | 
| 
      
 662 
     | 
    
         
            +
                }): Promise<{
         
     | 
| 
      
 663 
     | 
    
         
            +
                    partial: PARTIAL;
         
     | 
| 
      
 664 
     | 
    
         
            +
                } | undefined>;
         
     | 
| 
      
 665 
     | 
    
         
            +
                parseOutput(options: {
         
     | 
| 
      
 666 
     | 
    
         
            +
                    text: string;
         
     | 
| 
      
 667 
     | 
    
         
            +
                }, context: {
         
     | 
| 
      
 668 
     | 
    
         
            +
                    response: LanguageModelResponseMetadata;
         
     | 
| 
      
 669 
     | 
    
         
            +
                    usage: LanguageModelUsage;
         
     | 
| 
      
 670 
     | 
    
         
            +
                    finishReason: FinishReason;
         
     | 
| 
      
 671 
     | 
    
         
            +
                }): Promise<OUTPUT>;
         
     | 
| 
      
 672 
     | 
    
         
            +
            }
         
     | 
| 
      
 673 
     | 
    
         
            +
            declare const text: () => Output<string, string>;
         
     | 
| 
      
 674 
     | 
    
         
            +
            declare const object: <OUTPUT>({ schema: inputSchema, }: {
         
     | 
| 
      
 675 
     | 
    
         
            +
                schema: FlexibleSchema<OUTPUT>;
         
     | 
| 
      
 676 
     | 
    
         
            +
            }) => Output<OUTPUT, DeepPartial<OUTPUT>>;
         
     | 
| 
      
 677 
     | 
    
         
            +
            type InferGenerateOutput<OUTPUT extends Output> = OUTPUT extends Output<infer T, any> ? T : never;
         
     | 
| 
      
 678 
     | 
    
         
            +
            type InferStreamOutput<OUTPUT extends Output> = OUTPUT extends Output<any, infer P> ? P : never;
         
     | 
| 
      
 679 
     | 
    
         
            +
             
     | 
| 
      
 680 
     | 
    
         
            +
            type output_InferGenerateOutput<OUTPUT extends Output> = InferGenerateOutput<OUTPUT>;
         
     | 
| 
      
 681 
     | 
    
         
            +
            type output_InferStreamOutput<OUTPUT extends Output> = InferStreamOutput<OUTPUT>;
         
     | 
| 
      
 682 
     | 
    
         
            +
            type output_Output<OUTPUT = any, PARTIAL = any> = Output<OUTPUT, PARTIAL>;
         
     | 
| 
      
 683 
     | 
    
         
            +
            declare const output_object: typeof object;
         
     | 
| 
      
 684 
     | 
    
         
            +
            declare const output_text: typeof text;
         
     | 
| 
      
 685 
     | 
    
         
            +
            declare namespace output {
         
     | 
| 
      
 686 
     | 
    
         
            +
              export {
         
     | 
| 
      
 687 
     | 
    
         
            +
                output_InferGenerateOutput as InferGenerateOutput,
         
     | 
| 
      
 688 
     | 
    
         
            +
                output_InferStreamOutput as InferStreamOutput,
         
     | 
| 
      
 689 
     | 
    
         
            +
                output_Output as Output,
         
     | 
| 
      
 690 
     | 
    
         
            +
                output_object as object,
         
     | 
| 
      
 691 
     | 
    
         
            +
                output_text as text,
         
     | 
| 
      
 692 
     | 
    
         
            +
              };
         
     | 
| 
      
 693 
     | 
    
         
            +
            }
         
     | 
| 
      
 694 
     | 
    
         
            +
             
     | 
| 
       640 
695 
     | 
    
         
             
            type CallSettings = {
         
     | 
| 
       641 
696 
     | 
    
         
             
                /**
         
     | 
| 
       642 
697 
     | 
    
         
             
              Maximum number of tokens to generate.
         
     | 
| 
         @@ -806,55 +861,6 @@ type DownloadFunction = (options: Array<{ 
     | 
|
| 
       806 
861 
     | 
    
         
             
                mediaType: string | undefined;
         
     | 
| 
       807 
862 
     | 
    
         
             
            } | null>>;
         
     | 
| 
       808 
863 
     | 
    
         | 
| 
       809 
     | 
    
         
            -
            /**
         
     | 
| 
       810 
     | 
    
         
            -
            Create a type from an object with all keys and nested keys set to optional.
         
     | 
| 
       811 
     | 
    
         
            -
            The helper supports normal objects and schemas (which are resolved automatically).
         
     | 
| 
       812 
     | 
    
         
            -
            It always recurses into arrays.
         
     | 
| 
       813 
     | 
    
         
            -
             
     | 
| 
       814 
     | 
    
         
            -
            Adopted from [type-fest](https://github.com/sindresorhus/type-fest/tree/main) PartialDeep.
         
     | 
| 
       815 
     | 
    
         
            -
             */
         
     | 
| 
       816 
     | 
    
         
            -
            type DeepPartial<T> = T extends FlexibleSchema ? DeepPartialInternal<InferSchema<T>> : DeepPartialInternal<T>;
         
     | 
| 
       817 
     | 
    
         
            -
            type DeepPartialInternal<T> = T extends null | undefined | string | number | boolean | symbol | bigint | void | Date | RegExp | ((...arguments_: any[]) => unknown) | (new (...arguments_: any[]) => unknown) ? T : T extends Map<infer KeyType, infer ValueType> ? PartialMap<KeyType, ValueType> : T extends Set<infer ItemType> ? PartialSet<ItemType> : T extends ReadonlyMap<infer KeyType, infer ValueType> ? PartialReadonlyMap<KeyType, ValueType> : T extends ReadonlySet<infer ItemType> ? PartialReadonlySet<ItemType> : T extends object ? T extends ReadonlyArray<infer ItemType> ? ItemType[] extends T ? readonly ItemType[] extends T ? ReadonlyArray<DeepPartialInternal<ItemType | undefined>> : Array<DeepPartialInternal<ItemType | undefined>> : PartialObject<T> : PartialObject<T> : unknown;
         
     | 
| 
       818 
     | 
    
         
            -
            type PartialMap<KeyType, ValueType> = {} & Map<DeepPartialInternal<KeyType>, DeepPartialInternal<ValueType>>;
         
     | 
| 
       819 
     | 
    
         
            -
            type PartialSet<T> = {} & Set<DeepPartialInternal<T>>;
         
     | 
| 
       820 
     | 
    
         
            -
            type PartialReadonlyMap<KeyType, ValueType> = {} & ReadonlyMap<DeepPartialInternal<KeyType>, DeepPartialInternal<ValueType>>;
         
     | 
| 
       821 
     | 
    
         
            -
            type PartialReadonlySet<T> = {} & ReadonlySet<DeepPartialInternal<T>>;
         
     | 
| 
       822 
     | 
    
         
            -
            type PartialObject<ObjectType extends object> = {
         
     | 
| 
       823 
     | 
    
         
            -
                [KeyType in keyof ObjectType]?: DeepPartialInternal<ObjectType[KeyType]>;
         
     | 
| 
       824 
     | 
    
         
            -
            };
         
     | 
| 
       825 
     | 
    
         
            -
             
     | 
| 
       826 
     | 
    
         
            -
            interface Output<OUTPUT, PARTIAL> {
         
     | 
| 
       827 
     | 
    
         
            -
                readonly type: 'object' | 'text';
         
     | 
| 
       828 
     | 
    
         
            -
                responseFormat: PromiseLike<LanguageModelV3CallOptions['responseFormat']>;
         
     | 
| 
       829 
     | 
    
         
            -
                parsePartial(options: {
         
     | 
| 
       830 
     | 
    
         
            -
                    text: string;
         
     | 
| 
       831 
     | 
    
         
            -
                }): Promise<{
         
     | 
| 
       832 
     | 
    
         
            -
                    partial: PARTIAL;
         
     | 
| 
       833 
     | 
    
         
            -
                } | undefined>;
         
     | 
| 
       834 
     | 
    
         
            -
                parseOutput(options: {
         
     | 
| 
       835 
     | 
    
         
            -
                    text: string;
         
     | 
| 
       836 
     | 
    
         
            -
                }, context: {
         
     | 
| 
       837 
     | 
    
         
            -
                    response: LanguageModelResponseMetadata;
         
     | 
| 
       838 
     | 
    
         
            -
                    usage: LanguageModelUsage;
         
     | 
| 
       839 
     | 
    
         
            -
                    finishReason: FinishReason;
         
     | 
| 
       840 
     | 
    
         
            -
                }): Promise<OUTPUT>;
         
     | 
| 
       841 
     | 
    
         
            -
            }
         
     | 
| 
       842 
     | 
    
         
            -
            declare const text: () => Output<string, string>;
         
     | 
| 
       843 
     | 
    
         
            -
            declare const object: <OUTPUT>({ schema: inputSchema, }: {
         
     | 
| 
       844 
     | 
    
         
            -
                schema: FlexibleSchema<OUTPUT>;
         
     | 
| 
       845 
     | 
    
         
            -
            }) => Output<OUTPUT, DeepPartial<OUTPUT>>;
         
     | 
| 
       846 
     | 
    
         
            -
             
     | 
| 
       847 
     | 
    
         
            -
            type output_Output<OUTPUT, PARTIAL> = Output<OUTPUT, PARTIAL>;
         
     | 
| 
       848 
     | 
    
         
            -
            declare const output_object: typeof object;
         
     | 
| 
       849 
     | 
    
         
            -
            declare const output_text: typeof text;
         
     | 
| 
       850 
     | 
    
         
            -
            declare namespace output {
         
     | 
| 
       851 
     | 
    
         
            -
              export {
         
     | 
| 
       852 
     | 
    
         
            -
                output_Output as Output,
         
     | 
| 
       853 
     | 
    
         
            -
                output_object as object,
         
     | 
| 
       854 
     | 
    
         
            -
                output_text as text,
         
     | 
| 
       855 
     | 
    
         
            -
              };
         
     | 
| 
       856 
     | 
    
         
            -
            }
         
     | 
| 
       857 
     | 
    
         
            -
             
     | 
| 
       858 
864 
     | 
    
         
             
            /**
         
     | 
| 
       859 
865 
     | 
    
         
             
            Function that you can use to provide different settings for a step.
         
     | 
| 
       860 
866 
     | 
    
         | 
| 
         @@ -2381,7 +2387,7 @@ type TextStreamPart<TOOLS extends ToolSet> = { 
     | 
|
| 
       2381 
2387 
     | 
    
         
             
             * You can implement your own Agent by implementing the `Agent` interface,
         
     | 
| 
       2382 
2388 
     | 
    
         
             
             * or use the `ToolLoopAgent` class.
         
     | 
| 
       2383 
2389 
     | 
    
         
             
             */
         
     | 
| 
       2384 
     | 
    
         
            -
            interface Agent<TOOLS extends ToolSet = {}, OUTPUT  
     | 
| 
      
 2390 
     | 
    
         
            +
            interface Agent<TOOLS extends ToolSet = {}, OUTPUT extends Output = never> {
         
     | 
| 
       2385 
2391 
     | 
    
         
             
                /**
         
     | 
| 
       2386 
2392 
     | 
    
         
             
                 * The specification version of the agent interface. This will enable
         
     | 
| 
       2387 
2393 
     | 
    
         
             
                 * us to evolve the agent interface and retain backwards compatibility.
         
     | 
| 
         @@ -2398,11 +2404,11 @@ interface Agent<TOOLS extends ToolSet = {}, OUTPUT = never, OUTPUT_PARTIAL = nev 
     | 
|
| 
       2398 
2404 
     | 
    
         
             
                /**
         
     | 
| 
       2399 
2405 
     | 
    
         
             
                 * Generates an output from the agent (non-streaming).
         
     | 
| 
       2400 
2406 
     | 
    
         
             
                 */
         
     | 
| 
       2401 
     | 
    
         
            -
                generate(options: Prompt): PromiseLike<GenerateTextResult<TOOLS, OUTPUT 
     | 
| 
      
 2407 
     | 
    
         
            +
                generate(options: Prompt): PromiseLike<GenerateTextResult<TOOLS, InferGenerateOutput<OUTPUT>>>;
         
     | 
| 
       2402 
2408 
     | 
    
         
             
                /**
         
     | 
| 
       2403 
2409 
     | 
    
         
             
                 * Streams an output from the agent (streaming).
         
     | 
| 
       2404 
2410 
     | 
    
         
             
                 */
         
     | 
| 
       2405 
     | 
    
         
            -
                stream(options: Prompt): StreamTextResult<TOOLS,  
     | 
| 
      
 2411 
     | 
    
         
            +
                stream(options: Prompt): StreamTextResult<TOOLS, InferStreamOutput<OUTPUT>>;
         
     | 
| 
       2406 
2412 
     | 
    
         
             
            }
         
     | 
| 
       2407 
2413 
     | 
    
         | 
| 
       2408 
2414 
     | 
    
         
             
            /**
         
     | 
| 
         @@ -2431,7 +2437,7 @@ type ToolLoopAgentOnStepFinishCallback<TOOLS extends ToolSet = {}> = (stepResult 
     | 
|
| 
       2431 
2437 
     | 
    
         
             
            /**
         
     | 
| 
       2432 
2438 
     | 
    
         
             
             * Configuration options for an agent.
         
     | 
| 
       2433 
2439 
     | 
    
         
             
             */
         
     | 
| 
       2434 
     | 
    
         
            -
            type ToolLoopAgentSettings<TOOLS extends ToolSet = {}, OUTPUT  
     | 
| 
      
 2440 
     | 
    
         
            +
            type ToolLoopAgentSettings<TOOLS extends ToolSet = {}, OUTPUT extends Output = never> = CallSettings & {
         
     | 
| 
       2435 
2441 
     | 
    
         
             
                /**
         
     | 
| 
       2436 
2442 
     | 
    
         
             
                 * The id of the agent.
         
     | 
| 
       2437 
2443 
     | 
    
         
             
                 */
         
     | 
| 
         @@ -2471,7 +2477,7 @@ type ToolLoopAgentSettings<TOOLS extends ToolSet = {}, OUTPUT = never, OUTPUT_PA 
     | 
|
| 
       2471 
2477 
     | 
    
         
             
                /**
         
     | 
| 
       2472 
2478 
     | 
    
         
             
              Optional specification for parsing structured outputs from the LLM response.
         
     | 
| 
       2473 
2479 
     | 
    
         
             
                 */
         
     | 
| 
       2474 
     | 
    
         
            -
                experimental_output?:  
     | 
| 
      
 2480 
     | 
    
         
            +
                experimental_output?: OUTPUT;
         
     | 
| 
       2475 
2481 
     | 
    
         
             
                /**
         
     | 
| 
       2476 
2482 
     | 
    
         
             
                 * @deprecated Use `prepareStep` instead.
         
     | 
| 
       2477 
2483 
     | 
    
         
             
                 */
         
     | 
| 
         @@ -2519,10 +2525,10 @@ type ToolLoopAgentSettings<TOOLS extends ToolSet = {}, OUTPUT = never, OUTPUT_PA 
     | 
|
| 
       2519 
2525 
     | 
    
         
             
             * - A tool call needs approval, or
         
     | 
| 
       2520 
2526 
     | 
    
         
             
             * - A stop condition is met (default stop condition is stepCountIs(20))
         
     | 
| 
       2521 
2527 
     | 
    
         
             
             */
         
     | 
| 
       2522 
     | 
    
         
            -
            declare class ToolLoopAgent<TOOLS extends ToolSet = {}, OUTPUT  
     | 
| 
      
 2528 
     | 
    
         
            +
            declare class ToolLoopAgent<TOOLS extends ToolSet = {}, OUTPUT extends Output = never> implements Agent<TOOLS, OUTPUT> {
         
     | 
| 
       2523 
2529 
     | 
    
         
             
                readonly version = "agent-v1";
         
     | 
| 
       2524 
2530 
     | 
    
         
             
                private readonly settings;
         
     | 
| 
       2525 
     | 
    
         
            -
                constructor(settings: ToolLoopAgentSettings<TOOLS, OUTPUT 
     | 
| 
      
 2531 
     | 
    
         
            +
                constructor(settings: ToolLoopAgentSettings<TOOLS, OUTPUT>);
         
     | 
| 
       2526 
2532 
     | 
    
         
             
                /**
         
     | 
| 
       2527 
2533 
     | 
    
         
             
                 * The id of the agent.
         
     | 
| 
       2528 
2534 
     | 
    
         
             
                 */
         
     | 
| 
         @@ -2534,17 +2540,17 @@ declare class ToolLoopAgent<TOOLS extends ToolSet = {}, OUTPUT = never, OUTPUT_P 
     | 
|
| 
       2534 
2540 
     | 
    
         
             
                /**
         
     | 
| 
       2535 
2541 
     | 
    
         
             
                 * Generates an output from the agent (non-streaming).
         
     | 
| 
       2536 
2542 
     | 
    
         
             
                 */
         
     | 
| 
       2537 
     | 
    
         
            -
                generate(options: Prompt): Promise<GenerateTextResult<TOOLS, OUTPUT 
     | 
| 
      
 2543 
     | 
    
         
            +
                generate(options: Prompt): Promise<GenerateTextResult<TOOLS, InferGenerateOutput<OUTPUT>>>;
         
     | 
| 
       2538 
2544 
     | 
    
         
             
                /**
         
     | 
| 
       2539 
2545 
     | 
    
         
             
                 * Streams an output from the agent (streaming).
         
     | 
| 
       2540 
2546 
     | 
    
         
             
                 */
         
     | 
| 
       2541 
     | 
    
         
            -
                stream(options: Prompt): StreamTextResult<TOOLS,  
     | 
| 
      
 2547 
     | 
    
         
            +
                stream(options: Prompt): StreamTextResult<TOOLS, InferStreamOutput<OUTPUT>>;
         
     | 
| 
       2542 
2548 
     | 
    
         
             
            }
         
     | 
| 
       2543 
2549 
     | 
    
         | 
| 
       2544 
2550 
     | 
    
         
             
            /**
         
     | 
| 
       2545 
2551 
     | 
    
         
             
             * Infer the type of the tools of an agent.
         
     | 
| 
       2546 
2552 
     | 
    
         
             
             */
         
     | 
| 
       2547 
     | 
    
         
            -
            type InferAgentTools<AGENT> = AGENT extends Agent<infer TOOLS,  
     | 
| 
      
 2553 
     | 
    
         
            +
            type InferAgentTools<AGENT> = AGENT extends Agent<infer TOOLS, never> ? TOOLS : never;
         
     | 
| 
       2548 
2554 
     | 
    
         | 
| 
       2549 
2555 
     | 
    
         
             
            /**
         
     | 
| 
       2550 
2556 
     | 
    
         
             
             * Infer the UI message type of an agent.
         
     | 
| 
         @@ -2559,8 +2565,8 @@ type InferAgentUIMessage<AGENT> = UIMessage<never, never, InferUITools<InferAgen 
     | 
|
| 
       2559 
2565 
     | 
    
         
             
             *
         
     | 
| 
       2560 
2566 
     | 
    
         
             
             * @returns The response object.
         
     | 
| 
       2561 
2567 
     | 
    
         
             
             */
         
     | 
| 
       2562 
     | 
    
         
            -
            declare function createAgentUIStreamResponse<TOOLS extends ToolSet = {}, OUTPUT  
     | 
| 
       2563 
     | 
    
         
            -
                agent: Agent<TOOLS, OUTPUT 
     | 
| 
      
 2568 
     | 
    
         
            +
            declare function createAgentUIStreamResponse<TOOLS extends ToolSet = {}, OUTPUT extends Output = never>({ headers, status, statusText, consumeSseStream, ...options }: {
         
     | 
| 
      
 2569 
     | 
    
         
            +
                agent: Agent<TOOLS, OUTPUT>;
         
     | 
| 
       2564 
2570 
     | 
    
         
             
                messages: unknown[];
         
     | 
| 
       2565 
2571 
     | 
    
         
             
            } & UIMessageStreamResponseInit & UIMessageStreamOptions<UIMessage<never, never, InferUITools<TOOLS>>>): Promise<Response>;
         
     | 
| 
       2566 
2572 
     | 
    
         | 
| 
         @@ -3212,8 +3218,8 @@ declare const UI_MESSAGE_STREAM_HEADERS: { 
     | 
|
| 
       3212 
3218 
     | 
    
         
             
             *
         
     | 
| 
       3213 
3219 
     | 
    
         
             
             * @returns The UI message stream.
         
     | 
| 
       3214 
3220 
     | 
    
         
             
             */
         
     | 
| 
       3215 
     | 
    
         
            -
            declare function createAgentUIStream<TOOLS extends ToolSet = {}, OUTPUT  
     | 
| 
       3216 
     | 
    
         
            -
                agent: Agent<TOOLS, OUTPUT 
     | 
| 
      
 3221 
     | 
    
         
            +
            declare function createAgentUIStream<TOOLS extends ToolSet = {}, OUTPUT extends Output = never>({ agent, messages, ...uiMessageStreamOptions }: {
         
     | 
| 
      
 3222 
     | 
    
         
            +
                agent: Agent<TOOLS, OUTPUT>;
         
     | 
| 
       3217 
3223 
     | 
    
         
             
                messages: unknown[];
         
     | 
| 
       3218 
3224 
     | 
    
         
             
            } & UIMessageStreamOptions<UIMessage<never, never, InferUITools<TOOLS>>>): Promise<AsyncIterableStream<InferUIMessageChunk<UIMessage<never, never, InferUITools<TOOLS>>>>>;
         
     | 
| 
       3219 
3225 
     | 
    
         | 
| 
         @@ -3223,9 +3229,9 @@ declare function createAgentUIStream<TOOLS extends ToolSet = {}, OUTPUT = never, 
     | 
|
| 
       3223 
3229 
     | 
    
         
             
             * @param agent - The agent to run.
         
     | 
| 
       3224 
3230 
     | 
    
         
             
             * @param messages - The input UI messages.
         
     | 
| 
       3225 
3231 
     | 
    
         
             
             */
         
     | 
| 
       3226 
     | 
    
         
            -
            declare function pipeAgentUIStreamToResponse<TOOLS extends ToolSet = {}, OUTPUT  
     | 
| 
      
 3232 
     | 
    
         
            +
            declare function pipeAgentUIStreamToResponse<TOOLS extends ToolSet = {}, OUTPUT extends Output = never>({ response, headers, status, statusText, consumeSseStream, ...options }: {
         
     | 
| 
       3227 
3233 
     | 
    
         
             
                response: ServerResponse;
         
     | 
| 
       3228 
     | 
    
         
            -
                agent: Agent<TOOLS, OUTPUT 
     | 
| 
      
 3234 
     | 
    
         
            +
                agent: Agent<TOOLS, OUTPUT>;
         
     | 
| 
       3229 
3235 
     | 
    
         
             
                messages: unknown[];
         
     | 
| 
       3230 
3236 
     | 
    
         
             
            } & UIMessageStreamResponseInit & UIMessageStreamOptions<UIMessage<never, never, InferUITools<TOOLS>>>): Promise<void>;
         
     | 
| 
       3231 
3237 
     | 
    
         | 
    
        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.63" : "0.0.0-test";
         
     | 
| 
       877 
877 
     | 
    
         | 
| 
       878 
878 
     | 
    
         
             
            // src/util/download/download.ts
         
     | 
| 
       879 
879 
     | 
    
         
             
            var download = async ({ url }) => {
         
     |