ai 5.0.180 → 5.0.181

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.js CHANGED
@@ -59,7 +59,7 @@ __export(src_exports, {
59
59
  UI_MESSAGE_STREAM_HEADERS: () => UI_MESSAGE_STREAM_HEADERS,
60
60
  UnsupportedFunctionalityError: () => import_provider17.UnsupportedFunctionalityError,
61
61
  UnsupportedModelVersionError: () => UnsupportedModelVersionError,
62
- asSchema: () => import_provider_utils35.asSchema,
62
+ asSchema: () => import_provider_utils34.asSchema,
63
63
  assistantModelMessageSchema: () => assistantModelMessageSchema,
64
64
  callCompletionApi: () => callCompletionApi,
65
65
  consumeStream: () => consumeStream,
@@ -74,14 +74,14 @@ __export(src_exports, {
74
74
  cosineSimilarity: () => cosineSimilarity,
75
75
  createDownload: () => createDownload,
76
76
  createGateway: () => import_gateway3.createGateway,
77
- createIdGenerator: () => import_provider_utils35.createIdGenerator,
77
+ createIdGenerator: () => import_provider_utils34.createIdGenerator,
78
78
  createProviderRegistry: () => createProviderRegistry,
79
79
  createTextStreamResponse: () => createTextStreamResponse,
80
80
  createUIMessageStream: () => createUIMessageStream,
81
81
  createUIMessageStreamResponse: () => createUIMessageStreamResponse,
82
82
  customProvider: () => customProvider,
83
83
  defaultSettingsMiddleware: () => defaultSettingsMiddleware,
84
- dynamicTool: () => import_provider_utils35.dynamicTool,
84
+ dynamicTool: () => import_provider_utils34.dynamicTool,
85
85
  embed: () => embed,
86
86
  embedMany: () => embedMany,
87
87
  experimental_createProviderRegistry: () => experimental_createProviderRegistry,
@@ -91,7 +91,7 @@ __export(src_exports, {
91
91
  experimental_transcribe: () => transcribe,
92
92
  extractReasoningMiddleware: () => extractReasoningMiddleware,
93
93
  gateway: () => import_gateway3.gateway,
94
- generateId: () => import_provider_utils35.generateId,
94
+ generateId: () => import_provider_utils34.generateId,
95
95
  generateObject: () => generateObject,
96
96
  generateText: () => generateText,
97
97
  getTextFromDataUrl: () => getTextFromDataUrl,
@@ -105,10 +105,10 @@ __export(src_exports, {
105
105
  isTextUIPart: () => isTextUIPart,
106
106
  isToolOrDynamicToolUIPart: () => isToolOrDynamicToolUIPart,
107
107
  isToolUIPart: () => isToolUIPart,
108
- jsonSchema: () => import_provider_utils35.jsonSchema,
108
+ jsonSchema: () => import_provider_utils34.jsonSchema,
109
109
  lastAssistantMessageIsCompleteWithToolCalls: () => lastAssistantMessageIsCompleteWithToolCalls,
110
110
  modelMessageSchema: () => modelMessageSchema,
111
- parseJsonEventStream: () => import_provider_utils35.parseJsonEventStream,
111
+ parseJsonEventStream: () => import_provider_utils34.parseJsonEventStream,
112
112
  parsePartialJson: () => parsePartialJson,
113
113
  pipeTextStreamToResponse: () => pipeTextStreamToResponse,
114
114
  pipeUIMessageStreamToResponse: () => pipeUIMessageStreamToResponse,
@@ -122,21 +122,21 @@ __export(src_exports, {
122
122
  streamObject: () => streamObject,
123
123
  streamText: () => streamText,
124
124
  systemModelMessageSchema: () => systemModelMessageSchema,
125
- tool: () => import_provider_utils35.tool,
125
+ tool: () => import_provider_utils34.tool,
126
126
  toolModelMessageSchema: () => toolModelMessageSchema,
127
127
  uiMessageChunkSchema: () => uiMessageChunkSchema,
128
128
  userModelMessageSchema: () => userModelMessageSchema,
129
129
  validateUIMessages: () => validateUIMessages,
130
130
  wrapLanguageModel: () => wrapLanguageModel,
131
131
  wrapProvider: () => wrapProvider,
132
- zodSchema: () => import_provider_utils35.zodSchema
132
+ zodSchema: () => import_provider_utils34.zodSchema
133
133
  });
134
134
  module.exports = __toCommonJS(src_exports);
135
135
  var import_gateway3 = require("@ai-sdk/gateway");
136
- var import_provider_utils35 = require("@ai-sdk/provider-utils");
136
+ var import_provider_utils34 = require("@ai-sdk/provider-utils");
137
137
 
138
138
  // src/generate-text/generate-text.ts
139
- var import_provider_utils11 = require("@ai-sdk/provider-utils");
139
+ var import_provider_utils10 = require("@ai-sdk/provider-utils");
140
140
 
141
141
  // src/error/no-output-specified-error.ts
142
142
  var import_provider = require("@ai-sdk/provider");
@@ -587,7 +587,7 @@ function getGlobalProvider() {
587
587
  }
588
588
 
589
589
  // src/prompt/convert-to-language-model-prompt.ts
590
- var import_provider_utils5 = require("@ai-sdk/provider-utils");
590
+ var import_provider_utils4 = require("@ai-sdk/provider-utils");
591
591
 
592
592
  // src/util/detect-media-type.ts
593
593
  var import_provider_utils = require("@ai-sdk/provider-utils");
@@ -776,10 +776,9 @@ function detectMediaType({
776
776
 
777
777
  // src/util/download/download.ts
778
778
  var import_provider_utils2 = require("@ai-sdk/provider-utils");
779
- var import_provider_utils3 = require("@ai-sdk/provider-utils");
780
779
 
781
780
  // src/version.ts
782
- var VERSION = true ? "5.0.180" : "0.0.0-test";
781
+ var VERSION = true ? "5.0.181" : "0.0.0-test";
783
782
 
784
783
  // src/util/download/download.ts
785
784
  var download = async ({
@@ -792,10 +791,10 @@ var download = async ({
792
791
  (0, import_provider_utils2.validateDownloadUrl)(urlText);
793
792
  try {
794
793
  const response = await fetch(urlText, {
795
- headers: (0, import_provider_utils3.withUserAgentSuffix)(
794
+ headers: (0, import_provider_utils2.withUserAgentSuffix)(
796
795
  {},
797
796
  `ai-sdk/${VERSION}`,
798
- (0, import_provider_utils3.getRuntimeEnvironmentUserAgent)()
797
+ (0, import_provider_utils2.getRuntimeEnvironmentUserAgent)()
799
798
  ),
800
799
  signal: abortSignal
801
800
  });
@@ -835,7 +834,7 @@ var createDefaultDownloadFunction = (download2 = download) => (requestedDownload
835
834
 
836
835
  // src/prompt/data-content.ts
837
836
  var import_provider18 = require("@ai-sdk/provider");
838
- var import_provider_utils4 = require("@ai-sdk/provider-utils");
837
+ var import_provider_utils3 = require("@ai-sdk/provider-utils");
839
838
  var import_v4 = require("zod/v4");
840
839
 
841
840
  // src/prompt/split-data-url.ts
@@ -900,9 +899,9 @@ function convertDataContentToBase64String(content) {
900
899
  return content;
901
900
  }
902
901
  if (content instanceof ArrayBuffer) {
903
- return (0, import_provider_utils4.convertUint8ArrayToBase64)(new Uint8Array(content));
902
+ return (0, import_provider_utils3.convertUint8ArrayToBase64)(new Uint8Array(content));
904
903
  }
905
- return (0, import_provider_utils4.convertUint8ArrayToBase64)(content);
904
+ return (0, import_provider_utils3.convertUint8ArrayToBase64)(content);
906
905
  }
907
906
  function convertDataContentToUint8Array(content) {
908
907
  if (content instanceof Uint8Array) {
@@ -910,7 +909,7 @@ function convertDataContentToUint8Array(content) {
910
909
  }
911
910
  if (typeof content === "string") {
912
911
  try {
913
- return (0, import_provider_utils4.convertBase64ToUint8Array)(content);
912
+ return (0, import_provider_utils3.convertBase64ToUint8Array)(content);
914
913
  } catch (error) {
915
914
  throw new InvalidDataContentError({
916
915
  message: "Invalid data content. Content string is not a base64-encoded media.",
@@ -1075,7 +1074,7 @@ async function downloadAssets(messages, download2, supportedUrls) {
1075
1074
  (part) => part.data instanceof URL
1076
1075
  ).map((part) => ({
1077
1076
  url: part.data,
1078
- isUrlSupportedByModel: part.mediaType != null && (0, import_provider_utils5.isUrlSupported)({
1077
+ isUrlSupportedByModel: part.mediaType != null && (0, import_provider_utils4.isUrlSupported)({
1079
1078
  url: part.data.toString(),
1080
1079
  mediaType: part.mediaType,
1081
1080
  supportedUrls
@@ -1245,7 +1244,7 @@ function prepareCallSettings({
1245
1244
  }
1246
1245
 
1247
1246
  // src/prompt/prepare-tools-and-tool-choice.ts
1248
- var import_provider_utils6 = require("@ai-sdk/provider-utils");
1247
+ var import_provider_utils5 = require("@ai-sdk/provider-utils");
1249
1248
 
1250
1249
  // src/util/is-non-empty-object.ts
1251
1250
  function isNonEmptyObject(object2) {
@@ -1278,7 +1277,7 @@ function prepareToolsAndToolChoice({
1278
1277
  type: "function",
1279
1278
  name: name16,
1280
1279
  description: tool2.description,
1281
- inputSchema: (0, import_provider_utils6.asSchema)(tool2.inputSchema).jsonSchema,
1280
+ inputSchema: (0, import_provider_utils5.asSchema)(tool2.inputSchema).jsonSchema,
1282
1281
  providerOptions: tool2.providerOptions
1283
1282
  };
1284
1283
  case "provider-defined":
@@ -1300,7 +1299,7 @@ function prepareToolsAndToolChoice({
1300
1299
 
1301
1300
  // src/prompt/standardize-prompt.ts
1302
1301
  var import_provider19 = require("@ai-sdk/provider");
1303
- var import_provider_utils7 = require("@ai-sdk/provider-utils");
1302
+ var import_provider_utils6 = require("@ai-sdk/provider-utils");
1304
1303
  var import_v46 = require("zod/v4");
1305
1304
 
1306
1305
  // src/prompt/message.ts
@@ -1491,7 +1490,7 @@ async function standardizePrompt(prompt) {
1491
1490
  message: "messages must not be empty"
1492
1491
  });
1493
1492
  }
1494
- const validationResult = await (0, import_provider_utils7.safeValidateTypes)({
1493
+ const validationResult = await (0, import_provider_utils6.safeValidateTypes)({
1495
1494
  value: messages,
1496
1495
  schema: import_v46.z.array(modelMessageSchema)
1497
1496
  });
@@ -1774,7 +1773,7 @@ function asArray(value) {
1774
1773
 
1775
1774
  // src/util/retry-with-exponential-backoff.ts
1776
1775
  var import_provider21 = require("@ai-sdk/provider");
1777
- var import_provider_utils8 = require("@ai-sdk/provider-utils");
1776
+ var import_provider_utils7 = require("@ai-sdk/provider-utils");
1778
1777
  function getRetryDelayInMs({
1779
1778
  error,
1780
1779
  exponentialBackoffDelay
@@ -1824,13 +1823,13 @@ async function _retryWithExponentialBackoff(f, {
1824
1823
  try {
1825
1824
  return await f();
1826
1825
  } catch (error) {
1827
- if ((0, import_provider_utils8.isAbortError)(error)) {
1826
+ if ((0, import_provider_utils7.isAbortError)(error)) {
1828
1827
  throw error;
1829
1828
  }
1830
1829
  if (maxRetries === 0) {
1831
1830
  throw error;
1832
1831
  }
1833
- const errorMessage = (0, import_provider_utils8.getErrorMessage)(error);
1832
+ const errorMessage = (0, import_provider_utils7.getErrorMessage)(error);
1834
1833
  const newErrors = [...errors, error];
1835
1834
  const tryNumber = newErrors.length;
1836
1835
  if (tryNumber > maxRetries) {
@@ -1841,7 +1840,7 @@ async function _retryWithExponentialBackoff(f, {
1841
1840
  });
1842
1841
  }
1843
1842
  if (error instanceof Error && import_provider21.APICallError.isInstance(error) && error.isRetryable === true && tryNumber <= maxRetries) {
1844
- await (0, import_provider_utils8.delay)(
1843
+ await (0, import_provider_utils7.delay)(
1845
1844
  getRetryDelayInMs({
1846
1845
  error,
1847
1846
  exponentialBackoffDelay: delayInMs
@@ -1913,7 +1912,7 @@ function extractTextContent(content) {
1913
1912
  }
1914
1913
 
1915
1914
  // src/generate-text/generated-file.ts
1916
- var import_provider_utils9 = require("@ai-sdk/provider-utils");
1915
+ var import_provider_utils8 = require("@ai-sdk/provider-utils");
1917
1916
  var DefaultGeneratedFile = class {
1918
1917
  constructor({
1919
1918
  data,
@@ -1927,14 +1926,14 @@ var DefaultGeneratedFile = class {
1927
1926
  // lazy conversion with caching to avoid unnecessary conversion overhead:
1928
1927
  get base64() {
1929
1928
  if (this.base64Data == null) {
1930
- this.base64Data = (0, import_provider_utils9.convertUint8ArrayToBase64)(this.uint8ArrayData);
1929
+ this.base64Data = (0, import_provider_utils8.convertUint8ArrayToBase64)(this.uint8ArrayData);
1931
1930
  }
1932
1931
  return this.base64Data;
1933
1932
  }
1934
1933
  // lazy conversion with caching to avoid unnecessary conversion overhead:
1935
1934
  get uint8Array() {
1936
1935
  if (this.uint8ArrayData == null) {
1937
- this.uint8ArrayData = (0, import_provider_utils9.convertBase64ToUint8Array)(this.base64Data);
1936
+ this.uint8ArrayData = (0, import_provider_utils8.convertBase64ToUint8Array)(this.base64Data);
1938
1937
  }
1939
1938
  return this.uint8ArrayData;
1940
1939
  }
@@ -1947,7 +1946,7 @@ var DefaultGeneratedFileWithType = class extends DefaultGeneratedFile {
1947
1946
  };
1948
1947
 
1949
1948
  // src/generate-text/parse-tool-call.ts
1950
- var import_provider_utils10 = require("@ai-sdk/provider-utils");
1949
+ var import_provider_utils9 = require("@ai-sdk/provider-utils");
1951
1950
  async function parseToolCall({
1952
1951
  toolCall,
1953
1952
  tools,
@@ -1972,7 +1971,7 @@ async function parseToolCall({
1972
1971
  tools,
1973
1972
  inputSchema: ({ toolName }) => {
1974
1973
  const { inputSchema } = tools[toolName];
1975
- return (0, import_provider_utils10.asSchema)(inputSchema).jsonSchema;
1974
+ return (0, import_provider_utils9.asSchema)(inputSchema).jsonSchema;
1976
1975
  },
1977
1976
  system,
1978
1977
  messages,
@@ -1990,7 +1989,7 @@ async function parseToolCall({
1990
1989
  return await doParseToolCall({ toolCall: repairedToolCall, tools });
1991
1990
  }
1992
1991
  } catch (error) {
1993
- const parsedInput = await (0, import_provider_utils10.safeParseJSON)({ text: toolCall.input });
1992
+ const parsedInput = await (0, import_provider_utils9.safeParseJSON)({ text: toolCall.input });
1994
1993
  const input = parsedInput.success ? parsedInput.value : toolCall.input;
1995
1994
  return {
1996
1995
  type: "tool-call",
@@ -2016,8 +2015,8 @@ async function doParseToolCall({
2016
2015
  availableTools: Object.keys(tools)
2017
2016
  });
2018
2017
  }
2019
- const schema = (0, import_provider_utils10.asSchema)(tool2.inputSchema);
2020
- const parseResult = toolCall.input.trim() === "" ? await (0, import_provider_utils10.safeValidateTypes)({ value: {}, schema }) : await (0, import_provider_utils10.safeParseJSON)({ text: toolCall.input, schema });
2018
+ const schema = (0, import_provider_utils9.asSchema)(tool2.inputSchema);
2019
+ const parseResult = toolCall.input.trim() === "" ? await (0, import_provider_utils9.safeValidateTypes)({ value: {}, schema }) : await (0, import_provider_utils9.safeParseJSON)({ text: toolCall.input, schema });
2021
2020
  if (parseResult.success === false) {
2022
2021
  throw new InvalidToolInputError({
2023
2022
  toolName,
@@ -2237,7 +2236,7 @@ function toResponseMessages({
2237
2236
  }
2238
2237
 
2239
2238
  // src/generate-text/generate-text.ts
2240
- var originalGenerateId = (0, import_provider_utils11.createIdGenerator)({
2239
+ var originalGenerateId = (0, import_provider_utils10.createIdGenerator)({
2241
2240
  prefix: "aitxt",
2242
2241
  size: 24
2243
2242
  });
@@ -2276,7 +2275,7 @@ async function generateText({
2276
2275
  abortSignal
2277
2276
  });
2278
2277
  const callSettings = prepareCallSettings(settings);
2279
- const headersWithUserAgent = (0, import_provider_utils11.withUserAgentSuffix)(
2278
+ const headersWithUserAgent = (0, import_provider_utils10.withUserAgentSuffix)(
2280
2279
  headers != null ? headers : {},
2281
2280
  `ai/${VERSION}`
2282
2281
  );
@@ -2482,7 +2481,7 @@ async function generateText({
2482
2481
  toolCallId: toolCall.toolCallId,
2483
2482
  toolName: toolCall.toolName,
2484
2483
  input: toolCall.input,
2485
- error: (0, import_provider_utils11.getErrorMessage)(toolCall.error),
2484
+ error: (0, import_provider_utils10.getErrorMessage)(toolCall.error),
2486
2485
  dynamic: true
2487
2486
  });
2488
2487
  }
@@ -2616,7 +2615,7 @@ async function executeTools({
2616
2615
  tracer,
2617
2616
  fn: async (span) => {
2618
2617
  try {
2619
- const stream = (0, import_provider_utils11.executeTool)({
2618
+ const stream = (0, import_provider_utils10.executeTool)({
2620
2619
  execute: tool2.execute.bind(tool2),
2621
2620
  input,
2622
2621
  options: {
@@ -2827,7 +2826,7 @@ function asContent({
2827
2826
 
2828
2827
  // src/generate-text/stream-text.ts
2829
2828
  var import_provider23 = require("@ai-sdk/provider");
2830
- var import_provider_utils16 = require("@ai-sdk/provider-utils");
2829
+ var import_provider_utils15 = require("@ai-sdk/provider-utils");
2831
2830
 
2832
2831
  // src/util/prepare-headers.ts
2833
2832
  function prepareHeaders(headers, defaultHeaders) {
@@ -2974,13 +2973,13 @@ function getResponseUIMessageId({
2974
2973
  }
2975
2974
 
2976
2975
  // src/ui/process-ui-message-stream.ts
2977
- var import_provider_utils14 = require("@ai-sdk/provider-utils");
2976
+ var import_provider_utils13 = require("@ai-sdk/provider-utils");
2978
2977
 
2979
2978
  // src/ui-message-stream/ui-message-chunks.ts
2980
2979
  var import_v47 = require("zod/v4");
2981
- var import_provider_utils12 = require("@ai-sdk/provider-utils");
2982
- var uiMessageChunkSchema = (0, import_provider_utils12.lazyValidator)(
2983
- () => (0, import_provider_utils12.zodSchema)(
2980
+ var import_provider_utils11 = require("@ai-sdk/provider-utils");
2981
+ var uiMessageChunkSchema = (0, import_provider_utils11.lazyValidator)(
2982
+ () => (0, import_provider_utils11.zodSchema)(
2984
2983
  import_v47.z.union([
2985
2984
  import_v47.z.strictObject({
2986
2985
  type: import_v47.z.literal("text-start"),
@@ -3145,6 +3144,9 @@ function mergeObjects(base, overrides) {
3145
3144
  }
3146
3145
  const result = { ...base };
3147
3146
  for (const key in overrides) {
3147
+ if (key === "__proto__" || key === "constructor" || key === "prototype") {
3148
+ continue;
3149
+ }
3148
3150
  if (Object.prototype.hasOwnProperty.call(overrides, key)) {
3149
3151
  const overridesValue = overrides[key];
3150
3152
  if (overridesValue === void 0)
@@ -3166,7 +3168,7 @@ function mergeObjects(base, overrides) {
3166
3168
  }
3167
3169
 
3168
3170
  // src/util/parse-partial-json.ts
3169
- var import_provider_utils13 = require("@ai-sdk/provider-utils");
3171
+ var import_provider_utils12 = require("@ai-sdk/provider-utils");
3170
3172
 
3171
3173
  // src/util/fix-json.ts
3172
3174
  function fixJson(input) {
@@ -3491,11 +3493,11 @@ async function parsePartialJson(jsonText) {
3491
3493
  if (jsonText === void 0) {
3492
3494
  return { value: void 0, state: "undefined-input" };
3493
3495
  }
3494
- let result = await (0, import_provider_utils13.safeParseJSON)({ text: jsonText });
3496
+ let result = await (0, import_provider_utils12.safeParseJSON)({ text: jsonText });
3495
3497
  if (result.success) {
3496
3498
  return { value: result.value, state: "successful-parse" };
3497
3499
  }
3498
- result = await (0, import_provider_utils13.safeParseJSON)({ text: fixJson(jsonText) });
3500
+ result = await (0, import_provider_utils12.safeParseJSON)({ text: fixJson(jsonText) });
3499
3501
  if (result.success) {
3500
3502
  return { value: result.value, state: "repaired-parse" };
3501
3503
  }
@@ -3659,7 +3661,7 @@ function processUIMessageStream({
3659
3661
  if (metadata != null) {
3660
3662
  const mergedMetadata = state.message.metadata != null ? mergeObjects(state.message.metadata, metadata) : metadata;
3661
3663
  if (messageMetadataSchema != null) {
3662
- await (0, import_provider_utils14.validateTypes)({
3664
+ await (0, import_provider_utils13.validateTypes)({
3663
3665
  value: mergedMetadata,
3664
3666
  schema: messageMetadataSchema
3665
3667
  });
@@ -3959,7 +3961,7 @@ function processUIMessageStream({
3959
3961
  default: {
3960
3962
  if (isDataUIMessageChunk(chunk)) {
3961
3963
  if ((dataPartSchemas == null ? void 0 : dataPartSchemas[chunk.type]) != null) {
3962
- await (0, import_provider_utils14.validateTypes)({
3964
+ await (0, import_provider_utils13.validateTypes)({
3963
3965
  value: chunk.data,
3964
3966
  schema: dataPartSchemas[chunk.type]
3965
3967
  });
@@ -4278,7 +4280,7 @@ function now() {
4278
4280
  }
4279
4281
 
4280
4282
  // src/generate-text/run-tools-transformation.ts
4281
- var import_provider_utils15 = require("@ai-sdk/provider-utils");
4283
+ var import_provider_utils14 = require("@ai-sdk/provider-utils");
4282
4284
  function runToolsTransformation({
4283
4285
  tools,
4284
4286
  generatorStream,
@@ -4364,7 +4366,7 @@ function runToolsTransformation({
4364
4366
  toolCallId: toolCall.toolCallId,
4365
4367
  toolName: toolCall.toolName,
4366
4368
  input: toolCall.input,
4367
- error: (0, import_provider_utils15.getErrorMessage)(toolCall.error),
4369
+ error: (0, import_provider_utils14.getErrorMessage)(toolCall.error),
4368
4370
  dynamic: true
4369
4371
  });
4370
4372
  break;
@@ -4381,7 +4383,7 @@ function runToolsTransformation({
4381
4383
  });
4382
4384
  }
4383
4385
  if (tool2.execute != null && toolCall.providerExecuted !== true) {
4384
- const toolExecutionId = (0, import_provider_utils15.generateId)();
4386
+ const toolExecutionId = (0, import_provider_utils14.generateId)();
4385
4387
  outstandingToolResults.add(toolExecutionId);
4386
4388
  recordSpan({
4387
4389
  name: "ai.toolCall",
@@ -4403,7 +4405,7 @@ function runToolsTransformation({
4403
4405
  fn: async (span) => {
4404
4406
  let output;
4405
4407
  try {
4406
- const stream = (0, import_provider_utils15.executeTool)({
4408
+ const stream = (0, import_provider_utils14.executeTool)({
4407
4409
  execute: tool2.execute.bind(tool2),
4408
4410
  input: toolCall.input,
4409
4411
  options: {
@@ -4522,7 +4524,7 @@ function runToolsTransformation({
4522
4524
  }
4523
4525
 
4524
4526
  // src/generate-text/stream-text.ts
4525
- var originalGenerateId2 = (0, import_provider_utils16.createIdGenerator)({
4527
+ var originalGenerateId2 = (0, import_provider_utils15.createIdGenerator)({
4526
4528
  prefix: "aitxt",
4527
4529
  size: 24
4528
4530
  });
@@ -4691,9 +4693,9 @@ var DefaultStreamTextResult = class {
4691
4693
  experimental_context,
4692
4694
  download: download2
4693
4695
  }) {
4694
- this._totalUsage = new import_provider_utils16.DelayedPromise();
4695
- this._finishReason = new import_provider_utils16.DelayedPromise();
4696
- this._steps = new import_provider_utils16.DelayedPromise();
4696
+ this._totalUsage = new import_provider_utils15.DelayedPromise();
4697
+ this._finishReason = new import_provider_utils15.DelayedPromise();
4698
+ this._steps = new import_provider_utils15.DelayedPromise();
4697
4699
  this.output = output;
4698
4700
  this.includeRawChunks = includeRawChunks;
4699
4701
  this.tools = tools;
@@ -4944,7 +4946,7 @@ var DefaultStreamTextResult = class {
4944
4946
  }
4945
4947
  controller.enqueue(value);
4946
4948
  } catch (error) {
4947
- if ((0, import_provider_utils16.isAbortError)(error) && (abortSignal == null ? void 0 : abortSignal.aborted)) {
4949
+ if ((0, import_provider_utils15.isAbortError)(error) && (abortSignal == null ? void 0 : abortSignal.aborted)) {
4948
4950
  abort();
4949
4951
  } else {
4950
4952
  controller.error(error);
@@ -5003,7 +5005,7 @@ var DefaultStreamTextResult = class {
5003
5005
  }) {
5004
5006
  var _a16, _b, _c, _d, _e;
5005
5007
  const includeRawChunks2 = self.includeRawChunks;
5006
- stepFinish = new import_provider_utils16.DelayedPromise();
5008
+ stepFinish = new import_provider_utils15.DelayedPromise();
5007
5009
  const initialPrompt = await standardizePrompt({
5008
5010
  system,
5009
5011
  prompt,
@@ -6080,7 +6082,7 @@ var Agent = class {
6080
6082
  };
6081
6083
 
6082
6084
  // src/embed/embed.ts
6083
- var import_provider_utils17 = require("@ai-sdk/provider-utils");
6085
+ var import_provider_utils16 = require("@ai-sdk/provider-utils");
6084
6086
  async function embed({
6085
6087
  model: modelArg,
6086
6088
  value,
@@ -6095,7 +6097,7 @@ async function embed({
6095
6097
  maxRetries: maxRetriesArg,
6096
6098
  abortSignal
6097
6099
  });
6098
- const headersWithUserAgent = (0, import_provider_utils17.withUserAgentSuffix)(
6100
+ const headersWithUserAgent = (0, import_provider_utils16.withUserAgentSuffix)(
6099
6101
  headers != null ? headers : {},
6100
6102
  `ai/${VERSION}`
6101
6103
  );
@@ -6199,7 +6201,7 @@ var DefaultEmbedResult = class {
6199
6201
  };
6200
6202
 
6201
6203
  // src/embed/embed-many.ts
6202
- var import_provider_utils18 = require("@ai-sdk/provider-utils");
6204
+ var import_provider_utils17 = require("@ai-sdk/provider-utils");
6203
6205
 
6204
6206
  // src/util/split-array.ts
6205
6207
  function splitArray(array, chunkSize) {
@@ -6229,7 +6231,7 @@ async function embedMany({
6229
6231
  maxRetries: maxRetriesArg,
6230
6232
  abortSignal
6231
6233
  });
6232
- const headersWithUserAgent = (0, import_provider_utils18.withUserAgentSuffix)(
6234
+ const headersWithUserAgent = (0, import_provider_utils17.withUserAgentSuffix)(
6233
6235
  headers != null ? headers : {},
6234
6236
  `ai/${VERSION}`
6235
6237
  );
@@ -6448,7 +6450,7 @@ var DefaultEmbedManyResult = class {
6448
6450
  };
6449
6451
 
6450
6452
  // src/generate-image/generate-image.ts
6451
- var import_provider_utils19 = require("@ai-sdk/provider-utils");
6453
+ var import_provider_utils18 = require("@ai-sdk/provider-utils");
6452
6454
  async function generateImage({
6453
6455
  model: modelArg,
6454
6456
  prompt,
@@ -6464,7 +6466,7 @@ async function generateImage({
6464
6466
  }) {
6465
6467
  var _a16, _b;
6466
6468
  const model = resolveImageModel(modelArg);
6467
- const headersWithUserAgent = (0, import_provider_utils19.withUserAgentSuffix)(
6469
+ const headersWithUserAgent = (0, import_provider_utils18.withUserAgentSuffix)(
6468
6470
  headers != null ? headers : {},
6469
6471
  `ai/${VERSION}`
6470
6472
  );
@@ -6576,7 +6578,7 @@ async function invokeModelMaxImagesPerCall(model) {
6576
6578
  }
6577
6579
 
6578
6580
  // src/generate-object/generate-object.ts
6579
- var import_provider_utils22 = require("@ai-sdk/provider-utils");
6581
+ var import_provider_utils21 = require("@ai-sdk/provider-utils");
6580
6582
 
6581
6583
  // src/generate-text/extract-reasoning-content.ts
6582
6584
  function extractReasoningContent(content) {
@@ -6588,7 +6590,7 @@ function extractReasoningContent(content) {
6588
6590
 
6589
6591
  // src/generate-object/output-strategy.ts
6590
6592
  var import_provider24 = require("@ai-sdk/provider");
6591
- var import_provider_utils20 = require("@ai-sdk/provider-utils");
6593
+ var import_provider_utils19 = require("@ai-sdk/provider-utils");
6592
6594
  var noSchemaOutputStrategy = {
6593
6595
  type: "no-schema",
6594
6596
  jsonSchema: void 0,
@@ -6627,7 +6629,7 @@ var objectOutputStrategy = (schema) => ({
6627
6629
  };
6628
6630
  },
6629
6631
  async validateFinalResult(value) {
6630
- return (0, import_provider_utils20.safeValidateTypes)({ value, schema });
6632
+ return (0, import_provider_utils19.safeValidateTypes)({ value, schema });
6631
6633
  },
6632
6634
  createElementStream() {
6633
6635
  throw new import_provider24.UnsupportedFunctionalityError({
@@ -6671,7 +6673,7 @@ var arrayOutputStrategy = (schema) => {
6671
6673
  const resultArray = [];
6672
6674
  for (let i = 0; i < inputArray.length; i++) {
6673
6675
  const element = inputArray[i];
6674
- const result = await (0, import_provider_utils20.safeValidateTypes)({ value: element, schema });
6676
+ const result = await (0, import_provider_utils19.safeValidateTypes)({ value: element, schema });
6675
6677
  if (i === inputArray.length - 1 && !isFinalDelta) {
6676
6678
  continue;
6677
6679
  }
@@ -6712,7 +6714,7 @@ var arrayOutputStrategy = (schema) => {
6712
6714
  }
6713
6715
  const inputArray = value.elements;
6714
6716
  for (const element of inputArray) {
6715
- const result = await (0, import_provider_utils20.safeValidateTypes)({ value: element, schema });
6717
+ const result = await (0, import_provider_utils19.safeValidateTypes)({ value: element, schema });
6716
6718
  if (!result.success) {
6717
6719
  return result;
6718
6720
  }
@@ -6830,9 +6832,9 @@ function getOutputStrategy({
6830
6832
  }) {
6831
6833
  switch (output) {
6832
6834
  case "object":
6833
- return objectOutputStrategy((0, import_provider_utils20.asSchema)(schema));
6835
+ return objectOutputStrategy((0, import_provider_utils19.asSchema)(schema));
6834
6836
  case "array":
6835
- return arrayOutputStrategy((0, import_provider_utils20.asSchema)(schema));
6837
+ return arrayOutputStrategy((0, import_provider_utils19.asSchema)(schema));
6836
6838
  case "enum":
6837
6839
  return enumOutputStrategy(enumValues);
6838
6840
  case "no-schema":
@@ -6846,9 +6848,9 @@ function getOutputStrategy({
6846
6848
 
6847
6849
  // src/generate-object/parse-and-validate-object-result.ts
6848
6850
  var import_provider25 = require("@ai-sdk/provider");
6849
- var import_provider_utils21 = require("@ai-sdk/provider-utils");
6851
+ var import_provider_utils20 = require("@ai-sdk/provider-utils");
6850
6852
  async function parseAndValidateObjectResult(result, outputStrategy, context) {
6851
- const parseResult = await (0, import_provider_utils21.safeParseJSON)({ text: result });
6853
+ const parseResult = await (0, import_provider_utils20.safeParseJSON)({ text: result });
6852
6854
  if (!parseResult.success) {
6853
6855
  throw new NoObjectGeneratedError({
6854
6856
  message: "No object generated: could not parse the response.",
@@ -7020,7 +7022,7 @@ function validateObjectGenerationInput({
7020
7022
  }
7021
7023
 
7022
7024
  // src/generate-object/generate-object.ts
7023
- var originalGenerateId3 = (0, import_provider_utils22.createIdGenerator)({ prefix: "aiobj", size: 24 });
7025
+ var originalGenerateId3 = (0, import_provider_utils21.createIdGenerator)({ prefix: "aiobj", size: 24 });
7024
7026
  async function generateObject(options) {
7025
7027
  const {
7026
7028
  model: modelArg,
@@ -7065,7 +7067,7 @@ async function generateObject(options) {
7065
7067
  enumValues
7066
7068
  });
7067
7069
  const callSettings = prepareCallSettings(settings);
7068
- const headersWithUserAgent = (0, import_provider_utils22.withUserAgentSuffix)(
7070
+ const headersWithUserAgent = (0, import_provider_utils21.withUserAgentSuffix)(
7069
7071
  headers != null ? headers : {},
7070
7072
  `ai/${VERSION}`
7071
7073
  );
@@ -7284,7 +7286,7 @@ var DefaultGenerateObjectResult = class {
7284
7286
  };
7285
7287
 
7286
7288
  // src/generate-object/stream-object.ts
7287
- var import_provider_utils24 = require("@ai-sdk/provider-utils");
7289
+ var import_provider_utils23 = require("@ai-sdk/provider-utils");
7288
7290
 
7289
7291
  // src/util/cosine-similarity.ts
7290
7292
  function cosineSimilarity(vector1, vector2) {
@@ -7399,7 +7401,7 @@ var SerialJobExecutor = class {
7399
7401
  };
7400
7402
 
7401
7403
  // src/util/simulate-readable-stream.ts
7402
- var import_provider_utils23 = require("@ai-sdk/provider-utils");
7404
+ var import_provider_utils22 = require("@ai-sdk/provider-utils");
7403
7405
  function simulateReadableStream({
7404
7406
  chunks,
7405
7407
  initialDelayInMs = 0,
@@ -7407,7 +7409,7 @@ function simulateReadableStream({
7407
7409
  _internal
7408
7410
  }) {
7409
7411
  var _a16;
7410
- const delay2 = (_a16 = _internal == null ? void 0 : _internal.delay) != null ? _a16 : import_provider_utils23.delay;
7412
+ const delay2 = (_a16 = _internal == null ? void 0 : _internal.delay) != null ? _a16 : import_provider_utils22.delay;
7411
7413
  let index = 0;
7412
7414
  return new ReadableStream({
7413
7415
  async pull(controller) {
@@ -7422,7 +7424,7 @@ function simulateReadableStream({
7422
7424
  }
7423
7425
 
7424
7426
  // src/generate-object/stream-object.ts
7425
- var originalGenerateId4 = (0, import_provider_utils24.createIdGenerator)({ prefix: "aiobj", size: 24 });
7427
+ var originalGenerateId4 = (0, import_provider_utils23.createIdGenerator)({ prefix: "aiobj", size: 24 });
7426
7428
  function streamObject(options) {
7427
7429
  const {
7428
7430
  model,
@@ -7512,13 +7514,13 @@ var DefaultStreamObjectResult = class {
7512
7514
  currentDate,
7513
7515
  now: now2
7514
7516
  }) {
7515
- this._object = new import_provider_utils24.DelayedPromise();
7516
- this._usage = new import_provider_utils24.DelayedPromise();
7517
- this._providerMetadata = new import_provider_utils24.DelayedPromise();
7518
- this._warnings = new import_provider_utils24.DelayedPromise();
7519
- this._request = new import_provider_utils24.DelayedPromise();
7520
- this._response = new import_provider_utils24.DelayedPromise();
7521
- this._finishReason = new import_provider_utils24.DelayedPromise();
7517
+ this._object = new import_provider_utils23.DelayedPromise();
7518
+ this._usage = new import_provider_utils23.DelayedPromise();
7519
+ this._providerMetadata = new import_provider_utils23.DelayedPromise();
7520
+ this._warnings = new import_provider_utils23.DelayedPromise();
7521
+ this._request = new import_provider_utils23.DelayedPromise();
7522
+ this._response = new import_provider_utils23.DelayedPromise();
7523
+ this._finishReason = new import_provider_utils23.DelayedPromise();
7522
7524
  const model = resolveLanguageModel(modelArg);
7523
7525
  const { maxRetries, retry } = prepareRetries({
7524
7526
  maxRetries: maxRetriesArg,
@@ -7943,7 +7945,7 @@ var DefaultStreamObjectResult = class {
7943
7945
  };
7944
7946
 
7945
7947
  // src/generate-speech/generate-speech.ts
7946
- var import_provider_utils25 = require("@ai-sdk/provider-utils");
7948
+ var import_provider_utils24 = require("@ai-sdk/provider-utils");
7947
7949
 
7948
7950
  // src/generate-speech/generated-audio-file.ts
7949
7951
  var DefaultGeneratedAudioFile = class extends DefaultGeneratedFile {
@@ -7992,7 +7994,7 @@ async function generateSpeech({
7992
7994
  modelId: model.modelId
7993
7995
  });
7994
7996
  }
7995
- const headersWithUserAgent = (0, import_provider_utils25.withUserAgentSuffix)(
7997
+ const headersWithUserAgent = (0, import_provider_utils24.withUserAgentSuffix)(
7996
7998
  headers != null ? headers : {},
7997
7999
  `ai/${VERSION}`
7998
8000
  );
@@ -8046,7 +8048,7 @@ __export(output_exports, {
8046
8048
  object: () => object,
8047
8049
  text: () => text
8048
8050
  });
8049
- var import_provider_utils26 = require("@ai-sdk/provider-utils");
8051
+ var import_provider_utils25 = require("@ai-sdk/provider-utils");
8050
8052
  var text = () => ({
8051
8053
  type: "text",
8052
8054
  responseFormat: { type: "text" },
@@ -8060,7 +8062,7 @@ var text = () => ({
8060
8062
  var object = ({
8061
8063
  schema: inputSchema
8062
8064
  }) => {
8063
- const schema = (0, import_provider_utils26.asSchema)(inputSchema);
8065
+ const schema = (0, import_provider_utils25.asSchema)(inputSchema);
8064
8066
  return {
8065
8067
  type: "object",
8066
8068
  responseFormat: {
@@ -8086,7 +8088,7 @@ var object = ({
8086
8088
  }
8087
8089
  },
8088
8090
  async parseOutput({ text: text2 }, context) {
8089
- const parseResult = await (0, import_provider_utils26.safeParseJSON)({ text: text2 });
8091
+ const parseResult = await (0, import_provider_utils25.safeParseJSON)({ text: text2 });
8090
8092
  if (!parseResult.success) {
8091
8093
  throw new NoObjectGeneratedError({
8092
8094
  message: "No object generated: could not parse the response.",
@@ -8097,7 +8099,7 @@ var object = ({
8097
8099
  finishReason: context.finishReason
8098
8100
  });
8099
8101
  }
8100
- const validationResult = await (0, import_provider_utils26.safeValidateTypes)({
8102
+ const validationResult = await (0, import_provider_utils25.safeValidateTypes)({
8101
8103
  value: parseResult.value,
8102
8104
  schema
8103
8105
  });
@@ -8189,7 +8191,7 @@ function pruneMessages({
8189
8191
  }
8190
8192
 
8191
8193
  // src/generate-text/smooth-stream.ts
8192
- var import_provider_utils27 = require("@ai-sdk/provider-utils");
8194
+ var import_provider_utils26 = require("@ai-sdk/provider-utils");
8193
8195
  var import_provider26 = require("@ai-sdk/provider");
8194
8196
  var CHUNKING_REGEXPS = {
8195
8197
  word: /\S+\s+/m,
@@ -8198,7 +8200,7 @@ var CHUNKING_REGEXPS = {
8198
8200
  function smoothStream({
8199
8201
  delayInMs = 10,
8200
8202
  chunking = "word",
8201
- _internal: { delay: delay2 = import_provider_utils27.delay } = {}
8203
+ _internal: { delay: delay2 = import_provider_utils26.delay } = {}
8202
8204
  } = {}) {
8203
8205
  let detectChunk;
8204
8206
  if (typeof chunking === "function") {
@@ -8797,7 +8799,7 @@ var DefaultProviderRegistry = class {
8797
8799
  };
8798
8800
 
8799
8801
  // src/transcribe/transcribe.ts
8800
- var import_provider_utils28 = require("@ai-sdk/provider-utils");
8802
+ var import_provider_utils27 = require("@ai-sdk/provider-utils");
8801
8803
 
8802
8804
  // src/error/no-transcript-generated-error.ts
8803
8805
  var import_provider30 = require("@ai-sdk/provider");
@@ -8833,7 +8835,7 @@ async function transcribe({
8833
8835
  maxRetries: maxRetriesArg,
8834
8836
  abortSignal
8835
8837
  });
8836
- const headersWithUserAgent = (0, import_provider_utils28.withUserAgentSuffix)(
8838
+ const headersWithUserAgent = (0, import_provider_utils27.withUserAgentSuffix)(
8837
8839
  headers != null ? headers : {},
8838
8840
  `ai/${VERSION}`
8839
8841
  );
@@ -8881,7 +8883,7 @@ var DefaultTranscriptionResult = class {
8881
8883
  };
8882
8884
 
8883
8885
  // src/ui/call-completion-api.ts
8884
- var import_provider_utils29 = require("@ai-sdk/provider-utils");
8886
+ var import_provider_utils28 = require("@ai-sdk/provider-utils");
8885
8887
 
8886
8888
  // src/ui/process-text-stream.ts
8887
8889
  async function processTextStream({
@@ -8929,13 +8931,13 @@ async function callCompletionApi({
8929
8931
  ...body
8930
8932
  }),
8931
8933
  credentials,
8932
- headers: (0, import_provider_utils29.withUserAgentSuffix)(
8934
+ headers: (0, import_provider_utils28.withUserAgentSuffix)(
8933
8935
  {
8934
8936
  "Content-Type": "application/json",
8935
8937
  ...headers
8936
8938
  },
8937
8939
  `ai-sdk/${VERSION}`,
8938
- (0, import_provider_utils29.getRuntimeEnvironmentUserAgent)()
8940
+ (0, import_provider_utils28.getRuntimeEnvironmentUserAgent)()
8939
8941
  ),
8940
8942
  signal: abortController.signal
8941
8943
  }).catch((err) => {
@@ -8963,7 +8965,7 @@ async function callCompletionApi({
8963
8965
  }
8964
8966
  case "data": {
8965
8967
  await consumeStream({
8966
- stream: (0, import_provider_utils29.parseJsonEventStream)({
8968
+ stream: (0, import_provider_utils28.parseJsonEventStream)({
8967
8969
  stream: response.body,
8968
8970
  schema: uiMessageChunkSchema
8969
8971
  }).pipeThrough(
@@ -9015,7 +9017,7 @@ async function callCompletionApi({
9015
9017
  }
9016
9018
 
9017
9019
  // src/ui/chat.ts
9018
- var import_provider_utils32 = require("@ai-sdk/provider-utils");
9020
+ var import_provider_utils31 = require("@ai-sdk/provider-utils");
9019
9021
 
9020
9022
  // src/ui/convert-file-list-to-file-ui-parts.ts
9021
9023
  async function convertFileListToFileUIParts(files) {
@@ -9048,10 +9050,10 @@ async function convertFileListToFileUIParts(files) {
9048
9050
  }
9049
9051
 
9050
9052
  // src/ui/default-chat-transport.ts
9051
- var import_provider_utils31 = require("@ai-sdk/provider-utils");
9053
+ var import_provider_utils30 = require("@ai-sdk/provider-utils");
9052
9054
 
9053
9055
  // src/ui/http-chat-transport.ts
9054
- var import_provider_utils30 = require("@ai-sdk/provider-utils");
9056
+ var import_provider_utils29 = require("@ai-sdk/provider-utils");
9055
9057
  var HttpChatTransport = class {
9056
9058
  constructor({
9057
9059
  api = "/api/chat",
@@ -9075,12 +9077,12 @@ var HttpChatTransport = class {
9075
9077
  ...options
9076
9078
  }) {
9077
9079
  var _a16, _b, _c, _d, _e;
9078
- const resolvedBody = await (0, import_provider_utils30.resolve)(this.body);
9079
- const resolvedHeaders = await (0, import_provider_utils30.resolve)(this.headers);
9080
- const resolvedCredentials = await (0, import_provider_utils30.resolve)(this.credentials);
9080
+ const resolvedBody = await (0, import_provider_utils29.resolve)(this.body);
9081
+ const resolvedHeaders = await (0, import_provider_utils29.resolve)(this.headers);
9082
+ const resolvedCredentials = await (0, import_provider_utils29.resolve)(this.credentials);
9081
9083
  const baseHeaders = {
9082
- ...(0, import_provider_utils30.normalizeHeaders)(resolvedHeaders),
9083
- ...(0, import_provider_utils30.normalizeHeaders)(options.headers)
9084
+ ...(0, import_provider_utils29.normalizeHeaders)(resolvedHeaders),
9085
+ ...(0, import_provider_utils29.normalizeHeaders)(options.headers)
9084
9086
  };
9085
9087
  const preparedRequest = await ((_a16 = this.prepareSendMessagesRequest) == null ? void 0 : _a16.call(this, {
9086
9088
  api: this.api,
@@ -9094,7 +9096,7 @@ var HttpChatTransport = class {
9094
9096
  messageId: options.messageId
9095
9097
  }));
9096
9098
  const api = (_b = preparedRequest == null ? void 0 : preparedRequest.api) != null ? _b : this.api;
9097
- const headers = (preparedRequest == null ? void 0 : preparedRequest.headers) !== void 0 ? (0, import_provider_utils30.normalizeHeaders)(preparedRequest.headers) : baseHeaders;
9099
+ const headers = (preparedRequest == null ? void 0 : preparedRequest.headers) !== void 0 ? (0, import_provider_utils29.normalizeHeaders)(preparedRequest.headers) : baseHeaders;
9098
9100
  const body = (preparedRequest == null ? void 0 : preparedRequest.body) !== void 0 ? preparedRequest.body : {
9099
9101
  ...resolvedBody,
9100
9102
  ...options.body,
@@ -9127,12 +9129,12 @@ var HttpChatTransport = class {
9127
9129
  }
9128
9130
  async reconnectToStream(options) {
9129
9131
  var _a16, _b, _c, _d, _e;
9130
- const resolvedBody = await (0, import_provider_utils30.resolve)(this.body);
9131
- const resolvedHeaders = await (0, import_provider_utils30.resolve)(this.headers);
9132
- const resolvedCredentials = await (0, import_provider_utils30.resolve)(this.credentials);
9132
+ const resolvedBody = await (0, import_provider_utils29.resolve)(this.body);
9133
+ const resolvedHeaders = await (0, import_provider_utils29.resolve)(this.headers);
9134
+ const resolvedCredentials = await (0, import_provider_utils29.resolve)(this.credentials);
9133
9135
  const baseHeaders = {
9134
- ...(0, import_provider_utils30.normalizeHeaders)(resolvedHeaders),
9135
- ...(0, import_provider_utils30.normalizeHeaders)(options.headers)
9136
+ ...(0, import_provider_utils29.normalizeHeaders)(resolvedHeaders),
9137
+ ...(0, import_provider_utils29.normalizeHeaders)(options.headers)
9136
9138
  };
9137
9139
  const preparedRequest = await ((_a16 = this.prepareReconnectToStreamRequest) == null ? void 0 : _a16.call(this, {
9138
9140
  api: this.api,
@@ -9143,7 +9145,7 @@ var HttpChatTransport = class {
9143
9145
  requestMetadata: options.metadata
9144
9146
  }));
9145
9147
  const api = (_b = preparedRequest == null ? void 0 : preparedRequest.api) != null ? _b : `${this.api}/${options.chatId}/stream`;
9146
- const headers = (preparedRequest == null ? void 0 : preparedRequest.headers) !== void 0 ? (0, import_provider_utils30.normalizeHeaders)(preparedRequest.headers) : baseHeaders;
9148
+ const headers = (preparedRequest == null ? void 0 : preparedRequest.headers) !== void 0 ? (0, import_provider_utils29.normalizeHeaders)(preparedRequest.headers) : baseHeaders;
9147
9149
  const credentials = (_c = preparedRequest == null ? void 0 : preparedRequest.credentials) != null ? _c : resolvedCredentials;
9148
9150
  const fetch2 = (_d = this.fetch) != null ? _d : globalThis.fetch;
9149
9151
  const response = await fetch2(api, {
@@ -9172,7 +9174,7 @@ var DefaultChatTransport = class extends HttpChatTransport {
9172
9174
  super(options);
9173
9175
  }
9174
9176
  processResponseStream(stream) {
9175
- return (0, import_provider_utils31.parseJsonEventStream)({
9177
+ return (0, import_provider_utils30.parseJsonEventStream)({
9176
9178
  stream,
9177
9179
  schema: uiMessageChunkSchema
9178
9180
  }).pipeThrough(
@@ -9191,7 +9193,7 @@ var DefaultChatTransport = class extends HttpChatTransport {
9191
9193
  // src/ui/chat.ts
9192
9194
  var AbstractChat = class {
9193
9195
  constructor({
9194
- generateId: generateId3 = import_provider_utils32.generateId,
9196
+ generateId: generateId3 = import_provider_utils31.generateId,
9195
9197
  id = generateId3(),
9196
9198
  transport = new DefaultChatTransport(),
9197
9199
  messageMetadataSchema,
@@ -9580,10 +9582,10 @@ var TextStreamChatTransport = class extends HttpChatTransport {
9580
9582
 
9581
9583
  // src/ui/validate-ui-messages.ts
9582
9584
  var import_provider31 = require("@ai-sdk/provider");
9583
- var import_provider_utils33 = require("@ai-sdk/provider-utils");
9585
+ var import_provider_utils32 = require("@ai-sdk/provider-utils");
9584
9586
  var import_v48 = require("zod/v4");
9585
- var uiMessagesSchema = (0, import_provider_utils33.lazyValidator)(
9586
- () => (0, import_provider_utils33.zodSchema)(
9587
+ var uiMessagesSchema = (0, import_provider_utils32.lazyValidator)(
9588
+ () => (0, import_provider_utils32.zodSchema)(
9587
9589
  import_v48.z.array(
9588
9590
  import_v48.z.object({
9589
9591
  id: import_v48.z.string(),
@@ -9797,13 +9799,13 @@ async function safeValidateUIMessages({
9797
9799
  })
9798
9800
  };
9799
9801
  }
9800
- const validatedMessages = await (0, import_provider_utils33.validateTypes)({
9802
+ const validatedMessages = await (0, import_provider_utils32.validateTypes)({
9801
9803
  value: messages,
9802
9804
  schema: uiMessagesSchema
9803
9805
  });
9804
9806
  if (metadataSchema) {
9805
9807
  for (const message of validatedMessages) {
9806
- await (0, import_provider_utils33.validateTypes)({
9808
+ await (0, import_provider_utils32.validateTypes)({
9807
9809
  value: message.metadata,
9808
9810
  schema: metadataSchema
9809
9811
  });
@@ -9826,7 +9828,7 @@ async function safeValidateUIMessages({
9826
9828
  })
9827
9829
  };
9828
9830
  }
9829
- await (0, import_provider_utils33.validateTypes)({
9831
+ await (0, import_provider_utils32.validateTypes)({
9830
9832
  value: dataPart.data,
9831
9833
  schema: dataSchema
9832
9834
  });
@@ -9851,13 +9853,13 @@ async function safeValidateUIMessages({
9851
9853
  };
9852
9854
  }
9853
9855
  if (toolPart.state === "input-available" || toolPart.state === "output-available" || toolPart.state === "output-error") {
9854
- await (0, import_provider_utils33.validateTypes)({
9856
+ await (0, import_provider_utils32.validateTypes)({
9855
9857
  value: toolPart.input,
9856
9858
  schema: tool2.inputSchema
9857
9859
  });
9858
9860
  }
9859
9861
  if (toolPart.state === "output-available" && tool2.outputSchema) {
9860
- await (0, import_provider_utils33.validateTypes)({
9862
+ await (0, import_provider_utils32.validateTypes)({
9861
9863
  value: toolPart.output,
9862
9864
  schema: tool2.outputSchema
9863
9865
  });
@@ -9895,13 +9897,13 @@ async function validateUIMessages({
9895
9897
  }
9896
9898
 
9897
9899
  // src/ui-message-stream/create-ui-message-stream.ts
9898
- var import_provider_utils34 = require("@ai-sdk/provider-utils");
9900
+ var import_provider_utils33 = require("@ai-sdk/provider-utils");
9899
9901
  function createUIMessageStream({
9900
9902
  execute,
9901
- onError = import_provider_utils34.getErrorMessage,
9903
+ onError = import_provider_utils33.getErrorMessage,
9902
9904
  originalMessages,
9903
9905
  onFinish,
9904
- generateId: generateId3 = import_provider_utils34.generateId
9906
+ generateId: generateId3 = import_provider_utils33.generateId
9905
9907
  }) {
9906
9908
  let controller;
9907
9909
  const ongoingStreamPromises = [];