ai 6.0.0-beta.63 → 6.0.0-beta.65
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 +12 -0
 - package/dist/index.d.mts +33 -10
 - package/dist/index.d.ts +33 -10
 - package/dist/index.js +9 -7
 - package/dist/index.js.map +1 -1
 - package/dist/index.mjs +9 -7
 - 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
    
    | 
         @@ -1,5 +1,17 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # ai
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            ## 6.0.0-beta.65
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            ### Patch Changes
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            - dce4e7b: chore(agent): rename system to instructions
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            ## 6.0.0-beta.64
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            ### Patch Changes
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            - 2d28066: chore(agent): limit agent call parameters
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
       3 
15 
     | 
    
         
             
            ## 6.0.0-beta.63
         
     | 
| 
       4 
16 
     | 
    
         | 
| 
       5 
17 
     | 
    
         
             
            ### Patch Changes
         
     | 
    
        package/dist/index.d.mts
    CHANGED
    
    | 
         @@ -2380,6 +2380,33 @@ type TextStreamPart<TOOLS extends ToolSet> = { 
     | 
|
| 
       2380 
2380 
     | 
    
         
             
                rawValue: unknown;
         
     | 
| 
       2381 
2381 
     | 
    
         
             
            };
         
     | 
| 
       2382 
2382 
     | 
    
         | 
| 
      
 2383 
     | 
    
         
            +
            type AgentCallParameters = {
         
     | 
| 
      
 2384 
     | 
    
         
            +
                /**
         
     | 
| 
      
 2385 
     | 
    
         
            +
                 * A prompt. It can be either a text prompt or a list of messages.
         
     | 
| 
      
 2386 
     | 
    
         
            +
                 *
         
     | 
| 
      
 2387 
     | 
    
         
            +
                 * You can either use `prompt` or `messages` but not both.
         
     | 
| 
      
 2388 
     | 
    
         
            +
                 */
         
     | 
| 
      
 2389 
     | 
    
         
            +
                prompt: string | Array<ModelMessage>;
         
     | 
| 
      
 2390 
     | 
    
         
            +
                /**
         
     | 
| 
      
 2391 
     | 
    
         
            +
                 * A list of messages.
         
     | 
| 
      
 2392 
     | 
    
         
            +
                 *
         
     | 
| 
      
 2393 
     | 
    
         
            +
                 * You can either use `prompt` or `messages` but not both.
         
     | 
| 
      
 2394 
     | 
    
         
            +
                 */
         
     | 
| 
      
 2395 
     | 
    
         
            +
                messages?: never;
         
     | 
| 
      
 2396 
     | 
    
         
            +
            } | {
         
     | 
| 
      
 2397 
     | 
    
         
            +
                /**
         
     | 
| 
      
 2398 
     | 
    
         
            +
                 * A list of messages.
         
     | 
| 
      
 2399 
     | 
    
         
            +
                 *
         
     | 
| 
      
 2400 
     | 
    
         
            +
                 * You can either use `prompt` or `messages` but not both.
         
     | 
| 
      
 2401 
     | 
    
         
            +
                 */
         
     | 
| 
      
 2402 
     | 
    
         
            +
                messages: Array<ModelMessage>;
         
     | 
| 
      
 2403 
     | 
    
         
            +
                /**
         
     | 
| 
      
 2404 
     | 
    
         
            +
                 * A prompt. It can be either a text prompt or a list of messages.
         
     | 
| 
      
 2405 
     | 
    
         
            +
                 *
         
     | 
| 
      
 2406 
     | 
    
         
            +
                 * You can either use `prompt` or `messages` but not both.
         
     | 
| 
      
 2407 
     | 
    
         
            +
                 */
         
     | 
| 
      
 2408 
     | 
    
         
            +
                prompt?: never;
         
     | 
| 
      
 2409 
     | 
    
         
            +
            };
         
     | 
| 
       2383 
2410 
     | 
    
         
             
            /**
         
     | 
| 
       2384 
2411 
     | 
    
         
             
             * An Agent receives a prompt (text or messages) and generates or streams an output
         
     | 
| 
       2385 
2412 
     | 
    
         
             
             * that consists of steps, tool calls, data parts, etc.
         
     | 
| 
         @@ -2404,11 +2431,11 @@ interface Agent<TOOLS extends ToolSet = {}, OUTPUT extends Output = never> { 
     | 
|
| 
       2404 
2431 
     | 
    
         
             
                /**
         
     | 
| 
       2405 
2432 
     | 
    
         
             
                 * Generates an output from the agent (non-streaming).
         
     | 
| 
       2406 
2433 
     | 
    
         
             
                 */
         
     | 
| 
       2407 
     | 
    
         
            -
                generate(options:  
     | 
| 
      
 2434 
     | 
    
         
            +
                generate(options: AgentCallParameters): PromiseLike<GenerateTextResult<TOOLS, InferGenerateOutput<OUTPUT>>>;
         
     | 
| 
       2408 
2435 
     | 
    
         
             
                /**
         
     | 
| 
       2409 
2436 
     | 
    
         
             
                 * Streams an output from the agent (streaming).
         
     | 
| 
       2410 
2437 
     | 
    
         
             
                 */
         
     | 
| 
       2411 
     | 
    
         
            -
                stream(options:  
     | 
| 
      
 2438 
     | 
    
         
            +
                stream(options: AgentCallParameters): StreamTextResult<TOOLS, InferStreamOutput<OUTPUT>>;
         
     | 
| 
       2412 
2439 
     | 
    
         
             
            }
         
     | 
| 
       2413 
2440 
     | 
    
         | 
| 
       2414 
2441 
     | 
    
         
             
            /**
         
     | 
| 
         @@ -2443,9 +2470,9 @@ type ToolLoopAgentSettings<TOOLS extends ToolSet = {}, OUTPUT extends Output = n 
     | 
|
| 
       2443 
2470 
     | 
    
         
             
                 */
         
     | 
| 
       2444 
2471 
     | 
    
         
             
                id?: string;
         
     | 
| 
       2445 
2472 
     | 
    
         
             
                /**
         
     | 
| 
       2446 
     | 
    
         
            -
                 * The  
     | 
| 
      
 2473 
     | 
    
         
            +
                 * The instructions for the agent.
         
     | 
| 
       2447 
2474 
     | 
    
         
             
                 */
         
     | 
| 
       2448 
     | 
    
         
            -
                 
     | 
| 
      
 2475 
     | 
    
         
            +
                instructions?: string;
         
     | 
| 
       2449 
2476 
     | 
    
         
             
                /**
         
     | 
| 
       2450 
2477 
     | 
    
         
             
              The language model to use.
         
     | 
| 
       2451 
2478 
     | 
    
         
             
                 */
         
     | 
| 
         @@ -2479,10 +2506,6 @@ type ToolLoopAgentSettings<TOOLS extends ToolSet = {}, OUTPUT extends Output = n 
     | 
|
| 
       2479 
2506 
     | 
    
         
             
                 */
         
     | 
| 
       2480 
2507 
     | 
    
         
             
                experimental_output?: OUTPUT;
         
     | 
| 
       2481 
2508 
     | 
    
         
             
                /**
         
     | 
| 
       2482 
     | 
    
         
            -
                 * @deprecated Use `prepareStep` instead.
         
     | 
| 
       2483 
     | 
    
         
            -
                 */
         
     | 
| 
       2484 
     | 
    
         
            -
                experimental_prepareStep?: PrepareStepFunction<NoInfer<TOOLS>>;
         
     | 
| 
       2485 
     | 
    
         
            -
                /**
         
     | 
| 
       2486 
2509 
     | 
    
         
             
              Optional function that you can use to provide different settings for a step.
         
     | 
| 
       2487 
2510 
     | 
    
         
             
                */
         
     | 
| 
       2488 
2511 
     | 
    
         
             
                prepareStep?: PrepareStepFunction<NoInfer<TOOLS>>;
         
     | 
| 
         @@ -2540,11 +2563,11 @@ declare class ToolLoopAgent<TOOLS extends ToolSet = {}, OUTPUT extends Output = 
     | 
|
| 
       2540 
2563 
     | 
    
         
             
                /**
         
     | 
| 
       2541 
2564 
     | 
    
         
             
                 * Generates an output from the agent (non-streaming).
         
     | 
| 
       2542 
2565 
     | 
    
         
             
                 */
         
     | 
| 
       2543 
     | 
    
         
            -
                generate(options:  
     | 
| 
      
 2566 
     | 
    
         
            +
                generate(options: AgentCallParameters): Promise<GenerateTextResult<TOOLS, InferGenerateOutput<OUTPUT>>>;
         
     | 
| 
       2544 
2567 
     | 
    
         
             
                /**
         
     | 
| 
       2545 
2568 
     | 
    
         
             
                 * Streams an output from the agent (streaming).
         
     | 
| 
       2546 
2569 
     | 
    
         
             
                 */
         
     | 
| 
       2547 
     | 
    
         
            -
                stream(options:  
     | 
| 
      
 2570 
     | 
    
         
            +
                stream(options: AgentCallParameters): StreamTextResult<TOOLS, InferStreamOutput<OUTPUT>>;
         
     | 
| 
       2548 
2571 
     | 
    
         
             
            }
         
     | 
| 
       2549 
2572 
     | 
    
         | 
| 
       2550 
2573 
     | 
    
         
             
            /**
         
     | 
    
        package/dist/index.d.ts
    CHANGED
    
    | 
         @@ -2380,6 +2380,33 @@ type TextStreamPart<TOOLS extends ToolSet> = { 
     | 
|
| 
       2380 
2380 
     | 
    
         
             
                rawValue: unknown;
         
     | 
| 
       2381 
2381 
     | 
    
         
             
            };
         
     | 
| 
       2382 
2382 
     | 
    
         | 
| 
      
 2383 
     | 
    
         
            +
            type AgentCallParameters = {
         
     | 
| 
      
 2384 
     | 
    
         
            +
                /**
         
     | 
| 
      
 2385 
     | 
    
         
            +
                 * A prompt. It can be either a text prompt or a list of messages.
         
     | 
| 
      
 2386 
     | 
    
         
            +
                 *
         
     | 
| 
      
 2387 
     | 
    
         
            +
                 * You can either use `prompt` or `messages` but not both.
         
     | 
| 
      
 2388 
     | 
    
         
            +
                 */
         
     | 
| 
      
 2389 
     | 
    
         
            +
                prompt: string | Array<ModelMessage>;
         
     | 
| 
      
 2390 
     | 
    
         
            +
                /**
         
     | 
| 
      
 2391 
     | 
    
         
            +
                 * A list of messages.
         
     | 
| 
      
 2392 
     | 
    
         
            +
                 *
         
     | 
| 
      
 2393 
     | 
    
         
            +
                 * You can either use `prompt` or `messages` but not both.
         
     | 
| 
      
 2394 
     | 
    
         
            +
                 */
         
     | 
| 
      
 2395 
     | 
    
         
            +
                messages?: never;
         
     | 
| 
      
 2396 
     | 
    
         
            +
            } | {
         
     | 
| 
      
 2397 
     | 
    
         
            +
                /**
         
     | 
| 
      
 2398 
     | 
    
         
            +
                 * A list of messages.
         
     | 
| 
      
 2399 
     | 
    
         
            +
                 *
         
     | 
| 
      
 2400 
     | 
    
         
            +
                 * You can either use `prompt` or `messages` but not both.
         
     | 
| 
      
 2401 
     | 
    
         
            +
                 */
         
     | 
| 
      
 2402 
     | 
    
         
            +
                messages: Array<ModelMessage>;
         
     | 
| 
      
 2403 
     | 
    
         
            +
                /**
         
     | 
| 
      
 2404 
     | 
    
         
            +
                 * A prompt. It can be either a text prompt or a list of messages.
         
     | 
| 
      
 2405 
     | 
    
         
            +
                 *
         
     | 
| 
      
 2406 
     | 
    
         
            +
                 * You can either use `prompt` or `messages` but not both.
         
     | 
| 
      
 2407 
     | 
    
         
            +
                 */
         
     | 
| 
      
 2408 
     | 
    
         
            +
                prompt?: never;
         
     | 
| 
      
 2409 
     | 
    
         
            +
            };
         
     | 
| 
       2383 
2410 
     | 
    
         
             
            /**
         
     | 
| 
       2384 
2411 
     | 
    
         
             
             * An Agent receives a prompt (text or messages) and generates or streams an output
         
     | 
| 
       2385 
2412 
     | 
    
         
             
             * that consists of steps, tool calls, data parts, etc.
         
     | 
| 
         @@ -2404,11 +2431,11 @@ interface Agent<TOOLS extends ToolSet = {}, OUTPUT extends Output = never> { 
     | 
|
| 
       2404 
2431 
     | 
    
         
             
                /**
         
     | 
| 
       2405 
2432 
     | 
    
         
             
                 * Generates an output from the agent (non-streaming).
         
     | 
| 
       2406 
2433 
     | 
    
         
             
                 */
         
     | 
| 
       2407 
     | 
    
         
            -
                generate(options:  
     | 
| 
      
 2434 
     | 
    
         
            +
                generate(options: AgentCallParameters): PromiseLike<GenerateTextResult<TOOLS, InferGenerateOutput<OUTPUT>>>;
         
     | 
| 
       2408 
2435 
     | 
    
         
             
                /**
         
     | 
| 
       2409 
2436 
     | 
    
         
             
                 * Streams an output from the agent (streaming).
         
     | 
| 
       2410 
2437 
     | 
    
         
             
                 */
         
     | 
| 
       2411 
     | 
    
         
            -
                stream(options:  
     | 
| 
      
 2438 
     | 
    
         
            +
                stream(options: AgentCallParameters): StreamTextResult<TOOLS, InferStreamOutput<OUTPUT>>;
         
     | 
| 
       2412 
2439 
     | 
    
         
             
            }
         
     | 
| 
       2413 
2440 
     | 
    
         | 
| 
       2414 
2441 
     | 
    
         
             
            /**
         
     | 
| 
         @@ -2443,9 +2470,9 @@ type ToolLoopAgentSettings<TOOLS extends ToolSet = {}, OUTPUT extends Output = n 
     | 
|
| 
       2443 
2470 
     | 
    
         
             
                 */
         
     | 
| 
       2444 
2471 
     | 
    
         
             
                id?: string;
         
     | 
| 
       2445 
2472 
     | 
    
         
             
                /**
         
     | 
| 
       2446 
     | 
    
         
            -
                 * The  
     | 
| 
      
 2473 
     | 
    
         
            +
                 * The instructions for the agent.
         
     | 
| 
       2447 
2474 
     | 
    
         
             
                 */
         
     | 
| 
       2448 
     | 
    
         
            -
                 
     | 
| 
      
 2475 
     | 
    
         
            +
                instructions?: string;
         
     | 
| 
       2449 
2476 
     | 
    
         
             
                /**
         
     | 
| 
       2450 
2477 
     | 
    
         
             
              The language model to use.
         
     | 
| 
       2451 
2478 
     | 
    
         
             
                 */
         
     | 
| 
         @@ -2479,10 +2506,6 @@ type ToolLoopAgentSettings<TOOLS extends ToolSet = {}, OUTPUT extends Output = n 
     | 
|
| 
       2479 
2506 
     | 
    
         
             
                 */
         
     | 
| 
       2480 
2507 
     | 
    
         
             
                experimental_output?: OUTPUT;
         
     | 
| 
       2481 
2508 
     | 
    
         
             
                /**
         
     | 
| 
       2482 
     | 
    
         
            -
                 * @deprecated Use `prepareStep` instead.
         
     | 
| 
       2483 
     | 
    
         
            -
                 */
         
     | 
| 
       2484 
     | 
    
         
            -
                experimental_prepareStep?: PrepareStepFunction<NoInfer<TOOLS>>;
         
     | 
| 
       2485 
     | 
    
         
            -
                /**
         
     | 
| 
       2486 
2509 
     | 
    
         
             
              Optional function that you can use to provide different settings for a step.
         
     | 
| 
       2487 
2510 
     | 
    
         
             
                */
         
     | 
| 
       2488 
2511 
     | 
    
         
             
                prepareStep?: PrepareStepFunction<NoInfer<TOOLS>>;
         
     | 
| 
         @@ -2540,11 +2563,11 @@ declare class ToolLoopAgent<TOOLS extends ToolSet = {}, OUTPUT extends Output = 
     | 
|
| 
       2540 
2563 
     | 
    
         
             
                /**
         
     | 
| 
       2541 
2564 
     | 
    
         
             
                 * Generates an output from the agent (non-streaming).
         
     | 
| 
       2542 
2565 
     | 
    
         
             
                 */
         
     | 
| 
       2543 
     | 
    
         
            -
                generate(options:  
     | 
| 
      
 2566 
     | 
    
         
            +
                generate(options: AgentCallParameters): Promise<GenerateTextResult<TOOLS, InferGenerateOutput<OUTPUT>>>;
         
     | 
| 
       2544 
2567 
     | 
    
         
             
                /**
         
     | 
| 
       2545 
2568 
     | 
    
         
             
                 * Streams an output from the agent (streaming).
         
     | 
| 
       2546 
2569 
     | 
    
         
             
                 */
         
     | 
| 
       2547 
     | 
    
         
            -
                stream(options:  
     | 
| 
      
 2570 
     | 
    
         
            +
                stream(options: AgentCallParameters): StreamTextResult<TOOLS, InferStreamOutput<OUTPUT>>;
         
     | 
| 
       2548 
2571 
     | 
    
         
             
            }
         
     | 
| 
       2549 
2572 
     | 
    
         | 
| 
       2550 
2573 
     | 
    
         
             
            /**
         
     | 
    
        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.65" : "0.0.0-test";
         
     | 
| 
       877 
877 
     | 
    
         | 
| 
       878 
878 
     | 
    
         
             
            // src/util/download/download.ts
         
     | 
| 
       879 
879 
     | 
    
         
             
            var download = async ({ url }) => {
         
     | 
| 
         @@ -6345,10 +6345,11 @@ var ToolLoopAgent = class { 
     | 
|
| 
       6345 
6345 
     | 
    
         
             
               * Generates an output from the agent (non-streaming).
         
     | 
| 
       6346 
6346 
     | 
    
         
             
               */
         
     | 
| 
       6347 
6347 
     | 
    
         
             
              async generate(options) {
         
     | 
| 
       6348 
     | 
    
         
            -
                 
     | 
| 
      
 6348 
     | 
    
         
            +
                const { instructions, stopWhen, ...settings } = this.settings;
         
     | 
| 
       6349 
6349 
     | 
    
         
             
                return generateText({
         
     | 
| 
       6350 
     | 
    
         
            -
                  ... 
     | 
| 
       6351 
     | 
    
         
            -
                   
     | 
| 
      
 6350 
     | 
    
         
            +
                  ...settings,
         
     | 
| 
      
 6351 
     | 
    
         
            +
                  system: instructions,
         
     | 
| 
      
 6352 
     | 
    
         
            +
                  stopWhen: stopWhen != null ? stopWhen : stepCountIs(20),
         
     | 
| 
       6352 
6353 
     | 
    
         
             
                  ...options
         
     | 
| 
       6353 
6354 
     | 
    
         
             
                });
         
     | 
| 
       6354 
6355 
     | 
    
         
             
              }
         
     | 
| 
         @@ -6356,10 +6357,11 @@ var ToolLoopAgent = class { 
     | 
|
| 
       6356 
6357 
     | 
    
         
             
               * Streams an output from the agent (streaming).
         
     | 
| 
       6357 
6358 
     | 
    
         
             
               */
         
     | 
| 
       6358 
6359 
     | 
    
         
             
              stream(options) {
         
     | 
| 
       6359 
     | 
    
         
            -
                 
     | 
| 
      
 6360 
     | 
    
         
            +
                const { instructions, stopWhen, ...settings } = this.settings;
         
     | 
| 
       6360 
6361 
     | 
    
         
             
                return streamText({
         
     | 
| 
       6361 
     | 
    
         
            -
                  ... 
     | 
| 
       6362 
     | 
    
         
            -
                   
     | 
| 
      
 6362 
     | 
    
         
            +
                  ...settings,
         
     | 
| 
      
 6363 
     | 
    
         
            +
                  system: instructions,
         
     | 
| 
      
 6364 
     | 
    
         
            +
                  stopWhen: stopWhen != null ? stopWhen : stepCountIs(20),
         
     | 
| 
       6363 
6365 
     | 
    
         
             
                  ...options
         
     | 
| 
       6364 
6366 
     | 
    
         
             
                });
         
     | 
| 
       6365 
6367 
     | 
    
         
             
              }
         
     |