ai 7.0.87 → 7.0.89

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
@@ -1,7 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __export = (target, all) => {
3
- for (var name24 in all)
4
- __defProp(target, name24, { get: all[name24], enumerable: true });
3
+ for (var name25 in all)
4
+ __defProp(target, name25, { get: all[name25], enumerable: true });
5
5
  };
6
6
 
7
7
  // src/index.ts
@@ -37,7 +37,7 @@ import {
37
37
 
38
38
  // src/error/index.ts
39
39
  import {
40
- AISDKError as AISDKError24,
40
+ AISDKError as AISDKError25,
41
41
  APICallError,
42
42
  EmptyResponseBodyError,
43
43
  InvalidPromptError,
@@ -454,9 +454,39 @@ var ToolCallRepairError = class extends (_b17 = AISDKError17, _a17 = symbol17, _
454
454
  }
455
455
  };
456
456
 
457
+ // src/error/tool-choice-violation-error.ts
458
+ import {
459
+ AISDKError as AISDKError18
460
+ } from "@ai-sdk/provider";
461
+ var name18 = "AI_ToolChoiceViolationError";
462
+ var marker18 = `vercel.ai.error.${name18}`;
463
+ var symbol18 = Symbol.for(marker18);
464
+ var _a18, _b18;
465
+ var ToolChoiceViolationError = class extends (_b18 = AISDKError18, _a18 = symbol18, _b18) {
466
+ constructor({
467
+ toolChoice,
468
+ finishReason,
469
+ provider,
470
+ modelId,
471
+ content,
472
+ message = toolChoice.type === "required" ? "Model response did not contain a tool call even though tool choice was required." : `Model response did not contain a call to the required tool '${toolChoice.toolName}'.`
473
+ }) {
474
+ super({ name: name18, message });
475
+ this[_a18] = true;
476
+ this.toolChoice = toolChoice;
477
+ this.finishReason = finishReason;
478
+ this.provider = provider;
479
+ this.modelId = modelId;
480
+ this.content = content;
481
+ }
482
+ static isInstance(error) {
483
+ return AISDKError18.hasMarker(error, marker18);
484
+ }
485
+ };
486
+
457
487
  // src/error/unsupported-model-version-error.ts
458
- import { AISDKError as AISDKError18 } from "@ai-sdk/provider";
459
- var UnsupportedModelVersionError = class extends AISDKError18 {
488
+ import { AISDKError as AISDKError19 } from "@ai-sdk/provider";
489
+ var UnsupportedModelVersionError = class extends AISDKError19 {
460
490
  constructor(options) {
461
491
  super({
462
492
  name: "AI_UnsupportedModelVersionError",
@@ -469,85 +499,85 @@ var UnsupportedModelVersionError = class extends AISDKError18 {
469
499
  };
470
500
 
471
501
  // src/error/ui-message-stream-error.ts
472
- import { AISDKError as AISDKError19 } from "@ai-sdk/provider";
473
- var name18 = "AI_UIMessageStreamError";
474
- var marker18 = `vercel.ai.error.${name18}`;
475
- var symbol18 = Symbol.for(marker18);
476
- var _a18, _b18;
477
- var UIMessageStreamError = class extends (_b18 = AISDKError19, _a18 = symbol18, _b18) {
502
+ import { AISDKError as AISDKError20 } from "@ai-sdk/provider";
503
+ var name19 = "AI_UIMessageStreamError";
504
+ var marker19 = `vercel.ai.error.${name19}`;
505
+ var symbol19 = Symbol.for(marker19);
506
+ var _a19, _b19;
507
+ var UIMessageStreamError = class extends (_b19 = AISDKError20, _a19 = symbol19, _b19) {
478
508
  constructor({
479
509
  chunkType,
480
510
  chunkId,
481
511
  message
482
512
  }) {
483
- super({ name: name18, message });
484
- this[_a18] = true;
513
+ super({ name: name19, message });
514
+ this[_a19] = true;
485
515
  this.chunkType = chunkType;
486
516
  this.chunkId = chunkId;
487
517
  }
488
518
  static isInstance(error) {
489
- return AISDKError19.hasMarker(error, marker18);
519
+ return AISDKError20.hasMarker(error, marker19);
490
520
  }
491
521
  };
492
522
 
493
523
  // src/prompt/invalid-data-content-error.ts
494
- import { AISDKError as AISDKError20 } from "@ai-sdk/provider";
495
- var name19 = "AI_InvalidDataContentError";
496
- var marker19 = `vercel.ai.error.${name19}`;
497
- var symbol19 = Symbol.for(marker19);
498
- var _a19, _b19;
499
- var InvalidDataContentError = class extends (_b19 = AISDKError20, _a19 = symbol19, _b19) {
524
+ import { AISDKError as AISDKError21 } from "@ai-sdk/provider";
525
+ var name20 = "AI_InvalidDataContentError";
526
+ var marker20 = `vercel.ai.error.${name20}`;
527
+ var symbol20 = Symbol.for(marker20);
528
+ var _a20, _b20;
529
+ var InvalidDataContentError = class extends (_b20 = AISDKError21, _a20 = symbol20, _b20) {
500
530
  constructor({
501
531
  content,
502
532
  cause,
503
533
  message = `Invalid data content. Expected a base64 string, Uint8Array, ArrayBuffer, or Buffer, but got ${typeof content}.`
504
534
  }) {
505
- super({ name: name19, message, cause });
506
- this[_a19] = true;
535
+ super({ name: name20, message, cause });
536
+ this[_a20] = true;
507
537
  this.content = content;
508
538
  }
509
539
  static isInstance(error) {
510
- return AISDKError20.hasMarker(error, marker19);
540
+ return AISDKError21.hasMarker(error, marker20);
511
541
  }
512
542
  };
513
543
 
514
544
  // src/prompt/invalid-message-role-error.ts
515
- import { AISDKError as AISDKError21 } from "@ai-sdk/provider";
516
- var name20 = "AI_InvalidMessageRoleError";
517
- var marker20 = `vercel.ai.error.${name20}`;
518
- var symbol20 = Symbol.for(marker20);
519
- var _a20, _b20;
520
- var InvalidMessageRoleError = class extends (_b20 = AISDKError21, _a20 = symbol20, _b20) {
545
+ import { AISDKError as AISDKError22 } from "@ai-sdk/provider";
546
+ var name21 = "AI_InvalidMessageRoleError";
547
+ var marker21 = `vercel.ai.error.${name21}`;
548
+ var symbol21 = Symbol.for(marker21);
549
+ var _a21, _b21;
550
+ var InvalidMessageRoleError = class extends (_b21 = AISDKError22, _a21 = symbol21, _b21) {
521
551
  constructor({
522
552
  role,
523
553
  message = `Invalid message role: '${role}'. Must be one of: "system", "user", "assistant", "tool".`
524
554
  }) {
525
- super({ name: name20, message });
526
- this[_a20] = true;
555
+ super({ name: name21, message });
556
+ this[_a21] = true;
527
557
  this.role = role;
528
558
  }
529
559
  static isInstance(error) {
530
- return AISDKError21.hasMarker(error, marker20);
560
+ return AISDKError22.hasMarker(error, marker21);
531
561
  }
532
562
  };
533
563
 
534
564
  // src/prompt/message-conversion-error.ts
535
- import { AISDKError as AISDKError22 } from "@ai-sdk/provider";
536
- var name21 = "AI_MessageConversionError";
537
- var marker21 = `vercel.ai.error.${name21}`;
538
- var symbol21 = Symbol.for(marker21);
539
- var _a21, _b21;
540
- var MessageConversionError = class extends (_b21 = AISDKError22, _a21 = symbol21, _b21) {
565
+ import { AISDKError as AISDKError23 } from "@ai-sdk/provider";
566
+ var name22 = "AI_MessageConversionError";
567
+ var marker22 = `vercel.ai.error.${name22}`;
568
+ var symbol22 = Symbol.for(marker22);
569
+ var _a22, _b22;
570
+ var MessageConversionError = class extends (_b22 = AISDKError23, _a22 = symbol22, _b22) {
541
571
  constructor({
542
572
  originalMessage,
543
573
  message
544
574
  }) {
545
- super({ name: name21, message });
546
- this[_a21] = true;
575
+ super({ name: name22, message });
576
+ this[_a22] = true;
547
577
  this.originalMessage = originalMessage;
548
578
  }
549
579
  static isInstance(error) {
550
- return AISDKError22.hasMarker(error, marker21);
580
+ return AISDKError23.hasMarker(error, marker22);
551
581
  }
552
582
  };
553
583
 
@@ -555,25 +585,25 @@ var MessageConversionError = class extends (_b21 = AISDKError22, _a21 = symbol21
555
585
  import { DownloadError } from "@ai-sdk/provider-utils";
556
586
 
557
587
  // src/util/retry-error.ts
558
- import { AISDKError as AISDKError23 } from "@ai-sdk/provider";
559
- var name22 = "AI_RetryError";
560
- var marker22 = `vercel.ai.error.${name22}`;
561
- var symbol22 = Symbol.for(marker22);
562
- var _a22, _b22;
563
- var RetryError = class extends (_b22 = AISDKError23, _a22 = symbol22, _b22) {
588
+ import { AISDKError as AISDKError24 } from "@ai-sdk/provider";
589
+ var name23 = "AI_RetryError";
590
+ var marker23 = `vercel.ai.error.${name23}`;
591
+ var symbol23 = Symbol.for(marker23);
592
+ var _a23, _b23;
593
+ var RetryError = class extends (_b23 = AISDKError24, _a23 = symbol23, _b23) {
564
594
  constructor({
565
595
  message,
566
596
  reason,
567
597
  errors
568
598
  }) {
569
- super({ name: name22, message });
570
- this[_a22] = true;
599
+ super({ name: name23, message });
600
+ this[_a23] = true;
571
601
  this.reason = reason;
572
602
  this.errors = errors;
573
603
  this.lastError = errors[errors.length - 1];
574
604
  }
575
605
  static isInstance(error) {
576
- return AISDKError23.hasMarker(error, marker22);
606
+ return AISDKError24.hasMarker(error, marker23);
577
607
  }
578
608
  };
579
609
 
@@ -984,9 +1014,9 @@ function resolveEmbeddingModel(model) {
984
1014
  return asEmbeddingModelV4(model);
985
1015
  }
986
1016
  function resolveTranscriptionModel(model) {
987
- var _a24, _b24;
1017
+ var _a25, _b25;
988
1018
  if (typeof model === "string") {
989
- return (_b24 = (_a24 = getGlobalProvider()).transcriptionModel) == null ? void 0 : _b24.call(_a24, model);
1019
+ return (_b25 = (_a25 = getGlobalProvider()).transcriptionModel) == null ? void 0 : _b25.call(_a25, model);
990
1020
  }
991
1021
  if (!["v4", "v3", "v2"].includes(model.specificationVersion)) {
992
1022
  const unsupportedModel = model;
@@ -999,9 +1029,9 @@ function resolveTranscriptionModel(model) {
999
1029
  return asTranscriptionModelV4(model);
1000
1030
  }
1001
1031
  function resolveSpeechTranslationModel(model) {
1002
- var _a24;
1032
+ var _a25;
1003
1033
  if (typeof model === "string") {
1004
- const provider = (_a24 = globalThis.AI_SDK_DEFAULT_PROVIDER) != null ? _a24 : gateway;
1034
+ const provider = (_a25 = globalThis.AI_SDK_DEFAULT_PROVIDER) != null ? _a25 : gateway;
1005
1035
  const speechTranslationModel = provider.speechTranslationModel;
1006
1036
  if (!speechTranslationModel) {
1007
1037
  throw new Error(
@@ -1021,9 +1051,9 @@ function resolveSpeechTranslationModel(model) {
1021
1051
  return model;
1022
1052
  }
1023
1053
  function resolveSpeechModel(model) {
1024
- var _a24, _b24;
1054
+ var _a25, _b25;
1025
1055
  if (typeof model === "string") {
1026
- return (_b24 = (_a24 = getGlobalProvider()).speechModel) == null ? void 0 : _b24.call(_a24, model);
1056
+ return (_b25 = (_a25 = getGlobalProvider()).speechModel) == null ? void 0 : _b25.call(_a25, model);
1027
1057
  }
1028
1058
  if (!["v4", "v3", "v2"].includes(model.specificationVersion)) {
1029
1059
  const unsupportedModel = model;
@@ -1050,9 +1080,9 @@ function resolveImageModel(model) {
1050
1080
  return asImageModelV4(model);
1051
1081
  }
1052
1082
  function resolveVideoModel(model) {
1053
- var _a24;
1083
+ var _a25;
1054
1084
  if (typeof model === "string") {
1055
- const provider = (_a24 = globalThis.AI_SDK_DEFAULT_PROVIDER) != null ? _a24 : gateway;
1085
+ const provider = (_a25 = globalThis.AI_SDK_DEFAULT_PROVIDER) != null ? _a25 : gateway;
1056
1086
  const videoModel = provider.videoModel;
1057
1087
  if (!videoModel) {
1058
1088
  throw new Error(
@@ -1093,8 +1123,8 @@ function resolveRerankingModel(model) {
1093
1123
  return asRerankingModelV4(model);
1094
1124
  }
1095
1125
  function getGlobalProvider() {
1096
- var _a24;
1097
- const provider = (_a24 = globalThis.AI_SDK_DEFAULT_PROVIDER) != null ? _a24 : gateway;
1126
+ var _a25;
1127
+ const provider = (_a25 = globalThis.AI_SDK_DEFAULT_PROVIDER) != null ? _a25 : gateway;
1098
1128
  return asProviderV4(provider);
1099
1129
  }
1100
1130
 
@@ -1146,7 +1176,7 @@ import {
1146
1176
  } from "@ai-sdk/provider-utils";
1147
1177
 
1148
1178
  // src/version.ts
1149
- var VERSION = true ? "7.0.87" : "0.0.0-test";
1179
+ var VERSION = true ? "7.0.89" : "0.0.0-test";
1150
1180
 
1151
1181
  // src/util/download/download.ts
1152
1182
  var download = async ({
@@ -1154,7 +1184,7 @@ var download = async ({
1154
1184
  maxBytes,
1155
1185
  abortSignal
1156
1186
  }) => {
1157
- var _a24;
1187
+ var _a25;
1158
1188
  const urlText = url.toString();
1159
1189
  try {
1160
1190
  const headers = withUserAgentSuffix(
@@ -1182,7 +1212,7 @@ var download = async ({
1182
1212
  });
1183
1213
  return {
1184
1214
  data,
1185
- mediaType: (_a24 = response.headers.get("content-type")) != null ? _a24 : void 0
1215
+ mediaType: (_a25 = response.headers.get("content-type")) != null ? _a25 : void 0
1186
1216
  };
1187
1217
  } catch (error) {
1188
1218
  if (DownloadError2.isInstance(error)) {
@@ -1647,14 +1677,14 @@ function convertToLanguageModelMessage({
1647
1677
  }
1648
1678
  }
1649
1679
  function convertImagePartToFilePart(part) {
1650
- var _a24;
1680
+ var _a25;
1651
1681
  if (part.type !== "image") {
1652
1682
  return part;
1653
1683
  }
1654
1684
  return {
1655
1685
  type: "file",
1656
1686
  data: part.image,
1657
- mediaType: (_a24 = part.mediaType) != null ? _a24 : "image",
1687
+ mediaType: (_a25 = part.mediaType) != null ? _a25 : "image",
1658
1688
  providerOptions: part.providerOptions
1659
1689
  };
1660
1690
  }
@@ -1776,7 +1806,7 @@ function mapToolResultOutput({
1776
1806
  return {
1777
1807
  type: "content",
1778
1808
  value: output.value.map((item) => {
1779
- var _a24;
1809
+ var _a25;
1780
1810
  switch (item.type) {
1781
1811
  case "file": {
1782
1812
  const convertedPart = convertPartToLanguageModelPart(
@@ -1805,7 +1835,7 @@ function mapToolResultOutput({
1805
1835
  };
1806
1836
  }
1807
1837
  case "file-url": {
1808
- const mediaType = (_a24 = item.mediaType) != null ? _a24 : getMediaTypeFromUrl(item.url);
1838
+ const mediaType = (_a25 = item.mediaType) != null ? _a25 : getMediaTypeFromUrl(item.url);
1809
1839
  let message = `The "file-url" type for tool result content is deprecated. Use the "file" type with mediaType and { type: 'url', url } instead.`;
1810
1840
  if (!item.mediaType) {
1811
1841
  const inferenceSuffix = mediaType === "application/octet-stream" ? `Unable to infer media type from URL. Defaulting to 'application/octet-stream'.` : `Inferred media type '${mediaType}' from URL.`;
@@ -1961,10 +1991,10 @@ var URL_EXTENSION_TO_MEDIA_TYPE = {
1961
1991
  ogg: "audio/ogg"
1962
1992
  };
1963
1993
  function getMediaTypeFromUrl(url, fallbackMediaType = "application/octet-stream") {
1964
- var _a24;
1994
+ var _a25;
1965
1995
  try {
1966
1996
  const pathname = new URL(url).pathname;
1967
- const fileExtension = (_a24 = pathname.split(".").pop()) == null ? void 0 : _a24.toLowerCase();
1997
+ const fileExtension = (_a25 = pathname.split(".").pop()) == null ? void 0 : _a25.toLowerCase();
1968
1998
  if (fileExtension && Object.hasOwn(URL_EXTENSION_TO_MEDIA_TYPE, fileExtension)) {
1969
1999
  return URL_EXTENSION_TO_MEDIA_TYPE[fileExtension];
1970
2000
  }
@@ -2119,7 +2149,7 @@ async function prepareTools({
2119
2149
  return void 0;
2120
2150
  }
2121
2151
  const languageModelTools = [];
2122
- for (const [name24, tool2] of orderToolEntries({ tools, toolOrder })) {
2152
+ for (const [name25, tool2] of orderToolEntries({ tools, toolOrder })) {
2123
2153
  const toolType = tool2.type;
2124
2154
  switch (toolType) {
2125
2155
  case void 0:
@@ -2127,7 +2157,7 @@ async function prepareTools({
2127
2157
  case "function": {
2128
2158
  const description = resolveToolDescription({
2129
2159
  tool: tool2,
2130
- toolName: name24,
2160
+ toolName: name25,
2131
2161
  toolsContext,
2132
2162
  experimental_sandbox: sandbox
2133
2163
  });
@@ -2136,7 +2166,7 @@ async function prepareTools({
2136
2166
  const strict = tool2.strict;
2137
2167
  languageModelTools.push({
2138
2168
  type: "function",
2139
- name: name24,
2169
+ name: name25,
2140
2170
  inputSchema: await asSchema(tool2.inputSchema).jsonSchema,
2141
2171
  ...description != null ? { description } : {},
2142
2172
  ...inputExamples != null ? { inputExamples } : {},
@@ -2148,7 +2178,7 @@ async function prepareTools({
2148
2178
  case "provider": {
2149
2179
  languageModelTools.push({
2150
2180
  type: "provider",
2151
- name: name24,
2181
+ name: name25,
2152
2182
  id: tool2.id,
2153
2183
  args: tool2.args
2154
2184
  });
@@ -2170,10 +2200,10 @@ function orderToolEntries({
2170
2200
  return Object.entries(tools);
2171
2201
  }
2172
2202
  const toolEntries = Object.entries(tools);
2173
- const orderedTools = toolEntries.filter(([name24]) => toolOrder.includes(name24)).sort(
2203
+ const orderedTools = toolEntries.filter(([name25]) => toolOrder.includes(name25)).sort(
2174
2204
  ([nameA], [nameB]) => toolOrder.indexOf(nameA) - toolOrder.indexOf(nameB)
2175
2205
  );
2176
- const unorderedTools = toolEntries.filter(([name24]) => !toolOrder.includes(name24)).sort(([nameA], [nameB]) => nameA < nameB ? -1 : nameA > nameB ? 1 : 0);
2206
+ const unorderedTools = toolEntries.filter(([name25]) => !toolOrder.includes(name25)).sort(([nameA], [nameB]) => nameA < nameB ? -1 : nameA > nameB ? 1 : 0);
2177
2207
  return [...orderedTools, ...unorderedTools];
2178
2208
  }
2179
2209
  function resolveToolDescription({
@@ -2217,11 +2247,11 @@ function getChunkTimeoutMs(timeout) {
2217
2247
  return timeout.chunkMs;
2218
2248
  }
2219
2249
  function getToolTimeoutMs(timeout, toolName) {
2220
- var _a24, _b24;
2250
+ var _a25, _b25;
2221
2251
  if (timeout == null || typeof timeout === "number") {
2222
2252
  return void 0;
2223
2253
  }
2224
- return (_b24 = (_a24 = timeout.tools) == null ? void 0 : _a24[`${toolName}Ms`]) != null ? _b24 : timeout.toolMs;
2254
+ return (_b25 = (_a25 = timeout.tools) == null ? void 0 : _a25[`${toolName}Ms`]) != null ? _b25 : timeout.toolMs;
2225
2255
  }
2226
2256
 
2227
2257
  // src/prompt/standardize-prompt.ts
@@ -2604,13 +2634,13 @@ async function standardizePrompt({
2604
2634
 
2605
2635
  // src/prompt/wrap-gateway-error.ts
2606
2636
  import { GatewayAuthenticationError } from "@ai-sdk/gateway";
2607
- import { AISDKError as AISDKError25 } from "@ai-sdk/provider";
2637
+ import { AISDKError as AISDKError26 } from "@ai-sdk/provider";
2608
2638
  function wrapGatewayError(error) {
2609
2639
  if (!GatewayAuthenticationError.isInstance(error)) return error;
2610
2640
  const isProductionEnv = (process == null ? void 0 : process.env.NODE_ENV) === "production";
2611
2641
  const moreInfoURL = "https://ai-sdk.dev/unauthenticated-ai-gateway";
2612
2642
  if (isProductionEnv) {
2613
- return new AISDKError25({
2643
+ return new AISDKError26({
2614
2644
  name: "GatewayError",
2615
2645
  message: `Unauthenticated. Configure AI_GATEWAY_API_KEY or use a provider module. Learn more: ${moreInfoURL}`
2616
2646
  });
@@ -2668,13 +2698,13 @@ function createNullLanguageModelUsage() {
2668
2698
  };
2669
2699
  }
2670
2700
  function addLanguageModelUsage(usage1, usage2) {
2671
- var _a24, _b24, _c, _d, _e, _f, _g, _h, _i, _j;
2701
+ var _a25, _b25, _c, _d, _e, _f, _g, _h, _i, _j;
2672
2702
  return {
2673
2703
  inputTokens: addTokenCounts(usage1.inputTokens, usage2.inputTokens),
2674
2704
  inputTokenDetails: {
2675
2705
  noCacheTokens: addTokenCounts(
2676
- (_a24 = usage1.inputTokenDetails) == null ? void 0 : _a24.noCacheTokens,
2677
- (_b24 = usage2.inputTokenDetails) == null ? void 0 : _b24.noCacheTokens
2706
+ (_a25 = usage1.inputTokenDetails) == null ? void 0 : _a25.noCacheTokens,
2707
+ (_b25 = usage2.inputTokenDetails) == null ? void 0 : _b25.noCacheTokens
2678
2708
  ),
2679
2709
  cacheReadTokens: addTokenCounts(
2680
2710
  (_c = usage1.inputTokenDetails) == null ? void 0 : _c.cacheReadTokens,
@@ -2726,8 +2756,8 @@ function mergeAbortSignals(...signals) {
2726
2756
 
2727
2757
  // src/util/now.ts
2728
2758
  function now() {
2729
- var _a24, _b24;
2730
- return (_b24 = (_a24 = globalThis == null ? void 0 : globalThis.performance) == null ? void 0 : _a24.now()) != null ? _b24 : Date.now();
2759
+ var _a25, _b25;
2760
+ return (_b25 = (_a25 = globalThis == null ? void 0 : globalThis.performance) == null ? void 0 : _a25.now()) != null ? _b25 : Date.now();
2731
2761
  }
2732
2762
 
2733
2763
  // src/util/notify.ts
@@ -3285,7 +3315,7 @@ function filterActiveTools({
3285
3315
  return tools;
3286
3316
  }
3287
3317
  return Object.fromEntries(
3288
- Object.entries(tools).filter(([name24]) => activeTools.includes(name24))
3318
+ Object.entries(tools).filter(([name25]) => activeTools.includes(name25))
3289
3319
  );
3290
3320
  }
3291
3321
 
@@ -3685,7 +3715,7 @@ var text = () => ({
3685
3715
  });
3686
3716
  var object2 = ({
3687
3717
  schema: inputSchema,
3688
- name: name24,
3718
+ name: name25,
3689
3719
  description
3690
3720
  }) => {
3691
3721
  const schema = asSchema2(inputSchema);
@@ -3694,7 +3724,7 @@ var object2 = ({
3694
3724
  responseFormat: resolve(schema.jsonSchema).then((jsonSchema2) => ({
3695
3725
  type: "json",
3696
3726
  schema: jsonSchema2,
3697
- ...name24 != null && { name: name24 },
3727
+ ...name25 != null && { name: name25 },
3698
3728
  ...description != null && { description }
3699
3729
  })),
3700
3730
  async parseCompleteOutput({ text: text2 }, context) {
@@ -3748,7 +3778,7 @@ var object2 = ({
3748
3778
  };
3749
3779
  var array2 = ({
3750
3780
  element: inputElementSchema,
3751
- name: name24,
3781
+ name: name25,
3752
3782
  description
3753
3783
  }) => {
3754
3784
  const elementSchema = asSchema2(inputElementSchema);
@@ -3775,7 +3805,7 @@ var array2 = ({
3775
3805
  required: ["elements"],
3776
3806
  additionalProperties: false
3777
3807
  },
3778
- ...name24 != null && { name: name24 },
3808
+ ...name25 != null && { name: name25 },
3779
3809
  ...description != null && { description }
3780
3810
  };
3781
3811
  }),
@@ -3869,7 +3899,7 @@ var array2 = ({
3869
3899
  };
3870
3900
  var choice = ({
3871
3901
  options: choiceOptions,
3872
- name: name24,
3902
+ name: name25,
3873
3903
  description
3874
3904
  }) => {
3875
3905
  return {
@@ -3886,7 +3916,7 @@ var choice = ({
3886
3916
  required: ["result"],
3887
3917
  additionalProperties: false
3888
3918
  },
3889
- ...name24 != null && { name: name24 },
3919
+ ...name25 != null && { name: name25 },
3890
3920
  ...description != null && { description }
3891
3921
  }),
3892
3922
  async parseCompleteOutput({ text: text2 }, context) {
@@ -3947,14 +3977,14 @@ var choice = ({
3947
3977
  };
3948
3978
  };
3949
3979
  var json = ({
3950
- name: name24,
3980
+ name: name25,
3951
3981
  description
3952
3982
  } = {}) => {
3953
3983
  return {
3954
3984
  name: "json",
3955
3985
  responseFormat: Promise.resolve({
3956
3986
  type: "json",
3957
- ...name24 != null && { name: name24 },
3987
+ ...name25 != null && { name: name25 },
3958
3988
  ...description != null && { description }
3959
3989
  }),
3960
3990
  async parseCompleteOutput({ text: text2 }, context) {
@@ -4029,8 +4059,8 @@ async function parseToolCall({
4029
4059
  toolCall,
4030
4060
  tools,
4031
4061
  inputSchema: async ({ toolName }) => {
4032
- var _a24;
4033
- const inputSchema = (_a24 = getOwn(tools, toolName)) == null ? void 0 : _a24.inputSchema;
4062
+ var _a25;
4063
+ const inputSchema = (_a25 = getOwn(tools, toolName)) == null ? void 0 : _a25.inputSchema;
4034
4064
  return await asSchema3(inputSchema).jsonSchema;
4035
4065
  },
4036
4066
  instructions,
@@ -4154,10 +4184,10 @@ function prepareStepCallSettings({
4154
4184
  callSettings,
4155
4185
  stepSettings
4156
4186
  }) {
4157
- var _a24, _b24, _c, _d, _e, _f, _g, _h, _i;
4187
+ var _a25, _b25, _c, _d, _e, _f, _g, _h, _i;
4158
4188
  return prepareLanguageModelCallOptions({
4159
- maxOutputTokens: (_a24 = stepSettings == null ? void 0 : stepSettings.maxOutputTokens) != null ? _a24 : callSettings.maxOutputTokens,
4160
- temperature: (_b24 = stepSettings == null ? void 0 : stepSettings.temperature) != null ? _b24 : callSettings.temperature,
4189
+ maxOutputTokens: (_a25 = stepSettings == null ? void 0 : stepSettings.maxOutputTokens) != null ? _a25 : callSettings.maxOutputTokens,
4190
+ temperature: (_b25 = stepSettings == null ? void 0 : stepSettings.temperature) != null ? _b25 : callSettings.temperature,
4161
4191
  topP: (_c = stepSettings == null ? void 0 : stepSettings.topP) != null ? _c : callSettings.topP,
4162
4192
  topK: (_d = stepSettings == null ? void 0 : stepSettings.topK) != null ? _d : callSettings.topK,
4163
4193
  presencePenalty: (_e = stepSettings == null ? void 0 : stepSettings.presencePenalty) != null ? _e : callSettings.presencePenalty,
@@ -4288,8 +4318,8 @@ var AI_SDK_TELEMETRY_TRACING_CHANNEL = "ai:telemetry";
4288
4318
 
4289
4319
  // src/util/is-node-runtime.ts
4290
4320
  function isNodeRuntime() {
4291
- var _a24;
4292
- return typeof process !== "undefined" && ((_a24 = process.release) == null ? void 0 : _a24.name) === "node";
4321
+ var _a25;
4322
+ return typeof process !== "undefined" && ((_a25 = process.release) == null ? void 0 : _a25.name) === "node";
4293
4323
  }
4294
4324
 
4295
4325
  // src/telemetry/tracing-channel-publisher.ts
@@ -4306,18 +4336,18 @@ async function loadDiagnosticsChannel() {
4306
4336
  return diagnosticsChannelPromise;
4307
4337
  }
4308
4338
  function loadBuiltinModule(id) {
4309
- var _a24;
4339
+ var _a25;
4310
4340
  const processWithBuiltins = globalThis.process;
4311
4341
  try {
4312
- return (_a24 = processWithBuiltins == null ? void 0 : processWithBuiltins.getBuiltinModule) == null ? void 0 : _a24.call(processWithBuiltins, id);
4342
+ return (_a25 = processWithBuiltins == null ? void 0 : processWithBuiltins.getBuiltinModule) == null ? void 0 : _a25.call(processWithBuiltins, id);
4313
4343
  } catch (e) {
4314
4344
  return void 0;
4315
4345
  }
4316
4346
  }
4317
4347
  async function runWithTracingChannelSpan(message, execute) {
4318
- var _a24;
4348
+ var _a25;
4319
4349
  const diagnosticsChannel = await loadDiagnosticsChannel();
4320
- const tracingChannel = (_a24 = diagnosticsChannel == null ? void 0 : diagnosticsChannel.tracingChannel) == null ? void 0 : _a24.call(
4350
+ const tracingChannel = (_a25 = diagnosticsChannel == null ? void 0 : diagnosticsChannel.tracingChannel) == null ? void 0 : _a25.call(
4321
4351
  diagnosticsChannel,
4322
4352
  AI_SDK_TELEMETRY_TRACING_CHANNEL
4323
4353
  );
@@ -4368,7 +4398,7 @@ function openTelemetryChannelSpanContext({
4368
4398
  message,
4369
4399
  completion
4370
4400
  }) {
4371
- var _a24;
4401
+ var _a25;
4372
4402
  if (!isNodeRuntime()) {
4373
4403
  return void 0;
4374
4404
  }
@@ -4376,7 +4406,7 @@ function openTelemetryChannelSpanContext({
4376
4406
  "node:diagnostics_channel"
4377
4407
  );
4378
4408
  const asyncHooks = loadBuiltinModule("node:async_hooks");
4379
- const tracingChannel = (_a24 = diagnosticsChannel == null ? void 0 : diagnosticsChannel.tracingChannel) == null ? void 0 : _a24.call(
4409
+ const tracingChannel = (_a25 = diagnosticsChannel == null ? void 0 : diagnosticsChannel.tracingChannel) == null ? void 0 : _a25.call(
4380
4410
  diagnosticsChannel,
4381
4411
  AI_SDK_TELEMETRY_TRACING_CHANNEL
4382
4412
  );
@@ -4434,8 +4464,8 @@ function registerTelemetry(...integrations) {
4434
4464
  globalThis.AI_SDK_TELEMETRY_INTEGRATIONS.push(...integrations);
4435
4465
  }
4436
4466
  function getGlobalTelemetryIntegrations() {
4437
- var _a24;
4438
- return (_a24 = globalThis.AI_SDK_TELEMETRY_INTEGRATIONS) != null ? _a24 : [];
4467
+ var _a25;
4468
+ return (_a25 = globalThis.AI_SDK_TELEMETRY_INTEGRATIONS) != null ? _a25 : [];
4439
4469
  }
4440
4470
 
4441
4471
  // src/telemetry/create-telemetry-dispatcher.ts
@@ -4461,8 +4491,8 @@ function createTelemetryDispatcher({
4461
4491
  };
4462
4492
  const mergeTelemetryCallback = (key) => {
4463
4493
  const integrationCallbacks = integrations.map((integration) => {
4464
- var _a24;
4465
- return (_a24 = integration[key]) == null ? void 0 : _a24.bind(integration);
4494
+ var _a25;
4495
+ return (_a25 = integration[key]) == null ? void 0 : _a25.bind(integration);
4466
4496
  }).filter(Boolean).map(
4467
4497
  (callback) => ((event) => callback(augmentEvent(event, telemetryMetadata)))
4468
4498
  );
@@ -4472,12 +4502,12 @@ function createTelemetryDispatcher({
4472
4502
  };
4473
4503
  };
4474
4504
  const executeLanguageModelCallWrappers = integrations.map((integration) => {
4475
- var _a24;
4476
- return (_a24 = integration.executeLanguageModelCall) == null ? void 0 : _a24.bind(integration);
4505
+ var _a25;
4506
+ return (_a25 = integration.executeLanguageModelCall) == null ? void 0 : _a25.bind(integration);
4477
4507
  }).filter(Boolean);
4478
4508
  const executeToolWrappers = integrations.map((integration) => {
4479
- var _a24;
4480
- return (_a24 = integration.executeTool) == null ? void 0 : _a24.bind(integration);
4509
+ var _a25;
4510
+ return (_a25 = integration.executeTool) == null ? void 0 : _a25.bind(integration);
4481
4511
  }).filter(Boolean);
4482
4512
  return {
4483
4513
  runInTracingChannelSpan: async ({ type, event, execute }) => await runWithTracingChannelSpan(
@@ -4721,8 +4751,8 @@ function createRestrictedTelemetryDispatcher({
4721
4751
  return {
4722
4752
  ...telemetryDispatcher,
4723
4753
  onStart: (event) => {
4724
- var _a24;
4725
- return (_a24 = telemetryDispatcher.onStart) == null ? void 0 : _a24.call(telemetryDispatcher, {
4754
+ var _a25;
4755
+ return (_a25 = telemetryDispatcher.onStart) == null ? void 0 : _a25.call(telemetryDispatcher, {
4726
4756
  ...event,
4727
4757
  runtimeContext: filterIncludedContext({
4728
4758
  context: event.runtimeContext,
@@ -4735,8 +4765,8 @@ function createRestrictedTelemetryDispatcher({
4735
4765
  });
4736
4766
  },
4737
4767
  onStepStart: (event) => {
4738
- var _a24;
4739
- return (_a24 = telemetryDispatcher.onStepStart) == null ? void 0 : _a24.call(telemetryDispatcher, {
4768
+ var _a25;
4769
+ return (_a25 = telemetryDispatcher.onStepStart) == null ? void 0 : _a25.call(telemetryDispatcher, {
4740
4770
  ...event,
4741
4771
  runtimeContext: filterIncludedContext({
4742
4772
  context: event.runtimeContext,
@@ -4756,8 +4786,8 @@ function createRestrictedTelemetryDispatcher({
4756
4786
  });
4757
4787
  },
4758
4788
  onStepEnd: (event) => {
4759
- var _a24;
4760
- return (_a24 = telemetryDispatcher.onStepEnd) == null ? void 0 : _a24.call(
4789
+ var _a25;
4790
+ return (_a25 = telemetryDispatcher.onStepEnd) == null ? void 0 : _a25.call(
4761
4791
  telemetryDispatcher,
4762
4792
  restrictStepResult({
4763
4793
  step: event,
@@ -4767,8 +4797,8 @@ function createRestrictedTelemetryDispatcher({
4767
4797
  );
4768
4798
  },
4769
4799
  onStepFinish: (event) => {
4770
- var _a24;
4771
- return (_a24 = telemetryDispatcher.onStepEnd) == null ? void 0 : _a24.call(
4800
+ var _a25;
4801
+ return (_a25 = telemetryDispatcher.onStepEnd) == null ? void 0 : _a25.call(
4772
4802
  telemetryDispatcher,
4773
4803
  restrictStepResult({
4774
4804
  step: event,
@@ -4778,8 +4808,8 @@ function createRestrictedTelemetryDispatcher({
4778
4808
  );
4779
4809
  },
4780
4810
  onEnd: (event) => {
4781
- var _a24;
4782
- return (_a24 = telemetryDispatcher.onEnd) == null ? void 0 : _a24.call(
4811
+ var _a25;
4812
+ return (_a25 = telemetryDispatcher.onEnd) == null ? void 0 : _a25.call(
4783
4813
  telemetryDispatcher,
4784
4814
  ((restrictedSteps) => {
4785
4815
  return {
@@ -4807,8 +4837,8 @@ function createRestrictedTelemetryDispatcher({
4807
4837
  );
4808
4838
  },
4809
4839
  onAbort: (event) => {
4810
- var _a24;
4811
- return (_a24 = telemetryDispatcher.onAbort) == null ? void 0 : _a24.call(telemetryDispatcher, {
4840
+ var _a25;
4841
+ return (_a25 = telemetryDispatcher.onAbort) == null ? void 0 : _a25.call(telemetryDispatcher, {
4812
4842
  ...event,
4813
4843
  steps: event.steps.map(
4814
4844
  (step) => restrictStepResult({
@@ -4820,8 +4850,8 @@ function createRestrictedTelemetryDispatcher({
4820
4850
  });
4821
4851
  },
4822
4852
  onToolExecutionStart: (event) => {
4823
- var _a24;
4824
- return (_a24 = telemetryDispatcher.onToolExecutionStart) == null ? void 0 : _a24.call(telemetryDispatcher, {
4853
+ var _a25;
4854
+ return (_a25 = telemetryDispatcher.onToolExecutionStart) == null ? void 0 : _a25.call(telemetryDispatcher, {
4825
4855
  ...event,
4826
4856
  toolContext: filterToolContext({
4827
4857
  toolName: event.toolCall.toolName,
@@ -4831,8 +4861,8 @@ function createRestrictedTelemetryDispatcher({
4831
4861
  });
4832
4862
  },
4833
4863
  onToolExecutionEnd: (event) => {
4834
- var _a24;
4835
- return (_a24 = telemetryDispatcher.onToolExecutionEnd) == null ? void 0 : _a24.call(telemetryDispatcher, {
4864
+ var _a25;
4865
+ return (_a25 = telemetryDispatcher.onToolExecutionEnd) == null ? void 0 : _a25.call(telemetryDispatcher, {
4836
4866
  ...event,
4837
4867
  toolContext: filterToolContext({
4838
4868
  toolName: event.toolCall.toolName,
@@ -4853,8 +4883,8 @@ function isLoopFinished() {
4853
4883
  }
4854
4884
  function hasToolCall(...toolName) {
4855
4885
  return ({ steps }) => {
4856
- var _a24, _b24, _c;
4857
- return (_c = (_b24 = (_a24 = steps[steps.length - 1]) == null ? void 0 : _a24.toolCalls) == null ? void 0 : _b24.some(
4886
+ var _a25, _b25, _c;
4887
+ return (_c = (_b25 = (_a25 = steps[steps.length - 1]) == null ? void 0 : _a25.toolCalls) == null ? void 0 : _b25.some(
4858
4888
  (toolCall) => toolName.includes(toolCall.toolName)
4859
4889
  )) != null ? _c : false;
4860
4890
  };
@@ -5119,7 +5149,7 @@ function prepareToolsForToolCallers({
5119
5149
  tools,
5120
5150
  toolCallers
5121
5151
  }) {
5122
- var _a24, _b24;
5152
+ var _a25, _b25;
5123
5153
  if (tools == null || toolCallers == null) {
5124
5154
  return { executionTools: tools, modelTools: tools };
5125
5155
  }
@@ -5152,7 +5182,7 @@ function prepareToolsForToolCallers({
5152
5182
  )
5153
5183
  };
5154
5184
  } else {
5155
- const localTools = (_a24 = localToolsByCaller.get(callerName)) != null ? _a24 : {};
5185
+ const localTools = (_a25 = localToolsByCaller.get(callerName)) != null ? _a25 : {};
5156
5186
  localTools[toolName] = preparedTool;
5157
5187
  localToolsByCaller.set(callerName, localTools);
5158
5188
  }
@@ -5169,7 +5199,7 @@ function prepareToolsForToolCallers({
5169
5199
  if ((caller == null ? void 0 : caller.type) !== "local") {
5170
5200
  continue;
5171
5201
  }
5172
- const boundCaller = caller.bind((_b24 = localToolsByCaller.get(callerName)) != null ? _b24 : {});
5202
+ const boundCaller = caller.bind((_b25 = localToolsByCaller.get(callerName)) != null ? _b25 : {});
5173
5203
  executionTools[callerName] = boundCaller;
5174
5204
  if (Object.prototype.hasOwnProperty.call(modelTools, callerName)) {
5175
5205
  modelTools[callerName] = boundCaller;
@@ -5310,7 +5340,7 @@ async function validateApprovedToolApprovals({
5310
5340
  runtimeContext,
5311
5341
  toolApprovalSecret
5312
5342
  }) {
5313
- var _a24;
5343
+ var _a25;
5314
5344
  const approved = [];
5315
5345
  const denied = [];
5316
5346
  const invalid = [];
@@ -5372,7 +5402,7 @@ async function validateApprovedToolApprovals({
5372
5402
  approvalResponse: {
5373
5403
  ...approval.approvalResponse,
5374
5404
  approved: false,
5375
- reason: (_a24 = approvalStatus.reason) != null ? _a24 : approval.approvalResponse.reason
5405
+ reason: (_a25 = approvalStatus.reason) != null ? _a25 : approval.approvalResponse.reason
5376
5406
  }
5377
5407
  });
5378
5408
  } else {
@@ -5451,10 +5481,10 @@ async function generateText({
5451
5481
  onEnd = onFinish,
5452
5482
  ...settings
5453
5483
  }) {
5454
- var _a24, _b24, _c, _d;
5484
+ var _a25, _b25, _c, _d;
5455
5485
  include = {
5456
- requestBody: (_a24 = include == null ? void 0 : include.requestBody) != null ? _a24 : false,
5457
- requestMessages: (_b24 = include == null ? void 0 : include.requestMessages) != null ? _b24 : false,
5486
+ requestBody: (_a25 = include == null ? void 0 : include.requestBody) != null ? _a25 : false,
5487
+ requestMessages: (_b25 = include == null ? void 0 : include.requestMessages) != null ? _b25 : false,
5458
5488
  responseBody: (_c = include == null ? void 0 : include.responseBody) != null ? _c : false
5459
5489
  };
5460
5490
  const model = resolveLanguageModel(modelArg);
@@ -5552,7 +5582,7 @@ async function generateText({
5552
5582
  toolsContext
5553
5583
  };
5554
5584
  const executeGenerateText = async () => {
5555
- var _a25;
5585
+ var _a26;
5556
5586
  await notify({
5557
5587
  event: generateTextStartEvent,
5558
5588
  callbacks: [resolvedOnStart, telemetryDispatcher.onStart]
@@ -5698,7 +5728,7 @@ async function generateText({
5698
5728
  type: "step",
5699
5729
  event: { callId, stepNumber },
5700
5730
  execute: async () => {
5701
- var _a26, _b25, _c2, _d2, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
5731
+ var _a27, _b26, _c2, _d2, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
5702
5732
  const accumulatedResponseMessages = [
5703
5733
  ...initialResponseMessages,
5704
5734
  ...steps.flatMap((step) => step.response.messages)
@@ -5717,9 +5747,9 @@ async function generateText({
5717
5747
  toolsContext,
5718
5748
  experimental_sandbox: sandbox
5719
5749
  }));
5720
- const stepSandbox = (_a26 = prepareStepResult == null ? void 0 : prepareStepResult.experimental_sandbox) != null ? _a26 : sandbox;
5750
+ const stepSandbox = (_a27 = prepareStepResult == null ? void 0 : prepareStepResult.experimental_sandbox) != null ? _a27 : sandbox;
5721
5751
  const stepModel = resolveLanguageModel(
5722
- (_b25 = prepareStepResult == null ? void 0 : prepareStepResult.model) != null ? _b25 : model
5752
+ (_b26 = prepareStepResult == null ? void 0 : prepareStepResult.model) != null ? _b26 : model
5723
5753
  );
5724
5754
  const stepInstructions = (_d2 = (_c2 = prepareStepResult == null ? void 0 : prepareStepResult.instructions) != null ? _c2 : prepareStepResult == null ? void 0 : prepareStepResult.system) != null ? _d2 : instructionsForNextStep;
5725
5755
  const promptMessages = await convertToLanguageModelPrompt({
@@ -5812,7 +5842,7 @@ async function generateText({
5812
5842
  });
5813
5843
  const executeLanguageModelCallInTelemetryContext = (_n = telemetryDispatcher.executeLanguageModelCall) != null ? _n : (async ({ execute }) => await execute());
5814
5844
  currentModelResponse = await retry(async () => {
5815
- var _a27, _b26, _c3, _d3, _e2, _f2, _g2, _h2;
5845
+ var _a28, _b27, _c3, _d3, _e2, _f2, _g2, _h2;
5816
5846
  const result = await executeLanguageModelCallInTelemetryContext(
5817
5847
  {
5818
5848
  ...languageModelCallStartEvent,
@@ -5829,7 +5859,7 @@ async function generateText({
5829
5859
  }
5830
5860
  );
5831
5861
  const responseData = {
5832
- id: (_b26 = (_a27 = result.response) == null ? void 0 : _a27.id) != null ? _b26 : generateId4(),
5862
+ id: (_b27 = (_a28 = result.response) == null ? void 0 : _a28.id) != null ? _b27 : generateId4(),
5833
5863
  timestamp: (_d3 = (_c3 = result.response) == null ? void 0 : _c3.timestamp) != null ? _d3 : /* @__PURE__ */ new Date(),
5834
5864
  modelId: (_f2 = (_e2 = result.response) == null ? void 0 : _e2.modelId) != null ? _f2 : stepModel.modelId,
5835
5865
  headers: (_g2 = result.response) == null ? void 0 : _g2.headers,
@@ -5901,6 +5931,18 @@ async function generateText({
5901
5931
  telemetryDispatcher.onLanguageModelCallEnd
5902
5932
  ]
5903
5933
  });
5934
+ const enforcedToolChoice = stepToolChoice.type === "required" || stepToolChoice.type === "tool" ? stepToolChoice : void 0;
5935
+ if (enforcedToolChoice != null && !stepToolCalls.some(
5936
+ (toolCall) => enforcedToolChoice.type === "required" || toolCall.toolName === enforcedToolChoice.toolName
5937
+ )) {
5938
+ throw new ToolChoiceViolationError({
5939
+ toolChoice: enforcedToolChoice,
5940
+ finishReason: currentModelResponse.finishReason.unified,
5941
+ provider: stepModel.provider,
5942
+ modelId: stepModel.modelId,
5943
+ content: currentModelResponse.content
5944
+ });
5945
+ }
5904
5946
  for (const toolCall of stepToolCalls) {
5905
5947
  if (toolCall.invalid) {
5906
5948
  continue;
@@ -6189,8 +6231,8 @@ async function generateText({
6189
6231
  const staticToolResults = steps.flatMap((step) => step.staticToolResults);
6190
6232
  const dynamicToolResults = steps.flatMap((step) => step.dynamicToolResults);
6191
6233
  const warnings = steps.flatMap((step) => {
6192
- var _a26;
6193
- return (_a26 = step.warnings) != null ? _a26 : [];
6234
+ var _a27;
6235
+ return (_a27 = step.warnings) != null ? _a27 : [];
6194
6236
  });
6195
6237
  const onEndEvent = {
6196
6238
  callId,
@@ -6248,7 +6290,7 @@ async function generateText({
6248
6290
  output: resolvedOutput
6249
6291
  });
6250
6292
  } catch (error) {
6251
- await ((_a25 = telemetryDispatcher.onError) == null ? void 0 : _a25.call(telemetryDispatcher, { callId, error }));
6293
+ await ((_a26 = telemetryDispatcher.onError) == null ? void 0 : _a26.call(telemetryDispatcher, { callId, error }));
6252
6294
  throw wrapGatewayError(error);
6253
6295
  }
6254
6296
  };
@@ -6348,8 +6390,8 @@ var DefaultGenerateTextResult = class {
6348
6390
  }
6349
6391
  get warnings() {
6350
6392
  return this.steps.flatMap((step) => {
6351
- var _a24;
6352
- return (_a24 = step.warnings) != null ? _a24 : [];
6393
+ var _a25;
6394
+ return (_a25 = step.warnings) != null ? _a25 : [];
6353
6395
  });
6354
6396
  }
6355
6397
  get providerMetadata() {
@@ -6858,7 +6900,7 @@ function processUIMessageStream({
6858
6900
  new TransformStream({
6859
6901
  async transform(chunk, controller) {
6860
6902
  await runUpdateMessageJob(async ({ state, write }) => {
6861
- var _a24, _b24, _c, _d;
6903
+ var _a25, _b25, _c, _d;
6862
6904
  function getCurrentStepParts() {
6863
6905
  const parts = state.message.parts;
6864
6906
  let currentStepStartIndex = parts.length - 1;
@@ -6898,8 +6940,8 @@ function processUIMessageStream({
6898
6940
  const toolInvocations = state.message.parts.filter(isToolUIPart);
6899
6941
  const toolInvocation = toolInvocations.find(
6900
6942
  (invocation) => {
6901
- var _a25;
6902
- return ((_a25 = invocation.approval) == null ? void 0 : _a25.id) === approvalId;
6943
+ var _a26;
6944
+ return ((_a26 = invocation.approval) == null ? void 0 : _a26.id) === approvalId;
6903
6945
  }
6904
6946
  );
6905
6947
  if (toolInvocation == null) {
@@ -6912,7 +6954,7 @@ function processUIMessageStream({
6912
6954
  return toolInvocation;
6913
6955
  }
6914
6956
  function updateToolPart(options, existingPart) {
6915
- var _a25;
6957
+ var _a26;
6916
6958
  const part = existingPart != null ? existingPart : getCurrentStepParts().find(
6917
6959
  (part2) => isStaticToolUIPart(part2) && part2.toolCallId === options.toolCallId
6918
6960
  );
@@ -6931,7 +6973,7 @@ function processUIMessageStream({
6931
6973
  if (options.toolMetadata !== void 0) {
6932
6974
  anyPart.toolMetadata = options.toolMetadata;
6933
6975
  }
6934
- anyPart.providerExecuted = (_a25 = anyOptions.providerExecuted) != null ? _a25 : part.providerExecuted;
6976
+ anyPart.providerExecuted = (_a26 = anyOptions.providerExecuted) != null ? _a26 : part.providerExecuted;
6935
6977
  const providerMetadata = anyOptions.providerMetadata;
6936
6978
  if (providerMetadata != null) {
6937
6979
  if (options.state === "output-available" || options.state === "output-error") {
@@ -6960,7 +7002,7 @@ function processUIMessageStream({
6960
7002
  }
6961
7003
  }
6962
7004
  function updateDynamicToolPart(options, existingPart) {
6963
- var _a25, _b25;
7005
+ var _a26, _b26;
6964
7006
  const part = existingPart != null ? existingPart : getCurrentStepParts().find(
6965
7007
  (part2) => part2.type === "dynamic-tool" && part2.toolCallId === options.toolCallId
6966
7008
  );
@@ -6972,7 +7014,7 @@ function processUIMessageStream({
6972
7014
  anyPart.input = anyOptions.input;
6973
7015
  anyPart.output = anyOptions.output;
6974
7016
  anyPart.errorText = anyOptions.errorText;
6975
- anyPart.rawInput = (_a25 = anyOptions.rawInput) != null ? _a25 : anyPart.rawInput;
7017
+ anyPart.rawInput = (_a26 = anyOptions.rawInput) != null ? _a26 : anyPart.rawInput;
6976
7018
  anyPart.preliminary = anyOptions.preliminary;
6977
7019
  if (options.title !== void 0) {
6978
7020
  anyPart.title = options.title;
@@ -6980,7 +7022,7 @@ function processUIMessageStream({
6980
7022
  if (options.toolMetadata !== void 0) {
6981
7023
  anyPart.toolMetadata = options.toolMetadata;
6982
7024
  }
6983
- anyPart.providerExecuted = (_b25 = anyOptions.providerExecuted) != null ? _b25 : part.providerExecuted;
7025
+ anyPart.providerExecuted = (_b26 = anyOptions.providerExecuted) != null ? _b26 : part.providerExecuted;
6984
7026
  const providerMetadata = anyOptions.providerMetadata;
6985
7027
  if (providerMetadata != null) {
6986
7028
  if (options.state === "output-available" || options.state === "output-error") {
@@ -7047,7 +7089,7 @@ function processUIMessageStream({
7047
7089
  });
7048
7090
  }
7049
7091
  textPart.text += chunk.delta;
7050
- textPart.providerMetadata = (_a24 = chunk.providerMetadata) != null ? _a24 : textPart.providerMetadata;
7092
+ textPart.providerMetadata = (_a25 = chunk.providerMetadata) != null ? _a25 : textPart.providerMetadata;
7051
7093
  write();
7052
7094
  break;
7053
7095
  }
@@ -7061,7 +7103,7 @@ function processUIMessageStream({
7061
7103
  });
7062
7104
  }
7063
7105
  textPart.state = "done";
7064
- textPart.providerMetadata = (_b24 = chunk.providerMetadata) != null ? _b24 : textPart.providerMetadata;
7106
+ textPart.providerMetadata = (_b25 = chunk.providerMetadata) != null ? _b25 : textPart.providerMetadata;
7065
7107
  delete state.activeTextParts[chunk.id];
7066
7108
  write();
7067
7109
  break;
@@ -7565,13 +7607,13 @@ function handleUIMessageStreamFinish({
7565
7607
  };
7566
7608
  let finishCalled = false;
7567
7609
  const callOnEnd = async () => {
7568
- var _a24;
7610
+ var _a25;
7569
7611
  if (finishCalled || !resolvedOnEnd) {
7570
7612
  return;
7571
7613
  }
7572
7614
  finishCalled = true;
7573
7615
  const isContinuation = state.message.id === (lastMessage == null ? void 0 : lastMessage.id);
7574
- const declaredOutcome = (_a24 = getOutcome == null ? void 0 : getOutcome()) != null ? _a24 : { status: "unknown" };
7616
+ const declaredOutcome = (_a25 = getOutcome == null ? void 0 : getOutcome()) != null ? _a25 : { status: "unknown" };
7575
7617
  const outcome = hasProcessingFailure ? { status: "failed", error: processingError } : declaredOutcome.status === "unknown" && isAborted ? { status: "aborted" } : declaredOutcome;
7576
7618
  await resolvedOnEnd({
7577
7619
  isAborted: isAborted || outcome.status === "aborted",
@@ -8010,12 +8052,12 @@ function asAsyncIterableStream(stream) {
8010
8052
  const reader = this.getReader();
8011
8053
  let finished = false;
8012
8054
  async function cleanup(cancelStream) {
8013
- var _a24;
8055
+ var _a25;
8014
8056
  if (finished) return;
8015
8057
  finished = true;
8016
8058
  try {
8017
8059
  if (cancelStream) {
8018
- await ((_a24 = reader.cancel) == null ? void 0 : _a24.call(reader));
8060
+ await ((_a25 = reader.cancel) == null ? void 0 : _a25.call(reader));
8019
8061
  }
8020
8062
  } finally {
8021
8063
  try {
@@ -8136,7 +8178,7 @@ function createStitchableStream() {
8136
8178
  controller == null ? void 0 : controller.close();
8137
8179
  };
8138
8180
  const processPull = async () => {
8139
- var _a24;
8181
+ var _a25;
8140
8182
  if (isCancelled) {
8141
8183
  return;
8142
8184
  }
@@ -8169,7 +8211,7 @@ function createStitchableStream() {
8169
8211
  if (isCancelled) {
8170
8212
  return;
8171
8213
  }
8172
- (_a24 = currentStream.onError) == null ? void 0 : _a24.call(currentStream, error);
8214
+ (_a25 = currentStream.onError) == null ? void 0 : _a25.call(currentStream, error);
8173
8215
  controller == null ? void 0 : controller.error(error);
8174
8216
  innerStreams.shift();
8175
8217
  terminate();
@@ -8193,9 +8235,9 @@ function createStitchableStream() {
8193
8235
  }
8194
8236
  }),
8195
8237
  addStream: (innerStream, callbacks) => {
8196
- var _a24;
8238
+ var _a25;
8197
8239
  if (isCancelled) {
8198
- (_a24 = callbacks == null ? void 0 : callbacks.onCancel) == null ? void 0 : _a24.call(callbacks);
8240
+ (_a25 = callbacks == null ? void 0 : callbacks.onCancel) == null ? void 0 : _a25.call(callbacks);
8199
8241
  void innerStream.cancel().catch(() => {
8200
8242
  });
8201
8243
  return;
@@ -8459,11 +8501,11 @@ import {
8459
8501
  } from "@ai-sdk/provider-utils";
8460
8502
 
8461
8503
  // src/prompt/normalize-stream-provider-error.ts
8462
- import { AISDKError as AISDKError26 } from "@ai-sdk/provider";
8504
+ import { AISDKError as AISDKError27 } from "@ai-sdk/provider";
8463
8505
  import { isProviderStreamError } from "@ai-sdk/provider-utils";
8464
8506
  function normalizeStreamProviderError(error) {
8465
- var _a24, _b24, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
8466
- if (isError(error) || AISDKError26.isInstance(error) || StreamProviderError.isInstance(error)) {
8507
+ var _a25, _b25, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
8508
+ if (isError(error) || AISDKError27.isInstance(error) || StreamProviderError.isInstance(error)) {
8467
8509
  return error;
8468
8510
  }
8469
8511
  const outer = asRecord(error);
@@ -8471,7 +8513,7 @@ function normalizeStreamProviderError(error) {
8471
8513
  return error;
8472
8514
  }
8473
8515
  const providerStreamError = isProviderStreamError(error);
8474
- const details = providerStreamError ? outer : (_c = (_b24 = asRecord((_a24 = asRecord(outer.response)) == null ? void 0 : _a24.error)) != null ? _b24 : asRecord(outer.error)) != null ? _c : outer;
8516
+ const details = providerStreamError ? outer : (_c = (_b25 = asRecord((_a25 = asRecord(outer.response)) == null ? void 0 : _a25.error)) != null ? _b25 : asRecord(outer.error)) != null ? _c : outer;
8475
8517
  if (typeof details.message !== "string") {
8476
8518
  return error;
8477
8519
  }
@@ -8681,7 +8723,7 @@ function createLanguageModelV4StreamPartToLanguageModelStreamPartTransform({
8681
8723
  const timeBetweenOutputChunksMs = [];
8682
8724
  return new TransformStream({
8683
8725
  async transform(chunk, controller) {
8684
- var _a24, _b24, _c;
8726
+ var _a25, _b25, _c;
8685
8727
  if (isOutputChunk(chunk)) {
8686
8728
  const outputChunkTimestampMs = now2();
8687
8729
  if (timeToFirstOutputMs == null) {
@@ -8926,7 +8968,7 @@ function createLanguageModelV4StreamPartToLanguageModelStreamPartTransform({
8926
8968
  const tool2 = getOwn(tools, chunk.toolName);
8927
8969
  controller.enqueue({
8928
8970
  ...chunk,
8929
- dynamic: (_a24 = chunk.dynamic) != null ? _a24 : (tool2 == null ? void 0 : tool2.type) === "dynamic",
8971
+ dynamic: (_a25 = chunk.dynamic) != null ? _a25 : (tool2 == null ? void 0 : tool2.type) === "dynamic",
8930
8972
  title: tool2 == null ? void 0 : tool2.title,
8931
8973
  ...(tool2 == null ? void 0 : tool2.metadata) != null ? { toolMetadata: tool2.metadata } : {}
8932
8974
  });
@@ -8940,7 +8982,7 @@ function createLanguageModelV4StreamPartToLanguageModelStreamPartTransform({
8940
8982
  break;
8941
8983
  }
8942
8984
  case "response-metadata": {
8943
- responseId = (_b24 = chunk.id) != null ? _b24 : responseId;
8985
+ responseId = (_b25 = chunk.id) != null ? _b25 : responseId;
8944
8986
  responseModelId = (_c = chunk.modelId) != null ? _c : responseModelId;
8945
8987
  controller.enqueue({
8946
8988
  type: "model-call-response-metadata",
@@ -9120,7 +9162,7 @@ function streamText({
9120
9162
  } = {},
9121
9163
  ...settings
9122
9164
  }) {
9123
- var _a24, _b24, _c, _d;
9165
+ var _a25, _b25, _c, _d;
9124
9166
  const totalTimeoutMs = getTotalTimeoutMs(timeout);
9125
9167
  const stepTimeoutMs = getStepTimeoutMs(timeout);
9126
9168
  const firstChunkTimeoutMs = getFirstChunkTimeoutMs(timeout);
@@ -9194,8 +9236,8 @@ function streamText({
9194
9236
  download: download2,
9195
9237
  // assign default values to include:
9196
9238
  include: {
9197
- requestBody: (_a24 = include == null ? void 0 : include.requestBody) != null ? _a24 : false,
9198
- requestMessages: (_b24 = include == null ? void 0 : include.requestMessages) != null ? _b24 : false,
9239
+ requestBody: (_a25 = include == null ? void 0 : include.requestBody) != null ? _a25 : false,
9240
+ requestMessages: (_b25 = include == null ? void 0 : include.requestMessages) != null ? _b25 : false,
9199
9241
  rawChunks: (_d = (_c = include == null ? void 0 : include.rawChunks) != null ? _c : includeRawChunks) != null ? _d : false
9200
9242
  }
9201
9243
  });
@@ -9229,7 +9271,7 @@ function createOutputTransformStream(output) {
9229
9271
  }
9230
9272
  return new TransformStream({
9231
9273
  async transform(chunk, controller) {
9232
- var _a24;
9274
+ var _a25;
9233
9275
  if (chunk.type === "finish-step" && textChunk.length > 0) {
9234
9276
  publishTextChunk({ controller });
9235
9277
  }
@@ -9256,7 +9298,7 @@ function createOutputTransformStream(output) {
9256
9298
  }
9257
9299
  text2 += chunk.text;
9258
9300
  textChunk += chunk.text;
9259
- textProviderMetadata = (_a24 = chunk.providerMetadata) != null ? _a24 : textProviderMetadata;
9301
+ textProviderMetadata = (_a25 = chunk.providerMetadata) != null ? _a25 : textProviderMetadata;
9260
9302
  if (chunk.text.length === 0 && chunk.providerMetadata != null) {
9261
9303
  controller.enqueue({ part: chunk, partialOutput: void 0 });
9262
9304
  return;
@@ -9379,7 +9421,7 @@ var DefaultStreamTextResult = class {
9379
9421
  let recordedNoOutputError;
9380
9422
  const eventProcessor = new TransformStream({
9381
9423
  async transform(chunk, controller) {
9382
- var _a24, _b24, _c, _d;
9424
+ var _a25, _b25, _c, _d;
9383
9425
  controller.enqueue(chunk);
9384
9426
  const { part } = chunk;
9385
9427
  await notify({
@@ -9420,7 +9462,7 @@ var DefaultStreamTextResult = class {
9420
9462
  return;
9421
9463
  }
9422
9464
  activeText.text += part.text;
9423
- activeText.providerMetadata = (_a24 = part.providerMetadata) != null ? _a24 : activeText.providerMetadata;
9465
+ activeText.providerMetadata = (_a25 = part.providerMetadata) != null ? _a25 : activeText.providerMetadata;
9424
9466
  }
9425
9467
  if (part.type === "text-end") {
9426
9468
  const activeText = activeTextContent[part.id];
@@ -9434,7 +9476,7 @@ var DefaultStreamTextResult = class {
9434
9476
  });
9435
9477
  return;
9436
9478
  }
9437
- activeText.providerMetadata = (_b24 = part.providerMetadata) != null ? _b24 : activeText.providerMetadata;
9479
+ activeText.providerMetadata = (_b25 = part.providerMetadata) != null ? _b25 : activeText.providerMetadata;
9438
9480
  delete activeTextContent[part.id];
9439
9481
  }
9440
9482
  if (part.type === "reasoning-start") {
@@ -9576,8 +9618,8 @@ var DefaultStreamTextResult = class {
9576
9618
  (step) => step.dynamicToolResults
9577
9619
  );
9578
9620
  const warnings = recordedSteps.flatMap((step) => {
9579
- var _a24;
9580
- return (_a24 = step.warnings) != null ? _a24 : [];
9621
+ var _a25;
9622
+ return (_a25 = step.warnings) != null ? _a25 : [];
9581
9623
  });
9582
9624
  const onEndWithOutput = onEnd == null ? void 0 : async (event) => {
9583
9625
  const parsedOutput = output == null ? void 0 : await self.getOutputPromise().catch(() => void 0);
@@ -9714,7 +9756,7 @@ var DefaultStreamTextResult = class {
9714
9756
  const self = this;
9715
9757
  const callId = generateCallId();
9716
9758
  (async () => {
9717
- var _a24;
9759
+ var _a25;
9718
9760
  const initialPrompt = await standardizePrompt({
9719
9761
  instructions,
9720
9762
  system,
@@ -9750,14 +9792,14 @@ var DefaultStreamTextResult = class {
9750
9792
  runtimeContext,
9751
9793
  toolsContext
9752
9794
  };
9753
- const streamTextTracingChannelContext = (_a24 = telemetryDispatcher.startTracingChannelContext) == null ? void 0 : _a24.call(telemetryDispatcher, {
9795
+ const streamTextTracingChannelContext = (_a25 = telemetryDispatcher.startTracingChannelContext) == null ? void 0 : _a25.call(telemetryDispatcher, {
9754
9796
  type: "streamText",
9755
9797
  event: startEvent,
9756
9798
  completion: self._totalUsage.promise.then(() => void 0)
9757
9799
  });
9758
9800
  const runInStreamTextTracingChannelContext = (execute) => {
9759
- var _a25;
9760
- return (_a25 = streamTextTracingChannelContext == null ? void 0 : streamTextTracingChannelContext.run(execute)) != null ? _a25 : execute();
9801
+ var _a26;
9802
+ return (_a26 = streamTextTracingChannelContext == null ? void 0 : streamTextTracingChannelContext.run(execute)) != null ? _a26 : execute();
9761
9803
  };
9762
9804
  const runInTracingChannelSpanInStreamText = telemetryDispatcher.runInTracingChannelSpan == null ? void 0 : (options) => runInStreamTextTracingChannelContext(
9763
9805
  () => telemetryDispatcher.runInTracingChannelSpan(options)
@@ -9914,7 +9956,7 @@ var DefaultStreamTextResult = class {
9914
9956
  currentStep,
9915
9957
  usage
9916
9958
  }) {
9917
- var _a25, _b24, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
9959
+ var _a26, _b25, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
9918
9960
  const stepTimeoutId = setAbortTimeout({
9919
9961
  abortController: stepAbortController,
9920
9962
  label: "Step",
@@ -9973,14 +10015,14 @@ var DefaultStreamTextResult = class {
9973
10015
  });
9974
10016
  try {
9975
10017
  stepFinish = new DelayedPromise();
9976
- const stepTracingChannelContext = (_a25 = telemetryDispatcher.startTracingChannelContext) == null ? void 0 : _a25.call(telemetryDispatcher, {
10018
+ const stepTracingChannelContext = (_a26 = telemetryDispatcher.startTracingChannelContext) == null ? void 0 : _a26.call(telemetryDispatcher, {
9977
10019
  type: "step",
9978
10020
  event: { callId, stepNumber: currentStep },
9979
10021
  completion: stepFinish.promise
9980
10022
  });
9981
10023
  const runInStepTracingChannelContext = (execute) => {
9982
- var _a26;
9983
- return (_a26 = stepTracingChannelContext == null ? void 0 : stepTracingChannelContext.run(execute)) != null ? _a26 : execute();
10024
+ var _a27;
10025
+ return (_a27 = stepTracingChannelContext == null ? void 0 : stepTracingChannelContext.run(execute)) != null ? _a27 : execute();
9984
10026
  };
9985
10027
  const responseMessagesFromPreviousSteps = recordedSteps.flatMap(
9986
10028
  (step) => step.response.messages
@@ -10006,7 +10048,7 @@ var DefaultStreamTextResult = class {
10006
10048
  runtimeContext,
10007
10049
  experimental_sandbox: sandbox
10008
10050
  }));
10009
- const stepSandbox = (_b24 = prepareStepResult == null ? void 0 : prepareStepResult.experimental_sandbox) != null ? _b24 : sandbox;
10051
+ const stepSandbox = (_b25 = prepareStepResult == null ? void 0 : prepareStepResult.experimental_sandbox) != null ? _b25 : sandbox;
10010
10052
  runtimeContext = (_c = prepareStepResult == null ? void 0 : prepareStepResult.runtimeContext) != null ? _c : runtimeContext;
10011
10053
  toolsContext = (_d = prepareStepResult == null ? void 0 : prepareStepResult.toolsContext) != null ? _d : toolsContext;
10012
10054
  const stepModel = resolveLanguageModel(
@@ -10055,12 +10097,12 @@ var DefaultStreamTextResult = class {
10055
10097
  } = await runInStepTracingChannelContext(
10056
10098
  () => retry(
10057
10099
  async () => {
10058
- var _a26, _b25;
10100
+ var _a27, _b26;
10059
10101
  return streamLanguageModelCall({
10060
- model: (_a26 = prepareStepResult == null ? void 0 : prepareStepResult.model) != null ? _a26 : model,
10102
+ model: (_a27 = prepareStepResult == null ? void 0 : prepareStepResult.model) != null ? _a27 : model,
10061
10103
  tools: stepModelTools,
10062
10104
  toolOrder: stepToolOrder,
10063
- toolChoice: (_b25 = prepareStepResult == null ? void 0 : prepareStepResult.toolChoice) != null ? _b25 : toolChoice,
10105
+ toolChoice: (_b26 = prepareStepResult == null ? void 0 : prepareStepResult.toolChoice) != null ? _b26 : toolChoice,
10064
10106
  instructions: stepInstructions,
10065
10107
  messages: stepMessages,
10066
10108
  allowSystemInMessages,
@@ -10085,7 +10127,7 @@ var DefaultStreamTextResult = class {
10085
10127
  telemetryDispatcher.onLanguageModelCallEnd
10086
10128
  ),
10087
10129
  onStart: async ({ promptMessages }) => {
10088
- var _a27, _b26;
10130
+ var _a28, _b27;
10089
10131
  await notify({
10090
10132
  event: {
10091
10133
  callId,
@@ -10095,8 +10137,8 @@ var DefaultStreamTextResult = class {
10095
10137
  instructions: stepInstructions,
10096
10138
  messages: stepMessages,
10097
10139
  tools,
10098
- toolChoice: (_a27 = prepareStepResult == null ? void 0 : prepareStepResult.toolChoice) != null ? _a27 : toolChoice,
10099
- activeTools: (_b26 = prepareStepResult == null ? void 0 : prepareStepResult.activeTools) != null ? _b26 : activeTools,
10140
+ toolChoice: (_a28 = prepareStepResult == null ? void 0 : prepareStepResult.toolChoice) != null ? _a28 : toolChoice,
10141
+ activeTools: (_b27 = prepareStepResult == null ? void 0 : prepareStepResult.activeTools) != null ? _b27 : activeTools,
10100
10142
  toolOrder: stepToolOrder,
10101
10143
  steps: [...recordedSteps],
10102
10144
  providerOptions: stepProviderOptions,
@@ -10193,7 +10235,7 @@ var DefaultStreamTextResult = class {
10193
10235
  streamWithToolResults.pipeThrough(
10194
10236
  new TransformStream({
10195
10237
  async transform(chunk, controller) {
10196
- var _a26, _b25, _c2, _d2, _e2, _f2, _g2;
10238
+ var _a27, _b26, _c2, _d2, _e2, _f2, _g2;
10197
10239
  if (chunk.type === "model-call-start") {
10198
10240
  warnings = chunk.warnings;
10199
10241
  return;
@@ -10236,7 +10278,7 @@ var DefaultStreamTextResult = class {
10236
10278
  if (chunk.text.length > 0 || chunk.providerMetadata != null) {
10237
10279
  controller.enqueue({
10238
10280
  ...chunk,
10239
- id: (_a26 = textPartIds.get(chunk.id)) != null ? _a26 : chunk.id
10281
+ id: (_a27 = textPartIds.get(chunk.id)) != null ? _a27 : chunk.id
10240
10282
  });
10241
10283
  }
10242
10284
  break;
@@ -10244,7 +10286,7 @@ var DefaultStreamTextResult = class {
10244
10286
  case "text-end": {
10245
10287
  controller.enqueue({
10246
10288
  ...chunk,
10247
- id: (_b25 = textPartIds.get(chunk.id)) != null ? _b25 : chunk.id
10289
+ id: (_b26 = textPartIds.get(chunk.id)) != null ? _b26 : chunk.id
10248
10290
  });
10249
10291
  textPartIds.delete(chunk.id);
10250
10292
  break;
@@ -10448,8 +10490,8 @@ var DefaultStreamTextResult = class {
10448
10490
  )
10449
10491
  );
10450
10492
  })().catch(async (error) => {
10451
- var _a24;
10452
- await ((_a24 = telemetryDispatcher.onError) == null ? void 0 : _a24.call(telemetryDispatcher, { callId, error }));
10493
+ var _a25;
10494
+ await ((_a25 = telemetryDispatcher.onError) == null ? void 0 : _a25.call(telemetryDispatcher, { callId, error }));
10453
10495
  self._initialResponseMessages.reject(error);
10454
10496
  markPromiseAsHandled(self._initialResponseMessages.promise);
10455
10497
  self.addStream(
@@ -10475,8 +10517,8 @@ var DefaultStreamTextResult = class {
10475
10517
  }
10476
10518
  get warnings() {
10477
10519
  return this.steps.then((steps) => steps.flatMap((step) => {
10478
- var _a24;
10479
- return (_a24 = step.warnings) != null ? _a24 : [];
10520
+ var _a25;
10521
+ return (_a25 = step.warnings) != null ? _a25 : [];
10480
10522
  }));
10481
10523
  }
10482
10524
  get providerMetadata() {
@@ -10605,19 +10647,19 @@ var DefaultStreamTextResult = class {
10605
10647
  }
10606
10648
  }
10607
10649
  async consumeStream(options) {
10608
- var _a24;
10650
+ var _a25;
10609
10651
  try {
10610
10652
  await consumeStream({
10611
10653
  stream: this.stream,
10612
10654
  onError: (error) => {
10613
- var _a25;
10655
+ var _a26;
10614
10656
  this.rejectResultPromises(error);
10615
- (_a25 = options == null ? void 0 : options.onError) == null ? void 0 : _a25.call(options, error);
10657
+ (_a26 = options == null ? void 0 : options.onError) == null ? void 0 : _a26.call(options, error);
10616
10658
  }
10617
10659
  });
10618
10660
  } catch (error) {
10619
10661
  this.rejectResultPromises(error);
10620
- (_a24 = options == null ? void 0 : options.onError) == null ? void 0 : _a24.call(options, error);
10662
+ (_a25 = options == null ? void 0 : options.onError) == null ? void 0 : _a25.call(options, error);
10621
10663
  }
10622
10664
  }
10623
10665
  get experimental_partialOutputStream() {
@@ -10637,11 +10679,11 @@ var DefaultStreamTextResult = class {
10637
10679
  );
10638
10680
  }
10639
10681
  get elementStream() {
10640
- var _a24, _b24, _c;
10641
- const transform = (_a24 = this.outputSpecification) == null ? void 0 : _a24.createElementStreamTransform();
10682
+ var _a25, _b25, _c;
10683
+ const transform = (_a25 = this.outputSpecification) == null ? void 0 : _a25.createElementStreamTransform();
10642
10684
  if (transform == null) {
10643
10685
  throw new UnsupportedFunctionalityError2({
10644
- functionality: `element streams in ${(_c = (_b24 = this.outputSpecification) == null ? void 0 : _b24.name) != null ? _c : "text"} mode`
10686
+ functionality: `element streams in ${(_c = (_b25 = this.outputSpecification) == null ? void 0 : _b25.name) != null ? _c : "text"} mode`
10645
10687
  });
10646
10688
  }
10647
10689
  return createAsyncIterableStream(this.teeStream().pipeThrough(transform));
@@ -10649,8 +10691,8 @@ var DefaultStreamTextResult = class {
10649
10691
  getOutputPromise() {
10650
10692
  if (this.outputPromise == null) {
10651
10693
  this.outputPromise = this.finalStep.then((step) => {
10652
- var _a24;
10653
- const output = (_a24 = this.outputSpecification) != null ? _a24 : text();
10694
+ var _a25;
10695
+ const output = (_a25 = this.outputSpecification) != null ? _a25 : text();
10654
10696
  return output.parseCompleteOutput(
10655
10697
  { text: step.text },
10656
10698
  {
@@ -10786,7 +10828,7 @@ var ToolLoopAgent = class {
10786
10828
  return this.settings.tools;
10787
10829
  }
10788
10830
  async prepareCall(options) {
10789
- var _a24, _b24, _c, _d;
10831
+ var _a25, _b25, _c, _d;
10790
10832
  if (this.settings.callOptionsSchema != null && options.options !== void 0) {
10791
10833
  const validatedOptions = await validateTypes3({
10792
10834
  value: options.options,
@@ -10810,11 +10852,11 @@ var ToolLoopAgent = class {
10810
10852
  } = this.settings;
10811
10853
  const baseCallArgs = {
10812
10854
  ...settingsWithoutCallbacks,
10813
- stopWhen: (_a24 = this.settings.stopWhen) != null ? _a24 : isStepCount(20),
10855
+ stopWhen: (_a25 = this.settings.stopWhen) != null ? _a25 : isStepCount(20),
10814
10856
  ...options
10815
10857
  };
10816
- const preparedCallArgs = (_d = await ((_c = (_b24 = this.settings).prepareCall) == null ? void 0 : _c.call(
10817
- _b24,
10858
+ const preparedCallArgs = (_d = await ((_c = (_b25 = this.settings).prepareCall) == null ? void 0 : _c.call(
10859
+ _b25,
10818
10860
  baseCallArgs
10819
10861
  ))) != null ? _d : baseCallArgs;
10820
10862
  const {
@@ -10849,9 +10891,9 @@ var ToolLoopAgent = class {
10849
10891
  * downstream by generateText/streamText and the provider.
10850
10892
  */
10851
10893
  agentHeaders(preparedCall) {
10852
- var _a24;
10894
+ var _a25;
10853
10895
  return withUserAgentSuffix3(
10854
- (_a24 = preparedCall.headers) != null ? _a24 : {},
10896
+ (_a25 = preparedCall.headers) != null ? _a25 : {},
10855
10897
  "ai-sdk-agent/tool-loop"
10856
10898
  );
10857
10899
  }
@@ -10874,7 +10916,7 @@ var ToolLoopAgent = class {
10874
10916
  onEnd = onFinish,
10875
10917
  ...options
10876
10918
  }) {
10877
- var _a24, _b24, _c;
10919
+ var _a25, _b25, _c;
10878
10920
  const generate = generateText;
10879
10921
  const preparedCall = await this.prepareCall({
10880
10922
  ...options,
@@ -10885,11 +10927,11 @@ var ToolLoopAgent = class {
10885
10927
  timeout: timeout != null ? timeout : preparedCall.timeout,
10886
10928
  experimental_sandbox: sandbox,
10887
10929
  onStart: mergeCallbacks(
10888
- (_a24 = this.settings.onStart) != null ? _a24 : this.settings.experimental_onStart,
10930
+ (_a25 = this.settings.onStart) != null ? _a25 : this.settings.experimental_onStart,
10889
10931
  onStart != null ? onStart : experimental_onStart
10890
10932
  ),
10891
10933
  onStepStart: mergeCallbacks(
10892
- (_b24 = this.settings.onStepStart) != null ? _b24 : this.settings.experimental_onStepStart,
10934
+ (_b25 = this.settings.onStepStart) != null ? _b25 : this.settings.experimental_onStepStart,
10893
10935
  onStepStart != null ? onStepStart : experimental_onStepStart
10894
10936
  ),
10895
10937
  onToolExecutionStart: mergeCallbacks(
@@ -10932,7 +10974,7 @@ var ToolLoopAgent = class {
10932
10974
  onEnd = onFinish,
10933
10975
  ...options
10934
10976
  }) {
10935
- var _a24, _b24, _c;
10977
+ var _a25, _b25, _c;
10936
10978
  const stream = streamText;
10937
10979
  const preparedCall = await this.prepareCall({
10938
10980
  ...options,
@@ -10944,11 +10986,11 @@ var ToolLoopAgent = class {
10944
10986
  experimental_sandbox: sandbox,
10945
10987
  experimental_transform,
10946
10988
  onStart: mergeCallbacks(
10947
- (_a24 = this.settings.onStart) != null ? _a24 : this.settings.experimental_onStart,
10989
+ (_a25 = this.settings.onStart) != null ? _a25 : this.settings.experimental_onStart,
10948
10990
  onStart != null ? onStart : experimental_onStart
10949
10991
  ),
10950
10992
  onStepStart: mergeCallbacks(
10951
- (_b24 = this.settings.onStepStart) != null ? _b24 : this.settings.experimental_onStepStart,
10993
+ (_b25 = this.settings.onStepStart) != null ? _b25 : this.settings.experimental_onStepStart,
10952
10994
  onStepStart != null ? onStepStart : experimental_onStepStart
10953
10995
  ),
10954
10996
  onToolExecutionStart: mergeCallbacks(
@@ -11115,7 +11157,7 @@ function readUIMessageStream({
11115
11157
  onError,
11116
11158
  terminateOnError = false
11117
11159
  }) {
11118
- var _a24;
11160
+ var _a25;
11119
11161
  let controller;
11120
11162
  let hasErrored = false;
11121
11163
  const outputStream = new ReadableStream({
@@ -11124,7 +11166,7 @@ function readUIMessageStream({
11124
11166
  }
11125
11167
  });
11126
11168
  const state = createStreamingUIMessageState({
11127
- messageId: (_a24 = message == null ? void 0 : message.id) != null ? _a24 : "",
11169
+ messageId: (_a25 = message == null ? void 0 : message.id) != null ? _a25 : "",
11128
11170
  lastMessage: message
11129
11171
  });
11130
11172
  const handleError = (error) => {
@@ -11193,7 +11235,7 @@ async function convertToModelMessages(messages, options) {
11193
11235
  modelMessages.push({
11194
11236
  role: "user",
11195
11237
  content: message.parts.map((part) => {
11196
- var _a24;
11238
+ var _a25;
11197
11239
  if (isTextUIPart(part)) {
11198
11240
  return {
11199
11241
  type: "text",
@@ -11214,7 +11256,7 @@ async function convertToModelMessages(messages, options) {
11214
11256
  };
11215
11257
  }
11216
11258
  if (isDataUIPart(part)) {
11217
- return (_a24 = options == null ? void 0 : options.convertDataPart) == null ? void 0 : _a24.call(
11259
+ return (_a25 = options == null ? void 0 : options.convertDataPart) == null ? void 0 : _a25.call(
11218
11260
  options,
11219
11261
  part
11220
11262
  );
@@ -11227,7 +11269,7 @@ async function convertToModelMessages(messages, options) {
11227
11269
  if (message.parts != null) {
11228
11270
  let block = [];
11229
11271
  async function processBlock() {
11230
- var _a24, _b24, _c, _d, _e, _f, _g;
11272
+ var _a25, _b25, _c, _d, _e, _f, _g;
11231
11273
  if (block.length === 0) {
11232
11274
  return;
11233
11275
  }
@@ -11276,7 +11318,7 @@ async function convertToModelMessages(messages, options) {
11276
11318
  type: "tool-call",
11277
11319
  toolCallId: part.toolCallId,
11278
11320
  toolName,
11279
- input: part.state === "output-error" ? (_a24 = part.input) != null ? _a24 : "rawInput" in part ? part.rawInput : void 0 : part.input,
11321
+ input: part.state === "output-error" ? (_a25 = part.input) != null ? _a25 : "rawInput" in part ? part.rawInput : void 0 : part.input,
11280
11322
  providerExecuted: part.providerExecuted,
11281
11323
  ...part.callProviderMetadata != null ? { providerOptions: part.callProviderMetadata } : {}
11282
11324
  });
@@ -11291,7 +11333,7 @@ async function convertToModelMessages(messages, options) {
11291
11333
  });
11292
11334
  }
11293
11335
  if (part.providerExecuted === true && part.state !== "approval-responded" && (part.state === "output-available" || part.state === "output-error")) {
11294
- const resultProviderMetadata = (_b24 = part.resultProviderMetadata) != null ? _b24 : part.callProviderMetadata;
11336
+ const resultProviderMetadata = (_b25 = part.resultProviderMetadata) != null ? _b25 : part.callProviderMetadata;
11295
11337
  content.push({
11296
11338
  type: "tool-result",
11297
11339
  toolCallId: part.toolCallId,
@@ -11328,8 +11370,8 @@ async function convertToModelMessages(messages, options) {
11328
11370
  }
11329
11371
  const toolParts = block.filter(
11330
11372
  (part) => {
11331
- var _a25;
11332
- return isToolUIPart(part) && (part.providerExecuted !== true || ((_a25 = part.approval) == null ? void 0 : _a25.approved) != null);
11373
+ var _a26;
11374
+ return isToolUIPart(part) && (part.providerExecuted !== true || ((_a26 = part.approval) == null ? void 0 : _a26.approved) != null);
11333
11375
  }
11334
11376
  );
11335
11377
  if (toolParts.length > 0) {
@@ -11992,7 +12034,7 @@ async function createAgentUIStream({
11992
12034
  onStepFinish,
11993
12035
  ...uiMessageStreamOptions
11994
12036
  }) {
11995
- var _a24;
12037
+ var _a25;
11996
12038
  const validatedMessages = await validateUIMessagesForAgent({
11997
12039
  messages: uiMessages,
11998
12040
  // tools are compatible; the casting is required because the context param is
@@ -12011,7 +12053,7 @@ async function createAgentUIStream({
12011
12053
  experimental_transform,
12012
12054
  onStepEnd: onStepEnd != null ? onStepEnd : onStepFinish
12013
12055
  });
12014
- const originalMessages = (_a24 = uiMessageStreamOptions.originalMessages) != null ? _a24 : validatedMessages;
12056
+ const originalMessages = (_a25 = uiMessageStreamOptions.originalMessages) != null ? _a25 : validatedMessages;
12015
12057
  return createAsyncIterableStream(
12016
12058
  toUIMessageStream({
12017
12059
  ...uiMessageStreamOptions,
@@ -12066,6 +12108,10 @@ import { withUserAgentSuffix as withUserAgentSuffix4 } from "@ai-sdk/provider-ut
12066
12108
  async function startTextBatch({
12067
12109
  model: modelArg,
12068
12110
  requests,
12111
+ tools,
12112
+ toolChoice,
12113
+ toolOrder,
12114
+ toolsContext,
12069
12115
  providerOptions,
12070
12116
  webhookUrl,
12071
12117
  abortSignal,
@@ -12079,6 +12125,12 @@ async function startTextBatch({
12079
12125
  getTotalTimeoutMs(timeout)
12080
12126
  );
12081
12127
  const supportedUrls = await model.supportedUrls;
12128
+ const preparedTools = await prepareTools({
12129
+ tools,
12130
+ toolOrder,
12131
+ toolsContext
12132
+ });
12133
+ const preparedToolChoice = prepareToolChoice({ toolChoice });
12082
12134
  operationAbortSignal == null ? void 0 : operationAbortSignal.throwIfAborted();
12083
12135
  const normalizedRequests = [];
12084
12136
  for (const request of requests) {
@@ -12093,6 +12145,8 @@ async function startTextBatch({
12093
12145
  download: void 0,
12094
12146
  provider: model.provider.split(".")[0]
12095
12147
  }),
12148
+ tools: preparedTools,
12149
+ toolChoice: preparedToolChoice,
12096
12150
  providerOptions: request.providerOptions
12097
12151
  }
12098
12152
  });
@@ -12165,6 +12219,7 @@ async function getBatchStatus({
12165
12219
  function getBatchResults({
12166
12220
  model: modelArg,
12167
12221
  batch,
12222
+ tools,
12168
12223
  providerOptions,
12169
12224
  maxRetries,
12170
12225
  abortSignal,
@@ -12185,7 +12240,7 @@ function getBatchResults({
12185
12240
  });
12186
12241
  const transformer = {
12187
12242
  async transform(item, controller) {
12188
- controller.enqueue(await convertBatchItemResult(item));
12243
+ controller.enqueue(await convertBatchItemResult({ item, tools }));
12189
12244
  },
12190
12245
  cancel(reason) {
12191
12246
  streamAbortController.abort(
@@ -12274,25 +12329,31 @@ function validateBatchReference({
12274
12329
  });
12275
12330
  }
12276
12331
  }
12277
- async function convertBatchItemResult(item) {
12332
+ async function convertBatchItemResult({
12333
+ item,
12334
+ tools
12335
+ }) {
12278
12336
  if (item.status !== "succeeded") {
12279
12337
  return item;
12280
12338
  }
12281
12339
  return {
12282
12340
  id: item.id,
12283
12341
  status: "succeeded",
12284
- ...await convertGenerateResult(item.result)
12342
+ ...await convertGenerateResult({ result: item.result, tools })
12285
12343
  };
12286
12344
  }
12287
- async function convertGenerateResult(result) {
12288
- var _a24;
12345
+ async function convertGenerateResult({
12346
+ result,
12347
+ tools
12348
+ }) {
12349
+ var _a25;
12289
12350
  const toolCalls = await Promise.all(
12290
12351
  result.content.filter(
12291
12352
  (part) => part.type === "tool-call"
12292
12353
  ).map(
12293
12354
  (toolCall) => parseToolCall({
12294
12355
  toolCall,
12295
- tools: void 0,
12356
+ tools,
12296
12357
  repairToolCall: void 0,
12297
12358
  refineToolInput: void 0,
12298
12359
  instructions: void 0,
@@ -12306,11 +12367,11 @@ async function convertGenerateResult(result) {
12306
12367
  toolOutputs: [],
12307
12368
  toolApprovalRequests: [],
12308
12369
  toolApprovalResponses: [],
12309
- tools: void 0
12370
+ tools
12310
12371
  });
12311
12372
  return {
12312
12373
  content,
12313
- text: content.filter(
12374
+ text: result.content.filter(
12314
12375
  (part) => part.type === "text"
12315
12376
  ).map((part) => part.text).join(""),
12316
12377
  finishReason: result.finishReason.unified,
@@ -12319,7 +12380,7 @@ async function convertGenerateResult(result) {
12319
12380
  ...result.response != null ? {
12320
12381
  response: {
12321
12382
  id: result.response.id,
12322
- timestamp: (_a24 = result.response.timestamp) == null ? void 0 : _a24.toISOString(),
12383
+ timestamp: (_a25 = result.response.timestamp) == null ? void 0 : _a25.toISOString(),
12323
12384
  modelId: result.response.modelId
12324
12385
  }
12325
12386
  } : {},
@@ -12351,7 +12412,7 @@ async function embed({
12351
12412
  experimental_onEnd,
12352
12413
  _internal: { generateCallId = originalGenerateCallId4 } = {}
12353
12414
  }) {
12354
- var _a24;
12415
+ var _a25;
12355
12416
  const model = resolveEmbeddingModel(modelArg);
12356
12417
  const { maxRetries, retry } = prepareRetries({
12357
12418
  maxRetries: maxRetriesArg,
@@ -12367,7 +12428,7 @@ async function embed({
12367
12428
  const telemetryDispatcher = createTelemetryDispatcher({
12368
12429
  telemetry
12369
12430
  });
12370
- const runInTracingChannelSpan = (_a24 = telemetryDispatcher.runInTracingChannelSpan) != null ? _a24 : (async ({ execute }) => await execute());
12431
+ const runInTracingChannelSpan = (_a25 = telemetryDispatcher.runInTracingChannelSpan) != null ? _a25 : (async ({ execute }) => await execute());
12371
12432
  const startEvent = {
12372
12433
  callId,
12373
12434
  operationId: "ai.embed",
@@ -12382,14 +12443,14 @@ async function embed({
12382
12443
  type: "embed",
12383
12444
  event: startEvent,
12384
12445
  execute: async () => {
12385
- var _a25;
12446
+ var _a26;
12386
12447
  await notify({
12387
12448
  event: startEvent,
12388
12449
  callbacks: [resolvedOnStart, telemetryDispatcher.onStart]
12389
12450
  });
12390
12451
  try {
12391
12452
  const { embedding, usage, warnings, response, providerMetadata } = await retry(async () => {
12392
- var _a26, _b24;
12453
+ var _a27, _b25;
12393
12454
  const embedCallId = generateCallId();
12394
12455
  await notify({
12395
12456
  event: {
@@ -12409,7 +12470,7 @@ async function embed({
12409
12470
  providerOptions
12410
12471
  });
12411
12472
  const embedding2 = modelResponse.embeddings[0];
12412
- const usage2 = (_a26 = modelResponse.usage) != null ? _a26 : { tokens: NaN };
12473
+ const usage2 = (_a27 = modelResponse.usage) != null ? _a27 : { tokens: NaN };
12413
12474
  await notify({
12414
12475
  event: {
12415
12476
  callId,
@@ -12426,7 +12487,7 @@ async function embed({
12426
12487
  return {
12427
12488
  embedding: embedding2,
12428
12489
  usage: usage2,
12429
- warnings: (_b24 = modelResponse.warnings) != null ? _b24 : [],
12490
+ warnings: (_b25 = modelResponse.warnings) != null ? _b25 : [],
12430
12491
  providerMetadata: modelResponse.providerMetadata,
12431
12492
  response: modelResponse.response
12432
12493
  };
@@ -12460,7 +12521,7 @@ async function embed({
12460
12521
  response
12461
12522
  });
12462
12523
  } catch (error) {
12463
- await ((_a25 = telemetryDispatcher.onError) == null ? void 0 : _a25.call(telemetryDispatcher, { callId, error }));
12524
+ await ((_a26 = telemetryDispatcher.onError) == null ? void 0 : _a26.call(telemetryDispatcher, { callId, error }));
12464
12525
  throw error;
12465
12526
  }
12466
12527
  }
@@ -12522,7 +12583,7 @@ async function embedMany({
12522
12583
  experimental_onEnd,
12523
12584
  _internal: { generateCallId = originalGenerateCallId5 } = {}
12524
12585
  }) {
12525
- var _a24;
12586
+ var _a25;
12526
12587
  const model = resolveEmbeddingModel(modelArg);
12527
12588
  const { maxRetries, retry } = prepareRetries({
12528
12589
  maxRetries: maxRetriesArg,
@@ -12538,7 +12599,7 @@ async function embedMany({
12538
12599
  const telemetryDispatcher = createTelemetryDispatcher({
12539
12600
  telemetry
12540
12601
  });
12541
- const runInTracingChannelSpan = (_a24 = telemetryDispatcher.runInTracingChannelSpan) != null ? _a24 : (async ({ execute }) => await execute());
12602
+ const runInTracingChannelSpan = (_a25 = telemetryDispatcher.runInTracingChannelSpan) != null ? _a25 : (async ({ execute }) => await execute());
12542
12603
  const startEvent = {
12543
12604
  callId,
12544
12605
  operationId: "ai.embedMany",
@@ -12553,7 +12614,7 @@ async function embedMany({
12553
12614
  type: "embedMany",
12554
12615
  event: startEvent,
12555
12616
  execute: async () => {
12556
- var _a25, _b24;
12617
+ var _a26, _b25;
12557
12618
  await notify({
12558
12619
  event: startEvent,
12559
12620
  callbacks: [resolvedOnStart, telemetryDispatcher.onStart]
@@ -12572,7 +12633,7 @@ async function embedMany({
12572
12633
  const hasInputByteLimit = maxInputBytesPerCall != null && maxInputBytesPerCall !== Infinity;
12573
12634
  if (!hasEmbeddingLimit && !hasInputByteLimit) {
12574
12635
  const { embeddings: embeddings2, usage, warnings: warnings2, response, providerMetadata: providerMetadata2 } = await retry(async () => {
12575
- var _a26, _b25;
12636
+ var _a27, _b26;
12576
12637
  const embedCallId = generateCallId();
12577
12638
  await notify({
12578
12639
  event: {
@@ -12592,7 +12653,7 @@ async function embedMany({
12592
12653
  providerOptions
12593
12654
  });
12594
12655
  const embeddings3 = modelResponse.embeddings;
12595
- const usage2 = (_a26 = modelResponse.usage) != null ? _a26 : { tokens: NaN };
12656
+ const usage2 = (_a27 = modelResponse.usage) != null ? _a27 : { tokens: NaN };
12596
12657
  await notify({
12597
12658
  event: {
12598
12659
  callId,
@@ -12609,7 +12670,7 @@ async function embedMany({
12609
12670
  return {
12610
12671
  embeddings: embeddings3,
12611
12672
  usage: usage2,
12612
- warnings: (_b25 = modelResponse.warnings) != null ? _b25 : [],
12673
+ warnings: (_b26 = modelResponse.warnings) != null ? _b26 : [],
12613
12674
  providerMetadata: modelResponse.providerMetadata,
12614
12675
  response: modelResponse.response
12615
12676
  };
@@ -12661,7 +12722,7 @@ async function embedMany({
12661
12722
  const results = await Promise.all(
12662
12723
  parallelChunk.map((chunk) => {
12663
12724
  return retry(async () => {
12664
- var _a26, _b25;
12725
+ var _a27, _b26;
12665
12726
  const embedCallId = generateCallId();
12666
12727
  await notify({
12667
12728
  event: {
@@ -12681,7 +12742,7 @@ async function embedMany({
12681
12742
  providerOptions
12682
12743
  });
12683
12744
  const chunkEmbeddings = modelResponse.embeddings;
12684
- const usage = (_a26 = modelResponse.usage) != null ? _a26 : { tokens: NaN };
12745
+ const usage = (_a27 = modelResponse.usage) != null ? _a27 : { tokens: NaN };
12685
12746
  await notify({
12686
12747
  event: {
12687
12748
  callId,
@@ -12698,7 +12759,7 @@ async function embedMany({
12698
12759
  return {
12699
12760
  embeddings: chunkEmbeddings,
12700
12761
  usage,
12701
- warnings: (_b25 = modelResponse.warnings) != null ? _b25 : [],
12762
+ warnings: (_b26 = modelResponse.warnings) != null ? _b26 : [],
12702
12763
  providerMetadata: modelResponse.providerMetadata,
12703
12764
  response: modelResponse.response
12704
12765
  };
@@ -12718,7 +12779,7 @@ async function embedMany({
12718
12779
  result.providerMetadata
12719
12780
  )) {
12720
12781
  providerMetadata[providerName] = {
12721
- ...(_a25 = providerMetadata[providerName]) != null ? _a25 : {},
12782
+ ...(_a26 = providerMetadata[providerName]) != null ? _a26 : {},
12722
12783
  ...metadata
12723
12784
  };
12724
12785
  }
@@ -12755,7 +12816,7 @@ async function embedMany({
12755
12816
  responses
12756
12817
  });
12757
12818
  } catch (error) {
12758
- await ((_b24 = telemetryDispatcher.onError) == null ? void 0 : _b24.call(telemetryDispatcher, { callId, error }));
12819
+ await ((_b25 = telemetryDispatcher.onError) == null ? void 0 : _b25.call(telemetryDispatcher, { callId, error }));
12759
12820
  throw error;
12760
12821
  }
12761
12822
  }
@@ -12871,7 +12932,7 @@ async function generateImage({
12871
12932
  abortSignal,
12872
12933
  headers
12873
12934
  }) {
12874
- var _a24, _b24;
12935
+ var _a25, _b25;
12875
12936
  const model = resolveImageModel(modelArg);
12876
12937
  const headersWithUserAgent = withUserAgentSuffix7(
12877
12938
  headers != null ? headers : {},
@@ -12881,7 +12942,7 @@ async function generateImage({
12881
12942
  maxRetries: maxRetriesArg,
12882
12943
  abortSignal
12883
12944
  });
12884
- const maxImagesPerCallWithDefault = (_a24 = maxImagesPerCall != null ? maxImagesPerCall : await invokeModelMaxImagesPerCall(model)) != null ? _a24 : 1;
12945
+ const maxImagesPerCallWithDefault = (_a25 = maxImagesPerCall != null ? maxImagesPerCall : await invokeModelMaxImagesPerCall(model)) != null ? _a25 : 1;
12885
12946
  const callCount = Math.ceil(n / maxImagesPerCallWithDefault);
12886
12947
  const callImageCounts = Array.from({ length: callCount }, (_, i) => {
12887
12948
  if (i < callCount - 1) {
@@ -12922,13 +12983,13 @@ async function generateImage({
12922
12983
  for (const result of results) {
12923
12984
  const callImages = result.images.map(
12924
12985
  (image, index) => {
12925
- var _a25;
12986
+ var _a26;
12926
12987
  return new DefaultGeneratedFile({
12927
12988
  data: image,
12928
- mediaType: (_a25 = detectMediaType2({
12989
+ mediaType: (_a26 = detectMediaType2({
12929
12990
  data: image,
12930
12991
  topLevelType: "image"
12931
- })) != null ? _a25 : "image/png",
12992
+ })) != null ? _a26 : "image/png",
12932
12993
  providerMetadata: getImageProviderMetadata(
12933
12994
  result.providerMetadata,
12934
12995
  index
@@ -12980,7 +13041,7 @@ async function generateImage({
12980
13041
  delete providerMetadata[providerName].images;
12981
13042
  }
12982
13043
  } else {
12983
- (_b24 = providerMetadata[providerName]) != null ? _b24 : providerMetadata[providerName] = { images: [] };
13044
+ (_b25 = providerMetadata[providerName]) != null ? _b25 : providerMetadata[providerName] = { images: [] };
12984
13045
  providerMetadata[providerName].images.push(...metadata.images);
12985
13046
  }
12986
13047
  }
@@ -13014,13 +13075,13 @@ var DefaultGenerateImageResult = class {
13014
13075
  }
13015
13076
  };
13016
13077
  function getImageProviderMetadata(providerMetadata, imageIndex) {
13017
- var _a24;
13078
+ var _a25;
13018
13079
  if (providerMetadata == null) {
13019
13080
  return void 0;
13020
13081
  }
13021
13082
  let imageMetadata;
13022
13083
  for (const [providerName, metadata] of Object.entries(providerMetadata)) {
13023
- const value = (_a24 = metadata.images) == null ? void 0 : _a24[imageIndex];
13084
+ const value = (_a25 = metadata.images) == null ? void 0 : _a25[imageIndex];
13024
13085
  if (isJSONObject(value) && !Array.isArray(value)) {
13025
13086
  (imageMetadata != null ? imageMetadata : imageMetadata = {})[providerName] = value;
13026
13087
  }
@@ -13204,7 +13265,7 @@ var arrayOutputStrategy = (schema) => {
13204
13265
  isFirstDelta,
13205
13266
  isFinalDelta
13206
13267
  }) {
13207
- var _a24;
13268
+ var _a25;
13208
13269
  if (!isJSONObject2(value) || !isJSONArray(value.elements)) {
13209
13270
  return {
13210
13271
  success: false,
@@ -13227,7 +13288,7 @@ var arrayOutputStrategy = (schema) => {
13227
13288
  }
13228
13289
  resultArray.push(result.value);
13229
13290
  }
13230
- const publishedElementCount = (_a24 = latestObject == null ? void 0 : latestObject.length) != null ? _a24 : 0;
13291
+ const publishedElementCount = (_a25 = latestObject == null ? void 0 : latestObject.length) != null ? _a25 : 0;
13231
13292
  let textDelta = "";
13232
13293
  if (isFirstDelta) {
13233
13294
  textDelta += "[";
@@ -13571,7 +13632,7 @@ function validateObjectGenerationInput({
13571
13632
  // src/generate-object/generate-object.ts
13572
13633
  var originalGenerateId4 = createIdGenerator6({ prefix: "aiobj", size: 24 });
13573
13634
  async function generateObject(options) {
13574
- var _a24, _b24, _c, _d, _e, _f, _g, _h, _i, _j;
13635
+ var _a25, _b25, _c, _d, _e, _f, _g, _h, _i, _j;
13575
13636
  const {
13576
13637
  model: modelArg,
13577
13638
  output = "object",
@@ -13706,7 +13767,7 @@ async function generateObject(options) {
13706
13767
  })
13707
13768
  );
13708
13769
  const responseData = {
13709
- id: (_b24 = (_a24 = generateResult.response) == null ? void 0 : _a24.id) != null ? _b24 : generateId4(),
13770
+ id: (_b25 = (_a25 = generateResult.response) == null ? void 0 : _a25.id) != null ? _b25 : generateId4(),
13710
13771
  timestamp: (_d = (_c = generateResult.response) == null ? void 0 : _c.timestamp) != null ? _d : currentDate(),
13711
13772
  modelId: (_f = (_e = generateResult.response) == null ? void 0 : _e.modelId) != null ? _f : model.modelId,
13712
13773
  headers: (_g = generateResult.response) == null ? void 0 : _g.headers,
@@ -13804,9 +13865,9 @@ var DefaultGenerateObjectResult = class {
13804
13865
  this.reasoning = options.reasoning;
13805
13866
  }
13806
13867
  toJsonResponse(init) {
13807
- var _a24;
13868
+ var _a25;
13808
13869
  return new Response(JSON.stringify(this.object), {
13809
- status: (_a24 = init == null ? void 0 : init.status) != null ? _a24 : 200,
13870
+ status: (_a25 = init == null ? void 0 : init.status) != null ? _a25 : 200,
13810
13871
  headers: prepareHeaders(init == null ? void 0 : init.headers, {
13811
13872
  "content-type": "application/json; charset=utf-8"
13812
13873
  })
@@ -13932,8 +13993,8 @@ function simulateReadableStream({
13932
13993
  chunkDelayInMs = 0,
13933
13994
  _internal
13934
13995
  }) {
13935
- var _a24;
13936
- const delay = (_a24 = _internal == null ? void 0 : _internal.delay) != null ? _a24 : delayFunction;
13996
+ var _a25;
13997
+ const delay = (_a25 = _internal == null ? void 0 : _internal.delay) != null ? _a25 : delayFunction;
13937
13998
  let index = 0;
13938
13999
  return new ReadableStream({
13939
14000
  async pull(controller) {
@@ -14203,7 +14264,7 @@ var DefaultStreamObjectResult = class {
14203
14264
  const transformedStream = stream.pipeThrough(new TransformStream(transformer)).pipeThrough(
14204
14265
  new TransformStream({
14205
14266
  async transform(chunk, controller) {
14206
- var _a24, _b24, _c;
14267
+ var _a25, _b25, _c;
14207
14268
  if (typeof chunk === "object" && chunk.type === "stream-start") {
14208
14269
  warnings = chunk.warnings;
14209
14270
  return;
@@ -14247,8 +14308,8 @@ var DefaultStreamObjectResult = class {
14247
14308
  switch (chunk.type) {
14248
14309
  case "response-metadata": {
14249
14310
  fullResponse = {
14250
- id: (_a24 = chunk.id) != null ? _a24 : fullResponse.id,
14251
- timestamp: (_b24 = chunk.timestamp) != null ? _b24 : fullResponse.timestamp,
14311
+ id: (_a25 = chunk.id) != null ? _a25 : fullResponse.id,
14312
+ timestamp: (_b25 = chunk.timestamp) != null ? _b25 : fullResponse.timestamp,
14252
14313
  modelId: (_c = chunk.modelId) != null ? _c : fullResponse.modelId
14253
14314
  };
14254
14315
  break;
@@ -14383,9 +14444,9 @@ var DefaultStreamObjectResult = class {
14383
14444
  }
14384
14445
  });
14385
14446
  })().catch(async (error) => {
14386
- var _a24;
14447
+ var _a25;
14387
14448
  self.rejectResultPromises(error);
14388
- await ((_a24 = telemetryDispatcher.onError) == null ? void 0 : _a24.call(telemetryDispatcher, { callId, error }));
14449
+ await ((_a25 = telemetryDispatcher.onError) == null ? void 0 : _a25.call(telemetryDispatcher, { callId, error }));
14389
14450
  stitchableStream.addStream(
14390
14451
  new ReadableStream({
14391
14452
  start(controller) {
@@ -14550,7 +14611,7 @@ async function generateSpeech({
14550
14611
  abortSignal,
14551
14612
  headers
14552
14613
  }) {
14553
- var _a24;
14614
+ var _a25;
14554
14615
  const resolvedModel = resolveSpeechModel(model);
14555
14616
  if (!resolvedModel) {
14556
14617
  throw new Error("Model could not be resolved");
@@ -14587,10 +14648,10 @@ async function generateSpeech({
14587
14648
  return new DefaultSpeechResult({
14588
14649
  audio: new DefaultGeneratedAudioFile({
14589
14650
  data: result.audio,
14590
- mediaType: (_a24 = detectMediaType3({
14651
+ mediaType: (_a25 = detectMediaType3({
14591
14652
  data: result.audio,
14592
14653
  topLevelType: "audio"
14593
- })) != null ? _a24 : "audio/mp3"
14654
+ })) != null ? _a25 : "audio/mp3"
14594
14655
  }),
14595
14656
  warnings: result.warnings,
14596
14657
  responses: [result.response],
@@ -14599,11 +14660,11 @@ async function generateSpeech({
14599
14660
  }
14600
14661
  var DefaultSpeechResult = class {
14601
14662
  constructor(options) {
14602
- var _a24;
14663
+ var _a25;
14603
14664
  this.audio = options.audio;
14604
14665
  this.warnings = options.warnings;
14605
14666
  this.responses = options.responses;
14606
- this.providerMetadata = (_a24 = options.providerMetadata) != null ? _a24 : {};
14667
+ this.providerMetadata = (_a25 = options.providerMetadata) != null ? _a25 : {};
14607
14668
  }
14608
14669
  };
14609
14670
 
@@ -14826,14 +14887,14 @@ function tagDescription(description) {
14826
14887
  }
14827
14888
  async function fingerprintTools(tools) {
14828
14889
  const entries = await Promise.all(
14829
- Object.keys(tools).map(async (name24) => {
14830
- const tool2 = tools[name24];
14890
+ Object.keys(tools).map(async (name25) => {
14891
+ const tool2 = tools[name25];
14831
14892
  const digest = await hashCanonical({
14832
14893
  description: tagDescription(tool2.description),
14833
14894
  inputSchema: await asSchema6(tool2.inputSchema).jsonSchema,
14834
14895
  title: tool2.title
14835
14896
  });
14836
- return [name24, digest];
14897
+ return [name25, digest];
14837
14898
  })
14838
14899
  );
14839
14900
  return Object.fromEntries(entries);
@@ -14842,16 +14903,16 @@ function detectToolDrift(current, baseline) {
14842
14903
  const added = [];
14843
14904
  const removed = [];
14844
14905
  const changed = [];
14845
- for (const name24 of Object.keys(current)) {
14846
- if (!Object.hasOwn(baseline, name24)) {
14847
- added.push(name24);
14848
- } else if (current[name24] !== baseline[name24]) {
14849
- changed.push(name24);
14906
+ for (const name25 of Object.keys(current)) {
14907
+ if (!Object.hasOwn(baseline, name25)) {
14908
+ added.push(name25);
14909
+ } else if (current[name25] !== baseline[name25]) {
14910
+ changed.push(name25);
14850
14911
  }
14851
14912
  }
14852
- for (const name24 of Object.keys(baseline)) {
14853
- if (!Object.hasOwn(current, name24)) {
14854
- removed.push(name24);
14913
+ for (const name25 of Object.keys(baseline)) {
14914
+ if (!Object.hasOwn(current, name25)) {
14915
+ removed.push(name25);
14855
14916
  }
14856
14917
  }
14857
14918
  return { added, removed, changed };
@@ -14887,7 +14948,7 @@ async function experimental_generateVideo({
14887
14948
  poll,
14888
14949
  webhook
14889
14950
  }) {
14890
- var _a24;
14951
+ var _a25;
14891
14952
  const model = resolveVideoModel(modelArg);
14892
14953
  const headersWithUserAgent = withUserAgentSuffix10(
14893
14954
  headers != null ? headers : {},
@@ -14904,7 +14965,7 @@ async function experimental_generateVideo({
14904
14965
  effectiveInputReferences,
14905
14966
  warnings
14906
14967
  } = normalizeVideoCallInputs({ promptArg, frameImages, inputReferences });
14907
- const maxVideosPerCallWithDefault = (_a24 = maxVideosPerCall != null ? maxVideosPerCall : await invokeModelMaxVideosPerCall(model)) != null ? _a24 : 1;
14968
+ const maxVideosPerCallWithDefault = (_a25 = maxVideosPerCall != null ? maxVideosPerCall : await invokeModelMaxVideosPerCall(model)) != null ? _a25 : 1;
14908
14969
  const hasStartStatus = model.doStart != null && model.doStatus != null;
14909
14970
  const useStartStatus = hasStartStatus && (poll != null || webhook != null || model.doGenerate == null);
14910
14971
  if (model.doGenerate == null && !hasStartStatus) {
@@ -15043,7 +15104,7 @@ async function executeStartStatusFlow({
15043
15104
  webhook: webhookFactory,
15044
15105
  retry
15045
15106
  }) {
15046
- var _a24, _b24, _c, _d;
15107
+ var _a25, _b25, _c, _d;
15047
15108
  const earlyWarnings = [];
15048
15109
  let webhookUrl;
15049
15110
  let webhookReceived;
@@ -15062,7 +15123,7 @@ async function executeStartStatusFlow({
15062
15123
  });
15063
15124
  }
15064
15125
  }
15065
- const callerIdempotencyKey = Object.entries((_a24 = callOptions.headers) != null ? _a24 : {}).find(
15126
+ const callerIdempotencyKey = Object.entries((_a25 = callOptions.headers) != null ? _a25 : {}).find(
15066
15127
  ([key, value]) => key.toLowerCase() === "idempotency-key" && value !== void 0
15067
15128
  );
15068
15129
  const startCallOptions = {
@@ -15076,7 +15137,7 @@ async function executeStartStatusFlow({
15076
15137
  const startResult = await retry(() => model.doStart(startCallOptions));
15077
15138
  const allWarnings = [...earlyWarnings, ...startResult.warnings];
15078
15139
  let operationProviderMetadata = startResult.providerMetadata == null ? void 0 : { ...startResult.providerMetadata };
15079
- const intervalMs = (_b24 = pollConfig == null ? void 0 : pollConfig.intervalMs) != null ? _b24 : 5e3;
15140
+ const intervalMs = (_b25 = pollConfig == null ? void 0 : pollConfig.intervalMs) != null ? _b25 : 5e3;
15080
15141
  const timeoutMs = (_c = pollConfig == null ? void 0 : pollConfig.timeoutMs) != null ? _c : 6e5;
15081
15142
  const delay = (_d = pollConfig == null ? void 0 : pollConfig.delay) != null ? _d : defaultDelay;
15082
15143
  const startTime = Date.now();
@@ -15192,7 +15253,7 @@ function normalizeVideoCallInputs({
15192
15253
  frameImages,
15193
15254
  inputReferences
15194
15255
  }) {
15195
- var _a24;
15256
+ var _a25;
15196
15257
  const { prompt, image } = normalizePrompt2(promptArg);
15197
15258
  const normalizedFrameImages = frameImages == null ? void 0 : frameImages.flatMap((frame) => {
15198
15259
  const normalizedImage = normalizeImageData(frame.image);
@@ -15210,9 +15271,9 @@ function normalizeVideoCallInputs({
15210
15271
  message: "inputReferences were ignored because frameImages were provided; frameImages and inputReferences cannot be combined."
15211
15272
  });
15212
15273
  }
15213
- const firstFrameImage = (_a24 = normalizedFrameImages == null ? void 0 : normalizedFrameImages.find(
15274
+ const firstFrameImage = (_a25 = normalizedFrameImages == null ? void 0 : normalizedFrameImages.find(
15214
15275
  (frame) => frame.frameType === "first_frame"
15215
- )) == null ? void 0 : _a24.image;
15276
+ )) == null ? void 0 : _a25.image;
15216
15277
  if (image != null && firstFrameImage != null) {
15217
15278
  warnings.push({
15218
15279
  type: "other",
@@ -15458,8 +15519,8 @@ function stripMarkdownCodeFenceSuffix(text2) {
15458
15519
  return text2.replace(/\n?```\s*$/, "").trimEnd();
15459
15520
  }
15460
15521
  function extractJsonMiddleware(options) {
15461
- var _a24;
15462
- const transform = (_a24 = options == null ? void 0 : options.transform) != null ? _a24 : defaultTransform;
15522
+ var _a25;
15523
+ const transform = (_a25 = options == null ? void 0 : options.transform) != null ? _a25 : defaultTransform;
15463
15524
  const hasCustomTransform = (options == null ? void 0 : options.transform) !== void 0;
15464
15525
  return {
15465
15526
  specificationVersion: "v4",
@@ -15835,13 +15896,13 @@ function addToolInputExamplesMiddleware({
15835
15896
  return {
15836
15897
  specificationVersion: "v4",
15837
15898
  transformParams: async ({ params }) => {
15838
- var _a24;
15839
- if (!((_a24 = params.tools) == null ? void 0 : _a24.length)) {
15899
+ var _a25;
15900
+ if (!((_a25 = params.tools) == null ? void 0 : _a25.length)) {
15840
15901
  return params;
15841
15902
  }
15842
15903
  const transformedTools = params.tools.map((tool2) => {
15843
- var _a25;
15844
- if (tool2.type !== "function" || !((_a25 = tool2.inputExamples) == null ? void 0 : _a25.length)) {
15904
+ var _a26;
15905
+ if (tool2.type !== "function" || !((_a26 = tool2.inputExamples) == null ? void 0 : _a26.length)) {
15845
15906
  return tool2;
15846
15907
  }
15847
15908
  const formattedExamples = tool2.inputExamples.map((example, index) => format(example, index)).join("\n");
@@ -15890,7 +15951,7 @@ var doWrap = ({
15890
15951
  modelId,
15891
15952
  providerId
15892
15953
  }) => {
15893
- var _a24, _b24, _c;
15954
+ var _a25, _b25, _c;
15894
15955
  async function doTransform({
15895
15956
  params,
15896
15957
  type
@@ -15899,8 +15960,8 @@ var doWrap = ({
15899
15960
  }
15900
15961
  return {
15901
15962
  specificationVersion: "v4",
15902
- provider: (_a24 = providerId != null ? providerId : overrideProvider == null ? void 0 : overrideProvider({ model })) != null ? _a24 : model.provider,
15903
- modelId: (_b24 = modelId != null ? modelId : overrideModelId == null ? void 0 : overrideModelId({ model })) != null ? _b24 : model.modelId,
15963
+ provider: (_a25 = providerId != null ? providerId : overrideProvider == null ? void 0 : overrideProvider({ model })) != null ? _a25 : model.provider,
15964
+ modelId: (_b25 = modelId != null ? modelId : overrideModelId == null ? void 0 : overrideModelId({ model })) != null ? _b25 : model.modelId,
15904
15965
  supportedUrls: (_c = overrideSupportedUrls == null ? void 0 : overrideSupportedUrls({ model })) != null ? _c : model.supportedUrls,
15905
15966
  async doGenerate(params) {
15906
15967
  const transformedParams = await doTransform({ params, type: "generate" });
@@ -15956,7 +16017,7 @@ var doWrap2 = ({
15956
16017
  modelId,
15957
16018
  providerId
15958
16019
  }) => {
15959
- var _a24, _b24, _c, _d;
16020
+ var _a25, _b25, _c, _d;
15960
16021
  async function doTransform({
15961
16022
  params
15962
16023
  }) {
@@ -15964,8 +16025,8 @@ var doWrap2 = ({
15964
16025
  }
15965
16026
  return {
15966
16027
  specificationVersion: "v4",
15967
- provider: (_a24 = providerId != null ? providerId : overrideProvider == null ? void 0 : overrideProvider({ model })) != null ? _a24 : model.provider,
15968
- modelId: (_b24 = modelId != null ? modelId : overrideModelId == null ? void 0 : overrideModelId({ model })) != null ? _b24 : model.modelId,
16028
+ provider: (_a25 = providerId != null ? providerId : overrideProvider == null ? void 0 : overrideProvider({ model })) != null ? _a25 : model.provider,
16029
+ modelId: (_b25 = modelId != null ? modelId : overrideModelId == null ? void 0 : overrideModelId({ model })) != null ? _b25 : model.modelId,
15969
16030
  maxEmbeddingsPerCall: (_c = overrideMaxEmbeddingsPerCall == null ? void 0 : overrideMaxEmbeddingsPerCall({ model })) != null ? _c : model.maxEmbeddingsPerCall,
15970
16031
  [EXPERIMENTAL_EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL2]: getEmbeddingModelMaxInputBytesPerCall(model),
15971
16032
  supportsParallelCalls: (_d = overrideSupportsParallelCalls == null ? void 0 : overrideSupportsParallelCalls({ model })) != null ? _d : model.supportsParallelCalls,
@@ -16006,15 +16067,15 @@ var doWrap3 = ({
16006
16067
  modelId,
16007
16068
  providerId
16008
16069
  }) => {
16009
- var _a24, _b24, _c;
16070
+ var _a25, _b25, _c;
16010
16071
  async function doTransform({ params }) {
16011
16072
  return transformParams ? await transformParams({ params, model }) : params;
16012
16073
  }
16013
- const maxImagesPerCallRaw = (_a24 = overrideMaxImagesPerCall == null ? void 0 : overrideMaxImagesPerCall({ model })) != null ? _a24 : model.maxImagesPerCall;
16074
+ const maxImagesPerCallRaw = (_a25 = overrideMaxImagesPerCall == null ? void 0 : overrideMaxImagesPerCall({ model })) != null ? _a25 : model.maxImagesPerCall;
16014
16075
  const maxImagesPerCall = maxImagesPerCallRaw instanceof Function ? maxImagesPerCallRaw.bind(model) : maxImagesPerCallRaw;
16015
16076
  return {
16016
16077
  specificationVersion: "v4",
16017
- provider: (_b24 = providerId != null ? providerId : overrideProvider == null ? void 0 : overrideProvider({ model })) != null ? _b24 : model.provider,
16078
+ provider: (_b25 = providerId != null ? providerId : overrideProvider == null ? void 0 : overrideProvider({ model })) != null ? _b25 : model.provider,
16018
16079
  modelId: (_c = modelId != null ? modelId : overrideModelId == null ? void 0 : overrideModelId({ model })) != null ? _c : model.modelId,
16019
16080
  maxImagesPerCall,
16020
16081
  async doGenerate(params) {
@@ -16112,7 +16173,7 @@ async function getRealtimeToolDefinitions({
16112
16173
  toolsContext = {}
16113
16174
  }) {
16114
16175
  const definitions = [];
16115
- for (const [name24, tool2] of Object.entries(tools)) {
16176
+ for (const [name25, tool2] of Object.entries(tools)) {
16116
16177
  const toolType = tool2.type;
16117
16178
  switch (toolType) {
16118
16179
  case void 0:
@@ -16120,12 +16181,12 @@ async function getRealtimeToolDefinitions({
16120
16181
  case "dynamic": {
16121
16182
  const description = resolveRealtimeToolDescription({
16122
16183
  tool: tool2,
16123
- toolName: name24,
16184
+ toolName: name25,
16124
16185
  toolsContext
16125
16186
  });
16126
16187
  definitions.push({
16127
16188
  type: "function",
16128
- name: name24,
16189
+ name: name25,
16129
16190
  description,
16130
16191
  parameters: await asSchema7(tool2.inputSchema).jsonSchema
16131
16192
  });
@@ -16199,9 +16260,9 @@ var BrowserRealtimeAudio = class {
16199
16260
  this.onCapturingChange(true);
16200
16261
  }
16201
16262
  stopCapture() {
16202
- var _a24, _b24, _c, _d;
16203
- (_a24 = this.captureProcessor) == null ? void 0 : _a24.disconnect();
16204
- (_b24 = this.captureSource) == null ? void 0 : _b24.disconnect();
16263
+ var _a25, _b25, _c, _d;
16264
+ (_a25 = this.captureProcessor) == null ? void 0 : _a25.disconnect();
16265
+ (_b25 = this.captureSource) == null ? void 0 : _b25.disconnect();
16205
16266
  void ((_c = this.captureContext) == null ? void 0 : _c.close());
16206
16267
  (_d = this.captureStream) == null ? void 0 : _d.getTracks().forEach((track) => track.stop());
16207
16268
  this.captureProcessor = null;
@@ -16235,16 +16296,16 @@ var BrowserRealtimeAudio = class {
16235
16296
  return (ctx.currentTime - this.playbackStartTime) * 1e3;
16236
16297
  }
16237
16298
  dispose() {
16238
- var _a24;
16299
+ var _a25;
16239
16300
  this.stopCapture();
16240
16301
  this.stopPlayback();
16241
- void ((_a24 = this.playbackContext) == null ? void 0 : _a24.close());
16302
+ void ((_a25 = this.playbackContext) == null ? void 0 : _a25.close());
16242
16303
  this.playbackContext = null;
16243
16304
  }
16244
16305
  setPlaying(isPlaying) {
16245
- var _a24, _b24;
16306
+ var _a25, _b25;
16246
16307
  if (isPlaying && !this.isPlaying) {
16247
- this.playbackStartTime = (_b24 = (_a24 = this.playbackContext) == null ? void 0 : _a24.currentTime) != null ? _b24 : 0;
16308
+ this.playbackStartTime = (_b25 = (_a25 = this.playbackContext) == null ? void 0 : _a25.currentTime) != null ? _b25 : 0;
16248
16309
  }
16249
16310
  if (this.isPlaying !== isPlaying) {
16250
16311
  this.isPlaying = isPlaying;
@@ -16296,8 +16357,8 @@ var BrowserRealtimeTransport = class {
16296
16357
  url,
16297
16358
  onOpen
16298
16359
  }) {
16299
- var _a24;
16300
- (_a24 = this.ws) == null ? void 0 : _a24.close();
16360
+ var _a25;
16361
+ (_a25 = this.ws) == null ? void 0 : _a25.close();
16301
16362
  this.ws = null;
16302
16363
  const wsConfig = this.model.getWebSocketConfig({ token, url });
16303
16364
  const ws = new WebSocket(wsConfig.url, wsConfig.protocols);
@@ -16320,8 +16381,8 @@ var BrowserRealtimeTransport = class {
16320
16381
  };
16321
16382
  }
16322
16383
  disconnect() {
16323
- var _a24;
16324
- (_a24 = this.ws) == null ? void 0 : _a24.close();
16384
+ var _a25;
16385
+ (_a25 = this.ws) == null ? void 0 : _a25.close();
16325
16386
  this.ws = null;
16326
16387
  }
16327
16388
  sendEvent(event) {
@@ -16337,8 +16398,8 @@ var BrowserRealtimeTransport = class {
16337
16398
  });
16338
16399
  }
16339
16400
  sendRaw(data) {
16340
- var _a24;
16341
- if (((_a24 = this.ws) == null ? void 0 : _a24.readyState) === WebSocket.OPEN) {
16401
+ var _a25;
16402
+ if (((_a25 = this.ws) == null ? void 0 : _a25.readyState) === WebSocket.OPEN) {
16342
16403
  if (typeof data === "string" || data instanceof ArrayBuffer || ArrayBuffer.isView(data) || data instanceof Blob) {
16343
16404
  this.ws.send(data);
16344
16405
  } else {
@@ -16430,7 +16491,7 @@ var RealtimeEventReducer = class {
16430
16491
  };
16431
16492
  }
16432
16493
  async reduceServerEvent(state, event) {
16433
- var _a24;
16494
+ var _a25;
16434
16495
  let nextState = this.pushEvent(state, event);
16435
16496
  const effects = [];
16436
16497
  switch (event.type) {
@@ -16497,7 +16558,7 @@ var RealtimeEventReducer = class {
16497
16558
  const { state: updatedState, messageId } = this.getOrCreateAssistantMessage(nextState);
16498
16559
  nextState = updatedState;
16499
16560
  this.toolCallIdToMessageId.set(event.callId, messageId);
16500
- const acc = (_a24 = this.toolArgAccumulators.get(event.callId)) != null ? _a24 : "";
16561
+ const acc = (_a25 = this.toolArgAccumulators.get(event.callId)) != null ? _a25 : "";
16501
16562
  this.toolArgAccumulators.set(event.callId, acc + event.delta);
16502
16563
  nextState = this.ensureToolPart(nextState, messageId, event.callId);
16503
16564
  break;
@@ -16571,7 +16632,7 @@ var RealtimeEventReducer = class {
16571
16632
  };
16572
16633
  }
16573
16634
  addInputTranscriptionMessage(state, itemId, transcript) {
16574
- var _a24;
16635
+ var _a25;
16575
16636
  const messageId = `user-${itemId}`;
16576
16637
  const existingMessage = state.messages.find(
16577
16638
  (message) => message.id === messageId
@@ -16594,7 +16655,7 @@ var RealtimeEventReducer = class {
16594
16655
  };
16595
16656
  }
16596
16657
  const insertIndex = Math.min(
16597
- (_a24 = this.inputAudioMessageInsertIndex.get(itemId)) != null ? _a24 : state.messages.length,
16658
+ (_a25 = this.inputAudioMessageInsertIndex.get(itemId)) != null ? _a25 : state.messages.length,
16598
16659
  state.messages.length
16599
16660
  );
16600
16661
  const messages = [...state.messages];
@@ -16615,9 +16676,9 @@ var RealtimeEventReducer = class {
16615
16676
  };
16616
16677
  }
16617
16678
  appendTextDelta(state, itemId, delta) {
16618
- var _a24;
16679
+ var _a25;
16619
16680
  const { state: stateWithMessage, messageId } = this.getOrCreateAssistantMessage(state);
16620
- const acc = (_a24 = this.textAccumulators.get(itemId)) != null ? _a24 : "";
16681
+ const acc = (_a25 = this.textAccumulators.get(itemId)) != null ? _a25 : "";
16621
16682
  const text2 = acc + delta;
16622
16683
  this.textAccumulators.set(itemId, text2);
16623
16684
  const location = this.itemIdToPartLocation.get(itemId);
@@ -16646,8 +16707,8 @@ var RealtimeEventReducer = class {
16646
16707
  };
16647
16708
  }
16648
16709
  finalizeText(state, itemId, finalText) {
16649
- var _a24;
16650
- const text2 = (_a24 = finalText != null ? finalText : this.textAccumulators.get(itemId)) != null ? _a24 : "";
16710
+ var _a25;
16711
+ const text2 = (_a25 = finalText != null ? finalText : this.textAccumulators.get(itemId)) != null ? _a25 : "";
16651
16712
  this.textAccumulators.delete(itemId);
16652
16713
  const location = this.itemIdToPartLocation.get(itemId);
16653
16714
  if (location == null) return state;
@@ -16684,7 +16745,7 @@ var RealtimeEventReducer = class {
16684
16745
  })
16685
16746
  };
16686
16747
  }
16687
- markToolInputAvailable(state, messageId, callId, name24, input) {
16748
+ markToolInputAvailable(state, messageId, callId, name25, input) {
16688
16749
  return {
16689
16750
  ...state,
16690
16751
  messages: state.messages.map((message) => {
@@ -16697,7 +16758,7 @@ var RealtimeEventReducer = class {
16697
16758
  if (toolPart.toolCallId !== callId) return part;
16698
16759
  return {
16699
16760
  ...toolPart,
16700
- toolName: name24,
16761
+ toolName: name25,
16701
16762
  state: "input-available",
16702
16763
  input
16703
16764
  };
@@ -16754,25 +16815,25 @@ var AbstractRealtimeSession = class {
16754
16815
  this.toolCallsInResponse = /* @__PURE__ */ new Set();
16755
16816
  this.submittedToolOutputs = /* @__PURE__ */ new Set();
16756
16817
  this.responseToolCallsClosed = false;
16757
- var _a24, _b24, _c, _d, _e, _f, _g, _h;
16818
+ var _a25, _b25, _c, _d, _e, _f, _g, _h;
16758
16819
  this.model = options.model;
16759
16820
  this.api = options.api;
16760
16821
  this.sessionConfig = options.sessionConfig;
16761
- this.maxEvents = (_a24 = options.maxEvents) != null ? _a24 : 500;
16822
+ this.maxEvents = (_a25 = options.maxEvents) != null ? _a25 : 500;
16762
16823
  this.reducer = new RealtimeEventReducer(this.maxEvents);
16763
16824
  this.onToolCall = options.onToolCall;
16764
16825
  this.onEvent = options.onEvent;
16765
16826
  this.onError = options.onError;
16766
- const sampleRate = (_b24 = options.sampleRate) != null ? _b24 : 24e3;
16827
+ const sampleRate = (_b25 = options.sampleRate) != null ? _b25 : 24e3;
16767
16828
  const captureSampleRate = (_e = (_d = (_c = options.sessionConfig) == null ? void 0 : _c.inputAudioFormat) == null ? void 0 : _d.rate) != null ? _e : sampleRate;
16768
16829
  const playbackSampleRate = (_h = (_g = (_f = options.sessionConfig) == null ? void 0 : _f.outputAudioFormat) == null ? void 0 : _g.rate) != null ? _h : sampleRate;
16769
16830
  this.transport = new BrowserRealtimeTransport({
16770
16831
  model: this.model,
16771
16832
  onServerEvent: (event) => this.handleServerEvent(event),
16772
16833
  onError: (error) => {
16773
- var _a25;
16834
+ var _a26;
16774
16835
  this.applyState(this.reducer.setStatus(this.state, "error"));
16775
- (_a25 = this.onError) == null ? void 0 : _a25.call(this, error);
16836
+ (_a26 = this.onError) == null ? void 0 : _a26.call(this, error);
16776
16837
  },
16777
16838
  onClose: () => {
16778
16839
  this.applyState(this.reducer.setStatus(this.state, "disconnected"));
@@ -16792,7 +16853,7 @@ var AbstractRealtimeSession = class {
16792
16853
  }
16793
16854
  // ── Connection ─────────────────────────────────────────────────────
16794
16855
  async connect() {
16795
- var _a24;
16856
+ var _a25;
16796
16857
  this.applyState(this.reducer.setStatus(this.state, "connecting"));
16797
16858
  try {
16798
16859
  const response = await fetch(this.api.token, {
@@ -16822,7 +16883,7 @@ var AbstractRealtimeSession = class {
16822
16883
  });
16823
16884
  } catch (error) {
16824
16885
  this.applyState(this.reducer.setStatus(this.state, "error"));
16825
- (_a24 = this.onError) == null ? void 0 : _a24.call(
16886
+ (_a25 = this.onError) == null ? void 0 : _a25.call(
16826
16887
  this,
16827
16888
  error instanceof Error ? error : new Error(`Connection failed: ${String(error)}`)
16828
16889
  );
@@ -16945,34 +17006,34 @@ var AbstractRealtimeSession = class {
16945
17006
  }
16946
17007
  }
16947
17008
  async executeToolCall({
16948
- name: name24,
17009
+ name: name25,
16949
17010
  args,
16950
17011
  callId
16951
17012
  }) {
16952
- var _a24, _b24;
17013
+ var _a25, _b25;
16953
17014
  if (this.onToolCall == null) {
16954
- (_a24 = this.onError) == null ? void 0 : _a24.call(this, new Error(`No handler provided for tool "${name24}"`));
17015
+ (_a25 = this.onError) == null ? void 0 : _a25.call(this, new Error(`No handler provided for tool "${name25}"`));
16955
17016
  return;
16956
17017
  }
16957
17018
  try {
16958
17019
  const result = await this.onToolCall({
16959
- toolCall: { toolCallId: callId, toolName: name24, args }
17020
+ toolCall: { toolCallId: callId, toolName: name25, args }
16960
17021
  });
16961
17022
  if (result !== void 0) {
16962
17023
  this.addToolOutput(callId, result);
16963
17024
  }
16964
17025
  } catch (error) {
16965
- (_b24 = this.onError) == null ? void 0 : _b24.call(
17026
+ (_b25 = this.onError) == null ? void 0 : _b25.call(
16966
17027
  this,
16967
17028
  error instanceof Error ? error : new Error(`Client tool execution failed: ${String(error)}`)
16968
17029
  );
16969
17030
  }
16970
17031
  }
16971
17032
  async handleServerEvent(event) {
16972
- var _a24;
17033
+ var _a25;
16973
17034
  const result = await this.reducer.reduceServerEvent(this.state, event);
16974
17035
  this.applyState(result.state);
16975
- (_a24 = this.onEvent) == null ? void 0 : _a24.call(this, event);
17036
+ (_a25 = this.onEvent) == null ? void 0 : _a25.call(this, event);
16976
17037
  for (const effect of result.effects) {
16977
17038
  this.handleReducerEffect(effect);
16978
17039
  }
@@ -16982,7 +17043,7 @@ var AbstractRealtimeSession = class {
16982
17043
  }
16983
17044
  }
16984
17045
  handleReducerEffect(effect) {
16985
- var _a24;
17046
+ var _a25;
16986
17047
  switch (effect.type) {
16987
17048
  case "play-audio": {
16988
17049
  this.currentResponseItemId = effect.itemId;
@@ -17014,7 +17075,7 @@ var AbstractRealtimeSession = class {
17014
17075
  break;
17015
17076
  }
17016
17077
  case "error": {
17017
- (_a24 = this.onError) == null ? void 0 : _a24.call(this, effect.error);
17078
+ (_a25 = this.onError) == null ? void 0 : _a25.call(this, effect.error);
17018
17079
  break;
17019
17080
  }
17020
17081
  }
@@ -17127,12 +17188,12 @@ function customProvider({
17127
17188
  }
17128
17189
 
17129
17190
  // src/registry/no-such-provider-error.ts
17130
- import { AISDKError as AISDKError27, NoSuchModelError as NoSuchModelError3 } from "@ai-sdk/provider";
17131
- var name23 = "AI_NoSuchProviderError";
17132
- var marker23 = `vercel.ai.error.${name23}`;
17133
- var symbol23 = Symbol.for(marker23);
17134
- var _a23, _b23;
17135
- var NoSuchProviderError = class extends (_b23 = NoSuchModelError3, _a23 = symbol23, _b23) {
17191
+ import { AISDKError as AISDKError28, NoSuchModelError as NoSuchModelError3 } from "@ai-sdk/provider";
17192
+ var name24 = "AI_NoSuchProviderError";
17193
+ var marker24 = `vercel.ai.error.${name24}`;
17194
+ var symbol24 = Symbol.for(marker24);
17195
+ var _a24, _b24;
17196
+ var NoSuchProviderError = class extends (_b24 = NoSuchModelError3, _a24 = symbol24, _b24) {
17136
17197
  constructor({
17137
17198
  modelId,
17138
17199
  modelType,
@@ -17140,13 +17201,13 @@ var NoSuchProviderError = class extends (_b23 = NoSuchModelError3, _a23 = symbol
17140
17201
  availableProviders,
17141
17202
  message = `No such provider: ${providerId} (available providers: ${availableProviders.join()})`
17142
17203
  }) {
17143
- super({ errorName: name23, modelId, modelType, message });
17144
- this[_a23] = true;
17204
+ super({ errorName: name24, modelId, modelType, message });
17205
+ this[_a24] = true;
17145
17206
  this.providerId = providerId;
17146
17207
  this.availableProviders = availableProviders;
17147
17208
  }
17148
17209
  static isInstance(error) {
17149
- return AISDKError27.hasMarker(error, marker23);
17210
+ return AISDKError28.hasMarker(error, marker24);
17150
17211
  }
17151
17212
  };
17152
17213
 
@@ -17185,9 +17246,9 @@ var DefaultProviderRegistry = class {
17185
17246
  id,
17186
17247
  provider
17187
17248
  }) {
17188
- var _a24;
17249
+ var _a25;
17189
17250
  const providerV4 = asProviderV4(provider);
17190
- const videoModel = (_a24 = provider.videoModel) == null ? void 0 : _a24.bind(provider);
17251
+ const videoModel = (_a25 = provider.videoModel) == null ? void 0 : _a25.bind(provider);
17191
17252
  this.providers[id] = videoModel == null ? providerV4 : Object.assign(Object.create(Object.getPrototypeOf(providerV4)), {
17192
17253
  ...providerV4,
17193
17254
  videoModel: (modelId) => asVideoModelV4(videoModel(modelId))
@@ -17217,10 +17278,10 @@ var DefaultProviderRegistry = class {
17217
17278
  return [id.slice(0, index), id.slice(index + this.separator.length)];
17218
17279
  }
17219
17280
  languageModel(id) {
17220
- var _a24, _b24;
17281
+ var _a25, _b25;
17221
17282
  const [providerId, modelId] = this.splitId(id, "languageModel");
17222
- let model = (_b24 = (_a24 = this.getProvider(providerId, "languageModel")).languageModel) == null ? void 0 : _b24.call(
17223
- _a24,
17283
+ let model = (_b25 = (_a25 = this.getProvider(providerId, "languageModel")).languageModel) == null ? void 0 : _b25.call(
17284
+ _a25,
17224
17285
  modelId
17225
17286
  );
17226
17287
  if (model == null) {
@@ -17235,10 +17296,10 @@ var DefaultProviderRegistry = class {
17235
17296
  return model;
17236
17297
  }
17237
17298
  embeddingModel(id) {
17238
- var _a24;
17299
+ var _a25;
17239
17300
  const [providerId, modelId] = this.splitId(id, "embeddingModel");
17240
17301
  const provider = this.getProvider(providerId, "embeddingModel");
17241
- const model = (_a24 = provider.embeddingModel) == null ? void 0 : _a24.call(provider, modelId);
17302
+ const model = (_a25 = provider.embeddingModel) == null ? void 0 : _a25.call(provider, modelId);
17242
17303
  if (model == null) {
17243
17304
  throw new NoSuchModelError4({
17244
17305
  modelId: id,
@@ -17248,10 +17309,10 @@ var DefaultProviderRegistry = class {
17248
17309
  return model;
17249
17310
  }
17250
17311
  imageModel(id) {
17251
- var _a24;
17312
+ var _a25;
17252
17313
  const [providerId, modelId] = this.splitId(id, "imageModel");
17253
17314
  const provider = this.getProvider(providerId, "imageModel");
17254
- let model = (_a24 = provider.imageModel) == null ? void 0 : _a24.call(provider, modelId);
17315
+ let model = (_a25 = provider.imageModel) == null ? void 0 : _a25.call(provider, modelId);
17255
17316
  if (model == null) {
17256
17317
  throw new NoSuchModelError4({ modelId: id, modelType: "imageModel" });
17257
17318
  }
@@ -17264,10 +17325,10 @@ var DefaultProviderRegistry = class {
17264
17325
  return model;
17265
17326
  }
17266
17327
  transcriptionModel(id) {
17267
- var _a24;
17328
+ var _a25;
17268
17329
  const [providerId, modelId] = this.splitId(id, "transcriptionModel");
17269
17330
  const provider = this.getProvider(providerId, "transcriptionModel");
17270
- const model = (_a24 = provider.transcriptionModel) == null ? void 0 : _a24.call(provider, modelId);
17331
+ const model = (_a25 = provider.transcriptionModel) == null ? void 0 : _a25.call(provider, modelId);
17271
17332
  if (model == null) {
17272
17333
  throw new NoSuchModelError4({
17273
17334
  modelId: id,
@@ -17277,39 +17338,39 @@ var DefaultProviderRegistry = class {
17277
17338
  return model;
17278
17339
  }
17279
17340
  speechModel(id) {
17280
- var _a24;
17341
+ var _a25;
17281
17342
  const [providerId, modelId] = this.splitId(id, "speechModel");
17282
17343
  const provider = this.getProvider(providerId, "speechModel");
17283
- const model = (_a24 = provider.speechModel) == null ? void 0 : _a24.call(provider, modelId);
17344
+ const model = (_a25 = provider.speechModel) == null ? void 0 : _a25.call(provider, modelId);
17284
17345
  if (model == null) {
17285
17346
  throw new NoSuchModelError4({ modelId: id, modelType: "speechModel" });
17286
17347
  }
17287
17348
  return model;
17288
17349
  }
17289
17350
  rerankingModel(id) {
17290
- var _a24;
17351
+ var _a25;
17291
17352
  const [providerId, modelId] = this.splitId(id, "rerankingModel");
17292
17353
  const provider = this.getProvider(providerId, "rerankingModel");
17293
- const model = (_a24 = provider.rerankingModel) == null ? void 0 : _a24.call(provider, modelId);
17354
+ const model = (_a25 = provider.rerankingModel) == null ? void 0 : _a25.call(provider, modelId);
17294
17355
  if (model == null) {
17295
17356
  throw new NoSuchModelError4({ modelId: id, modelType: "rerankingModel" });
17296
17357
  }
17297
17358
  return model;
17298
17359
  }
17299
17360
  videoModel(id) {
17300
- var _a24;
17361
+ var _a25;
17301
17362
  const [providerId, modelId] = this.splitId(id, "videoModel");
17302
17363
  const provider = this.getProvider(providerId, "videoModel");
17303
- const model = (_a24 = provider.videoModel) == null ? void 0 : _a24.call(provider, modelId);
17364
+ const model = (_a25 = provider.videoModel) == null ? void 0 : _a25.call(provider, modelId);
17304
17365
  if (model == null) {
17305
17366
  throw new NoSuchModelError4({ modelId: id, modelType: "videoModel" });
17306
17367
  }
17307
17368
  return asVideoModelV4(model);
17308
17369
  }
17309
17370
  files(id) {
17310
- var _a24;
17371
+ var _a25;
17311
17372
  const provider = this.getProvider(id, "languageModel");
17312
- const files = (_a24 = provider.files) == null ? void 0 : _a24.call(provider);
17373
+ const files = (_a25 = provider.files) == null ? void 0 : _a25.call(provider);
17313
17374
  if (files == null) {
17314
17375
  throw new Error(
17315
17376
  `The provider "${id}" does not support file uploads. Make sure it exposes a files() method.`
@@ -17318,9 +17379,9 @@ var DefaultProviderRegistry = class {
17318
17379
  return files;
17319
17380
  }
17320
17381
  skills(id) {
17321
- var _a24;
17382
+ var _a25;
17322
17383
  const provider = this.getProvider(id, "languageModel");
17323
- const skills = (_a24 = provider.skills) == null ? void 0 : _a24.call(provider);
17384
+ const skills = (_a25 = provider.skills) == null ? void 0 : _a25.call(provider);
17324
17385
  if (skills == null) {
17325
17386
  throw new Error(
17326
17387
  `The provider "${id}" does not support skills. Make sure it exposes a skills() method.`
@@ -17355,7 +17416,7 @@ async function rerank({
17355
17416
  experimental_onEnd,
17356
17417
  _internal: { generateCallId = originalGenerateCallId6 } = {}
17357
17418
  }) {
17358
- var _a24;
17419
+ var _a25;
17359
17420
  const model = resolveRerankingModel(modelArg);
17360
17421
  const callId = generateCallId();
17361
17422
  const resolvedOnStart = onStart != null ? onStart : experimental_onStart;
@@ -17363,7 +17424,7 @@ async function rerank({
17363
17424
  const telemetryDispatcher = createTelemetryDispatcher({
17364
17425
  telemetry
17365
17426
  });
17366
- const runInTracingChannelSpan = (_a24 = telemetryDispatcher.runInTracingChannelSpan) != null ? _a24 : (async ({ execute }) => await execute());
17427
+ const runInTracingChannelSpan = (_a25 = telemetryDispatcher.runInTracingChannelSpan) != null ? _a25 : (async ({ execute }) => await execute());
17367
17428
  if (documents.length === 0) {
17368
17429
  await notify({
17369
17430
  event: {
@@ -17429,7 +17490,7 @@ async function rerank({
17429
17490
  type: "rerank",
17430
17491
  event: startEvent,
17431
17492
  execute: async () => {
17432
- var _a25, _b24, _c, _d, _e;
17493
+ var _a26, _b25, _c, _d, _e;
17433
17494
  await notify({
17434
17495
  event: startEvent,
17435
17496
  callbacks: [resolvedOnStart, telemetryDispatcher.onStart]
@@ -17500,8 +17561,8 @@ async function rerank({
17500
17561
  providerMetadata,
17501
17562
  response: {
17502
17563
  id: response == null ? void 0 : response.id,
17503
- timestamp: (_a25 = response == null ? void 0 : response.timestamp) != null ? _a25 : /* @__PURE__ */ new Date(),
17504
- modelId: (_b24 = response == null ? void 0 : response.modelId) != null ? _b24 : model.modelId,
17564
+ timestamp: (_a26 = response == null ? void 0 : response.timestamp) != null ? _a26 : /* @__PURE__ */ new Date(),
17565
+ modelId: (_b25 = response == null ? void 0 : response.modelId) != null ? _b25 : model.modelId,
17505
17566
  headers: response == null ? void 0 : response.headers,
17506
17567
  body: response == null ? void 0 : response.body
17507
17568
  }
@@ -17573,16 +17634,16 @@ async function transcribe({
17573
17634
  const audioData = audio instanceof URL ? (await downloadFn({ url: audio, abortSignal })).data : convertDataContentToUint8Array(audio);
17574
17635
  const result = await retry(
17575
17636
  () => {
17576
- var _a24;
17637
+ var _a25;
17577
17638
  return resolvedModel.doGenerate({
17578
17639
  audio: audioData,
17579
17640
  abortSignal,
17580
17641
  headers: headersWithUserAgent,
17581
17642
  providerOptions,
17582
- mediaType: (_a24 = detectMediaType5({
17643
+ mediaType: (_a25 = detectMediaType5({
17583
17644
  data: audioData,
17584
17645
  topLevelType: "audio"
17585
- })) != null ? _a24 : "audio/wav"
17646
+ })) != null ? _a25 : "audio/wav"
17586
17647
  });
17587
17648
  }
17588
17649
  );
@@ -17606,14 +17667,14 @@ async function transcribe({
17606
17667
  }
17607
17668
  var DefaultTranscriptionResult = class {
17608
17669
  constructor(options) {
17609
- var _a24;
17670
+ var _a25;
17610
17671
  this.text = options.text;
17611
17672
  this.segments = options.segments;
17612
17673
  this.language = options.language;
17613
17674
  this.durationInSeconds = options.durationInSeconds;
17614
17675
  this.warnings = options.warnings;
17615
17676
  this.responses = options.responses;
17616
- this.providerMetadata = (_a24 = options.providerMetadata) != null ? _a24 : {};
17677
+ this.providerMetadata = (_a25 = options.providerMetadata) != null ? _a25 : {};
17617
17678
  }
17618
17679
  };
17619
17680
 
@@ -17635,12 +17696,12 @@ function streamTranscribe({
17635
17696
  includeRawChunks,
17636
17697
  _internal: { currentDate = () => /* @__PURE__ */ new Date() } = {}
17637
17698
  }) {
17638
- var _a24;
17699
+ var _a25;
17639
17700
  const resolvedModel = resolveTranscriptionModel(model);
17640
17701
  if (!resolvedModel) {
17641
17702
  throw new Error("Model could not be resolved");
17642
17703
  }
17643
- const doStream = (_a24 = resolvedModel.doStream) == null ? void 0 : _a24.bind(resolvedModel);
17704
+ const doStream = (_a25 = resolvedModel.doStream) == null ? void 0 : _a25.bind(resolvedModel);
17644
17705
  if (doStream == null) {
17645
17706
  throw new UnsupportedFunctionalityError5({
17646
17707
  functionality: "streaming transcription",
@@ -17687,7 +17748,7 @@ function streamTranscribe({
17687
17748
  const pipeAbortController = new AbortController();
17688
17749
  const transformer = {
17689
17750
  transform(value, controller) {
17690
- var _a25, _b24, _c, _d;
17751
+ var _a26, _b25, _c, _d;
17691
17752
  switch (value.type) {
17692
17753
  case "stream-start": {
17693
17754
  resolveWarnings(value.warnings);
@@ -17695,8 +17756,8 @@ function streamTranscribe({
17695
17756
  }
17696
17757
  case "response-metadata": {
17697
17758
  response = {
17698
- timestamp: (_a25 = value.timestamp) != null ? _a25 : currentResponseMetadata().timestamp,
17699
- modelId: (_b24 = value.modelId) != null ? _b24 : currentResponseMetadata().modelId,
17759
+ timestamp: (_a26 = value.timestamp) != null ? _a26 : currentResponseMetadata().timestamp,
17760
+ modelId: (_b25 = value.modelId) != null ? _b25 : currentResponseMetadata().modelId,
17700
17761
  headers: (_c = value.headers) != null ? _c : response == null ? void 0 : response.headers
17701
17762
  };
17702
17763
  break;
@@ -17743,7 +17804,7 @@ function streamTranscribe({
17743
17804
  };
17744
17805
  const transform = new TransformStream(transformer);
17745
17806
  void (async () => {
17746
- var _a25, _b24, _c, _d, _e;
17807
+ var _a26, _b25, _c, _d, _e;
17747
17808
  const result = await doStream({
17748
17809
  audio,
17749
17810
  inputAudioFormat,
@@ -17754,7 +17815,7 @@ function streamTranscribe({
17754
17815
  includeRawChunks
17755
17816
  });
17756
17817
  response = {
17757
- timestamp: (_b24 = (_a25 = result.response) == null ? void 0 : _a25.timestamp) != null ? _b24 : startedAt,
17818
+ timestamp: (_b25 = (_a26 = result.response) == null ? void 0 : _a26.timestamp) != null ? _b25 : startedAt,
17758
17819
  modelId: (_d = (_c = result.response) == null ? void 0 : _c.modelId) != null ? _d : resolvedModel.modelId,
17759
17820
  headers: (_e = result.response) == null ? void 0 : _e.headers
17760
17821
  };
@@ -17890,7 +17951,7 @@ function streamTranslate({
17890
17951
  let hasAudioOutput = false;
17891
17952
  const transformer = {
17892
17953
  transform(value, controller) {
17893
- var _a24, _b24, _c, _d;
17954
+ var _a25, _b25, _c, _d;
17894
17955
  switch (value.type) {
17895
17956
  case "stream-start": {
17896
17957
  resolveWarnings(value.warnings);
@@ -17898,8 +17959,8 @@ function streamTranslate({
17898
17959
  }
17899
17960
  case "response-metadata": {
17900
17961
  response = {
17901
- timestamp: (_a24 = value.timestamp) != null ? _a24 : currentResponseMetadata().timestamp,
17902
- modelId: (_b24 = value.modelId) != null ? _b24 : currentResponseMetadata().modelId,
17962
+ timestamp: (_a25 = value.timestamp) != null ? _a25 : currentResponseMetadata().timestamp,
17963
+ modelId: (_b25 = value.modelId) != null ? _b25 : currentResponseMetadata().modelId,
17903
17964
  headers: (_c = value.headers) != null ? _c : response == null ? void 0 : response.headers
17904
17965
  };
17905
17966
  break;
@@ -17957,7 +18018,7 @@ function streamTranslate({
17957
18018
  };
17958
18019
  const transform = new TransformStream(transformer);
17959
18020
  void (async () => {
17960
- var _a24, _b24, _c, _d, _e;
18021
+ var _a25, _b25, _c, _d, _e;
17961
18022
  const result = await doStream({
17962
18023
  audio,
17963
18024
  inputAudioFormat,
@@ -17971,7 +18032,7 @@ function streamTranslate({
17971
18032
  includeRawChunks
17972
18033
  });
17973
18034
  response = {
17974
- timestamp: (_b24 = (_a24 = result.response) == null ? void 0 : _a24.timestamp) != null ? _b24 : startedAt,
18035
+ timestamp: (_b25 = (_a25 = result.response) == null ? void 0 : _a25.timestamp) != null ? _b25 : startedAt,
17975
18036
  modelId: (_d = (_c = result.response) == null ? void 0 : _c.modelId) != null ? _d : resolvedModel.modelId,
17976
18037
  headers: (_e = result.response) == null ? void 0 : _e.headers
17977
18038
  };
@@ -18082,7 +18143,7 @@ async function callCompletionApi({
18082
18143
  onError,
18083
18144
  fetch: fetch2 = getOriginalFetch()
18084
18145
  }) {
18085
- var _a24;
18146
+ var _a25;
18086
18147
  try {
18087
18148
  setLoading(true);
18088
18149
  setError(void 0);
@@ -18110,7 +18171,7 @@ async function callCompletionApi({
18110
18171
  });
18111
18172
  if (!response.ok) {
18112
18173
  throw new Error(
18113
- (_a24 = await response.text()) != null ? _a24 : "Failed to fetch the chat response."
18174
+ (_a25 = await response.text()) != null ? _a25 : "Failed to fetch the chat response."
18114
18175
  );
18115
18176
  }
18116
18177
  if (!response.body) {
@@ -18196,12 +18257,12 @@ async function convertFileListToFileUIParts(files) {
18196
18257
  }
18197
18258
  return Promise.all(
18198
18259
  Array.from(files).map(async (file) => {
18199
- const { name: name24, type } = file;
18260
+ const { name: name25, type } = file;
18200
18261
  const dataUrl = await new Promise((resolve3, reject) => {
18201
18262
  const reader = new FileReader();
18202
18263
  reader.onload = (readerEvent) => {
18203
- var _a24;
18204
- resolve3((_a24 = readerEvent.target) == null ? void 0 : _a24.result);
18264
+ var _a25;
18265
+ resolve3((_a25 = readerEvent.target) == null ? void 0 : _a25.result);
18205
18266
  };
18206
18267
  reader.onerror = (error) => reject(error);
18207
18268
  reader.readAsDataURL(file);
@@ -18209,7 +18270,7 @@ async function convertFileListToFileUIParts(files) {
18209
18270
  return {
18210
18271
  type: "file",
18211
18272
  mediaType: type,
18212
- filename: name24,
18273
+ filename: name25,
18213
18274
  url: dataUrl
18214
18275
  };
18215
18276
  })
@@ -18246,7 +18307,7 @@ var HttpChatTransport = class {
18246
18307
  abortSignal,
18247
18308
  ...options
18248
18309
  }) {
18249
- var _a24, _b24, _c, _d, _e;
18310
+ var _a25, _b25, _c, _d, _e;
18250
18311
  const resolvedBody = await resolve2(this.body);
18251
18312
  const resolvedHeaders = await resolve2(this.headers);
18252
18313
  const resolvedCredentials = await resolve2(this.credentials);
@@ -18254,7 +18315,7 @@ var HttpChatTransport = class {
18254
18315
  ...normalizeHeaders(resolvedHeaders),
18255
18316
  ...normalizeHeaders(options.headers)
18256
18317
  };
18257
- const preparedRequest = await ((_a24 = this.prepareSendMessagesRequest) == null ? void 0 : _a24.call(this, {
18318
+ const preparedRequest = await ((_a25 = this.prepareSendMessagesRequest) == null ? void 0 : _a25.call(this, {
18258
18319
  api: this.api,
18259
18320
  id: options.chatId,
18260
18321
  messages: options.messages,
@@ -18265,7 +18326,7 @@ var HttpChatTransport = class {
18265
18326
  trigger: options.trigger,
18266
18327
  messageId: options.messageId
18267
18328
  }));
18268
- const api = (_b24 = preparedRequest == null ? void 0 : preparedRequest.api) != null ? _b24 : this.api;
18329
+ const api = (_b25 = preparedRequest == null ? void 0 : preparedRequest.api) != null ? _b25 : this.api;
18269
18330
  const headers = (preparedRequest == null ? void 0 : preparedRequest.headers) !== void 0 ? normalizeHeaders(preparedRequest.headers) : baseHeaders;
18270
18331
  const body = (preparedRequest == null ? void 0 : preparedRequest.body) !== void 0 ? preparedRequest.body : {
18271
18332
  ...resolvedBody,
@@ -18298,7 +18359,7 @@ var HttpChatTransport = class {
18298
18359
  return this.processResponseStream(response.body);
18299
18360
  }
18300
18361
  async reconnectToStream(options) {
18301
- var _a24, _b24, _c, _d, _e;
18362
+ var _a25, _b25, _c, _d, _e;
18302
18363
  const resolvedBody = await resolve2(this.body);
18303
18364
  const resolvedHeaders = await resolve2(this.headers);
18304
18365
  const resolvedCredentials = await resolve2(this.credentials);
@@ -18306,7 +18367,7 @@ var HttpChatTransport = class {
18306
18367
  ...normalizeHeaders(resolvedHeaders),
18307
18368
  ...normalizeHeaders(options.headers)
18308
18369
  };
18309
- const preparedRequest = await ((_a24 = this.prepareReconnectToStreamRequest) == null ? void 0 : _a24.call(this, {
18370
+ const preparedRequest = await ((_a25 = this.prepareReconnectToStreamRequest) == null ? void 0 : _a25.call(this, {
18310
18371
  api: this.api,
18311
18372
  id: options.chatId,
18312
18373
  body: { ...resolvedBody, ...options.body },
@@ -18314,7 +18375,7 @@ var HttpChatTransport = class {
18314
18375
  credentials: resolvedCredentials,
18315
18376
  requestMetadata: options.metadata
18316
18377
  }));
18317
- const api = (_b24 = preparedRequest == null ? void 0 : preparedRequest.api) != null ? _b24 : `${this.api}/${options.chatId}/stream`;
18378
+ const api = (_b25 = preparedRequest == null ? void 0 : preparedRequest.api) != null ? _b25 : `${this.api}/${options.chatId}/stream`;
18318
18379
  const headers = (preparedRequest == null ? void 0 : preparedRequest.headers) !== void 0 ? normalizeHeaders(preparedRequest.headers) : baseHeaders;
18319
18380
  const credentials = (_c = preparedRequest == null ? void 0 : preparedRequest.credentials) != null ? _c : resolvedCredentials;
18320
18381
  const fetch2 = (_d = this.fetch) != null ? _d : globalThis.fetch;
@@ -18387,11 +18448,11 @@ var AbstractChat = class {
18387
18448
  * If a messageId is provided, the message will be replaced.
18388
18449
  */
18389
18450
  this.sendMessage = async (message, options) => {
18390
- var _a24, _b24, _c, _d;
18451
+ var _a25, _b25, _c, _d;
18391
18452
  if (message == null) {
18392
18453
  await this.makeRequest({
18393
18454
  trigger: "submit-message",
18394
- messageId: (_a24 = this.lastMessage) == null ? void 0 : _a24.id,
18455
+ messageId: (_a25 = this.lastMessage) == null ? void 0 : _a25.id,
18395
18456
  ...options
18396
18457
  });
18397
18458
  return;
@@ -18434,7 +18495,7 @@ var AbstractChat = class {
18434
18495
  this.state.replaceMessage(messageIndex, {
18435
18496
  ...uiMessage,
18436
18497
  id: message.messageId,
18437
- role: (_b24 = uiMessage.role) != null ? _b24 : "user",
18498
+ role: (_b25 = uiMessage.role) != null ? _b25 : "user",
18438
18499
  metadata: message.metadata
18439
18500
  });
18440
18501
  } else {
@@ -18511,11 +18572,11 @@ var AbstractChat = class {
18511
18572
  }
18512
18573
  if (this.status !== "streaming" && this.status !== "submitted" && this.sendAutomaticallyWhen) {
18513
18574
  this.shouldSendAutomatically().then((shouldSend) => {
18514
- var _a24;
18575
+ var _a25;
18515
18576
  if (shouldSend) {
18516
18577
  this.makeRequest({
18517
18578
  trigger: "submit-message",
18518
- messageId: (_a24 = this.lastMessage) == null ? void 0 : _a24.id,
18579
+ messageId: (_a25 = this.lastMessage) == null ? void 0 : _a25.id,
18519
18580
  ...options
18520
18581
  });
18521
18582
  }
@@ -18541,11 +18602,11 @@ var AbstractChat = class {
18541
18602
  }
18542
18603
  if (this.status !== "streaming" && this.status !== "submitted" && this.sendAutomaticallyWhen) {
18543
18604
  this.shouldSendAutomatically().then((shouldSend) => {
18544
- var _a24;
18605
+ var _a25;
18545
18606
  if (shouldSend) {
18546
18607
  this.makeRequest({
18547
18608
  trigger: "submit-message",
18548
- messageId: (_a24 = this.lastMessage) == null ? void 0 : _a24.id,
18609
+ messageId: (_a25 = this.lastMessage) == null ? void 0 : _a25.id,
18549
18610
  ...options
18550
18611
  });
18551
18612
  }
@@ -18558,12 +18619,12 @@ var AbstractChat = class {
18558
18619
  * Abort the current request immediately, keep the generated tokens if any.
18559
18620
  */
18560
18621
  this.stop = async () => {
18561
- var _a24, _b24;
18622
+ var _a25, _b25;
18562
18623
  for (const controller of this.pendingMessagePreparations) {
18563
18624
  controller.abort();
18564
18625
  }
18565
- (_a24 = this.activeResumeRequest) == null ? void 0 : _a24.abortController.abort();
18566
- (_b24 = this.activeResponse) == null ? void 0 : _b24.abortController.abort();
18626
+ (_a25 = this.activeResumeRequest) == null ? void 0 : _a25.abortController.abort();
18627
+ (_b25 = this.activeResponse) == null ? void 0 : _b25.abortController.abort();
18567
18628
  };
18568
18629
  this.id = id;
18569
18630
  this.transport = transport;
@@ -18625,11 +18686,11 @@ var AbstractChat = class {
18625
18686
  body,
18626
18687
  messageId
18627
18688
  }) {
18628
- var _a24, _b24, _c;
18689
+ var _a25, _b25, _c;
18629
18690
  const abortController = new AbortController();
18630
18691
  const activeResumeRequest = trigger === "resume-stream" ? { abortController } : void 0;
18631
18692
  if (activeResumeRequest) {
18632
- (_a24 = this.activeResumeRequest) == null ? void 0 : _a24.abortController.abort();
18693
+ (_a25 = this.activeResumeRequest) == null ? void 0 : _a25.abortController.abort();
18633
18694
  this.activeResumeRequest = activeResumeRequest;
18634
18695
  }
18635
18696
  const isCurrentRequest = () => activeResumeRequest == null || this.activeResumeRequest === activeResumeRequest;
@@ -18725,14 +18786,14 @@ var AbstractChat = class {
18725
18786
  return job({
18726
18787
  state: response.state,
18727
18788
  write: ({ updateStatus = true } = {}) => {
18728
- var _a25;
18789
+ var _a26;
18729
18790
  if (response.abortController.signal.aborted) {
18730
18791
  return;
18731
18792
  }
18732
18793
  if (updateStatus) {
18733
18794
  this.setStatus({ status: "streaming" });
18734
18795
  }
18735
- const replaceLastMessage = response.state.message.id === ((_a25 = this.lastMessage) == null ? void 0 : _a25.id);
18796
+ const replaceLastMessage = response.state.message.id === ((_a26 = this.lastMessage) == null ? void 0 : _a26.id);
18736
18797
  if (replaceLastMessage) {
18737
18798
  this.state.replaceMessage(
18738
18799
  this.state.messages.length - 1,
@@ -18793,7 +18854,7 @@ var AbstractChat = class {
18793
18854
  } finally {
18794
18855
  try {
18795
18856
  if (activeResponse) {
18796
- (_b24 = this.onFinish) == null ? void 0 : _b24.call(this, {
18857
+ (_b25 = this.onFinish) == null ? void 0 : _b25.call(this, {
18797
18858
  message: activeResponse.state.message,
18798
18859
  messages: this.state.messages,
18799
18860
  isAbort,
@@ -18956,26 +19017,42 @@ async function uploadFile({
18956
19017
  data: dataArg,
18957
19018
  mediaType: mediaTypeArg,
18958
19019
  filename,
19020
+ abortSignal,
19021
+ headers,
18959
19022
  providerOptions
18960
19023
  }) {
18961
- var _a24;
19024
+ var _a25;
18962
19025
  const data = dataArg instanceof Uint8Array || typeof dataArg === "string" ? { type: "data", data: dataArg } : dataArg;
18963
- const mediaType = mediaTypeArg != null ? mediaTypeArg : data.type === "text" ? "text/plain" : (_a24 = detectMediaType6({ data: data.data })) != null ? _a24 : isLikelyText(data.data) ? "text/plain" : "application/octet-stream";
18964
- const filesApi = "uploadFile" in api ? api : typeof api.files === "function" ? api.files() : (() => {
18965
- throw new Error(
18966
- "The provider does not support file uploads. Make sure it exposes a files() method."
18967
- );
18968
- })();
18969
- const result = await filesApi.uploadFile({
18970
- data,
18971
- mediaType,
18972
- filename,
18973
- providerOptions
18974
- });
19026
+ const mediaType = mediaTypeArg != null ? mediaTypeArg : data.type === "text" ? "text/plain" : data.type === "stream" ? "application/octet-stream" : (_a25 = detectMediaType6({ data: data.data })) != null ? _a25 : isLikelyText(data.data) ? "text/plain" : "application/octet-stream";
19027
+ let result;
19028
+ try {
19029
+ const filesApi = "uploadFile" in api ? api : typeof api.files === "function" ? api.files() : (() => {
19030
+ throw new Error(
19031
+ "The provider does not support file uploads. Make sure it exposes a files() method."
19032
+ );
19033
+ })();
19034
+ result = await filesApi.uploadFile({
19035
+ data,
19036
+ mediaType,
19037
+ filename,
19038
+ abortSignal,
19039
+ headers,
19040
+ providerOptions
19041
+ });
19042
+ } catch (error) {
19043
+ if (data.type === "stream") {
19044
+ await data.stream.cancel(error).catch(() => {
19045
+ });
19046
+ }
19047
+ throw error;
19048
+ }
18975
19049
  return new DefaultUploadFileResult({
18976
19050
  providerReference: result.providerReference,
18977
19051
  mediaType: result.mediaType,
18978
19052
  filename: result.filename,
19053
+ byteSize: result.byteSize,
19054
+ createdAt: result.createdAt,
19055
+ expiresAt: result.expiresAt,
18979
19056
  providerMetadata: result.providerMetadata,
18980
19057
  warnings: result.warnings
18981
19058
  });
@@ -18985,6 +19062,9 @@ var DefaultUploadFileResult = class {
18985
19062
  this.providerReference = options.providerReference;
18986
19063
  this.mediaType = options.mediaType;
18987
19064
  this.filename = options.filename;
19065
+ this.byteSize = options.byteSize;
19066
+ this.createdAt = options.createdAt;
19067
+ this.expiresAt = options.expiresAt;
18988
19068
  this.providerMetadata = options.providerMetadata;
18989
19069
  this.warnings = options.warnings;
18990
19070
  }
@@ -19030,7 +19110,7 @@ async function uploadSkill({
19030
19110
  return result;
19031
19111
  }
19032
19112
  export {
19033
- AISDKError24 as AISDKError,
19113
+ AISDKError25 as AISDKError,
19034
19114
  AI_SDK_TELEMETRY_TRACING_CHANNEL,
19035
19115
  APICallError,
19036
19116
  AbstractChat,
@@ -19077,6 +19157,7 @@ export {
19077
19157
  TooManyEmbeddingValuesForCallError,
19078
19158
  ToolCallNotFoundForApprovalError,
19079
19159
  ToolCallRepairError,
19160
+ ToolChoiceViolationError,
19080
19161
  ToolLoopAgent,
19081
19162
  TypeValidationError,
19082
19163
  UIMessageStreamError,