ai 5.0.44 → 5.0.45

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
@@ -58,7 +58,7 @@ __export(src_exports, {
58
58
  UI_MESSAGE_STREAM_HEADERS: () => UI_MESSAGE_STREAM_HEADERS,
59
59
  UnsupportedFunctionalityError: () => import_provider17.UnsupportedFunctionalityError,
60
60
  UnsupportedModelVersionError: () => UnsupportedModelVersionError,
61
- asSchema: () => import_provider_utils34.asSchema,
61
+ asSchema: () => import_provider_utils35.asSchema,
62
62
  assistantModelMessageSchema: () => assistantModelMessageSchema,
63
63
  callCompletionApi: () => callCompletionApi,
64
64
  consumeStream: () => consumeStream,
@@ -72,14 +72,14 @@ __export(src_exports, {
72
72
  coreUserMessageSchema: () => coreUserMessageSchema,
73
73
  cosineSimilarity: () => cosineSimilarity,
74
74
  createGateway: () => import_gateway3.createGateway,
75
- createIdGenerator: () => import_provider_utils34.createIdGenerator,
75
+ createIdGenerator: () => import_provider_utils35.createIdGenerator,
76
76
  createProviderRegistry: () => createProviderRegistry,
77
77
  createTextStreamResponse: () => createTextStreamResponse,
78
78
  createUIMessageStream: () => createUIMessageStream,
79
79
  createUIMessageStreamResponse: () => createUIMessageStreamResponse,
80
80
  customProvider: () => customProvider,
81
81
  defaultSettingsMiddleware: () => defaultSettingsMiddleware,
82
- dynamicTool: () => import_provider_utils34.dynamicTool,
82
+ dynamicTool: () => import_provider_utils35.dynamicTool,
83
83
  embed: () => embed,
84
84
  embedMany: () => embedMany,
85
85
  experimental_createMCPClient: () => createMCPClient,
@@ -90,7 +90,7 @@ __export(src_exports, {
90
90
  experimental_transcribe: () => transcribe,
91
91
  extractReasoningMiddleware: () => extractReasoningMiddleware,
92
92
  gateway: () => import_gateway3.gateway,
93
- generateId: () => import_provider_utils34.generateId,
93
+ generateId: () => import_provider_utils35.generateId,
94
94
  generateObject: () => generateObject,
95
95
  generateText: () => generateText,
96
96
  getTextFromDataUrl: () => getTextFromDataUrl,
@@ -100,7 +100,7 @@ __export(src_exports, {
100
100
  isDeepEqualData: () => isDeepEqualData,
101
101
  isToolOrDynamicToolUIPart: () => isToolOrDynamicToolUIPart,
102
102
  isToolUIPart: () => isToolUIPart,
103
- jsonSchema: () => import_provider_utils34.jsonSchema,
103
+ jsonSchema: () => import_provider_utils35.jsonSchema,
104
104
  lastAssistantMessageIsCompleteWithToolCalls: () => lastAssistantMessageIsCompleteWithToolCalls,
105
105
  modelMessageSchema: () => modelMessageSchema,
106
106
  parsePartialJson: () => parsePartialJson,
@@ -114,20 +114,20 @@ __export(src_exports, {
114
114
  streamObject: () => streamObject,
115
115
  streamText: () => streamText,
116
116
  systemModelMessageSchema: () => systemModelMessageSchema,
117
- tool: () => import_provider_utils34.tool,
117
+ tool: () => import_provider_utils35.tool,
118
118
  toolModelMessageSchema: () => toolModelMessageSchema,
119
119
  userModelMessageSchema: () => userModelMessageSchema,
120
120
  validateUIMessages: () => validateUIMessages,
121
121
  wrapLanguageModel: () => wrapLanguageModel,
122
122
  wrapProvider: () => wrapProvider,
123
- zodSchema: () => import_provider_utils34.zodSchema
123
+ zodSchema: () => import_provider_utils35.zodSchema
124
124
  });
125
125
  module.exports = __toCommonJS(src_exports);
126
126
  var import_gateway3 = require("@ai-sdk/gateway");
127
- var import_provider_utils34 = require("@ai-sdk/provider-utils");
127
+ var import_provider_utils35 = require("@ai-sdk/provider-utils");
128
128
 
129
129
  // src/generate-text/generate-text.ts
130
- var import_provider_utils9 = require("@ai-sdk/provider-utils");
130
+ var import_provider_utils10 = require("@ai-sdk/provider-utils");
131
131
 
132
132
  // src/error/no-output-specified-error.ts
133
133
  var import_provider = require("@ai-sdk/provider");
@@ -574,45 +574,57 @@ function getGlobalProvider() {
574
574
  }
575
575
 
576
576
  // src/prompt/convert-to-language-model-prompt.ts
577
- var import_provider_utils3 = require("@ai-sdk/provider-utils");
577
+ var import_provider_utils4 = require("@ai-sdk/provider-utils");
578
578
 
579
579
  // src/util/detect-media-type.ts
580
580
  var import_provider_utils = require("@ai-sdk/provider-utils");
581
581
  var imageMediaTypeSignatures = [
582
582
  {
583
583
  mediaType: "image/gif",
584
- bytesPrefix: [71, 73, 70],
585
- base64Prefix: "R0lG"
584
+ bytesPrefix: [71, 73, 70]
585
+ // GIF
586
586
  },
587
587
  {
588
588
  mediaType: "image/png",
589
- bytesPrefix: [137, 80, 78, 71],
590
- base64Prefix: "iVBORw"
589
+ bytesPrefix: [137, 80, 78, 71]
590
+ // PNG
591
591
  },
592
592
  {
593
593
  mediaType: "image/jpeg",
594
- bytesPrefix: [255, 216],
595
- base64Prefix: "/9j/"
594
+ bytesPrefix: [255, 216]
595
+ // JPEG
596
596
  },
597
597
  {
598
598
  mediaType: "image/webp",
599
- bytesPrefix: [82, 73, 70, 70],
600
- base64Prefix: "UklGRg"
599
+ bytesPrefix: [
600
+ 82,
601
+ 73,
602
+ 70,
603
+ 70,
604
+ // "RIFF"
605
+ null,
606
+ null,
607
+ null,
608
+ null,
609
+ // file size (variable)
610
+ 87,
611
+ 69,
612
+ 66,
613
+ 80
614
+ // "WEBP"
615
+ ]
601
616
  },
602
617
  {
603
618
  mediaType: "image/bmp",
604
- bytesPrefix: [66, 77],
605
- base64Prefix: "Qk"
619
+ bytesPrefix: [66, 77]
606
620
  },
607
621
  {
608
622
  mediaType: "image/tiff",
609
- bytesPrefix: [73, 73, 42, 0],
610
- base64Prefix: "SUkqAA"
623
+ bytesPrefix: [73, 73, 42, 0]
611
624
  },
612
625
  {
613
626
  mediaType: "image/tiff",
614
- bytesPrefix: [77, 77, 0, 42],
615
- base64Prefix: "TU0AKg"
627
+ bytesPrefix: [77, 77, 0, 42]
616
628
  },
617
629
  {
618
630
  mediaType: "image/avif",
@@ -629,8 +641,7 @@ var imageMediaTypeSignatures = [
629
641
  118,
630
642
  105,
631
643
  102
632
- ],
633
- base64Prefix: "AAAAIGZ0eXBhdmlm"
644
+ ]
634
645
  },
635
646
  {
636
647
  mediaType: "image/heic",
@@ -647,70 +658,78 @@ var imageMediaTypeSignatures = [
647
658
  101,
648
659
  105,
649
660
  99
650
- ],
651
- base64Prefix: "AAAAIGZ0eXBoZWlj"
661
+ ]
652
662
  }
653
663
  ];
654
664
  var audioMediaTypeSignatures = [
655
665
  {
656
666
  mediaType: "audio/mpeg",
657
- bytesPrefix: [255, 251],
658
- base64Prefix: "//s="
667
+ bytesPrefix: [255, 251]
659
668
  },
660
669
  {
661
670
  mediaType: "audio/mpeg",
662
- bytesPrefix: [255, 250],
663
- base64Prefix: "//o="
671
+ bytesPrefix: [255, 250]
664
672
  },
665
673
  {
666
674
  mediaType: "audio/mpeg",
667
- bytesPrefix: [255, 243],
668
- base64Prefix: "//M="
675
+ bytesPrefix: [255, 243]
669
676
  },
670
677
  {
671
678
  mediaType: "audio/mpeg",
672
- bytesPrefix: [255, 242],
673
- base64Prefix: "//I="
679
+ bytesPrefix: [255, 242]
674
680
  },
675
681
  {
676
682
  mediaType: "audio/mpeg",
677
- bytesPrefix: [255, 227],
678
- base64Prefix: "/+M="
683
+ bytesPrefix: [255, 227]
679
684
  },
680
685
  {
681
686
  mediaType: "audio/mpeg",
682
- bytesPrefix: [255, 226],
683
- base64Prefix: "/+I="
687
+ bytesPrefix: [255, 226]
684
688
  },
685
689
  {
686
690
  mediaType: "audio/wav",
687
- bytesPrefix: [82, 73, 70, 70],
688
- base64Prefix: "UklGR"
691
+ bytesPrefix: [
692
+ 82,
693
+ // R
694
+ 73,
695
+ // I
696
+ 70,
697
+ // F
698
+ 70,
699
+ // F
700
+ null,
701
+ null,
702
+ null,
703
+ null,
704
+ 87,
705
+ // W
706
+ 65,
707
+ // A
708
+ 86,
709
+ // V
710
+ 69
711
+ // E
712
+ ]
689
713
  },
690
714
  {
691
715
  mediaType: "audio/ogg",
692
- bytesPrefix: [79, 103, 103, 83],
693
- base64Prefix: "T2dnUw"
716
+ bytesPrefix: [79, 103, 103, 83]
694
717
  },
695
718
  {
696
719
  mediaType: "audio/flac",
697
- bytesPrefix: [102, 76, 97, 67],
698
- base64Prefix: "ZkxhQw"
720
+ bytesPrefix: [102, 76, 97, 67]
699
721
  },
700
722
  {
701
723
  mediaType: "audio/aac",
702
- bytesPrefix: [64, 21, 0, 0],
703
- base64Prefix: "QBUA"
724
+ bytesPrefix: [64, 21, 0, 0]
704
725
  },
705
726
  {
706
727
  mediaType: "audio/mp4",
707
- bytesPrefix: [102, 116, 121, 112],
708
- base64Prefix: "ZnR5cA"
728
+ bytesPrefix: [102, 116, 121, 112]
709
729
  },
710
730
  {
711
731
  mediaType: "audio/webm",
712
- bytesPrefix: [26, 69, 223, 163],
713
- base64Prefix: "GkXf"
732
+ bytesPrefix: [26, 69, 223, 163]
714
733
  }
715
734
  ];
716
735
  var stripID3 = (data) => {
@@ -729,9 +748,12 @@ function detectMediaType({
729
748
  signatures
730
749
  }) {
731
750
  const processedData = stripID3TagsIfPresent(data);
751
+ const bytes = typeof processedData === "string" ? (0, import_provider_utils.convertBase64ToUint8Array)(
752
+ processedData.substring(0, Math.min(processedData.length, 24))
753
+ ) : processedData;
732
754
  for (const signature of signatures) {
733
- if (typeof processedData === "string" ? processedData.startsWith(signature.base64Prefix) : processedData.length >= signature.bytesPrefix.length && signature.bytesPrefix.every(
734
- (byte, index) => processedData[index] === byte
755
+ if (bytes.length >= signature.bytesPrefix.length && signature.bytesPrefix.every(
756
+ (byte, index) => byte === null || bytes[index] === byte
735
757
  )) {
736
758
  return signature.mediaType;
737
759
  }
@@ -739,12 +761,24 @@ function detectMediaType({
739
761
  return void 0;
740
762
  }
741
763
 
764
+ // src/util/download/download.ts
765
+ var import_provider_utils2 = require("@ai-sdk/provider-utils");
766
+
767
+ // src/version.ts
768
+ var VERSION = true ? "5.0.45" : "0.0.0-test";
769
+
742
770
  // src/util/download/download.ts
743
771
  var download = async ({ url }) => {
744
772
  var _a17;
745
773
  const urlText = url.toString();
746
774
  try {
747
- const response = await fetch(urlText);
775
+ const response = await fetch(urlText, {
776
+ headers: (0, import_provider_utils2.withUserAgentSuffix)(
777
+ {},
778
+ `ai-sdk/${VERSION}`,
779
+ (0, import_provider_utils2.getRuntimeEnvironmentUserAgent)()
780
+ )
781
+ });
748
782
  if (!response.ok) {
749
783
  throw new DownloadError({
750
784
  url: urlText,
@@ -773,7 +807,7 @@ var createDefaultDownloadFunction = (download2 = download) => (requestedDownload
773
807
 
774
808
  // src/prompt/data-content.ts
775
809
  var import_provider18 = require("@ai-sdk/provider");
776
- var import_provider_utils2 = require("@ai-sdk/provider-utils");
810
+ var import_provider_utils3 = require("@ai-sdk/provider-utils");
777
811
  var import_v4 = require("zod/v4");
778
812
 
779
813
  // src/prompt/split-data-url.ts
@@ -838,9 +872,9 @@ function convertDataContentToBase64String(content) {
838
872
  return content;
839
873
  }
840
874
  if (content instanceof ArrayBuffer) {
841
- return (0, import_provider_utils2.convertUint8ArrayToBase64)(new Uint8Array(content));
875
+ return (0, import_provider_utils3.convertUint8ArrayToBase64)(new Uint8Array(content));
842
876
  }
843
- return (0, import_provider_utils2.convertUint8ArrayToBase64)(content);
877
+ return (0, import_provider_utils3.convertUint8ArrayToBase64)(content);
844
878
  }
845
879
  function convertDataContentToUint8Array(content) {
846
880
  if (content instanceof Uint8Array) {
@@ -848,7 +882,7 @@ function convertDataContentToUint8Array(content) {
848
882
  }
849
883
  if (typeof content === "string") {
850
884
  try {
851
- return (0, import_provider_utils2.convertBase64ToUint8Array)(content);
885
+ return (0, import_provider_utils3.convertBase64ToUint8Array)(content);
852
886
  } catch (error) {
853
887
  throw new InvalidDataContentError({
854
888
  message: "Invalid data content. Content string is not a base64-encoded media.",
@@ -919,8 +953,8 @@ function convertToLanguageModelMessage({
919
953
  return {
920
954
  role: "assistant",
921
955
  content: message.content.filter(
922
- // remove empty text parts:
923
- (part) => part.type !== "text" || part.text !== ""
956
+ // remove empty text parts (no text, and no provider options):
957
+ (part) => part.type !== "text" || part.text !== "" || part.providerOptions != null
924
958
  ).map((part) => {
925
959
  const providerOptions = part.providerOptions;
926
960
  switch (part.type) {
@@ -1013,7 +1047,7 @@ async function downloadAssets(messages, download2, supportedUrls) {
1013
1047
  (part) => part.data instanceof URL
1014
1048
  ).map((part) => ({
1015
1049
  url: part.data,
1016
- isUrlSupportedByModel: part.mediaType != null && (0, import_provider_utils3.isUrlSupported)({
1050
+ isUrlSupportedByModel: part.mediaType != null && (0, import_provider_utils4.isUrlSupported)({
1017
1051
  url: part.data.toString(),
1018
1052
  mediaType: part.mediaType,
1019
1053
  supportedUrls
@@ -1183,7 +1217,7 @@ function prepareCallSettings({
1183
1217
  }
1184
1218
 
1185
1219
  // src/prompt/prepare-tools-and-tool-choice.ts
1186
- var import_provider_utils4 = require("@ai-sdk/provider-utils");
1220
+ var import_provider_utils5 = require("@ai-sdk/provider-utils");
1187
1221
 
1188
1222
  // src/util/is-non-empty-object.ts
1189
1223
  function isNonEmptyObject(object2) {
@@ -1216,7 +1250,7 @@ function prepareToolsAndToolChoice({
1216
1250
  type: "function",
1217
1251
  name: name17,
1218
1252
  description: tool3.description,
1219
- inputSchema: (0, import_provider_utils4.asSchema)(tool3.inputSchema).jsonSchema,
1253
+ inputSchema: (0, import_provider_utils5.asSchema)(tool3.inputSchema).jsonSchema,
1220
1254
  providerOptions: tool3.providerOptions
1221
1255
  };
1222
1256
  case "provider-defined":
@@ -1238,7 +1272,7 @@ function prepareToolsAndToolChoice({
1238
1272
 
1239
1273
  // src/prompt/standardize-prompt.ts
1240
1274
  var import_provider19 = require("@ai-sdk/provider");
1241
- var import_provider_utils5 = require("@ai-sdk/provider-utils");
1275
+ var import_provider_utils6 = require("@ai-sdk/provider-utils");
1242
1276
  var import_v46 = require("zod/v4");
1243
1277
 
1244
1278
  // src/prompt/message.ts
@@ -1429,7 +1463,7 @@ async function standardizePrompt(prompt) {
1429
1463
  message: "messages must not be empty"
1430
1464
  });
1431
1465
  }
1432
- const validationResult = await (0, import_provider_utils5.safeValidateTypes)({
1466
+ const validationResult = await (0, import_provider_utils6.safeValidateTypes)({
1433
1467
  value: messages,
1434
1468
  schema: import_v46.z.array(modelMessageSchema)
1435
1469
  });
@@ -1698,7 +1732,7 @@ function asArray(value) {
1698
1732
 
1699
1733
  // src/util/retry-with-exponential-backoff.ts
1700
1734
  var import_provider21 = require("@ai-sdk/provider");
1701
- var import_provider_utils6 = require("@ai-sdk/provider-utils");
1735
+ var import_provider_utils7 = require("@ai-sdk/provider-utils");
1702
1736
  function getRetryDelayInMs({
1703
1737
  error,
1704
1738
  exponentialBackoffDelay
@@ -1748,13 +1782,13 @@ async function _retryWithExponentialBackoff(f, {
1748
1782
  try {
1749
1783
  return await f();
1750
1784
  } catch (error) {
1751
- if ((0, import_provider_utils6.isAbortError)(error)) {
1785
+ if ((0, import_provider_utils7.isAbortError)(error)) {
1752
1786
  throw error;
1753
1787
  }
1754
1788
  if (maxRetries === 0) {
1755
1789
  throw error;
1756
1790
  }
1757
- const errorMessage = (0, import_provider_utils6.getErrorMessage)(error);
1791
+ const errorMessage = (0, import_provider_utils7.getErrorMessage)(error);
1758
1792
  const newErrors = [...errors, error];
1759
1793
  const tryNumber = newErrors.length;
1760
1794
  if (tryNumber > maxRetries) {
@@ -1765,7 +1799,7 @@ async function _retryWithExponentialBackoff(f, {
1765
1799
  });
1766
1800
  }
1767
1801
  if (error instanceof Error && import_provider21.APICallError.isInstance(error) && error.isRetryable === true && tryNumber <= maxRetries) {
1768
- await (0, import_provider_utils6.delay)(
1802
+ await (0, import_provider_utils7.delay)(
1769
1803
  getRetryDelayInMs({
1770
1804
  error,
1771
1805
  exponentialBackoffDelay: delayInMs
@@ -1837,7 +1871,7 @@ function extractTextContent(content) {
1837
1871
  }
1838
1872
 
1839
1873
  // src/generate-text/generated-file.ts
1840
- var import_provider_utils7 = require("@ai-sdk/provider-utils");
1874
+ var import_provider_utils8 = require("@ai-sdk/provider-utils");
1841
1875
  var DefaultGeneratedFile = class {
1842
1876
  constructor({
1843
1877
  data,
@@ -1851,14 +1885,14 @@ var DefaultGeneratedFile = class {
1851
1885
  // lazy conversion with caching to avoid unnecessary conversion overhead:
1852
1886
  get base64() {
1853
1887
  if (this.base64Data == null) {
1854
- this.base64Data = (0, import_provider_utils7.convertUint8ArrayToBase64)(this.uint8ArrayData);
1888
+ this.base64Data = (0, import_provider_utils8.convertUint8ArrayToBase64)(this.uint8ArrayData);
1855
1889
  }
1856
1890
  return this.base64Data;
1857
1891
  }
1858
1892
  // lazy conversion with caching to avoid unnecessary conversion overhead:
1859
1893
  get uint8Array() {
1860
1894
  if (this.uint8ArrayData == null) {
1861
- this.uint8ArrayData = (0, import_provider_utils7.convertBase64ToUint8Array)(this.base64Data);
1895
+ this.uint8ArrayData = (0, import_provider_utils8.convertBase64ToUint8Array)(this.base64Data);
1862
1896
  }
1863
1897
  return this.uint8ArrayData;
1864
1898
  }
@@ -1871,7 +1905,7 @@ var DefaultGeneratedFileWithType = class extends DefaultGeneratedFile {
1871
1905
  };
1872
1906
 
1873
1907
  // src/generate-text/parse-tool-call.ts
1874
- var import_provider_utils8 = require("@ai-sdk/provider-utils");
1908
+ var import_provider_utils9 = require("@ai-sdk/provider-utils");
1875
1909
  async function parseToolCall({
1876
1910
  toolCall,
1877
1911
  tools,
@@ -1896,7 +1930,7 @@ async function parseToolCall({
1896
1930
  tools,
1897
1931
  inputSchema: ({ toolName }) => {
1898
1932
  const { inputSchema } = tools[toolName];
1899
- return (0, import_provider_utils8.asSchema)(inputSchema).jsonSchema;
1933
+ return (0, import_provider_utils9.asSchema)(inputSchema).jsonSchema;
1900
1934
  },
1901
1935
  system,
1902
1936
  messages,
@@ -1914,7 +1948,7 @@ async function parseToolCall({
1914
1948
  return await doParseToolCall({ toolCall: repairedToolCall, tools });
1915
1949
  }
1916
1950
  } catch (error) {
1917
- const parsedInput = await (0, import_provider_utils8.safeParseJSON)({ text: toolCall.input });
1951
+ const parsedInput = await (0, import_provider_utils9.safeParseJSON)({ text: toolCall.input });
1918
1952
  const input = parsedInput.success ? parsedInput.value : toolCall.input;
1919
1953
  return {
1920
1954
  type: "tool-call",
@@ -1939,8 +1973,8 @@ async function doParseToolCall({
1939
1973
  availableTools: Object.keys(tools)
1940
1974
  });
1941
1975
  }
1942
- const schema = (0, import_provider_utils8.asSchema)(tool3.inputSchema);
1943
- const parseResult = toolCall.input.trim() === "" ? await (0, import_provider_utils8.safeValidateTypes)({ value: {}, schema }) : await (0, import_provider_utils8.safeParseJSON)({ text: toolCall.input, schema });
1976
+ const schema = (0, import_provider_utils9.asSchema)(tool3.inputSchema);
1977
+ const parseResult = toolCall.input.trim() === "" ? await (0, import_provider_utils9.safeValidateTypes)({ value: {}, schema }) : await (0, import_provider_utils9.safeParseJSON)({ text: toolCall.input, schema });
1944
1978
  if (parseResult.success === false) {
1945
1979
  throw new InvalidToolInputError({
1946
1980
  toolName,
@@ -2005,7 +2039,7 @@ var DefaultStepResult = class {
2005
2039
  }
2006
2040
  get staticToolCalls() {
2007
2041
  return this.toolCalls.filter(
2008
- (toolCall) => toolCall.dynamic === false
2042
+ (toolCall) => toolCall.dynamic !== true
2009
2043
  );
2010
2044
  }
2011
2045
  get dynamicToolCalls() {
@@ -2018,7 +2052,7 @@ var DefaultStepResult = class {
2018
2052
  }
2019
2053
  get staticToolResults() {
2020
2054
  return this.toolResults.filter(
2021
- (toolResult) => toolResult.dynamic === false
2055
+ (toolResult) => toolResult.dynamic !== true
2022
2056
  );
2023
2057
  }
2024
2058
  get dynamicToolResults() {
@@ -2158,11 +2192,8 @@ function toResponseMessages({
2158
2192
  return responseMessages;
2159
2193
  }
2160
2194
 
2161
- // src/version.ts
2162
- var VERSION = true ? "5.0.44" : "0.0.0-test";
2163
-
2164
2195
  // src/generate-text/generate-text.ts
2165
- var originalGenerateId = (0, import_provider_utils9.createIdGenerator)({
2196
+ var originalGenerateId = (0, import_provider_utils10.createIdGenerator)({
2166
2197
  prefix: "aitxt",
2167
2198
  size: 24
2168
2199
  });
@@ -2201,7 +2232,7 @@ async function generateText({
2201
2232
  abortSignal
2202
2233
  });
2203
2234
  const callSettings = prepareCallSettings(settings);
2204
- const headersWithUserAgent = (0, import_provider_utils9.withUserAgentSuffix)(
2235
+ const headersWithUserAgent = (0, import_provider_utils10.withUserAgentSuffix)(
2205
2236
  headers != null ? headers : {},
2206
2237
  `ai/${VERSION}`
2207
2238
  );
@@ -2407,7 +2438,7 @@ async function generateText({
2407
2438
  toolCallId: toolCall.toolCallId,
2408
2439
  toolName: toolCall.toolName,
2409
2440
  input: toolCall.input,
2410
- error: (0, import_provider_utils9.getErrorMessage)(toolCall.error),
2441
+ error: (0, import_provider_utils10.getErrorMessage)(toolCall.error),
2411
2442
  dynamic: true
2412
2443
  });
2413
2444
  }
@@ -2537,7 +2568,7 @@ async function executeTools({
2537
2568
  tracer,
2538
2569
  fn: async (span) => {
2539
2570
  try {
2540
- const stream = (0, import_provider_utils9.executeTool)({
2571
+ const stream = (0, import_provider_utils10.executeTool)({
2541
2572
  execute: tool3.execute.bind(tool3),
2542
2573
  input,
2543
2574
  options: {
@@ -2748,7 +2779,7 @@ function asContent({
2748
2779
 
2749
2780
  // src/generate-text/stream-text.ts
2750
2781
  var import_provider23 = require("@ai-sdk/provider");
2751
- var import_provider_utils13 = require("@ai-sdk/provider-utils");
2782
+ var import_provider_utils14 = require("@ai-sdk/provider-utils");
2752
2783
 
2753
2784
  // src/util/prepare-headers.ts
2754
2785
  function prepareHeaders(headers, defaultHeaders) {
@@ -2885,7 +2916,7 @@ function getResponseUIMessageId({
2885
2916
  }
2886
2917
 
2887
2918
  // src/ui/process-ui-message-stream.ts
2888
- var import_provider_utils11 = require("@ai-sdk/provider-utils");
2919
+ var import_provider_utils12 = require("@ai-sdk/provider-utils");
2889
2920
 
2890
2921
  // src/ui-message-stream/ui-message-chunks.ts
2891
2922
  var import_v47 = require("zod/v4");
@@ -3068,7 +3099,7 @@ function mergeObjects(base, overrides) {
3068
3099
  }
3069
3100
 
3070
3101
  // src/util/parse-partial-json.ts
3071
- var import_provider_utils10 = require("@ai-sdk/provider-utils");
3102
+ var import_provider_utils11 = require("@ai-sdk/provider-utils");
3072
3103
 
3073
3104
  // src/util/fix-json.ts
3074
3105
  function fixJson(input) {
@@ -3393,11 +3424,11 @@ async function parsePartialJson(jsonText) {
3393
3424
  if (jsonText === void 0) {
3394
3425
  return { value: void 0, state: "undefined-input" };
3395
3426
  }
3396
- let result = await (0, import_provider_utils10.safeParseJSON)({ text: jsonText });
3427
+ let result = await (0, import_provider_utils11.safeParseJSON)({ text: jsonText });
3397
3428
  if (result.success) {
3398
3429
  return { value: result.value, state: "successful-parse" };
3399
3430
  }
3400
- result = await (0, import_provider_utils10.safeParseJSON)({ text: fixJson(jsonText) });
3431
+ result = await (0, import_provider_utils11.safeParseJSON)({ text: fixJson(jsonText) });
3401
3432
  if (result.success) {
3402
3433
  return { value: result.value, state: "repaired-parse" };
3403
3434
  }
@@ -3547,7 +3578,7 @@ function processUIMessageStream({
3547
3578
  if (metadata != null) {
3548
3579
  const mergedMetadata = state.message.metadata != null ? mergeObjects(state.message.metadata, metadata) : metadata;
3549
3580
  if (messageMetadataSchema != null) {
3550
- await (0, import_provider_utils11.validateTypes)({
3581
+ await (0, import_provider_utils12.validateTypes)({
3551
3582
  value: mergedMetadata,
3552
3583
  schema: messageMetadataSchema
3553
3584
  });
@@ -3839,7 +3870,7 @@ function processUIMessageStream({
3839
3870
  default: {
3840
3871
  if (isDataUIMessageChunk(chunk)) {
3841
3872
  if ((dataPartSchemas == null ? void 0 : dataPartSchemas[chunk.type]) != null) {
3842
- await (0, import_provider_utils11.validateTypes)({
3873
+ await (0, import_provider_utils12.validateTypes)({
3843
3874
  value: chunk.data,
3844
3875
  schema: dataPartSchemas[chunk.type]
3845
3876
  });
@@ -4195,7 +4226,7 @@ function now() {
4195
4226
  }
4196
4227
 
4197
4228
  // src/generate-text/run-tools-transformation.ts
4198
- var import_provider_utils12 = require("@ai-sdk/provider-utils");
4229
+ var import_provider_utils13 = require("@ai-sdk/provider-utils");
4199
4230
  function runToolsTransformation({
4200
4231
  tools,
4201
4232
  generatorStream,
@@ -4281,7 +4312,7 @@ function runToolsTransformation({
4281
4312
  toolCallId: toolCall.toolCallId,
4282
4313
  toolName: toolCall.toolName,
4283
4314
  input: toolCall.input,
4284
- error: (0, import_provider_utils12.getErrorMessage)(toolCall.error),
4315
+ error: (0, import_provider_utils13.getErrorMessage)(toolCall.error),
4285
4316
  dynamic: true
4286
4317
  });
4287
4318
  break;
@@ -4298,7 +4329,7 @@ function runToolsTransformation({
4298
4329
  });
4299
4330
  }
4300
4331
  if (tool3.execute != null && toolCall.providerExecuted !== true) {
4301
- const toolExecutionId = (0, import_provider_utils12.generateId)();
4332
+ const toolExecutionId = (0, import_provider_utils13.generateId)();
4302
4333
  outstandingToolResults.add(toolExecutionId);
4303
4334
  recordSpan({
4304
4335
  name: "ai.toolCall",
@@ -4320,7 +4351,7 @@ function runToolsTransformation({
4320
4351
  fn: async (span) => {
4321
4352
  let output;
4322
4353
  try {
4323
- const stream = (0, import_provider_utils12.executeTool)({
4354
+ const stream = (0, import_provider_utils13.executeTool)({
4324
4355
  execute: tool3.execute.bind(tool3),
4325
4356
  input: toolCall.input,
4326
4357
  options: {
@@ -4439,7 +4470,7 @@ function runToolsTransformation({
4439
4470
  }
4440
4471
 
4441
4472
  // src/generate-text/stream-text.ts
4442
- var originalGenerateId2 = (0, import_provider_utils13.createIdGenerator)({
4473
+ var originalGenerateId2 = (0, import_provider_utils14.createIdGenerator)({
4443
4474
  prefix: "aitxt",
4444
4475
  size: 24
4445
4476
  });
@@ -4849,7 +4880,7 @@ var DefaultStreamTextResult = class {
4849
4880
  }
4850
4881
  controller.enqueue(value);
4851
4882
  } catch (error) {
4852
- if ((0, import_provider_utils13.isAbortError)(error) && (abortSignal == null ? void 0 : abortSignal.aborted)) {
4883
+ if ((0, import_provider_utils14.isAbortError)(error) && (abortSignal == null ? void 0 : abortSignal.aborted)) {
4853
4884
  abort();
4854
4885
  } else {
4855
4886
  controller.error(error);
@@ -5969,7 +6000,7 @@ var Agent = class {
5969
6000
  };
5970
6001
 
5971
6002
  // src/embed/embed.ts
5972
- var import_provider_utils14 = require("@ai-sdk/provider-utils");
6003
+ var import_provider_utils15 = require("@ai-sdk/provider-utils");
5973
6004
  async function embed({
5974
6005
  model: modelArg,
5975
6006
  value,
@@ -5984,7 +6015,7 @@ async function embed({
5984
6015
  maxRetries: maxRetriesArg,
5985
6016
  abortSignal
5986
6017
  });
5987
- const headersWithUserAgent = (0, import_provider_utils14.withUserAgentSuffix)(
6018
+ const headersWithUserAgent = (0, import_provider_utils15.withUserAgentSuffix)(
5988
6019
  headers != null ? headers : {},
5989
6020
  `ai/${VERSION}`
5990
6021
  );
@@ -6088,7 +6119,7 @@ var DefaultEmbedResult = class {
6088
6119
  };
6089
6120
 
6090
6121
  // src/embed/embed-many.ts
6091
- var import_provider_utils15 = require("@ai-sdk/provider-utils");
6122
+ var import_provider_utils16 = require("@ai-sdk/provider-utils");
6092
6123
 
6093
6124
  // src/util/split-array.ts
6094
6125
  function splitArray(array, chunkSize) {
@@ -6118,7 +6149,7 @@ async function embedMany({
6118
6149
  maxRetries: maxRetriesArg,
6119
6150
  abortSignal
6120
6151
  });
6121
- const headersWithUserAgent = (0, import_provider_utils15.withUserAgentSuffix)(
6152
+ const headersWithUserAgent = (0, import_provider_utils16.withUserAgentSuffix)(
6122
6153
  headers != null ? headers : {},
6123
6154
  `ai/${VERSION}`
6124
6155
  );
@@ -6337,7 +6368,7 @@ var DefaultEmbedManyResult = class {
6337
6368
  };
6338
6369
 
6339
6370
  // src/generate-image/generate-image.ts
6340
- var import_provider_utils16 = require("@ai-sdk/provider-utils");
6371
+ var import_provider_utils17 = require("@ai-sdk/provider-utils");
6341
6372
  async function generateImage({
6342
6373
  model,
6343
6374
  prompt,
@@ -6359,7 +6390,7 @@ async function generateImage({
6359
6390
  modelId: model.modelId
6360
6391
  });
6361
6392
  }
6362
- const headersWithUserAgent = (0, import_provider_utils16.withUserAgentSuffix)(
6393
+ const headersWithUserAgent = (0, import_provider_utils17.withUserAgentSuffix)(
6363
6394
  headers != null ? headers : {},
6364
6395
  `ai/${VERSION}`
6365
6396
  );
@@ -6455,7 +6486,7 @@ async function invokeModelMaxImagesPerCall(model) {
6455
6486
  }
6456
6487
 
6457
6488
  // src/generate-object/generate-object.ts
6458
- var import_provider_utils19 = require("@ai-sdk/provider-utils");
6489
+ var import_provider_utils20 = require("@ai-sdk/provider-utils");
6459
6490
 
6460
6491
  // src/generate-text/extract-reasoning-content.ts
6461
6492
  function extractReasoningContent(content) {
@@ -6467,7 +6498,7 @@ function extractReasoningContent(content) {
6467
6498
 
6468
6499
  // src/generate-object/output-strategy.ts
6469
6500
  var import_provider24 = require("@ai-sdk/provider");
6470
- var import_provider_utils17 = require("@ai-sdk/provider-utils");
6501
+ var import_provider_utils18 = require("@ai-sdk/provider-utils");
6471
6502
  var noSchemaOutputStrategy = {
6472
6503
  type: "no-schema",
6473
6504
  jsonSchema: void 0,
@@ -6506,7 +6537,7 @@ var objectOutputStrategy = (schema) => ({
6506
6537
  };
6507
6538
  },
6508
6539
  async validateFinalResult(value) {
6509
- return (0, import_provider_utils17.safeValidateTypes)({ value, schema });
6540
+ return (0, import_provider_utils18.safeValidateTypes)({ value, schema });
6510
6541
  },
6511
6542
  createElementStream() {
6512
6543
  throw new import_provider24.UnsupportedFunctionalityError({
@@ -6550,7 +6581,7 @@ var arrayOutputStrategy = (schema) => {
6550
6581
  const resultArray = [];
6551
6582
  for (let i = 0; i < inputArray.length; i++) {
6552
6583
  const element = inputArray[i];
6553
- const result = await (0, import_provider_utils17.safeValidateTypes)({ value: element, schema });
6584
+ const result = await (0, import_provider_utils18.safeValidateTypes)({ value: element, schema });
6554
6585
  if (i === inputArray.length - 1 && !isFinalDelta) {
6555
6586
  continue;
6556
6587
  }
@@ -6591,7 +6622,7 @@ var arrayOutputStrategy = (schema) => {
6591
6622
  }
6592
6623
  const inputArray = value.elements;
6593
6624
  for (const element of inputArray) {
6594
- const result = await (0, import_provider_utils17.safeValidateTypes)({ value: element, schema });
6625
+ const result = await (0, import_provider_utils18.safeValidateTypes)({ value: element, schema });
6595
6626
  if (!result.success) {
6596
6627
  return result;
6597
6628
  }
@@ -6709,9 +6740,9 @@ function getOutputStrategy({
6709
6740
  }) {
6710
6741
  switch (output) {
6711
6742
  case "object":
6712
- return objectOutputStrategy((0, import_provider_utils17.asSchema)(schema));
6743
+ return objectOutputStrategy((0, import_provider_utils18.asSchema)(schema));
6713
6744
  case "array":
6714
- return arrayOutputStrategy((0, import_provider_utils17.asSchema)(schema));
6745
+ return arrayOutputStrategy((0, import_provider_utils18.asSchema)(schema));
6715
6746
  case "enum":
6716
6747
  return enumOutputStrategy(enumValues);
6717
6748
  case "no-schema":
@@ -6725,9 +6756,9 @@ function getOutputStrategy({
6725
6756
 
6726
6757
  // src/generate-object/parse-and-validate-object-result.ts
6727
6758
  var import_provider25 = require("@ai-sdk/provider");
6728
- var import_provider_utils18 = require("@ai-sdk/provider-utils");
6759
+ var import_provider_utils19 = require("@ai-sdk/provider-utils");
6729
6760
  async function parseAndValidateObjectResult(result, outputStrategy, context) {
6730
- const parseResult = await (0, import_provider_utils18.safeParseJSON)({ text: result });
6761
+ const parseResult = await (0, import_provider_utils19.safeParseJSON)({ text: result });
6731
6762
  if (!parseResult.success) {
6732
6763
  throw new NoObjectGeneratedError({
6733
6764
  message: "No object generated: could not parse the response.",
@@ -6899,7 +6930,7 @@ function validateObjectGenerationInput({
6899
6930
  }
6900
6931
 
6901
6932
  // src/generate-object/generate-object.ts
6902
- var originalGenerateId3 = (0, import_provider_utils19.createIdGenerator)({ prefix: "aiobj", size: 24 });
6933
+ var originalGenerateId3 = (0, import_provider_utils20.createIdGenerator)({ prefix: "aiobj", size: 24 });
6903
6934
  async function generateObject(options) {
6904
6935
  const {
6905
6936
  model: modelArg,
@@ -6944,7 +6975,7 @@ async function generateObject(options) {
6944
6975
  enumValues
6945
6976
  });
6946
6977
  const callSettings = prepareCallSettings(settings);
6947
- const headersWithUserAgent = (0, import_provider_utils19.withUserAgentSuffix)(
6978
+ const headersWithUserAgent = (0, import_provider_utils20.withUserAgentSuffix)(
6948
6979
  headers != null ? headers : {},
6949
6980
  `ai/${VERSION}`
6950
6981
  );
@@ -7163,7 +7194,7 @@ var DefaultGenerateObjectResult = class {
7163
7194
  };
7164
7195
 
7165
7196
  // src/generate-object/stream-object.ts
7166
- var import_provider_utils21 = require("@ai-sdk/provider-utils");
7197
+ var import_provider_utils22 = require("@ai-sdk/provider-utils");
7167
7198
 
7168
7199
  // src/util/cosine-similarity.ts
7169
7200
  function cosineSimilarity(vector1, vector2) {
@@ -7273,7 +7304,7 @@ var SerialJobExecutor = class {
7273
7304
  };
7274
7305
 
7275
7306
  // src/util/simulate-readable-stream.ts
7276
- var import_provider_utils20 = require("@ai-sdk/provider-utils");
7307
+ var import_provider_utils21 = require("@ai-sdk/provider-utils");
7277
7308
  function simulateReadableStream({
7278
7309
  chunks,
7279
7310
  initialDelayInMs = 0,
@@ -7281,7 +7312,7 @@ function simulateReadableStream({
7281
7312
  _internal
7282
7313
  }) {
7283
7314
  var _a17;
7284
- const delay2 = (_a17 = _internal == null ? void 0 : _internal.delay) != null ? _a17 : import_provider_utils20.delay;
7315
+ const delay2 = (_a17 = _internal == null ? void 0 : _internal.delay) != null ? _a17 : import_provider_utils21.delay;
7285
7316
  let index = 0;
7286
7317
  return new ReadableStream({
7287
7318
  async pull(controller) {
@@ -7296,7 +7327,7 @@ function simulateReadableStream({
7296
7327
  }
7297
7328
 
7298
7329
  // src/generate-object/stream-object.ts
7299
- var originalGenerateId4 = (0, import_provider_utils21.createIdGenerator)({ prefix: "aiobj", size: 24 });
7330
+ var originalGenerateId4 = (0, import_provider_utils22.createIdGenerator)({ prefix: "aiobj", size: 24 });
7300
7331
  function streamObject(options) {
7301
7332
  const {
7302
7333
  model,
@@ -7817,7 +7848,7 @@ var DefaultStreamObjectResult = class {
7817
7848
  };
7818
7849
 
7819
7850
  // src/generate-speech/generate-speech.ts
7820
- var import_provider_utils22 = require("@ai-sdk/provider-utils");
7851
+ var import_provider_utils23 = require("@ai-sdk/provider-utils");
7821
7852
 
7822
7853
  // src/error/no-speech-generated-error.ts
7823
7854
  var import_provider26 = require("@ai-sdk/provider");
@@ -7878,7 +7909,7 @@ async function generateSpeech({
7878
7909
  modelId: model.modelId
7879
7910
  });
7880
7911
  }
7881
- const headersWithUserAgent = (0, import_provider_utils22.withUserAgentSuffix)(
7912
+ const headersWithUserAgent = (0, import_provider_utils23.withUserAgentSuffix)(
7882
7913
  headers != null ? headers : {},
7883
7914
  `ai/${VERSION}`
7884
7915
  );
@@ -7932,7 +7963,7 @@ __export(output_exports, {
7932
7963
  object: () => object,
7933
7964
  text: () => text
7934
7965
  });
7935
- var import_provider_utils23 = require("@ai-sdk/provider-utils");
7966
+ var import_provider_utils24 = require("@ai-sdk/provider-utils");
7936
7967
  var text = () => ({
7937
7968
  type: "text",
7938
7969
  responseFormat: { type: "text" },
@@ -7946,7 +7977,7 @@ var text = () => ({
7946
7977
  var object = ({
7947
7978
  schema: inputSchema
7948
7979
  }) => {
7949
- const schema = (0, import_provider_utils23.asSchema)(inputSchema);
7980
+ const schema = (0, import_provider_utils24.asSchema)(inputSchema);
7950
7981
  return {
7951
7982
  type: "object",
7952
7983
  responseFormat: {
@@ -7972,7 +8003,7 @@ var object = ({
7972
8003
  }
7973
8004
  },
7974
8005
  async parseOutput({ text: text2 }, context) {
7975
- const parseResult = await (0, import_provider_utils23.safeParseJSON)({ text: text2 });
8006
+ const parseResult = await (0, import_provider_utils24.safeParseJSON)({ text: text2 });
7976
8007
  if (!parseResult.success) {
7977
8008
  throw new NoObjectGeneratedError({
7978
8009
  message: "No object generated: could not parse the response.",
@@ -7983,7 +8014,7 @@ var object = ({
7983
8014
  finishReason: context.finishReason
7984
8015
  });
7985
8016
  }
7986
- const validationResult = await (0, import_provider_utils23.safeValidateTypes)({
8017
+ const validationResult = await (0, import_provider_utils24.safeValidateTypes)({
7987
8018
  value: parseResult.value,
7988
8019
  schema
7989
8020
  });
@@ -8003,7 +8034,7 @@ var object = ({
8003
8034
  };
8004
8035
 
8005
8036
  // src/generate-text/smooth-stream.ts
8006
- var import_provider_utils24 = require("@ai-sdk/provider-utils");
8037
+ var import_provider_utils25 = require("@ai-sdk/provider-utils");
8007
8038
  var import_provider27 = require("@ai-sdk/provider");
8008
8039
  var CHUNKING_REGEXPS = {
8009
8040
  word: /\S+\s+/m,
@@ -8012,7 +8043,7 @@ var CHUNKING_REGEXPS = {
8012
8043
  function smoothStream({
8013
8044
  delayInMs = 10,
8014
8045
  chunking = "word",
8015
- _internal: { delay: delay2 = import_provider_utils24.delay } = {}
8046
+ _internal: { delay: delay2 = import_provider_utils25.delay } = {}
8016
8047
  } = {}) {
8017
8048
  let detectChunk;
8018
8049
  if (typeof chunking === "function") {
@@ -8611,10 +8642,10 @@ var DefaultProviderRegistry = class {
8611
8642
  };
8612
8643
 
8613
8644
  // src/tool/mcp/mcp-client.ts
8614
- var import_provider_utils26 = require("@ai-sdk/provider-utils");
8645
+ var import_provider_utils27 = require("@ai-sdk/provider-utils");
8615
8646
 
8616
8647
  // src/tool/mcp/mcp-sse-transport.ts
8617
- var import_provider_utils25 = require("@ai-sdk/provider-utils");
8648
+ var import_provider_utils26 = require("@ai-sdk/provider-utils");
8618
8649
 
8619
8650
  // src/tool/mcp/json-rpc-message.ts
8620
8651
  var import_v49 = require("zod/v4");
@@ -8773,8 +8804,14 @@ var SseMCPTransport = class {
8773
8804
  const establishConnection = async () => {
8774
8805
  var _a17, _b, _c;
8775
8806
  try {
8776
- const headers = new Headers(this.headers);
8777
- headers.set("Accept", "text/event-stream");
8807
+ const headers = (0, import_provider_utils26.withUserAgentSuffix)(
8808
+ {
8809
+ ...this.headers,
8810
+ Accept: "text/event-stream"
8811
+ },
8812
+ `ai-sdk/${VERSION}`,
8813
+ (0, import_provider_utils26.getRuntimeEnvironmentUserAgent)()
8814
+ );
8778
8815
  const response = await fetch(this.url.href, {
8779
8816
  headers,
8780
8817
  signal: (_a17 = this.abortController) == null ? void 0 : _a17.signal
@@ -8786,7 +8823,7 @@ var SseMCPTransport = class {
8786
8823
  (_b = this.onerror) == null ? void 0 : _b.call(this, error);
8787
8824
  return reject(error);
8788
8825
  }
8789
- const stream = response.body.pipeThrough(new TextDecoderStream()).pipeThrough(new import_provider_utils25.EventSourceParserStream());
8826
+ const stream = response.body.pipeThrough(new TextDecoderStream()).pipeThrough(new import_provider_utils26.EventSourceParserStream());
8790
8827
  const reader = stream.getReader();
8791
8828
  const processEvents = async () => {
8792
8829
  var _a18, _b2, _c2;
@@ -8865,8 +8902,14 @@ var SseMCPTransport = class {
8865
8902
  });
8866
8903
  }
8867
8904
  try {
8868
- const headers = new Headers(this.headers);
8869
- headers.set("Content-Type", "application/json");
8905
+ const headers = (0, import_provider_utils26.withUserAgentSuffix)(
8906
+ {
8907
+ ...this.headers,
8908
+ "Content-Type": "application/json"
8909
+ },
8910
+ `ai-sdk/${VERSION}`,
8911
+ (0, import_provider_utils26.getRuntimeEnvironmentUserAgent)()
8912
+ );
8870
8913
  const init = {
8871
8914
  method: "POST",
8872
8915
  headers,
@@ -9116,15 +9159,15 @@ var DefaultMCPClient = class {
9116
9159
  (_a18 = options == null ? void 0 : options.abortSignal) == null ? void 0 : _a18.throwIfAborted();
9117
9160
  return self.callTool({ name: name17, args, options });
9118
9161
  };
9119
- const toolWithExecute = schemas === "automatic" ? (0, import_provider_utils26.dynamicTool)({
9162
+ const toolWithExecute = schemas === "automatic" ? (0, import_provider_utils27.dynamicTool)({
9120
9163
  description,
9121
- inputSchema: (0, import_provider_utils26.jsonSchema)({
9164
+ inputSchema: (0, import_provider_utils27.jsonSchema)({
9122
9165
  ...inputSchema,
9123
9166
  properties: (_a17 = inputSchema.properties) != null ? _a17 : {},
9124
9167
  additionalProperties: false
9125
9168
  }),
9126
9169
  execute
9127
- }) : (0, import_provider_utils26.tool)({
9170
+ }) : (0, import_provider_utils27.tool)({
9128
9171
  description,
9129
9172
  inputSchema: schemas[name17].inputSchema,
9130
9173
  execute
@@ -9174,7 +9217,7 @@ var DefaultMCPClient = class {
9174
9217
  };
9175
9218
 
9176
9219
  // src/transcribe/transcribe.ts
9177
- var import_provider_utils27 = require("@ai-sdk/provider-utils");
9220
+ var import_provider_utils28 = require("@ai-sdk/provider-utils");
9178
9221
 
9179
9222
  // src/error/no-transcript-generated-error.ts
9180
9223
  var import_provider31 = require("@ai-sdk/provider");
@@ -9208,7 +9251,7 @@ async function transcribe({
9208
9251
  maxRetries: maxRetriesArg,
9209
9252
  abortSignal
9210
9253
  });
9211
- const headersWithUserAgent = (0, import_provider_utils27.withUserAgentSuffix)(
9254
+ const headersWithUserAgent = (0, import_provider_utils28.withUserAgentSuffix)(
9212
9255
  headers != null ? headers : {},
9213
9256
  `ai/${VERSION}`
9214
9257
  );
@@ -9256,7 +9299,7 @@ var DefaultTranscriptionResult = class {
9256
9299
  };
9257
9300
 
9258
9301
  // src/ui/call-completion-api.ts
9259
- var import_provider_utils28 = require("@ai-sdk/provider-utils");
9302
+ var import_provider_utils29 = require("@ai-sdk/provider-utils");
9260
9303
 
9261
9304
  // src/ui/process-text-stream.ts
9262
9305
  async function processTextStream({
@@ -9304,10 +9347,14 @@ async function callCompletionApi({
9304
9347
  ...body
9305
9348
  }),
9306
9349
  credentials,
9307
- headers: {
9308
- "Content-Type": "application/json",
9309
- ...headers
9310
- },
9350
+ headers: (0, import_provider_utils29.withUserAgentSuffix)(
9351
+ {
9352
+ "Content-Type": "application/json",
9353
+ ...headers
9354
+ },
9355
+ `ai-sdk/${VERSION}`,
9356
+ (0, import_provider_utils29.getRuntimeEnvironmentUserAgent)()
9357
+ ),
9311
9358
  signal: abortController.signal
9312
9359
  }).catch((err) => {
9313
9360
  throw err;
@@ -9334,7 +9381,7 @@ async function callCompletionApi({
9334
9381
  }
9335
9382
  case "data": {
9336
9383
  await consumeStream({
9337
- stream: (0, import_provider_utils28.parseJsonEventStream)({
9384
+ stream: (0, import_provider_utils29.parseJsonEventStream)({
9338
9385
  stream: response.body,
9339
9386
  schema: uiMessageChunkSchema
9340
9387
  }).pipeThrough(
@@ -9386,7 +9433,7 @@ async function callCompletionApi({
9386
9433
  }
9387
9434
 
9388
9435
  // src/ui/chat.ts
9389
- var import_provider_utils31 = require("@ai-sdk/provider-utils");
9436
+ var import_provider_utils32 = require("@ai-sdk/provider-utils");
9390
9437
 
9391
9438
  // src/ui/convert-file-list-to-file-ui-parts.ts
9392
9439
  async function convertFileListToFileUIParts(files) {
@@ -9419,10 +9466,10 @@ async function convertFileListToFileUIParts(files) {
9419
9466
  }
9420
9467
 
9421
9468
  // src/ui/default-chat-transport.ts
9422
- var import_provider_utils30 = require("@ai-sdk/provider-utils");
9469
+ var import_provider_utils31 = require("@ai-sdk/provider-utils");
9423
9470
 
9424
9471
  // src/ui/http-chat-transport.ts
9425
- var import_provider_utils29 = require("@ai-sdk/provider-utils");
9472
+ var import_provider_utils30 = require("@ai-sdk/provider-utils");
9426
9473
  var HttpChatTransport = class {
9427
9474
  constructor({
9428
9475
  api = "/api/chat",
@@ -9446,9 +9493,9 @@ var HttpChatTransport = class {
9446
9493
  ...options
9447
9494
  }) {
9448
9495
  var _a17, _b, _c, _d, _e;
9449
- const resolvedBody = await (0, import_provider_utils29.resolve)(this.body);
9450
- const resolvedHeaders = await (0, import_provider_utils29.resolve)(this.headers);
9451
- const resolvedCredentials = await (0, import_provider_utils29.resolve)(this.credentials);
9496
+ const resolvedBody = await (0, import_provider_utils30.resolve)(this.body);
9497
+ const resolvedHeaders = await (0, import_provider_utils30.resolve)(this.headers);
9498
+ const resolvedCredentials = await (0, import_provider_utils30.resolve)(this.credentials);
9452
9499
  const preparedRequest = await ((_a17 = this.prepareSendMessagesRequest) == null ? void 0 : _a17.call(this, {
9453
9500
  api: this.api,
9454
9501
  id: options.chatId,
@@ -9474,10 +9521,14 @@ var HttpChatTransport = class {
9474
9521
  const fetch2 = (_d = this.fetch) != null ? _d : globalThis.fetch;
9475
9522
  const response = await fetch2(api, {
9476
9523
  method: "POST",
9477
- headers: {
9478
- "Content-Type": "application/json",
9479
- ...headers
9480
- },
9524
+ headers: (0, import_provider_utils30.withUserAgentSuffix)(
9525
+ {
9526
+ "Content-Type": "application/json",
9527
+ ...headers
9528
+ },
9529
+ `ai-sdk/${VERSION}`,
9530
+ (0, import_provider_utils30.getRuntimeEnvironmentUserAgent)()
9531
+ ),
9481
9532
  body: JSON.stringify(body),
9482
9533
  credentials,
9483
9534
  signal: abortSignal
@@ -9494,9 +9545,9 @@ var HttpChatTransport = class {
9494
9545
  }
9495
9546
  async reconnectToStream(options) {
9496
9547
  var _a17, _b, _c, _d, _e;
9497
- const resolvedBody = await (0, import_provider_utils29.resolve)(this.body);
9498
- const resolvedHeaders = await (0, import_provider_utils29.resolve)(this.headers);
9499
- const resolvedCredentials = await (0, import_provider_utils29.resolve)(this.credentials);
9548
+ const resolvedBody = await (0, import_provider_utils30.resolve)(this.body);
9549
+ const resolvedHeaders = await (0, import_provider_utils30.resolve)(this.headers);
9550
+ const resolvedCredentials = await (0, import_provider_utils30.resolve)(this.credentials);
9500
9551
  const preparedRequest = await ((_a17 = this.prepareReconnectToStreamRequest) == null ? void 0 : _a17.call(this, {
9501
9552
  api: this.api,
9502
9553
  id: options.chatId,
@@ -9511,7 +9562,11 @@ var HttpChatTransport = class {
9511
9562
  const fetch2 = (_d = this.fetch) != null ? _d : globalThis.fetch;
9512
9563
  const response = await fetch2(api, {
9513
9564
  method: "GET",
9514
- headers,
9565
+ headers: (0, import_provider_utils30.withUserAgentSuffix)(
9566
+ headers,
9567
+ `ai-sdk/${VERSION}`,
9568
+ (0, import_provider_utils30.getRuntimeEnvironmentUserAgent)()
9569
+ ),
9515
9570
  credentials
9516
9571
  });
9517
9572
  if (response.status === 204) {
@@ -9535,7 +9590,7 @@ var DefaultChatTransport = class extends HttpChatTransport {
9535
9590
  super(options);
9536
9591
  }
9537
9592
  processResponseStream(stream) {
9538
- return (0, import_provider_utils30.parseJsonEventStream)({
9593
+ return (0, import_provider_utils31.parseJsonEventStream)({
9539
9594
  stream,
9540
9595
  schema: uiMessageChunkSchema
9541
9596
  }).pipeThrough(
@@ -9554,7 +9609,7 @@ var DefaultChatTransport = class extends HttpChatTransport {
9554
9609
  // src/ui/chat.ts
9555
9610
  var AbstractChat = class {
9556
9611
  constructor({
9557
- generateId: generateId3 = import_provider_utils31.generateId,
9612
+ generateId: generateId3 = import_provider_utils32.generateId,
9558
9613
  id = generateId3(),
9559
9614
  transport = new DefaultChatTransport(),
9560
9615
  messageMetadataSchema,
@@ -9936,7 +9991,7 @@ var TextStreamChatTransport = class extends HttpChatTransport {
9936
9991
 
9937
9992
  // src/ui/validate-ui-messages.ts
9938
9993
  var import_provider32 = require("@ai-sdk/provider");
9939
- var import_provider_utils32 = require("@ai-sdk/provider-utils");
9994
+ var import_provider_utils33 = require("@ai-sdk/provider-utils");
9940
9995
  var import_v410 = require("zod/v4");
9941
9996
  var textUIPartSchema = import_v410.z.object({
9942
9997
  type: import_v410.z.literal("text"),
@@ -10095,13 +10150,13 @@ async function validateUIMessages({
10095
10150
  message: "messages parameter must be provided"
10096
10151
  });
10097
10152
  }
10098
- const validatedMessages = await (0, import_provider_utils32.validateTypes)({
10153
+ const validatedMessages = await (0, import_provider_utils33.validateTypes)({
10099
10154
  value: messages,
10100
10155
  schema: import_v410.z.array(uiMessageSchema)
10101
10156
  });
10102
10157
  if (metadataSchema) {
10103
10158
  for (const message of validatedMessages) {
10104
- await (0, import_provider_utils32.validateTypes)({
10159
+ await (0, import_provider_utils33.validateTypes)({
10105
10160
  value: message.metadata,
10106
10161
  schema: metadataSchema
10107
10162
  });
@@ -10121,7 +10176,7 @@ async function validateUIMessages({
10121
10176
  cause: `No data schema found for data part ${dataName}`
10122
10177
  });
10123
10178
  }
10124
- await (0, import_provider_utils32.validateTypes)({
10179
+ await (0, import_provider_utils33.validateTypes)({
10125
10180
  value: dataPart.data,
10126
10181
  schema: dataSchema
10127
10182
  });
@@ -10143,13 +10198,13 @@ async function validateUIMessages({
10143
10198
  });
10144
10199
  }
10145
10200
  if (toolPart.state === "input-available" || toolPart.state === "output-available" || toolPart.state === "output-error") {
10146
- await (0, import_provider_utils32.validateTypes)({
10201
+ await (0, import_provider_utils33.validateTypes)({
10147
10202
  value: toolPart.input,
10148
10203
  schema: tool3.inputSchema
10149
10204
  });
10150
10205
  }
10151
10206
  if (toolPart.state === "output-available" && tool3.outputSchema) {
10152
- await (0, import_provider_utils32.validateTypes)({
10207
+ await (0, import_provider_utils33.validateTypes)({
10153
10208
  value: toolPart.output,
10154
10209
  schema: tool3.outputSchema
10155
10210
  });
@@ -10161,13 +10216,13 @@ async function validateUIMessages({
10161
10216
  }
10162
10217
 
10163
10218
  // src/ui-message-stream/create-ui-message-stream.ts
10164
- var import_provider_utils33 = require("@ai-sdk/provider-utils");
10219
+ var import_provider_utils34 = require("@ai-sdk/provider-utils");
10165
10220
  function createUIMessageStream({
10166
10221
  execute,
10167
- onError = import_provider_utils33.getErrorMessage,
10222
+ onError = import_provider_utils34.getErrorMessage,
10168
10223
  originalMessages,
10169
10224
  onFinish,
10170
- generateId: generateId3 = import_provider_utils33.generateId
10225
+ generateId: generateId3 = import_provider_utils34.generateId
10171
10226
  }) {
10172
10227
  let controller;
10173
10228
  const ongoingStreamPromises = [];