@agentproto/adapter-pi 0.3.0 → 0.3.2

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.
@@ -7237,6 +7237,109 @@ var require_cross_spawn = __commonJS({
7237
7237
  }
7238
7238
  });
7239
7239
 
7240
+ // ../../node_modules/.pnpm/content-type@1.0.5/node_modules/content-type/index.js
7241
+ var require_content_type = __commonJS({
7242
+ "../../node_modules/.pnpm/content-type@1.0.5/node_modules/content-type/index.js"(exports$1) {
7243
+ var PARAM_REGEXP = /; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g;
7244
+ var TEXT_REGEXP = /^[\u000b\u0020-\u007e\u0080-\u00ff]+$/;
7245
+ var TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
7246
+ var QESC_REGEXP = /\\([\u000b\u0020-\u00ff])/g;
7247
+ var QUOTE_REGEXP = /([\\"])/g;
7248
+ var TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
7249
+ exports$1.format = format;
7250
+ exports$1.parse = parse3;
7251
+ function format(obj) {
7252
+ if (!obj || typeof obj !== "object") {
7253
+ throw new TypeError("argument obj is required");
7254
+ }
7255
+ var parameters = obj.parameters;
7256
+ var type = obj.type;
7257
+ if (!type || !TYPE_REGEXP.test(type)) {
7258
+ throw new TypeError("invalid type");
7259
+ }
7260
+ var string4 = type;
7261
+ if (parameters && typeof parameters === "object") {
7262
+ var param;
7263
+ var params = Object.keys(parameters).sort();
7264
+ for (var i = 0; i < params.length; i++) {
7265
+ param = params[i];
7266
+ if (!TOKEN_REGEXP.test(param)) {
7267
+ throw new TypeError("invalid parameter name");
7268
+ }
7269
+ string4 += "; " + param + "=" + qstring(parameters[param]);
7270
+ }
7271
+ }
7272
+ return string4;
7273
+ }
7274
+ function parse3(string4) {
7275
+ if (!string4) {
7276
+ throw new TypeError("argument string is required");
7277
+ }
7278
+ var header = typeof string4 === "object" ? getcontenttype(string4) : string4;
7279
+ if (typeof header !== "string") {
7280
+ throw new TypeError("argument string is required to be a string");
7281
+ }
7282
+ var index = header.indexOf(";");
7283
+ var type = index !== -1 ? header.slice(0, index).trim() : header.trim();
7284
+ if (!TYPE_REGEXP.test(type)) {
7285
+ throw new TypeError("invalid media type");
7286
+ }
7287
+ var obj = new ContentType(type.toLowerCase());
7288
+ if (index !== -1) {
7289
+ var key;
7290
+ var match;
7291
+ var value;
7292
+ PARAM_REGEXP.lastIndex = index;
7293
+ while (match = PARAM_REGEXP.exec(header)) {
7294
+ if (match.index !== index) {
7295
+ throw new TypeError("invalid parameter format");
7296
+ }
7297
+ index += match[0].length;
7298
+ key = match[1].toLowerCase();
7299
+ value = match[2];
7300
+ if (value.charCodeAt(0) === 34) {
7301
+ value = value.slice(1, -1);
7302
+ if (value.indexOf("\\") !== -1) {
7303
+ value = value.replace(QESC_REGEXP, "$1");
7304
+ }
7305
+ }
7306
+ obj.parameters[key] = value;
7307
+ }
7308
+ if (index !== header.length) {
7309
+ throw new TypeError("invalid parameter format");
7310
+ }
7311
+ }
7312
+ return obj;
7313
+ }
7314
+ function getcontenttype(obj) {
7315
+ var header;
7316
+ if (typeof obj.getHeader === "function") {
7317
+ header = obj.getHeader("content-type");
7318
+ } else if (typeof obj.headers === "object") {
7319
+ header = obj.headers && obj.headers["content-type"];
7320
+ }
7321
+ if (typeof header !== "string") {
7322
+ throw new TypeError("content-type header is missing from object");
7323
+ }
7324
+ return header;
7325
+ }
7326
+ function qstring(val) {
7327
+ var str = String(val);
7328
+ if (TOKEN_REGEXP.test(str)) {
7329
+ return str;
7330
+ }
7331
+ if (str.length > 0 && !TEXT_REGEXP.test(str)) {
7332
+ throw new TypeError("invalid parameter value");
7333
+ }
7334
+ return '"' + str.replace(QUOTE_REGEXP, "\\$1") + '"';
7335
+ }
7336
+ function ContentType(type) {
7337
+ this.parameters = /* @__PURE__ */ Object.create(null);
7338
+ this.type = type;
7339
+ }
7340
+ }
7341
+ });
7342
+
7240
7343
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/core.js
7241
7344
  var _a;
7242
7345
  var NEVER = /* @__PURE__ */ Object.freeze({
@@ -11609,7 +11712,7 @@ var optionalProcessor = (schema, ctx, _json, params) => {
11609
11712
  seen.ref = def.innerType;
11610
11713
  };
11611
11714
 
11612
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
11715
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
11613
11716
  function isZ4Schema(s) {
11614
11717
  const schema = s;
11615
11718
  return !!schema._zod;
@@ -12684,7 +12787,7 @@ function date3(params) {
12684
12787
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/external.js
12685
12788
  config(en_default());
12686
12789
 
12687
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
12790
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
12688
12791
  var LATEST_PROTOCOL_VERSION = "2025-11-25";
12689
12792
  var SUPPORTED_PROTOCOL_VERSIONS = [LATEST_PROTOCOL_VERSION, "2025-06-18", "2025-03-26", "2024-11-05", "2024-10-07"];
12690
12793
  var RELATED_TASK_META_KEY = "io.modelcontextprotocol/related-task";
@@ -14204,7 +14307,7 @@ var UrlElicitationRequiredError = class extends McpError {
14204
14307
  }
14205
14308
  };
14206
14309
 
14207
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
14310
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
14208
14311
  function isTerminal(status) {
14209
14312
  return status === "completed" || status === "failed" || status === "cancelled";
14210
14313
  }
@@ -14212,7 +14315,7 @@ function isTerminal(status) {
14212
14315
  // ../../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.4.3/node_modules/zod-to-json-schema/dist/esm/parsers/string.js
14213
14316
  new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
14214
14317
 
14215
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
14318
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
14216
14319
  function getMethodLiteral(schema) {
14217
14320
  const shape = getObjectShape(schema);
14218
14321
  const methodSchema = shape?.method;
@@ -14233,7 +14336,7 @@ function parseWithCompat(schema, data) {
14233
14336
  return result.data;
14234
14337
  }
14235
14338
 
14236
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
14339
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
14237
14340
  var DEFAULT_REQUEST_TIMEOUT_MSEC = 6e4;
14238
14341
  var Protocol = class {
14239
14342
  constructor(_options) {
@@ -15187,7 +15290,7 @@ function mergeCapabilities(base, additional) {
15187
15290
  return result;
15188
15291
  }
15189
15292
 
15190
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
15293
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
15191
15294
  var import_ajv = __toESM(require_ajv());
15192
15295
  var import_ajv_formats = __toESM(require_dist());
15193
15296
  function createDefaultAjvInstance() {
@@ -15255,7 +15358,7 @@ var AjvJsonSchemaValidator = class {
15255
15358
  }
15256
15359
  };
15257
15360
 
15258
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/client.js
15361
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/client.js
15259
15362
  var ExperimentalClientTasks = class {
15260
15363
  constructor(_client) {
15261
15364
  this._client = _client;
@@ -15409,7 +15512,7 @@ var ExperimentalClientTasks = class {
15409
15512
  }
15410
15513
  };
15411
15514
 
15412
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
15515
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
15413
15516
  function assertToolsCallTaskCapability(requests, method, entityName) {
15414
15517
  if (!requests) {
15415
15518
  throw new Error(`${entityName} does not support task creation (required for ${method})`);
@@ -15440,7 +15543,7 @@ function assertClientRequestTaskCapability(requests, method, entityName) {
15440
15543
  }
15441
15544
  }
15442
15545
 
15443
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js
15546
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js
15444
15547
  function applyElicitationDefaults(schema, data) {
15445
15548
  if (!schema || data === null || typeof data !== "object")
15446
15549
  return;
@@ -15560,16 +15663,7 @@ var Client = class extends Protocol {
15560
15663
  if (!methodSchema) {
15561
15664
  throw new Error("Schema is missing a method literal");
15562
15665
  }
15563
- let methodValue;
15564
- if (isZ4Schema(methodSchema)) {
15565
- const v4Schema = methodSchema;
15566
- const v4Def = v4Schema._zod?.def;
15567
- methodValue = v4Def?.value ?? v4Schema.value;
15568
- } else {
15569
- const v3Schema = methodSchema;
15570
- const legacyDef = v3Schema._def;
15571
- methodValue = legacyDef?.value ?? v3Schema.value;
15572
- }
15666
+ const methodValue = getLiteralValue(methodSchema);
15573
15667
  if (typeof methodValue !== "string") {
15574
15668
  throw new Error("Schema method literal must be a string");
15575
15669
  }
@@ -15948,7 +16042,7 @@ var Client = class extends Protocol {
15948
16042
  }
15949
16043
  };
15950
16044
 
15951
- // ../../node_modules/.pnpm/eventsource-parser@3.0.8/node_modules/eventsource-parser/dist/index.js
16045
+ // ../../node_modules/.pnpm/eventsource-parser@3.1.0/node_modules/eventsource-parser/dist/index.js
15952
16046
  var ParseError = class extends Error {
15953
16047
  constructor(message, options) {
15954
16048
  super(message), this.name = "ParseError", this.type = options.type, this.field = options.field, this.value = options.value, this.line = options.line;
@@ -15959,29 +16053,40 @@ var CR = 13;
15959
16053
  var SPACE = 32;
15960
16054
  function noop(_arg) {
15961
16055
  }
15962
- function createParser(callbacks) {
15963
- if (typeof callbacks == "function")
16056
+ function createParser(config2) {
16057
+ if (typeof config2 == "function")
15964
16058
  throw new TypeError(
15965
- "`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
16059
+ "`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?"
15966
16060
  );
15967
- const { onEvent = noop, onError = noop, onRetry = noop, onComment } = callbacks, pendingFragments = [];
15968
- let isFirstChunk = true, id, data = "", dataLines = 0, eventType;
16061
+ const { onEvent = noop, onError = noop, onRetry = noop, onComment, maxBufferSize } = config2, pendingFragments = [];
16062
+ let pendingFragmentsLength = 0, isFirstChunk = true, id, data = "", dataLines = 0, eventType, terminated = false;
15969
16063
  function feed(chunk) {
16064
+ if (terminated)
16065
+ throw new Error(
16066
+ "Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing."
16067
+ );
15970
16068
  if (isFirstChunk && (isFirstChunk = false, chunk.charCodeAt(0) === 239 && chunk.charCodeAt(1) === 187 && chunk.charCodeAt(2) === 191 && (chunk = chunk.slice(3))), pendingFragments.length === 0) {
15971
16069
  const trailing2 = processLines(chunk);
15972
- trailing2 !== "" && pendingFragments.push(trailing2);
16070
+ trailing2 !== "" && (pendingFragments.push(trailing2), pendingFragmentsLength = trailing2.length), checkBufferSize();
15973
16071
  return;
15974
16072
  }
15975
16073
  if (chunk.indexOf(`
15976
16074
  `) === -1 && chunk.indexOf("\r") === -1) {
15977
- pendingFragments.push(chunk);
16075
+ pendingFragments.push(chunk), pendingFragmentsLength += chunk.length, checkBufferSize();
15978
16076
  return;
15979
16077
  }
15980
16078
  pendingFragments.push(chunk);
15981
16079
  const input = pendingFragments.join("");
15982
- pendingFragments.length = 0;
16080
+ pendingFragments.length = 0, pendingFragmentsLength = 0;
15983
16081
  const trailing = processLines(input);
15984
- trailing !== "" && pendingFragments.push(trailing);
16082
+ trailing !== "" && (pendingFragments.push(trailing), pendingFragmentsLength = trailing.length), checkBufferSize();
16083
+ }
16084
+ function checkBufferSize() {
16085
+ maxBufferSize !== void 0 && (pendingFragmentsLength + data.length <= maxBufferSize || (terminated = true, pendingFragments.length = 0, pendingFragmentsLength = 0, id = void 0, data = "", dataLines = 0, eventType = void 0, onError(
16086
+ new ParseError(`Buffered data exceeded max buffer size of ${maxBufferSize} characters`, {
16087
+ type: "max-buffer-size-exceeded"
16088
+ })
16089
+ )));
15985
16090
  }
15986
16091
  function processLines(chunk) {
15987
16092
  let searchIndex = 0;
@@ -16102,7 +16207,7 @@ ${value}`, dataLines++;
16102
16207
  const incompleteLine = pendingFragments.join("");
16103
16208
  parseLine(incompleteLine, 0, incompleteLine.length);
16104
16209
  }
16105
- isFirstChunk = true, id = void 0, data = "", dataLines = 0, eventType = void 0, pendingFragments.length = 0;
16210
+ isFirstChunk = true, id = void 0, data = "", dataLines = 0, eventType = void 0, pendingFragments.length = 0, pendingFragmentsLength = 0, terminated = false;
16106
16211
  }
16107
16212
  return { feed, reset };
16108
16213
  }
@@ -16410,7 +16515,7 @@ function getBaseURL() {
16410
16515
  return doc && typeof doc == "object" && "baseURI" in doc && typeof doc.baseURI == "string" ? doc.baseURI : void 0;
16411
16516
  }
16412
16517
 
16413
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.js
16518
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.js
16414
16519
  function normalizeHeaders(headers) {
16415
16520
  if (!headers)
16416
16521
  return {};
@@ -16480,7 +16585,7 @@ async function pkceChallenge(length) {
16480
16585
  };
16481
16586
  }
16482
16587
 
16483
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js
16588
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js
16484
16589
  var SafeUrlSchema = url().superRefine((val, ctx) => {
16485
16590
  if (!URL.canParse(val)) {
16486
16591
  ctx.addIssue({
@@ -16624,7 +16729,7 @@ object2({
16624
16729
  token_type_hint: string2().optional()
16625
16730
  }).strip();
16626
16731
 
16627
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth-utils.js
16732
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth-utils.js
16628
16733
  function resourceUrlFromServerUrl(url2) {
16629
16734
  const resourceURL = typeof url2 === "string" ? new URL(url2) : new URL(url2.href);
16630
16735
  resourceURL.hash = "";
@@ -16644,7 +16749,7 @@ function checkResourceAllowed({ requestedResource, configuredResource }) {
16644
16749
  return requestedPath.startsWith(configuredPath);
16645
16750
  }
16646
16751
 
16647
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js
16752
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js
16648
16753
  var OAuthError = class extends Error {
16649
16754
  constructor(message, errorUri) {
16650
16755
  super(message);
@@ -16739,7 +16844,7 @@ var OAUTH_ERRORS = {
16739
16844
  [InvalidTargetError.errorCode]: InvalidTargetError
16740
16845
  };
16741
16846
 
16742
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js
16847
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js
16743
16848
  var UnauthorizedError = class extends Error {
16744
16849
  constructor(message) {
16745
16850
  super(message ?? "Unauthorized");
@@ -17279,7 +17384,7 @@ async function registerClient(authorizationServerUrl, { metadata, clientMetadata
17279
17384
  return OAuthClientInformationFullSchema.parse(await response.json());
17280
17385
  }
17281
17386
 
17282
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.js
17387
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.js
17283
17388
  var SseError = class extends Error {
17284
17389
  constructor(code, message, event) {
17285
17390
  super(`SSE error: ${message}`);
@@ -17470,12 +17575,21 @@ var SSEClientTransport = class {
17470
17575
  }
17471
17576
  };
17472
17577
 
17473
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js
17578
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js
17474
17579
  var import_cross_spawn = __toESM(require_cross_spawn());
17475
17580
 
17476
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
17581
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
17582
+ var STDIO_DEFAULT_MAX_BUFFER_SIZE = 10 * 1024 * 1024;
17477
17583
  var ReadBuffer = class {
17584
+ constructor(options) {
17585
+ this._maxBufferSize = options?.maxBufferSize ?? STDIO_DEFAULT_MAX_BUFFER_SIZE;
17586
+ }
17478
17587
  append(chunk) {
17588
+ const newSize = (this._buffer?.length ?? 0) + chunk.length;
17589
+ if (newSize > this._maxBufferSize) {
17590
+ this.clear();
17591
+ throw new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);
17592
+ }
17479
17593
  this._buffer = this._buffer ? Buffer.concat([this._buffer, chunk]) : chunk;
17480
17594
  }
17481
17595
  readMessage() {
@@ -17501,7 +17615,7 @@ function serializeMessage(message) {
17501
17615
  return JSON.stringify(message) + "\n";
17502
17616
  }
17503
17617
 
17504
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js
17618
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js
17505
17619
  var DEFAULT_INHERITED_ENV_VARS = process3.platform === "win32" ? [
17506
17620
  "APPDATA",
17507
17621
  "HOMEDRIVE",
@@ -17535,9 +17649,9 @@ function getDefaultEnvironment() {
17535
17649
  }
17536
17650
  var StdioClientTransport = class {
17537
17651
  constructor(server) {
17538
- this._readBuffer = new ReadBuffer();
17539
17652
  this._stderrStream = null;
17540
17653
  this._serverParams = server;
17654
+ this._readBuffer = new ReadBuffer({ maxBufferSize: server.maxBufferSize });
17541
17655
  if (server.stderr === "pipe" || server.stderr === "overlapped") {
17542
17656
  this._stderrStream = new PassThrough();
17543
17657
  }
@@ -17576,8 +17690,14 @@ var StdioClientTransport = class {
17576
17690
  this.onerror?.(error2);
17577
17691
  });
17578
17692
  this._process.stdout?.on("data", (chunk) => {
17579
- this._readBuffer.append(chunk);
17580
- this.processReadBuffer();
17693
+ try {
17694
+ this._readBuffer.append(chunk);
17695
+ this.processReadBuffer();
17696
+ } catch (error2) {
17697
+ this.onerror?.(error2);
17698
+ this.close().catch(() => {
17699
+ });
17700
+ }
17581
17701
  });
17582
17702
  this._process.stdout?.on("error", (error2) => {
17583
17703
  this.onerror?.(error2);
@@ -17666,9 +17786,26 @@ var StdioClientTransport = class {
17666
17786
  }
17667
17787
  };
17668
17788
 
17669
- // ../../node_modules/.pnpm/eventsource-parser@3.0.8/node_modules/eventsource-parser/dist/stream.js
17789
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.js
17790
+ var import_content_type = __toESM(require_content_type());
17791
+ function mediaTypeEssence(header) {
17792
+ if (!header) {
17793
+ return void 0;
17794
+ }
17795
+ try {
17796
+ return import_content_type.default.parse(header).type;
17797
+ } catch {
17798
+ const essence = (header.split(";", 1)[0] ?? "").trim().toLowerCase();
17799
+ if (essence === "" || header.slice(essence.length).includes(",")) {
17800
+ return void 0;
17801
+ }
17802
+ return essence;
17803
+ }
17804
+ }
17805
+
17806
+ // ../../node_modules/.pnpm/eventsource-parser@3.1.0/node_modules/eventsource-parser/dist/stream.js
17670
17807
  var EventSourceParserStream = class extends TransformStream {
17671
- constructor({ onError, onRetry, onComment } = {}) {
17808
+ constructor({ onError, onRetry, onComment, maxBufferSize } = {}) {
17672
17809
  let parser;
17673
17810
  super({
17674
17811
  start(controller) {
@@ -17677,10 +17814,11 @@ var EventSourceParserStream = class extends TransformStream {
17677
17814
  controller.enqueue(event);
17678
17815
  },
17679
17816
  onError(error2) {
17680
- onError === "terminate" ? controller.error(error2) : typeof onError == "function" && onError(error2);
17817
+ typeof onError == "function" && onError(error2), (onError === "terminate" || error2.type === "max-buffer-size-exceeded") && controller.error(error2);
17681
17818
  },
17682
17819
  onRetry,
17683
- onComment
17820
+ onComment,
17821
+ maxBufferSize
17684
17822
  });
17685
17823
  },
17686
17824
  transform(chunk) {
@@ -17690,7 +17828,7 @@ var EventSourceParserStream = class extends TransformStream {
17690
17828
  }
17691
17829
  };
17692
17830
 
17693
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js
17831
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js
17694
17832
  var DEFAULT_STREAMABLE_HTTP_RECONNECTION_OPTIONS = {
17695
17833
  initialReconnectionDelay: 1e3,
17696
17834
  maxReconnectionDelay: 3e4,
@@ -18006,11 +18144,12 @@ var StreamableHTTPClientTransport = class {
18006
18144
  }
18007
18145
  const messages = Array.isArray(message) ? message : [message];
18008
18146
  const hasRequests = messages.filter((msg) => "method" in msg && "id" in msg && msg.id !== void 0).length > 0;
18009
- const contentType = response.headers.get("content-type");
18147
+ const contentType2 = response.headers.get("content-type");
18148
+ const responseMediaType = mediaTypeEssence(contentType2);
18010
18149
  if (hasRequests) {
18011
- if (contentType?.includes("text/event-stream")) {
18150
+ if (responseMediaType === "text/event-stream") {
18012
18151
  this._handleSseStream(response.body, { onresumptiontoken }, false);
18013
- } else if (contentType?.includes("application/json")) {
18152
+ } else if (responseMediaType === "application/json") {
18014
18153
  const data = await response.json();
18015
18154
  const responseMessages = Array.isArray(data) ? data.map((msg) => JSONRPCMessageSchema.parse(msg)) : [JSONRPCMessageSchema.parse(data)];
18016
18155
  for (const msg of responseMessages) {
@@ -18018,7 +18157,7 @@ var StreamableHTTPClientTransport = class {
18018
18157
  }
18019
18158
  } else {
18020
18159
  await response.body?.cancel();
18021
- throw new StreamableHTTPError(-1, `Unexpected content type: ${contentType}`);
18160
+ throw new StreamableHTTPError(-1, `Unexpected content type: ${contentType2}`);
18022
18161
  }
18023
18162
  } else {
18024
18163
  await response.body?.cancel();
@@ -18327,6 +18466,15 @@ function registerBridge(pi, config2) {
18327
18466
  function mcpBridgeExtension(pi) {
18328
18467
  registerBridge(pi, loadConfig());
18329
18468
  }
18469
+ /*! Bundled license information:
18470
+
18471
+ content-type/index.js:
18472
+ (*!
18473
+ * content-type
18474
+ * Copyright(c) 2015 Douglas Christopher Wilson
18475
+ * MIT Licensed
18476
+ *)
18477
+ */
18330
18478
 
18331
18479
  export { mcpBridgeExtension as default, registerBridge };
18332
18480
  //# sourceMappingURL=mcp-bridge-extension.mjs.map