ai 6.0.0-beta.74 → 6.0.0-beta.75

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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # ai
2
2
 
3
+ ## 6.0.0-beta.75
4
+
5
+ ### Patch Changes
6
+
7
+ - 58920e0: fix(ai): do not drop custom headers in HttpChatTransport
8
+ - 58920e0: refactor: consolidate header normalization across packages, remove duplicates, preserve custom headers
9
+ - Updated dependencies [58920e0]
10
+ - @ai-sdk/provider-utils@4.0.0-beta.22
11
+ - @ai-sdk/gateway@2.0.0-beta.39
12
+
3
13
  ## 6.0.0-beta.74
4
14
 
5
15
  ### Patch Changes
package/dist/index.js CHANGED
@@ -849,7 +849,7 @@ function detectMediaType({
849
849
  var import_provider_utils2 = require("@ai-sdk/provider-utils");
850
850
 
851
851
  // src/version.ts
852
- var VERSION = true ? "6.0.0-beta.74" : "0.0.0-test";
852
+ var VERSION = true ? "6.0.0-beta.75" : "0.0.0-test";
853
853
 
854
854
  // src/util/download/download.ts
855
855
  var download = async ({ url }) => {
@@ -10349,19 +10349,23 @@ var HttpChatTransport = class {
10349
10349
  const resolvedBody = await (0, import_provider_utils33.resolve)(this.body);
10350
10350
  const resolvedHeaders = await (0, import_provider_utils33.resolve)(this.headers);
10351
10351
  const resolvedCredentials = await (0, import_provider_utils33.resolve)(this.credentials);
10352
+ const baseHeaders = {
10353
+ ...(0, import_provider_utils33.normalizeHeaders)(resolvedHeaders),
10354
+ ...(0, import_provider_utils33.normalizeHeaders)(options.headers)
10355
+ };
10352
10356
  const preparedRequest = await ((_a16 = this.prepareSendMessagesRequest) == null ? void 0 : _a16.call(this, {
10353
10357
  api: this.api,
10354
10358
  id: options.chatId,
10355
10359
  messages: options.messages,
10356
10360
  body: { ...resolvedBody, ...options.body },
10357
- headers: { ...resolvedHeaders, ...options.headers },
10361
+ headers: baseHeaders,
10358
10362
  credentials: resolvedCredentials,
10359
10363
  requestMetadata: options.metadata,
10360
10364
  trigger: options.trigger,
10361
10365
  messageId: options.messageId
10362
10366
  }));
10363
10367
  const api = (_b = preparedRequest == null ? void 0 : preparedRequest.api) != null ? _b : this.api;
10364
- const headers = (preparedRequest == null ? void 0 : preparedRequest.headers) !== void 0 ? preparedRequest.headers : { ...resolvedHeaders, ...options.headers };
10368
+ const headers = (preparedRequest == null ? void 0 : preparedRequest.headers) !== void 0 ? (0, import_provider_utils33.normalizeHeaders)(preparedRequest.headers) : baseHeaders;
10365
10369
  const body = (preparedRequest == null ? void 0 : preparedRequest.body) !== void 0 ? preparedRequest.body : {
10366
10370
  ...resolvedBody,
10367
10371
  ...options.body,
@@ -10401,16 +10405,20 @@ var HttpChatTransport = class {
10401
10405
  const resolvedBody = await (0, import_provider_utils33.resolve)(this.body);
10402
10406
  const resolvedHeaders = await (0, import_provider_utils33.resolve)(this.headers);
10403
10407
  const resolvedCredentials = await (0, import_provider_utils33.resolve)(this.credentials);
10408
+ const baseHeaders = {
10409
+ ...(0, import_provider_utils33.normalizeHeaders)(resolvedHeaders),
10410
+ ...(0, import_provider_utils33.normalizeHeaders)(options.headers)
10411
+ };
10404
10412
  const preparedRequest = await ((_a16 = this.prepareReconnectToStreamRequest) == null ? void 0 : _a16.call(this, {
10405
10413
  api: this.api,
10406
10414
  id: options.chatId,
10407
10415
  body: { ...resolvedBody, ...options.body },
10408
- headers: { ...resolvedHeaders, ...options.headers },
10416
+ headers: baseHeaders,
10409
10417
  credentials: resolvedCredentials,
10410
10418
  requestMetadata: options.metadata
10411
10419
  }));
10412
10420
  const api = (_b = preparedRequest == null ? void 0 : preparedRequest.api) != null ? _b : `${this.api}/${options.chatId}/stream`;
10413
- const headers = (preparedRequest == null ? void 0 : preparedRequest.headers) !== void 0 ? preparedRequest.headers : { ...resolvedHeaders, ...options.headers };
10421
+ const headers = (preparedRequest == null ? void 0 : preparedRequest.headers) !== void 0 ? (0, import_provider_utils33.normalizeHeaders)(preparedRequest.headers) : baseHeaders;
10414
10422
  const credentials = (_c = preparedRequest == null ? void 0 : preparedRequest.credentials) != null ? _c : resolvedCredentials;
10415
10423
  const fetch2 = (_d = this.fetch) != null ? _d : globalThis.fetch;
10416
10424
  const response = await fetch2(api, {