ai 6.0.0-beta.65 → 6.0.0-beta.67

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -775,7 +775,7 @@ import {
775
775
  } from "@ai-sdk/provider-utils";
776
776
 
777
777
  // src/version.ts
778
- var VERSION = true ? "6.0.0-beta.65" : "0.0.0-test";
778
+ var VERSION = true ? "6.0.0-beta.67" : "0.0.0-test";
779
779
 
780
780
  // src/util/download/download.ts
781
781
  var download = async ({ url }) => {
@@ -6263,29 +6263,32 @@ var ToolLoopAgent = class {
6263
6263
  get tools() {
6264
6264
  return this.settings.tools;
6265
6265
  }
6266
+ async prepareCall(options) {
6267
+ var _a17, _b, _c, _d;
6268
+ const baseCallArgs = {
6269
+ ...this.settings,
6270
+ stopWhen: (_a17 = this.settings.stopWhen) != null ? _a17 : stepCountIs(20),
6271
+ ...options
6272
+ };
6273
+ const preparedCallArgs = (_d = await ((_c = (_b = this.settings).prepareCall) == null ? void 0 : _c.call(_b, baseCallArgs))) != null ? _d : baseCallArgs;
6274
+ const { instructions, messages, prompt, ...callArgs } = preparedCallArgs;
6275
+ return {
6276
+ ...callArgs,
6277
+ // restore prompt types
6278
+ ...{ system: instructions, messages, prompt }
6279
+ };
6280
+ }
6266
6281
  /**
6267
6282
  * Generates an output from the agent (non-streaming).
6268
6283
  */
6269
6284
  async generate(options) {
6270
- const { instructions, stopWhen, ...settings } = this.settings;
6271
- return generateText({
6272
- ...settings,
6273
- system: instructions,
6274
- stopWhen: stopWhen != null ? stopWhen : stepCountIs(20),
6275
- ...options
6276
- });
6285
+ return generateText(await this.prepareCall(options));
6277
6286
  }
6278
6287
  /**
6279
6288
  * Streams an output from the agent (streaming).
6280
6289
  */
6281
- stream(options) {
6282
- const { instructions, stopWhen, ...settings } = this.settings;
6283
- return streamText({
6284
- ...settings,
6285
- system: instructions,
6286
- stopWhen: stopWhen != null ? stopWhen : stepCountIs(20),
6287
- ...options
6288
- });
6290
+ async stream(options) {
6291
+ return streamText(await this.prepareCall(options));
6289
6292
  }
6290
6293
  };
6291
6294
 
@@ -7015,6 +7018,7 @@ async function validateUIMessages({
7015
7018
  async function createAgentUIStream({
7016
7019
  agent,
7017
7020
  messages,
7021
+ options,
7018
7022
  ...uiMessageStreamOptions
7019
7023
  }) {
7020
7024
  const validatedMessages = await validateUIMessages({
@@ -7024,7 +7028,10 @@ async function createAgentUIStream({
7024
7028
  const modelMessages = convertToModelMessages(validatedMessages, {
7025
7029
  tools: agent.tools
7026
7030
  });
7027
- const result = agent.stream({ prompt: modelMessages });
7031
+ const result = await agent.stream({
7032
+ prompt: modelMessages,
7033
+ options
7034
+ });
7028
7035
  return result.toUIMessageStream(uiMessageStreamOptions);
7029
7036
  }
7030
7037