@squirrelnotes.app/mcp 1.31.6 → 2.0.0

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/stdio-handler.js +430 -126
  2. package/package.json +1 -1
@@ -16399,9 +16399,28 @@ var require_utils = __commonJS({
16399
16399
  "use strict";
16400
16400
  var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
16401
16401
  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);
16402
+ var isPort = RegExp.prototype.test.bind(/^\d*$/u);
16402
16403
  var isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
16403
16404
  var isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
16404
- var isPathCharacter = RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);
16405
+ var isPathCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u);
16406
+ var isQueryFragmentCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u);
16407
+ var isUserinfoCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u);
16408
+ var BYTE_HEX = new Array(256);
16409
+ {
16410
+ const HEX_DIGITS = "0123456789ABCDEF";
16411
+ for (let i = 0; i < 256; i++) {
16412
+ BYTE_HEX[i] = "%" + HEX_DIGITS[i >> 4] + HEX_DIGITS[i & 15];
16413
+ }
16414
+ }
16415
+ function percentEncodeNonAscii(cp) {
16416
+ if (cp < 2048) {
16417
+ return BYTE_HEX[192 | cp >> 6] + BYTE_HEX[128 | cp & 63];
16418
+ }
16419
+ if (cp < 65536) {
16420
+ return BYTE_HEX[224 | cp >> 12] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63];
16421
+ }
16422
+ return BYTE_HEX[240 | cp >> 18] + BYTE_HEX[128 | cp >> 12 & 63] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63];
16423
+ }
16405
16424
  function stringArrayToHexStripped(input) {
16406
16425
  let acc = "";
16407
16426
  let code = 0;
@@ -16426,91 +16445,105 @@ var require_utils = __commonJS({
16426
16445
  }
16427
16446
  return acc;
16428
16447
  }
16448
+ var isHextet = RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/);
16449
+ var isIPvFuture = RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/);
16450
+ var isZoneCharacter = RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/);
16429
16451
  var nonSimpleDomain = RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);
16430
- function consumeIsZone(buffer) {
16431
- buffer.length = 0;
16432
- return true;
16433
- }
16434
- function consumeHextets(buffer, address, output) {
16435
- if (buffer.length) {
16436
- const hex = stringArrayToHexStripped(buffer);
16437
- if (hex !== "") {
16438
- address.push(hex);
16439
- } else {
16440
- output.error = true;
16441
- return false;
16452
+ function isZoneIdentifier(zone) {
16453
+ if (zone.length === 0) return false;
16454
+ for (let i = 0; i < zone.length; i++) {
16455
+ if (isZoneCharacter(zone[i])) continue;
16456
+ if (zone[i] === "%" && i + 2 < zone.length && isHexPair(zone.slice(i + 1, i + 3))) {
16457
+ i += 2;
16458
+ continue;
16442
16459
  }
16443
- buffer.length = 0;
16460
+ return false;
16444
16461
  }
16445
16462
  return true;
16446
16463
  }
16447
- function getIPV6(input) {
16448
- let tokenCount = 0;
16449
- const output = { error: false, address: "", zone: "" };
16450
- const address = [];
16451
- const buffer = [];
16452
- let endipv6Encountered = false;
16453
- let endIpv6 = false;
16454
- let consume = consumeHextets;
16455
- for (let i = 0; i < input.length; i++) {
16456
- const cursor = input[i];
16457
- if (cursor === "[" || cursor === "]") {
16458
- continue;
16459
- }
16460
- if (cursor === ":") {
16461
- if (endipv6Encountered === true) {
16462
- endIpv6 = true;
16463
- }
16464
- if (!consume(buffer, address, output)) {
16465
- break;
16466
- }
16467
- if (++tokenCount > 7) {
16468
- output.error = true;
16469
- break;
16464
+ function compressIPv6ZeroRun(hextets) {
16465
+ let bestStart = -1;
16466
+ let bestLength = 0;
16467
+ let runStart = -1;
16468
+ let runLength = 0;
16469
+ for (let i = 0; i < hextets.length; i++) {
16470
+ if (hextets[i] === "0") {
16471
+ if (runStart === -1) runStart = i;
16472
+ runLength++;
16473
+ if (runLength > bestLength) {
16474
+ bestLength = runLength;
16475
+ bestStart = runStart;
16470
16476
  }
16471
- if (i > 0 && input[i - 1] === ":") {
16472
- endipv6Encountered = true;
16473
- }
16474
- address.push(":");
16475
- continue;
16476
- } else if (cursor === "%") {
16477
- if (!consume(buffer, address, output)) {
16478
- break;
16479
- }
16480
- consume = consumeIsZone;
16481
16477
  } else {
16482
- buffer.push(cursor);
16478
+ runStart = -1;
16479
+ runLength = 0;
16480
+ }
16481
+ }
16482
+ if (bestLength < 2) return hextets.join(":");
16483
+ const head = hextets.slice(0, bestStart).join(":");
16484
+ const tail = hextets.slice(bestStart + bestLength).join(":");
16485
+ return head + "::" + tail;
16486
+ }
16487
+ function normalizeIPv6Address(input) {
16488
+ const compression = input.indexOf("::");
16489
+ if (compression !== -1 && input.indexOf("::", compression + 1) !== -1) return void 0;
16490
+ const left = compression === -1 ? input.split(":") : input.slice(0, compression).split(":");
16491
+ const right = compression === -1 ? [] : input.slice(compression + 2).split(":");
16492
+ if (compression !== -1) {
16493
+ if (left.length === 1 && left[0] === "") left.length = 0;
16494
+ if (right.length === 1 && right[0] === "") right.length = 0;
16495
+ }
16496
+ const parts = left.concat(right);
16497
+ let hextetCount = 0;
16498
+ for (let i = 0; i < parts.length; i++) {
16499
+ const part = parts[i];
16500
+ if (part === "") return void 0;
16501
+ if (part.indexOf(".") !== -1) {
16502
+ if (i !== parts.length - 1 || compression !== -1 && right.length === 0 || !isIPv4(part)) return void 0;
16503
+ hextetCount += 2;
16483
16504
  continue;
16484
16505
  }
16506
+ if (!isHextet(part)) return void 0;
16507
+ parts[i] = parseInt(part, 16).toString(16);
16508
+ hextetCount++;
16485
16509
  }
16486
- if (buffer.length) {
16487
- if (consume === consumeIsZone) {
16488
- output.zone = buffer.join("");
16489
- } else if (endIpv6) {
16490
- address.push(buffer.join(""));
16491
- } else {
16492
- address.push(stringArrayToHexStripped(buffer));
16493
- }
16510
+ if (compression === -1) {
16511
+ if (hextetCount !== 8) return void 0;
16512
+ return compressIPv6ZeroRun(parts);
16494
16513
  }
16495
- output.address = address.join("");
16496
- return output;
16514
+ if (hextetCount >= 8) return void 0;
16515
+ const expanded = parts.slice(0, left.length);
16516
+ for (let i = hextetCount; i < 8; i++) expanded.push("0");
16517
+ for (let i = left.length; i < parts.length; i++) expanded.push(parts[i]);
16518
+ return compressIPv6ZeroRun(expanded);
16497
16519
  }
16498
16520
  function normalizeIPv6(host) {
16499
- if (findToken(host, ":") < 2) {
16500
- return { host, isIPV6: false };
16501
- }
16502
- const ipv62 = getIPV6(host);
16503
- if (!ipv62.error) {
16504
- let newHost = ipv62.address;
16505
- let escapedHost = ipv62.address;
16506
- if (ipv62.zone) {
16507
- newHost += "%" + ipv62.zone;
16508
- escapedHost += "%25" + ipv62.zone;
16509
- }
16510
- return { host: newHost, isIPV6: true, escapedHost };
16511
- } else {
16512
- return { host, isIPV6: false };
16513
- }
16521
+ const bracketed = host[0] === "[" && host[host.length - 1] === "]";
16522
+ const hasBracket = host[0] === "[" || host[host.length - 1] === "]";
16523
+ if (hasBracket && !bracketed) return { host, isIPV6: false, error: true };
16524
+ let input = bracketed ? host.slice(1, -1) : host;
16525
+ if (bracketed && isIPvFuture(input)) {
16526
+ input = input.toLowerCase();
16527
+ return { host: `[${input}]`, escapedHost: input, isIPV6: false, isIPVFuture: true };
16528
+ }
16529
+ if (findToken(input, ":") < 2) {
16530
+ return { host, isIPV6: false, error: bracketed };
16531
+ }
16532
+ let zoneIdentifier = "";
16533
+ const zoneSeparator = input.indexOf("%");
16534
+ if (zoneSeparator !== -1) {
16535
+ const separatorLength = input.slice(zoneSeparator, zoneSeparator + 3).toLowerCase() === "%25" ? 3 : 1;
16536
+ zoneIdentifier = input.slice(zoneSeparator + separatorLength);
16537
+ if (!isZoneIdentifier(zoneIdentifier)) return { host, isIPV6: false, error: true };
16538
+ input = input.slice(0, zoneSeparator);
16539
+ }
16540
+ const address = normalizeIPv6Address(input);
16541
+ if (address === void 0) return { host, isIPV6: false, error: true };
16542
+ return {
16543
+ host: address + (zoneIdentifier ? "%" + zoneIdentifier : ""),
16544
+ escapedHost: address + (zoneIdentifier ? "%25" + zoneIdentifier : ""),
16545
+ isIPV6: true
16546
+ };
16514
16547
  }
16515
16548
  function findToken(str, token) {
16516
16549
  let ind = 0;
@@ -16629,7 +16662,8 @@ var require_utils = __commonJS({
16629
16662
  function normalizePathEncoding(input) {
16630
16663
  let output = "";
16631
16664
  for (let i = 0; i < input.length; i++) {
16632
- if (input[i] === "%" && i + 2 < input.length) {
16665
+ const ch = input[i];
16666
+ if (ch === "%" && i + 2 < input.length) {
16633
16667
  const hex = input.slice(i + 1, i + 3);
16634
16668
  if (isHexPair(hex)) {
16635
16669
  const normalizedHex = hex.toUpperCase();
@@ -16643,10 +16677,152 @@ var require_utils = __commonJS({
16643
16677
  continue;
16644
16678
  }
16645
16679
  }
16646
- if (isPathCharacter(input[i])) {
16647
- output += input[i];
16680
+ if (isPathCharacter(ch)) {
16681
+ output += ch;
16682
+ } else {
16683
+ const code = input.charCodeAt(i);
16684
+ if (code < 128) {
16685
+ output += isEscapeSafe(code) ? ch : BYTE_HEX[code];
16686
+ } else if (code < 55296 || code > 57343) {
16687
+ output += percentEncodeNonAscii(code);
16688
+ } else if (code <= 56319 && i + 1 < input.length) {
16689
+ const low = input.charCodeAt(i + 1);
16690
+ if (low >= 56320 && low <= 57343) {
16691
+ output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
16692
+ i++;
16693
+ } else {
16694
+ output += percentEncodeNonAscii(65533);
16695
+ }
16696
+ } else {
16697
+ output += percentEncodeNonAscii(65533);
16698
+ }
16699
+ }
16700
+ }
16701
+ return output;
16702
+ }
16703
+ function serializePathEncoding(input, pathNoScheme = false) {
16704
+ let output = "";
16705
+ let firstSegment = pathNoScheme && input[0] !== "/";
16706
+ for (let i = 0; i < input.length; i++) {
16707
+ const ch = input[i];
16708
+ if (ch === "%" && i + 2 < input.length) {
16709
+ const hex = input.slice(i + 1, i + 3);
16710
+ if (isHexPair(hex)) {
16711
+ output += "%" + hex.toUpperCase();
16712
+ i += 2;
16713
+ continue;
16714
+ }
16715
+ }
16716
+ if (ch === "/") {
16717
+ firstSegment = false;
16718
+ }
16719
+ if (isPathCharacter(ch) && (ch !== ":" || !firstSegment)) {
16720
+ output += ch;
16648
16721
  } else {
16649
- output += escape(input[i]);
16722
+ const code = input.charCodeAt(i);
16723
+ if (code < 128) {
16724
+ output += BYTE_HEX[code];
16725
+ } else if (code < 55296 || code > 57343) {
16726
+ output += percentEncodeNonAscii(code);
16727
+ } else if (code <= 56319 && i + 1 < input.length) {
16728
+ const low = input.charCodeAt(i + 1);
16729
+ if (low >= 56320 && low <= 57343) {
16730
+ output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
16731
+ i++;
16732
+ } else {
16733
+ output += percentEncodeNonAscii(65533);
16734
+ }
16735
+ } else {
16736
+ output += percentEncodeNonAscii(65533);
16737
+ }
16738
+ }
16739
+ }
16740
+ return output;
16741
+ }
16742
+ function encodeComponent(input, isAllowed) {
16743
+ let output = "";
16744
+ for (let i = 0; i < input.length; i++) {
16745
+ const ch = input[i];
16746
+ if (ch === "%" && i + 2 < input.length) {
16747
+ const hex = input.slice(i + 1, i + 3);
16748
+ if (isHexPair(hex)) {
16749
+ output += "%" + hex.toUpperCase();
16750
+ i += 2;
16751
+ continue;
16752
+ }
16753
+ }
16754
+ if (isAllowed(ch)) {
16755
+ output += ch;
16756
+ } else {
16757
+ const code = input.charCodeAt(i);
16758
+ if (code < 128) {
16759
+ output += BYTE_HEX[code];
16760
+ } else if (code < 55296 || code > 57343) {
16761
+ output += percentEncodeNonAscii(code);
16762
+ } else if (code <= 56319 && i + 1 < input.length) {
16763
+ const low = input.charCodeAt(i + 1);
16764
+ if (low >= 56320 && low <= 57343) {
16765
+ output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
16766
+ i++;
16767
+ } else {
16768
+ output += percentEncodeNonAscii(65533);
16769
+ }
16770
+ } else {
16771
+ output += percentEncodeNonAscii(65533);
16772
+ }
16773
+ }
16774
+ }
16775
+ return output;
16776
+ }
16777
+ function encodeUserinfo(input) {
16778
+ return encodeComponent(input, isUserinfoCharacter);
16779
+ }
16780
+ function encodeQuery(input) {
16781
+ return encodeComponent(input, isQueryFragmentCharacter);
16782
+ }
16783
+ function encodeFragment(input) {
16784
+ return encodeComponent(input, isQueryFragmentCharacter);
16785
+ }
16786
+ function isEscapeSafe(cp) {
16787
+ 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;
16788
+ }
16789
+ function normalizeQueryFragmentEncoding(input) {
16790
+ let output = "";
16791
+ for (let i = 0; i < input.length; i++) {
16792
+ const ch = input[i];
16793
+ if (ch === "%" && i + 2 < input.length) {
16794
+ const hex = input.slice(i + 1, i + 3);
16795
+ if (isHexPair(hex)) {
16796
+ const normalizedHex = hex.toUpperCase();
16797
+ const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
16798
+ if (isUnreserved(decoded)) {
16799
+ output += decoded;
16800
+ } else {
16801
+ output += "%" + normalizedHex;
16802
+ }
16803
+ i += 2;
16804
+ continue;
16805
+ }
16806
+ }
16807
+ if (isQueryFragmentCharacter(ch)) {
16808
+ output += ch;
16809
+ } else {
16810
+ const code = input.charCodeAt(i);
16811
+ if (code < 128) {
16812
+ output += isEscapeSafe(code) ? ch : BYTE_HEX[code];
16813
+ } else if (code < 55296 || code > 57343) {
16814
+ output += percentEncodeNonAscii(code);
16815
+ } else if (code <= 56319 && i + 1 < input.length) {
16816
+ const low = input.charCodeAt(i + 1);
16817
+ if (low >= 56320 && low <= 57343) {
16818
+ output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
16819
+ i++;
16820
+ } else {
16821
+ output += percentEncodeNonAscii(65533);
16822
+ }
16823
+ } else {
16824
+ output += percentEncodeNonAscii(65533);
16825
+ }
16650
16826
  }
16651
16827
  }
16652
16828
  return output;
@@ -16669,14 +16845,18 @@ var require_utils = __commonJS({
16669
16845
  function recomposeAuthority(component) {
16670
16846
  const uriTokens = [];
16671
16847
  if (component.userinfo !== void 0) {
16672
- uriTokens.push(component.userinfo);
16848
+ uriTokens.push(encodeUserinfo(component.userinfo));
16673
16849
  uriTokens.push("@");
16674
16850
  }
16675
16851
  if (component.host !== void 0) {
16676
- let host = unescape(component.host);
16852
+ let host = component.host;
16677
16853
  if (!isIPv4(host)) {
16678
- const ipV6res = normalizeIPv6(host);
16679
- if (ipV6res.isIPV6 === true) {
16854
+ let ipV6res = normalizeIPv6(host);
16855
+ if (ipV6res.isIPV6 !== true && ipV6res.isIPVFuture !== true) {
16856
+ host = normalizePercentEncoding(host, true);
16857
+ ipV6res = normalizeIPv6(host);
16858
+ }
16859
+ if (ipV6res.isIPV6 === true || ipV6res.isIPVFuture === true) {
16680
16860
  host = `[${ipV6res.escapedHost}]`;
16681
16861
  } else {
16682
16862
  host = reescapeHostDelimiters(host, false);
@@ -16685,8 +16865,12 @@ var require_utils = __commonJS({
16685
16865
  uriTokens.push(host);
16686
16866
  }
16687
16867
  if (typeof component.port === "number" || typeof component.port === "string") {
16868
+ const port = String(component.port);
16869
+ if (!isPort(port)) {
16870
+ throw new TypeError("URI port is malformed.");
16871
+ }
16688
16872
  uriTokens.push(":");
16689
- uriTokens.push(String(component.port));
16873
+ uriTokens.push(port);
16690
16874
  }
16691
16875
  return uriTokens.length ? uriTokens.join("") : void 0;
16692
16876
  }
@@ -16696,6 +16880,11 @@ var require_utils = __commonJS({
16696
16880
  reescapeHostDelimiters,
16697
16881
  normalizePercentEncoding,
16698
16882
  normalizePathEncoding,
16883
+ serializePathEncoding,
16884
+ normalizeQueryFragmentEncoding,
16885
+ encodeUserinfo,
16886
+ encodeQuery,
16887
+ encodeFragment,
16699
16888
  escapePreservingEscapes,
16700
16889
  removeDotSegments,
16701
16890
  isIPv4,
@@ -16711,7 +16900,7 @@ var require_schemes = __commonJS({
16711
16900
  "node_modules/fast-uri/lib/schemes.js"(exports, module) {
16712
16901
  "use strict";
16713
16902
  var { isUUID } = require_utils();
16714
- var URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;
16903
+ var URN_REG = /^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu;
16715
16904
  var supportedSchemeNames = (
16716
16905
  /** @type {const} */
16717
16906
  [
@@ -16772,9 +16961,10 @@ var require_schemes = __commonJS({
16772
16961
  wsComponent.secure = void 0;
16773
16962
  }
16774
16963
  if (wsComponent.resourceName) {
16775
- const [path, query] = wsComponent.resourceName.split("?");
16964
+ const queryIndex = wsComponent.resourceName.indexOf("?");
16965
+ const path = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
16776
16966
  wsComponent.path = path && path !== "/" ? path : void 0;
16777
- wsComponent.query = query;
16967
+ wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
16778
16968
  wsComponent.resourceName = void 0;
16779
16969
  }
16780
16970
  wsComponent.fragment = void 0;
@@ -16786,7 +16976,7 @@ var require_schemes = __commonJS({
16786
16976
  return urnComponent;
16787
16977
  }
16788
16978
  const matches = urnComponent.path.match(URN_REG);
16789
- if (matches) {
16979
+ if (matches && matches[0] === urnComponent.path) {
16790
16980
  const scheme = options.scheme || urnComponent.scheme || "urn";
16791
16981
  urnComponent.nid = matches[1].toLowerCase();
16792
16982
  urnComponent.nss = matches[2];
@@ -16920,8 +17110,17 @@ var require_schemes = __commonJS({
16920
17110
  var require_fast_uri = __commonJS({
16921
17111
  "node_modules/fast-uri/index.js"(exports, module) {
16922
17112
  "use strict";
16923
- var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, escapePreservingEscapes, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
17113
+ var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
16924
17114
  var { SCHEMES, getSchemeHandler } = require_schemes();
17115
+ var VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u;
17116
+ var MALFORMED_SCHEME_ERROR = "URI scheme is malformed.";
17117
+ function decodeValidScheme(scheme) {
17118
+ const decodedScheme = unescape(String(scheme));
17119
+ if (!VALID_SCHEME.test(decodedScheme)) {
17120
+ throw new TypeError(MALFORMED_SCHEME_ERROR);
17121
+ }
17122
+ return decodedScheme;
17123
+ }
16925
17124
  function normalize(uri, options) {
16926
17125
  if (typeof uri === "string") {
16927
17126
  uri = /** @type {T} */
@@ -16934,7 +17133,34 @@ var require_fast_uri = __commonJS({
16934
17133
  }
16935
17134
  function resolve2(baseURI, relativeURI, options) {
16936
17135
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
16937
- const resolved = resolveComponent(parse3(baseURI, schemelessOptions), parse3(relativeURI, schemelessOptions), schemelessOptions, true);
17136
+ const {
17137
+ parsed: baseParsed,
17138
+ malformedAuthorityOrPort: baseMalformed,
17139
+ malformedPercentEncoding: baseMalformedPercentEncoding,
17140
+ malformedSchemeSpecific: baseMalformedSchemeSpecific,
17141
+ malformedHost: baseMalformedHost,
17142
+ malformedScheme: baseMalformedScheme
17143
+ } = parseWithStatus(baseURI, schemelessOptions);
17144
+ const {
17145
+ parsed: relativeParsed,
17146
+ malformedAuthorityOrPort: relativeMalformed,
17147
+ malformedPercentEncoding: relativeMalformedPercentEncoding,
17148
+ malformedSchemeSpecific: relativeMalformedSchemeSpecific,
17149
+ malformedHost: relativeMalformedHost,
17150
+ malformedScheme: relativeMalformedScheme
17151
+ } = parseWithStatus(relativeURI, schemelessOptions);
17152
+ if (baseMalformed || relativeMalformed || baseMalformedPercentEncoding || relativeMalformedPercentEncoding || baseMalformedSchemeSpecific || relativeMalformedSchemeSpecific || baseMalformedHost || relativeMalformedHost || baseMalformedScheme || relativeMalformedScheme) {
17153
+ throw new Error(baseParsed.error || relativeParsed.error || "URI is malformed.");
17154
+ }
17155
+ const resolved = resolveComponent(baseParsed, relativeParsed, schemelessOptions, true);
17156
+ const resolvedSchemeHandler = getSchemeHandler(options && options.scheme || resolved.scheme);
17157
+ const resolvedHost = resolved.host;
17158
+ const resolvedHostIsIP = resolvedHost !== void 0 && resolvedHost !== "" && (isIPv4(resolvedHost) || normalizeIPv6(resolvedHost).isIPV6);
17159
+ canonicalizeHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP);
17160
+ const encodedASCIIHost = resolvedHost && resolvedHost.indexOf("%") !== -1 && !new RegExp("\\P{ASCII}", "u").test(resolvedHost);
17161
+ if (resolved.error && !encodedASCIIHost) {
17162
+ throw new Error(resolved.error);
17163
+ }
16938
17164
  schemelessOptions.skipEscape = true;
16939
17165
  return serialize(resolved, schemelessOptions);
16940
17166
  }
@@ -16994,7 +17220,7 @@ var require_fast_uri = __commonJS({
16994
17220
  function equal(uriA, uriB, options) {
16995
17221
  const normalizedA = normalizeComparableURI(uriA, options);
16996
17222
  const normalizedB = normalizeComparableURI(uriB, options);
16997
- return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA.toLowerCase() === normalizedB.toLowerCase();
17223
+ return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA === normalizedB;
16998
17224
  }
16999
17225
  function serialize(cmpts, opts) {
17000
17226
  const component = {
@@ -17015,19 +17241,22 @@ var require_fast_uri = __commonJS({
17015
17241
  };
17016
17242
  const options = Object.assign({}, opts);
17017
17243
  const uriTokens = [];
17244
+ if (component.scheme) {
17245
+ component.scheme = decodeValidScheme(component.scheme);
17246
+ }
17018
17247
  const schemeHandler = getSchemeHandler(options.scheme || component.scheme);
17019
17248
  if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options);
17249
+ const hasAuthority = component.userinfo !== void 0 || component.host !== void 0 || component.port !== void 0;
17250
+ const pathNoScheme = !options.skipEscape && component.scheme === void 0 && !hasAuthority;
17020
17251
  if (component.path !== void 0) {
17021
17252
  if (!options.skipEscape) {
17022
- component.path = escapePreservingEscapes(component.path);
17023
- if (component.scheme !== void 0) {
17024
- component.path = component.path.split("%3A").join(":");
17025
- }
17253
+ component.path = serializePathEncoding(component.path, pathNoScheme);
17026
17254
  } else {
17027
17255
  component.path = normalizePercentEncoding(component.path);
17028
17256
  }
17029
17257
  }
17030
17258
  if (options.reference !== "suffix" && component.scheme) {
17259
+ component.scheme = decodeValidScheme(component.scheme);
17031
17260
  uriTokens.push(component.scheme, ":");
17032
17261
  }
17033
17262
  const authority = recomposeAuthority(component);
@@ -17045,21 +17274,25 @@ var require_fast_uri = __commonJS({
17045
17274
  if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
17046
17275
  s = removeDotSegments(s);
17047
17276
  }
17277
+ if (pathNoScheme) {
17278
+ s = serializePathEncoding(s, true);
17279
+ }
17048
17280
  if (authority === void 0 && s[0] === "/" && s[1] === "/") {
17049
17281
  s = "/%2F" + s.slice(2);
17050
17282
  }
17051
17283
  uriTokens.push(s);
17052
17284
  }
17053
17285
  if (component.query !== void 0) {
17054
- uriTokens.push("?", component.query);
17286
+ uriTokens.push("?", encodeQuery(component.query));
17055
17287
  }
17056
17288
  if (component.fragment !== void 0) {
17057
- uriTokens.push("#", component.fragment);
17289
+ uriTokens.push("#", encodeFragment(component.fragment));
17058
17290
  }
17059
17291
  return uriTokens.join("");
17060
17292
  }
17061
17293
  var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
17062
17294
  var AUTHORITY_PREFIX = /^(?:[^#/:?]+:)?\/\/([^/?#]*)/;
17295
+ var AUTHORITY_INTRODUCER_REGION = /^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;
17063
17296
  function getParseError(parsed, matches) {
17064
17297
  if (matches[2] !== void 0 && parsed.path && parsed.path[0] !== "/") {
17065
17298
  return 'URI path must start with "/" when authority is present.';
@@ -17069,6 +17302,35 @@ var require_fast_uri = __commonJS({
17069
17302
  }
17070
17303
  return void 0;
17071
17304
  }
17305
+ function hasMalformedPercentEncoding(component) {
17306
+ if (component === void 0) return false;
17307
+ let percent = component.indexOf("%");
17308
+ while (percent !== -1) {
17309
+ if (percent + 2 >= component.length || !/^[\da-f]{2}$/iu.test(component.slice(percent + 1, percent + 3))) {
17310
+ return true;
17311
+ }
17312
+ percent = component.indexOf("%", percent + 3);
17313
+ }
17314
+ return false;
17315
+ }
17316
+ function isIPLiteral(host) {
17317
+ return host[0] === "[" && host[host.length - 1] === "]";
17318
+ }
17319
+ function hasMalformedComponentPercentEncoding(matches) {
17320
+ const host = matches[4];
17321
+ return hasMalformedPercentEncoding(matches[3]) || host !== void 0 && !isIPLiteral(host) && hasMalformedPercentEncoding(host) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]);
17322
+ }
17323
+ function canonicalizeHost(parsed, options, schemeHandler, isIP) {
17324
+ if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
17325
+ try {
17326
+ parsed.host = new URL("http://" + parsed.host).hostname;
17327
+ } catch (e) {
17328
+ parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
17329
+ return true;
17330
+ }
17331
+ }
17332
+ return false;
17333
+ }
17072
17334
  function parseWithStatus(uri, opts) {
17073
17335
  const options = Object.assign({}, opts);
17074
17336
  const parsed = {
@@ -17081,6 +17343,11 @@ var require_fast_uri = __commonJS({
17081
17343
  fragment: void 0
17082
17344
  };
17083
17345
  let malformedAuthorityOrPort = false;
17346
+ let malformedPercentEncoding = false;
17347
+ let malformedSchemeSpecific = false;
17348
+ let malformedHost = false;
17349
+ let malformedIPLiteral = false;
17350
+ let malformedScheme = false;
17084
17351
  let isIP = false;
17085
17352
  if (options.reference === "suffix") {
17086
17353
  if (options.scheme) {
@@ -17094,6 +17361,20 @@ var require_fast_uri = __commonJS({
17094
17361
  parsed.error = "URI authority must not contain a literal backslash.";
17095
17362
  malformedAuthorityOrPort = true;
17096
17363
  }
17364
+ const introducerMatch = uri.match(AUTHORITY_INTRODUCER_REGION);
17365
+ if (introducerMatch !== null) {
17366
+ const region = introducerMatch[1];
17367
+ const normalizedRegion = region.replace(/[\t\n\r]/g, "");
17368
+ if (normalizedRegion.length >= 2) {
17369
+ if (normalizedRegion.slice(0, 2) !== "//") {
17370
+ parsed.error = parsed.error || "URI authority must not contain a literal backslash.";
17371
+ malformedAuthorityOrPort = true;
17372
+ } else if (region.length !== normalizedRegion.length) {
17373
+ parsed.error = parsed.error || "URI authority introducer must not contain whitespace.";
17374
+ malformedAuthorityOrPort = true;
17375
+ }
17376
+ }
17377
+ }
17097
17378
  const matches = uri.match(URI_PARSE);
17098
17379
  if (matches) {
17099
17380
  parsed.scheme = matches[1];
@@ -17103,6 +17384,19 @@ var require_fast_uri = __commonJS({
17103
17384
  parsed.path = matches[6] || "";
17104
17385
  parsed.query = matches[7];
17105
17386
  parsed.fragment = matches[8];
17387
+ if (parsed.scheme !== void 0) {
17388
+ const decodedScheme = unescape(parsed.scheme);
17389
+ if (VALID_SCHEME.test(decodedScheme)) {
17390
+ parsed.scheme = decodedScheme.toLowerCase();
17391
+ } else {
17392
+ parsed.error = parsed.error || MALFORMED_SCHEME_ERROR;
17393
+ malformedScheme = true;
17394
+ }
17395
+ }
17396
+ malformedPercentEncoding = hasMalformedComponentPercentEncoding(matches);
17397
+ if (malformedPercentEncoding) {
17398
+ parsed.error = parsed.error || "URI contains malformed percent-encoding.";
17399
+ }
17106
17400
  if (isNaN(parsed.port)) {
17107
17401
  parsed.port = matches[5];
17108
17402
  }
@@ -17114,9 +17408,16 @@ var require_fast_uri = __commonJS({
17114
17408
  if (parsed.host) {
17115
17409
  const ipv4result = isIPv4(parsed.host);
17116
17410
  if (ipv4result === false) {
17411
+ const bracketedIPLiteral = isIPLiteral(parsed.host);
17412
+ const hasIPLiteralBracket = parsed.host.indexOf("[") !== -1 || parsed.host.indexOf("]") !== -1;
17117
17413
  const ipv6result = normalizeIPv6(parsed.host);
17118
- parsed.host = ipv6result.host.toLowerCase();
17119
- isIP = ipv6result.isIPV6;
17414
+ isIP = ipv6result.isIPV6 || ipv6result.isIPVFuture === true;
17415
+ malformedIPLiteral = hasIPLiteralBracket && (!bracketedIPLiteral || ipv6result.error === true);
17416
+ parsed.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase();
17417
+ if (malformedIPLiteral) {
17418
+ parsed.error = parsed.error || "URI host is malformed.";
17419
+ malformedAuthorityOrPort = true;
17420
+ }
17120
17421
  } else {
17121
17422
  isIP = true;
17122
17423
  }
@@ -17134,42 +17435,37 @@ var require_fast_uri = __commonJS({
17134
17435
  parsed.error = parsed.error || "URI is not a " + options.reference + " reference.";
17135
17436
  }
17136
17437
  const schemeHandler = getSchemeHandler(options.scheme || parsed.scheme);
17137
- if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
17138
- if (parsed.host && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
17139
- try {
17140
- parsed.host = new URL("http://" + parsed.host).hostname;
17141
- } catch (e) {
17142
- parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
17143
- }
17438
+ if (!malformedIPLiteral) {
17439
+ malformedHost = canonicalizeHost(parsed, options, schemeHandler, isIP);
17440
+ }
17441
+ if (uri.indexOf("%") !== -1 && parsed.host !== void 0 && !malformedIPLiteral) {
17442
+ let host = isIP ? parsed.host : normalizePercentEncoding(parsed.host, true);
17443
+ if (!isIP) {
17444
+ host = normalizePercentEncoding(host.toLowerCase());
17144
17445
  }
17446
+ parsed.host = reescapeHostDelimiters(host, isIP);
17145
17447
  }
17146
17448
  if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
17147
- if (uri.indexOf("%") !== -1) {
17148
- if (parsed.scheme !== void 0) {
17149
- parsed.scheme = unescape(parsed.scheme);
17150
- }
17151
- if (parsed.host !== void 0) {
17152
- parsed.host = reescapeHostDelimiters(unescape(parsed.host), isIP);
17153
- }
17154
- }
17155
17449
  if (parsed.path) {
17156
17450
  parsed.path = normalizePathEncoding(parsed.path);
17157
17451
  }
17452
+ if (parsed.query) {
17453
+ parsed.query = normalizeQueryFragmentEncoding(parsed.query);
17454
+ }
17158
17455
  if (parsed.fragment) {
17159
- try {
17160
- parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
17161
- } catch {
17162
- parsed.error = parsed.error || "URI malformed";
17163
- }
17456
+ parsed.fragment = normalizeQueryFragmentEncoding(parsed.fragment);
17164
17457
  }
17165
17458
  }
17166
17459
  if (schemeHandler && schemeHandler.parse) {
17167
17460
  schemeHandler.parse(parsed, options);
17461
+ if (schemeHandler === SCHEMES.urn && parsed.nid === void 0) {
17462
+ malformedSchemeSpecific = true;
17463
+ }
17168
17464
  }
17169
17465
  } else {
17170
17466
  parsed.error = parsed.error || "URI can not be parsed.";
17171
17467
  }
17172
- return { parsed, malformedAuthorityOrPort };
17468
+ return { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme };
17173
17469
  }
17174
17470
  function parse3(uri, opts) {
17175
17471
  return parseWithStatus(uri, opts).parsed;
@@ -17178,20 +17474,28 @@ var require_fast_uri = __commonJS({
17178
17474
  return normalizeStringWithStatus(uri, opts).normalized;
17179
17475
  }
17180
17476
  function normalizeStringWithStatus(uri, opts) {
17181
- const { parsed, malformedAuthorityOrPort } = parseWithStatus(uri, opts);
17477
+ const { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = parseWithStatus(uri, opts);
17182
17478
  return {
17183
- normalized: malformedAuthorityOrPort ? uri : serialize(parsed, opts),
17184
- malformedAuthorityOrPort
17479
+ normalized: malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? uri : serialize(parsed, opts),
17480
+ malformedAuthorityOrPort,
17481
+ malformedPercentEncoding,
17482
+ malformedSchemeSpecific,
17483
+ malformedHost,
17484
+ malformedScheme
17185
17485
  };
17186
17486
  }
17187
17487
  function normalizeComparableURI(uri, opts) {
17188
- if (typeof uri === "string") {
17189
- const { normalized, malformedAuthorityOrPort } = normalizeStringWithStatus(uri, opts);
17190
- return malformedAuthorityOrPort ? void 0 : normalized;
17488
+ if (typeof uri !== "string" && typeof uri !== "object") {
17489
+ return void 0;
17191
17490
  }
17192
- if (typeof uri === "object") {
17193
- return serialize(uri, opts);
17491
+ let value;
17492
+ try {
17493
+ value = typeof uri === "string" ? uri : serialize(uri, opts);
17494
+ } catch {
17495
+ return void 0;
17194
17496
  }
17497
+ const { normalized, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = normalizeStringWithStatus(value, opts);
17498
+ return malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? void 0 : normalized;
17195
17499
  }
17196
17500
  var fastUri = {
17197
17501
  SCHEMES,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squirrelnotes.app/mcp",
3
- "version": "1.31.6",
3
+ "version": "2.0.0",
4
4
  "description": "MCP stdio CLI for Squirrel Notes — bridges AI agents to the encrypted note-taking API",
5
5
  "type": "module",
6
6
  "bin": {