@agentproto/adapter-pi 0.3.0 → 0.3.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
@@ -7244,6 +7244,109 @@ var require_cross_spawn = __commonJS({
7244
7244
  }
7245
7245
  });
7246
7246
 
7247
+ // ../../node_modules/.pnpm/content-type@1.0.5/node_modules/content-type/index.js
7248
+ var require_content_type = __commonJS({
7249
+ "../../node_modules/.pnpm/content-type@1.0.5/node_modules/content-type/index.js"(exports$1) {
7250
+ var PARAM_REGEXP = /; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g;
7251
+ var TEXT_REGEXP = /^[\u000b\u0020-\u007e\u0080-\u00ff]+$/;
7252
+ var TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
7253
+ var QESC_REGEXP = /\\([\u000b\u0020-\u00ff])/g;
7254
+ var QUOTE_REGEXP = /([\\"])/g;
7255
+ var TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
7256
+ exports$1.format = format;
7257
+ exports$1.parse = parse3;
7258
+ function format(obj) {
7259
+ if (!obj || typeof obj !== "object") {
7260
+ throw new TypeError("argument obj is required");
7261
+ }
7262
+ var parameters = obj.parameters;
7263
+ var type = obj.type;
7264
+ if (!type || !TYPE_REGEXP.test(type)) {
7265
+ throw new TypeError("invalid type");
7266
+ }
7267
+ var string4 = type;
7268
+ if (parameters && typeof parameters === "object") {
7269
+ var param;
7270
+ var params = Object.keys(parameters).sort();
7271
+ for (var i = 0; i < params.length; i++) {
7272
+ param = params[i];
7273
+ if (!TOKEN_REGEXP.test(param)) {
7274
+ throw new TypeError("invalid parameter name");
7275
+ }
7276
+ string4 += "; " + param + "=" + qstring(parameters[param]);
7277
+ }
7278
+ }
7279
+ return string4;
7280
+ }
7281
+ function parse3(string4) {
7282
+ if (!string4) {
7283
+ throw new TypeError("argument string is required");
7284
+ }
7285
+ var header = typeof string4 === "object" ? getcontenttype(string4) : string4;
7286
+ if (typeof header !== "string") {
7287
+ throw new TypeError("argument string is required to be a string");
7288
+ }
7289
+ var index = header.indexOf(";");
7290
+ var type = index !== -1 ? header.slice(0, index).trim() : header.trim();
7291
+ if (!TYPE_REGEXP.test(type)) {
7292
+ throw new TypeError("invalid media type");
7293
+ }
7294
+ var obj = new ContentType(type.toLowerCase());
7295
+ if (index !== -1) {
7296
+ var key;
7297
+ var match;
7298
+ var value;
7299
+ PARAM_REGEXP.lastIndex = index;
7300
+ while (match = PARAM_REGEXP.exec(header)) {
7301
+ if (match.index !== index) {
7302
+ throw new TypeError("invalid parameter format");
7303
+ }
7304
+ index += match[0].length;
7305
+ key = match[1].toLowerCase();
7306
+ value = match[2];
7307
+ if (value.charCodeAt(0) === 34) {
7308
+ value = value.slice(1, -1);
7309
+ if (value.indexOf("\\") !== -1) {
7310
+ value = value.replace(QESC_REGEXP, "$1");
7311
+ }
7312
+ }
7313
+ obj.parameters[key] = value;
7314
+ }
7315
+ if (index !== header.length) {
7316
+ throw new TypeError("invalid parameter format");
7317
+ }
7318
+ }
7319
+ return obj;
7320
+ }
7321
+ function getcontenttype(obj) {
7322
+ var header;
7323
+ if (typeof obj.getHeader === "function") {
7324
+ header = obj.getHeader("content-type");
7325
+ } else if (typeof obj.headers === "object") {
7326
+ header = obj.headers && obj.headers["content-type"];
7327
+ }
7328
+ if (typeof header !== "string") {
7329
+ throw new TypeError("content-type header is missing from object");
7330
+ }
7331
+ return header;
7332
+ }
7333
+ function qstring(val) {
7334
+ var str = String(val);
7335
+ if (TOKEN_REGEXP.test(str)) {
7336
+ return str;
7337
+ }
7338
+ if (str.length > 0 && !TEXT_REGEXP.test(str)) {
7339
+ throw new TypeError("invalid parameter value");
7340
+ }
7341
+ return '"' + str.replace(QUOTE_REGEXP, "\\$1") + '"';
7342
+ }
7343
+ function ContentType(type) {
7344
+ this.parameters = /* @__PURE__ */ Object.create(null);
7345
+ this.type = type;
7346
+ }
7347
+ }
7348
+ });
7349
+
7247
7350
  // src/mcp-bridge/config.ts
7248
7351
  var DEFAULT_TOOL_PREFIX = "mcp__";
7249
7352
  var MAX_TOOL_NAME_LEN = 64;
@@ -11664,7 +11767,7 @@ var optionalProcessor = (schema, ctx, _json, params) => {
11664
11767
  seen.ref = def.innerType;
11665
11768
  };
11666
11769
 
11667
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
11770
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
11668
11771
  function isZ4Schema(s) {
11669
11772
  const schema = s;
11670
11773
  return !!schema._zod;
@@ -12739,7 +12842,7 @@ function date3(params) {
12739
12842
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/external.js
12740
12843
  config(en_default());
12741
12844
 
12742
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
12845
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
12743
12846
  var LATEST_PROTOCOL_VERSION = "2025-11-25";
12744
12847
  var SUPPORTED_PROTOCOL_VERSIONS = [LATEST_PROTOCOL_VERSION, "2025-06-18", "2025-03-26", "2024-11-05", "2024-10-07"];
12745
12848
  var RELATED_TASK_META_KEY = "io.modelcontextprotocol/related-task";
@@ -14259,7 +14362,7 @@ var UrlElicitationRequiredError = class extends McpError {
14259
14362
  }
14260
14363
  };
14261
14364
 
14262
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
14365
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
14263
14366
  function isTerminal(status) {
14264
14367
  return status === "completed" || status === "failed" || status === "cancelled";
14265
14368
  }
@@ -14267,7 +14370,7 @@ function isTerminal(status) {
14267
14370
  // ../../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
14268
14371
  new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
14269
14372
 
14270
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
14373
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
14271
14374
  function getMethodLiteral(schema) {
14272
14375
  const shape = getObjectShape(schema);
14273
14376
  const methodSchema = shape?.method;
@@ -14288,7 +14391,7 @@ function parseWithCompat(schema, data) {
14288
14391
  return result.data;
14289
14392
  }
14290
14393
 
14291
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
14394
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
14292
14395
  var DEFAULT_REQUEST_TIMEOUT_MSEC = 6e4;
14293
14396
  var Protocol = class {
14294
14397
  constructor(_options) {
@@ -15242,7 +15345,7 @@ function mergeCapabilities(base, additional) {
15242
15345
  return result;
15243
15346
  }
15244
15347
 
15245
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
15348
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
15246
15349
  var import_ajv = __toESM(require_ajv());
15247
15350
  var import_ajv_formats = __toESM(require_dist());
15248
15351
  function createDefaultAjvInstance() {
@@ -15310,7 +15413,7 @@ var AjvJsonSchemaValidator = class {
15310
15413
  }
15311
15414
  };
15312
15415
 
15313
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/client.js
15416
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/client.js
15314
15417
  var ExperimentalClientTasks = class {
15315
15418
  constructor(_client) {
15316
15419
  this._client = _client;
@@ -15464,7 +15567,7 @@ var ExperimentalClientTasks = class {
15464
15567
  }
15465
15568
  };
15466
15569
 
15467
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
15570
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
15468
15571
  function assertToolsCallTaskCapability(requests, method, entityName) {
15469
15572
  if (!requests) {
15470
15573
  throw new Error(`${entityName} does not support task creation (required for ${method})`);
@@ -15495,7 +15598,7 @@ function assertClientRequestTaskCapability(requests, method, entityName) {
15495
15598
  }
15496
15599
  }
15497
15600
 
15498
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js
15601
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js
15499
15602
  function applyElicitationDefaults(schema, data) {
15500
15603
  if (!schema || data === null || typeof data !== "object")
15501
15604
  return;
@@ -15615,16 +15718,7 @@ var Client = class extends Protocol {
15615
15718
  if (!methodSchema) {
15616
15719
  throw new Error("Schema is missing a method literal");
15617
15720
  }
15618
- let methodValue;
15619
- if (isZ4Schema(methodSchema)) {
15620
- const v4Schema = methodSchema;
15621
- const v4Def = v4Schema._zod?.def;
15622
- methodValue = v4Def?.value ?? v4Schema.value;
15623
- } else {
15624
- const v3Schema = methodSchema;
15625
- const legacyDef = v3Schema._def;
15626
- methodValue = legacyDef?.value ?? v3Schema.value;
15627
- }
15721
+ const methodValue = getLiteralValue(methodSchema);
15628
15722
  if (typeof methodValue !== "string") {
15629
15723
  throw new Error("Schema method literal must be a string");
15630
15724
  }
@@ -16003,7 +16097,7 @@ var Client = class extends Protocol {
16003
16097
  }
16004
16098
  };
16005
16099
 
16006
- // ../../node_modules/.pnpm/eventsource-parser@3.0.8/node_modules/eventsource-parser/dist/index.js
16100
+ // ../../node_modules/.pnpm/eventsource-parser@3.1.0/node_modules/eventsource-parser/dist/index.js
16007
16101
  var ParseError = class extends Error {
16008
16102
  constructor(message, options) {
16009
16103
  super(message), this.name = "ParseError", this.type = options.type, this.field = options.field, this.value = options.value, this.line = options.line;
@@ -16014,29 +16108,40 @@ var CR = 13;
16014
16108
  var SPACE = 32;
16015
16109
  function noop(_arg) {
16016
16110
  }
16017
- function createParser(callbacks) {
16018
- if (typeof callbacks == "function")
16111
+ function createParser(config2) {
16112
+ if (typeof config2 == "function")
16019
16113
  throw new TypeError(
16020
- "`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
16114
+ "`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?"
16021
16115
  );
16022
- const { onEvent = noop, onError = noop, onRetry = noop, onComment } = callbacks, pendingFragments = [];
16023
- let isFirstChunk = true, id, data = "", dataLines = 0, eventType;
16116
+ const { onEvent = noop, onError = noop, onRetry = noop, onComment, maxBufferSize } = config2, pendingFragments = [];
16117
+ let pendingFragmentsLength = 0, isFirstChunk = true, id, data = "", dataLines = 0, eventType, terminated = false;
16024
16118
  function feed(chunk) {
16119
+ if (terminated)
16120
+ throw new Error(
16121
+ "Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing."
16122
+ );
16025
16123
  if (isFirstChunk && (isFirstChunk = false, chunk.charCodeAt(0) === 239 && chunk.charCodeAt(1) === 187 && chunk.charCodeAt(2) === 191 && (chunk = chunk.slice(3))), pendingFragments.length === 0) {
16026
16124
  const trailing2 = processLines(chunk);
16027
- trailing2 !== "" && pendingFragments.push(trailing2);
16125
+ trailing2 !== "" && (pendingFragments.push(trailing2), pendingFragmentsLength = trailing2.length), checkBufferSize();
16028
16126
  return;
16029
16127
  }
16030
16128
  if (chunk.indexOf(`
16031
16129
  `) === -1 && chunk.indexOf("\r") === -1) {
16032
- pendingFragments.push(chunk);
16130
+ pendingFragments.push(chunk), pendingFragmentsLength += chunk.length, checkBufferSize();
16033
16131
  return;
16034
16132
  }
16035
16133
  pendingFragments.push(chunk);
16036
16134
  const input = pendingFragments.join("");
16037
- pendingFragments.length = 0;
16135
+ pendingFragments.length = 0, pendingFragmentsLength = 0;
16038
16136
  const trailing = processLines(input);
16039
- trailing !== "" && pendingFragments.push(trailing);
16137
+ trailing !== "" && (pendingFragments.push(trailing), pendingFragmentsLength = trailing.length), checkBufferSize();
16138
+ }
16139
+ function checkBufferSize() {
16140
+ maxBufferSize !== void 0 && (pendingFragmentsLength + data.length <= maxBufferSize || (terminated = true, pendingFragments.length = 0, pendingFragmentsLength = 0, id = void 0, data = "", dataLines = 0, eventType = void 0, onError(
16141
+ new ParseError(`Buffered data exceeded max buffer size of ${maxBufferSize} characters`, {
16142
+ type: "max-buffer-size-exceeded"
16143
+ })
16144
+ )));
16040
16145
  }
16041
16146
  function processLines(chunk) {
16042
16147
  let searchIndex = 0;
@@ -16157,7 +16262,7 @@ ${value}`, dataLines++;
16157
16262
  const incompleteLine = pendingFragments.join("");
16158
16263
  parseLine(incompleteLine, 0, incompleteLine.length);
16159
16264
  }
16160
- isFirstChunk = true, id = void 0, data = "", dataLines = 0, eventType = void 0, pendingFragments.length = 0;
16265
+ isFirstChunk = true, id = void 0, data = "", dataLines = 0, eventType = void 0, pendingFragments.length = 0, pendingFragmentsLength = 0, terminated = false;
16161
16266
  }
16162
16267
  return { feed, reset };
16163
16268
  }
@@ -16465,7 +16570,7 @@ function getBaseURL() {
16465
16570
  return doc && typeof doc == "object" && "baseURI" in doc && typeof doc.baseURI == "string" ? doc.baseURI : void 0;
16466
16571
  }
16467
16572
 
16468
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.js
16573
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.js
16469
16574
  function normalizeHeaders(headers) {
16470
16575
  if (!headers)
16471
16576
  return {};
@@ -16535,7 +16640,7 @@ async function pkceChallenge(length) {
16535
16640
  };
16536
16641
  }
16537
16642
 
16538
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js
16643
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js
16539
16644
  var SafeUrlSchema = url().superRefine((val, ctx) => {
16540
16645
  if (!URL.canParse(val)) {
16541
16646
  ctx.addIssue({
@@ -16679,7 +16784,7 @@ object2({
16679
16784
  token_type_hint: string2().optional()
16680
16785
  }).strip();
16681
16786
 
16682
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth-utils.js
16787
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth-utils.js
16683
16788
  function resourceUrlFromServerUrl(url2) {
16684
16789
  const resourceURL = typeof url2 === "string" ? new URL(url2) : new URL(url2.href);
16685
16790
  resourceURL.hash = "";
@@ -16699,7 +16804,7 @@ function checkResourceAllowed({ requestedResource, configuredResource }) {
16699
16804
  return requestedPath.startsWith(configuredPath);
16700
16805
  }
16701
16806
 
16702
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js
16807
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js
16703
16808
  var OAuthError = class extends Error {
16704
16809
  constructor(message, errorUri) {
16705
16810
  super(message);
@@ -16794,7 +16899,7 @@ var OAUTH_ERRORS = {
16794
16899
  [InvalidTargetError.errorCode]: InvalidTargetError
16795
16900
  };
16796
16901
 
16797
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js
16902
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js
16798
16903
  var UnauthorizedError = class extends Error {
16799
16904
  constructor(message) {
16800
16905
  super(message ?? "Unauthorized");
@@ -17334,7 +17439,7 @@ async function registerClient(authorizationServerUrl, { metadata, clientMetadata
17334
17439
  return OAuthClientInformationFullSchema.parse(await response.json());
17335
17440
  }
17336
17441
 
17337
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.js
17442
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.js
17338
17443
  var SseError = class extends Error {
17339
17444
  constructor(code, message, event) {
17340
17445
  super(`SSE error: ${message}`);
@@ -17525,12 +17630,21 @@ var SSEClientTransport = class {
17525
17630
  }
17526
17631
  };
17527
17632
 
17528
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js
17633
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js
17529
17634
  var import_cross_spawn = __toESM(require_cross_spawn());
17530
17635
 
17531
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
17636
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
17637
+ var STDIO_DEFAULT_MAX_BUFFER_SIZE = 10 * 1024 * 1024;
17532
17638
  var ReadBuffer = class {
17639
+ constructor(options) {
17640
+ this._maxBufferSize = options?.maxBufferSize ?? STDIO_DEFAULT_MAX_BUFFER_SIZE;
17641
+ }
17533
17642
  append(chunk) {
17643
+ const newSize = (this._buffer?.length ?? 0) + chunk.length;
17644
+ if (newSize > this._maxBufferSize) {
17645
+ this.clear();
17646
+ throw new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);
17647
+ }
17534
17648
  this._buffer = this._buffer ? Buffer.concat([this._buffer, chunk]) : chunk;
17535
17649
  }
17536
17650
  readMessage() {
@@ -17556,7 +17670,7 @@ function serializeMessage(message) {
17556
17670
  return JSON.stringify(message) + "\n";
17557
17671
  }
17558
17672
 
17559
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js
17673
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js
17560
17674
  var DEFAULT_INHERITED_ENV_VARS = process3.platform === "win32" ? [
17561
17675
  "APPDATA",
17562
17676
  "HOMEDRIVE",
@@ -17590,9 +17704,9 @@ function getDefaultEnvironment() {
17590
17704
  }
17591
17705
  var StdioClientTransport = class {
17592
17706
  constructor(server) {
17593
- this._readBuffer = new ReadBuffer();
17594
17707
  this._stderrStream = null;
17595
17708
  this._serverParams = server;
17709
+ this._readBuffer = new ReadBuffer({ maxBufferSize: server.maxBufferSize });
17596
17710
  if (server.stderr === "pipe" || server.stderr === "overlapped") {
17597
17711
  this._stderrStream = new PassThrough();
17598
17712
  }
@@ -17631,8 +17745,14 @@ var StdioClientTransport = class {
17631
17745
  this.onerror?.(error2);
17632
17746
  });
17633
17747
  this._process.stdout?.on("data", (chunk) => {
17634
- this._readBuffer.append(chunk);
17635
- this.processReadBuffer();
17748
+ try {
17749
+ this._readBuffer.append(chunk);
17750
+ this.processReadBuffer();
17751
+ } catch (error2) {
17752
+ this.onerror?.(error2);
17753
+ this.close().catch(() => {
17754
+ });
17755
+ }
17636
17756
  });
17637
17757
  this._process.stdout?.on("error", (error2) => {
17638
17758
  this.onerror?.(error2);
@@ -17721,9 +17841,26 @@ var StdioClientTransport = class {
17721
17841
  }
17722
17842
  };
17723
17843
 
17724
- // ../../node_modules/.pnpm/eventsource-parser@3.0.8/node_modules/eventsource-parser/dist/stream.js
17844
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.js
17845
+ var import_content_type = __toESM(require_content_type());
17846
+ function mediaTypeEssence(header) {
17847
+ if (!header) {
17848
+ return void 0;
17849
+ }
17850
+ try {
17851
+ return import_content_type.default.parse(header).type;
17852
+ } catch {
17853
+ const essence = (header.split(";", 1)[0] ?? "").trim().toLowerCase();
17854
+ if (essence === "" || header.slice(essence.length).includes(",")) {
17855
+ return void 0;
17856
+ }
17857
+ return essence;
17858
+ }
17859
+ }
17860
+
17861
+ // ../../node_modules/.pnpm/eventsource-parser@3.1.0/node_modules/eventsource-parser/dist/stream.js
17725
17862
  var EventSourceParserStream = class extends TransformStream {
17726
- constructor({ onError, onRetry, onComment } = {}) {
17863
+ constructor({ onError, onRetry, onComment, maxBufferSize } = {}) {
17727
17864
  let parser;
17728
17865
  super({
17729
17866
  start(controller) {
@@ -17732,10 +17869,11 @@ var EventSourceParserStream = class extends TransformStream {
17732
17869
  controller.enqueue(event);
17733
17870
  },
17734
17871
  onError(error2) {
17735
- onError === "terminate" ? controller.error(error2) : typeof onError == "function" && onError(error2);
17872
+ typeof onError == "function" && onError(error2), (onError === "terminate" || error2.type === "max-buffer-size-exceeded") && controller.error(error2);
17736
17873
  },
17737
17874
  onRetry,
17738
- onComment
17875
+ onComment,
17876
+ maxBufferSize
17739
17877
  });
17740
17878
  },
17741
17879
  transform(chunk) {
@@ -17745,7 +17883,7 @@ var EventSourceParserStream = class extends TransformStream {
17745
17883
  }
17746
17884
  };
17747
17885
 
17748
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js
17886
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js
17749
17887
  var DEFAULT_STREAMABLE_HTTP_RECONNECTION_OPTIONS = {
17750
17888
  initialReconnectionDelay: 1e3,
17751
17889
  maxReconnectionDelay: 3e4,
@@ -18061,11 +18199,12 @@ var StreamableHTTPClientTransport = class {
18061
18199
  }
18062
18200
  const messages = Array.isArray(message) ? message : [message];
18063
18201
  const hasRequests = messages.filter((msg) => "method" in msg && "id" in msg && msg.id !== void 0).length > 0;
18064
- const contentType = response.headers.get("content-type");
18202
+ const contentType2 = response.headers.get("content-type");
18203
+ const responseMediaType = mediaTypeEssence(contentType2);
18065
18204
  if (hasRequests) {
18066
- if (contentType?.includes("text/event-stream")) {
18205
+ if (responseMediaType === "text/event-stream") {
18067
18206
  this._handleSseStream(response.body, { onresumptiontoken }, false);
18068
- } else if (contentType?.includes("application/json")) {
18207
+ } else if (responseMediaType === "application/json") {
18069
18208
  const data = await response.json();
18070
18209
  const responseMessages = Array.isArray(data) ? data.map((msg) => JSONRPCMessageSchema.parse(msg)) : [JSONRPCMessageSchema.parse(data)];
18071
18210
  for (const msg of responseMessages) {
@@ -18073,7 +18212,7 @@ var StreamableHTTPClientTransport = class {
18073
18212
  }
18074
18213
  } else {
18075
18214
  await response.body?.cancel();
18076
- throw new StreamableHTTPError(-1, `Unexpected content type: ${contentType}`);
18215
+ throw new StreamableHTTPError(-1, `Unexpected content type: ${contentType2}`);
18077
18216
  }
18078
18217
  } else {
18079
18218
  await response.body?.cancel();
@@ -18822,6 +18961,7 @@ var pi = defineAgentCli({
18822
18961
  // eligibility projection compute an unrecognized "moonshotai" endpoint,
18823
18962
  // which doesn't match any real wallet, so a genuinely-eligible moonshot
18824
18963
  // profile was rejected.
18964
+ { id: "moonshotai/kimi-k3", provider: "moonshot" },
18825
18965
  { id: "moonshotai/kimi-k2.7-code", provider: "moonshot" }
18826
18966
  ],
18827
18967
  env: {
@@ -18899,6 +19039,15 @@ var pi = defineAgentCli({
18899
19039
  function piRuntime() {
18900
19040
  return createAgentCliRuntime(pi);
18901
19041
  }
19042
+ /*! Bundled license information:
19043
+
19044
+ content-type/index.js:
19045
+ (*!
19046
+ * content-type
19047
+ * Copyright(c) 2015 Douglas Christopher Wilson
19048
+ * MIT Licensed
19049
+ *)
19050
+ */
18902
19051
 
18903
19052
  export { classifyPiLine, createAgentCliClient, createPiMapperState, mapPiEvent, mapStopReason, pi, piRuntime, resetPiMapperState };
18904
19053
  //# sourceMappingURL=index.mjs.map