ai 7.0.32 → 7.0.33

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.
@@ -85,7 +85,7 @@ import {
85
85
  } from "@ai-sdk/provider-utils";
86
86
 
87
87
  // src/version.ts
88
- var VERSION = true ? "7.0.32" : "0.0.0-test";
88
+ var VERSION = true ? "7.0.33" : "0.0.0-test";
89
89
 
90
90
  // src/util/download/download.ts
91
91
  var download = async ({
@@ -138,6 +138,42 @@ var createDefaultDownloadFunction = (download2 = download) => (requestedDownload
138
138
  )
139
139
  );
140
140
 
141
+ // src/util/merge-objects.ts
142
+ function mergeObjects(base, overrides) {
143
+ if (base === void 0 && overrides === void 0) {
144
+ return void 0;
145
+ }
146
+ if (base === void 0) {
147
+ return overrides;
148
+ }
149
+ if (overrides === void 0) {
150
+ return base;
151
+ }
152
+ const result = { ...base };
153
+ for (const key in overrides) {
154
+ if (key === "__proto__" || key === "constructor" || key === "prototype") {
155
+ continue;
156
+ }
157
+ if (Object.prototype.hasOwnProperty.call(overrides, key)) {
158
+ const overridesValue = overrides[key];
159
+ if (overridesValue === void 0)
160
+ continue;
161
+ const baseValue = key in base ? base[key] : void 0;
162
+ const isSourceObject = overridesValue !== null && typeof overridesValue === "object" && !Array.isArray(overridesValue) && !(overridesValue instanceof Date) && !(overridesValue instanceof RegExp);
163
+ const isTargetObject = baseValue !== null && baseValue !== void 0 && typeof baseValue === "object" && !Array.isArray(baseValue) && !(baseValue instanceof Date) && !(baseValue instanceof RegExp);
164
+ if (isSourceObject && isTargetObject) {
165
+ result[key] = mergeObjects(
166
+ baseValue,
167
+ overridesValue
168
+ );
169
+ } else {
170
+ result[key] = overridesValue;
171
+ }
172
+ }
173
+ }
174
+ return result;
175
+ }
176
+
141
177
  // src/prompt/file-part-data.ts
142
178
  import {
143
179
  isBuffer,
@@ -437,7 +473,15 @@ async function convertToLanguageModelPrompt({
437
473
  }
438
474
  const lastCombinedMessage = combinedMessages.at(-1);
439
475
  if ((lastCombinedMessage == null ? void 0 : lastCombinedMessage.role) === "tool") {
476
+ const lastContentPart = lastCombinedMessage.content.at(-1);
477
+ if (lastContentPart != null && lastCombinedMessage.providerOptions != null) {
478
+ lastContentPart.providerOptions = mergeObjects(
479
+ lastCombinedMessage.providerOptions,
480
+ lastContentPart.providerOptions
481
+ );
482
+ }
440
483
  lastCombinedMessage.content.push(...message.content);
484
+ lastCombinedMessage.providerOptions = message.providerOptions;
441
485
  } else {
442
486
  combinedMessages.push(message);
443
487
  }