ai 4.2.0 → 4.2.1

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.mjs CHANGED
@@ -6957,9 +6957,13 @@ var JSONRPCMessageSchema = z9.union([
6957
6957
 
6958
6958
  // core/tool/mcp/mcp-sse-transport.ts
6959
6959
  var SseMCPTransport = class {
6960
- constructor({ url }) {
6960
+ constructor({
6961
+ url,
6962
+ headers
6963
+ }) {
6961
6964
  this.connected = false;
6962
6965
  this.url = new URL(url);
6966
+ this.headers = headers;
6963
6967
  }
6964
6968
  async start() {
6965
6969
  return new Promise((resolve, reject) => {
@@ -6970,10 +6974,10 @@ var SseMCPTransport = class {
6970
6974
  const establishConnection = async () => {
6971
6975
  var _a17, _b, _c;
6972
6976
  try {
6977
+ const headers = new Headers(this.headers);
6978
+ headers.set("Accept", "text/event-stream");
6973
6979
  const response = await fetch(this.url.href, {
6974
- headers: {
6975
- Accept: "text/event-stream"
6976
- },
6980
+ headers,
6977
6981
  signal: (_a17 = this.abortController) == null ? void 0 : _a17.signal
6978
6982
  });
6979
6983
  if (!response.ok || !response.body) {
@@ -7062,7 +7066,7 @@ var SseMCPTransport = class {
7062
7066
  });
7063
7067
  }
7064
7068
  try {
7065
- const headers = new Headers();
7069
+ const headers = new Headers(this.headers);
7066
7070
  headers.set("Content-Type", "application/json");
7067
7071
  const init = {
7068
7072
  method: "POST",