@icoretech/warden-mcp 0.2.71 → 0.2.73

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 (45) hide show
  1. package/node_modules/tldts-core/dist/cjs/index.js +160 -34
  2. package/node_modules/tldts-core/dist/cjs/index.js.map +1 -1
  3. package/node_modules/tldts-core/dist/cjs/src/domain.js +1 -0
  4. package/node_modules/tldts-core/dist/cjs/src/domain.js.map +1 -1
  5. package/node_modules/tldts-core/dist/cjs/src/extract-hostname.js +61 -29
  6. package/node_modules/tldts-core/dist/cjs/src/extract-hostname.js.map +1 -1
  7. package/node_modules/tldts-core/dist/cjs/src/factory.js +12 -3
  8. package/node_modules/tldts-core/dist/cjs/src/factory.js.map +1 -1
  9. package/node_modules/tldts-core/dist/cjs/src/lookup/extra-suffixes.js +87 -0
  10. package/node_modules/tldts-core/dist/cjs/src/lookup/extra-suffixes.js.map +1 -0
  11. package/node_modules/tldts-core/dist/cjs/src/lookup/fast-path.js +3 -1
  12. package/node_modules/tldts-core/dist/cjs/src/lookup/fast-path.js.map +1 -1
  13. package/node_modules/tldts-core/dist/cjs/src/options.js +2 -1
  14. package/node_modules/tldts-core/dist/cjs/src/options.js.map +1 -1
  15. package/node_modules/tldts-core/dist/cjs/tsconfig.tsbuildinfo +1 -1
  16. package/node_modules/tldts-core/dist/es6/src/domain.js +1 -1
  17. package/node_modules/tldts-core/dist/es6/src/domain.js.map +1 -1
  18. package/node_modules/tldts-core/dist/es6/src/extract-hostname.js +61 -29
  19. package/node_modules/tldts-core/dist/es6/src/extract-hostname.js.map +1 -1
  20. package/node_modules/tldts-core/dist/es6/src/factory.js +12 -3
  21. package/node_modules/tldts-core/dist/es6/src/factory.js.map +1 -1
  22. package/node_modules/tldts-core/dist/es6/src/lookup/extra-suffixes.js +84 -0
  23. package/node_modules/tldts-core/dist/es6/src/lookup/extra-suffixes.js.map +1 -0
  24. package/node_modules/tldts-core/dist/es6/src/lookup/fast-path.js +3 -1
  25. package/node_modules/tldts-core/dist/es6/src/lookup/fast-path.js.map +1 -1
  26. package/node_modules/tldts-core/dist/es6/src/options.js +2 -1
  27. package/node_modules/tldts-core/dist/es6/src/options.js.map +1 -1
  28. package/node_modules/tldts-core/dist/es6/tsconfig.bundle.tsbuildinfo +1 -1
  29. package/node_modules/tldts-core/dist/types/src/domain.d.ts +12 -0
  30. package/node_modules/tldts-core/dist/types/src/factory.d.ts +1 -1
  31. package/node_modules/tldts-core/dist/types/src/lookup/extra-suffixes.d.ts +10 -0
  32. package/node_modules/tldts-core/dist/types/src/options.d.ts +4 -0
  33. package/node_modules/tldts-core/package.json +2 -2
  34. package/node_modules/tldts-core/src/domain.ts +4 -1
  35. package/node_modules/tldts-core/src/extract-hostname.ts +68 -29
  36. package/node_modules/tldts-core/src/factory.ts +13 -4
  37. package/node_modules/tldts-core/src/lookup/extra-suffixes.ts +98 -0
  38. package/node_modules/tldts-core/src/lookup/fast-path.ts +5 -1
  39. package/node_modules/tldts-core/src/options.ts +7 -0
  40. package/node_modules/ws/README.md +2 -3
  41. package/node_modules/ws/lib/receiver.js +8 -0
  42. package/node_modules/ws/lib/websocket-server.js +3 -0
  43. package/node_modules/ws/lib/websocket.js +58 -13
  44. package/node_modules/ws/package.json +1 -1
  45. package/package.json +3 -3
@@ -0,0 +1,98 @@
1
+ import { shareSameDomainSuffix } from '../domain';
2
+ import { IOptions } from '../options';
3
+ import { IPublicSuffix } from './interface';
4
+
5
+ /**
6
+ * Apply `options.extraSuffixes` to the built-in lookup result in `out`, as if
7
+ * they were part of the list (`isException`: the built-in winner is an
8
+ * exception rule). As in browsers, the longest match prevails and an exception
9
+ * beats a rule of the same length. Remaining ties go to the built-in match
10
+ * (unless it matched no rule: both flags falsy), then to `icann`.
11
+ */
12
+ export default function extraSuffixLookup(
13
+ hostname: string,
14
+ options: IOptions,
15
+ isException: boolean,
16
+ out: IPublicSuffix,
17
+ ): void {
18
+ const suffix = out.publicSuffix;
19
+ if (suffix === null) {
20
+ return;
21
+ }
22
+
23
+ // Best extra exception and rule, as start indices in `hostname` (smaller is
24
+ // longer; `none` if unmatched), and whether each is ICANN.
25
+ const none = hostname.length + 1;
26
+ let exception = none;
27
+ let exceptionIsIcann = false;
28
+ let rule = none;
29
+ let ruleIsIcann = false;
30
+ const extra = options.extraSuffixes!;
31
+ for (let section = 0; section < 2; section += 1) {
32
+ const isIcann = section === 0;
33
+ const rules = isIcann
34
+ ? options.allowIcannDomains && extra.icann
35
+ : options.allowPrivateDomains && extra.private;
36
+ if (!Array.isArray(rules)) {
37
+ continue;
38
+ }
39
+ for (const r of rules) {
40
+ // Sparse or untyped lists may hold non-strings.
41
+ if (typeof r !== 'string') {
42
+ continue;
43
+ }
44
+ const exceptionRule = r.startsWith('!');
45
+ const wildcard = r.startsWith('*.');
46
+ const body = exceptionRule ? r.slice(1) : wildcard ? r.slice(2) : r;
47
+ // Skip empty rules, and exceptions without a parent ('!p').
48
+ if (
49
+ body === '' ||
50
+ (exceptionRule && !body.includes('.')) ||
51
+ !shareSameDomainSuffix(hostname, body)
52
+ ) {
53
+ continue;
54
+ }
55
+ let start = hostname.length - body.length;
56
+ // Strict `<`: on a tie, the first match (`icann` first) wins.
57
+ if (exceptionRule) {
58
+ if (start < exception) {
59
+ exception = start;
60
+ exceptionIsIcann = isIcann;
61
+ }
62
+ continue;
63
+ }
64
+ // `*.p` also matches `p`, else one more non-empty label.
65
+ if (wildcard && start > 1 && hostname.charCodeAt(start - 2) !== 46) {
66
+ start = hostname.lastIndexOf('.', start - 2) + 1;
67
+ }
68
+ if (start < rule) {
69
+ rule = start;
70
+ ruleIsIcann = isIcann;
71
+ }
72
+ }
73
+ }
74
+
75
+ // Start of the built-in match: an exception starts one label left of its
76
+ // suffix.
77
+ const suffixStart = hostname.length - suffix.length;
78
+ const builtin = isException
79
+ ? hostname.lastIndexOf('.', suffixStart - 2) + 1
80
+ : suffixStart;
81
+ // An exception wins ties with rules; a built-in exception wins ties with
82
+ // an extra one.
83
+ if (
84
+ exception <= rule &&
85
+ (isException ? exception < builtin : exception <= builtin)
86
+ ) {
87
+ out.publicSuffix = hostname.slice(hostname.indexOf('.', exception) + 1);
88
+ out.isIcann = exceptionIsIcann;
89
+ out.isPrivate = !exceptionIsIcann;
90
+ } else if (
91
+ rule < builtin ||
92
+ (rule === builtin && !out.isIcann && !out.isPrivate)
93
+ ) {
94
+ out.publicSuffix = hostname.slice(rule);
95
+ out.isIcann = ruleIsIcann;
96
+ out.isPrivate = !ruleIsIcann;
97
+ }
98
+ }
@@ -7,7 +7,11 @@ export default function (
7
7
  ): boolean {
8
8
  // Fast path for very popular suffixes; this allows to by-pass lookup
9
9
  // completely as well as any extra allocation or string manipulation.
10
- if (!options.allowPrivateDomains && hostname.length > 3) {
10
+ if (
11
+ !options.allowPrivateDomains &&
12
+ options.allowIcannDomains &&
13
+ hostname.length > 3
14
+ ) {
11
15
  const last: number = hostname.length - 1;
12
16
  const c3: number = hostname.charCodeAt(last);
13
17
  const c2: number = hostname.charCodeAt(last - 1);
@@ -6,6 +6,11 @@ export interface IOptions {
6
6
  // `isSpecialUse` on `parse()`. Off by default so the common path stays
7
7
  // allocation-free with no extra work; enable it to populate the field.
8
8
  detectSpecialUse: boolean;
9
+ // Extra public suffix rules, in PSL syntax, per section (default: null)
10
+ extraSuffixes: {
11
+ icann?: readonly string[];
12
+ private?: readonly string[];
13
+ } | null;
9
14
  extractHostname: boolean;
10
15
  mixedInputs: boolean;
11
16
  validHosts: string[] | null;
@@ -17,6 +22,7 @@ function setDefaultsImpl({
17
22
  allowPrivateDomains = false,
18
23
  detectIp = true,
19
24
  detectSpecialUse = false,
25
+ extraSuffixes = null,
20
26
  extractHostname = true,
21
27
  mixedInputs = true,
22
28
  validHosts = null,
@@ -27,6 +33,7 @@ function setDefaultsImpl({
27
33
  allowPrivateDomains,
28
34
  detectIp,
29
35
  detectSpecialUse,
36
+ extraSuffixes,
30
37
  extractHostname,
31
38
  mixedInputs,
32
39
  validHosts,
@@ -22,8 +22,7 @@ can use one of the many wrappers available on npm, like
22
22
 
23
23
  - [Protocol support](#protocol-support)
24
24
  - [Installing](#installing)
25
- - [Opt-in for performance](#opt-in-for-performance)
26
- - [Legacy opt-in for performance](#legacy-opt-in-for-performance)
25
+ - [Legacy opt-in for performance](#legacy-opt-in-for-performance)
27
26
  - [API docs](#api-docs)
28
27
  - [WebSocket compression](#websocket-compression)
29
28
  - [Usage examples](#usage-examples)
@@ -66,7 +65,7 @@ performance.
66
65
  - `npm install --save-optional utf-8-validate`: Provides a binary polyfill for
67
66
  [`buffer.isUtf8()`][].
68
67
 
69
- On newer Node.js versions (v27.0.0-alpha.0.0.0 or later for bufferutil, and
68
+ On newer Node.js versions (v26.12.0 or later for bufferutil, and
70
69
  v18.14.0 or later for utf-8-validate) that feature built-in alternatives, these
71
70
  modules are not loaded even if installed.
72
71
 
@@ -496,6 +496,14 @@ class Receiver extends Writable {
496
496
  }
497
497
  }
498
498
 
499
+ //
500
+ // The mask is a view into the buffer the stream delivered, which is commonly
501
+ // 64 KiB, and it is not needed once the payload above has been unmasked.
502
+ // Leaving it set would pin that whole buffer until the next frame arrives,
503
+ // which on an idle connection can be indefinitely.
504
+ //
505
+ this._mask = undefined;
506
+
499
507
  if (this._opcode > 0x07) {
500
508
  this.controlMessage(data, cb);
501
509
  return;
@@ -49,6 +49,8 @@ class WebSocketServer extends EventEmitter {
49
49
  * fragments
50
50
  * @param {Number} [options.maxPayload=104857600] The maximum allowed message
51
51
  * size
52
+ * @param {Number} [options.maxPendingAutoPongs=60] The maximum number of
53
+ * pending automatic pongs
52
54
  * @param {Boolean} [options.noServer=false] Enable no server mode
53
55
  * @param {String} [options.path] Accept only connections matching this path
54
56
  * @param {(Boolean|Object)} [options.perMessageDeflate=false] Enable/disable
@@ -72,6 +74,7 @@ class WebSocketServer extends EventEmitter {
72
74
  maxBufferedChunks: 256 * 1024,
73
75
  maxFragments: 16 * 1024,
74
76
  maxPayload: 100 * 1024 * 1024,
77
+ maxPendingAutoPongs: 60,
75
78
  skipUTF8Validation: false,
76
79
  perMessageDeflate: false,
77
80
  handleProtocols: null,
@@ -6,6 +6,7 @@ const EventEmitter = require('events');
6
6
  const https = require('https');
7
7
  const http = require('http');
8
8
  const net = require('net');
9
+ const querystring = require('querystring');
9
10
  const tls = require('tls');
10
11
  const { randomBytes, createHash } = require('crypto');
11
12
  const { Duplex, Readable } = require('stream');
@@ -98,12 +99,19 @@ class WebSocket extends EventEmitter {
98
99
  }
99
100
  }
100
101
 
101
- initAsClient(this, address, protocols, options);
102
+ options = initAsClient(this, address, protocols, options);
102
103
  } else {
103
- this._autoPong = options.autoPong;
104
- this._closeTimeout = options.closeTimeout;
105
104
  this._isServer = true;
106
105
  }
106
+
107
+ if (options.autoPong) {
108
+ this._autoPong = true;
109
+ this._autoPongComplete = () => autoPongComplete(this);
110
+ this._pendingAutoPongs = 0;
111
+ this._maxPendingAutoPongs = options.maxPendingAutoPongs | 0;
112
+ }
113
+
114
+ this._closeTimeout = options.closeTimeout;
107
115
  }
108
116
 
109
117
  /**
@@ -665,6 +673,8 @@ module.exports = WebSocket;
665
673
  * fragments
666
674
  * @param {Number} [options.maxPayload=104857600] The maximum allowed message
667
675
  * size
676
+ * @param {Number} [options.maxPendingAutoPongs=60] The maximum number of
677
+ * pending automatic pongs
668
678
  * @param {Number} [options.maxRedirects=10] The maximum number of redirects
669
679
  * allowed
670
680
  * @param {String} [options.origin] Value of the `Origin` or
@@ -675,6 +685,7 @@ module.exports = WebSocket;
675
685
  * `Sec-WebSocket-Version` header
676
686
  * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
677
687
  * not to skip UTF-8 validation for text and close messages
688
+ * @return {Object} The resolved options object used for initialization
678
689
  * @private
679
690
  */
680
691
  function initAsClient(websocket, address, protocols, options) {
@@ -686,6 +697,7 @@ function initAsClient(websocket, address, protocols, options) {
686
697
  maxBufferedChunks: 256 * 1024,
687
698
  maxFragments: 16 * 1024,
688
699
  maxPayload: 100 * 1024 * 1024,
700
+ maxPendingAutoPongs: 60,
689
701
  skipUTF8Validation: false,
690
702
  perMessageDeflate: true,
691
703
  followRedirects: false,
@@ -702,9 +714,6 @@ function initAsClient(websocket, address, protocols, options) {
702
714
  port: undefined
703
715
  };
704
716
 
705
- websocket._autoPong = opts.autoPong;
706
- websocket._closeTimeout = opts.closeTimeout;
707
-
708
717
  if (!protocolVersions.includes(opts.protocolVersion)) {
709
718
  throw new RangeError(
710
719
  `Unsupported protocol version: ${opts.protocolVersion} ` +
@@ -724,10 +733,9 @@ function initAsClient(websocket, address, protocols, options) {
724
733
  }
725
734
  }
726
735
 
727
- if (parsedUrl.protocol === 'http:') {
728
- parsedUrl.protocol = 'ws:';
729
- } else if (parsedUrl.protocol === 'https:') {
730
- parsedUrl.protocol = 'wss:';
736
+ if (parsedUrl.protocol === 'http:' || parsedUrl.protocol === 'https:') {
737
+ parsedUrl = new URL(parsedUrl);
738
+ parsedUrl.protocol = parsedUrl.protocol === 'http:' ? 'ws:' : 'wss:';
731
739
  }
732
740
 
733
741
  websocket._url = parsedUrl.href;
@@ -815,7 +823,10 @@ function initAsClient(websocket, address, protocols, options) {
815
823
  }
816
824
  }
817
825
  if (parsedUrl.username || parsedUrl.password) {
818
- opts.auth = `${parsedUrl.username}:${parsedUrl.password}`;
826
+ const username = querystring.unescape(parsedUrl.username);
827
+ const password = querystring.unescape(parsedUrl.password);
828
+
829
+ opts.auth = `${username}:${password}`;
819
830
  }
820
831
 
821
832
  if (isIpcUrl) {
@@ -1060,6 +1071,8 @@ function initAsClient(websocket, address, protocols, options) {
1060
1071
  } else {
1061
1072
  req.end();
1062
1073
  }
1074
+
1075
+ return opts;
1063
1076
  }
1064
1077
 
1065
1078
  /**
@@ -1188,9 +1201,20 @@ function receiverOnConclude(code, reason) {
1188
1201
  const websocket = this[kWebSocket];
1189
1202
 
1190
1203
  websocket._closeFrameReceived = true;
1191
- websocket._closeMessage = reason;
1192
1204
  websocket._closeCode = code;
1193
1205
 
1206
+ //
1207
+ // The reason is a view into the buffer the socket delivered. Copy it so that
1208
+ // the `WebSocket` does not keep that buffer alive. The copy is not pooled
1209
+ // because a pooled one would keep the pool alive in the same way.
1210
+ //
1211
+ if (reason.length === 0) {
1212
+ websocket._closeMessage = EMPTY_BUFFER;
1213
+ } else {
1214
+ websocket._closeMessage = Buffer.allocUnsafeSlow(reason.length);
1215
+ websocket._closeMessage.set(reason);
1216
+ }
1217
+
1194
1218
  if (websocket._socket[kWebSocket] === undefined) return;
1195
1219
 
1196
1220
  websocket._socket.removeListener('data', socketOnData);
@@ -1267,10 +1291,31 @@ function receiverOnMessage(data, isBinary) {
1267
1291
  function receiverOnPing(data) {
1268
1292
  const websocket = this[kWebSocket];
1269
1293
 
1270
- if (websocket._autoPong) websocket.pong(data, !this._isServer, NOOP);
1294
+ if (websocket._autoPong && websocket.readyState === WebSocket.OPEN) {
1295
+ if (
1296
+ websocket._maxPendingAutoPongs > 0 &&
1297
+ websocket._pendingAutoPongs >= websocket._maxPendingAutoPongs
1298
+ ) {
1299
+ websocket.terminate();
1300
+ } else {
1301
+ websocket._pendingAutoPongs++;
1302
+ websocket.pong(data, !this._isServer, websocket._autoPongComplete);
1303
+ }
1304
+ }
1305
+
1271
1306
  websocket.emit('ping', data);
1272
1307
  }
1273
1308
 
1309
+ /**
1310
+ * The callback for automatic pong responses.
1311
+ *
1312
+ * @param {WebSocket} websocket The WebSocket instance
1313
+ * @private
1314
+ */
1315
+ function autoPongComplete(websocket) {
1316
+ websocket._pendingAutoPongs--;
1317
+ }
1318
+
1274
1319
  /**
1275
1320
  * The listener of the `Receiver` `'pong'` event.
1276
1321
  *
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ws",
3
- "version": "8.22.1",
3
+ "version": "8.23.0",
4
4
  "peerDependencies": {
5
5
  "bufferutil": "^4.0.1",
6
6
  "utf-8-validate": ">=5.0.2"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icoretech/warden-mcp",
3
- "version": "0.2.71",
3
+ "version": "0.2.73",
4
4
  "dependencies": {
5
5
  "@bitwarden/cli": "2026.10.1",
6
6
  "@modelcontextprotocol/sdk": "^1.32.2",
@@ -48,8 +48,8 @@
48
48
  "access": "public"
49
49
  },
50
50
  "engines": {
51
- "node": "~22.23.4",
52
- "npm": "~10.9.9"
51
+ "node": "~22.23.5",
52
+ "npm": "~10.9.10"
53
53
  },
54
54
  "bundleDependencies": [
55
55
  "@bitwarden/cli"