@mrrlin-dev/mcp 0.4.80 → 0.4.85

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.
Files changed (2) hide show
  1. package/dist/bin.cjs +1545 -635
  2. package/package.json +28 -20
package/dist/bin.cjs CHANGED
@@ -6,6 +6,9 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
7
  var __getProtoOf = Object.getPrototypeOf;
8
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __esm = (fn, res) => function __init() {
10
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
11
+ };
9
12
  var __commonJS = (cb, mod2) => function __require() {
10
13
  return mod2 || (0, cb[__getOwnPropNames(cb)[0]])((mod2 = { exports: {} }).exports, mod2), mod2.exports;
11
14
  };
@@ -1949,8 +1952,8 @@ var require_stringify = __commonJS({
1949
1952
  return type === "float" || type === "integer";
1950
1953
  }
1951
1954
  function arrayType(values) {
1952
- var contentType = tomlType2(values[0]);
1953
- if (values.every((_) => tomlType2(_) === contentType)) return contentType;
1955
+ var contentType2 = tomlType2(values[0]);
1956
+ if (values.every((_) => tomlType2(_) === contentType2)) return contentType2;
1954
1957
  if (values.every((_) => isNumber(tomlType2(_)))) return "float";
1955
1958
  return "mixed";
1956
1959
  }
@@ -5095,15 +5098,34 @@ var require_data = __commonJS({
5095
5098
  }
5096
5099
  });
5097
5100
 
5098
- // ../../node_modules/.pnpm/fast-uri@3.1.2/node_modules/fast-uri/lib/utils.js
5101
+ // ../../node_modules/.pnpm/fast-uri@3.1.8/node_modules/fast-uri/lib/utils.js
5099
5102
  var require_utils = __commonJS({
5100
- "../../node_modules/.pnpm/fast-uri@3.1.2/node_modules/fast-uri/lib/utils.js"(exports2, module2) {
5103
+ "../../node_modules/.pnpm/fast-uri@3.1.8/node_modules/fast-uri/lib/utils.js"(exports2, module2) {
5101
5104
  "use strict";
5102
5105
  var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
5103
5106
  var isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
5107
+ var isPort = RegExp.prototype.test.bind(/^\d*$/u);
5104
5108
  var isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
5105
5109
  var isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
5106
- var isPathCharacter = RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);
5110
+ var isPathCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u);
5111
+ var isQueryFragmentCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u);
5112
+ var isUserinfoCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u);
5113
+ var BYTE_HEX = new Array(256);
5114
+ {
5115
+ const HEX_DIGITS = "0123456789ABCDEF";
5116
+ for (let i = 0; i < 256; i++) {
5117
+ BYTE_HEX[i] = "%" + HEX_DIGITS[i >> 4] + HEX_DIGITS[i & 15];
5118
+ }
5119
+ }
5120
+ function percentEncodeNonAscii(cp) {
5121
+ if (cp < 2048) {
5122
+ return BYTE_HEX[192 | cp >> 6] + BYTE_HEX[128 | cp & 63];
5123
+ }
5124
+ if (cp < 65536) {
5125
+ return BYTE_HEX[224 | cp >> 12] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63];
5126
+ }
5127
+ return BYTE_HEX[240 | cp >> 18] + BYTE_HEX[128 | cp >> 12 & 63] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63];
5128
+ }
5107
5129
  function stringArrayToHexStripped(input) {
5108
5130
  let acc = "";
5109
5131
  let code = 0;
@@ -5128,91 +5150,105 @@ var require_utils = __commonJS({
5128
5150
  }
5129
5151
  return acc;
5130
5152
  }
5153
+ var isHextet = RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/);
5154
+ var isIPvFuture = RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/);
5155
+ var isZoneCharacter = RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/);
5131
5156
  var nonSimpleDomain = RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);
5132
- function consumeIsZone(buffer) {
5133
- buffer.length = 0;
5134
- return true;
5135
- }
5136
- function consumeHextets(buffer, address, output3) {
5137
- if (buffer.length) {
5138
- const hex3 = stringArrayToHexStripped(buffer);
5139
- if (hex3 !== "") {
5140
- address.push(hex3);
5141
- } else {
5142
- output3.error = true;
5143
- return false;
5157
+ function isZoneIdentifier(zone) {
5158
+ if (zone.length === 0) return false;
5159
+ for (let i = 0; i < zone.length; i++) {
5160
+ if (isZoneCharacter(zone[i])) continue;
5161
+ if (zone[i] === "%" && i + 2 < zone.length && isHexPair(zone.slice(i + 1, i + 3))) {
5162
+ i += 2;
5163
+ continue;
5144
5164
  }
5145
- buffer.length = 0;
5165
+ return false;
5146
5166
  }
5147
5167
  return true;
5148
5168
  }
5149
- function getIPV6(input) {
5150
- let tokenCount = 0;
5151
- const output3 = { error: false, address: "", zone: "" };
5152
- const address = [];
5153
- const buffer = [];
5154
- let endipv6Encountered = false;
5155
- let endIpv6 = false;
5156
- let consume = consumeHextets;
5157
- for (let i = 0; i < input.length; i++) {
5158
- const cursor = input[i];
5159
- if (cursor === "[" || cursor === "]") {
5160
- continue;
5161
- }
5162
- if (cursor === ":") {
5163
- if (endipv6Encountered === true) {
5164
- endIpv6 = true;
5165
- }
5166
- if (!consume(buffer, address, output3)) {
5167
- break;
5168
- }
5169
- if (++tokenCount > 7) {
5170
- output3.error = true;
5171
- break;
5172
- }
5173
- if (i > 0 && input[i - 1] === ":") {
5174
- endipv6Encountered = true;
5175
- }
5176
- address.push(":");
5177
- continue;
5178
- } else if (cursor === "%") {
5179
- if (!consume(buffer, address, output3)) {
5180
- break;
5169
+ function compressIPv6ZeroRun(hextets) {
5170
+ let bestStart = -1;
5171
+ let bestLength = 0;
5172
+ let runStart = -1;
5173
+ let runLength = 0;
5174
+ for (let i = 0; i < hextets.length; i++) {
5175
+ if (hextets[i] === "0") {
5176
+ if (runStart === -1) runStart = i;
5177
+ runLength++;
5178
+ if (runLength > bestLength) {
5179
+ bestLength = runLength;
5180
+ bestStart = runStart;
5181
5181
  }
5182
- consume = consumeIsZone;
5183
5182
  } else {
5184
- buffer.push(cursor);
5183
+ runStart = -1;
5184
+ runLength = 0;
5185
+ }
5186
+ }
5187
+ if (bestLength < 2) return hextets.join(":");
5188
+ const head = hextets.slice(0, bestStart).join(":");
5189
+ const tail2 = hextets.slice(bestStart + bestLength).join(":");
5190
+ return head + "::" + tail2;
5191
+ }
5192
+ function normalizeIPv6Address(input) {
5193
+ const compression = input.indexOf("::");
5194
+ if (compression !== -1 && input.indexOf("::", compression + 1) !== -1) return void 0;
5195
+ const left = compression === -1 ? input.split(":") : input.slice(0, compression).split(":");
5196
+ const right = compression === -1 ? [] : input.slice(compression + 2).split(":");
5197
+ if (compression !== -1) {
5198
+ if (left.length === 1 && left[0] === "") left.length = 0;
5199
+ if (right.length === 1 && right[0] === "") right.length = 0;
5200
+ }
5201
+ const parts = left.concat(right);
5202
+ let hextetCount = 0;
5203
+ for (let i = 0; i < parts.length; i++) {
5204
+ const part = parts[i];
5205
+ if (part === "") return void 0;
5206
+ if (part.indexOf(".") !== -1) {
5207
+ if (i !== parts.length - 1 || compression !== -1 && right.length === 0 || !isIPv4(part)) return void 0;
5208
+ hextetCount += 2;
5185
5209
  continue;
5186
5210
  }
5211
+ if (!isHextet(part)) return void 0;
5212
+ parts[i] = parseInt(part, 16).toString(16);
5213
+ hextetCount++;
5187
5214
  }
5188
- if (buffer.length) {
5189
- if (consume === consumeIsZone) {
5190
- output3.zone = buffer.join("");
5191
- } else if (endIpv6) {
5192
- address.push(buffer.join(""));
5193
- } else {
5194
- address.push(stringArrayToHexStripped(buffer));
5195
- }
5215
+ if (compression === -1) {
5216
+ if (hextetCount !== 8) return void 0;
5217
+ return compressIPv6ZeroRun(parts);
5196
5218
  }
5197
- output3.address = address.join("");
5198
- return output3;
5219
+ if (hextetCount >= 8) return void 0;
5220
+ const expanded = parts.slice(0, left.length);
5221
+ for (let i = hextetCount; i < 8; i++) expanded.push("0");
5222
+ for (let i = left.length; i < parts.length; i++) expanded.push(parts[i]);
5223
+ return compressIPv6ZeroRun(expanded);
5199
5224
  }
5200
5225
  function normalizeIPv6(host) {
5201
- if (findToken(host, ":") < 2) {
5202
- return { host, isIPV6: false };
5203
- }
5204
- const ipv63 = getIPV6(host);
5205
- if (!ipv63.error) {
5206
- let newHost = ipv63.address;
5207
- let escapedHost = ipv63.address;
5208
- if (ipv63.zone) {
5209
- newHost += "%" + ipv63.zone;
5210
- escapedHost += "%25" + ipv63.zone;
5211
- }
5212
- return { host: newHost, isIPV6: true, escapedHost };
5213
- } else {
5214
- return { host, isIPV6: false };
5215
- }
5226
+ const bracketed = host[0] === "[" && host[host.length - 1] === "]";
5227
+ const hasBracket = host[0] === "[" || host[host.length - 1] === "]";
5228
+ if (hasBracket && !bracketed) return { host, isIPV6: false, error: true };
5229
+ let input = bracketed ? host.slice(1, -1) : host;
5230
+ if (bracketed && isIPvFuture(input)) {
5231
+ input = input.toLowerCase();
5232
+ return { host: `[${input}]`, escapedHost: input, isIPV6: false, isIPVFuture: true };
5233
+ }
5234
+ if (findToken(input, ":") < 2) {
5235
+ return { host, isIPV6: false, error: bracketed };
5236
+ }
5237
+ let zoneIdentifier = "";
5238
+ const zoneSeparator = input.indexOf("%");
5239
+ if (zoneSeparator !== -1) {
5240
+ const separatorLength = input.slice(zoneSeparator, zoneSeparator + 3).toLowerCase() === "%25" ? 3 : 1;
5241
+ zoneIdentifier = input.slice(zoneSeparator + separatorLength);
5242
+ if (!isZoneIdentifier(zoneIdentifier)) return { host, isIPV6: false, error: true };
5243
+ input = input.slice(0, zoneSeparator);
5244
+ }
5245
+ const address = normalizeIPv6Address(input);
5246
+ if (address === void 0) return { host, isIPV6: false, error: true };
5247
+ return {
5248
+ host: address + (zoneIdentifier ? "%" + zoneIdentifier : ""),
5249
+ escapedHost: address + (zoneIdentifier ? "%25" + zoneIdentifier : ""),
5250
+ isIPV6: true
5251
+ };
5216
5252
  }
5217
5253
  function findToken(str, token) {
5218
5254
  let ind = 0;
@@ -5221,8 +5257,8 @@ var require_utils = __commonJS({
5221
5257
  }
5222
5258
  return ind;
5223
5259
  }
5224
- function removeDotSegments(path26) {
5225
- let input = path26;
5260
+ function removeDotSegments(path28) {
5261
+ let input = path28;
5226
5262
  const output3 = [];
5227
5263
  let nextSlash = -1;
5228
5264
  let len = 0;
@@ -5331,7 +5367,8 @@ var require_utils = __commonJS({
5331
5367
  function normalizePathEncoding(input) {
5332
5368
  let output3 = "";
5333
5369
  for (let i = 0; i < input.length; i++) {
5334
- if (input[i] === "%" && i + 2 < input.length) {
5370
+ const ch = input[i];
5371
+ if (ch === "%" && i + 2 < input.length) {
5335
5372
  const hex3 = input.slice(i + 1, i + 3);
5336
5373
  if (isHexPair(hex3)) {
5337
5374
  const normalizedHex = hex3.toUpperCase();
@@ -5345,10 +5382,152 @@ var require_utils = __commonJS({
5345
5382
  continue;
5346
5383
  }
5347
5384
  }
5348
- if (isPathCharacter(input[i])) {
5349
- output3 += input[i];
5385
+ if (isPathCharacter(ch)) {
5386
+ output3 += ch;
5350
5387
  } else {
5351
- output3 += escape(input[i]);
5388
+ const code = input.charCodeAt(i);
5389
+ if (code < 128) {
5390
+ output3 += isEscapeSafe(code) ? ch : BYTE_HEX[code];
5391
+ } else if (code < 55296 || code > 57343) {
5392
+ output3 += percentEncodeNonAscii(code);
5393
+ } else if (code <= 56319 && i + 1 < input.length) {
5394
+ const low = input.charCodeAt(i + 1);
5395
+ if (low >= 56320 && low <= 57343) {
5396
+ output3 += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
5397
+ i++;
5398
+ } else {
5399
+ output3 += percentEncodeNonAscii(65533);
5400
+ }
5401
+ } else {
5402
+ output3 += percentEncodeNonAscii(65533);
5403
+ }
5404
+ }
5405
+ }
5406
+ return output3;
5407
+ }
5408
+ function serializePathEncoding(input, pathNoScheme = false) {
5409
+ let output3 = "";
5410
+ let firstSegment = pathNoScheme && input[0] !== "/";
5411
+ for (let i = 0; i < input.length; i++) {
5412
+ const ch = input[i];
5413
+ if (ch === "%" && i + 2 < input.length) {
5414
+ const hex3 = input.slice(i + 1, i + 3);
5415
+ if (isHexPair(hex3)) {
5416
+ output3 += "%" + hex3.toUpperCase();
5417
+ i += 2;
5418
+ continue;
5419
+ }
5420
+ }
5421
+ if (ch === "/") {
5422
+ firstSegment = false;
5423
+ }
5424
+ if (isPathCharacter(ch) && (ch !== ":" || !firstSegment)) {
5425
+ output3 += ch;
5426
+ } else {
5427
+ const code = input.charCodeAt(i);
5428
+ if (code < 128) {
5429
+ output3 += BYTE_HEX[code];
5430
+ } else if (code < 55296 || code > 57343) {
5431
+ output3 += percentEncodeNonAscii(code);
5432
+ } else if (code <= 56319 && i + 1 < input.length) {
5433
+ const low = input.charCodeAt(i + 1);
5434
+ if (low >= 56320 && low <= 57343) {
5435
+ output3 += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
5436
+ i++;
5437
+ } else {
5438
+ output3 += percentEncodeNonAscii(65533);
5439
+ }
5440
+ } else {
5441
+ output3 += percentEncodeNonAscii(65533);
5442
+ }
5443
+ }
5444
+ }
5445
+ return output3;
5446
+ }
5447
+ function encodeComponent(input, isAllowed) {
5448
+ let output3 = "";
5449
+ for (let i = 0; i < input.length; i++) {
5450
+ const ch = input[i];
5451
+ if (ch === "%" && i + 2 < input.length) {
5452
+ const hex3 = input.slice(i + 1, i + 3);
5453
+ if (isHexPair(hex3)) {
5454
+ output3 += "%" + hex3.toUpperCase();
5455
+ i += 2;
5456
+ continue;
5457
+ }
5458
+ }
5459
+ if (isAllowed(ch)) {
5460
+ output3 += ch;
5461
+ } else {
5462
+ const code = input.charCodeAt(i);
5463
+ if (code < 128) {
5464
+ output3 += BYTE_HEX[code];
5465
+ } else if (code < 55296 || code > 57343) {
5466
+ output3 += percentEncodeNonAscii(code);
5467
+ } else if (code <= 56319 && i + 1 < input.length) {
5468
+ const low = input.charCodeAt(i + 1);
5469
+ if (low >= 56320 && low <= 57343) {
5470
+ output3 += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
5471
+ i++;
5472
+ } else {
5473
+ output3 += percentEncodeNonAscii(65533);
5474
+ }
5475
+ } else {
5476
+ output3 += percentEncodeNonAscii(65533);
5477
+ }
5478
+ }
5479
+ }
5480
+ return output3;
5481
+ }
5482
+ function encodeUserinfo(input) {
5483
+ return encodeComponent(input, isUserinfoCharacter);
5484
+ }
5485
+ function encodeQuery(input) {
5486
+ return encodeComponent(input, isQueryFragmentCharacter);
5487
+ }
5488
+ function encodeFragment(input) {
5489
+ return encodeComponent(input, isQueryFragmentCharacter);
5490
+ }
5491
+ function isEscapeSafe(cp) {
5492
+ return cp >= 48 && cp <= 57 || cp >= 65 && cp <= 90 || cp >= 97 && cp <= 122 || cp === 42 || cp === 43 || cp === 45 || cp === 46 || cp === 47 || cp === 64 || cp === 95;
5493
+ }
5494
+ function normalizeQueryFragmentEncoding(input) {
5495
+ let output3 = "";
5496
+ for (let i = 0; i < input.length; i++) {
5497
+ const ch = input[i];
5498
+ if (ch === "%" && i + 2 < input.length) {
5499
+ const hex3 = input.slice(i + 1, i + 3);
5500
+ if (isHexPair(hex3)) {
5501
+ const normalizedHex = hex3.toUpperCase();
5502
+ const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
5503
+ if (isUnreserved(decoded)) {
5504
+ output3 += decoded;
5505
+ } else {
5506
+ output3 += "%" + normalizedHex;
5507
+ }
5508
+ i += 2;
5509
+ continue;
5510
+ }
5511
+ }
5512
+ if (isQueryFragmentCharacter(ch)) {
5513
+ output3 += ch;
5514
+ } else {
5515
+ const code = input.charCodeAt(i);
5516
+ if (code < 128) {
5517
+ output3 += isEscapeSafe(code) ? ch : BYTE_HEX[code];
5518
+ } else if (code < 55296 || code > 57343) {
5519
+ output3 += percentEncodeNonAscii(code);
5520
+ } else if (code <= 56319 && i + 1 < input.length) {
5521
+ const low = input.charCodeAt(i + 1);
5522
+ if (low >= 56320 && low <= 57343) {
5523
+ output3 += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
5524
+ i++;
5525
+ } else {
5526
+ output3 += percentEncodeNonAscii(65533);
5527
+ }
5528
+ } else {
5529
+ output3 += percentEncodeNonAscii(65533);
5530
+ }
5352
5531
  }
5353
5532
  }
5354
5533
  return output3;
@@ -5371,14 +5550,18 @@ var require_utils = __commonJS({
5371
5550
  function recomposeAuthority(component) {
5372
5551
  const uriTokens = [];
5373
5552
  if (component.userinfo !== void 0) {
5374
- uriTokens.push(component.userinfo);
5553
+ uriTokens.push(encodeUserinfo(component.userinfo));
5375
5554
  uriTokens.push("@");
5376
5555
  }
5377
5556
  if (component.host !== void 0) {
5378
- let host = unescape(component.host);
5557
+ let host = component.host;
5379
5558
  if (!isIPv4(host)) {
5380
- const ipV6res = normalizeIPv6(host);
5381
- if (ipV6res.isIPV6 === true) {
5559
+ let ipV6res = normalizeIPv6(host);
5560
+ if (ipV6res.isIPV6 !== true && ipV6res.isIPVFuture !== true) {
5561
+ host = normalizePercentEncoding(host, true);
5562
+ ipV6res = normalizeIPv6(host);
5563
+ }
5564
+ if (ipV6res.isIPV6 === true || ipV6res.isIPVFuture === true) {
5382
5565
  host = `[${ipV6res.escapedHost}]`;
5383
5566
  } else {
5384
5567
  host = reescapeHostDelimiters(host, false);
@@ -5387,8 +5570,12 @@ var require_utils = __commonJS({
5387
5570
  uriTokens.push(host);
5388
5571
  }
5389
5572
  if (typeof component.port === "number" || typeof component.port === "string") {
5573
+ const port = String(component.port);
5574
+ if (!isPort(port)) {
5575
+ throw new TypeError("URI port is malformed.");
5576
+ }
5390
5577
  uriTokens.push(":");
5391
- uriTokens.push(String(component.port));
5578
+ uriTokens.push(port);
5392
5579
  }
5393
5580
  return uriTokens.length ? uriTokens.join("") : void 0;
5394
5581
  }
@@ -5398,6 +5585,11 @@ var require_utils = __commonJS({
5398
5585
  reescapeHostDelimiters,
5399
5586
  normalizePercentEncoding,
5400
5587
  normalizePathEncoding,
5588
+ serializePathEncoding,
5589
+ normalizeQueryFragmentEncoding,
5590
+ encodeUserinfo,
5591
+ encodeQuery,
5592
+ encodeFragment,
5401
5593
  escapePreservingEscapes,
5402
5594
  removeDotSegments,
5403
5595
  isIPv4,
@@ -5408,12 +5600,12 @@ var require_utils = __commonJS({
5408
5600
  }
5409
5601
  });
5410
5602
 
5411
- // ../../node_modules/.pnpm/fast-uri@3.1.2/node_modules/fast-uri/lib/schemes.js
5603
+ // ../../node_modules/.pnpm/fast-uri@3.1.8/node_modules/fast-uri/lib/schemes.js
5412
5604
  var require_schemes = __commonJS({
5413
- "../../node_modules/.pnpm/fast-uri@3.1.2/node_modules/fast-uri/lib/schemes.js"(exports2, module2) {
5605
+ "../../node_modules/.pnpm/fast-uri@3.1.8/node_modules/fast-uri/lib/schemes.js"(exports2, module2) {
5414
5606
  "use strict";
5415
5607
  var { isUUID } = require_utils();
5416
- var URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;
5608
+ var URN_REG = /^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu;
5417
5609
  var supportedSchemeNames = (
5418
5610
  /** @type {const} */
5419
5611
  [
@@ -5474,9 +5666,10 @@ var require_schemes = __commonJS({
5474
5666
  wsComponent.secure = void 0;
5475
5667
  }
5476
5668
  if (wsComponent.resourceName) {
5477
- const [path26, query] = wsComponent.resourceName.split("?");
5478
- wsComponent.path = path26 && path26 !== "/" ? path26 : void 0;
5479
- wsComponent.query = query;
5669
+ const queryIndex = wsComponent.resourceName.indexOf("?");
5670
+ const path28 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
5671
+ wsComponent.path = path28 && path28 !== "/" ? path28 : void 0;
5672
+ wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
5480
5673
  wsComponent.resourceName = void 0;
5481
5674
  }
5482
5675
  wsComponent.fragment = void 0;
@@ -5488,7 +5681,7 @@ var require_schemes = __commonJS({
5488
5681
  return urnComponent;
5489
5682
  }
5490
5683
  const matches = urnComponent.path.match(URN_REG);
5491
- if (matches) {
5684
+ if (matches && matches[0] === urnComponent.path) {
5492
5685
  const scheme = options.scheme || urnComponent.scheme || "urn";
5493
5686
  urnComponent.nid = matches[1].toLowerCase();
5494
5687
  urnComponent.nss = matches[2];
@@ -5618,33 +5811,69 @@ var require_schemes = __commonJS({
5618
5811
  }
5619
5812
  });
5620
5813
 
5621
- // ../../node_modules/.pnpm/fast-uri@3.1.2/node_modules/fast-uri/index.js
5814
+ // ../../node_modules/.pnpm/fast-uri@3.1.8/node_modules/fast-uri/index.js
5622
5815
  var require_fast_uri = __commonJS({
5623
- "../../node_modules/.pnpm/fast-uri@3.1.2/node_modules/fast-uri/index.js"(exports2, module2) {
5816
+ "../../node_modules/.pnpm/fast-uri@3.1.8/node_modules/fast-uri/index.js"(exports2, module2) {
5624
5817
  "use strict";
5625
- var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, escapePreservingEscapes, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
5818
+ var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
5626
5819
  var { SCHEMES, getSchemeHandler } = require_schemes();
5820
+ var VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u;
5821
+ var MALFORMED_SCHEME_ERROR = "URI scheme is malformed.";
5822
+ function decodeValidScheme(scheme) {
5823
+ const decodedScheme = unescape(String(scheme));
5824
+ if (!VALID_SCHEME.test(decodedScheme)) {
5825
+ throw new TypeError(MALFORMED_SCHEME_ERROR);
5826
+ }
5827
+ return decodedScheme;
5828
+ }
5627
5829
  function normalize(uri, options) {
5628
5830
  if (typeof uri === "string") {
5629
5831
  uri = /** @type {T} */
5630
5832
  normalizeString(uri, options);
5631
5833
  } else if (typeof uri === "object") {
5632
5834
  uri = /** @type {T} */
5633
- parse6(serialize(uri, options), options);
5835
+ parse7(serialize(uri, options), options);
5634
5836
  }
5635
5837
  return uri;
5636
5838
  }
5637
5839
  function resolve(baseURI, relativeURI, options) {
5638
5840
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
5639
- const resolved = resolveComponent(parse6(baseURI, schemelessOptions), parse6(relativeURI, schemelessOptions), schemelessOptions, true);
5841
+ const {
5842
+ parsed: baseParsed,
5843
+ malformedAuthorityOrPort: baseMalformed,
5844
+ malformedPercentEncoding: baseMalformedPercentEncoding,
5845
+ malformedSchemeSpecific: baseMalformedSchemeSpecific,
5846
+ malformedHost: baseMalformedHost,
5847
+ malformedScheme: baseMalformedScheme
5848
+ } = parseWithStatus(baseURI, schemelessOptions);
5849
+ const {
5850
+ parsed: relativeParsed,
5851
+ malformedAuthorityOrPort: relativeMalformed,
5852
+ malformedPercentEncoding: relativeMalformedPercentEncoding,
5853
+ malformedSchemeSpecific: relativeMalformedSchemeSpecific,
5854
+ malformedHost: relativeMalformedHost,
5855
+ malformedScheme: relativeMalformedScheme
5856
+ } = parseWithStatus(relativeURI, schemelessOptions);
5857
+ if (baseMalformed || relativeMalformed || baseMalformedPercentEncoding || relativeMalformedPercentEncoding || baseMalformedSchemeSpecific || relativeMalformedSchemeSpecific || baseMalformedHost || relativeMalformedHost || baseMalformedScheme || relativeMalformedScheme) {
5858
+ throw new Error(baseParsed.error || relativeParsed.error || "URI is malformed.");
5859
+ }
5860
+ const resolved = resolveComponent(baseParsed, relativeParsed, schemelessOptions, true);
5861
+ const resolvedSchemeHandler = getSchemeHandler(options && options.scheme || resolved.scheme);
5862
+ const resolvedHost = resolved.host;
5863
+ const resolvedHostIsIP = resolvedHost !== void 0 && resolvedHost !== "" && (isIPv4(resolvedHost) || normalizeIPv6(resolvedHost).isIPV6);
5864
+ canonicalizeHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP);
5865
+ const encodedASCIIHost = resolvedHost && resolvedHost.indexOf("%") !== -1 && !new RegExp("\\P{ASCII}", "u").test(resolvedHost);
5866
+ if (resolved.error && !encodedASCIIHost) {
5867
+ throw new Error(resolved.error);
5868
+ }
5640
5869
  schemelessOptions.skipEscape = true;
5641
5870
  return serialize(resolved, schemelessOptions);
5642
5871
  }
5643
5872
  function resolveComponent(base, relative, options, skipNormalization) {
5644
5873
  const target = {};
5645
5874
  if (!skipNormalization) {
5646
- base = parse6(serialize(base, options), options);
5647
- relative = parse6(serialize(relative, options), options);
5875
+ base = parse7(serialize(base, options), options);
5876
+ relative = parse7(serialize(relative, options), options);
5648
5877
  }
5649
5878
  options = options || {};
5650
5879
  if (!options.tolerant && relative.scheme) {
@@ -5696,7 +5925,7 @@ var require_fast_uri = __commonJS({
5696
5925
  function equal(uriA, uriB, options) {
5697
5926
  const normalizedA = normalizeComparableURI(uriA, options);
5698
5927
  const normalizedB = normalizeComparableURI(uriB, options);
5699
- return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA.toLowerCase() === normalizedB.toLowerCase();
5928
+ return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA === normalizedB;
5700
5929
  }
5701
5930
  function serialize(cmpts, opts) {
5702
5931
  const component = {
@@ -5717,19 +5946,22 @@ var require_fast_uri = __commonJS({
5717
5946
  };
5718
5947
  const options = Object.assign({}, opts);
5719
5948
  const uriTokens = [];
5949
+ if (component.scheme) {
5950
+ component.scheme = decodeValidScheme(component.scheme);
5951
+ }
5720
5952
  const schemeHandler = getSchemeHandler(options.scheme || component.scheme);
5721
5953
  if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options);
5954
+ const hasAuthority = component.userinfo !== void 0 || component.host !== void 0 || component.port !== void 0;
5955
+ const pathNoScheme = !options.skipEscape && component.scheme === void 0 && !hasAuthority;
5722
5956
  if (component.path !== void 0) {
5723
5957
  if (!options.skipEscape) {
5724
- component.path = escapePreservingEscapes(component.path);
5725
- if (component.scheme !== void 0) {
5726
- component.path = component.path.split("%3A").join(":");
5727
- }
5958
+ component.path = serializePathEncoding(component.path, pathNoScheme);
5728
5959
  } else {
5729
5960
  component.path = normalizePercentEncoding(component.path);
5730
5961
  }
5731
5962
  }
5732
5963
  if (options.reference !== "suffix" && component.scheme) {
5964
+ component.scheme = decodeValidScheme(component.scheme);
5733
5965
  uriTokens.push(component.scheme, ":");
5734
5966
  }
5735
5967
  const authority = recomposeAuthority(component);
@@ -5747,20 +5979,25 @@ var require_fast_uri = __commonJS({
5747
5979
  if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
5748
5980
  s = removeDotSegments(s);
5749
5981
  }
5982
+ if (pathNoScheme) {
5983
+ s = serializePathEncoding(s, true);
5984
+ }
5750
5985
  if (authority === void 0 && s[0] === "/" && s[1] === "/") {
5751
5986
  s = "/%2F" + s.slice(2);
5752
5987
  }
5753
5988
  uriTokens.push(s);
5754
5989
  }
5755
5990
  if (component.query !== void 0) {
5756
- uriTokens.push("?", component.query);
5991
+ uriTokens.push("?", encodeQuery(component.query));
5757
5992
  }
5758
5993
  if (component.fragment !== void 0) {
5759
- uriTokens.push("#", component.fragment);
5994
+ uriTokens.push("#", encodeFragment(component.fragment));
5760
5995
  }
5761
5996
  return uriTokens.join("");
5762
5997
  }
5763
5998
  var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
5999
+ var AUTHORITY_PREFIX = /^(?:[^#/:?]+:)?\/\/([^/?#]*)/;
6000
+ var AUTHORITY_INTRODUCER_REGION = /^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;
5764
6001
  function getParseError(parsed, matches) {
5765
6002
  if (matches[2] !== void 0 && parsed.path && parsed.path[0] !== "/") {
5766
6003
  return 'URI path must start with "/" when authority is present.';
@@ -5770,6 +6007,35 @@ var require_fast_uri = __commonJS({
5770
6007
  }
5771
6008
  return void 0;
5772
6009
  }
6010
+ function hasMalformedPercentEncoding(component) {
6011
+ if (component === void 0) return false;
6012
+ let percent = component.indexOf("%");
6013
+ while (percent !== -1) {
6014
+ if (percent + 2 >= component.length || !/^[\da-f]{2}$/iu.test(component.slice(percent + 1, percent + 3))) {
6015
+ return true;
6016
+ }
6017
+ percent = component.indexOf("%", percent + 3);
6018
+ }
6019
+ return false;
6020
+ }
6021
+ function isIPLiteral(host) {
6022
+ return host[0] === "[" && host[host.length - 1] === "]";
6023
+ }
6024
+ function hasMalformedComponentPercentEncoding(matches) {
6025
+ const host = matches[4];
6026
+ return hasMalformedPercentEncoding(matches[3]) || host !== void 0 && !isIPLiteral(host) && hasMalformedPercentEncoding(host) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]);
6027
+ }
6028
+ function canonicalizeHost(parsed, options, schemeHandler, isIP) {
6029
+ if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
6030
+ try {
6031
+ parsed.host = new URL("http://" + parsed.host).hostname;
6032
+ } catch (e) {
6033
+ parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
6034
+ return true;
6035
+ }
6036
+ }
6037
+ return false;
6038
+ }
5773
6039
  function parseWithStatus(uri, opts) {
5774
6040
  const options = Object.assign({}, opts);
5775
6041
  const parsed = {
@@ -5782,6 +6048,11 @@ var require_fast_uri = __commonJS({
5782
6048
  fragment: void 0
5783
6049
  };
5784
6050
  let malformedAuthorityOrPort = false;
6051
+ let malformedPercentEncoding = false;
6052
+ let malformedSchemeSpecific = false;
6053
+ let malformedHost = false;
6054
+ let malformedIPLiteral = false;
6055
+ let malformedScheme = false;
5785
6056
  let isIP = false;
5786
6057
  if (options.reference === "suffix") {
5787
6058
  if (options.scheme) {
@@ -5790,6 +6061,25 @@ var require_fast_uri = __commonJS({
5790
6061
  uri = "//" + uri;
5791
6062
  }
5792
6063
  }
6064
+ const authorityMatch = uri.match(AUTHORITY_PREFIX);
6065
+ if (authorityMatch !== null && authorityMatch[1].indexOf("\\") !== -1) {
6066
+ parsed.error = "URI authority must not contain a literal backslash.";
6067
+ malformedAuthorityOrPort = true;
6068
+ }
6069
+ const introducerMatch = uri.match(AUTHORITY_INTRODUCER_REGION);
6070
+ if (introducerMatch !== null) {
6071
+ const region = introducerMatch[1];
6072
+ const normalizedRegion = region.replace(/[\t\n\r]/g, "");
6073
+ if (normalizedRegion.length >= 2) {
6074
+ if (normalizedRegion.slice(0, 2) !== "//") {
6075
+ parsed.error = parsed.error || "URI authority must not contain a literal backslash.";
6076
+ malformedAuthorityOrPort = true;
6077
+ } else if (region.length !== normalizedRegion.length) {
6078
+ parsed.error = parsed.error || "URI authority introducer must not contain whitespace.";
6079
+ malformedAuthorityOrPort = true;
6080
+ }
6081
+ }
6082
+ }
5793
6083
  const matches = uri.match(URI_PARSE);
5794
6084
  if (matches) {
5795
6085
  parsed.scheme = matches[1];
@@ -5799,6 +6089,19 @@ var require_fast_uri = __commonJS({
5799
6089
  parsed.path = matches[6] || "";
5800
6090
  parsed.query = matches[7];
5801
6091
  parsed.fragment = matches[8];
6092
+ if (parsed.scheme !== void 0) {
6093
+ const decodedScheme = unescape(parsed.scheme);
6094
+ if (VALID_SCHEME.test(decodedScheme)) {
6095
+ parsed.scheme = decodedScheme.toLowerCase();
6096
+ } else {
6097
+ parsed.error = parsed.error || MALFORMED_SCHEME_ERROR;
6098
+ malformedScheme = true;
6099
+ }
6100
+ }
6101
+ malformedPercentEncoding = hasMalformedComponentPercentEncoding(matches);
6102
+ if (malformedPercentEncoding) {
6103
+ parsed.error = parsed.error || "URI contains malformed percent-encoding.";
6104
+ }
5802
6105
  if (isNaN(parsed.port)) {
5803
6106
  parsed.port = matches[5];
5804
6107
  }
@@ -5810,9 +6113,16 @@ var require_fast_uri = __commonJS({
5810
6113
  if (parsed.host) {
5811
6114
  const ipv4result = isIPv4(parsed.host);
5812
6115
  if (ipv4result === false) {
6116
+ const bracketedIPLiteral = isIPLiteral(parsed.host);
6117
+ const hasIPLiteralBracket = parsed.host.indexOf("[") !== -1 || parsed.host.indexOf("]") !== -1;
5813
6118
  const ipv6result = normalizeIPv6(parsed.host);
5814
- parsed.host = ipv6result.host.toLowerCase();
5815
- isIP = ipv6result.isIPV6;
6119
+ isIP = ipv6result.isIPV6 || ipv6result.isIPVFuture === true;
6120
+ malformedIPLiteral = hasIPLiteralBracket && (!bracketedIPLiteral || ipv6result.error === true);
6121
+ parsed.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase();
6122
+ if (malformedIPLiteral) {
6123
+ parsed.error = parsed.error || "URI host is malformed.";
6124
+ malformedAuthorityOrPort = true;
6125
+ }
5816
6126
  } else {
5817
6127
  isIP = true;
5818
6128
  }
@@ -5830,64 +6140,67 @@ var require_fast_uri = __commonJS({
5830
6140
  parsed.error = parsed.error || "URI is not a " + options.reference + " reference.";
5831
6141
  }
5832
6142
  const schemeHandler = getSchemeHandler(options.scheme || parsed.scheme);
5833
- if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
5834
- if (parsed.host && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
5835
- try {
5836
- parsed.host = URL.domainToASCII(parsed.host.toLowerCase());
5837
- } catch (e) {
5838
- parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
5839
- }
6143
+ if (!malformedIPLiteral) {
6144
+ malformedHost = canonicalizeHost(parsed, options, schemeHandler, isIP);
6145
+ }
6146
+ if (uri.indexOf("%") !== -1 && parsed.host !== void 0 && !malformedIPLiteral) {
6147
+ let host = isIP ? parsed.host : normalizePercentEncoding(parsed.host, true);
6148
+ if (!isIP) {
6149
+ host = normalizePercentEncoding(host.toLowerCase());
5840
6150
  }
6151
+ parsed.host = reescapeHostDelimiters(host, isIP);
5841
6152
  }
5842
6153
  if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
5843
- if (uri.indexOf("%") !== -1) {
5844
- if (parsed.scheme !== void 0) {
5845
- parsed.scheme = unescape(parsed.scheme);
5846
- }
5847
- if (parsed.host !== void 0) {
5848
- parsed.host = reescapeHostDelimiters(unescape(parsed.host), isIP);
5849
- }
5850
- }
5851
6154
  if (parsed.path) {
5852
6155
  parsed.path = normalizePathEncoding(parsed.path);
5853
6156
  }
6157
+ if (parsed.query) {
6158
+ parsed.query = normalizeQueryFragmentEncoding(parsed.query);
6159
+ }
5854
6160
  if (parsed.fragment) {
5855
- try {
5856
- parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
5857
- } catch {
5858
- parsed.error = parsed.error || "URI malformed";
5859
- }
6161
+ parsed.fragment = normalizeQueryFragmentEncoding(parsed.fragment);
5860
6162
  }
5861
6163
  }
5862
6164
  if (schemeHandler && schemeHandler.parse) {
5863
6165
  schemeHandler.parse(parsed, options);
6166
+ if (schemeHandler === SCHEMES.urn && parsed.nid === void 0) {
6167
+ malformedSchemeSpecific = true;
6168
+ }
5864
6169
  }
5865
6170
  } else {
5866
6171
  parsed.error = parsed.error || "URI can not be parsed.";
5867
6172
  }
5868
- return { parsed, malformedAuthorityOrPort };
6173
+ return { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme };
5869
6174
  }
5870
- function parse6(uri, opts) {
6175
+ function parse7(uri, opts) {
5871
6176
  return parseWithStatus(uri, opts).parsed;
5872
6177
  }
5873
6178
  function normalizeString(uri, opts) {
5874
6179
  return normalizeStringWithStatus(uri, opts).normalized;
5875
6180
  }
5876
6181
  function normalizeStringWithStatus(uri, opts) {
5877
- const { parsed, malformedAuthorityOrPort } = parseWithStatus(uri, opts);
6182
+ const { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = parseWithStatus(uri, opts);
5878
6183
  return {
5879
- normalized: malformedAuthorityOrPort ? uri : serialize(parsed, opts),
5880
- malformedAuthorityOrPort
6184
+ normalized: malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? uri : serialize(parsed, opts),
6185
+ malformedAuthorityOrPort,
6186
+ malformedPercentEncoding,
6187
+ malformedSchemeSpecific,
6188
+ malformedHost,
6189
+ malformedScheme
5881
6190
  };
5882
6191
  }
5883
6192
  function normalizeComparableURI(uri, opts) {
5884
- if (typeof uri === "string") {
5885
- const { normalized, malformedAuthorityOrPort } = normalizeStringWithStatus(uri, opts);
5886
- return malformedAuthorityOrPort ? void 0 : normalized;
6193
+ if (typeof uri !== "string" && typeof uri !== "object") {
6194
+ return void 0;
5887
6195
  }
5888
- if (typeof uri === "object") {
5889
- return serialize(uri, opts);
6196
+ let value;
6197
+ try {
6198
+ value = typeof uri === "string" ? uri : serialize(uri, opts);
6199
+ } catch {
6200
+ return void 0;
5890
6201
  }
6202
+ const { normalized, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = normalizeStringWithStatus(value, opts);
6203
+ return malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? void 0 : normalized;
5891
6204
  }
5892
6205
  var fastUri = {
5893
6206
  SCHEMES,
@@ -5896,7 +6209,7 @@ var require_fast_uri = __commonJS({
5896
6209
  resolveComponent,
5897
6210
  equal,
5898
6211
  serialize,
5899
- parse: parse6
6212
+ parse: parse7
5900
6213
  };
5901
6214
  module2.exports = fastUri;
5902
6215
  module2.exports.default = fastUri;
@@ -8868,12 +9181,12 @@ var require_dist = __commonJS({
8868
9181
  throw new Error(`Unknown format "${name}"`);
8869
9182
  return f;
8870
9183
  };
8871
- function addFormats(ajv, list, fs12, exportName) {
9184
+ function addFormats(ajv, list, fs14, exportName) {
8872
9185
  var _a3;
8873
9186
  var _b;
8874
9187
  (_a3 = (_b = ajv.opts.code).formats) !== null && _a3 !== void 0 ? _a3 : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
8875
9188
  for (const f of list)
8876
- ajv.addFormat(f, fs12[f]);
9189
+ ajv.addFormat(f, fs14[f]);
8877
9190
  }
8878
9191
  module2.exports = exports2 = formatsPlugin;
8879
9192
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -8881,6 +9194,110 @@ var require_dist = __commonJS({
8881
9194
  }
8882
9195
  });
8883
9196
 
9197
+ // ../../node_modules/.pnpm/content-type@1.0.5/node_modules/content-type/index.js
9198
+ var require_content_type = __commonJS({
9199
+ "../../node_modules/.pnpm/content-type@1.0.5/node_modules/content-type/index.js"(exports2) {
9200
+ "use strict";
9201
+ var PARAM_REGEXP = /; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g;
9202
+ var TEXT_REGEXP = /^[\u000b\u0020-\u007e\u0080-\u00ff]+$/;
9203
+ var TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
9204
+ var QESC_REGEXP = /\\([\u000b\u0020-\u00ff])/g;
9205
+ var QUOTE_REGEXP = /([\\"])/g;
9206
+ var TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
9207
+ exports2.format = format;
9208
+ exports2.parse = parse7;
9209
+ function format(obj) {
9210
+ if (!obj || typeof obj !== "object") {
9211
+ throw new TypeError("argument obj is required");
9212
+ }
9213
+ var parameters = obj.parameters;
9214
+ var type = obj.type;
9215
+ if (!type || !TYPE_REGEXP.test(type)) {
9216
+ throw new TypeError("invalid type");
9217
+ }
9218
+ var string4 = type;
9219
+ if (parameters && typeof parameters === "object") {
9220
+ var param;
9221
+ var params = Object.keys(parameters).sort();
9222
+ for (var i = 0; i < params.length; i++) {
9223
+ param = params[i];
9224
+ if (!TOKEN_REGEXP.test(param)) {
9225
+ throw new TypeError("invalid parameter name");
9226
+ }
9227
+ string4 += "; " + param + "=" + qstring(parameters[param]);
9228
+ }
9229
+ }
9230
+ return string4;
9231
+ }
9232
+ function parse7(string4) {
9233
+ if (!string4) {
9234
+ throw new TypeError("argument string is required");
9235
+ }
9236
+ var header = typeof string4 === "object" ? getcontenttype(string4) : string4;
9237
+ if (typeof header !== "string") {
9238
+ throw new TypeError("argument string is required to be a string");
9239
+ }
9240
+ var index = header.indexOf(";");
9241
+ var type = index !== -1 ? header.slice(0, index).trim() : header.trim();
9242
+ if (!TYPE_REGEXP.test(type)) {
9243
+ throw new TypeError("invalid media type");
9244
+ }
9245
+ var obj = new ContentType(type.toLowerCase());
9246
+ if (index !== -1) {
9247
+ var key;
9248
+ var match;
9249
+ var value;
9250
+ PARAM_REGEXP.lastIndex = index;
9251
+ while (match = PARAM_REGEXP.exec(header)) {
9252
+ if (match.index !== index) {
9253
+ throw new TypeError("invalid parameter format");
9254
+ }
9255
+ index += match[0].length;
9256
+ key = match[1].toLowerCase();
9257
+ value = match[2];
9258
+ if (value.charCodeAt(0) === 34) {
9259
+ value = value.slice(1, -1);
9260
+ if (value.indexOf("\\") !== -1) {
9261
+ value = value.replace(QESC_REGEXP, "$1");
9262
+ }
9263
+ }
9264
+ obj.parameters[key] = value;
9265
+ }
9266
+ if (index !== header.length) {
9267
+ throw new TypeError("invalid parameter format");
9268
+ }
9269
+ }
9270
+ return obj;
9271
+ }
9272
+ function getcontenttype(obj) {
9273
+ var header;
9274
+ if (typeof obj.getHeader === "function") {
9275
+ header = obj.getHeader("content-type");
9276
+ } else if (typeof obj.headers === "object") {
9277
+ header = obj.headers && obj.headers["content-type"];
9278
+ }
9279
+ if (typeof header !== "string") {
9280
+ throw new TypeError("content-type header is missing from object");
9281
+ }
9282
+ return header;
9283
+ }
9284
+ function qstring(val) {
9285
+ var str = String(val);
9286
+ if (TOKEN_REGEXP.test(str)) {
9287
+ return str;
9288
+ }
9289
+ if (str.length > 0 && !TEXT_REGEXP.test(str)) {
9290
+ throw new TypeError("invalid parameter value");
9291
+ }
9292
+ return '"' + str.replace(QUOTE_REGEXP, "\\$1") + '"';
9293
+ }
9294
+ function ContentType(type) {
9295
+ this.parameters = /* @__PURE__ */ Object.create(null);
9296
+ this.type = type;
9297
+ }
9298
+ }
9299
+ });
9300
+
8884
9301
  // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/internal/constants.js
8885
9302
  var require_constants = __commonJS({
8886
9303
  "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/internal/constants.js"(exports2, module2) {
@@ -9339,7 +9756,7 @@ var require_parse2 = __commonJS({
9339
9756
  "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/parse.js"(exports2, module2) {
9340
9757
  "use strict";
9341
9758
  var SemVer = require_semver();
9342
- var parse6 = (version2, options, throwErrors = false) => {
9759
+ var parse7 = (version2, options, throwErrors = false) => {
9343
9760
  if (version2 instanceof SemVer) {
9344
9761
  return version2;
9345
9762
  }
@@ -9352,7 +9769,7 @@ var require_parse2 = __commonJS({
9352
9769
  throw er;
9353
9770
  }
9354
9771
  };
9355
- module2.exports = parse6;
9772
+ module2.exports = parse7;
9356
9773
  }
9357
9774
  });
9358
9775
 
@@ -9360,9 +9777,9 @@ var require_parse2 = __commonJS({
9360
9777
  var require_valid = __commonJS({
9361
9778
  "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/valid.js"(exports2, module2) {
9362
9779
  "use strict";
9363
- var parse6 = require_parse2();
9780
+ var parse7 = require_parse2();
9364
9781
  var valid = (version2, options) => {
9365
- const v = parse6(version2, options);
9782
+ const v = parse7(version2, options);
9366
9783
  return v ? v.version : null;
9367
9784
  };
9368
9785
  module2.exports = valid;
@@ -9373,9 +9790,9 @@ var require_valid = __commonJS({
9373
9790
  var require_clean = __commonJS({
9374
9791
  "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/clean.js"(exports2, module2) {
9375
9792
  "use strict";
9376
- var parse6 = require_parse2();
9793
+ var parse7 = require_parse2();
9377
9794
  var clean = (version2, options) => {
9378
- const s = parse6(version2.trim().replace(/^[=v]+/, ""), options);
9795
+ const s = parse7(version2.trim().replace(/^[=v]+/, ""), options);
9379
9796
  return s ? s.version : null;
9380
9797
  };
9381
9798
  module2.exports = clean;
@@ -9410,10 +9827,10 @@ var require_inc = __commonJS({
9410
9827
  var require_diff = __commonJS({
9411
9828
  "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/diff.js"(exports2, module2) {
9412
9829
  "use strict";
9413
- var parse6 = require_parse2();
9830
+ var parse7 = require_parse2();
9414
9831
  var diff = (version1, version2) => {
9415
- const v1 = parse6(version1, null, true);
9416
- const v2 = parse6(version2, null, true);
9832
+ const v1 = parse7(version1, null, true);
9833
+ const v2 = parse7(version2, null, true);
9417
9834
  const comparison = v1.compare(v2);
9418
9835
  if (comparison === 0) {
9419
9836
  return null;
@@ -9484,9 +9901,9 @@ var require_patch = __commonJS({
9484
9901
  var require_prerelease = __commonJS({
9485
9902
  "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/prerelease.js"(exports2, module2) {
9486
9903
  "use strict";
9487
- var parse6 = require_parse2();
9904
+ var parse7 = require_parse2();
9488
9905
  var prerelease = (version2, options) => {
9489
- const parsed = parse6(version2, options);
9906
+ const parsed = parse7(version2, options);
9490
9907
  return parsed && parsed.prerelease.length ? parsed.prerelease : null;
9491
9908
  };
9492
9909
  module2.exports = prerelease;
@@ -9672,7 +10089,7 @@ var require_coerce = __commonJS({
9672
10089
  "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/coerce.js"(exports2, module2) {
9673
10090
  "use strict";
9674
10091
  var SemVer = require_semver();
9675
- var parse6 = require_parse2();
10092
+ var parse7 = require_parse2();
9676
10093
  var { safeRe: re, t } = require_re();
9677
10094
  var coerce = (version2, options) => {
9678
10095
  if (version2 instanceof SemVer) {
@@ -9707,7 +10124,7 @@ var require_coerce = __commonJS({
9707
10124
  const patch = match[4] || "0";
9708
10125
  const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : "";
9709
10126
  const build = options.includePrerelease && match[6] ? `+${match[6]}` : "";
9710
- return parse6(`${major}.${minor}.${patch}${prerelease}${build}`, options);
10127
+ return parse7(`${major}.${minor}.${patch}${prerelease}${build}`, options);
9711
10128
  };
9712
10129
  module2.exports = coerce;
9713
10130
  }
@@ -9717,7 +10134,7 @@ var require_coerce = __commonJS({
9717
10134
  var require_truncate = __commonJS({
9718
10135
  "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/truncate.js"(exports2, module2) {
9719
10136
  "use strict";
9720
- var parse6 = require_parse2();
10137
+ var parse7 = require_parse2();
9721
10138
  var constants2 = require_constants();
9722
10139
  var SemVer = require_semver();
9723
10140
  var truncate3 = (version2, truncation, options) => {
@@ -9729,7 +10146,7 @@ var require_truncate = __commonJS({
9729
10146
  };
9730
10147
  var cloneInputVersion = (version2, options) => {
9731
10148
  const versionStringToParse = version2 instanceof SemVer ? version2.version : version2;
9732
- return parse6(versionStringToParse, options);
10149
+ return parse7(versionStringToParse, options);
9733
10150
  };
9734
10151
  var doTruncation = (version2, truncation) => {
9735
10152
  if (isPrerelease(truncation)) {
@@ -10765,7 +11182,7 @@ var require_semver2 = __commonJS({
10765
11182
  var constants2 = require_constants();
10766
11183
  var SemVer = require_semver();
10767
11184
  var identifiers = require_identifiers();
10768
- var parse6 = require_parse2();
11185
+ var parse7 = require_parse2();
10769
11186
  var valid = require_valid();
10770
11187
  var clean = require_clean();
10771
11188
  var inc = require_inc();
@@ -10804,7 +11221,7 @@ var require_semver2 = __commonJS({
10804
11221
  var simplifyRange = require_simplify();
10805
11222
  var subset = require_subset();
10806
11223
  module2.exports = {
10807
- parse: parse6,
11224
+ parse: parse7,
10808
11225
  valid,
10809
11226
  clean,
10810
11227
  inc,
@@ -12949,7 +13366,7 @@ var require_extension = __commonJS({
12949
13366
  if (dest[name] === void 0) dest[name] = [elem];
12950
13367
  else dest[name].push(elem);
12951
13368
  }
12952
- function parse6(header) {
13369
+ function parse7(header) {
12953
13370
  const offers = /* @__PURE__ */ Object.create(null);
12954
13371
  let params = /* @__PURE__ */ Object.create(null);
12955
13372
  let mustUnescape = false;
@@ -13089,7 +13506,7 @@ var require_extension = __commonJS({
13089
13506
  }).join(", ");
13090
13507
  }).join(", ");
13091
13508
  }
13092
- module2.exports = { format, parse: parse6 };
13509
+ module2.exports = { format, parse: parse7 };
13093
13510
  }
13094
13511
  });
13095
13512
 
@@ -13123,7 +13540,7 @@ var require_websocket = __commonJS({
13123
13540
  var {
13124
13541
  EventTarget: { addEventListener, removeEventListener }
13125
13542
  } = require_event_target();
13126
- var { format, parse: parse6 } = require_extension();
13543
+ var { format, parse: parse7 } = require_extension();
13127
13544
  var { toBuffer } = require_buffer_util();
13128
13545
  var kAborted = Symbol("kAborted");
13129
13546
  var protocolVersions = [8, 13];
@@ -13800,7 +14217,7 @@ var require_websocket = __commonJS({
13800
14217
  }
13801
14218
  let extensions;
13802
14219
  try {
13803
- extensions = parse6(secWebSocketExtensions);
14220
+ extensions = parse7(secWebSocketExtensions);
13804
14221
  } catch (err) {
13805
14222
  const message = "Invalid Sec-WebSocket-Extensions header";
13806
14223
  abortHandshake(websocket, socket, message);
@@ -14092,7 +14509,7 @@ var require_subprotocol = __commonJS({
14092
14509
  "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/subprotocol.js"(exports2, module2) {
14093
14510
  "use strict";
14094
14511
  var { tokenChars } = require_validation2();
14095
- function parse6(header) {
14512
+ function parse7(header) {
14096
14513
  const protocols = /* @__PURE__ */ new Set();
14097
14514
  let start = -1;
14098
14515
  let end = -1;
@@ -14128,7 +14545,7 @@ var require_subprotocol = __commonJS({
14128
14545
  protocols.add(protocol);
14129
14546
  return protocols;
14130
14547
  }
14131
- module2.exports = { parse: parse6 };
14548
+ module2.exports = { parse: parse7 };
14132
14549
  }
14133
14550
  });
14134
14551
 
@@ -14559,54 +14976,54 @@ var require_polyfills = __commonJS({
14559
14976
  }
14560
14977
  var chdir;
14561
14978
  module2.exports = patch;
14562
- function patch(fs12) {
14979
+ function patch(fs14) {
14563
14980
  if (constants2.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
14564
- patchLchmod(fs12);
14565
- }
14566
- if (!fs12.lutimes) {
14567
- patchLutimes(fs12);
14568
- }
14569
- fs12.chown = chownFix(fs12.chown);
14570
- fs12.fchown = chownFix(fs12.fchown);
14571
- fs12.lchown = chownFix(fs12.lchown);
14572
- fs12.chmod = chmodFix(fs12.chmod);
14573
- fs12.fchmod = chmodFix(fs12.fchmod);
14574
- fs12.lchmod = chmodFix(fs12.lchmod);
14575
- fs12.chownSync = chownFixSync(fs12.chownSync);
14576
- fs12.fchownSync = chownFixSync(fs12.fchownSync);
14577
- fs12.lchownSync = chownFixSync(fs12.lchownSync);
14578
- fs12.chmodSync = chmodFixSync(fs12.chmodSync);
14579
- fs12.fchmodSync = chmodFixSync(fs12.fchmodSync);
14580
- fs12.lchmodSync = chmodFixSync(fs12.lchmodSync);
14581
- fs12.stat = statFix(fs12.stat);
14582
- fs12.fstat = statFix(fs12.fstat);
14583
- fs12.lstat = statFix(fs12.lstat);
14584
- fs12.statSync = statFixSync(fs12.statSync);
14585
- fs12.fstatSync = statFixSync(fs12.fstatSync);
14586
- fs12.lstatSync = statFixSync(fs12.lstatSync);
14587
- if (fs12.chmod && !fs12.lchmod) {
14588
- fs12.lchmod = function(path26, mode, cb) {
14981
+ patchLchmod(fs14);
14982
+ }
14983
+ if (!fs14.lutimes) {
14984
+ patchLutimes(fs14);
14985
+ }
14986
+ fs14.chown = chownFix(fs14.chown);
14987
+ fs14.fchown = chownFix(fs14.fchown);
14988
+ fs14.lchown = chownFix(fs14.lchown);
14989
+ fs14.chmod = chmodFix(fs14.chmod);
14990
+ fs14.fchmod = chmodFix(fs14.fchmod);
14991
+ fs14.lchmod = chmodFix(fs14.lchmod);
14992
+ fs14.chownSync = chownFixSync(fs14.chownSync);
14993
+ fs14.fchownSync = chownFixSync(fs14.fchownSync);
14994
+ fs14.lchownSync = chownFixSync(fs14.lchownSync);
14995
+ fs14.chmodSync = chmodFixSync(fs14.chmodSync);
14996
+ fs14.fchmodSync = chmodFixSync(fs14.fchmodSync);
14997
+ fs14.lchmodSync = chmodFixSync(fs14.lchmodSync);
14998
+ fs14.stat = statFix(fs14.stat);
14999
+ fs14.fstat = statFix(fs14.fstat);
15000
+ fs14.lstat = statFix(fs14.lstat);
15001
+ fs14.statSync = statFixSync(fs14.statSync);
15002
+ fs14.fstatSync = statFixSync(fs14.fstatSync);
15003
+ fs14.lstatSync = statFixSync(fs14.lstatSync);
15004
+ if (fs14.chmod && !fs14.lchmod) {
15005
+ fs14.lchmod = function(path28, mode, cb) {
14589
15006
  if (cb) process.nextTick(cb);
14590
15007
  };
14591
- fs12.lchmodSync = function() {
15008
+ fs14.lchmodSync = function() {
14592
15009
  };
14593
15010
  }
14594
- if (fs12.chown && !fs12.lchown) {
14595
- fs12.lchown = function(path26, uid, gid, cb) {
15011
+ if (fs14.chown && !fs14.lchown) {
15012
+ fs14.lchown = function(path28, uid, gid, cb) {
14596
15013
  if (cb) process.nextTick(cb);
14597
15014
  };
14598
- fs12.lchownSync = function() {
15015
+ fs14.lchownSync = function() {
14599
15016
  };
14600
15017
  }
14601
15018
  if (platform === "win32") {
14602
- fs12.rename = typeof fs12.rename !== "function" ? fs12.rename : function(fs$rename) {
15019
+ fs14.rename = typeof fs14.rename !== "function" ? fs14.rename : function(fs$rename) {
14603
15020
  function rename4(from, to, cb) {
14604
15021
  var start = Date.now();
14605
15022
  var backoff = 0;
14606
15023
  fs$rename(from, to, function CB(er) {
14607
15024
  if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
14608
15025
  setTimeout(function() {
14609
- fs12.stat(to, function(stater, st) {
15026
+ fs14.stat(to, function(stater, st) {
14610
15027
  if (stater && stater.code === "ENOENT")
14611
15028
  fs$rename(from, to, CB);
14612
15029
  else
@@ -14622,9 +15039,9 @@ var require_polyfills = __commonJS({
14622
15039
  }
14623
15040
  if (Object.setPrototypeOf) Object.setPrototypeOf(rename4, fs$rename);
14624
15041
  return rename4;
14625
- }(fs12.rename);
15042
+ }(fs14.rename);
14626
15043
  }
14627
- fs12.read = typeof fs12.read !== "function" ? fs12.read : function(fs$read) {
15044
+ fs14.read = typeof fs14.read !== "function" ? fs14.read : function(fs$read) {
14628
15045
  function read(fd, buffer, offset, length, position, callback_) {
14629
15046
  var callback;
14630
15047
  if (callback_ && typeof callback_ === "function") {
@@ -14632,22 +15049,22 @@ var require_polyfills = __commonJS({
14632
15049
  callback = function(er, _, __) {
14633
15050
  if (er && er.code === "EAGAIN" && eagCounter < 10) {
14634
15051
  eagCounter++;
14635
- return fs$read.call(fs12, fd, buffer, offset, length, position, callback);
15052
+ return fs$read.call(fs14, fd, buffer, offset, length, position, callback);
14636
15053
  }
14637
15054
  callback_.apply(this, arguments);
14638
15055
  };
14639
15056
  }
14640
- return fs$read.call(fs12, fd, buffer, offset, length, position, callback);
15057
+ return fs$read.call(fs14, fd, buffer, offset, length, position, callback);
14641
15058
  }
14642
15059
  if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
14643
15060
  return read;
14644
- }(fs12.read);
14645
- fs12.readSync = typeof fs12.readSync !== "function" ? fs12.readSync : /* @__PURE__ */ function(fs$readSync) {
15061
+ }(fs14.read);
15062
+ fs14.readSync = typeof fs14.readSync !== "function" ? fs14.readSync : /* @__PURE__ */ function(fs$readSync) {
14646
15063
  return function(fd, buffer, offset, length, position) {
14647
15064
  var eagCounter = 0;
14648
15065
  while (true) {
14649
15066
  try {
14650
- return fs$readSync.call(fs12, fd, buffer, offset, length, position);
15067
+ return fs$readSync.call(fs14, fd, buffer, offset, length, position);
14651
15068
  } catch (er) {
14652
15069
  if (er.code === "EAGAIN" && eagCounter < 10) {
14653
15070
  eagCounter++;
@@ -14657,11 +15074,11 @@ var require_polyfills = __commonJS({
14657
15074
  }
14658
15075
  }
14659
15076
  };
14660
- }(fs12.readSync);
14661
- function patchLchmod(fs13) {
14662
- fs13.lchmod = function(path26, mode, callback) {
14663
- fs13.open(
14664
- path26,
15077
+ }(fs14.readSync);
15078
+ function patchLchmod(fs15) {
15079
+ fs15.lchmod = function(path28, mode, callback) {
15080
+ fs15.open(
15081
+ path28,
14665
15082
  constants2.O_WRONLY | constants2.O_SYMLINK,
14666
15083
  mode,
14667
15084
  function(err, fd) {
@@ -14669,80 +15086,80 @@ var require_polyfills = __commonJS({
14669
15086
  if (callback) callback(err);
14670
15087
  return;
14671
15088
  }
14672
- fs13.fchmod(fd, mode, function(err2) {
14673
- fs13.close(fd, function(err22) {
15089
+ fs15.fchmod(fd, mode, function(err2) {
15090
+ fs15.close(fd, function(err22) {
14674
15091
  if (callback) callback(err2 || err22);
14675
15092
  });
14676
15093
  });
14677
15094
  }
14678
15095
  );
14679
15096
  };
14680
- fs13.lchmodSync = function(path26, mode) {
14681
- var fd = fs13.openSync(path26, constants2.O_WRONLY | constants2.O_SYMLINK, mode);
15097
+ fs15.lchmodSync = function(path28, mode) {
15098
+ var fd = fs15.openSync(path28, constants2.O_WRONLY | constants2.O_SYMLINK, mode);
14682
15099
  var threw = true;
14683
15100
  var ret;
14684
15101
  try {
14685
- ret = fs13.fchmodSync(fd, mode);
15102
+ ret = fs15.fchmodSync(fd, mode);
14686
15103
  threw = false;
14687
15104
  } finally {
14688
15105
  if (threw) {
14689
15106
  try {
14690
- fs13.closeSync(fd);
15107
+ fs15.closeSync(fd);
14691
15108
  } catch (er) {
14692
15109
  }
14693
15110
  } else {
14694
- fs13.closeSync(fd);
15111
+ fs15.closeSync(fd);
14695
15112
  }
14696
15113
  }
14697
15114
  return ret;
14698
15115
  };
14699
15116
  }
14700
- function patchLutimes(fs13) {
14701
- if (constants2.hasOwnProperty("O_SYMLINK") && fs13.futimes) {
14702
- fs13.lutimes = function(path26, at, mt, cb) {
14703
- fs13.open(path26, constants2.O_SYMLINK, function(er, fd) {
15117
+ function patchLutimes(fs15) {
15118
+ if (constants2.hasOwnProperty("O_SYMLINK") && fs15.futimes) {
15119
+ fs15.lutimes = function(path28, at, mt, cb) {
15120
+ fs15.open(path28, constants2.O_SYMLINK, function(er, fd) {
14704
15121
  if (er) {
14705
15122
  if (cb) cb(er);
14706
15123
  return;
14707
15124
  }
14708
- fs13.futimes(fd, at, mt, function(er2) {
14709
- fs13.close(fd, function(er22) {
15125
+ fs15.futimes(fd, at, mt, function(er2) {
15126
+ fs15.close(fd, function(er22) {
14710
15127
  if (cb) cb(er2 || er22);
14711
15128
  });
14712
15129
  });
14713
15130
  });
14714
15131
  };
14715
- fs13.lutimesSync = function(path26, at, mt) {
14716
- var fd = fs13.openSync(path26, constants2.O_SYMLINK);
15132
+ fs15.lutimesSync = function(path28, at, mt) {
15133
+ var fd = fs15.openSync(path28, constants2.O_SYMLINK);
14717
15134
  var ret;
14718
15135
  var threw = true;
14719
15136
  try {
14720
- ret = fs13.futimesSync(fd, at, mt);
15137
+ ret = fs15.futimesSync(fd, at, mt);
14721
15138
  threw = false;
14722
15139
  } finally {
14723
15140
  if (threw) {
14724
15141
  try {
14725
- fs13.closeSync(fd);
15142
+ fs15.closeSync(fd);
14726
15143
  } catch (er) {
14727
15144
  }
14728
15145
  } else {
14729
- fs13.closeSync(fd);
15146
+ fs15.closeSync(fd);
14730
15147
  }
14731
15148
  }
14732
15149
  return ret;
14733
15150
  };
14734
- } else if (fs13.futimes) {
14735
- fs13.lutimes = function(_a3, _b, _c, cb) {
15151
+ } else if (fs15.futimes) {
15152
+ fs15.lutimes = function(_a3, _b, _c, cb) {
14736
15153
  if (cb) process.nextTick(cb);
14737
15154
  };
14738
- fs13.lutimesSync = function() {
15155
+ fs15.lutimesSync = function() {
14739
15156
  };
14740
15157
  }
14741
15158
  }
14742
15159
  function chmodFix(orig) {
14743
15160
  if (!orig) return orig;
14744
15161
  return function(target, mode, cb) {
14745
- return orig.call(fs12, target, mode, function(er) {
15162
+ return orig.call(fs14, target, mode, function(er) {
14746
15163
  if (chownErOk(er)) er = null;
14747
15164
  if (cb) cb.apply(this, arguments);
14748
15165
  });
@@ -14752,7 +15169,7 @@ var require_polyfills = __commonJS({
14752
15169
  if (!orig) return orig;
14753
15170
  return function(target, mode) {
14754
15171
  try {
14755
- return orig.call(fs12, target, mode);
15172
+ return orig.call(fs14, target, mode);
14756
15173
  } catch (er) {
14757
15174
  if (!chownErOk(er)) throw er;
14758
15175
  }
@@ -14761,7 +15178,7 @@ var require_polyfills = __commonJS({
14761
15178
  function chownFix(orig) {
14762
15179
  if (!orig) return orig;
14763
15180
  return function(target, uid, gid, cb) {
14764
- return orig.call(fs12, target, uid, gid, function(er) {
15181
+ return orig.call(fs14, target, uid, gid, function(er) {
14765
15182
  if (chownErOk(er)) er = null;
14766
15183
  if (cb) cb.apply(this, arguments);
14767
15184
  });
@@ -14771,7 +15188,7 @@ var require_polyfills = __commonJS({
14771
15188
  if (!orig) return orig;
14772
15189
  return function(target, uid, gid) {
14773
15190
  try {
14774
- return orig.call(fs12, target, uid, gid);
15191
+ return orig.call(fs14, target, uid, gid);
14775
15192
  } catch (er) {
14776
15193
  if (!chownErOk(er)) throw er;
14777
15194
  }
@@ -14791,13 +15208,13 @@ var require_polyfills = __commonJS({
14791
15208
  }
14792
15209
  if (cb) cb.apply(this, arguments);
14793
15210
  }
14794
- return options ? orig.call(fs12, target, options, callback) : orig.call(fs12, target, callback);
15211
+ return options ? orig.call(fs14, target, options, callback) : orig.call(fs14, target, callback);
14795
15212
  };
14796
15213
  }
14797
15214
  function statFixSync(orig) {
14798
15215
  if (!orig) return orig;
14799
15216
  return function(target, options) {
14800
- var stats = options ? orig.call(fs12, target, options) : orig.call(fs12, target);
15217
+ var stats = options ? orig.call(fs14, target, options) : orig.call(fs14, target);
14801
15218
  if (stats) {
14802
15219
  if (stats.uid < 0) stats.uid += 4294967296;
14803
15220
  if (stats.gid < 0) stats.gid += 4294967296;
@@ -14826,16 +15243,16 @@ var require_legacy_streams = __commonJS({
14826
15243
  "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js"(exports2, module2) {
14827
15244
  var Stream = require("stream").Stream;
14828
15245
  module2.exports = legacy;
14829
- function legacy(fs12) {
15246
+ function legacy(fs14) {
14830
15247
  return {
14831
15248
  ReadStream,
14832
15249
  WriteStream
14833
15250
  };
14834
- function ReadStream(path26, options) {
14835
- if (!(this instanceof ReadStream)) return new ReadStream(path26, options);
15251
+ function ReadStream(path28, options) {
15252
+ if (!(this instanceof ReadStream)) return new ReadStream(path28, options);
14836
15253
  Stream.call(this);
14837
15254
  var self = this;
14838
- this.path = path26;
15255
+ this.path = path28;
14839
15256
  this.fd = null;
14840
15257
  this.readable = true;
14841
15258
  this.paused = false;
@@ -14869,7 +15286,7 @@ var require_legacy_streams = __commonJS({
14869
15286
  });
14870
15287
  return;
14871
15288
  }
14872
- fs12.open(this.path, this.flags, this.mode, function(err, fd) {
15289
+ fs14.open(this.path, this.flags, this.mode, function(err, fd) {
14873
15290
  if (err) {
14874
15291
  self.emit("error", err);
14875
15292
  self.readable = false;
@@ -14880,10 +15297,10 @@ var require_legacy_streams = __commonJS({
14880
15297
  self._read();
14881
15298
  });
14882
15299
  }
14883
- function WriteStream(path26, options) {
14884
- if (!(this instanceof WriteStream)) return new WriteStream(path26, options);
15300
+ function WriteStream(path28, options) {
15301
+ if (!(this instanceof WriteStream)) return new WriteStream(path28, options);
14885
15302
  Stream.call(this);
14886
- this.path = path26;
15303
+ this.path = path28;
14887
15304
  this.fd = null;
14888
15305
  this.writable = true;
14889
15306
  this.flags = "w";
@@ -14908,7 +15325,7 @@ var require_legacy_streams = __commonJS({
14908
15325
  this.busy = false;
14909
15326
  this._queue = [];
14910
15327
  if (this.fd === null) {
14911
- this._open = fs12.open;
15328
+ this._open = fs14.open;
14912
15329
  this._queue.push([this._open, this.path, this.flags, this.mode, void 0]);
14913
15330
  this.flush();
14914
15331
  }
@@ -14943,7 +15360,7 @@ var require_clone = __commonJS({
14943
15360
  // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js
14944
15361
  var require_graceful_fs = __commonJS({
14945
15362
  "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js"(exports2, module2) {
14946
- var fs12 = require("fs");
15363
+ var fs14 = require("fs");
14947
15364
  var polyfills = require_polyfills();
14948
15365
  var legacy = require_legacy_streams();
14949
15366
  var clone2 = require_clone();
@@ -14975,12 +15392,12 @@ var require_graceful_fs = __commonJS({
14975
15392
  m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
14976
15393
  console.error(m);
14977
15394
  };
14978
- if (!fs12[gracefulQueue]) {
15395
+ if (!fs14[gracefulQueue]) {
14979
15396
  queue = global[gracefulQueue] || [];
14980
- publishQueue(fs12, queue);
14981
- fs12.close = function(fs$close) {
15397
+ publishQueue(fs14, queue);
15398
+ fs14.close = function(fs$close) {
14982
15399
  function close(fd, cb) {
14983
- return fs$close.call(fs12, fd, function(err) {
15400
+ return fs$close.call(fs14, fd, function(err) {
14984
15401
  if (!err) {
14985
15402
  resetQueue();
14986
15403
  }
@@ -14992,48 +15409,48 @@ var require_graceful_fs = __commonJS({
14992
15409
  value: fs$close
14993
15410
  });
14994
15411
  return close;
14995
- }(fs12.close);
14996
- fs12.closeSync = function(fs$closeSync) {
15412
+ }(fs14.close);
15413
+ fs14.closeSync = function(fs$closeSync) {
14997
15414
  function closeSync(fd) {
14998
- fs$closeSync.apply(fs12, arguments);
15415
+ fs$closeSync.apply(fs14, arguments);
14999
15416
  resetQueue();
15000
15417
  }
15001
15418
  Object.defineProperty(closeSync, previousSymbol, {
15002
15419
  value: fs$closeSync
15003
15420
  });
15004
15421
  return closeSync;
15005
- }(fs12.closeSync);
15422
+ }(fs14.closeSync);
15006
15423
  if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
15007
15424
  process.on("exit", function() {
15008
- debug(fs12[gracefulQueue]);
15009
- require("assert").equal(fs12[gracefulQueue].length, 0);
15425
+ debug(fs14[gracefulQueue]);
15426
+ require("assert").equal(fs14[gracefulQueue].length, 0);
15010
15427
  });
15011
15428
  }
15012
15429
  }
15013
15430
  var queue;
15014
15431
  if (!global[gracefulQueue]) {
15015
- publishQueue(global, fs12[gracefulQueue]);
15016
- }
15017
- module2.exports = patch(clone2(fs12));
15018
- if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs12.__patched) {
15019
- module2.exports = patch(fs12);
15020
- fs12.__patched = true;
15021
- }
15022
- function patch(fs13) {
15023
- polyfills(fs13);
15024
- fs13.gracefulify = patch;
15025
- fs13.createReadStream = createReadStream2;
15026
- fs13.createWriteStream = createWriteStream;
15027
- var fs$readFile = fs13.readFile;
15028
- fs13.readFile = readFile9;
15029
- function readFile9(path26, options, cb) {
15432
+ publishQueue(global, fs14[gracefulQueue]);
15433
+ }
15434
+ module2.exports = patch(clone2(fs14));
15435
+ if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs14.__patched) {
15436
+ module2.exports = patch(fs14);
15437
+ fs14.__patched = true;
15438
+ }
15439
+ function patch(fs15) {
15440
+ polyfills(fs15);
15441
+ fs15.gracefulify = patch;
15442
+ fs15.createReadStream = createReadStream2;
15443
+ fs15.createWriteStream = createWriteStream;
15444
+ var fs$readFile = fs15.readFile;
15445
+ fs15.readFile = readFile9;
15446
+ function readFile9(path28, options, cb) {
15030
15447
  if (typeof options === "function")
15031
15448
  cb = options, options = null;
15032
- return go$readFile(path26, options, cb);
15033
- function go$readFile(path27, options2, cb2, startTime) {
15034
- return fs$readFile(path27, options2, function(err) {
15449
+ return go$readFile(path28, options, cb);
15450
+ function go$readFile(path29, options2, cb2, startTime) {
15451
+ return fs$readFile(path29, options2, function(err) {
15035
15452
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
15036
- enqueue([go$readFile, [path27, options2, cb2], err, startTime || Date.now(), Date.now()]);
15453
+ enqueue([go$readFile, [path29, options2, cb2], err, startTime || Date.now(), Date.now()]);
15037
15454
  else {
15038
15455
  if (typeof cb2 === "function")
15039
15456
  cb2.apply(this, arguments);
@@ -15041,16 +15458,16 @@ var require_graceful_fs = __commonJS({
15041
15458
  });
15042
15459
  }
15043
15460
  }
15044
- var fs$writeFile = fs13.writeFile;
15045
- fs13.writeFile = writeFile5;
15046
- function writeFile5(path26, data, options, cb) {
15461
+ var fs$writeFile = fs15.writeFile;
15462
+ fs15.writeFile = writeFile5;
15463
+ function writeFile5(path28, data, options, cb) {
15047
15464
  if (typeof options === "function")
15048
15465
  cb = options, options = null;
15049
- return go$writeFile(path26, data, options, cb);
15050
- function go$writeFile(path27, data2, options2, cb2, startTime) {
15051
- return fs$writeFile(path27, data2, options2, function(err) {
15466
+ return go$writeFile(path28, data, options, cb);
15467
+ function go$writeFile(path29, data2, options2, cb2, startTime) {
15468
+ return fs$writeFile(path29, data2, options2, function(err) {
15052
15469
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
15053
- enqueue([go$writeFile, [path27, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
15470
+ enqueue([go$writeFile, [path29, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
15054
15471
  else {
15055
15472
  if (typeof cb2 === "function")
15056
15473
  cb2.apply(this, arguments);
@@ -15058,17 +15475,17 @@ var require_graceful_fs = __commonJS({
15058
15475
  });
15059
15476
  }
15060
15477
  }
15061
- var fs$appendFile = fs13.appendFile;
15478
+ var fs$appendFile = fs15.appendFile;
15062
15479
  if (fs$appendFile)
15063
- fs13.appendFile = appendFile2;
15064
- function appendFile2(path26, data, options, cb) {
15480
+ fs15.appendFile = appendFile2;
15481
+ function appendFile2(path28, data, options, cb) {
15065
15482
  if (typeof options === "function")
15066
15483
  cb = options, options = null;
15067
- return go$appendFile(path26, data, options, cb);
15068
- function go$appendFile(path27, data2, options2, cb2, startTime) {
15069
- return fs$appendFile(path27, data2, options2, function(err) {
15484
+ return go$appendFile(path28, data, options, cb);
15485
+ function go$appendFile(path29, data2, options2, cb2, startTime) {
15486
+ return fs$appendFile(path29, data2, options2, function(err) {
15070
15487
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
15071
- enqueue([go$appendFile, [path27, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
15488
+ enqueue([go$appendFile, [path29, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
15072
15489
  else {
15073
15490
  if (typeof cb2 === "function")
15074
15491
  cb2.apply(this, arguments);
@@ -15076,9 +15493,9 @@ var require_graceful_fs = __commonJS({
15076
15493
  });
15077
15494
  }
15078
15495
  }
15079
- var fs$copyFile = fs13.copyFile;
15496
+ var fs$copyFile = fs15.copyFile;
15080
15497
  if (fs$copyFile)
15081
- fs13.copyFile = copyFile;
15498
+ fs15.copyFile = copyFile;
15082
15499
  function copyFile(src, dest, flags, cb) {
15083
15500
  if (typeof flags === "function") {
15084
15501
  cb = flags;
@@ -15096,34 +15513,34 @@ var require_graceful_fs = __commonJS({
15096
15513
  });
15097
15514
  }
15098
15515
  }
15099
- var fs$readdir = fs13.readdir;
15100
- fs13.readdir = readdir5;
15516
+ var fs$readdir = fs15.readdir;
15517
+ fs15.readdir = readdir5;
15101
15518
  var noReaddirOptionVersions = /^v[0-5]\./;
15102
- function readdir5(path26, options, cb) {
15519
+ function readdir5(path28, options, cb) {
15103
15520
  if (typeof options === "function")
15104
15521
  cb = options, options = null;
15105
- var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path27, options2, cb2, startTime) {
15106
- return fs$readdir(path27, fs$readdirCallback(
15107
- path27,
15522
+ var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path29, options2, cb2, startTime) {
15523
+ return fs$readdir(path29, fs$readdirCallback(
15524
+ path29,
15108
15525
  options2,
15109
15526
  cb2,
15110
15527
  startTime
15111
15528
  ));
15112
- } : function go$readdir2(path27, options2, cb2, startTime) {
15113
- return fs$readdir(path27, options2, fs$readdirCallback(
15114
- path27,
15529
+ } : function go$readdir2(path29, options2, cb2, startTime) {
15530
+ return fs$readdir(path29, options2, fs$readdirCallback(
15531
+ path29,
15115
15532
  options2,
15116
15533
  cb2,
15117
15534
  startTime
15118
15535
  ));
15119
15536
  };
15120
- return go$readdir(path26, options, cb);
15121
- function fs$readdirCallback(path27, options2, cb2, startTime) {
15537
+ return go$readdir(path28, options, cb);
15538
+ function fs$readdirCallback(path29, options2, cb2, startTime) {
15122
15539
  return function(err, files) {
15123
15540
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
15124
15541
  enqueue([
15125
15542
  go$readdir,
15126
- [path27, options2, cb2],
15543
+ [path29, options2, cb2],
15127
15544
  err,
15128
15545
  startTime || Date.now(),
15129
15546
  Date.now()
@@ -15138,21 +15555,21 @@ var require_graceful_fs = __commonJS({
15138
15555
  }
15139
15556
  }
15140
15557
  if (process.version.substr(0, 4) === "v0.8") {
15141
- var legStreams = legacy(fs13);
15558
+ var legStreams = legacy(fs15);
15142
15559
  ReadStream = legStreams.ReadStream;
15143
15560
  WriteStream = legStreams.WriteStream;
15144
15561
  }
15145
- var fs$ReadStream = fs13.ReadStream;
15562
+ var fs$ReadStream = fs15.ReadStream;
15146
15563
  if (fs$ReadStream) {
15147
15564
  ReadStream.prototype = Object.create(fs$ReadStream.prototype);
15148
15565
  ReadStream.prototype.open = ReadStream$open;
15149
15566
  }
15150
- var fs$WriteStream = fs13.WriteStream;
15567
+ var fs$WriteStream = fs15.WriteStream;
15151
15568
  if (fs$WriteStream) {
15152
15569
  WriteStream.prototype = Object.create(fs$WriteStream.prototype);
15153
15570
  WriteStream.prototype.open = WriteStream$open;
15154
15571
  }
15155
- Object.defineProperty(fs13, "ReadStream", {
15572
+ Object.defineProperty(fs15, "ReadStream", {
15156
15573
  get: function() {
15157
15574
  return ReadStream;
15158
15575
  },
@@ -15162,7 +15579,7 @@ var require_graceful_fs = __commonJS({
15162
15579
  enumerable: true,
15163
15580
  configurable: true
15164
15581
  });
15165
- Object.defineProperty(fs13, "WriteStream", {
15582
+ Object.defineProperty(fs15, "WriteStream", {
15166
15583
  get: function() {
15167
15584
  return WriteStream;
15168
15585
  },
@@ -15173,7 +15590,7 @@ var require_graceful_fs = __commonJS({
15173
15590
  configurable: true
15174
15591
  });
15175
15592
  var FileReadStream = ReadStream;
15176
- Object.defineProperty(fs13, "FileReadStream", {
15593
+ Object.defineProperty(fs15, "FileReadStream", {
15177
15594
  get: function() {
15178
15595
  return FileReadStream;
15179
15596
  },
@@ -15184,7 +15601,7 @@ var require_graceful_fs = __commonJS({
15184
15601
  configurable: true
15185
15602
  });
15186
15603
  var FileWriteStream = WriteStream;
15187
- Object.defineProperty(fs13, "FileWriteStream", {
15604
+ Object.defineProperty(fs15, "FileWriteStream", {
15188
15605
  get: function() {
15189
15606
  return FileWriteStream;
15190
15607
  },
@@ -15194,7 +15611,7 @@ var require_graceful_fs = __commonJS({
15194
15611
  enumerable: true,
15195
15612
  configurable: true
15196
15613
  });
15197
- function ReadStream(path26, options) {
15614
+ function ReadStream(path28, options) {
15198
15615
  if (this instanceof ReadStream)
15199
15616
  return fs$ReadStream.apply(this, arguments), this;
15200
15617
  else
@@ -15214,7 +15631,7 @@ var require_graceful_fs = __commonJS({
15214
15631
  }
15215
15632
  });
15216
15633
  }
15217
- function WriteStream(path26, options) {
15634
+ function WriteStream(path28, options) {
15218
15635
  if (this instanceof WriteStream)
15219
15636
  return fs$WriteStream.apply(this, arguments), this;
15220
15637
  else
@@ -15232,22 +15649,22 @@ var require_graceful_fs = __commonJS({
15232
15649
  }
15233
15650
  });
15234
15651
  }
15235
- function createReadStream2(path26, options) {
15236
- return new fs13.ReadStream(path26, options);
15652
+ function createReadStream2(path28, options) {
15653
+ return new fs15.ReadStream(path28, options);
15237
15654
  }
15238
- function createWriteStream(path26, options) {
15239
- return new fs13.WriteStream(path26, options);
15655
+ function createWriteStream(path28, options) {
15656
+ return new fs15.WriteStream(path28, options);
15240
15657
  }
15241
- var fs$open = fs13.open;
15242
- fs13.open = open;
15243
- function open(path26, flags, mode, cb) {
15658
+ var fs$open = fs15.open;
15659
+ fs15.open = open;
15660
+ function open(path28, flags, mode, cb) {
15244
15661
  if (typeof mode === "function")
15245
15662
  cb = mode, mode = null;
15246
- return go$open(path26, flags, mode, cb);
15247
- function go$open(path27, flags2, mode2, cb2, startTime) {
15248
- return fs$open(path27, flags2, mode2, function(err, fd) {
15663
+ return go$open(path28, flags, mode, cb);
15664
+ function go$open(path29, flags2, mode2, cb2, startTime) {
15665
+ return fs$open(path29, flags2, mode2, function(err, fd) {
15249
15666
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
15250
- enqueue([go$open, [path27, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
15667
+ enqueue([go$open, [path29, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
15251
15668
  else {
15252
15669
  if (typeof cb2 === "function")
15253
15670
  cb2.apply(this, arguments);
@@ -15255,20 +15672,20 @@ var require_graceful_fs = __commonJS({
15255
15672
  });
15256
15673
  }
15257
15674
  }
15258
- return fs13;
15675
+ return fs15;
15259
15676
  }
15260
15677
  function enqueue(elem) {
15261
15678
  debug("ENQUEUE", elem[0].name, elem[1]);
15262
- fs12[gracefulQueue].push(elem);
15679
+ fs14[gracefulQueue].push(elem);
15263
15680
  retry();
15264
15681
  }
15265
15682
  var retryTimer;
15266
15683
  function resetQueue() {
15267
15684
  var now = Date.now();
15268
- for (var i = 0; i < fs12[gracefulQueue].length; ++i) {
15269
- if (fs12[gracefulQueue][i].length > 2) {
15270
- fs12[gracefulQueue][i][3] = now;
15271
- fs12[gracefulQueue][i][4] = now;
15685
+ for (var i = 0; i < fs14[gracefulQueue].length; ++i) {
15686
+ if (fs14[gracefulQueue][i].length > 2) {
15687
+ fs14[gracefulQueue][i][3] = now;
15688
+ fs14[gracefulQueue][i][4] = now;
15272
15689
  }
15273
15690
  }
15274
15691
  retry();
@@ -15276,9 +15693,9 @@ var require_graceful_fs = __commonJS({
15276
15693
  function retry() {
15277
15694
  clearTimeout(retryTimer);
15278
15695
  retryTimer = void 0;
15279
- if (fs12[gracefulQueue].length === 0)
15696
+ if (fs14[gracefulQueue].length === 0)
15280
15697
  return;
15281
- var elem = fs12[gracefulQueue].shift();
15698
+ var elem = fs14[gracefulQueue].shift();
15282
15699
  var fn = elem[0];
15283
15700
  var args = elem[1];
15284
15701
  var err = elem[2];
@@ -15300,7 +15717,7 @@ var require_graceful_fs = __commonJS({
15300
15717
  debug("RETRY", fn.name, args);
15301
15718
  fn.apply(null, args.concat([startTime]));
15302
15719
  } else {
15303
- fs12[gracefulQueue].push(elem);
15720
+ fs14[gracefulQueue].push(elem);
15304
15721
  }
15305
15722
  }
15306
15723
  if (retryTimer === void 0) {
@@ -15735,10 +16152,10 @@ var require_mtime_precision = __commonJS({
15735
16152
  "../../node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/mtime-precision.js"(exports2, module2) {
15736
16153
  "use strict";
15737
16154
  var cacheSymbol = Symbol();
15738
- function probe(file2, fs12, callback) {
15739
- const cachedPrecision = fs12[cacheSymbol];
16155
+ function probe(file2, fs14, callback) {
16156
+ const cachedPrecision = fs14[cacheSymbol];
15740
16157
  if (cachedPrecision) {
15741
- return fs12.stat(file2, (err, stat3) => {
16158
+ return fs14.stat(file2, (err, stat3) => {
15742
16159
  if (err) {
15743
16160
  return callback(err);
15744
16161
  }
@@ -15746,16 +16163,16 @@ var require_mtime_precision = __commonJS({
15746
16163
  });
15747
16164
  }
15748
16165
  const mtime = new Date(Math.ceil(Date.now() / 1e3) * 1e3 + 5);
15749
- fs12.utimes(file2, mtime, mtime, (err) => {
16166
+ fs14.utimes(file2, mtime, mtime, (err) => {
15750
16167
  if (err) {
15751
16168
  return callback(err);
15752
16169
  }
15753
- fs12.stat(file2, (err2, stat3) => {
16170
+ fs14.stat(file2, (err2, stat3) => {
15754
16171
  if (err2) {
15755
16172
  return callback(err2);
15756
16173
  }
15757
16174
  const precision = stat3.mtime.getTime() % 1e3 === 0 ? "s" : "ms";
15758
- Object.defineProperty(fs12, cacheSymbol, { value: precision });
16175
+ Object.defineProperty(fs14, cacheSymbol, { value: precision });
15759
16176
  callback(null, stat3.mtime, precision);
15760
16177
  });
15761
16178
  });
@@ -15776,8 +16193,8 @@ var require_mtime_precision = __commonJS({
15776
16193
  var require_lockfile = __commonJS({
15777
16194
  "../../node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/lockfile.js"(exports2, module2) {
15778
16195
  "use strict";
15779
- var path26 = require("path");
15780
- var fs12 = require_graceful_fs();
16196
+ var path28 = require("path");
16197
+ var fs14 = require_graceful_fs();
15781
16198
  var retry = require_retry2();
15782
16199
  var onExit = require_signal_exit();
15783
16200
  var mtimePrecision = require_mtime_precision();
@@ -15787,7 +16204,7 @@ var require_lockfile = __commonJS({
15787
16204
  }
15788
16205
  function resolveCanonicalPath(file2, options, callback) {
15789
16206
  if (!options.realpath) {
15790
- return callback(null, path26.resolve(file2));
16207
+ return callback(null, path28.resolve(file2));
15791
16208
  }
15792
16209
  options.fs.realpath(file2, callback);
15793
16210
  }
@@ -15908,7 +16325,7 @@ var require_lockfile = __commonJS({
15908
16325
  update: null,
15909
16326
  realpath: true,
15910
16327
  retries: 0,
15911
- fs: fs12,
16328
+ fs: fs14,
15912
16329
  onCompromised: (err) => {
15913
16330
  throw err;
15914
16331
  },
@@ -15952,7 +16369,7 @@ var require_lockfile = __commonJS({
15952
16369
  }
15953
16370
  function unlock(file2, options, callback) {
15954
16371
  options = {
15955
- fs: fs12,
16372
+ fs: fs14,
15956
16373
  realpath: true,
15957
16374
  ...options
15958
16375
  };
@@ -15974,7 +16391,7 @@ var require_lockfile = __commonJS({
15974
16391
  options = {
15975
16392
  stale: 1e4,
15976
16393
  realpath: true,
15977
- fs: fs12,
16394
+ fs: fs14,
15978
16395
  ...options
15979
16396
  };
15980
16397
  options.stale = Math.max(options.stale || 0, 2e3);
@@ -16013,16 +16430,16 @@ var require_lockfile = __commonJS({
16013
16430
  var require_adapter = __commonJS({
16014
16431
  "../../node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/adapter.js"(exports2, module2) {
16015
16432
  "use strict";
16016
- var fs12 = require_graceful_fs();
16017
- function createSyncFs(fs13) {
16433
+ var fs14 = require_graceful_fs();
16434
+ function createSyncFs(fs15) {
16018
16435
  const methods = ["mkdir", "realpath", "stat", "rmdir", "utimes"];
16019
- const newFs = { ...fs13 };
16436
+ const newFs = { ...fs15 };
16020
16437
  methods.forEach((method) => {
16021
16438
  newFs[method] = (...args) => {
16022
16439
  const callback = args.pop();
16023
16440
  let ret;
16024
16441
  try {
16025
- ret = fs13[`${method}Sync`](...args);
16442
+ ret = fs15[`${method}Sync`](...args);
16026
16443
  } catch (err) {
16027
16444
  return callback(err);
16028
16445
  }
@@ -16060,7 +16477,7 @@ var require_adapter = __commonJS({
16060
16477
  }
16061
16478
  function toSyncOptions(options) {
16062
16479
  options = { ...options };
16063
- options.fs = createSyncFs(options.fs || fs12);
16480
+ options.fs = createSyncFs(options.fs || fs14);
16064
16481
  if (typeof options.retries === "number" && options.retries > 0 || options.retries && typeof options.retries.retries === "number" && options.retries.retries > 0) {
16065
16482
  throw Object.assign(new Error("Cannot use retries with the sync api"), { code: "ESYNC" });
16066
16483
  }
@@ -17651,10 +18068,10 @@ var require_segments = __commonJS({
17651
18068
  const segs = getSegmentsFromString(data, Utils.isKanjiModeEnabled());
17652
18069
  const nodes = buildNodes(segs);
17653
18070
  const graph = buildGraph(nodes, version2);
17654
- const path26 = dijkstra.find_path(graph.map, "start", "end");
18071
+ const path28 = dijkstra.find_path(graph.map, "start", "end");
17655
18072
  const optimizedSegs = [];
17656
- for (let i = 1; i < path26.length - 1; i++) {
17657
- optimizedSegs.push(graph.table[path26[i]].node);
18073
+ for (let i = 1; i < path28.length - 1; i++) {
18074
+ optimizedSegs.push(graph.table[path28[i]].node);
17658
18075
  }
17659
18076
  return exports2.fromArray(mergeSegments(optimizedSegs));
17660
18077
  };
@@ -19859,10 +20276,10 @@ var require_packer_sync = __commonJS({
19859
20276
  var require_png_sync = __commonJS({
19860
20277
  "../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/png-sync.js"(exports2) {
19861
20278
  "use strict";
19862
- var parse6 = require_parser_sync();
20279
+ var parse7 = require_parser_sync();
19863
20280
  var pack = require_packer_sync();
19864
20281
  exports2.read = function(buffer, options) {
19865
- return parse6(buffer, options || {});
20282
+ return parse7(buffer, options || {});
19866
20283
  };
19867
20284
  exports2.write = function(png, options) {
19868
20285
  return pack(png, options);
@@ -20090,7 +20507,7 @@ var require_utils3 = __commonJS({
20090
20507
  // ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/png.js
20091
20508
  var require_png2 = __commonJS({
20092
20509
  "../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/png.js"(exports2) {
20093
- var fs12 = require("fs");
20510
+ var fs14 = require("fs");
20094
20511
  var PNG = require_png().PNG;
20095
20512
  var Utils = require_utils3();
20096
20513
  exports2.render = function render(qrData, options) {
@@ -20131,7 +20548,7 @@ var require_png2 = __commonJS({
20131
20548
  });
20132
20549
  png.pack();
20133
20550
  };
20134
- exports2.renderToFile = function renderToFile(path26, qrData, options, cb) {
20551
+ exports2.renderToFile = function renderToFile(path28, qrData, options, cb) {
20135
20552
  if (typeof cb === "undefined") {
20136
20553
  cb = options;
20137
20554
  options = void 0;
@@ -20142,7 +20559,7 @@ var require_png2 = __commonJS({
20142
20559
  called = true;
20143
20560
  cb.apply(null, args);
20144
20561
  };
20145
- const stream = fs12.createWriteStream(path26);
20562
+ const stream = fs14.createWriteStream(path28);
20146
20563
  stream.on("error", done);
20147
20564
  stream.on("close", done);
20148
20565
  exports2.renderToFileStream(stream, qrData, options);
@@ -20204,14 +20621,14 @@ var require_utf8 = __commonJS({
20204
20621
  }
20205
20622
  return output3;
20206
20623
  };
20207
- exports2.renderToFile = function renderToFile(path26, qrData, options, cb) {
20624
+ exports2.renderToFile = function renderToFile(path28, qrData, options, cb) {
20208
20625
  if (typeof cb === "undefined") {
20209
20626
  cb = options;
20210
20627
  options = void 0;
20211
20628
  }
20212
- const fs12 = require("fs");
20629
+ const fs14 = require("fs");
20213
20630
  const utf8 = exports2.render(qrData, options);
20214
- fs12.writeFile(path26, utf8, cb);
20631
+ fs14.writeFile(path28, utf8, cb);
20215
20632
  };
20216
20633
  }
20217
20634
  });
@@ -20332,7 +20749,7 @@ var require_svg_tag = __commonJS({
20332
20749
  return str;
20333
20750
  }
20334
20751
  function qrToPath(data, size, margin) {
20335
- let path26 = "";
20752
+ let path28 = "";
20336
20753
  let moveBy = 0;
20337
20754
  let newRow = false;
20338
20755
  let lineLength = 0;
@@ -20343,19 +20760,19 @@ var require_svg_tag = __commonJS({
20343
20760
  if (data[i]) {
20344
20761
  lineLength++;
20345
20762
  if (!(i > 0 && col > 0 && data[i - 1])) {
20346
- path26 += newRow ? svgCmd("M", col + margin, 0.5 + row + margin) : svgCmd("m", moveBy, 0);
20763
+ path28 += newRow ? svgCmd("M", col + margin, 0.5 + row + margin) : svgCmd("m", moveBy, 0);
20347
20764
  moveBy = 0;
20348
20765
  newRow = false;
20349
20766
  }
20350
20767
  if (!(col + 1 < size && data[i + 1])) {
20351
- path26 += svgCmd("h", lineLength);
20768
+ path28 += svgCmd("h", lineLength);
20352
20769
  lineLength = 0;
20353
20770
  }
20354
20771
  } else {
20355
20772
  moveBy++;
20356
20773
  }
20357
20774
  }
20358
- return path26;
20775
+ return path28;
20359
20776
  }
20360
20777
  exports2.render = function render(qrData, options, cb) {
20361
20778
  const opts = Utils.getOptions(options);
@@ -20363,10 +20780,10 @@ var require_svg_tag = __commonJS({
20363
20780
  const data = qrData.modules.data;
20364
20781
  const qrcodesize = size + opts.margin * 2;
20365
20782
  const bg = !opts.color.light.a ? "" : "<path " + getColorAttrib(opts.color.light, "fill") + ' d="M0 0h' + qrcodesize + "v" + qrcodesize + 'H0z"/>';
20366
- const path26 = "<path " + getColorAttrib(opts.color.dark, "stroke") + ' d="' + qrToPath(data, size, opts.margin) + '"/>';
20783
+ const path28 = "<path " + getColorAttrib(opts.color.dark, "stroke") + ' d="' + qrToPath(data, size, opts.margin) + '"/>';
20367
20784
  const viewBox = 'viewBox="0 0 ' + qrcodesize + " " + qrcodesize + '"';
20368
20785
  const width = !opts.width ? "" : 'width="' + opts.width + '" height="' + opts.width + '" ';
20369
- const svgTag = '<svg xmlns="http://www.w3.org/2000/svg" ' + width + viewBox + ' shape-rendering="crispEdges">' + bg + path26 + "</svg>\n";
20786
+ const svgTag = '<svg xmlns="http://www.w3.org/2000/svg" ' + width + viewBox + ' shape-rendering="crispEdges">' + bg + path28 + "</svg>\n";
20370
20787
  if (typeof cb === "function") {
20371
20788
  cb(null, svgTag);
20372
20789
  }
@@ -20380,15 +20797,15 @@ var require_svg = __commonJS({
20380
20797
  "../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/svg.js"(exports2) {
20381
20798
  var svgTagRenderer = require_svg_tag();
20382
20799
  exports2.render = svgTagRenderer.render;
20383
- exports2.renderToFile = function renderToFile(path26, qrData, options, cb) {
20800
+ exports2.renderToFile = function renderToFile(path28, qrData, options, cb) {
20384
20801
  if (typeof cb === "undefined") {
20385
20802
  cb = options;
20386
20803
  options = void 0;
20387
20804
  }
20388
- const fs12 = require("fs");
20805
+ const fs14 = require("fs");
20389
20806
  const svgTag = exports2.render(qrData, options);
20390
20807
  const xmlStr = '<?xml version="1.0" encoding="utf-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">' + svgTag;
20391
- fs12.writeFile(path26, xmlStr, cb);
20808
+ fs14.writeFile(path28, xmlStr, cb);
20392
20809
  };
20393
20810
  }
20394
20811
  });
@@ -20546,8 +20963,8 @@ var require_server = __commonJS({
20546
20963
  cb
20547
20964
  };
20548
20965
  }
20549
- function getTypeFromFilename(path26) {
20550
- return path26.slice((path26.lastIndexOf(".") - 1 >>> 0) + 2).toLowerCase();
20966
+ function getTypeFromFilename(path28) {
20967
+ return path28.slice((path28.lastIndexOf(".") - 1 >>> 0) + 2).toLowerCase();
20551
20968
  }
20552
20969
  function getRendererFromType(type) {
20553
20970
  switch (type) {
@@ -20611,17 +21028,17 @@ var require_server = __commonJS({
20611
21028
  const renderer = getRendererFromType(params.opts.type);
20612
21029
  return render(renderer.renderToBuffer, text, params);
20613
21030
  };
20614
- exports2.toFile = function toFile(path26, text, opts, cb) {
20615
- if (typeof path26 !== "string" || !(typeof text === "string" || typeof text === "object")) {
21031
+ exports2.toFile = function toFile(path28, text, opts, cb) {
21032
+ if (typeof path28 !== "string" || !(typeof text === "string" || typeof text === "object")) {
20616
21033
  throw new Error("Invalid argument");
20617
21034
  }
20618
21035
  if (arguments.length < 3 && !canPromise()) {
20619
21036
  throw new Error("Too few arguments provided");
20620
21037
  }
20621
21038
  const params = checkParams(text, opts, cb);
20622
- const type = params.opts.type || getTypeFromFilename(path26);
21039
+ const type = params.opts.type || getTypeFromFilename(path28);
20623
21040
  const renderer = getRendererFromType(type);
20624
- const renderToFile = renderer.renderToFile.bind(null, path26);
21041
+ const renderToFile = renderer.renderToFile.bind(null, path28);
20625
21042
  return render(renderToFile, text, params);
20626
21043
  };
20627
21044
  exports2.toFileStream = function toFileStream(stream, text, opts) {
@@ -20643,12 +21060,109 @@ var require_lib = __commonJS({
20643
21060
  }
20644
21061
  });
20645
21062
 
21063
+ // src/install-public-mcp.ts
21064
+ var install_public_mcp_exports = {};
21065
+ __export(install_public_mcp_exports, {
21066
+ installPublicMcpServerToConfigs: () => installPublicMcpServerToConfigs
21067
+ });
21068
+ async function pathExists5(target) {
21069
+ try {
21070
+ await import_promises15.default.access(target);
21071
+ return true;
21072
+ } catch {
21073
+ return false;
21074
+ }
21075
+ }
21076
+ async function writeAtomic(targetPath, content) {
21077
+ const tempPath = `${targetPath}.${Date.now()}.tmp`;
21078
+ await import_promises15.default.writeFile(tempPath, content, { mode: 384 });
21079
+ await import_promises15.default.rename(tempPath, targetPath);
21080
+ }
21081
+ function renderTomlBlock(serverId, expected) {
21082
+ let tomlStr = `
21083
+ [mcp_servers.${serverId}]
21084
+ command = ${JSON.stringify(expected.command)}
21085
+ args = ${JSON.stringify(expected.args)}
21086
+ `;
21087
+ if (expected.env && Object.keys(expected.env).length > 0) {
21088
+ tomlStr += `[mcp_servers.${serverId}.env]
21089
+ `;
21090
+ for (const [k, v] of Object.entries(expected.env)) {
21091
+ tomlStr += `${k} = ${JSON.stringify(v)}
21092
+ `;
21093
+ }
21094
+ }
21095
+ return tomlStr;
21096
+ }
21097
+ async function installPublicMcpServerToConfigs(serverId, expected) {
21098
+ const homeDir = import_node_os16.default.homedir();
21099
+ const claudePath = import_node_path36.default.join(homeDir, ".claude.json");
21100
+ if (await pathExists5(claudePath)) {
21101
+ try {
21102
+ const content = await import_promises15.default.readFile(claudePath, "utf8");
21103
+ const parsed = JSON.parse(content);
21104
+ if (!parsed.mcpServers) parsed.mcpServers = {};
21105
+ parsed.mcpServers[serverId] = expected;
21106
+ await writeAtomic(claudePath, JSON.stringify(parsed, null, 2) + "\n");
21107
+ } catch (e) {
21108
+ console.error(`Failed to inject MCP server into ${claudePath}`, e);
21109
+ }
21110
+ } else {
21111
+ await writeAtomic(claudePath, JSON.stringify({ mcpServers: { [serverId]: expected } }, null, 2) + "\n");
21112
+ }
21113
+ const codexPath = import_node_path36.default.join(homeDir, ".codex", "config.toml");
21114
+ if (await pathExists5(codexPath)) {
21115
+ try {
21116
+ const content = await import_promises15.default.readFile(codexPath, "utf8");
21117
+ const parsed = toml3.parse(content);
21118
+ if (!parsed.mcp_servers?.[serverId]) {
21119
+ const appended = content.replace(/\n$/, "") + renderTomlBlock(serverId, expected);
21120
+ await writeAtomic(codexPath, appended);
21121
+ } else {
21122
+ console.warn(`MCP server ${serverId} already exists in ${codexPath}, skipping direct TOML edit.`);
21123
+ }
21124
+ } catch (e) {
21125
+ console.error(`Failed to inject MCP server into ${codexPath}`, e);
21126
+ }
21127
+ } else {
21128
+ await import_promises15.default.mkdir(import_node_path36.default.dirname(codexPath), { recursive: true, mode: 448 }).catch(() => {
21129
+ });
21130
+ await writeAtomic(codexPath, renderTomlBlock(serverId, expected).trim() + "\n");
21131
+ }
21132
+ const agyPath = import_node_path36.default.join(homeDir, ".gemini", "antigravity", "mcp_config.json");
21133
+ if (await pathExists5(agyPath)) {
21134
+ try {
21135
+ const content = await import_promises15.default.readFile(agyPath, "utf8");
21136
+ const parsed = JSON.parse(content);
21137
+ if (!parsed.mcpServers) parsed.mcpServers = {};
21138
+ parsed.mcpServers[serverId] = expected;
21139
+ await writeAtomic(agyPath, JSON.stringify(parsed, null, 2) + "\n");
21140
+ } catch (e) {
21141
+ console.error(`Failed to inject MCP server into ${agyPath}`, e);
21142
+ }
21143
+ } else {
21144
+ await import_promises15.default.mkdir(import_node_path36.default.dirname(agyPath), { recursive: true, mode: 448 }).catch(() => {
21145
+ });
21146
+ await writeAtomic(agyPath, JSON.stringify({ mcpServers: { [serverId]: expected } }, null, 2) + "\n");
21147
+ }
21148
+ }
21149
+ var import_promises15, import_node_os16, import_node_path36, toml3;
21150
+ var init_install_public_mcp = __esm({
21151
+ "src/install-public-mcp.ts"() {
21152
+ "use strict";
21153
+ import_promises15 = __toESM(require("node:fs/promises"), 1);
21154
+ import_node_os16 = __toESM(require("node:os"), 1);
21155
+ import_node_path36 = __toESM(require("node:path"), 1);
21156
+ toml3 = __toESM(require_toml(), 1);
21157
+ }
21158
+ });
21159
+
20646
21160
  // src/bin.ts
20647
- var import_node_path39 = __toESM(require("node:path"), 1);
21161
+ var import_node_path41 = __toESM(require("node:path"), 1);
20648
21162
  var import_node_child_process21 = require("node:child_process");
20649
- var import_node_fs24 = require("node:fs");
20650
- var import_node_os19 = require("node:os");
20651
- var import_node_path40 = __toESM(require("node:path"), 1);
21163
+ var import_node_fs25 = require("node:fs");
21164
+ var import_node_os20 = require("node:os");
21165
+ var import_node_path42 = __toESM(require("node:path"), 1);
20652
21166
 
20653
21167
  // src/install-codex.ts
20654
21168
  var import_promises = __toESM(require("node:fs/promises"), 1);
@@ -21135,6 +21649,126 @@ function readMcpServerById(configPath, serverId) {
21135
21649
  }
21136
21650
  return { url: url2, headers };
21137
21651
  }
21652
+ function parseTomlMcpServers(raw) {
21653
+ const result = {};
21654
+ const lines2 = raw.split(/\r?\n/);
21655
+ let currentServer = null;
21656
+ for (const line of lines2) {
21657
+ const trimmed = line.trim();
21658
+ if (!trimmed || trimmed.startsWith("#")) continue;
21659
+ const headerMatch = trimmed.match(/^\[(?:mcp_servers|mcpServers)\.["']?([^"']+)["']?\]$/i);
21660
+ if (headerMatch) {
21661
+ currentServer = headerMatch[1] ?? null;
21662
+ if (currentServer && !result[currentServer]) {
21663
+ result[currentServer] = {};
21664
+ }
21665
+ continue;
21666
+ }
21667
+ if (trimmed.startsWith("[") && !trimmed.startsWith("[mcp_servers.") && !trimmed.startsWith("[mcpServers.")) {
21668
+ currentServer = null;
21669
+ continue;
21670
+ }
21671
+ if (!currentServer) continue;
21672
+ const serverObj = result[currentServer];
21673
+ if (!serverObj) continue;
21674
+ const commandMatch = trimmed.match(/^command\s*=\s*["']([^"']+)["']/i);
21675
+ if (commandMatch) {
21676
+ serverObj.command = commandMatch[1];
21677
+ continue;
21678
+ }
21679
+ const urlMatch = trimmed.match(/^url\s*=\s*["']([^"']+)["']/i);
21680
+ if (urlMatch) {
21681
+ serverObj.url = urlMatch[1];
21682
+ continue;
21683
+ }
21684
+ const argsMatch = trimmed.match(/^args\s*=\s*\[(.*)\]/i);
21685
+ if (argsMatch) {
21686
+ const inner = argsMatch[1];
21687
+ const parsedArgs = inner ? (inner.match(/"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'/g) ?? []).map((s) => s.slice(1, -1)) : [];
21688
+ serverObj.args = parsedArgs;
21689
+ continue;
21690
+ }
21691
+ }
21692
+ return result;
21693
+ }
21694
+ function listDiscoveredMcpServers(customPaths) {
21695
+ const home = import_node_os2.default.homedir();
21696
+ const codexHome = process.env.CODEX_HOME || import_node_path2.default.join(home, ".codex");
21697
+ const candidatePaths = [
21698
+ { path: import_node_path2.default.join(home, ".claude.json"), source: "claude", format: "json" },
21699
+ { path: import_node_path2.default.join(home, ".gemini", "antigravity", "mcp_config.json"), source: "gemini", format: "json" },
21700
+ { path: import_node_path2.default.join(home, ".gemini", "config", "config.json"), source: "gemini", format: "json" },
21701
+ { path: import_node_path2.default.join(codexHome, "config.toml"), source: "codex", format: "toml" },
21702
+ { path: import_node_path2.default.join(home, ".config", "codex", "config.toml"), source: "codex", format: "toml" },
21703
+ { path: import_node_path2.default.join(home, "Library", "Application Support", "Claude", "claude_desktop_config.json"), source: "claude", format: "json" },
21704
+ { path: import_node_path2.default.join(home, ".config", "Claude", "claude_desktop_config.json"), source: "claude", format: "json" }
21705
+ ];
21706
+ if (customPaths) {
21707
+ for (const cp of customPaths) {
21708
+ candidatePaths.unshift({
21709
+ path: cp,
21710
+ source: "custom",
21711
+ format: cp.endsWith(".toml") ? "toml" : "json"
21712
+ });
21713
+ }
21714
+ }
21715
+ const result = /* @__PURE__ */ new Map();
21716
+ for (const { path: cfgPath, source, format } of candidatePaths) {
21717
+ let raw;
21718
+ try {
21719
+ raw = import_node_fs.default.readFileSync(cfgPath, "utf8");
21720
+ } catch {
21721
+ continue;
21722
+ }
21723
+ let servers;
21724
+ if (format === "toml" || cfgPath.endsWith(".toml")) {
21725
+ try {
21726
+ servers = parseTomlMcpServers(raw);
21727
+ } catch {
21728
+ continue;
21729
+ }
21730
+ } else {
21731
+ let parsed;
21732
+ try {
21733
+ parsed = JSON.parse(raw);
21734
+ } catch {
21735
+ continue;
21736
+ }
21737
+ if (typeof parsed !== "object" || parsed === null) continue;
21738
+ const rawServers = parsed.mcpServers ?? parsed.mcp_servers;
21739
+ if (typeof rawServers !== "object" || rawServers === null) continue;
21740
+ servers = rawServers;
21741
+ }
21742
+ if (!servers) continue;
21743
+ for (const [id, entry] of Object.entries(servers)) {
21744
+ if (typeof entry !== "object" || entry === null) continue;
21745
+ if (result.has(id)) continue;
21746
+ const record2 = entry;
21747
+ const url2 = typeof record2.url === "string" && record2.url.trim().length > 0 ? record2.url.trim() : void 0;
21748
+ const command = typeof record2.command === "string" && record2.command.trim().length > 0 ? record2.command.trim() : void 0;
21749
+ const args = Array.isArray(record2.args) ? record2.args.filter((a) => typeof a === "string") : void 0;
21750
+ if (url2) {
21751
+ result.set(id, {
21752
+ id,
21753
+ name: id,
21754
+ transport: "http",
21755
+ url: url2,
21756
+ source
21757
+ });
21758
+ } else if (command) {
21759
+ result.set(id, {
21760
+ id,
21761
+ name: id,
21762
+ transport: "stdio",
21763
+ command,
21764
+ args,
21765
+ source
21766
+ });
21767
+ }
21768
+ }
21769
+ }
21770
+ return Array.from(result.values()).sort((a, b) => a.id.localeCompare(b.id));
21771
+ }
21138
21772
 
21139
21773
  // src/install-codex.ts
21140
21774
  function deriveServeEnvFromProcessEnv(env) {
@@ -22276,10 +22910,10 @@ function mergeDefs(...defs) {
22276
22910
  function cloneDef(schema) {
22277
22911
  return mergeDefs(schema._zod.def);
22278
22912
  }
22279
- function getElementAtPath(obj, path26) {
22280
- if (!path26)
22913
+ function getElementAtPath(obj, path28) {
22914
+ if (!path28)
22281
22915
  return obj;
22282
- return path26.reduce((acc, key) => acc?.[key], obj);
22916
+ return path28.reduce((acc, key) => acc?.[key], obj);
22283
22917
  }
22284
22918
  function promiseAllObject(promisesObj) {
22285
22919
  const keys = Object.keys(promisesObj);
@@ -22688,11 +23322,11 @@ function explicitlyAborted(x, startIndex = 0) {
22688
23322
  }
22689
23323
  return false;
22690
23324
  }
22691
- function prefixIssues(path26, issues) {
23325
+ function prefixIssues(path28, issues) {
22692
23326
  return issues.map((iss) => {
22693
23327
  var _a3;
22694
23328
  (_a3 = iss).path ?? (_a3.path = []);
22695
- iss.path.unshift(path26);
23329
+ iss.path.unshift(path28);
22696
23330
  return iss;
22697
23331
  });
22698
23332
  }
@@ -22839,16 +23473,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
22839
23473
  }
22840
23474
  function formatError(error51, mapper = (issue2) => issue2.message) {
22841
23475
  const fieldErrors = { _errors: [] };
22842
- const processError = (error52, path26 = []) => {
23476
+ const processError = (error52, path28 = []) => {
22843
23477
  for (const issue2 of error52.issues) {
22844
23478
  if (issue2.code === "invalid_union" && issue2.errors.length) {
22845
- issue2.errors.map((issues) => processError({ issues }, [...path26, ...issue2.path]));
23479
+ issue2.errors.map((issues) => processError({ issues }, [...path28, ...issue2.path]));
22846
23480
  } else if (issue2.code === "invalid_key") {
22847
- processError({ issues: issue2.issues }, [...path26, ...issue2.path]);
23481
+ processError({ issues: issue2.issues }, [...path28, ...issue2.path]);
22848
23482
  } else if (issue2.code === "invalid_element") {
22849
- processError({ issues: issue2.issues }, [...path26, ...issue2.path]);
23483
+ processError({ issues: issue2.issues }, [...path28, ...issue2.path]);
22850
23484
  } else {
22851
- const fullpath = [...path26, ...issue2.path];
23485
+ const fullpath = [...path28, ...issue2.path];
22852
23486
  if (fullpath.length === 0) {
22853
23487
  fieldErrors._errors.push(mapper(issue2));
22854
23488
  } else {
@@ -22875,17 +23509,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
22875
23509
  }
22876
23510
  function treeifyError(error51, mapper = (issue2) => issue2.message) {
22877
23511
  const result = { errors: [] };
22878
- const processError = (error52, path26 = []) => {
23512
+ const processError = (error52, path28 = []) => {
22879
23513
  var _a3, _b;
22880
23514
  for (const issue2 of error52.issues) {
22881
23515
  if (issue2.code === "invalid_union" && issue2.errors.length) {
22882
- issue2.errors.map((issues) => processError({ issues }, [...path26, ...issue2.path]));
23516
+ issue2.errors.map((issues) => processError({ issues }, [...path28, ...issue2.path]));
22883
23517
  } else if (issue2.code === "invalid_key") {
22884
- processError({ issues: issue2.issues }, [...path26, ...issue2.path]);
23518
+ processError({ issues: issue2.issues }, [...path28, ...issue2.path]);
22885
23519
  } else if (issue2.code === "invalid_element") {
22886
- processError({ issues: issue2.issues }, [...path26, ...issue2.path]);
23520
+ processError({ issues: issue2.issues }, [...path28, ...issue2.path]);
22887
23521
  } else {
22888
- const fullpath = [...path26, ...issue2.path];
23522
+ const fullpath = [...path28, ...issue2.path];
22889
23523
  if (fullpath.length === 0) {
22890
23524
  result.errors.push(mapper(issue2));
22891
23525
  continue;
@@ -22917,8 +23551,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
22917
23551
  }
22918
23552
  function toDotPath(_path) {
22919
23553
  const segs = [];
22920
- const path26 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
22921
- for (const seg of path26) {
23554
+ const path28 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
23555
+ for (const seg of path28) {
22922
23556
  if (typeof seg === "number")
22923
23557
  segs.push(`[${seg}]`);
22924
23558
  else if (typeof seg === "symbol")
@@ -35610,13 +36244,13 @@ function resolveRef(ref, ctx) {
35610
36244
  if (!ref.startsWith("#")) {
35611
36245
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
35612
36246
  }
35613
- const path26 = ref.slice(1).split("/").filter(Boolean);
35614
- if (path26.length === 0) {
36247
+ const path28 = ref.slice(1).split("/").filter(Boolean);
36248
+ if (path28.length === 0) {
35615
36249
  return ctx.rootSchema;
35616
36250
  }
35617
36251
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
35618
- if (path26[0] === defsKey) {
35619
- const key = path26[1];
36252
+ if (path28[0] === defsKey) {
36253
+ const key = path28[1];
35620
36254
  if (!key || !ctx.defs[key]) {
35621
36255
  throw new Error(`Reference not found: ${ref}`);
35622
36256
  }
@@ -38080,7 +38714,7 @@ var mrrlinExecutionArtifactSchema = external_exports.object({
38080
38714
  var mrrlinExecutionArtifactCreateSchema = external_exports.object({
38081
38715
  id: mrrlinExecutionArtifactIdSchema,
38082
38716
  kind: mrrlinExecutionArtifactKindSchema,
38083
- payload: external_exports.record(external_exports.string(), external_exports.unknown()).default({})
38717
+ payload: external_exports.record(external_exports.string(), external_exports.unknown()).optional().default({})
38084
38718
  });
38085
38719
  var executionArtifactListFiltersSchema = external_exports.object({
38086
38720
  limit: external_exports.coerce.number().int().min(1).max(100).optional(),
@@ -38849,18 +39483,18 @@ function createMrrlinClient(config2) {
38849
39483
  const customFetch = config2.fetch ?? globalThis.fetch;
38850
39484
  const baseUrl = config2.baseUrl.replace(/\/$/, "");
38851
39485
  const token = config2.token;
38852
- async function request(path26, init) {
39486
+ async function request(path28, init) {
38853
39487
  const method = init?.method ?? "GET";
38854
39488
  const headers = new Headers(init?.headers ?? {});
38855
39489
  if (token && !headers.has("authorization")) {
38856
39490
  headers.set("authorization", `Bearer ${token}`);
38857
39491
  }
38858
- const response = await customFetch(`${baseUrl}${path26}`, { ...init, headers });
39492
+ const response = await customFetch(`${baseUrl}${path28}`, { ...init, headers });
38859
39493
  if (!response.ok) {
38860
39494
  const body = await response.text();
38861
39495
  let code = `HTTP_${response.status}`;
38862
39496
  let violations = null;
38863
- let message = `Mrrlin API ${method} ${path26} failed: ${response.status}`;
39497
+ let message = `Mrrlin API ${method} ${path28} failed: ${response.status}`;
38864
39498
  try {
38865
39499
  const parsed = JSON.parse(body);
38866
39500
  const violationsParsed = apiViolationsErrorSchema.safeParse(parsed);
@@ -38880,7 +39514,7 @@ function createMrrlinClient(config2) {
38880
39514
  throw new MrrlinApiError({
38881
39515
  code,
38882
39516
  method,
38883
- path: path26,
39517
+ path: path28,
38884
39518
  responseBody: body,
38885
39519
  status: response.status,
38886
39520
  violations,
@@ -38889,18 +39523,18 @@ function createMrrlinClient(config2) {
38889
39523
  }
38890
39524
  return response.json();
38891
39525
  }
38892
- async function requestText(path26, init) {
39526
+ async function requestText(path28, init) {
38893
39527
  const method = init?.method ?? "GET";
38894
39528
  const headers = new Headers(init?.headers ?? {});
38895
39529
  if (token && !headers.has("authorization")) {
38896
39530
  headers.set("authorization", `Bearer ${token}`);
38897
39531
  }
38898
- const response = await customFetch(`${baseUrl}${path26}`, { ...init, headers });
39532
+ const response = await customFetch(`${baseUrl}${path28}`, { ...init, headers });
38899
39533
  if (!response.ok) {
38900
39534
  const body = await response.text();
38901
39535
  let code = `HTTP_${response.status}`;
38902
39536
  let violations = null;
38903
- let message = `Mrrlin API ${method} ${path26} failed: ${response.status}`;
39537
+ let message = `Mrrlin API ${method} ${path28} failed: ${response.status}`;
38904
39538
  try {
38905
39539
  const parsed = JSON.parse(body);
38906
39540
  const violationsParsed = apiViolationsErrorSchema.safeParse(parsed);
@@ -38920,7 +39554,7 @@ function createMrrlinClient(config2) {
38920
39554
  throw new MrrlinApiError({
38921
39555
  code,
38922
39556
  method,
38923
- path: path26,
39557
+ path: path28,
38924
39558
  responseBody: body,
38925
39559
  status: response.status,
38926
39560
  violations,
@@ -39161,16 +39795,16 @@ function createMrrlinClient(config2) {
39161
39795
  // rejected against the first, MrrlinTask[]-only overload) -- the `any` here is contained to
39162
39796
  // this one implementation signature; MrrlinClient's declared overloads keep callers precise.
39163
39797
  async listTasks(projectSlug, filters = {}, options) {
39164
- const path26 = buildTaskListPath(projectSlug, filters, options?.view);
39165
- const body = await request(path26);
39798
+ const path28 = buildTaskListPath(projectSlug, filters, options?.view);
39799
+ const body = await request(path28);
39166
39800
  if (options?.view === "summary") {
39167
39801
  return taskSummaryListResponseSchema.parse(body).data;
39168
39802
  }
39169
39803
  return taskListResponseSchema.parse(body).data;
39170
39804
  },
39171
39805
  async listTaskSummaries(projectSlug, filters = {}) {
39172
- const path26 = buildTaskListPath(projectSlug, filters, "summary");
39173
- const body = await request(path26);
39806
+ const path28 = buildTaskListPath(projectSlug, filters, "summary");
39807
+ const body = await request(path28);
39174
39808
  return taskSummaryListResponseSchema.parse(body).data;
39175
39809
  },
39176
39810
  async listTaxonomy(projectSlug) {
@@ -39178,22 +39812,22 @@ function createMrrlinClient(config2) {
39178
39812
  return taxonomyListResponseSchema.parse(body).data;
39179
39813
  },
39180
39814
  async listWikiPages(projectSlug, filters = {}) {
39181
- const path26 = appendQuery(`${projectPath(projectSlug)}/wiki`, {
39815
+ const path28 = appendQuery(`${projectPath(projectSlug)}/wiki`, {
39182
39816
  folder: filters.folder,
39183
39817
  q: filters.q,
39184
39818
  taskId: filters.taskId
39185
39819
  });
39186
- const body = await request(path26);
39820
+ const body = await request(path28);
39187
39821
  return wikiPageListResponseSchema.parse(body).data;
39188
39822
  },
39189
39823
  async searchWikiPages(projectSlug, query) {
39190
- const path26 = appendQuery(`${projectPath(projectSlug)}/wiki/search`, {
39824
+ const path28 = appendQuery(`${projectPath(projectSlug)}/wiki/search`, {
39191
39825
  folder: query.folder,
39192
39826
  limit: query.limit === void 0 ? void 0 : String(query.limit),
39193
39827
  pathPrefix: query.pathPrefix,
39194
39828
  q: query.q
39195
39829
  });
39196
- const body = await request(path26);
39830
+ const body = await request(path28);
39197
39831
  return wikiPageSearchResponseSchema.parse(body).data;
39198
39832
  },
39199
39833
  async updatePlan(projectSlug, planId, patch) {
@@ -39396,6 +40030,13 @@ function createMrrlinClient(config2) {
39396
40030
  const body = await request(`${projectPath(projectSlug)}/capability-grants`);
39397
40031
  return capabilityGrantListResponseSchema.parse(body).data;
39398
40032
  },
40033
+ async createCapabilityGrant(projectSlug, serverId) {
40034
+ const body = await request(`${projectPath(projectSlug)}/capability-grants`, {
40035
+ method: "POST",
40036
+ body: JSON.stringify({ serverId })
40037
+ });
40038
+ return capabilityGrantResponseSchema.parse(body).data;
40039
+ },
39399
40040
  async listCapabilityUses(projectSlug) {
39400
40041
  const body = await request(`${projectPath(projectSlug)}/capability-uses`);
39401
40042
  return capabilityUseListResponseSchema.parse(body).data;
@@ -39698,10 +40339,10 @@ function createMrrlinClient(config2) {
39698
40339
  });
39699
40340
  return artifactFileCreateResponseSchema.parse(body).data;
39700
40341
  },
39701
- async uploadArtifactFileContent(projectSlug, artifactFileId, bytes3, contentType) {
40342
+ async uploadArtifactFileContent(projectSlug, artifactFileId, bytes3, contentType2) {
39702
40343
  await request(`${projectPath(projectSlug)}/artifact-files/${encodeURIComponent(artifactFileId)}/content`, {
39703
40344
  body: bytes3,
39704
- headers: { "content-type": contentType },
40345
+ headers: { "content-type": contentType2 },
39705
40346
  method: "PUT"
39706
40347
  });
39707
40348
  },
@@ -41927,7 +42568,8 @@ var CodexAgentHandle = class {
41927
42568
  sandbox: params.sandbox ?? null,
41928
42569
  baseInstructions: params.baseInstructions ?? null,
41929
42570
  developerInstructions: params.developerInstructions ?? null,
41930
- ephemeral: params.ephemeral ?? null
42571
+ ephemeral: params.ephemeral ?? null,
42572
+ mcpConfig: params.mcpConfig ?? null
41931
42573
  });
41932
42574
  return { threadId: started.thread.id };
41933
42575
  }
@@ -41937,7 +42579,8 @@ var CodexAgentHandle = class {
41937
42579
  model: params.model ?? null,
41938
42580
  cwd: params.cwd ?? null,
41939
42581
  approvalPolicy: params.approvalPolicy ?? null,
41940
- sandbox: params.sandbox ?? null
42582
+ sandbox: params.sandbox ?? null,
42583
+ mcpConfig: params.mcpConfig ?? null
41941
42584
  });
41942
42585
  return { threadId: resumed.thread.id };
41943
42586
  }
@@ -42008,7 +42651,7 @@ var ClaudeProcess = class {
42008
42651
  this.child = (0, import_node_child_process3.spawn)(executable, args, {
42009
42652
  cwd: options.cwd?.trim() || void 0,
42010
42653
  // Inherit the operator's env so the CLI picks up their own ~/.claude.json tool registry —
42011
- // that is deliberately why we pass NO --mcp-config/--strict-mcp-config here.
42654
+ // unless an explicit mcpConfig was provided in options.
42012
42655
  env: process.env,
42013
42656
  stdio: ["pipe", "pipe", "pipe"]
42014
42657
  });
@@ -42052,6 +42695,9 @@ var ClaudeProcess = class {
42052
42695
  const model = options.model?.trim();
42053
42696
  if (model)
42054
42697
  args.push("--model", model);
42698
+ if (options.mcpConfig) {
42699
+ args.push("--mcp-config", options.mcpConfig);
42700
+ }
42055
42701
  args.push("--permission-mode", options.permissionMode);
42056
42702
  if (options.disallowedTools && options.disallowedTools.length > 0) {
42057
42703
  args.push("--disallowedTools", options.disallowedTools.join(","));
@@ -42326,7 +42972,8 @@ var ClaudeAgentHandle = class {
42326
42972
  permissionMode,
42327
42973
  disallowedTools,
42328
42974
  model: params.model,
42329
- cwd: params.cwd
42975
+ cwd: params.cwd,
42976
+ mcpConfig: params.mcpConfig
42330
42977
  });
42331
42978
  this.processes.set(child.sessionId, child);
42332
42979
  this.mappers.set(child.sessionId, new ClaudeBridgeEventMapper());
@@ -42339,7 +42986,8 @@ var ClaudeAgentHandle = class {
42339
42986
  permissionMode,
42340
42987
  disallowedTools,
42341
42988
  model: params.model,
42342
- cwd: params.cwd
42989
+ cwd: params.cwd,
42990
+ mcpConfig: params.mcpConfig
42343
42991
  });
42344
42992
  this.processes.set(threadId, child);
42345
42993
  this.mappers.set(threadId, new ClaudeBridgeEventMapper());
@@ -43033,6 +43681,9 @@ ${input.prompt}` : input.prompt;
43033
43681
  "--skip-git-repo-check",
43034
43682
  "--ignore-user-config"
43035
43683
  ];
43684
+ if (input.mcpConfig) {
43685
+ args.push("--mcp-config", input.mcpConfig);
43686
+ }
43036
43687
  if (input.model) {
43037
43688
  args.push("-m", input.model);
43038
43689
  }
@@ -43102,6 +43753,9 @@ function runClaudeExec(input, deps) {
43102
43753
  const spawn5 = deps?.spawn ?? import_node_child_process7.spawn;
43103
43754
  const executable = input.codexExecutable ?? "claude";
43104
43755
  const args = ["--print", "--output-format", "json", "--strict-mcp-config"];
43756
+ if (input.mcpConfig) {
43757
+ args.push("--mcp-config", input.mcpConfig);
43758
+ }
43105
43759
  if (input.sandbox === "read-only") {
43106
43760
  args.push("--permission-mode", "plan", "--disallowedTools", "Edit,Write,NotebookEdit,Bash");
43107
43761
  } else if (input.sandbox === "workspace-write") {
@@ -44775,7 +45429,7 @@ async function deliverToWiki(client, projectSlug, payload) {
44775
45429
  return client.updateWikiPage(projectSlug, payload.pageId, payload.patch);
44776
45430
  }
44777
45431
 
44778
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
45432
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
44779
45433
  function isZ4Schema(s) {
44780
45434
  const schema = s;
44781
45435
  return !!schema._zod;
@@ -44838,7 +45492,7 @@ function getLiteralValue(schema) {
44838
45492
  return void 0;
44839
45493
  }
44840
45494
 
44841
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
45495
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
44842
45496
  var LATEST_PROTOCOL_VERSION = "2025-11-25";
44843
45497
  var SUPPORTED_PROTOCOL_VERSIONS = [LATEST_PROTOCOL_VERSION, "2025-06-18", "2025-03-26", "2024-11-05", "2024-10-07"];
44844
45498
  var RELATED_TASK_META_KEY = "io.modelcontextprotocol/related-task";
@@ -46358,7 +47012,7 @@ var UrlElicitationRequiredError = class extends McpError {
46358
47012
  }
46359
47013
  };
46360
47014
 
46361
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
47015
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
46362
47016
  function isTerminal(status) {
46363
47017
  return status === "completed" || status === "failed" || status === "cancelled";
46364
47018
  }
@@ -46369,7 +47023,7 @@ var ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use")
46369
47023
  // ../../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
46370
47024
  var ALPHA_NUMERIC = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
46371
47025
 
46372
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
47026
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
46373
47027
  function getMethodLiteral(schema) {
46374
47028
  const shape = getObjectShape(schema);
46375
47029
  const methodSchema = shape?.method;
@@ -46390,7 +47044,7 @@ function parseWithCompat(schema, data) {
46390
47044
  return result.data;
46391
47045
  }
46392
47046
 
46393
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
47047
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
46394
47048
  var DEFAULT_REQUEST_TIMEOUT_MSEC = 6e4;
46395
47049
  var Protocol = class {
46396
47050
  constructor(_options) {
@@ -47344,7 +47998,7 @@ function mergeCapabilities(base, additional) {
47344
47998
  return result;
47345
47999
  }
47346
48000
 
47347
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
48001
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
47348
48002
  var import_ajv = __toESM(require_ajv(), 1);
47349
48003
  var import_ajv_formats = __toESM(require_dist(), 1);
47350
48004
  function createDefaultAjvInstance() {
@@ -47412,7 +48066,7 @@ var AjvJsonSchemaValidator = class {
47412
48066
  }
47413
48067
  };
47414
48068
 
47415
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/client.js
48069
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/client.js
47416
48070
  var ExperimentalClientTasks = class {
47417
48071
  constructor(_client) {
47418
48072
  this._client = _client;
@@ -47566,7 +48220,7 @@ var ExperimentalClientTasks = class {
47566
48220
  }
47567
48221
  };
47568
48222
 
47569
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
48223
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
47570
48224
  function assertToolsCallTaskCapability(requests, method, entityName) {
47571
48225
  if (!requests) {
47572
48226
  throw new Error(`${entityName} does not support task creation (required for ${method})`);
@@ -47601,7 +48255,7 @@ function assertClientRequestTaskCapability(requests, method, entityName) {
47601
48255
  }
47602
48256
  }
47603
48257
 
47604
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js
48258
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js
47605
48259
  function applyElicitationDefaults(schema, data) {
47606
48260
  if (!schema || data === null || typeof data !== "object")
47607
48261
  return;
@@ -47721,16 +48375,7 @@ var Client = class extends Protocol {
47721
48375
  if (!methodSchema) {
47722
48376
  throw new Error("Schema is missing a method literal");
47723
48377
  }
47724
- let methodValue;
47725
- if (isZ4Schema(methodSchema)) {
47726
- const v4Schema = methodSchema;
47727
- const v4Def = v4Schema._zod?.def;
47728
- methodValue = v4Def?.value ?? v4Schema.value;
47729
- } else {
47730
- const v3Schema = methodSchema;
47731
- const legacyDef = v3Schema._def;
47732
- methodValue = legacyDef?.value ?? v3Schema.value;
47733
- }
48378
+ const methodValue = getLiteralValue(methodSchema);
47734
48379
  if (typeof methodValue !== "string") {
47735
48380
  throw new Error("Schema method literal must be a string");
47736
48381
  }
@@ -48121,7 +48766,24 @@ var Client = class extends Protocol {
48121
48766
  }
48122
48767
  };
48123
48768
 
48124
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.js
48769
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.js
48770
+ var import_content_type = __toESM(require_content_type(), 1);
48771
+ function mediaTypeEssence(header) {
48772
+ if (!header) {
48773
+ return void 0;
48774
+ }
48775
+ try {
48776
+ return import_content_type.default.parse(header).type;
48777
+ } catch {
48778
+ const essence = (header.split(";", 1)[0] ?? "").trim().toLowerCase();
48779
+ if (essence === "" || header.slice(essence.length).includes(",")) {
48780
+ return void 0;
48781
+ }
48782
+ return essence;
48783
+ }
48784
+ }
48785
+
48786
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.js
48125
48787
  function normalizeHeaders(headers) {
48126
48788
  if (!headers)
48127
48789
  return {};
@@ -48191,7 +48853,7 @@ async function pkceChallenge(length) {
48191
48853
  };
48192
48854
  }
48193
48855
 
48194
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js
48856
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js
48195
48857
  var SafeUrlSchema = url().superRefine((val, ctx) => {
48196
48858
  if (!URL.canParse(val)) {
48197
48859
  ctx.addIssue({
@@ -48335,7 +48997,7 @@ var OAuthTokenRevocationRequestSchema = object({
48335
48997
  token_type_hint: string2().optional()
48336
48998
  }).strip();
48337
48999
 
48338
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth-utils.js
49000
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth-utils.js
48339
49001
  function resourceUrlFromServerUrl(url2) {
48340
49002
  const resourceURL = typeof url2 === "string" ? new URL(url2) : new URL(url2.href);
48341
49003
  resourceURL.hash = "";
@@ -48355,7 +49017,7 @@ function checkResourceAllowed({ requestedResource, configuredResource }) {
48355
49017
  return requestedPath.startsWith(configuredPath);
48356
49018
  }
48357
49019
 
48358
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js
49020
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js
48359
49021
  var OAuthError = class extends Error {
48360
49022
  constructor(message, errorUri) {
48361
49023
  super(message);
@@ -48450,7 +49112,7 @@ var OAUTH_ERRORS = {
48450
49112
  [InvalidTargetError.errorCode]: InvalidTargetError
48451
49113
  };
48452
49114
 
48453
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js
49115
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js
48454
49116
  var UnauthorizedError = class extends Error {
48455
49117
  constructor(message) {
48456
49118
  super(message ?? "Unauthorized");
@@ -48991,7 +49653,7 @@ async function registerClient(authorizationServerUrl, { metadata, clientMetadata
48991
49653
  return OAuthClientInformationFullSchema.parse(await response.json());
48992
49654
  }
48993
49655
 
48994
- // ../../node_modules/.pnpm/eventsource-parser@3.0.8/node_modules/eventsource-parser/dist/index.js
49656
+ // ../../node_modules/.pnpm/eventsource-parser@3.1.1/node_modules/eventsource-parser/dist/index.js
48995
49657
  var ParseError = class extends Error {
48996
49658
  constructor(message, options) {
48997
49659
  super(message), this.name = "ParseError", this.type = options.type, this.field = options.field, this.value = options.value, this.line = options.line;
@@ -49002,29 +49664,40 @@ var CR = 13;
49002
49664
  var SPACE = 32;
49003
49665
  function noop(_arg) {
49004
49666
  }
49005
- function createParser(callbacks) {
49006
- if (typeof callbacks == "function")
49667
+ function createParser(config2) {
49668
+ if (typeof config2 == "function")
49007
49669
  throw new TypeError(
49008
- "`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
49670
+ "`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?"
49009
49671
  );
49010
- const { onEvent = noop, onError = noop, onRetry = noop, onComment } = callbacks, pendingFragments = [];
49011
- let isFirstChunk = true, id, data = "", dataLines = 0, eventType;
49672
+ const { onEvent = noop, onError = noop, onRetry = noop, onComment, maxBufferSize } = config2, pendingFragments = [];
49673
+ let pendingFragmentsLength = 0, isFirstChunk = true, id, data = "", dataLines = 0, eventType, terminated = false;
49012
49674
  function feed(chunk) {
49675
+ if (terminated)
49676
+ throw new Error(
49677
+ "Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing."
49678
+ );
49013
49679
  if (isFirstChunk && (isFirstChunk = false, chunk.charCodeAt(0) === 239 && chunk.charCodeAt(1) === 187 && chunk.charCodeAt(2) === 191 && (chunk = chunk.slice(3))), pendingFragments.length === 0) {
49014
49680
  const trailing2 = processLines(chunk);
49015
- trailing2 !== "" && pendingFragments.push(trailing2);
49681
+ trailing2 !== "" && (pendingFragments.push(trailing2), pendingFragmentsLength = trailing2.length), checkBufferSize();
49016
49682
  return;
49017
49683
  }
49018
49684
  if (chunk.indexOf(`
49019
49685
  `) === -1 && chunk.indexOf("\r") === -1) {
49020
- pendingFragments.push(chunk);
49686
+ pendingFragments.push(chunk), pendingFragmentsLength += chunk.length, checkBufferSize();
49021
49687
  return;
49022
49688
  }
49023
49689
  pendingFragments.push(chunk);
49024
49690
  const input = pendingFragments.join("");
49025
- pendingFragments.length = 0;
49691
+ pendingFragments.length = 0, pendingFragmentsLength = 0;
49026
49692
  const trailing = processLines(input);
49027
- trailing !== "" && pendingFragments.push(trailing);
49693
+ trailing !== "" && (pendingFragments.push(trailing), pendingFragmentsLength = trailing.length), checkBufferSize();
49694
+ }
49695
+ function checkBufferSize() {
49696
+ maxBufferSize !== void 0 && (pendingFragmentsLength + data.length <= maxBufferSize || (terminated = true, pendingFragments.length = 0, pendingFragmentsLength = 0, id = void 0, data = "", dataLines = 0, eventType = void 0, onError(
49697
+ new ParseError(`Buffered data exceeded max buffer size of ${maxBufferSize} characters`, {
49698
+ type: "max-buffer-size-exceeded"
49699
+ })
49700
+ )));
49028
49701
  }
49029
49702
  function processLines(chunk) {
49030
49703
  let searchIndex = 0;
@@ -49084,7 +49757,7 @@ ${value2}`, dataLines++;
49084
49757
  }
49085
49758
  if (firstCharCode === 105 && chunk.charCodeAt(start + 1) === 100 && chunk.charCodeAt(start + 2) === 58) {
49086
49759
  const value2 = chunk.slice(chunk.charCodeAt(start + 3) === SPACE ? start + 4 : start + 3, end);
49087
- id = value2.includes("\0") ? void 0 : value2;
49760
+ value2.includes("\0") || (id = value2);
49088
49761
  return;
49089
49762
  }
49090
49763
  if (firstCharCode === 58) {
@@ -49112,7 +49785,7 @@ ${value2}`, dataLines++;
49112
49785
  ${value}`, dataLines++;
49113
49786
  break;
49114
49787
  case "id":
49115
- id = value.includes("\0") ? void 0 : value;
49788
+ value.includes("\0") || (id = value);
49116
49789
  break;
49117
49790
  case "retry":
49118
49791
  /^\d+$/.test(value) ? onRetry(parseInt(value, 10)) : onError(
@@ -49145,7 +49818,7 @@ ${value}`, dataLines++;
49145
49818
  const incompleteLine = pendingFragments.join("");
49146
49819
  parseLine(incompleteLine, 0, incompleteLine.length);
49147
49820
  }
49148
- isFirstChunk = true, id = void 0, data = "", dataLines = 0, eventType = void 0, pendingFragments.length = 0;
49821
+ isFirstChunk = true, id = void 0, data = "", dataLines = 0, eventType = void 0, pendingFragments.length = 0, pendingFragmentsLength = 0, terminated = false;
49149
49822
  }
49150
49823
  return { feed, reset };
49151
49824
  }
@@ -49156,9 +49829,9 @@ function isEventPrefix(chunk, i, firstCharCode) {
49156
49829
  return firstCharCode === 101 && chunk.charCodeAt(i + 1) === 118 && chunk.charCodeAt(i + 2) === 101 && chunk.charCodeAt(i + 3) === 110 && chunk.charCodeAt(i + 4) === 116 && chunk.charCodeAt(i + 5) === 58;
49157
49830
  }
49158
49831
 
49159
- // ../../node_modules/.pnpm/eventsource-parser@3.0.8/node_modules/eventsource-parser/dist/stream.js
49832
+ // ../../node_modules/.pnpm/eventsource-parser@3.1.1/node_modules/eventsource-parser/dist/stream.js
49160
49833
  var EventSourceParserStream = class extends TransformStream {
49161
- constructor({ onError, onRetry, onComment } = {}) {
49834
+ constructor({ onError, onRetry, onComment, maxBufferSize } = {}) {
49162
49835
  let parser;
49163
49836
  super({
49164
49837
  start(controller) {
@@ -49167,10 +49840,11 @@ var EventSourceParserStream = class extends TransformStream {
49167
49840
  controller.enqueue(event);
49168
49841
  },
49169
49842
  onError(error51) {
49170
- onError === "terminate" ? controller.error(error51) : typeof onError == "function" && onError(error51);
49843
+ typeof onError == "function" && onError(error51), (onError === "terminate" || error51.type === "max-buffer-size-exceeded") && controller.error(error51);
49171
49844
  },
49172
49845
  onRetry,
49173
- onComment
49846
+ onComment,
49847
+ maxBufferSize
49174
49848
  });
49175
49849
  },
49176
49850
  transform(chunk) {
@@ -49180,7 +49854,7 @@ var EventSourceParserStream = class extends TransformStream {
49180
49854
  }
49181
49855
  };
49182
49856
 
49183
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js
49857
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js
49184
49858
  var DEFAULT_STREAMABLE_HTTP_RECONNECTION_OPTIONS = {
49185
49859
  initialReconnectionDelay: 1e3,
49186
49860
  maxReconnectionDelay: 3e4,
@@ -49496,11 +50170,12 @@ var StreamableHTTPClientTransport = class {
49496
50170
  }
49497
50171
  const messages = Array.isArray(message) ? message : [message];
49498
50172
  const hasRequests = messages.filter((msg) => "method" in msg && "id" in msg && msg.id !== void 0).length > 0;
49499
- const contentType = response.headers.get("content-type");
50173
+ const contentType2 = response.headers.get("content-type");
50174
+ const responseMediaType = mediaTypeEssence(contentType2);
49500
50175
  if (hasRequests) {
49501
- if (contentType?.includes("text/event-stream")) {
50176
+ if (responseMediaType === "text/event-stream") {
49502
50177
  this._handleSseStream(response.body, { onresumptiontoken }, false);
49503
- } else if (contentType?.includes("application/json")) {
50178
+ } else if (responseMediaType === "application/json") {
49504
50179
  const data = await response.json();
49505
50180
  const responseMessages = Array.isArray(data) ? data.map((msg) => JSONRPCMessageSchema.parse(msg)) : [JSONRPCMessageSchema.parse(data)];
49506
50181
  for (const msg of responseMessages) {
@@ -49508,7 +50183,7 @@ var StreamableHTTPClientTransport = class {
49508
50183
  }
49509
50184
  } else {
49510
50185
  await response.body?.cancel();
49511
- throw new StreamableHTTPError(-1, `Unexpected content type: ${contentType}`);
50186
+ throw new StreamableHTTPError(-1, `Unexpected content type: ${contentType2}`);
49512
50187
  }
49513
50188
  } else {
49514
50189
  await response.body?.cancel();
@@ -49722,10 +50397,10 @@ var McpToolCodedError = class extends Error {
49722
50397
 
49723
50398
  // src/delivery/artifacts.ts
49724
50399
  async function deliverToArtifacts(client, projectSlug, payload, bareFetch) {
49725
- const { bytes: bytes3, class: artifactClass, contentType, description, filename, runId, taskId } = payload;
50400
+ const { bytes: bytes3, class: artifactClass, contentType: contentType2, description, filename, runId, taskId } = payload;
49726
50401
  const created = await client.createArtifactFile(projectSlug, {
49727
50402
  class: artifactClass,
49728
- contentType,
50403
+ contentType: contentType2,
49729
50404
  filename,
49730
50405
  runId,
49731
50406
  sizeBytes: bytes3.byteLength,
@@ -49738,14 +50413,14 @@ async function deliverToArtifacts(client, projectSlug, payload, bareFetch) {
49738
50413
  for (const [field, value] of Object.entries(created.upload.fields)) {
49739
50414
  form.append(field, value);
49740
50415
  }
49741
- form.append("file", new Blob([bytes3], { type: contentType }), filename);
50416
+ form.append("file", new Blob([bytes3], { type: contentType2 }), filename);
49742
50417
  const fetchImpl = bareFetch ?? globalThis.fetch;
49743
50418
  const uploadResponse = await fetchImpl(created.upload.url, { body: form, method: "POST" });
49744
50419
  if (!uploadResponse.ok) {
49745
50420
  throw new Error(`Presigned upload failed: ${uploadResponse.status} ${await uploadResponse.text()}`);
49746
50421
  }
49747
50422
  } else {
49748
- await client.uploadArtifactFileContent(projectSlug, created.artifact.id, bytes3, contentType);
50423
+ await client.uploadArtifactFileContent(projectSlug, created.artifact.id, bytes3, contentType2);
49749
50424
  }
49750
50425
  stage = "complete";
49751
50426
  const completed = await client.completeArtifactFile(projectSlug, created.artifact.id);
@@ -49765,7 +50440,7 @@ async function deliverToArtifacts(client, projectSlug, payload, bareFetch) {
49765
50440
  }
49766
50441
  });
49767
50442
  }
49768
- const markdown = contentType.startsWith("image/") ? `![${completed.filename}](${created.stableUrl})` : `[${completed.filename}](${created.stableUrl})`;
50443
+ const markdown = contentType2.startsWith("image/") ? `![${completed.filename}](${created.stableUrl})` : `[${completed.filename}](${created.stableUrl})`;
49769
50444
  return {
49770
50445
  artifactFile: completed,
49771
50446
  markdown,
@@ -52318,8 +52993,8 @@ async function findSessionDays(stateDir, sessionId) {
52318
52993
  function isRecord5(v) {
52319
52994
  return v !== null && typeof v === "object";
52320
52995
  }
52321
- function resolvePath(root, path26) {
52322
- const parts = path26.split(".");
52996
+ function resolvePath(root, path28) {
52997
+ const parts = path28.split(".");
52323
52998
  let cur = root;
52324
52999
  for (let i = 0; i < parts.length - 1; i += 1) {
52325
53000
  const part = parts[i];
@@ -52387,9 +53062,9 @@ async function gate(artifact, prose, ctx) {
52387
53062
  return { ok: true, gated: true, artifact: withheldExcerptClone(artifact) };
52388
53063
  }
52389
53064
  const maskedClone = typeof structuredClone === "function" ? structuredClone(artifact) : JSON.parse(JSON.stringify(artifact));
52390
- for (const { path: path26, masked } of fields) {
52391
- const target = resolvePath(maskedClone, path26);
52392
- if (!target) throw new Error(`pii-gate: path "${path26}" failed to resolve on the clone after validating on the original`);
53065
+ for (const { path: path28, masked } of fields) {
53066
+ const target = resolvePath(maskedClone, path28);
53067
+ if (!target) throw new Error(`pii-gate: path "${path28}" failed to resolve on the clone after validating on the original`);
52393
53068
  target.parent[target.key] = masked;
52394
53069
  }
52395
53070
  return { ok: true, gated: false, artifact: maskedClone };
@@ -52596,9 +53271,9 @@ var CheckoutRegistry = class {
52596
53271
  get(slug) {
52597
53272
  return this.read()[slug] ?? null;
52598
53273
  }
52599
- confirm(slug, path26, now) {
53274
+ confirm(slug, path28, now) {
52600
53275
  const all = this.read();
52601
- all[slug] = { path: path26, confirmedAt: now };
53276
+ all[slug] = { path: path28, confirmedAt: now };
52602
53277
  (0, import_node_fs6.writeFileSync)(this.file, JSON.stringify(all, null, 2));
52603
53278
  }
52604
53279
  /**
@@ -54580,8 +55255,8 @@ function createMrrlinTools(options) {
54580
55255
  "Unable to upload artifact file.",
54581
55256
  async (c, { projectSlug, path: filePath, class: artifactClass, taskId, runId, description }) => {
54582
55257
  const extension2 = import_node_path16.default.extname(filePath).toLowerCase();
54583
- const contentType = ARTIFACT_EXTENSION_TYPES[extension2];
54584
- if (!contentType) {
55258
+ const contentType2 = ARTIFACT_EXTENSION_TYPES[extension2];
55259
+ if (!contentType2) {
54585
55260
  throw new McpToolCodedError(
54586
55261
  "ARTIFACT_FILE_TYPE_UNSUPPORTED",
54587
55262
  `Unsupported artifact extension '${extension2}'. Allowed: ${Object.keys(ARTIFACT_EXTENSION_TYPES).join(", ")}.`
@@ -54612,7 +55287,7 @@ function createMrrlinTools(options) {
54612
55287
  c,
54613
55288
  projectSlug,
54614
55289
  "file_set",
54615
- { operation: "upload", bytes: bytes3, class: artifactClass, contentType, description, filename, runId, taskId },
55290
+ { operation: "upload", bytes: bytes3, class: artifactClass, contentType: contentType2, description, filename, runId, taskId },
54616
55291
  { mcpConfigPath: options.mcpConfigPath, bareFetch: options.fetch ?? globalThis.fetch, taskId, runId }
54617
55292
  );
54618
55293
  }
@@ -54630,8 +55305,8 @@ function createMrrlinTools(options) {
54630
55305
  );
54631
55306
  }
54632
55307
  const extension2 = import_node_path16.default.extname(filename).toLowerCase();
54633
- const contentType = ARTIFACT_EXTENSION_TYPES[extension2];
54634
- if (!contentType) {
55308
+ const contentType2 = ARTIFACT_EXTENSION_TYPES[extension2];
55309
+ if (!contentType2) {
54635
55310
  throw new McpToolCodedError(
54636
55311
  "ARTIFACT_FILE_TYPE_UNSUPPORTED",
54637
55312
  `Unsupported artifact extension '${extension2}'. Allowed: ${Object.keys(ARTIFACT_EXTENSION_TYPES).join(", ")}.`
@@ -54654,7 +55329,7 @@ function createMrrlinTools(options) {
54654
55329
  c,
54655
55330
  projectSlug,
54656
55331
  "file_set",
54657
- { operation: "upload", bytes: bytes3, class: artifactClass, contentType, description, filename, runId, taskId },
55332
+ { operation: "upload", bytes: bytes3, class: artifactClass, contentType: contentType2, description, filename, runId, taskId },
54658
55333
  { mcpConfigPath: options.mcpConfigPath, bareFetch: options.fetch ?? globalThis.fetch, taskId, runId }
54659
55334
  );
54660
55335
  }
@@ -55181,10 +55856,10 @@ async function verifyProviderReadiness(provider, run3, opts = {}) {
55181
55856
  }
55182
55857
 
55183
55858
  // src/director-bridge.ts
55184
- var import_node_fs22 = __toESM(require("node:fs"), 1);
55859
+ var import_node_fs23 = __toESM(require("node:fs"), 1);
55185
55860
  var import_node_http = __toESM(require("node:http"), 1);
55186
- var import_node_os16 = __toESM(require("node:os"), 1);
55187
- var import_node_path35 = __toESM(require("node:path"), 1);
55861
+ var import_node_os17 = __toESM(require("node:os"), 1);
55862
+ var import_node_path37 = __toESM(require("node:path"), 1);
55188
55863
  var import_node_child_process20 = require("node:child_process");
55189
55864
  var import_node_crypto15 = __toESM(require("node:crypto"), 1);
55190
55865
 
@@ -56315,7 +56990,7 @@ Do NOT derail the current task - if the operator has an in-flight question, answ
56315
56990
  }
56316
56991
 
56317
56992
  // src/_generated/version.ts
56318
- var PKG_VERSION = "0.4.80";
56993
+ var PKG_VERSION = "0.4.85";
56319
56994
 
56320
56995
  // src/api-base-url-migrate.ts
56321
56996
  var import_node_fs13 = __toESM(require("node:fs"), 1);
@@ -57414,15 +58089,15 @@ var cache = /* @__PURE__ */ new Map();
57414
58089
  function resolveInstallationId(stateDir) {
57415
58090
  const cached2 = cache.get(stateDir);
57416
58091
  if (cached2 !== void 0) return cached2;
57417
- const path26 = (0, import_node_path26.join)(stateDir, FILE_NAME);
58092
+ const path28 = (0, import_node_path26.join)(stateDir, FILE_NAME);
57418
58093
  let id;
57419
58094
  try {
57420
- id = (0, import_node_fs15.readFileSync)(path26, "utf8").trim();
58095
+ id = (0, import_node_fs15.readFileSync)(path28, "utf8").trim();
57421
58096
  if (!UUID.test(id)) throw new Error("unusable");
57422
58097
  } catch {
57423
58098
  id = (0, import_node_crypto12.randomUUID)();
57424
- (0, import_node_fs15.mkdirSync)((0, import_node_path26.dirname)(path26), { recursive: true });
57425
- (0, import_node_fs15.writeFileSync)(path26, `${id}
58099
+ (0, import_node_fs15.mkdirSync)((0, import_node_path26.dirname)(path28), { recursive: true });
58100
+ (0, import_node_fs15.writeFileSync)(path28, `${id}
57426
58101
  `, "utf8");
57427
58102
  }
57428
58103
  cache.set(stateDir, id);
@@ -59234,10 +59909,17 @@ var BASE_INSTRUCTIONS_PREFIX = [
59234
59909
  "Completion contract (the run is gated on this):",
59235
59910
  "- Act now, in this turn, whenever the tools to do the work are in reach, the work does not",
59236
59911
  " depend on waiting for external state, and any irreversible outward action it takes is already",
59237
- " covered by this turn's own recording obligation. The conveyor -- a scheduled follow-up task or",
59238
- " plan -- is the exception, entered only for a build-and-test cycle, work still unfinished when",
59239
- " the turn ends, or a decision only the operator can make. A task or plan exists to keep",
59240
- " unfinished work from being lost, not to authorize doing it later when it could be done now.",
59912
+ " covered by this turn's own recording obligation. BUT this applies ONLY to self-contained or",
59913
+ " routine work.",
59914
+ "- For large epics, complex integrations, or multi-step initiatives (e.g. adding a new",
59915
+ " payment provider, launching a broad marketing campaign, synthesizing a",
59916
+ " comprehensive UX research report, or setting up a database schema), you MUST NOT act",
59917
+ " immediately in chat. You must route substantial work through a tracked task or plan to ensure",
59918
+ " it goes through the proper Spec -> Consensus flow.",
59919
+ "- The conveyor (a scheduled follow-up task or plan) is the rule for complex work, and the exception",
59920
+ " for simple work, entered only for a build-and-test cycle, work still unfinished when",
59921
+ " the turn ends, or a decision only the operator can make. A task or plan exists to organize complex work",
59922
+ " and keep unfinished work from being lost, not to authorize doing it later when it could be done now.",
59241
59923
  "- Never file a clarifying question about anything the operator already answered in this thread.",
59242
59924
  " A complete instruction whose work is reachable in this turn gets done, then recorded -- it does",
59243
59925
  " not become a question.",
@@ -59278,6 +59960,9 @@ var BASE_INSTRUCTIONS_PREFIX = [
59278
59960
  " NOT a product/scope decision, which is legitimately the operator's call -- first search for it:",
59279
59961
  " search_wiki_pages / retrieve_context, and re-read anything already loaded in this run's context",
59280
59962
  " bundle. Only hand off for that input if the search comes up empty.",
59963
+ "- When a task requires an external service (e.g. PostgreSQL, Notion, Linear, Slack, Stripe, Supabase, Brave Search)",
59964
+ " that is not currently granted or reachable, do not fake credentials or pretend to execute it. Note the missing",
59965
+ " capability in the spec or handoff and direct the operator to [Integrations](/integrations) to grant it in 1 click.",
59281
59966
  "",
59282
59967
  "File artifacts:",
59283
59968
  "- Decide BEFORE writing your result, by PROVENANCE: output assembled from data you RETRIEVED",
@@ -59464,26 +60149,26 @@ function newArtifactId() {
59464
60149
  return `EA-${import_node_crypto13.default.randomUUID()}`;
59465
60150
  }
59466
60151
  var BLAST_RADIUS_FLOOR_PATTERNS = [/^supabase\/migrations\//, /^packages\/db\/src\/schema\.ts$/];
59467
- function isBlastRadiusFloorPath(path26) {
59468
- return BLAST_RADIUS_FLOOR_PATTERNS.some((re) => re.test(path26));
60152
+ function isBlastRadiusFloorPath(path28) {
60153
+ return BLAST_RADIUS_FLOOR_PATTERNS.some((re) => re.test(path28));
59469
60154
  }
59470
60155
  var execFileAsync2 = (0, import_node_util2.promisify)(import_node_child_process18.execFile);
59471
60156
  async function defaultListRunDiffPaths(opts) {
59472
- const parse6 = (stdout) => stdout.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
60157
+ const parse7 = (stdout) => stdout.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
59473
60158
  try {
59474
60159
  const { stdout } = await execFileAsync2(
59475
60160
  "git",
59476
60161
  ["-C", opts.worktreePath, "diff", "--name-only", `origin/${opts.defaultBranch}...HEAD`],
59477
60162
  { timeout: 3e4 }
59478
60163
  );
59479
- return parse6(stdout);
60164
+ return parse7(stdout);
59480
60165
  } catch {
59481
60166
  const { stdout } = await execFileAsync2(
59482
60167
  "git",
59483
60168
  ["-C", opts.worktreePath, "diff", "--name-only", `${opts.defaultBranch}...HEAD`],
59484
60169
  { timeout: 3e4 }
59485
60170
  );
59486
- return parse6(stdout);
60171
+ return parse7(stdout);
59487
60172
  }
59488
60173
  }
59489
60174
  var BLAST_RADIUS_FLOOR_REASON = "migration or database schema files changed";
@@ -60057,7 +60742,8 @@ ${renderTaskStateSection(taskState)}`;
60057
60742
  // self-censor). The read-only path keeps the never-write restriction.
60058
60743
  baseInstructions: useExecutor ? EXECUTOR_BASE_INSTRUCTIONS : CONSUMER_BASE_INSTRUCTIONS,
60059
60744
  developerInstructions: null,
60060
- ephemeral: null
60745
+ ephemeral: null,
60746
+ mcpConfig: deps.mcpConfigPath
60061
60747
  };
60062
60748
  let resumed = true;
60063
60749
  let acquireResult;
@@ -60284,16 +60970,15 @@ Continue executing task ${task.id}. Make the next concrete increment of progress
60284
60970
  if (!expectedRepoFullName) {
60285
60971
  throw new Error(`push aborted: project ${projectSlug} has no bound GitHub repository`);
60286
60972
  }
60973
+ const pushFn2 = deps.pushRunBranch ?? pushRunBranch;
60287
60974
  const locksDir = deps.locksDir ?? "/tmp/mrrlin-locks";
60288
60975
  await withCheckoutLock(locksDir, projectSlug, async () => {
60289
- await pushFn({
60976
+ await pushFn2({
60290
60977
  worktreePath,
60291
60978
  locksDir,
60292
60979
  slug: projectSlug,
60293
60980
  runId,
60294
60981
  expectedRepoFullName,
60295
- // Guard a stale/wrong tree against the SHA recorded for the run at execution time
60296
- // (null until head_sha recording is wired — then the guard activates automatically).
60297
60982
  expectedSha: claimed.headSha ?? null,
60298
60983
  alreadyLocked: true
60299
60984
  });
@@ -60353,7 +61038,8 @@ Continue executing task ${task.id}. Make the next concrete increment of progress
60353
61038
  await postRunFeed(deps.client, projectSlug, runId, readiness.task.id, "demoted_blast_radius", { reason });
60354
61039
  }
60355
61040
  }
60356
- if (readiness.task.autoDeploy !== "dev" && readiness.task.autoDeploy !== "prod") {
61041
+ const autoDeploy = readiness.task.autoDeploy;
61042
+ if (autoDeploy === "off") {
60357
61043
  await deps.client.updateExecutionRun(projectSlug, runId, {
60358
61044
  leaseId,
60359
61045
  pullRequestUrl: pr.url,
@@ -60725,7 +61411,8 @@ async function driveNonCodeRun(deps, projectSlug, runId, leaseId, task, domain2)
60725
61411
  cwd: deps.codexCwd ?? process.cwd(),
60726
61412
  timeoutMs: DELIVERABLE_AUTHOR_TIMEOUT_MS,
60727
61413
  sandbox: "read-only",
60728
- codexExecutable: deps.codexExecutable
61414
+ codexExecutable: deps.codexExecutable,
61415
+ mcpConfig: deps.mcpConfigPath
60729
61416
  });
60730
61417
  if (!exec.ok) {
60731
61418
  await failRun(deps, projectSlug, task, runId, leaseId, `deliverable_authoring_failed: ${exec.error}`);
@@ -61423,6 +62110,114 @@ async function runAsyncBackstopSweep(deps, drive = (slug, jobId) => driveAsyncJo
61423
62110
  }
61424
62111
  }
61425
62112
 
62113
+ // src/bridge-artifacts.ts
62114
+ var import_node_fs18 = __toESM(require("node:fs"), 1);
62115
+ var import_promises14 = __toESM(require("node:fs/promises"), 1);
62116
+ var import_node_path31 = __toESM(require("node:path"), 1);
62117
+ var DEFAULT_MAX_ARTIFACTS_BYTES = 500 * 1024 * 1024;
62118
+ var DEFAULT_MAX_ARTIFACT_AGE_MS = 7 * 24 * 60 * 60 * 1e3;
62119
+ function resolveArtifactsDir(baseStateDir) {
62120
+ const stateDir = baseStateDir ?? resolveStateDir();
62121
+ return import_node_path31.default.join(stateDir, "artifacts");
62122
+ }
62123
+ function ensureDir(dir) {
62124
+ import_node_fs18.default.mkdirSync(dir, { recursive: true, mode: 448 });
62125
+ try {
62126
+ import_node_fs18.default.chmodSync(dir, 448);
62127
+ } catch {
62128
+ }
62129
+ }
62130
+ function safeArtifactPath(artifactsDir, id) {
62131
+ if (!id || typeof id !== "string" || !/^[a-zA-Z0-9_-]+$/.test(id)) {
62132
+ throw new Error("Invalid artifact id");
62133
+ }
62134
+ return import_node_path31.default.join(artifactsDir, `${id}.json`);
62135
+ }
62136
+ async function writeLocalArtifact(id, payload, baseStateDir) {
62137
+ const artifactsDir = resolveArtifactsDir(baseStateDir);
62138
+ ensureDir(artifactsDir);
62139
+ const filePath = safeArtifactPath(artifactsDir, id);
62140
+ const content = JSON.stringify(payload ?? {});
62141
+ await import_promises14.default.writeFile(filePath, content, { mode: 384, encoding: "utf8" });
62142
+ try {
62143
+ await import_promises14.default.chmod(filePath, 384);
62144
+ } catch {
62145
+ }
62146
+ return filePath;
62147
+ }
62148
+ async function readLocalArtifact(id, baseStateDir) {
62149
+ const artifactsDir = resolveArtifactsDir(baseStateDir);
62150
+ try {
62151
+ const filePath = safeArtifactPath(artifactsDir, id);
62152
+ const content = await import_promises14.default.readFile(filePath, "utf8");
62153
+ return JSON.parse(content);
62154
+ } catch (err) {
62155
+ if (err?.code === "ENOENT") {
62156
+ return null;
62157
+ }
62158
+ return null;
62159
+ }
62160
+ }
62161
+ async function cleanArtifacts(baseStateDir, options) {
62162
+ const artifactsDir = resolveArtifactsDir(baseStateDir);
62163
+ const maxAgeMs = options?.maxAgeMs ?? DEFAULT_MAX_ARTIFACT_AGE_MS;
62164
+ const maxTotalBytes = options?.maxTotalBytes ?? DEFAULT_MAX_ARTIFACTS_BYTES;
62165
+ let entries = [];
62166
+ try {
62167
+ entries = await import_promises14.default.readdir(artifactsDir);
62168
+ } catch {
62169
+ return { deletedCount: 0, deletedBytes: 0 };
62170
+ }
62171
+ const now = Date.now();
62172
+ const files = [];
62173
+ let deletedCount = 0;
62174
+ let deletedBytes = 0;
62175
+ for (const name of entries) {
62176
+ if (!name.endsWith(".json")) continue;
62177
+ const filePath = import_node_path31.default.join(artifactsDir, name);
62178
+ try {
62179
+ const stat3 = await import_promises14.default.stat(filePath);
62180
+ if (now - stat3.mtimeMs > maxAgeMs) {
62181
+ await import_promises14.default.unlink(filePath);
62182
+ deletedCount++;
62183
+ deletedBytes += stat3.size;
62184
+ } else {
62185
+ files.push({ name, path: filePath, size: stat3.size, mtimeMs: stat3.mtimeMs });
62186
+ }
62187
+ } catch {
62188
+ }
62189
+ }
62190
+ let currentTotalBytes = files.reduce((acc, f) => acc + f.size, 0);
62191
+ if (currentTotalBytes > maxTotalBytes) {
62192
+ files.sort((a, b) => a.mtimeMs - b.mtimeMs);
62193
+ for (const f of files) {
62194
+ if (currentTotalBytes <= maxTotalBytes) break;
62195
+ try {
62196
+ await import_promises14.default.unlink(f.path);
62197
+ deletedCount++;
62198
+ deletedBytes += f.size;
62199
+ currentTotalBytes -= f.size;
62200
+ } catch {
62201
+ }
62202
+ }
62203
+ }
62204
+ return { deletedCount, deletedBytes };
62205
+ }
62206
+ function startArtifactsGc(baseStateDir, intervalMs = 10 * 60 * 1e3, options) {
62207
+ const timer = setInterval(() => {
62208
+ cleanArtifacts(baseStateDir, options).catch((err) => {
62209
+ process.stderr.write(
62210
+ `[mrrlin-mcp bridge-artifacts] GC failed: ${err instanceof Error ? err.message : String(err)}
62211
+ `
62212
+ );
62213
+ });
62214
+ }, intervalMs);
62215
+ timer.unref();
62216
+ return {
62217
+ stop: () => clearInterval(timer)
62218
+ };
62219
+ }
62220
+
61426
62221
  // src/chat-compaction.ts
61427
62222
  var DEFAULT_COMPACTION_SEED_BUDGET_BYTES = 8e3;
61428
62223
  var DEFAULT_COMPACTION_TIMEOUT_MS = 3e4;
@@ -61606,16 +62401,16 @@ function agentIdleMs(provider) {
61606
62401
  }
61607
62402
 
61608
62403
  // src/thread-index.ts
61609
- var import_node_fs18 = require("node:fs");
61610
- var import_node_path31 = __toESM(require("node:path"), 1);
62404
+ var import_node_fs19 = require("node:fs");
62405
+ var import_node_path32 = __toESM(require("node:path"), 1);
61611
62406
  function threadIndexPath(stateDir) {
61612
- return import_node_path31.default.join(stateDir, "threads.json");
62407
+ return import_node_path32.default.join(stateDir, "threads.json");
61613
62408
  }
61614
62409
  function loadThreadIndex(stateDir, ttlMs, now) {
61615
62410
  const result = /* @__PURE__ */ new Map();
61616
62411
  let parsed;
61617
62412
  try {
61618
- parsed = JSON.parse((0, import_node_fs18.readFileSync)(threadIndexPath(stateDir), "utf8"));
62413
+ parsed = JSON.parse((0, import_node_fs19.readFileSync)(threadIndexPath(stateDir), "utf8"));
61619
62414
  } catch {
61620
62415
  return result;
61621
62416
  }
@@ -61638,8 +62433,8 @@ function loadThreadIndex(stateDir, ttlMs, now) {
61638
62433
  return result;
61639
62434
  }
61640
62435
  function saveThreadIndex(stateDir, entries) {
61641
- (0, import_node_fs18.mkdirSync)(stateDir, { recursive: true, mode: 448 });
61642
- (0, import_node_fs18.writeFileSync)(threadIndexPath(stateDir), `${JSON.stringify(Object.fromEntries(entries), null, 2)}
62436
+ (0, import_node_fs19.mkdirSync)(stateDir, { recursive: true, mode: 448 });
62437
+ (0, import_node_fs19.writeFileSync)(threadIndexPath(stateDir), `${JSON.stringify(Object.fromEntries(entries), null, 2)}
61643
62438
  `, {
61644
62439
  encoding: "utf8",
61645
62440
  mode: 384
@@ -61775,9 +62570,9 @@ function createToolBusyClock(opts) {
61775
62570
 
61776
62571
  // src/remote-phone-relay.ts
61777
62572
  var import_node_events3 = require("node:events");
61778
- var import_node_fs19 = require("node:fs");
62573
+ var import_node_fs20 = require("node:fs");
61779
62574
  var import_node_os14 = require("node:os");
61780
- var import_node_path32 = require("node:path");
62575
+ var import_node_path33 = require("node:path");
61781
62576
 
61782
62577
  // ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/cryptoNode.js
61783
62578
  var nc = __toESM(require("node:crypto"), 1);
@@ -65348,9 +66143,9 @@ var DirectorRelay = class {
65348
66143
 
65349
66144
  // src/remote-phone-relay.ts
65350
66145
  function loadOrCreateAgentDeviceKey() {
65351
- const path26 = (0, import_node_path32.join)((0, import_node_os14.homedir)(), ".mrrlin", "agent-device-key");
66146
+ const path28 = (0, import_node_path33.join)((0, import_node_os14.homedir)(), ".mrrlin", "agent-device-key");
65352
66147
  try {
65353
- const raw = JSON.parse((0, import_node_fs19.readFileSync)(path26, "utf8"));
66148
+ const raw = JSON.parse((0, import_node_fs20.readFileSync)(path28, "utf8"));
65354
66149
  if (typeof raw.priv === "string" && typeof raw.pub === "string") {
65355
66150
  return { privateKey: fromBase64Url(raw.priv), publicKey: fromBase64Url(raw.pub) };
65356
66151
  }
@@ -65358,9 +66153,9 @@ function loadOrCreateAgentDeviceKey() {
65358
66153
  }
65359
66154
  const kp = generateIdentityKeyPair();
65360
66155
  try {
65361
- (0, import_node_fs19.mkdirSync)((0, import_node_path32.join)((0, import_node_os14.homedir)(), ".mrrlin"), { recursive: true });
65362
- (0, import_node_fs19.writeFileSync)(
65363
- path26,
66156
+ (0, import_node_fs20.mkdirSync)((0, import_node_path33.join)((0, import_node_os14.homedir)(), ".mrrlin"), { recursive: true });
66157
+ (0, import_node_fs20.writeFileSync)(
66158
+ path28,
65364
66159
  JSON.stringify({ priv: toBase64Url(kp.privateKey), pub: toBase64Url(kp.publicKey) }),
65365
66160
  { mode: 384 }
65366
66161
  );
@@ -65368,10 +66163,10 @@ function loadOrCreateAgentDeviceKey() {
65368
66163
  }
65369
66164
  return kp;
65370
66165
  }
65371
- var AGENT_PAIRING_PATH = (0, import_node_path32.join)((0, import_node_os14.homedir)(), ".mrrlin", "agent-pairing.json");
66166
+ var AGENT_PAIRING_PATH = (0, import_node_path33.join)((0, import_node_os14.homedir)(), ".mrrlin", "agent-pairing.json");
65372
66167
  function loadAgentPairing() {
65373
66168
  try {
65374
- const raw = JSON.parse((0, import_node_fs19.readFileSync)(AGENT_PAIRING_PATH, "utf8"));
66169
+ const raw = JSON.parse((0, import_node_fs20.readFileSync)(AGENT_PAIRING_PATH, "utf8"));
65375
66170
  if (typeof raw.channelId === "string" && typeof raw.agentControlSecret === "string" && typeof raw.relayAuth === "string" && typeof raw.peerIdentityKey === "string") {
65376
66171
  return {
65377
66172
  channelId: raw.channelId,
@@ -65386,8 +66181,8 @@ function loadAgentPairing() {
65386
66181
  }
65387
66182
  function saveAgentPairing(record2) {
65388
66183
  try {
65389
- (0, import_node_fs19.mkdirSync)((0, import_node_path32.join)((0, import_node_os14.homedir)(), ".mrrlin"), { recursive: true });
65390
- (0, import_node_fs19.writeFileSync)(AGENT_PAIRING_PATH, JSON.stringify(record2), { mode: 384 });
66184
+ (0, import_node_fs20.mkdirSync)((0, import_node_path33.join)((0, import_node_os14.homedir)(), ".mrrlin"), { recursive: true });
66185
+ (0, import_node_fs20.writeFileSync)(AGENT_PAIRING_PATH, JSON.stringify(record2), { mode: 384 });
65391
66186
  } catch {
65392
66187
  }
65393
66188
  }
@@ -65810,9 +66605,9 @@ function extractVerificationSection(markdown) {
65810
66605
  }
65811
66606
 
65812
66607
  // src/director-reseed.ts
65813
- var import_node_fs20 = require("node:fs");
66608
+ var import_node_fs21 = require("node:fs");
65814
66609
  var import_node_readline = require("node:readline");
65815
- var import_node_path33 = require("node:path");
66610
+ var import_node_path34 = require("node:path");
65816
66611
  function estimateTokens(s) {
65817
66612
  return Buffer.byteLength(s, "utf8");
65818
66613
  }
@@ -65944,9 +66739,9 @@ async function readSessionRows(logsDir, files, sessionIds) {
65944
66739
  const lines2 = [];
65945
66740
  let missingFiles = 0;
65946
66741
  for (const f of files) {
65947
- const filePath = (0, import_node_path33.join)(logsDir, f);
66742
+ const filePath = (0, import_node_path34.join)(logsDir, f);
65948
66743
  try {
65949
- const stream = (0, import_node_fs20.createReadStream)(filePath, { encoding: "utf8" });
66744
+ const stream = (0, import_node_fs21.createReadStream)(filePath, { encoding: "utf8" });
65950
66745
  const rl = (0, import_node_readline.createInterface)({ input: stream, crlfDelay: Infinity });
65951
66746
  try {
65952
66747
  for await (const line of rl) {
@@ -65970,18 +66765,18 @@ async function readSessionRows(logsDir, files, sessionIds) {
65970
66765
  }
65971
66766
 
65972
66767
  // src/external-agents-scrub.ts
65973
- var import_node_fs21 = __toESM(require("node:fs"), 1);
66768
+ var import_node_fs22 = __toESM(require("node:fs"), 1);
65974
66769
  var import_node_os15 = __toESM(require("node:os"), 1);
65975
- var import_node_path34 = __toESM(require("node:path"), 1);
66770
+ var import_node_path35 = __toESM(require("node:path"), 1);
65976
66771
  var REDACTION = "[REDACTED]";
65977
66772
  var SHORT_VALUE_THRESHOLD = 8;
65978
- var KEYS_ENV_PATH = () => import_node_path34.default.join(import_node_os15.default.homedir(), ".local", "state", "external-agents", "keys.env");
66773
+ var KEYS_ENV_PATH = () => import_node_path35.default.join(import_node_os15.default.homedir(), ".local", "state", "external-agents", "keys.env");
65979
66774
  var keysEnvCache = null;
65980
66775
  function readKeysEnv() {
65981
66776
  const filePath = KEYS_ENV_PATH();
65982
66777
  let mtimeMs = 0;
65983
66778
  try {
65984
- mtimeMs = import_node_fs21.default.statSync(filePath).mtimeMs;
66779
+ mtimeMs = import_node_fs22.default.statSync(filePath).mtimeMs;
65985
66780
  } catch {
65986
66781
  mtimeMs = 0;
65987
66782
  }
@@ -65990,7 +66785,7 @@ function readKeysEnv() {
65990
66785
  }
65991
66786
  const map2 = /* @__PURE__ */ new Map();
65992
66787
  try {
65993
- const content = import_node_fs21.default.readFileSync(filePath, "utf8");
66788
+ const content = import_node_fs22.default.readFileSync(filePath, "utf8");
65994
66789
  for (const rawLine of content.split(/\r?\n/)) {
65995
66790
  const line = rawLine.trim();
65996
66791
  if (line === "" || line.startsWith("#")) continue;
@@ -66408,7 +67203,7 @@ function addBridgeModel(target, model) {
66408
67203
  }
66409
67204
  function readTextIfExists(filePath) {
66410
67205
  try {
66411
- return import_node_fs22.default.readFileSync(filePath, "utf8");
67206
+ return import_node_fs23.default.readFileSync(filePath, "utf8");
66412
67207
  } catch {
66413
67208
  return null;
66414
67209
  }
@@ -66419,9 +67214,9 @@ function readKnownGptSlugsFromTomlFile(filePath) {
66419
67214
  return Array.from(raw.matchAll(/^\s*model\s*=\s*"([^"]+)"/gm)).map((match) => match[1]?.trim() ?? "").filter(isSelectableModelSlug);
66420
67215
  }
66421
67216
  function readCodexFallbackModels() {
66422
- const codexHome = process.env.CODEX_HOME?.trim() || import_node_path35.default.join(import_node_os16.default.homedir(), ".codex");
67217
+ const codexHome = process.env.CODEX_HOME?.trim() || import_node_path37.default.join(import_node_os17.default.homedir(), ".codex");
66423
67218
  const models = /* @__PURE__ */ new Map();
66424
- const cachePath = import_node_path35.default.join(codexHome, "models_cache.json");
67219
+ const cachePath = import_node_path37.default.join(codexHome, "models_cache.json");
66425
67220
  const cacheRaw = readTextIfExists(cachePath);
66426
67221
  if (cacheRaw) {
66427
67222
  try {
@@ -66471,7 +67266,7 @@ function readCodexFallbackModels() {
66471
67266
  );
66472
67267
  }
66473
67268
  }
66474
- for (const slug of readKnownGptSlugsFromTomlFile(import_node_path35.default.join(codexHome, "config.toml"))) {
67269
+ for (const slug of readKnownGptSlugsFromTomlFile(import_node_path37.default.join(codexHome, "config.toml"))) {
66475
67270
  addBridgeModel(
66476
67271
  models,
66477
67272
  mapBridgeModel({
@@ -66485,11 +67280,11 @@ function readCodexFallbackModels() {
66485
67280
  })
66486
67281
  );
66487
67282
  }
66488
- const automationsDir = import_node_path35.default.join(codexHome, "automations");
67283
+ const automationsDir = import_node_path37.default.join(codexHome, "automations");
66489
67284
  try {
66490
- for (const entry of import_node_fs22.default.readdirSync(automationsDir, { withFileTypes: true })) {
67285
+ for (const entry of import_node_fs23.default.readdirSync(automationsDir, { withFileTypes: true })) {
66491
67286
  if (!entry.isDirectory()) continue;
66492
- for (const slug of readKnownGptSlugsFromTomlFile(import_node_path35.default.join(automationsDir, entry.name, "automation.toml"))) {
67287
+ for (const slug of readKnownGptSlugsFromTomlFile(import_node_path37.default.join(automationsDir, entry.name, "automation.toml"))) {
66493
67288
  addBridgeModel(
66494
67289
  models,
66495
67290
  mapBridgeModel({
@@ -66515,9 +67310,9 @@ function selfUpdateInboxItemId(offeredVersion) {
66515
67310
  return `II-MCPUPD-${offeredVersion.replace(/[^A-Za-z0-9._-]/g, "-")}-${hash3}`;
66516
67311
  }
66517
67312
  function neutralCheckoutCwd(stateDir) {
66518
- const dir = import_node_path35.default.join(stateDir, "no-checkout");
67313
+ const dir = import_node_path37.default.join(stateDir, "no-checkout");
66519
67314
  try {
66520
- import_node_fs22.default.mkdirSync(dir, { recursive: true });
67315
+ import_node_fs23.default.mkdirSync(dir, { recursive: true });
66521
67316
  } catch {
66522
67317
  }
66523
67318
  return dir;
@@ -66696,6 +67491,11 @@ function buildThreadStartParams(msg, config2, desiredModel) {
66696
67491
  " the default, not the only option: see the browser-vs-fetch contract below for when a fetch is",
66697
67492
  " the wrong tool outright and when a failed fetch must be escalated to `mrrlin-browser`.",
66698
67493
  "",
67494
+ "Integrations & external capability proactive guidance:",
67495
+ "- When an operator request or planned task requires an external service (e.g. database schema/queries via PostgreSQL, documentation sync with Notion, task tracking in Linear, team notifications with Slack, payments via Stripe, web scraping with Puppeteer, cloud database/storage with Supabase, or external search via Brave Search) that is not currently granted to the project or available on the host:",
67496
+ "- Proactively inform the operator which integration is needed and provide a direct link to the integrations page: [Integrations](/integrations).",
67497
+ "- Explain that they can browse the Public Marketplace, discover installed local MCP servers from Claude / Codex / Antigravity, and grant project permissions in 1 click.",
67498
+ "",
66699
67499
  "Handoff contract \u2014 durable operator action MUST NOT live only in chat:",
66700
67500
  "- If you conclude that a specific task needs human input, account access, manual evidence,",
66701
67501
  " or an operator decision before it can be closed or advanced, call `create_inbox_item`",
@@ -67028,7 +67828,7 @@ async function runOrphanWorktreeSweep(client, opts) {
67028
67828
  const cutoff = Date.now() - worktreeRetentionMs();
67029
67829
  const isReapable = (worktreePath) => {
67030
67830
  try {
67031
- return import_node_fs22.default.statSync(worktreePath).mtimeMs < cutoff;
67831
+ return import_node_fs23.default.statSync(worktreePath).mtimeMs < cutoff;
67032
67832
  } catch {
67033
67833
  return false;
67034
67834
  }
@@ -67104,7 +67904,7 @@ function applyPnaHeaders(res, requestOrigin, allowed) {
67104
67904
  res.setHeader("Vary", "Origin");
67105
67905
  }
67106
67906
  function createBridgeRequestListener(opts) {
67107
- const { host, port, token, allowedOrigins, getHealth } = opts;
67907
+ const { host, port, token, allowedOrigins, stateDir, getHealth } = opts;
67108
67908
  return (req, res) => {
67109
67909
  const requestOrigin = typeof req.headers.origin === "string" ? req.headers.origin : void 0;
67110
67910
  if (req.method === "OPTIONS") {
@@ -67126,6 +67926,44 @@ function createBridgeRequestListener(opts) {
67126
67926
  return;
67127
67927
  }
67128
67928
  const url2 = new URL(req.url, `http://${req.headers.host ?? `${host}:${port}`}`);
67929
+ if (url2.pathname.startsWith("/artifacts/")) {
67930
+ if (req.method !== "GET") {
67931
+ res.writeHead(405).end();
67932
+ return;
67933
+ }
67934
+ applyPnaHeaders(res, requestOrigin, allowedOrigins);
67935
+ if (requestOrigin !== void 0 && !isOriginAllowed(requestOrigin, allowedOrigins)) {
67936
+ res.writeHead(403, { "content-type": "application/json" });
67937
+ res.end(JSON.stringify({ ok: false, error: "Origin not allowed." }));
67938
+ return;
67939
+ }
67940
+ const authHeader = (req.headers.authorization ?? "").trim();
67941
+ const match = /^Bearer\s+(\S+)$/i.exec(authHeader);
67942
+ if (!match || match[1] !== token) {
67943
+ res.writeHead(401, { "content-type": "application/json" });
67944
+ res.end(JSON.stringify({ ok: false, error: "Unauthorized" }));
67945
+ return;
67946
+ }
67947
+ const artifactId = decodeURIComponent(url2.pathname.slice("/artifacts/".length).trim());
67948
+ if (!artifactId) {
67949
+ res.writeHead(400, { "content-type": "application/json" });
67950
+ res.end(JSON.stringify({ ok: false, error: "Artifact ID required." }));
67951
+ return;
67952
+ }
67953
+ readLocalArtifact(artifactId, stateDir).then((payload) => {
67954
+ if (!payload) {
67955
+ res.writeHead(404, { "content-type": "application/json" });
67956
+ res.end(JSON.stringify({ ok: false, error: "Artifact not found." }));
67957
+ return;
67958
+ }
67959
+ res.writeHead(200, { "content-type": "application/json" });
67960
+ res.end(JSON.stringify({ ok: true, data: { id: artifactId, payload }, payload }));
67961
+ }).catch((err) => {
67962
+ res.writeHead(500, { "content-type": "application/json" });
67963
+ res.end(JSON.stringify({ ok: false, error: err instanceof Error ? err.message : String(err) }));
67964
+ });
67965
+ return;
67966
+ }
67129
67967
  if (url2.pathname === "/pair") {
67130
67968
  const origin = (url2.searchParams.get("origin") ?? "").trim();
67131
67969
  const originAllowed = isOriginAllowed(origin, allowedOrigins);
@@ -67507,7 +68345,7 @@ function createBridgeMessageHandler(deps) {
67507
68345
  sendForSpan({ type: "checkout-state", ok: false, error: { code: "invalid_input", fields: { projectSlug: "required" } } });
67508
68346
  return;
67509
68347
  }
67510
- const state = readCheckoutState(deps.checkoutRegistry, projectSlug, import_node_os16.default.hostname());
68348
+ const state = readCheckoutState(deps.checkoutRegistry, projectSlug, import_node_os17.default.hostname());
67511
68349
  if (!state) {
67512
68350
  sendForSpan({ type: "checkout-state", ok: false, error: { code: "checkout_missing" } });
67513
68351
  return;
@@ -67539,7 +68377,7 @@ function createBridgeMessageHandler(deps) {
67539
68377
  const result = registerCheckout(
67540
68378
  deps.checkoutRegistry,
67541
68379
  { projectSlug, path: typeof msg.path === "string" ? msg.path : "", repo },
67542
- import_node_os16.default.hostname()
68380
+ import_node_os17.default.hostname()
67543
68381
  );
67544
68382
  if (!result.ok) {
67545
68383
  sendForSpan({ type: "checkout-register", ok: false, error: { code: result.code, detail: result.detail } });
@@ -67595,6 +68433,50 @@ function createBridgeMessageHandler(deps) {
67595
68433
  });
67596
68434
  return;
67597
68435
  }
68436
+ if (msg.type === "list-installed-mcp-servers" || msg.type === "get_installed_mcp_servers") {
68437
+ const requestId = typeof msg.requestId === "string" ? msg.requestId : void 0;
68438
+ try {
68439
+ const servers = listDiscoveredMcpServers();
68440
+ sendForSpan({
68441
+ type: "installed-mcp-servers",
68442
+ requestId,
68443
+ ok: true,
68444
+ data: { servers }
68445
+ });
68446
+ } catch (err) {
68447
+ sendForSpan({
68448
+ type: "installed-mcp-servers",
68449
+ requestId,
68450
+ ok: false,
68451
+ error: { code: "discovery_failed", detail: err instanceof Error ? err.message : String(err) }
68452
+ });
68453
+ }
68454
+ return;
68455
+ }
68456
+ if (msg.type === "install-public-mcp-server") {
68457
+ const typedMsg = msg;
68458
+ try {
68459
+ const { installPublicMcpServerToConfigs: installPublicMcpServerToConfigs2 } = await Promise.resolve().then(() => (init_install_public_mcp(), install_public_mcp_exports));
68460
+ await installPublicMcpServerToConfigs2(typedMsg.id, {
68461
+ command: typedMsg.command,
68462
+ args: typedMsg.args,
68463
+ env: typedMsg.env
68464
+ });
68465
+ sendForSpan({
68466
+ type: "install-public-mcp-server-response",
68467
+ requestId: typedMsg.requestId,
68468
+ ok: true
68469
+ });
68470
+ } catch (err) {
68471
+ sendForSpan({
68472
+ type: "install-public-mcp-server-response",
68473
+ requestId: typedMsg.requestId,
68474
+ ok: false,
68475
+ error: { code: "install_failed", detail: err instanceof Error ? err.message : String(err) }
68476
+ });
68477
+ }
68478
+ return;
68479
+ }
67598
68480
  if (msg.type === "agents-state") {
67599
68481
  if (!deps.runExternalAgentsCli) {
67600
68482
  sendForSpan({ type: "agents-state", ok: false, error: { code: "bridge_offline", detail: "external-agents is not configured on this bridge" } });
@@ -68646,6 +69528,18 @@ async function startDirectorBridge() {
68646
69528
  }
68647
69529
  const hasStaticToken = !agentSecret && Boolean(envToken ?? readOperatorToken());
68648
69530
  const client = createMrrlinClient({ baseUrl: apiBaseUrl, fetch: authedFetch });
69531
+ const originalAppendExecutionArtifact = client.appendExecutionArtifact.bind(client);
69532
+ client.appendExecutionArtifact = async (projectSlug, runId, artifact) => {
69533
+ if (artifact.payload && Object.keys(artifact.payload).length > 0) {
69534
+ await writeLocalArtifact(artifact.id, artifact.payload, config2.stateDir);
69535
+ }
69536
+ const isBridgeHosted = artifact.kind === "command_output" || artifact.kind === "test_result" || artifact.kind === "diff_summary" || artifact.kind === "error";
69537
+ return originalAppendExecutionArtifact(projectSlug, runId, {
69538
+ ...artifact,
69539
+ payload: isBridgeHosted ? {} : artifact.payload ?? {}
69540
+ });
69541
+ };
69542
+ const artifactsGc = startArtifactsGc(config2.stateDir);
68649
69543
  const agentKeepalive = createAgentKeepalive({
68650
69544
  acquire: (providerId) => resolveProvider(process.env, providerId).acquireWarm(),
68651
69545
  release: (providerId) => resolveProvider(process.env, providerId).releaseWarm(),
@@ -68667,8 +69561,8 @@ async function startDirectorBridge() {
68667
69561
  codexCwd: config2.codexCwd,
68668
69562
  codexExecutable: config2.codexExecutable,
68669
69563
  checkoutRegistry,
68670
- worktreeRoot: import_node_path35.default.join(config2.stateDir, "worktrees"),
68671
- locksDir: import_node_path35.default.join(config2.stateDir, "locks"),
69564
+ worktreeRoot: import_node_path37.default.join(config2.stateDir, "worktrees"),
69565
+ locksDir: import_node_path37.default.join(config2.stateDir, "locks"),
68672
69566
  // Wire the executor server for code-execution runs. Each run gets its own provider process
68673
69567
  // (app-server for codex, a resident CLI child for claude) at the run worktree, running
68674
69568
  // UNRESTRICTED from the real operator config (owner no-sandbox decision — auth + mrrlin MCP
@@ -68712,13 +69606,13 @@ async function startDirectorBridge() {
68712
69606
  // egressDomains is retained in the seam signature (verification-turn.ts still computes the
68713
69607
  // env host) but no longer constrains anything — the executor is unrestricted.
68714
69608
  startSandbox: async (_egressDomains, providerId) => {
68715
- const cwd = import_node_fs22.default.mkdtempSync(import_node_path35.default.join(import_node_os16.default.tmpdir(), "mrrlin-verify-"));
69609
+ const cwd = import_node_fs23.default.mkdtempSync(import_node_path37.default.join(import_node_os17.default.tmpdir(), "mrrlin-verify-"));
68716
69610
  let executor;
68717
69611
  try {
68718
69612
  executor = await startExecutorServer({ worktree: cwd, provider: providerId });
68719
69613
  } catch (error51) {
68720
69614
  try {
68721
- import_node_fs22.default.rmSync(cwd, { recursive: true, force: true });
69615
+ import_node_fs23.default.rmSync(cwd, { recursive: true, force: true });
68722
69616
  } catch {
68723
69617
  }
68724
69618
  throw error51;
@@ -68729,7 +69623,7 @@ async function startDirectorBridge() {
68729
69623
  dispose: () => {
68730
69624
  executor.dispose();
68731
69625
  try {
68732
- import_node_fs22.default.rmSync(cwd, { recursive: true, force: true });
69626
+ import_node_fs23.default.rmSync(cwd, { recursive: true, force: true });
68733
69627
  } catch {
68734
69628
  }
68735
69629
  }
@@ -68822,6 +69716,7 @@ async function startDirectorBridge() {
68822
69716
  port: config2.port,
68823
69717
  token: config2.token,
68824
69718
  allowedOrigins: config2.allowedOrigins,
69719
+ stateDir: config2.stateDir,
68825
69720
  getHealth: () => ({
68826
69721
  ok: true,
68827
69722
  // Most recently claimed run, or null once nothing is in flight — kept for existing consumers.
@@ -68829,7 +69724,8 @@ async function startDirectorBridge() {
68829
69724
  inFlightRunIds: Array.from(consumerState.inFlightRunIds),
68830
69725
  inFlightCount: consumerState.inFlightRunIds.size,
68831
69726
  lastClaimAt: consumerState.lastClaimAt,
68832
- service: health.snapshot()
69727
+ service: health.snapshot(),
69728
+ localArtifactToken: config2.token
68833
69729
  })
68834
69730
  })
68835
69731
  );
@@ -68940,7 +69836,7 @@ async function startDirectorBridge() {
68940
69836
  }
68941
69837
  const files = dayFilesInWindow(/* @__PURE__ */ new Date(), reseedWindowMs);
68942
69838
  const sessionIds = [args.directorSessionId, ...args.priorSessionIds];
68943
- const { lines: lines2, missingFiles } = await readSessionRows(import_node_path35.default.join(config2.stateDir, "logs"), files, sessionIds);
69839
+ const { lines: lines2, missingFiles } = await readSessionRows(import_node_path37.default.join(config2.stateDir, "logs"), files, sessionIds);
68944
69840
  const { items, skipped: skipped2 } = extractItems(lines2, sessionIds);
68945
69841
  if (items.length === 0) return refuse2("no-rows");
68946
69842
  const budget = Math.max(0, Math.min(config2.reseedMaxTokens, config2.turnMaxTokens - args.otherBytes));
@@ -69048,7 +69944,7 @@ async function startDirectorBridge() {
69048
69944
  const bridgeLogger = createBridgeLogger(config2.stateDir, process.env);
69049
69945
  let bridgeBinShaShort = "unknown00000";
69050
69946
  try {
69051
- bridgeBinShaShort = import_node_crypto15.default.createHash("sha256").update(import_node_fs22.default.readFileSync(process.argv[1] ?? "")).digest("hex").slice(0, 12);
69947
+ bridgeBinShaShort = import_node_crypto15.default.createHash("sha256").update(import_node_fs23.default.readFileSync(process.argv[1] ?? "")).digest("hex").slice(0, 12);
69052
69948
  } catch {
69053
69949
  }
69054
69950
  attachBridgeWss(server, {
@@ -69184,8 +70080,8 @@ async function startDirectorBridge() {
69184
70080
  );
69185
70081
  void runOrphanWorktreeSweep(client, {
69186
70082
  checkoutRegistry,
69187
- worktreeRoot: import_node_path35.default.join(config2.stateDir, "worktrees"),
69188
- locksDir: import_node_path35.default.join(config2.stateDir, "locks")
70083
+ worktreeRoot: import_node_path37.default.join(config2.stateDir, "worktrees"),
70084
+ locksDir: import_node_path37.default.join(config2.stateDir, "locks")
69189
70085
  });
69190
70086
  {
69191
70087
  const { retainedBuffers, retainedBytes, tombstonesRemoved } = sweepReplayBuffers(threads, tombstones, {
@@ -69380,7 +70276,8 @@ async function startDirectorBridge() {
69380
70276
  () => providerReadinessLoopHandle?.stop(),
69381
70277
  () => agentKeepalive.dropNow(),
69382
70278
  () => selfUpdateHandle.stop(),
69383
- () => codexProbeHandle.stop()
70279
+ () => codexProbeHandle.stop(),
70280
+ () => artifactsGc.stop()
69384
70281
  ],
69385
70282
  shutdownCodex: () => codexServerManager.shutdown(),
69386
70283
  exit: (code) => process.exit(code),
@@ -69510,15 +70407,15 @@ function readDispatchBody(req) {
69510
70407
  function readOrCreateBridgeToken(stateDir) {
69511
70408
  const explicit = (process.env.MRRLIN_DIRECTOR_BRIDGE_TOKEN ?? "").trim();
69512
70409
  if (explicit) return explicit;
69513
- const tokenPath = import_node_path35.default.join(stateDir, "token.txt");
70410
+ const tokenPath = import_node_path37.default.join(stateDir, "token.txt");
69514
70411
  try {
69515
- const existing = import_node_fs22.default.readFileSync(tokenPath, "utf8").trim();
70412
+ const existing = import_node_fs23.default.readFileSync(tokenPath, "utf8").trim();
69516
70413
  if (existing) return existing;
69517
70414
  } catch {
69518
70415
  }
69519
- import_node_fs22.default.mkdirSync(stateDir, { recursive: true, mode: 448 });
70416
+ import_node_fs23.default.mkdirSync(stateDir, { recursive: true, mode: 448 });
69520
70417
  const token = import_node_crypto15.default.randomBytes(32).toString("base64url");
69521
- import_node_fs22.default.writeFileSync(tokenPath, `${token}
70418
+ import_node_fs23.default.writeFileSync(tokenPath, `${token}
69522
70419
  `, { mode: 384 });
69523
70420
  return token;
69524
70421
  }
@@ -69549,7 +70446,7 @@ function renderContextPrefix(context) {
69549
70446
  return `Context (JSON): ${JSON.stringify(payload)}`;
69550
70447
  }
69551
70448
 
69552
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
70449
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
69553
70450
  var ExperimentalServerTasks = class {
69554
70451
  constructor(_server) {
69555
70452
  this._server = _server;
@@ -69762,7 +70659,7 @@ var ExperimentalServerTasks = class {
69762
70659
  }
69763
70660
  };
69764
70661
 
69765
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
70662
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
69766
70663
  var Server = class extends Protocol {
69767
70664
  /**
69768
70665
  * Initializes this server with the given name and version information.
@@ -69828,16 +70725,7 @@ var Server = class extends Protocol {
69828
70725
  if (!methodSchema) {
69829
70726
  throw new Error("Schema is missing a method literal");
69830
70727
  }
69831
- let methodValue;
69832
- if (isZ4Schema(methodSchema)) {
69833
- const v4Schema = methodSchema;
69834
- const v4Def = v4Schema._zod?.def;
69835
- methodValue = v4Def?.value ?? v4Schema.value;
69836
- } else {
69837
- const v3Schema = methodSchema;
69838
- const legacyDef = v3Schema._def;
69839
- methodValue = legacyDef?.value ?? v3Schema.value;
69840
- }
70728
+ const methodValue = getLiteralValue(methodSchema);
69841
70729
  if (typeof methodValue !== "string") {
69842
70730
  throw new Error("Schema method literal must be a string");
69843
70731
  }
@@ -70142,12 +71030,21 @@ var Server = class extends Protocol {
70142
71030
  }
70143
71031
  };
70144
71032
 
70145
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
71033
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
70146
71034
  var import_node_process = __toESM(require("node:process"), 1);
70147
71035
 
70148
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
71036
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
71037
+ var STDIO_DEFAULT_MAX_BUFFER_SIZE = 10 * 1024 * 1024;
70149
71038
  var ReadBuffer = class {
71039
+ constructor(options) {
71040
+ this._maxBufferSize = options?.maxBufferSize ?? STDIO_DEFAULT_MAX_BUFFER_SIZE;
71041
+ }
70150
71042
  append(chunk) {
71043
+ const newSize = (this._buffer?.length ?? 0) + chunk.length;
71044
+ if (newSize > this._maxBufferSize) {
71045
+ this.clear();
71046
+ throw new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);
71047
+ }
70151
71048
  this._buffer = this._buffer ? Buffer.concat([this._buffer, chunk]) : chunk;
70152
71049
  }
70153
71050
  readMessage() {
@@ -70173,20 +71070,26 @@ function serializeMessage(message) {
70173
71070
  return JSON.stringify(message) + "\n";
70174
71071
  }
70175
71072
 
70176
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
71073
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
70177
71074
  var StdioServerTransport = class {
70178
- constructor(_stdin = import_node_process.default.stdin, _stdout = import_node_process.default.stdout) {
71075
+ constructor(_stdin = import_node_process.default.stdin, _stdout = import_node_process.default.stdout, options) {
70179
71076
  this._stdin = _stdin;
70180
71077
  this._stdout = _stdout;
70181
- this._readBuffer = new ReadBuffer();
70182
71078
  this._started = false;
70183
71079
  this._ondata = (chunk) => {
70184
- this._readBuffer.append(chunk);
70185
- this.processReadBuffer();
71080
+ try {
71081
+ this._readBuffer.append(chunk);
71082
+ this.processReadBuffer();
71083
+ } catch (error51) {
71084
+ this.onerror?.(error51);
71085
+ this.close().catch(() => {
71086
+ });
71087
+ }
70186
71088
  };
70187
71089
  this._onerror = (error51) => {
70188
71090
  this.onerror?.(error51);
70189
71091
  };
71092
+ this._readBuffer = new ReadBuffer({ maxBufferSize: options?.maxBufferSize });
70190
71093
  }
70191
71094
  /**
70192
71095
  * Starts listening for messages on stdin.
@@ -70415,9 +71318,9 @@ function runSetCredential(args) {
70415
71318
  }
70416
71319
 
70417
71320
  // src/install-service.ts
70418
- var import_node_os17 = __toESM(require("node:os"), 1);
70419
- var import_node_fs23 = require("node:fs");
70420
- var import_node_path36 = __toESM(require("node:path"), 1);
71321
+ var import_node_os18 = __toESM(require("node:os"), 1);
71322
+ var import_node_fs24 = require("node:fs");
71323
+ var import_node_path38 = __toESM(require("node:path"), 1);
70421
71324
  function isOwnedEcosystemConfig(text) {
70422
71325
  return /name:\s*"mrrlin-bridge"/.test(text) && /script:\s*"mrrlin-mcp"/.test(text) && /args:\s*"director-bridge"/.test(text);
70423
71326
  }
@@ -70465,7 +71368,7 @@ function deriveServiceApiTarget(deps, ecoPath) {
70465
71368
  var SYSTEM_PATH_DIRS = ["/usr/bin", "/bin", "/usr/sbin", "/sbin"];
70466
71369
  function defaultHomeOwnerUid(home) {
70467
71370
  try {
70468
- return (0, import_node_fs23.statSync)(home).uid;
71371
+ return (0, import_node_fs24.statSync)(home).uid;
70469
71372
  } catch {
70470
71373
  return null;
70471
71374
  }
@@ -70506,11 +71409,11 @@ function installService(deps) {
70506
71409
  deps.log(resolved.reason);
70507
71410
  return { ok: false };
70508
71411
  }
70509
- const home = deps.env.HOME ?? import_node_os17.default.homedir();
71412
+ const home = deps.env.HOME ?? import_node_os18.default.homedir();
70510
71413
  const user = resolveBridgeUser({
70511
71414
  env: deps.env,
70512
71415
  home,
70513
- userInfo: deps.userInfo ?? (() => import_node_os17.default.userInfo()),
71416
+ userInfo: deps.userInfo ?? (() => import_node_os18.default.userInfo()),
70514
71417
  homeOwnerUid: deps.homeOwnerUid ?? defaultHomeOwnerUid,
70515
71418
  log: deps.log
70516
71419
  });
@@ -70530,12 +71433,12 @@ function installService(deps) {
70530
71433
  }
70531
71434
  const claudeBin = deps.which("claude");
70532
71435
  const resolvedBins = [...bins, claudeBin].filter((b) => b !== null);
70533
- const isWin = import_node_os17.default.platform() === "win32";
70534
- const systemDirs = isWin ? (deps.env.PATH || "").split(import_node_path36.default.delimiter).filter(Boolean) : SYSTEM_PATH_DIRS;
71436
+ const isWin = import_node_os18.default.platform() === "win32";
71437
+ const systemDirs = isWin ? (deps.env.PATH || "").split(import_node_path38.default.delimiter).filter(Boolean) : SYSTEM_PATH_DIRS;
70535
71438
  const pathEnv = Array.from(
70536
- /* @__PURE__ */ new Set([...resolvedBins.map((b) => import_node_path36.default.dirname(b)), ...systemDirs])
70537
- ).join(import_node_path36.default.delimiter);
70538
- const ecoPath = import_node_path36.default.join(home, ".mrrlin", "ecosystem.config.cjs");
71439
+ /* @__PURE__ */ new Set([...resolvedBins.map((b) => import_node_path38.default.dirname(b)), ...systemDirs])
71440
+ ).join(import_node_path38.default.delimiter);
71441
+ const ecoPath = import_node_path38.default.join(home, ".mrrlin", "ecosystem.config.cjs");
70539
71442
  const apiTarget = deriveServiceApiTarget(deps, ecoPath);
70540
71443
  const text = renderEcosystemConfig({
70541
71444
  cwd: resolved.cwd,
@@ -70597,18 +71500,18 @@ function uninstallService(deps) {
70597
71500
  }
70598
71501
 
70599
71502
  // src/uninstall-codex.ts
70600
- var import_promises14 = __toESM(require("node:fs/promises"), 1);
70601
- var import_node_os18 = __toESM(require("node:os"), 1);
70602
- var import_node_path37 = __toESM(require("node:path"), 1);
70603
- var toml3 = __toESM(require_toml(), 1);
71503
+ var import_promises16 = __toESM(require("node:fs/promises"), 1);
71504
+ var import_node_os19 = __toESM(require("node:os"), 1);
71505
+ var import_node_path39 = __toESM(require("node:path"), 1);
71506
+ var toml4 = __toESM(require_toml(), 1);
70604
71507
  function resolveCodexHome3(options) {
70605
71508
  if (options.codexHome) return options.codexHome;
70606
71509
  if (process.env.CODEX_HOME) return process.env.CODEX_HOME;
70607
- return import_node_path37.default.join(options.homeDir ?? import_node_os18.default.homedir(), ".codex");
71510
+ return import_node_path39.default.join(options.homeDir ?? import_node_os19.default.homedir(), ".codex");
70608
71511
  }
70609
- async function pathExists5(target) {
71512
+ async function pathExists6(target) {
70610
71513
  try {
70611
- await import_promises14.default.access(target);
71514
+ await import_promises16.default.access(target);
70612
71515
  return true;
70613
71516
  } catch {
70614
71517
  return false;
@@ -70617,16 +71520,16 @@ async function pathExists5(target) {
70617
71520
  var MRRLIN_BLOCK_RE = /(^|\n)\[mcp_servers\.(?:mrrlin(?:-browser)?|external-agents)(?:\]|\.[^\]\n]*\])[\s\S]*?(?=\n\[|$)/g;
70618
71521
  async function uninstallCodex(options = {}) {
70619
71522
  const codexHome = resolveCodexHome3(options);
70620
- const configPath = import_node_path37.default.join(codexHome, "config.toml");
71523
+ const configPath = import_node_path39.default.join(codexHome, "config.toml");
70621
71524
  const removePrompts = async () => uninstallPrompts(codexHome, options.promptNames ?? []);
70622
- if (!await pathExists5(configPath)) {
71525
+ if (!await pathExists6(configPath)) {
70623
71526
  return { action: "missing", configPath, prompts: await removePrompts() };
70624
71527
  }
70625
- const realPath = await import_promises14.default.realpath(configPath).catch(() => configPath);
70626
- const existing = await import_promises14.default.readFile(realPath, "utf8");
71528
+ const realPath = await import_promises16.default.realpath(configPath).catch(() => configPath);
71529
+ const existing = await import_promises16.default.readFile(realPath, "utf8");
70627
71530
  let parsed = null;
70628
71531
  try {
70629
- parsed = toml3.parse(existing);
71532
+ parsed = toml4.parse(existing);
70630
71533
  } catch (error51) {
70631
71534
  const detail = error51 instanceof Error ? error51.message : String(error51);
70632
71535
  const err = {
@@ -70640,17 +71543,17 @@ async function uninstallCodex(options = {}) {
70640
71543
  return { action: "noop", configPath: realPath, prompts: await removePrompts() };
70641
71544
  }
70642
71545
  const stripped = existing.replace(MRRLIN_BLOCK_RE, (match) => match.startsWith("\n") ? "\n" : "").replace(/\n{3,}/g, "\n\n").replace(/^\n+/, "");
70643
- await import_promises14.default.writeFile(realPath, stripped, { mode: 384 });
71546
+ await import_promises16.default.writeFile(realPath, stripped, { mode: 384 });
70644
71547
  return { action: "removed", configPath: realPath, prompts: await removePrompts() };
70645
71548
  }
70646
71549
  async function uninstallPrompts(codexHome, names) {
70647
71550
  if (names.length === 0) return [];
70648
- const promptsDir = import_node_path37.default.join(codexHome, "prompts");
71551
+ const promptsDir = import_node_path39.default.join(codexHome, "prompts");
70649
71552
  const out = [];
70650
71553
  for (const name of names) {
70651
- const promptPath = import_node_path37.default.join(promptsDir, `${name}.md`);
71554
+ const promptPath = import_node_path39.default.join(promptsDir, `${name}.md`);
70652
71555
  try {
70653
- await import_promises14.default.unlink(promptPath);
71556
+ await import_promises16.default.unlink(promptPath);
70654
71557
  out.push({ name, action: "removed", promptPath });
70655
71558
  } catch (error51) {
70656
71559
  const code = error51?.code;
@@ -70665,8 +71568,8 @@ async function uninstallPrompts(codexHome, names) {
70665
71568
  }
70666
71569
 
70667
71570
  // src/extract/command.ts
70668
- var import_promises15 = require("node:fs/promises");
70669
- var import_node_path38 = require("node:path");
71571
+ var import_promises17 = require("node:fs/promises");
71572
+ var import_node_path40 = require("node:path");
70670
71573
  function parseArgs(args) {
70671
71574
  const map2 = /* @__PURE__ */ new Map();
70672
71575
  for (let i = 0; i < args.length; i++) {
@@ -70703,10 +71606,10 @@ Missing required flag(s): ${missing.join(
70703
71606
  const days = await findSessionDays(deps.stateDir, sessionId);
70704
71607
  const matchingLines = [];
70705
71608
  for (const day of days) {
70706
- const logPath = (0, import_node_path38.join)(deps.stateDir, "logs", `bridge-${day}.jsonl`);
71609
+ const logPath = (0, import_node_path40.join)(deps.stateDir, "logs", `bridge-${day}.jsonl`);
70707
71610
  let raw;
70708
71611
  try {
70709
- raw = await (0, import_promises15.readFile)(logPath, "utf8");
71612
+ raw = await (0, import_promises17.readFile)(logPath, "utf8");
70710
71613
  } catch {
70711
71614
  continue;
70712
71615
  }
@@ -70740,7 +71643,7 @@ Missing required flag(s): ${missing.join(
70740
71643
  }
70741
71644
  const outputText = cappedLines.join("\n");
70742
71645
  if (outPath) {
70743
- await (0, import_promises15.writeFile)(outPath, outputText, "utf8");
71646
+ await (0, import_promises17.writeFile)(outPath, outputText, "utf8");
70744
71647
  return {
70745
71648
  ok: true,
70746
71649
  message: `Wrote extract to ${outPath}`,
@@ -70803,16 +71706,16 @@ function bootHookStatus() {
70803
71706
  if (process.platform !== "darwin") return { status: "unknown" };
70804
71707
  const uid = process.getuid?.();
70805
71708
  if (uid === void 0 || uid === 0) return { status: "unknown" };
70806
- const home = process.env.HOME ?? (0, import_node_os19.homedir)();
70807
- const agents = import_node_path40.default.join(home, "Library", "LaunchAgents");
71709
+ const home = process.env.HOME ?? (0, import_node_os20.homedir)();
71710
+ const agents = import_node_path42.default.join(home, "Library", "LaunchAgents");
70808
71711
  const candidates = [
70809
- { label: "com.mrrlin.director-bridge", plist: import_node_path40.default.join(agents, "com.mrrlin.director-bridge.plist") },
70810
- { label: "com.PM2", plist: import_node_path40.default.join(agents, `pm2.${(0, import_node_os19.userInfo)().username}.plist`) }
71712
+ { label: "com.mrrlin.director-bridge", plist: import_node_path42.default.join(agents, "com.mrrlin.director-bridge.plist") },
71713
+ { label: "com.PM2", plist: import_node_path42.default.join(agents, `pm2.${(0, import_node_os20.userInfo)().username}.plist`) }
70811
71714
  ];
70812
71715
  for (const candidate of candidates) {
70813
71716
  const printed = (0, import_node_child_process21.spawnSync)("launchctl", ["print", `gui/${uid}/${candidate.label}`], { encoding: "utf8" });
70814
71717
  if (printed.status !== 0) continue;
70815
- if (!(0, import_node_fs24.existsSync)(candidate.plist)) continue;
71718
+ if (!(0, import_node_fs25.existsSync)(candidate.plist)) continue;
70816
71719
  const out = printed.stdout ?? "";
70817
71720
  const runs = /^\s*runs\s*=\s*(\d+)/m.exec(out);
70818
71721
  const exitCode = /^\s*last exit code\s*=\s*(-?\d+)/m.exec(out);
@@ -71097,8 +72000,8 @@ async function main() {
71097
72000
  }
71098
72001
  }
71099
72002
  try {
71100
- const codexHome = process.env.CODEX_HOME ?? import_node_path40.default.join(process.env.HOME ?? (0, import_node_os19.homedir)(), ".codex");
71101
- (0, import_node_fs24.rmSync)(import_node_path40.default.join(codexHome, "prompts", "report-issue.md"), { force: true });
72003
+ const codexHome = process.env.CODEX_HOME ?? import_node_path42.default.join(process.env.HOME ?? (0, import_node_os20.homedir)(), ".codex");
72004
+ (0, import_node_fs25.rmSync)(import_node_path42.default.join(codexHome, "prompts", "report-issue.md"), { force: true });
71102
72005
  } catch {
71103
72006
  }
71104
72007
  const claudeResult = await installClaude({ binPath, force, serveEnv });
@@ -71168,15 +72071,15 @@ async function main() {
71168
72071
  env: process.env,
71169
72072
  cwd: process.cwd(),
71170
72073
  writeFile: (p, c) => {
71171
- (0, import_node_fs24.mkdirSync)(import_node_path40.default.dirname(p), { recursive: true, mode: 448 });
71172
- (0, import_node_fs24.writeFileSync)(p, c, { mode: 384 });
72074
+ (0, import_node_fs25.mkdirSync)(import_node_path42.default.dirname(p), { recursive: true, mode: 448 });
72075
+ (0, import_node_fs25.writeFileSync)(p, c, { mode: 384 });
71173
72076
  },
71174
72077
  // Swallows every error on purpose — the only caller uses this to recover settings from the
71175
72078
  // config it is about to overwrite, and a missing or unreadable file means "no previous
71176
72079
  // value", never a failed install. See readExistingTelemetryDefaultProject.
71177
72080
  readFile: (p) => {
71178
72081
  try {
71179
- return (0, import_node_fs24.readFileSync)(p, "utf8");
72082
+ return (0, import_node_fs25.readFileSync)(p, "utf8");
71180
72083
  } catch {
71181
72084
  return null;
71182
72085
  }
@@ -71197,35 +72100,35 @@ async function main() {
71197
72100
  runPm2: (a) => ({ code: pm2Runner(a).code }),
71198
72101
  removeFile: (p) => {
71199
72102
  try {
71200
- (0, import_node_fs24.rmSync)(p, { force: true });
72103
+ (0, import_node_fs25.rmSync)(p, { force: true });
71201
72104
  } catch {
71202
72105
  }
71203
72106
  },
71204
72107
  purgeSecret: purge,
71205
72108
  secretPath: agentCredentialPath(),
71206
72109
  tokenPath: operatorTokenPath(),
71207
- ecoPath: import_node_path40.default.join(process.env.HOME ?? (0, import_node_os19.homedir)(), ".mrrlin", "ecosystem.config.cjs"),
72110
+ ecoPath: import_node_path42.default.join(process.env.HOME ?? (0, import_node_os20.homedir)(), ".mrrlin", "ecosystem.config.cjs"),
71208
72111
  log: (m) => process.stderr.write(`[mrrlin-mcp uninstall-service] ${m}
71209
72112
  `)
71210
72113
  });
71211
72114
  return;
71212
72115
  }
71213
72116
  case "uninstall": {
71214
- const home = process.env.HOME ?? (0, import_node_os19.homedir)();
72117
+ const home = process.env.HOME ?? (0, import_node_os20.homedir)();
71215
72118
  const log = (m) => process.stderr.write(`[mrrlin-mcp uninstall] ${m}
71216
72119
  `);
71217
72120
  uninstallService({
71218
72121
  runPm2: (a) => ({ code: pm2Runner(a).code }),
71219
72122
  removeFile: (p) => {
71220
72123
  try {
71221
- (0, import_node_fs24.rmSync)(p, { force: true });
72124
+ (0, import_node_fs25.rmSync)(p, { force: true });
71222
72125
  } catch {
71223
72126
  }
71224
72127
  },
71225
72128
  purgeSecret: true,
71226
72129
  secretPath: agentCredentialPath(),
71227
72130
  tokenPath: operatorTokenPath(),
71228
- ecoPath: import_node_path40.default.join(home, ".mrrlin", "ecosystem.config.cjs"),
72131
+ ecoPath: import_node_path42.default.join(home, ".mrrlin", "ecosystem.config.cjs"),
71229
72132
  log
71230
72133
  });
71231
72134
  let codexOk = true;
@@ -71245,7 +72148,7 @@ async function main() {
71245
72148
  log(`codex config NOT modified: ${error51 instanceof Error ? error51.message : String(error51)}`);
71246
72149
  }
71247
72150
  try {
71248
- (0, import_node_fs24.rmSync)(import_node_path40.default.join(home, ".mrrlin"), { recursive: true, force: true });
72151
+ (0, import_node_fs25.rmSync)(import_node_path42.default.join(home, ".mrrlin"), { recursive: true, force: true });
71249
72152
  } catch {
71250
72153
  }
71251
72154
  log("removed ~/.mrrlin");
@@ -71286,7 +72189,7 @@ ${HELP_TEXT}`);
71286
72189
  }
71287
72190
  }
71288
72191
  function resolveSelfBinPath() {
71289
- return import_node_path39.default.resolve(process.argv[1] ?? process.execPath);
72192
+ return import_node_path41.default.resolve(process.argv[1] ?? process.execPath);
71290
72193
  }
71291
72194
  main().catch((error51) => {
71292
72195
  process.stderr.write(`mrrlin-mcp fatal error: ${error51 instanceof Error ? error51.message : String(error51)}
@@ -71295,6 +72198,13 @@ main().catch((error51) => {
71295
72198
  });
71296
72199
  /*! Bundled license information:
71297
72200
 
72201
+ content-type/index.js:
72202
+ (*!
72203
+ * content-type
72204
+ * Copyright(c) 2015 Douglas Christopher Wilson
72205
+ * MIT Licensed
72206
+ *)
72207
+
71298
72208
  @noble/hashes/esm/utils.js:
71299
72209
  (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
71300
72210