@ai-sdk/mcp 0.0.19 → 0.0.21

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
@@ -1009,6 +1009,9 @@ async function authInternal(provider, {
1009
1009
  }
1010
1010
 
1011
1011
  // src/tool/mcp-sse-transport.ts
1012
+ function isMessageEvent(event) {
1013
+ return event === void 0 || event === "message";
1014
+ }
1012
1015
  var SseMCPTransport = class {
1013
1016
  constructor({
1014
1017
  url,
@@ -1117,7 +1120,7 @@ var SseMCPTransport = class {
1117
1120
  this.endpoint = endpoint;
1118
1121
  this.connected = true;
1119
1122
  resolve();
1120
- } else if (event === "message") {
1123
+ } else if (isMessageEvent(event)) {
1121
1124
  try {
1122
1125
  const message = await parseJSONRPCMessage(data);
1123
1126
  (_c2 = this.onmessage) == null ? void 0 : _c2.call(this, message);
@@ -1222,6 +1225,9 @@ import {
1222
1225
  withUserAgentSuffix as withUserAgentSuffix2,
1223
1226
  getRuntimeEnvironmentUserAgent as getRuntimeEnvironmentUserAgent2
1224
1227
  } from "@ai-sdk/provider-utils";
1228
+ function isMessageEvent2(event) {
1229
+ return event === void 0 || event === "message";
1230
+ }
1225
1231
  var HttpMCPTransport = class {
1226
1232
  constructor({
1227
1233
  url,
@@ -1364,7 +1370,7 @@ var HttpMCPTransport = class {
1364
1370
  const { done, value } = await reader.read();
1365
1371
  if (done) return;
1366
1372
  const { event, data } = value;
1367
- if (event === "message") {
1373
+ if (isMessageEvent2(event)) {
1368
1374
  try {
1369
1375
  const msg = await parseJSONRPCMessage(data);
1370
1376
  (_a4 = this.onmessage) == null ? void 0 : _a4.call(this, msg);
@@ -1489,7 +1495,7 @@ var HttpMCPTransport = class {
1489
1495
  if (id) {
1490
1496
  this.lastInboundEventId = id;
1491
1497
  }
1492
- if (event === "message") {
1498
+ if (isMessageEvent2(event)) {
1493
1499
  try {
1494
1500
  const msg = await parseJSONRPCMessage(data);
1495
1501
  (_a4 = this.onmessage) == null ? void 0 : _a4.call(this, msg);