ai 6.0.0-beta.64 → 6.0.0-beta.66

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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.64" : "0.0.0-test";
778
+ var VERSION = true ? "6.0.0-beta.66" : "0.0.0-test";
779
779
 
780
780
  // src/util/download/download.ts
781
781
  var download = async ({ url }) => {
@@ -6263,27 +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
- var _a17;
6271
- return generateText({
6272
- ...this.settings,
6273
- stopWhen: (_a17 = this.settings.stopWhen) != null ? _a17 : stepCountIs(20),
6274
- ...options
6275
- });
6285
+ return generateText(await this.prepareCall(options));
6276
6286
  }
6277
6287
  /**
6278
6288
  * Streams an output from the agent (streaming).
6279
6289
  */
6280
- stream(options) {
6281
- var _a17;
6282
- return streamText({
6283
- ...this.settings,
6284
- stopWhen: (_a17 = this.settings.stopWhen) != null ? _a17 : stepCountIs(20),
6285
- ...options
6286
- });
6290
+ async stream(options) {
6291
+ return streamText(await this.prepareCall(options));
6287
6292
  }
6288
6293
  };
6289
6294
 
@@ -7013,6 +7018,7 @@ async function validateUIMessages({
7013
7018
  async function createAgentUIStream({
7014
7019
  agent,
7015
7020
  messages,
7021
+ options,
7016
7022
  ...uiMessageStreamOptions
7017
7023
  }) {
7018
7024
  const validatedMessages = await validateUIMessages({
@@ -7022,7 +7028,10 @@ async function createAgentUIStream({
7022
7028
  const modelMessages = convertToModelMessages(validatedMessages, {
7023
7029
  tools: agent.tools
7024
7030
  });
7025
- const result = agent.stream({ prompt: modelMessages });
7031
+ const result = await agent.stream({
7032
+ prompt: modelMessages,
7033
+ options
7034
+ });
7026
7035
  return result.toUIMessageStream(uiMessageStreamOptions);
7027
7036
  }
7028
7037