@flemist/mcp-project-tools 4.0.4 → 5.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.
@@ -1,22 +1,22 @@
1
1
  import ne from "express";
2
- import { McpServer as Vt } from "@modelcontextprotocol/sdk/server/mcp.js";
3
- import { randomUUID as Zt } from "crypto";
2
+ import { McpServer as Zt } from "@modelcontextprotocol/sdk/server/mcp.js";
3
+ import { randomUUID as Xt } from "crypto";
4
4
  import * as j from "fs";
5
5
  import * as k from "path";
6
- import { StreamableHTTPServerTransport as Xt } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
7
- import { spawn as er } from "child_process";
8
- import { z as h } from "zod";
6
+ import { StreamableHTTPServerTransport as er } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
7
+ import { spawn as tr } from "child_process";
8
+ import { z as m } from "zod";
9
9
  import he from "tree-kill";
10
- import { Pool as tr, poolRunWait as V } from "@flemist/time-limits";
10
+ import { Pool as rr, poolRunWait as V } from "@flemist/time-limits";
11
11
  import { priorityCreate as X } from "@flemist/priority-queue";
12
- import { useAbortController as rr, combineAbortSignals as sr, Locker as or } from "@flemist/async-utils";
13
- import nr from "node:os";
14
- import ir from "picomatch";
15
- import { webkit as ar, firefox as lr, chromium as cr } from "playwright";
16
- import ur from "deepmerge";
12
+ import { useAbortController as sr, combineAbortSignals as or, Locker as nr } from "@flemist/async-utils";
13
+ import ir from "node:os";
14
+ import ar from "picomatch";
15
+ import { webkit as lr, firefox as cr, chromium as ur } from "playwright";
16
+ import dr from "deepmerge";
17
17
  import Ne from "json5";
18
- import dr from "js-yaml";
19
- function fr(t) {
18
+ import fr from "js-yaml";
19
+ function pr(t) {
20
20
  const { authToken: r } = t;
21
21
  return function(o, e, n) {
22
22
  if ((o.query.token || o.headers.authorization?.replace("Bearer ", "")) !== r) {
@@ -39,12 +39,12 @@ ${n}
39
39
  }
40
40
  }
41
41
  const ae = /* @__PURE__ */ new Map();
42
- function pr(t) {
42
+ function hr(t) {
43
43
  return t.headers["mcp-session-id"] || t.headers["x-session-id"] || t.query.token;
44
44
  }
45
- async function hr(t, r) {
46
- const s = await r.createMcpServer(t), o = new Xt({
47
- sessionIdGenerator: Zt,
45
+ async function mr(t, r) {
46
+ const s = await r.createMcpServer(t), o = new er({
47
+ sessionIdGenerator: Xt,
48
48
  onsessioninitialized: (n) => {
49
49
  ae.set(n, o);
50
50
  },
@@ -66,16 +66,16 @@ async function hr(t, r) {
66
66
  throw await e(), n;
67
67
  }
68
68
  }
69
- async function mr(t, r, s, o) {
69
+ async function gr(t, r, s, o) {
70
70
  await ie({
71
71
  logFilePath: s.logFilePath,
72
72
  message: "REQUEST",
73
73
  data: t.body
74
74
  });
75
75
  let e = o ? ae.get(o) : null;
76
- e || (e = await hr(t, s)), await e.handleRequest(t, r, t.body);
76
+ e || (e = await mr(t, s)), await e.handleRequest(t, r, t.body);
77
77
  }
78
- async function gr(t, r, s) {
78
+ async function wr(t, r, s) {
79
79
  const o = s ? ae.get(s) : null;
80
80
  if (!o) {
81
81
  r.status(400).json({ error: "No valid session found" });
@@ -83,11 +83,11 @@ async function gr(t, r, s) {
83
83
  }
84
84
  await o.handleRequest(t, r);
85
85
  }
86
- function wr(t) {
86
+ function yr(t) {
87
87
  return async function(s, o) {
88
88
  try {
89
- const e = pr(s);
90
- s.method === "POST" ? await mr(s, o, t, e) : s.method === "GET" ? await gr(s, o, e) : o.status(405).json({ error: "Method not allowed" });
89
+ const e = hr(s);
90
+ s.method === "POST" ? await gr(s, o, t, e) : s.method === "GET" ? await wr(s, o, e) : o.status(405).json({ error: "Method not allowed" });
91
91
  } catch (e) {
92
92
  console.error("Unhandled error in streamableHttpHandler", e), o.status(500).json({
93
93
  error: "Internal server error: " + (e instanceof Error ? e.message : "Unknown error")
@@ -96,9 +96,9 @@ function wr(t) {
96
96
  };
97
97
  }
98
98
  const Y = /* @__PURE__ */ new Map();
99
- let yr = 0;
100
- const ke = 10, br = 1800 * 1e3, J = 1e4, Q = 2e3, Sr = 5e3;
101
- function xr(t) {
99
+ let br = 0;
100
+ const ke = 10, Sr = 1800 * 1e3, J = 1e4, Q = 2e3, xr = 5e3;
101
+ function $r(t) {
102
102
  const { commandLine: r, commandLineRules: s } = t;
103
103
  let o = !1;
104
104
  for (const e of s)
@@ -115,11 +115,11 @@ function xr(t) {
115
115
  }
116
116
  return o;
117
117
  }
118
- function $r() {
119
- return ++yr;
118
+ function Ir() {
119
+ return ++br;
120
120
  }
121
121
  let Oe = !1;
122
- function Ir() {
122
+ function Mr() {
123
123
  if (Oe)
124
124
  return;
125
125
  Oe = !0;
@@ -139,7 +139,7 @@ function Ir() {
139
139
  function ge() {
140
140
  const t = Date.now(), r = [];
141
141
  for (const [s, o] of Array.from(Y.entries()))
142
- !o.isRunning && o.endTime && t - o.endTime.getTime() > br && r.push(s);
142
+ !o.isRunning && o.endTime && t - o.endTime.getTime() > Sr && r.push(s);
143
143
  for (const s of r)
144
144
  Y.delete(s);
145
145
  }
@@ -152,11 +152,11 @@ function at(t, r) {
152
152
  let o;
153
153
  return r ? o = s.split(/[\\/]/).map(Re).join(De) : o = Re(s), o += `(?=${De}|$)`, new RegExp(o, r ? "gi" : "g");
154
154
  }
155
- function Mr(t, r, s, o) {
155
+ function Tr(t, r, s, o) {
156
156
  const e = at(r, o);
157
157
  return t.replace(e, (n) => s + n.slice(r.length));
158
158
  }
159
- function Tr(t, r, s, o) {
159
+ function Cr(t, r, s, o) {
160
160
  const e = process.platform === "win32", n = {};
161
161
  if (s !== "clear") if (s === "replaceServerPaths" || s === "deleteServerPaths") {
162
162
  const i = Fe(t, e), a = Fe(r, e);
@@ -165,7 +165,7 @@ function Tr(t, r, s, o) {
165
165
  for (const u in process.env) {
166
166
  if (!Object.prototype.hasOwnProperty.call(process.env, u)) continue;
167
167
  const f = process.env[u];
168
- f != null && (l.lastIndex = 0, l.test(f) ? s === "replaceServerPaths" && (n[u] = Mr(f, t, r, e)) : n[u] = f);
168
+ f != null && (l.lastIndex = 0, l.test(f) ? s === "replaceServerPaths" && (n[u] = Tr(f, t, r, e)) : n[u] = f);
169
169
  }
170
170
  } else
171
171
  for (const l in process.env) {
@@ -191,10 +191,10 @@ function Fe(t, r) {
191
191
  const s = k.normalize(t).replace(/[\\/]+$/, "");
192
192
  return r ? s.toLowerCase() : s;
193
193
  }
194
- const Cr = 1800 * 1e3, Pe = /* @__PURE__ */ new Map();
195
- let vr = 0;
196
- function Er() {
197
- return ++vr;
194
+ const vr = 1800 * 1e3, Pe = /* @__PURE__ */ new Map();
195
+ let Er = 0;
196
+ function Nr() {
197
+ return ++Er;
198
198
  }
199
199
  function lt(t) {
200
200
  let r = Pe.get(t);
@@ -208,13 +208,13 @@ function ct(t) {
208
208
  function ut(t, r) {
209
209
  return setTimeout(() => {
210
210
  t.storedOutputs.delete(r);
211
- }, Cr);
211
+ }, vr);
212
212
  }
213
- function Nr(t, r, s) {
213
+ function kr(t, r, s) {
214
214
  clearTimeout(s.cleanupTimer), s.cleanupTimer = ut(t, r);
215
215
  }
216
- function kr(t) {
217
- const { sessionId: r, source: s } = t, o = lt(r), e = Er(), n = {
216
+ function Or(t) {
217
+ const { sessionId: r, source: s } = t, o = lt(r), e = Nr(), n = {
218
218
  source: s,
219
219
  cleanupTimer: ut(o, e)
220
220
  };
@@ -229,7 +229,7 @@ function dt(t) {
229
229
  range: [0, 0],
230
230
  error: `Stored output with outputId=${s} not found or expired`
231
231
  };
232
- Nr(i, s, a);
232
+ kr(i, s, a);
233
233
  const c = ct(a.source), l = c.length, u = Math.min(Math.max(e, 0), l), f = Math.min(Math.max(n, 0), l);
234
234
  return { content: c.substring(u, f), total: l, range: [u, f] };
235
235
  }
@@ -237,7 +237,7 @@ function we(t) {
237
237
  const { sessionId: r, source: s, limit: o } = t, e = ct(s);
238
238
  if (e.length <= o)
239
239
  return { content: e, outputId: null };
240
- const n = kr({ sessionId: r, source: s }), i = dt({
240
+ const n = Or({ sessionId: r, source: s }), i = dt({
241
241
  sessionId: r,
242
242
  outputId: n,
243
243
  range: [0, o]
@@ -253,16 +253,22 @@ function F(t) {
253
253
 
254
254
  Provide valid parameters according to schema.`;
255
255
  }
256
- const ft = h.object({
257
- outputId: h.number().int().describe("Output ID from truncation message"),
258
- range: h.tuple([h.number().int().min(0), h.number().int().min(0)]).describe(
259
- `Character range [from, to) to retrieve. Maximum range size: ${J}.`
256
+ const ft = m.object({
257
+ from: m.number().int().min(0).describe("Start index"),
258
+ to: m.number().int().min(0).describe("End index")
259
+ }), Rr = m.object({
260
+ from: m.number().int().min(0).describe("Start index"),
261
+ toExclusive: m.number().int().min(0).describe("End index exclusive")
262
+ }), pt = m.object({
263
+ outputId: m.number().int().describe("Output ID from truncation message"),
264
+ range: Rr.describe(
265
+ `Character range to retrieve. Maximum range size: ${J}.`
260
266
  )
261
267
  });
262
- function Or(t, r) {
268
+ function Dr(t, r) {
263
269
  let s;
264
270
  try {
265
- s = ft.parse(t);
271
+ s = pt.parse(t);
266
272
  } catch (i) {
267
273
  return {
268
274
  error: F(i)
@@ -272,7 +278,7 @@ function Or(t, r) {
272
278
  return {
273
279
  error: "Session ID is required"
274
280
  };
275
- const [o, e] = s.range;
281
+ const { from: o, toExclusive: e } = s.range;
276
282
  if (e <= o)
277
283
  return {
278
284
  error: `Invalid range: to (${e}) must be greater than from (${o})`
@@ -284,20 +290,24 @@ function Or(t, r) {
284
290
  const n = dt({
285
291
  sessionId: r.sessionId,
286
292
  outputId: s.outputId,
287
- range: s.range
293
+ range: [o, e]
288
294
  });
289
- return n.error != null ? { error: n.error } : { content: n.content, total: n.total, range: n.range };
295
+ return n.error != null ? { error: n.error } : {
296
+ content: n.content,
297
+ total: n.total,
298
+ range: n.range
299
+ };
290
300
  }
291
- function Rr(t) {
301
+ function Fr(t) {
292
302
  t(
293
303
  "output-read",
294
304
  {
295
305
  title: "Read Stored Output Range",
296
306
  description: "Read any range from stored output. Use outputId from truncation message and specify character range [from, to).",
297
- inputSchema: ft.shape
307
+ inputSchema: pt.shape
298
308
  },
299
309
  async (r, s) => {
300
- const o = Or(r, s);
310
+ const o = Dr(r, s);
301
311
  if (o.error != null)
302
312
  return `Method: output-read(${JSON.stringify(r)})
303
313
  ❌ Error: ${o.error}`;
@@ -311,14 +321,14 @@ ${o.content}`, a;
311
321
  }
312
322
  );
313
323
  }
314
- function Dr(t) {
315
- Rr(t);
324
+ function Pr(t) {
325
+ Fr(t);
316
326
  }
317
- const pt = h.object({
318
- id: h.number().describe(
327
+ const ht = m.object({
328
+ id: m.number().describe(
319
329
  "Process ID to get detailed status information for. Get process IDs using process-list. Works for both running and completed processes. Examples: 1, 42, 123"
320
330
  ),
321
- outputLimit: h.number().int().min(0).max(J).default(Q).describe(
331
+ outputLimit: m.number().int().min(0).max(J).default(Q).describe(
322
332
  `Maximum output characters to return. Truncated output can be retrieved via output-read tool using outputId from truncation message. Maximum: ${J}. Default: ${Q}`
323
333
  )
324
334
  });
@@ -326,7 +336,7 @@ async function ye(t, r, s) {
326
336
  ge();
327
337
  let o;
328
338
  try {
329
- o = pt.parse(t);
339
+ o = ht.parse(t);
330
340
  } catch (c) {
331
341
  return {
332
342
  error: F(c)
@@ -359,13 +369,13 @@ async function ye(t, r, s) {
359
369
  error: i.error
360
370
  };
361
371
  }
362
- function Fr(t, r) {
372
+ function Br(t, r) {
363
373
  t(
364
374
  "process-status",
365
375
  {
366
376
  title: "Get Host Machine Process Status",
367
377
  description: "Get detailed status information about a process on the host machine. Use this to check if commands completed successfully, get their output, or monitor running processes",
368
- inputSchema: pt.shape
378
+ inputSchema: ht.shape
369
379
  },
370
380
  async (s, o) => {
371
381
  const e = await ye(s, r, o);
@@ -381,36 +391,36 @@ ${n.trim()}`;
381
391
  }
382
392
  );
383
393
  }
384
- function ht(t) {
394
+ function mt(t) {
385
395
  he(t, "SIGTERM", (r) => {
386
396
  r && !r.message.includes("not found") && console.error(`Error sending SIGTERM to process ${t}:`, r);
387
397
  }), setTimeout(() => {
388
398
  he(t, "SIGKILL", (r) => {
389
399
  r && !r.message.includes("not found") && console.error(`Error sending SIGKILL to process ${t}:`, r);
390
400
  });
391
- }, Sr);
401
+ }, xr);
392
402
  }
393
- const mt = h.object({
394
- id: h.number().describe(
403
+ const gt = m.object({
404
+ id: m.number().describe(
395
405
  "Process ID to wait for completion. Get process IDs using process-list. The process can be running or already completed. Examples: 1, 42, 123"
396
406
  ),
397
- waitTime: h.number().optional().describe(
407
+ waitTime: m.number().optional().describe(
398
408
  "Maximum time to wait in seconds for process completion. If omitted, waits indefinitely until process completes. If process is already completed, returns immediately. Examples: 30 (wait up to 30 seconds), 300 (wait up to 5 minutes)"
399
409
  ),
400
- autoKill: h.boolean().default(!1).describe(
410
+ autoKill: m.boolean().default(!1).describe(
401
411
  "Automatically terminate the process if waitTime expires and it is still running. Only applies when waitTime is specified. Default: false (let process continue running after timeout). Set to true for processes that should not run indefinitely"
402
412
  ),
403
- outputLimit: h.number().int().min(0).max(J).default(Q).describe(
413
+ outputLimit: m.number().int().min(0).max(J).default(Q).describe(
404
414
  `Maximum output characters to return. Truncated output can be retrieved via output-read tool using outputId from truncation message. Maximum: ${J}. Default: ${Q}`
405
415
  )
406
416
  });
407
- async function gt(t, r, s) {
417
+ async function wt(t, r, s) {
408
418
  let o;
409
419
  try {
410
- o = mt.parse(t);
411
- } catch (m) {
420
+ o = gt.parse(t);
421
+ } catch (h) {
412
422
  return {
413
- error: F(m)
423
+ error: F(h)
414
424
  };
415
425
  }
416
426
  const { id: e, waitTime: n, autoKill: i, outputLimit: a } = o, c = Y.get(e);
@@ -422,7 +432,7 @@ async function gt(t, r, s) {
422
432
  let u = !1, f = !1;
423
433
  n != null && await new Promise((g) => {
424
434
  const y = setInterval(() => {
425
- c.isRunning ? Date.now() - l >= n * 1e3 && (clearInterval(y), u = !0, i && c.pid && (ht(c.pid), f = !0), g()) : (clearInterval(y), g());
435
+ c.isRunning ? Date.now() - l >= n * 1e3 && (clearInterval(y), u = !0, i && c.pid && (mt(c.pid), f = !0), g()) : (clearInterval(y), g());
426
436
  }, 100);
427
437
  });
428
438
  const d = (Date.now() - l) / 1e3;
@@ -433,16 +443,16 @@ async function gt(t, r, s) {
433
443
  autoKillExecuted: f
434
444
  };
435
445
  }
436
- function Pr(t, r) {
446
+ function Lr(t, r) {
437
447
  t(
438
448
  "process-wait",
439
449
  {
440
450
  title: "Wait for Host Machine Process",
441
451
  description: "Wait for a host machine process to complete execution, with optional timeout and auto-kill functionality. Use this for long-running commands like builds, installs, or tests when you need final results",
442
- inputSchema: mt.shape
452
+ inputSchema: gt.shape
443
453
  },
444
454
  async (s, o) => {
445
- const e = await gt(s, r, o);
455
+ const e = await wt(s, r, o);
446
456
  if (!("output" in e))
447
457
  return `Method: process-wait(${JSON.stringify(s)})
448
458
  ❌ Error: ${e.error}`;
@@ -468,31 +478,31 @@ function be(t, r) {
468
478
  error: `Path "${r}" escapes root directory "${t}". Resolved path: "${o}"`
469
479
  } : { path: o };
470
480
  }
471
- const wt = h.object({
472
- relativeRootDir: h.string().optional().describe(
481
+ const yt = m.object({
482
+ relativeRootDir: m.string().optional().describe(
473
483
  'Relative path from project root to working directory for command execution. Use forward slashes. Leave empty for project root. Examples: "src", "src/tools", "tests/unit". Directory must exist'
474
484
  ),
475
- commandLine: h.string().describe(
485
+ commandLine: m.string().describe(
476
486
  'Complete command line to execute on the host machine. Include all arguments and options. Examples: "npm install", "pnpm build", "node script.js --verbose", "git status". Command must be in the allowed commands list for security'
477
487
  ),
478
- waitTime: h.number().optional().describe(
488
+ waitTime: m.number().optional().describe(
479
489
  "Time to wait in seconds for process completion before returning results. If specified, will wait this long then return final status. If omitted, returns immediately with initial status. Use process-wait or process-status to check progress later. Examples: 30 (wait 30 seconds), 120 (wait 2 minutes)"
480
490
  ),
481
- autoKill: h.boolean().default(!1).describe(
491
+ autoKill: m.boolean().default(!1).describe(
482
492
  "Automatically kill the process if waitTime expires and it is still running. Only applies when waitTime is specified. Default: false (let process continue running). Set to true for commands that should not run indefinitely"
483
493
  ),
484
- outputLimit: h.number().int().min(0).max(J).default(Q).describe(
494
+ outputLimit: m.number().int().min(0).max(J).default(Q).describe(
485
495
  `Maximum output characters to return. Truncated output can be retrieved via output-read tool using outputId from truncation message. Maximum: ${J}. Default: ${Q}`
486
496
  )
487
497
  });
488
- async function Br(t, r, s) {
498
+ async function Ar(t, r, s) {
489
499
  ge();
490
500
  let o;
491
501
  try {
492
- o = wt.parse(t);
493
- } catch (m) {
502
+ o = yt.parse(t);
503
+ } catch (h) {
494
504
  return {
495
- error: F(m)
505
+ error: F(h)
496
506
  };
497
507
  }
498
508
  const { commandLine: e, waitTime: n, autoKill: i, outputLimit: a } = o, { commandLineRules: c } = r, l = be(
@@ -502,25 +512,25 @@ async function Br(t, r, s) {
502
512
  if ("error" in l)
503
513
  return { error: l.error };
504
514
  const u = l.path;
505
- if (!xr({ commandLine: e, commandLineRules: c })) {
506
- const m = c.map(
515
+ if (!$r({ commandLine: e, commandLineRules: c })) {
516
+ const h = c.map(
507
517
  (g) => `${g.rule.toUpperCase()}: /${g.regexp}/ (${g.note})`
508
518
  ).join(`
509
519
  `);
510
520
  return {
511
521
  error: `Command line not allowed: "${e}". For security, command lines are validated against configured rules in order. Command line was denied by the rule evaluation. Current command line rules:
512
- ${m}
522
+ ${h}
513
523
 
514
524
  To use this command line, ask the user to modify the command line rules in the configuration.`
515
525
  };
516
526
  }
517
527
  if (Array.from(Y.values()).filter(
518
- (m) => m.isRunning
528
+ (h) => h.isRunning
519
529
  ).length >= ke)
520
530
  return {
521
531
  error: `Maximum concurrent process limit reached (${ke} processes). Cannot start new process until existing processes complete. Use process-list to see active processes, or process-kill to terminate unnecessary processes.`
522
532
  };
523
- const d = $r(), p = {
533
+ const d = Ir(), p = {
524
534
  id: d,
525
535
  cwd: u,
526
536
  commandLine: e,
@@ -530,15 +540,15 @@ To use this command line, ask the user to modify the command line rules in the c
530
540
  };
531
541
  Y.set(d, p);
532
542
  try {
533
- const m = Tr(
543
+ const h = Cr(
534
544
  process.cwd(),
535
545
  u,
536
546
  r.envCleanup ?? "deleteServerPaths",
537
547
  r.env
538
- ), g = er(e, [], {
548
+ ), g = tr(e, [], {
539
549
  shell: !0,
540
550
  cwd: u,
541
- env: m,
551
+ env: h,
542
552
  stdio: ["pipe", "pipe", "pipe"]
543
553
  });
544
554
  p.pid = g.pid;
@@ -550,16 +560,16 @@ To use this command line, ask the user to modify the command line rules in the c
550
560
  p.isRunning = !1, p.endTime = /* @__PURE__ */ new Date(), p.exitCode = w !== null ? w : void 0, console.log(`Process ${d} (${e}) exited with code ${w}`);
551
561
  }), g.on("error", (w) => {
552
562
  p.isRunning = !1, p.endTime = /* @__PURE__ */ new Date(), p.error = w.message, console.error(`Process ${d} error:`, w.message);
553
- }), n != null ? gt(
563
+ }), n != null ? wt(
554
564
  { id: d, waitTime: n, autoKill: i, outputLimit: a },
555
565
  r,
556
566
  s
557
567
  ) : ye({ id: d, outputLimit: a }, r, s);
558
- } catch (m) {
559
- return p.isRunning = !1, p.endTime = /* @__PURE__ */ new Date(), p.error = m instanceof Error ? m.message : "Unknown error", { error: p.error };
568
+ } catch (h) {
569
+ return p.isRunning = !1, p.endTime = /* @__PURE__ */ new Date(), p.error = h instanceof Error ? h.message : "Unknown error", { error: p.error };
560
570
  }
561
571
  }
562
- function Lr(t, r) {
572
+ function zr(t, r) {
563
573
  const s = r.commandLineRules.map((o) => `${o.rule.toUpperCase()}: ${o.regexp} (${o.note})`).join(`
564
574
  `);
565
575
  t(
@@ -568,10 +578,10 @@ function Lr(t, r) {
568
578
  title: "Execute Command Line on Host Machine",
569
579
  description: `Execute command lines on the host machine. Use this to build, test, lint, install packages, or run system commands. Prefer process-run with waitTime parameter if you need to immediately execute and wait for completion, instead of separate process-run and process-wait calls. Security: Command lines are validated against configured rules processed in order (later rules override earlier ones). Current command line rules:
570
580
  ${s}`,
571
- inputSchema: wt.shape
581
+ inputSchema: yt.shape
572
582
  },
573
583
  async (o, e) => {
574
- const n = await Br(o, r, e);
584
+ const n = await Ar(o, r, e);
575
585
  if (!("output" in n))
576
586
  return `Method: process-run(${JSON.stringify(o)})
577
587
  ❌ Error: ${n.error}`;
@@ -584,25 +594,25 @@ ${i.trim()}`;
584
594
  }
585
595
  );
586
596
  }
587
- const yt = h.object({
588
- minOpenDateTime: h.string().optional().describe(
597
+ const bt = m.object({
598
+ minOpenDateTime: m.string().optional().describe(
589
599
  'Filter to processes started after this datetime. Accepts ISO format or space-separated format. Examples: "2024-01-15T10:30:00Z", "2024-01-15 10:30:00". Underscores and spaces are converted to standard ISO format internally'
590
600
  ),
591
- minCloseDateTime: h.string().optional().describe(
601
+ minCloseDateTime: m.string().optional().describe(
592
602
  'Filter to processes that finished after this datetime. Only applies to completed processes. Accepts ISO format or space-separated format. Examples: "2024-01-15T14:30:00Z", "2024-01-15 14:30:00". Useful for finding recently completed processes'
593
603
  ),
594
- activeOnly: h.boolean().default(!1).describe(
604
+ activeOnly: m.boolean().default(!1).describe(
595
605
  "Show only currently running processes. Set to true to exclude completed processes, false to show all processes (running and completed). Default: false (show all)"
596
606
  ),
597
- fields: h.array(h.string()).optional().describe(
607
+ fields: m.array(m.string()).optional().describe(
598
608
  'Specific process data fields to include in the response. If omitted, returns all available fields. Fields id, isRunning, and commandLine are always included. Available fields: id, cwd, commandLine, pid, startTime, endTime, exitCode, isRunning, output, error. Examples: ["id", "commandLine", "isRunning"] for minimal info, ["id", "output", "exitCode"] for execution results'
599
609
  )
600
610
  });
601
- async function Ar(t, r) {
611
+ async function Ur(t, r) {
602
612
  ge();
603
613
  let s;
604
614
  try {
605
- s = yt.parse(t);
615
+ s = bt.parse(t);
606
616
  } catch (l) {
607
617
  return {
608
618
  error: F(l)
@@ -641,16 +651,16 @@ async function Ar(t, r) {
641
651
  return u;
642
652
  }) };
643
653
  }
644
- function zr(t, r) {
654
+ function jr(t, r) {
645
655
  t(
646
656
  "process-list",
647
657
  {
648
658
  title: "List Host Machine Processes",
649
659
  description: "List all processes that have been executed on the host machine. Use this to see running processes, check command history, or find process IDs for status/wait operations",
650
- inputSchema: yt.shape
660
+ inputSchema: bt.shape
651
661
  },
652
662
  async (s) => {
653
- const o = await Ar(s, r);
663
+ const o = await Ur(s, r);
654
664
  if (o.error != null)
655
665
  return `Method: process-list(${JSON.stringify(s)})
656
666
  ❌ Error: ${o.error}`;
@@ -664,15 +674,15 @@ ${e}`;
664
674
  }
665
675
  );
666
676
  }
667
- const bt = h.object({
668
- id: h.number().describe(
677
+ const St = m.object({
678
+ id: m.number().describe(
669
679
  "Process ID of the process to terminate. Get process IDs using process-list. The process must be currently running. Examples: 1, 42, 123"
670
680
  )
671
681
  });
672
- function Ur(t) {
682
+ function qr(t) {
673
683
  let r;
674
684
  try {
675
- r = bt.parse(t);
685
+ r = St.parse(t);
676
686
  } catch (e) {
677
687
  return {
678
688
  error: F(e)
@@ -692,31 +702,31 @@ function Ur(t) {
692
702
  error: `Process ${s} has no system process ID (PID). This indicates the process failed to start properly or the system was unable to assign a PID. Check process-status for error details.`
693
703
  };
694
704
  try {
695
- return ht(o.pid), { success: !0, message: `Kill signal sent to process ${s}` };
705
+ return mt(o.pid), { success: !0, message: `Kill signal sent to process ${s}` };
696
706
  } catch (e) {
697
707
  return {
698
708
  error: `Failed to terminate process ${s}: ${e instanceof Error ? e.message : "Unknown error"}. The process may have already exited, be protected by the system, or there may be insufficient permissions. Use process-status to check current process state.`
699
709
  };
700
710
  }
701
711
  }
702
- function jr(t, r) {
712
+ function _r(t, r) {
703
713
  t(
704
714
  "process-kill",
705
715
  {
706
716
  title: "Kill Host Machine Process",
707
717
  description: "Forcibly terminate a running process on the host machine. Use this to stop runaway processes, hung commands, or long-running tasks that need to be cancelled",
708
- inputSchema: bt.shape
718
+ inputSchema: St.shape
709
719
  },
710
720
  async (s) => {
711
- const o = Ur(s);
721
+ const o = qr(s);
712
722
  return o.error != null ? `Method: process-kill(${JSON.stringify(s)})
713
723
  ❌ Error: ${o.error}` : `Method: process-kill(${JSON.stringify(s)})
714
724
  ${JSON.stringify(o, null, 2)}`;
715
725
  }
716
726
  );
717
727
  }
718
- function qr(t, r) {
719
- Ir(), r.run && Lr(t, r), r.status && Fr(t, r), r.wait && Pr(t, r), r.list && zr(t, r), r.kill && jr(t);
728
+ function Gr(t, r) {
729
+ Mr(), r.run && zr(t, r), r.status && Br(t, r), r.wait && Lr(t, r), r.list && jr(t, r), r.kill && _r(t);
720
730
  const s = r.commandLineRules?.map(
721
731
  (o) => `${o.rule.toUpperCase()}: ${o.regexp} (${o.note})`
722
732
  ) || [];
@@ -729,7 +739,7 @@ ${s.map((o) => `- ${o}`).join(`
729
739
  `
730
740
  );
731
741
  }
732
- function _r(t, r) {
742
+ function Jr(t, r) {
733
743
  return function(o, e, n) {
734
744
  const i = async (...a) => {
735
745
  await ie({
@@ -758,26 +768,26 @@ function _r(t, r) {
758
768
  );
759
769
  };
760
770
  }
761
- function Gr(t) {
771
+ function Wr(t) {
762
772
  return t.match(/^[/\\]?[^/\\]+/)[0];
763
773
  }
764
- function Jr(t, r) {
765
- return Gr(t) + "|" + r.ino;
774
+ function Kr(t, r) {
775
+ return Wr(t) + "|" + r.ino;
766
776
  }
767
- function Wr(t) {
777
+ function Hr(t) {
768
778
  return t.endsWith(":") && (t += "/"), k.resolve(t);
769
779
  }
770
- const Se = new tr(nr.cpus().length);
780
+ const Se = new rr(ir.cpus().length);
771
781
  function Be(t, r) {
772
782
  t.totalSize += r.totalSize, t.maxFileDateModified = Math.max(
773
783
  t.maxFileDateModified,
774
784
  r.maxFileDateModified
775
785
  ), t.countFiles += r.countFiles, t.countDirs += r.countDirs, t.countLinks += r.countLinks;
776
786
  }
777
- const Kr = function(r) {
787
+ const Qr = function(r) {
778
788
  return r.code === "ENOENT";
779
789
  };
780
- function St(t) {
790
+ function xt(t) {
781
791
  const r = t.paths;
782
792
  if (!r || r.length === 0)
783
793
  return Promise.resolve({
@@ -788,15 +798,15 @@ function St(t) {
788
798
  countLinks: 0
789
799
  });
790
800
  const s = t.level ?? 0, o = t.walkedIds ?? /* @__PURE__ */ new Set(), e = t.abortSignal, n = t.pool ?? Se, i = t.handleError, a = t.priority ?? X(0), c = t.walkLinks ?? !1, l = t.log, u = t.handlePath, f = t.matchPath;
791
- async function d(m) {
792
- if (!(i && await i(m)) && !Kr(m))
793
- throw m;
801
+ async function d(h) {
802
+ if (!(i && await i(h)) && !Qr(h))
803
+ throw h;
794
804
  }
795
- function p(m) {
796
- return !(!l || l.minTotalContentSize != null && m < l.minTotalContentSize || l.maxNestedLevel != null && s > l.maxNestedLevel);
805
+ function p(h) {
806
+ return !(!l || l.minTotalContentSize != null && h < l.minTotalContentSize || l.maxNestedLevel != null && s > l.maxNestedLevel);
797
807
  }
798
- return rr(async (m) => {
799
- const g = sr(e, m), y = {
808
+ return sr(async (h) => {
809
+ const g = or(e, h), y = {
800
810
  totalSize: 0,
801
811
  maxFileDateModified: 0,
802
812
  countFiles: 0,
@@ -842,7 +852,7 @@ function St(t) {
842
852
  });
843
853
  if (!v || !x && v.isFile())
844
854
  return null;
845
- const P = Jr($, v);
855
+ const P = Kr($, v);
846
856
  if (o.has(P))
847
857
  return null;
848
858
  o.add(P);
@@ -893,7 +903,7 @@ function St(t) {
893
903
  if (C) {
894
904
  for (let N = 0, R = C.length; N < R; N++)
895
905
  C[N] = k.join(S, C[N]);
896
- O = await St({
906
+ O = await xt({
897
907
  ...t,
898
908
  paths: C,
899
909
  abortSignal: g,
@@ -912,16 +922,16 @@ function St(t) {
912
922
  }
913
923
  const b = [];
914
924
  for (let $ = 0, T = r.length; $ < T; $++) {
915
- const x = Wr(r[$]), S = f ? f(x) : !0;
925
+ const x = Hr(r[$]), S = f ? f(x) : !0;
916
926
  S !== !1 && b.push(E(x, $, S));
917
927
  }
918
928
  return await Promise.all(b), y;
919
929
  });
920
930
  }
921
- function xt(t) {
922
- return St(t);
931
+ function $t(t) {
932
+ return xt(t);
923
933
  }
924
- function Hr(t, r) {
934
+ function Yr(t, r) {
925
935
  if (!r || r === ".")
926
936
  return t;
927
937
  const s = t.startsWith("^");
@@ -929,21 +939,21 @@ function Hr(t, r) {
929
939
  const o = t.startsWith("!");
930
940
  return o && (t = t.substring(1)), t.startsWith("/") ? (r.endsWith("/") && (r = r.substring(0, r.length - 1)), t = r + t) : (r.endsWith("/") || (r += "/"), t.startsWith("./") ? t = r + t.substring(2) : t.startsWith("../") ? t = r + t : (r.startsWith("..") && (r = ""), t.startsWith("**") ? t = r + t : t = r + "**/" + t)), t = H(k.normalize(t)), o && (t = "!" + t), s && (t = "^" + t), t;
931
941
  }
932
- function Qr(t) {
942
+ function Vr(t) {
933
943
  const r = t.startsWith("!");
934
944
  return r && (t = t.substring(1)), t.startsWith("/") ? t = t.substring(1) : !t.startsWith("**") && !t.startsWith("../") && (t = `**/${t}`), r && (t = "!" + t), t;
935
945
  }
936
946
  function Le(t) {
937
947
  return "^" + t;
938
948
  }
939
- async function Yr(t) {
949
+ async function Zr(t) {
940
950
  const s = (await j.promises.readFile(t, "utf-8")).split(`
941
951
  `), o = [];
942
952
  return s.forEach((e) => {
943
953
  e = e.trim(), !(!e || e.startsWith("#")) && o.push(e);
944
954
  }), o;
945
955
  }
946
- async function $t(t) {
956
+ async function It(t) {
947
957
  const r = t.rootDir ?? ".", s = [];
948
958
  if (!t.globs?.length)
949
959
  return s;
@@ -956,16 +966,16 @@ async function $t(t) {
956
966
  pool: Se,
957
967
  count: 1,
958
968
  func: async () => {
959
- const n = k.resolve(r, e.value), i = await Yr(n), a = k.relative(r, k.dirname(n));
969
+ const n = k.resolve(r, e.value), i = await Zr(n), a = k.relative(r, k.dirname(n));
960
970
  i.forEach((c) => {
961
- c = Qr(c), c = Hr(c, a), s.push(e.exclude ? Le(c) : c);
971
+ c = Vr(c), c = Yr(c, a), s.push(e.exclude ? Le(c) : c);
962
972
  });
963
973
  }
964
974
  });
965
975
  })
966
976
  ), s;
967
977
  }
968
- function It({
978
+ function Mt({
969
979
  globs: t,
970
980
  rootDir: r,
971
981
  noCase: s
@@ -986,7 +996,7 @@ function It({
986
996
  return;
987
997
  let c;
988
998
  try {
989
- c = ir(a, {
999
+ c = ar(a, {
990
1000
  nocase: s ?? !1,
991
1001
  dot: !0,
992
1002
  strictBrackets: !0
@@ -1013,17 +1023,17 @@ function It({
1013
1023
  return a ? !1 : i;
1014
1024
  };
1015
1025
  }
1016
- async function Vr(t) {
1026
+ async function Xr(t) {
1017
1027
  const r = t.rootDir ?? ".", s = [], o = {};
1018
1028
  t.result.countFiles && (o.countFiles = 0), t.result.size && (o.size = 0);
1019
- const e = await $t({
1029
+ const e = await It({
1020
1030
  rootDir: r,
1021
1031
  globs: t.globs
1022
1032
  });
1023
- return await xt({
1033
+ return await $t({
1024
1034
  paths: [r],
1025
1035
  walkLinks: !0,
1026
- matchPath: It({
1036
+ matchPath: Mt({
1027
1037
  globs: e,
1028
1038
  rootDir: r,
1029
1039
  noCase: !0
@@ -1032,21 +1042,21 @@ async function Vr(t) {
1032
1042
  const c = k.relative(r, n), l = i.isDirectory(), u = i.isFile();
1033
1043
  if (!l && !u)
1034
1044
  return !0;
1035
- const f = H(c || "."), d = l ? "dir" : "file", p = l ? a.maxFileDateModified || null : i.mtimeMs, m = l ? a.totalSize : i.size, g = l ? a.countFiles : null, y = {
1045
+ const f = H(c || "."), d = l ? "dir" : "file", p = l ? a.maxFileDateModified || null : i.mtimeMs, h = l ? a.totalSize : i.size, g = l ? a.countFiles : null, y = {
1036
1046
  path: f,
1037
1047
  type: d
1038
1048
  };
1039
- if (t.result.dateModified && (y.dateModified = p), t.result.size && (y.size = m), t.result.countFiles && (y.countFiles = g), t.dateModified && p != null) {
1049
+ if (t.result.dateModified && (y.dateModified = p), t.result.size && (y.size = h), t.result.countFiles && (y.countFiles = g), t.dateModified && p != null) {
1040
1050
  const [w, M] = t.dateModified;
1041
1051
  if (w != null && p < w || M != null && p > M)
1042
1052
  return !1;
1043
1053
  }
1044
- if (t.totalSize && m != null) {
1054
+ if (t.totalSize && h != null) {
1045
1055
  const [w, M] = t.totalSize;
1046
- if (w != null && m < w || M != null && m > M)
1056
+ if (w != null && h < w || M != null && h > M)
1047
1057
  return !1;
1048
1058
  }
1049
- return d === "file" && (o.countFiles = (o.countFiles ?? 0) + 1), d === "file" && m != null && (o.size = (o.size ?? 0) + m), p != null && (o.dateModified == null || p > o.dateModified) && (o.dateModified = p), l && !t.result.dirs || u && !t.result.files || s.push(y), !0;
1059
+ return d === "file" && (o.countFiles = (o.countFiles ?? 0) + 1), d === "file" && h != null && (o.size = (o.size ?? 0) + h), p != null && (o.dateModified == null || p > o.dateModified) && (o.dateModified = p), l && !t.result.dirs || u && !t.result.files || s.push(y), !0;
1050
1060
  }
1051
1061
  }), { items: s, totals: o };
1052
1062
  }
@@ -1064,7 +1074,7 @@ function je(t) {
1064
1074
  const o = Math.floor(s / 1e3), e = Math.floor(o / 60), n = Math.floor(e / 60), i = Math.floor(n / 24), a = Math.floor(i / 7), c = Math.floor(i / 30), l = Math.floor(i / 365);
1065
1075
  return l > 0 ? `${l}Y` : c > 0 ? `${c}M` : a > 0 ? `${a}w` : i > 0 ? `${i}d` : n > 0 ? `${n}h` : e > 0 ? `${e}m` : `${o}s`;
1066
1076
  }
1067
- function Zr(t, r) {
1077
+ function es(t, r) {
1068
1078
  return r?.length ? [...t].sort((s, o) => {
1069
1079
  for (let e = 0, n = r.length; e < n; e++) {
1070
1080
  const i = r[e];
@@ -1100,8 +1110,8 @@ function Zr(t, r) {
1100
1110
  return 0;
1101
1111
  }) : t;
1102
1112
  }
1103
- function Xr(t, r) {
1104
- const s = Zr(t.items, r.sort ?? []), o = r.fields && r.fields.length > 0 ? r.fields : [];
1113
+ function ts(t, r) {
1114
+ const s = es(t.items, r.sort ?? []), o = r.fields && r.fields.length > 0 ? r.fields : [];
1105
1115
  let e = "";
1106
1116
  if (s.length > 0 && o.length > 0) {
1107
1117
  for (let n = 0, i = o.length; n < i; n++) {
@@ -1159,9 +1169,9 @@ function Xr(t, r) {
1159
1169
  }
1160
1170
  return e;
1161
1171
  }
1162
- const es = "4.0.4", ts = {
1163
- version: es
1164
- }, Go = "Project Tools", Jo = "project-tools", Wo = ts.version, Ko = "d00f70240703039df14c76176a055bce6b5484d2b552ba2c89820f03b8e5e60d", qe = 25e3;
1172
+ const rs = "5.0.0", ss = {
1173
+ version: rs
1174
+ }, Wo = "Project Tools", Ko = "project-tools", Ho = ss.version, Qo = "d00f70240703039df14c76176a055bce6b5484d2b552ba2c89820f03b8e5e60d", qe = 25e3;
1165
1175
  function _e(t) {
1166
1176
  const r = t.match(
1167
1177
  /^\s*(\d+(?:\.\d+)?)\s*([smhdwMY]|sec(onds?)?|min(utes?)?|hours?|days?|weeks?|months?|years?)\s*$/i
@@ -1217,49 +1227,49 @@ function Ge(t) {
1217
1227
  );
1218
1228
  }
1219
1229
  }
1220
- const Mt = h.object({
1221
- relativeRootDir: h.string().optional().describe(
1230
+ const Tt = m.object({
1231
+ relativeRootDir: m.string().optional().describe(
1222
1232
  'Relative path from project root to directory for listing. Use forward slashes. Leave empty for project root. Examples: "src", "src/components", "tests". Path must exist'
1223
1233
  ),
1224
- globs: h.array(h.string()).optional().describe(
1234
+ globs: m.array(m.string()).optional().describe(
1225
1235
  'Glob patterns to filter which files/directories to include. Add leading ** to match files and dirs in subdirectories. Examples: ["**/*.js"] (JavaScript files), ["src/**/*.ts"] (TypeScript files in src), ["**/dir/"] (all directories named "dir"), ["!node_modules"] (exclude {rootDir}/node_modules). If omitted, includes all files matching other criteria. Supports standard glob syntax: * (any chars), ** (any dirs), ? (single char), [abc] (char class)'
1226
1236
  ),
1227
- showFiles: h.boolean().optional().describe(
1237
+ showFiles: m.boolean().optional().describe(
1228
1238
  "Whether to show regular files in the report table. Set to true to show files, false to hide them from the table. When both showFiles and showDirs are false, nothing will be shown in the table. It Does not affect totals. Default is false (do not show files in the table)"
1229
1239
  ),
1230
- showDirs: h.boolean().optional().describe(
1240
+ showDirs: m.boolean().optional().describe(
1231
1241
  "Whether to show directories in the report table. Set to true to show directories, false to hide them from the table. When both showFiles and showDirs are false, nothing will be shown in the table. It Does not affect totals. Default is true (show directories in the table)"
1232
1242
  ),
1233
- sortBy: h.array(
1234
- h.object({
1235
- field: h.enum(["type", "path", "lastModified", "size", "totalCountFiles"]).describe(
1243
+ sortBy: m.array(
1244
+ m.object({
1245
+ field: m.enum(["type", "path", "lastModified", "size", "totalCountFiles"]).describe(
1236
1246
  'Field to sort results by. "type" sorts files before directories. "path" sorts alphabetically by file/directory name. "lastModified" sorts by modification time (newest first when desc=true). "size" sorts by file/directory size (largest first when desc=true). "totalCountFiles" sorts by total files count (highest first when desc=true, directories only)'
1237
1247
  ),
1238
- desc: h.boolean().optional().describe("Sort in descending order (largest/newest first)")
1248
+ desc: m.boolean().optional().describe("Sort in descending order (largest/newest first)")
1239
1249
  })
1240
1250
  ).optional().describe(
1241
1251
  'Multi-level sorting configuration. Sorts are applied in array order - first sort is primary, second is secondary, etc. Example: [{field: "type", desc: false}, {field: "size", desc: true}] sorts by type ascending, then by size descending within each type'
1242
1252
  ),
1243
- fields: h.array(h.enum(["type", "path", "lastModified", "size", "totalCountFiles"])).optional().describe(
1253
+ fields: m.array(m.enum(["type", "path", "lastModified", "size", "totalCountFiles"])).optional().describe(
1244
1254
  'Which data fields to include in the formatted table output. "type" shows file/directory indicator. "path" shows relative file/directory path. "lastModified" shows last modification time as time-ago format (5m, 2h, 3d, etc). "size" shows file/directory size in human-readable format (KB, MB, GB). "totalCountFiles" shows total files count for directories (displays "-" for files). Adding lastModified, size, or totalCountFiles fields increases processing time. Do not set fields if you want to show only totals summary'
1245
1255
  ),
1246
- minTimeAgo: h.string().optional().describe(
1256
+ minTimeAgo: m.string().optional().describe(
1247
1257
  'Filter files/directories modified at least this long ago. Only items older than this duration will be included. Format: number + unit (s/m/h/d/w/M/Y). Examples: "1h" (modified more than 1 hour ago), "7d" (modified more than 7 days ago), "6M" (modified more than 6 months ago)'
1248
1258
  ),
1249
- maxTimeAgo: h.string().optional().describe(
1259
+ maxTimeAgo: m.string().optional().describe(
1250
1260
  'Filter files/directories modified at most this long ago. Only items newer than this duration will be included. Format: number + unit (s/m/h/d/w/M/Y). Examples: "1h" (modified within last hour), "7d" (modified within last 7 days), "1M" (modified within last month). Combine with minTimeAgo for date ranges'
1251
1261
  ),
1252
- minTotalSize: h.string().optional().describe(
1262
+ minTotalSize: m.string().optional().describe(
1253
1263
  'Filter files/directories with total size at least this large. Only items with size >= this value will be included. For directories, uses total size of all contents. Format: number + unit (B/KB/MB/GB/TB). Examples: "1KB" (at least 1 kilobyte), "100MB" (at least 100 megabytes), "1.5GB" (at least 1.5 gigabytes)'
1254
1264
  ),
1255
- maxTotalSize: h.string().optional().describe(
1265
+ maxTotalSize: m.string().optional().describe(
1256
1266
  'Filter files/directories with total size at most this large. Only items with size <= this value will be included. For directories, uses total size of all contents. Format: number + unit (B/KB/MB/GB/TB). Examples: "1MB" (up to 1 megabyte), "500KB" (up to 500 kilobytes), "10GB" (up to 10 gigabytes). Combine with minTotalSize for size ranges'
1257
1267
  )
1258
1268
  });
1259
- async function rs(t, r) {
1269
+ async function os(t, r) {
1260
1270
  let s;
1261
1271
  try {
1262
- s = Mt.parse(t);
1272
+ s = Tt.parse(t);
1263
1273
  } catch (y) {
1264
1274
  return {
1265
1275
  error: F(y)
@@ -1289,13 +1299,13 @@ async function rs(t, r) {
1289
1299
  };
1290
1300
  }) ?? null;
1291
1301
  (!d || d.length === 0) && (d = [{ field: "path", desc: !1 }]);
1292
- const p = d?.map((y) => y.field) || [], m = be(
1302
+ const p = d?.map((y) => y.field) || [], h = be(
1293
1303
  r.workingDir,
1294
1304
  s.relativeRootDir
1295
1305
  );
1296
- if ("error" in m)
1297
- return { error: m.error };
1298
- const g = m.path;
1306
+ if ("error" in h)
1307
+ return { error: h.error };
1308
+ const g = h.path;
1299
1309
  try {
1300
1310
  try {
1301
1311
  await j.promises.access(g, j.constants.F_OK);
@@ -1336,7 +1346,7 @@ async function rs(t, r) {
1336
1346
  error: S instanceof Error ? S.message : "Unknown error parsing size filter"
1337
1347
  };
1338
1348
  }
1339
- const T = await Vr({
1349
+ const T = await Xr({
1340
1350
  rootDir: g || null,
1341
1351
  globs: M,
1342
1352
  result: E,
@@ -1346,7 +1356,7 @@ async function rs(t, r) {
1346
1356
  return T.items.length > qe ? {
1347
1357
  error: `Number of paths (${T.items.length}) exceeds maximum allowed (${qe}). Consider using more specific glob patterns or filters to reduce the result set.`
1348
1358
  } : {
1349
- output: Xr(T, {
1359
+ output: ts(T, {
1350
1360
  sort: d,
1351
1361
  fields: f,
1352
1362
  totals: !0
@@ -1356,16 +1366,16 @@ async function rs(t, r) {
1356
1366
  return { error: y instanceof Error ? y.message : "Unknown error" };
1357
1367
  }
1358
1368
  }
1359
- function ss(t, r) {
1369
+ function ns(t, r) {
1360
1370
  t(
1361
1371
  "fs-list",
1362
1372
  {
1363
1373
  title: "List Files and Directories",
1364
1374
  description: "List files and directories with advanced filtering, sorting and formatting options. Use this to analyze filesystem structure",
1365
- inputSchema: Mt.shape
1375
+ inputSchema: Tt.shape
1366
1376
  },
1367
1377
  async (s) => {
1368
- const o = await rs(s, r);
1378
+ const o = await os(s, r);
1369
1379
  return o.error ? `Method: fs-list(${JSON.stringify(s)})
1370
1380
  ❌ Error: ${o.error}` : `Method: fs-list(${JSON.stringify(s)})
1371
1381
  ${o.output || JSON.stringify(o, null, 2)}`;
@@ -1373,9 +1383,9 @@ ${o.output || JSON.stringify(o, null, 2)}`;
1373
1383
  );
1374
1384
  }
1375
1385
  const ue = /* @__PURE__ */ new Map();
1376
- let os = 0;
1377
- function ns() {
1378
- return `${++os}-${Math.random().toString(36).slice(2)}`;
1386
+ let is = 0;
1387
+ function as() {
1388
+ return `${++is}-${Math.random().toString(36).slice(2)}`;
1379
1389
  }
1380
1390
  function Z(t) {
1381
1391
  return ue.has(t) || ue.set(t, {
@@ -1439,32 +1449,32 @@ function We(t) {
1439
1449
  );
1440
1450
  }
1441
1451
  }
1442
- const xe = h.object({
1443
- name: h.string().describe(
1452
+ const xe = m.object({
1453
+ name: m.string().describe(
1444
1454
  "Unique name for the filesystem snapshot query. Recommended format: kebab-case-1, kebab-case-2, ..."
1445
1455
  ),
1446
- relativeRootDir: h.string().optional().describe(
1456
+ relativeRootDir: m.string().optional().describe(
1447
1457
  'Relative path from project root to directory for snapshot. Use forward slashes. Leave empty for project root. Examples: "src", "src/components", "tests". Path must exist'
1448
1458
  ),
1449
- bulkGlobs: h.array(h.string()).optional().describe(
1459
+ bulkGlobs: m.array(m.string()).optional().describe(
1450
1460
  'Glob patterns to filter files/directories. Include all patterns in this single array; never split across multiple tool calls. Add leading ** for recursive matching. Examples: ["**/*.js"], ["src/**/*.ts"], ["**/*.{ts,svelte}"], ["!node_modules"]. If omitted, includes all files matching other criteria. Supports: * (any chars), ** (any dirs), ? (single char), [abc] (char class)'
1451
1461
  ),
1452
- types: h.array(h.enum(["file", "dir"])).optional().describe(
1462
+ types: m.array(m.enum(["file", "dir"])).optional().describe(
1453
1463
  "Types of items to include in the snapshot. If omitted, includes both files and directories"
1454
1464
  ),
1455
- extraFields: h.array(h.enum(["lastModified", "size", "countMatched"])).optional().describe(
1465
+ extraFields: m.array(m.enum(["lastModified", "size", "countMatched"])).optional().describe(
1456
1466
  'Which extra data fields to include in the snapshot tree output. "lastModified" shows last modification time as time-ago format (5m, 2h, 3d, etc). "size" shows file/directory size in human-readable format (KB, MB, GB). "countMatched" shows total matched items count'
1457
1467
  ),
1458
- minTimeAgo: h.string().optional().describe(
1468
+ minTimeAgo: m.string().optional().describe(
1459
1469
  'Filter files/directories modified at least this long ago. Only items older than this duration will be included. Format: number + unit (s/m/h/d/w/M/Y). Examples: "1h" (modified more than 1 hour ago), "7d" (modified more than 7 days ago), "6M" (modified more than 6 months ago)'
1460
1470
  ),
1461
- maxTimeAgo: h.string().optional().describe(
1471
+ maxTimeAgo: m.string().optional().describe(
1462
1472
  'Filter files/directories modified at most this long ago. Only items newer than this duration will be included. Format: number + unit (s/m/h/d/w/M/Y). Examples: "1h" (modified within last hour), "7d" (modified within last 7 days), "1M" (modified within last month). Combine with minTimeAgo for date ranges'
1463
1473
  ),
1464
- minTotalSize: h.string().optional().describe(
1474
+ minTotalSize: m.string().optional().describe(
1465
1475
  'Filter files/directories with total size at least this large. Only items with size >= this value will be included. For directories, uses total size of all contents. Format: number + unit (B/KB/MB/GB/TB). Examples: "1KB" (at least 1 kilobyte), "100MB" (at least 100 megabytes), "1.5GB" (at least 1.5 gigabytes)'
1466
1476
  ),
1467
- maxTotalSize: h.string().optional().describe(
1477
+ maxTotalSize: m.string().optional().describe(
1468
1478
  'Filter files/directories with total size at most this large. Only items with size <= this value will be included. For directories, uses total size of all contents. Format: number + unit (B/KB/MB/GB/TB). Examples: "1MB" (up to 1 megabyte), "500KB" (up to 500 kilobytes), "10GB" (up to 10 gigabytes). Combine with minTotalSize for size ranges'
1469
1479
  )
1470
1480
  }), Ke = new Map(
@@ -1476,17 +1486,17 @@ const xe = h.object({
1476
1486
  "dateModified"
1477
1487
  ].map((t, r) => [t, r])
1478
1488
  );
1479
- function is(t, r) {
1489
+ function ls(t, r) {
1480
1490
  const s = Ke.get(t) ?? 1 / 0, o = Ke.get(r) ?? 1 / 0;
1481
1491
  return s > o ? 1 : s < o ? -1 : 0;
1482
1492
  }
1483
- async function Tt(t, r, s) {
1493
+ async function Ct(t, r, s) {
1484
1494
  let o;
1485
1495
  try {
1486
1496
  o = xe.parse(t);
1487
- } catch (m) {
1497
+ } catch (h) {
1488
1498
  return {
1489
- error: F(m)
1499
+ error: F(h)
1490
1500
  };
1491
1501
  }
1492
1502
  const {
@@ -1519,8 +1529,8 @@ async function Tt(t, r, s) {
1519
1529
  };
1520
1530
  throw x;
1521
1531
  }
1522
- const m = o.extraFields ? o.extraFields.map((x) => x === "lastModified" ? "dateModified" : x) : [];
1523
- m.includes("name") || m.push("name"), m.sort(is);
1532
+ const h = o.extraFields ? o.extraFields.map((x) => x === "lastModified" ? "dateModified" : x) : [];
1533
+ h.includes("name") || h.push("name"), h.sort(ls);
1524
1534
  const g = n && n.length > 0 ? n.map((x) => ({
1525
1535
  value: x,
1526
1536
  valueType: "pattern",
@@ -1553,18 +1563,18 @@ async function Tt(t, r, s) {
1553
1563
  matchDirs: $,
1554
1564
  dateModified: M,
1555
1565
  totalSize: E,
1556
- fields: m
1566
+ fields: h
1557
1567
  };
1558
1568
  return f.fsSnapshotQueries.set(e, T), {
1559
1569
  snapshotQuery: T
1560
1570
  };
1561
- } catch (m) {
1571
+ } catch (h) {
1562
1572
  return {
1563
- error: m instanceof Error ? m.message : "Unknown error"
1573
+ error: h instanceof Error ? h.message : "Unknown error"
1564
1574
  };
1565
1575
  }
1566
1576
  }
1567
- function as(t, r) {
1577
+ function cs(t, r) {
1568
1578
  t(
1569
1579
  "fs-snapshot-query-create",
1570
1580
  {
@@ -1573,7 +1583,7 @@ function as(t, r) {
1573
1583
  inputSchema: xe.shape
1574
1584
  },
1575
1585
  async (s, o) => {
1576
- const e = await Tt(s, r, o);
1586
+ const e = await Ct(s, r, o);
1577
1587
  return e.error != null ? `Method: fs-snapshot-query-create(${JSON.stringify(s)})
1578
1588
  ❌ Error: ${e.error}` : `Method: fs-snapshot-query-create(${JSON.stringify(s)})
1579
1589
  ✅ Filesystem snapshot query "${e.snapshotQuery.name}" created successfully`;
@@ -1620,16 +1630,16 @@ function le(t) {
1620
1630
  }
1621
1631
  };
1622
1632
  }
1623
- function Ct(t, r, s) {
1633
+ function vt(t, r, s) {
1624
1634
  let o = null;
1625
1635
  for (let e = 0, n = r.length; e < n; e++) {
1626
- const i = r[e], a = t(i), c = a == null ? null : Ct(t, a, s), l = s(i, c);
1636
+ const i = r[e], a = t(i), c = a == null ? null : vt(t, a, s), l = s(i, c);
1627
1637
  l != null && (o == null && (o = []), o.push(l));
1628
1638
  }
1629
1639
  return o;
1630
1640
  }
1631
- function vt(t) {
1632
- const { getId: r, getChilds: s, rootNodes: o, createSnapshotNode: e } = t, n = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), c = Ct(
1641
+ function Et(t) {
1642
+ const { getId: r, getChilds: s, rootNodes: o, createSnapshotNode: e } = t, n = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), c = vt(
1633
1643
  s,
1634
1644
  o,
1635
1645
  (u, f) => {
@@ -1657,7 +1667,7 @@ function vt(t) {
1657
1667
  function me(t) {
1658
1668
  return t = t != null ? H(t).replace(/\/$/, "") : null, !t || t === "." ? null : t;
1659
1669
  }
1660
- async function ls(t) {
1670
+ async function us(t) {
1661
1671
  const r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), o = k.resolve(t.rootDir || "."), n = {
1662
1672
  path: ".",
1663
1673
  name: k.basename(o),
@@ -1667,14 +1677,14 @@ async function ls(t) {
1667
1677
  size: 0
1668
1678
  };
1669
1679
  r.set(null, n);
1670
- const i = await $t({
1680
+ const i = await It({
1671
1681
  rootDir: o,
1672
1682
  globs: t.globs
1673
1683
  });
1674
- return await xt({
1684
+ return await $t({
1675
1685
  paths: [o],
1676
1686
  walkLinks: !0,
1677
- matchPath: It({
1687
+ matchPath: Mt({
1678
1688
  globs: i,
1679
1689
  rootDir: o,
1680
1690
  noCase: !0
@@ -1683,7 +1693,7 @@ async function ls(t) {
1683
1693
  const u = k.relative(o, a), f = c.isDirectory(), d = c.isFile();
1684
1694
  if (!f && !d)
1685
1695
  return !0;
1686
- const p = me(u || "."), m = f ? "dir" : "file", g = f ? null : c.mtimeMs, y = c.size;
1696
+ const p = me(u || "."), h = f ? "dir" : "file", g = f ? null : c.mtimeMs, y = c.size;
1687
1697
  let w = !0;
1688
1698
  if (d && !t.matchFiles && (w = !1), f && !t.matchDirs && (w = !1), w && d && t.dateModified && g != null) {
1689
1699
  const [$, T] = t.dateModified;
@@ -1700,7 +1710,7 @@ async function ls(t) {
1700
1710
  const M = {
1701
1711
  path: p ?? ".",
1702
1712
  name: k.basename(a),
1703
- type: m,
1713
+ type: h,
1704
1714
  dateModified: g,
1705
1715
  size: y,
1706
1716
  isMatched: w
@@ -1717,7 +1727,7 @@ async function ls(t) {
1717
1727
  idToChildIds: s
1718
1728
  };
1719
1729
  }
1720
- const cs = [
1730
+ const ds = [
1721
1731
  { name: "[ ]", match: (t) => t === 32, min: 2, max: 81 },
1722
1732
  { name: "[\\t]", match: (t) => t === 9, min: 2, max: 20 },
1723
1733
  { name: "[\\n]", match: (t) => t === 10, min: 2, max: 14 },
@@ -1740,7 +1750,7 @@ const cs = [
1740
1750
  // max: 2,
1741
1751
  // },
1742
1752
  ];
1743
- function He(t, r = cs) {
1753
+ function He(t, r = ds) {
1744
1754
  const s = t.length;
1745
1755
  if (s === 0) return 0;
1746
1756
  const o = r.length;
@@ -1766,25 +1776,25 @@ function He(t, r = cs) {
1766
1776
  }
1767
1777
  return e;
1768
1778
  }
1769
- function Et(t) {
1779
+ function Nt(t) {
1770
1780
  let r = 0;
1771
1781
  return r += He(t.textOpen) + 1, t.textClose != null && (r += He(t.textClose) + 1), t.indent && (r += 1), r;
1772
1782
  }
1773
1783
  const Qe = ["B", "KB", "MB", "GB", "TB"], Ye = 1024;
1774
- function us(t) {
1784
+ function fs(t) {
1775
1785
  if (t == null) return "-";
1776
1786
  let r = t ?? 0, s = 0;
1777
1787
  for (; r >= Ye && s < Qe.length - 1; )
1778
1788
  r /= Ye, s++;
1779
1789
  return `${s === 0 ? r.toString() : r.toFixed(2)}${Qe[s]}`;
1780
1790
  }
1781
- function ds(t) {
1791
+ function ps(t) {
1782
1792
  const s = Date.now() - t;
1783
1793
  if (s < 0) return "0s";
1784
1794
  const o = Math.floor(s / 1e3), e = Math.floor(o / 60), n = Math.floor(e / 60), i = Math.floor(n / 24), a = Math.floor(i / 7), c = Math.floor(i / 30), l = Math.floor(i / 365);
1785
1795
  return l > 0 ? `${l}Y` : c > 0 ? `${c}M` : a > 0 ? `${a}w` : i > 0 ? `${i}d` : n > 0 ? `${n}h` : e > 0 ? `${e}m` : `${o}s`;
1786
1796
  }
1787
- function fs(t) {
1797
+ function hs(t) {
1788
1798
  return function(s, o) {
1789
1799
  const e = t.get(s), n = t.get(o);
1790
1800
  if (e.type !== n.type)
@@ -1797,26 +1807,26 @@ function fs(t) {
1797
1807
  }
1798
1808
  };
1799
1809
  }
1800
- function ps(t) {
1810
+ function ms(t) {
1801
1811
  const r = t.fields ?? [];
1802
1812
  return function(o, e) {
1803
1813
  let n = "", i, a = 0;
1804
1814
  const c = e ? e.length : 0;
1805
- let l = 1, u, f = 0, d = 0, p = 0, m = 0, g = null, y, w, M;
1815
+ let l = 1, u, f = 0, d = 0, p = 0, h = 0, g = null, y, w, M;
1806
1816
  if (e)
1807
1817
  for (let b = 0; b < e.length; b++) {
1808
1818
  const $ = e[b];
1809
- a += $.countMatched, l += $.countTotal, f += $.tokens, d += $.tokensTotal, p += $.size, m += $.countFiles, $.dateModified != null && (g == null || $.dateModified > g) && (g = $.dateModified);
1819
+ a += $.countMatched, l += $.countTotal, f += $.tokens, d += $.tokensTotal, p += $.size, h += $.countFiles, $.dateModified != null && (g == null || $.dateModified > g) && (g = $.dateModified);
1810
1820
  }
1811
- o ? (y = o.type, w = o.name, M = o.path, i = o.isMatched, i && (a += 1), o.type === "file" ? (p = o.size || 0, m = 1, g = o.dateModified || null) : o.dateModified != null && (g == null || o.dateModified > g) && (g = o.dateModified)) : (y = "dir", w = "<root>", M = ".", i = !0);
1821
+ o ? (y = o.type, w = o.name, M = o.path, i = o.isMatched, i && (a += 1), o.type === "file" ? (p = o.size || 0, h = 1, g = o.dateModified || null) : o.dateModified != null && (g == null || o.dateModified > g) && (g = o.dateModified)) : (y = "dir", w = "<root>", M = ".", i = !0);
1812
1822
  for (let b = 0, $ = r.length; b < $; b++) {
1813
1823
  const T = r[b];
1814
1824
  switch (b > 0 && (n += " "), T) {
1815
1825
  case "dateModified":
1816
- n += g ? ds(g) : "-";
1826
+ n += g ? ps(g) : "-";
1817
1827
  break;
1818
1828
  case "size":
1819
- n += us(p);
1829
+ n += fs(p);
1820
1830
  break;
1821
1831
  case "type":
1822
1832
  n += y;
@@ -1834,7 +1844,7 @@ function ps(t) {
1834
1844
  textOpen: n,
1835
1845
  textClose: null
1836
1846
  };
1837
- return u = Et(E), d += u, {
1847
+ return u = Nt(E), d += u, {
1838
1848
  type: y,
1839
1849
  name: w,
1840
1850
  path: M,
@@ -1847,13 +1857,13 @@ function ps(t) {
1847
1857
  tokensTotal: d,
1848
1858
  text: E,
1849
1859
  size: p,
1850
- countFiles: m,
1860
+ countFiles: h,
1851
1861
  dateModified: g
1852
1862
  };
1853
1863
  };
1854
1864
  }
1855
- async function hs(t) {
1856
- const r = await ls(t), s = le(r), o = s.getChilds(s.root), e = vt({
1865
+ async function gs(t) {
1866
+ const r = await us(t), s = le(r), o = s.getChilds(s.root), e = Et({
1857
1867
  getId: (i) => {
1858
1868
  const a = s.getId(i);
1859
1869
  if (a == null)
@@ -1863,19 +1873,19 @@ async function hs(t) {
1863
1873
  return a;
1864
1874
  },
1865
1875
  getChilds: (i) => s.getChilds(i),
1866
- createSnapshotNode: ps(t),
1876
+ createSnapshotNode: ms(t),
1867
1877
  rootNodes: o ?? []
1868
- }), n = fs(e.idToNode);
1878
+ }), n = hs(e.idToNode);
1869
1879
  return e.idToChildIds.forEach((i) => {
1870
1880
  i.sort(n);
1871
1881
  }), le(e);
1872
1882
  }
1873
- const ee = h.object({
1874
- queryName: h.string().optional().describe("Name of previously created filesystem snapshot query, to use"),
1883
+ const ee = m.object({
1884
+ queryName: m.string().optional().describe("Name of previously created filesystem snapshot query, to use"),
1875
1885
  query: xe.optional().describe(
1876
1886
  "Filesystem snapshot query creation options JSON to automatically create query"
1877
1887
  ),
1878
- name: h.string().describe(
1888
+ name: m.string().describe(
1879
1889
  "Unique name for the filesystem snapshot. Recommended format: kebab-case-1, kebab-case-2, ..."
1880
1890
  )
1881
1891
  });
@@ -1907,7 +1917,7 @@ async function ce(t, r, s) {
1907
1917
  };
1908
1918
  c = u;
1909
1919
  } else if (i) {
1910
- const u = await Tt(
1920
+ const u = await Ct(
1911
1921
  i,
1912
1922
  r,
1913
1923
  s
@@ -1922,7 +1932,7 @@ async function ce(t, r, s) {
1922
1932
  error: "Either queryName or query must be provided"
1923
1933
  };
1924
1934
  try {
1925
- const u = await hs(c), f = {
1935
+ const u = await gs(c), f = {
1926
1936
  name: e,
1927
1937
  query: c,
1928
1938
  tree: u
@@ -1937,7 +1947,7 @@ async function ce(t, r, s) {
1937
1947
  };
1938
1948
  }
1939
1949
  }
1940
- function ms(t, r) {
1950
+ function ws(t, r) {
1941
1951
  t(
1942
1952
  "fs-snapshot-create",
1943
1953
  {
@@ -1957,7 +1967,7 @@ function ms(t, r) {
1957
1967
  }
1958
1968
  );
1959
1969
  }
1960
- class gs {
1970
+ class ys {
1961
1971
  _first = null;
1962
1972
  _last = null;
1963
1973
  _size = 0;
@@ -1980,8 +1990,8 @@ class gs {
1980
1990
  return this._size;
1981
1991
  }
1982
1992
  }
1983
- function ws(t) {
1984
- const r = new gs(), {
1993
+ function bs(t) {
1994
+ const r = new ys(), {
1985
1995
  tree: s,
1986
1996
  limits: { maxCountTotal: o, maxTokensTotal: e, maxCountGroup: n, maxTokensGroup: i },
1987
1997
  indexRangeGroupStrategy: a
@@ -1992,20 +2002,20 @@ function ws(t) {
1992
2002
  });
1993
2003
  let l = null, u = 0, f = 0;
1994
2004
  for (; !r.isEmpty(); ) {
1995
- const { reportNode: d, node: p } = r.dequeue(), m = s.getChilds(p);
1996
- if (m == null || p.countChilds === 0 || m.length !== p.countChilds)
2005
+ const { reportNode: d, node: p } = r.dequeue(), h = s.getChilds(p);
2006
+ if (h == null || p.countChilds === 0 || h.length !== p.countChilds)
1997
2007
  throw new Error(
1998
2008
  "Impossible behavior: nodeChilds is null or length mismatch"
1999
2009
  );
2000
2010
  let g = r.size();
2001
- for (let w = 0; w < m.length; w++)
2002
- m[w].countChilds > 0 && (g += 1);
2011
+ for (let w = 0; w < h.length; w++)
2012
+ h[w].countChilds > 0 && (g += 1);
2003
2013
  const y = g * a.tokens;
2004
2014
  if (o != null && u + p.countChilds + g > o || e != null && f + p.tokensChilds + y > e) {
2005
2015
  const w = [];
2006
2016
  let M = null, E = 0;
2007
- for (let $ = 0, T = m.length; $ < T; $++) {
2008
- const x = m[$], S = E * a.tokens;
2017
+ for (let $ = 0, T = h.length; $ < T; $++) {
2018
+ const x = h[$], S = E * a.tokens;
2009
2019
  M != null && // Если общий лимит превышен, то не создаем новую группу, а продолжаем текущую. В случае достижения лимитов, последняя группа может содержать больше элементов, чем указано в лимитах группы, и это допустимо. Главное - дать в отчете полную картину.
2010
2020
  !(o != null && u + 1 > o || e != null && f + a.tokens > e) && (n != null && M.countGrouped + 1 + E > n || i != null && M.tokensGrouped + x.tokens + S > i) && (w.push(M), u += 1, f += a.tokens, M = null, E = 0), M = a.add(M, x, $), x.countChilds > 0 && (E += 1);
2011
2021
  }
@@ -2025,8 +2035,8 @@ function ws(t) {
2025
2035
  } else {
2026
2036
  u += p.countChilds, f += p.tokensChilds;
2027
2037
  const w = [];
2028
- for (let M = 0; M < m.length; M++) {
2029
- const E = m[M], b = {
2038
+ for (let M = 0; M < h.length; M++) {
2039
+ const E = h[M], b = {
2030
2040
  text: E.text
2031
2041
  };
2032
2042
  w.push(b);
@@ -2049,7 +2059,7 @@ function ws(t) {
2049
2059
  }
2050
2060
  return l ?? [];
2051
2061
  }
2052
- function Nt(t) {
2062
+ function kt(t) {
2053
2063
  const {
2054
2064
  tree: r,
2055
2065
  request: { parentNodeId: s, childsIndexRange: o, limits: e },
@@ -2071,13 +2081,13 @@ function Nt(t) {
2071
2081
  throw new Error(
2072
2082
  `Invalid index range: ${d}-${p} for root nodes length ${l.length}`
2073
2083
  );
2074
- const m = [];
2084
+ const h = [];
2075
2085
  let g = null;
2076
2086
  for (let y = d; y <= p; y++) {
2077
2087
  const w = l[y];
2078
- m.push(w), g = n.add(g, w, y);
2088
+ h.push(w), g = n.add(g, w, y);
2079
2089
  }
2080
- l = m, c = {
2090
+ l = h, c = {
2081
2091
  ...a,
2082
2092
  text: n.getReportText(g),
2083
2093
  countChilds: g.countGrouped,
@@ -2093,14 +2103,14 @@ function Nt(t) {
2093
2103
  root: u,
2094
2104
  getChilds: (d) => d === u ? [c] : d === c ? l : r.getChilds(d)
2095
2105
  };
2096
- return ws({
2106
+ return bs({
2097
2107
  tree: f,
2098
2108
  limits: e,
2099
2109
  indexRangeGroupStrategy: n,
2100
2110
  ...i
2101
2111
  });
2102
2112
  }
2103
- function kt(t, r) {
2113
+ function Ot(t, r) {
2104
2114
  if (t == null || t.length === 0)
2105
2115
  return "No results found";
2106
2116
  let s = "";
@@ -2117,7 +2127,7 @@ function kt(t, r) {
2117
2127
  }
2118
2128
  return o(t, ""), s;
2119
2129
  }
2120
- class ys {
2130
+ class Ss {
2121
2131
  tokens = 16;
2122
2132
  // +1 indent, +1 for line break
2123
2133
  getReportText = (r) => ({
@@ -2132,16 +2142,16 @@ class ys {
2132
2142
  tokensGrouped: s.tokens
2133
2143
  } : (r.indexRange[1] = o, r.countGrouped += 1, r.countMatched += s.countMatched, r.tokensGrouped += s.tokens, r);
2134
2144
  }
2135
- const Ot = h.object({
2136
- snapshotName: h.string().optional().describe("Name of previously created filesystem snapshot, to use"),
2145
+ const Rt = m.object({
2146
+ snapshotName: m.string().optional().describe("Name of previously created filesystem snapshot, to use"),
2137
2147
  snapshot: ee.optional().describe(
2138
2148
  "Filesystem snapshot creation options JSON to automatically create snapshot"
2139
2149
  ),
2140
- parentPath: h.string().optional().describe(
2150
+ parentPath: m.string().optional().describe(
2141
2151
  "Path relative to snapshot rootDir to browse. Omit to browse the rootDir itself"
2142
2152
  ),
2143
- childsIndexRange: h.tuple([h.number(), h.number()]).optional().describe(
2144
- "Child index range to show [start, end]. Only use the exact ranges that appeared in previous snapshot results - do not modify, combine, or split them"
2153
+ childsIndexRange: ft.optional().describe(
2154
+ "Child index range to show. Only use the exact ranges that appeared in previous snapshot results - do not modify, combine, or split them"
2145
2155
  )
2146
2156
  // maxCountTotal: z
2147
2157
  // .number()
@@ -2154,10 +2164,10 @@ const Ot = h.object({
2154
2164
  // maxCountGroup: z.number().default(10).describe('Maximum items per group'),
2155
2165
  // maxTokensGroup: z.number().default(1000).describe('Maximum tokens per group'),
2156
2166
  });
2157
- async function bs(t, r, s) {
2167
+ async function xs(t, r, s) {
2158
2168
  let o;
2159
2169
  try {
2160
- o = Ot.parse(t);
2170
+ o = Rt.parse(t);
2161
2171
  } catch (g) {
2162
2172
  return {
2163
2173
  error: F(g)
@@ -2165,13 +2175,12 @@ async function bs(t, r, s) {
2165
2175
  }
2166
2176
  const {
2167
2177
  snapshotName: e,
2168
- snapshot: n,
2169
- childsIndexRange: i
2178
+ snapshot: n
2170
2179
  // maxCountTotal,
2171
2180
  // maxTokensTotal,
2172
2181
  // maxCountGroup,
2173
2182
  // maxTokensGroup,
2174
- } = o, a = 60, c = 1e3, l = 25, u = 900;
2183
+ } = o, i = o.childsIndexRange?.from != null && o.childsIndexRange?.to != null ? [o.childsIndexRange.from, o.childsIndexRange.to] : null, a = 60, c = 1e3, l = 25, u = 900;
2175
2184
  if (!s.sessionId)
2176
2185
  return {
2177
2186
  error: "Session ID is required"
@@ -2181,7 +2190,7 @@ async function bs(t, r, s) {
2181
2190
  return {
2182
2191
  error: "Either snapshotName or snapshot must be provided, not both"
2183
2192
  };
2184
- let d, p = !1, m = !1;
2193
+ let d, p = !1, h = !1;
2185
2194
  if (e) {
2186
2195
  if (d = f.fsSnapshots.get(e), d == null)
2187
2196
  return {
@@ -2197,13 +2206,13 @@ async function bs(t, r, s) {
2197
2206
  return {
2198
2207
  error: g.error
2199
2208
  };
2200
- d = g.fsSnapshot, p = g.queryCreated, m = !0;
2209
+ d = g.fsSnapshot, p = g.queryCreated, h = !0;
2201
2210
  } else
2202
2211
  return {
2203
2212
  error: "Either snapshotName or snapshot must be provided"
2204
2213
  };
2205
2214
  try {
2206
- const g = me(o.parentPath), y = Nt({
2215
+ const g = me(o.parentPath), y = kt({
2207
2216
  tree: d.tree,
2208
2217
  request: {
2209
2218
  parentNodeId: g,
@@ -2215,12 +2224,12 @@ async function bs(t, r, s) {
2215
2224
  maxTokensGroup: u
2216
2225
  }
2217
2226
  },
2218
- indexRangeGroupStrategy: new ys()
2219
- }), w = kt(y);
2227
+ indexRangeGroupStrategy: new Ss()
2228
+ }), w = Ot(y);
2220
2229
  return {
2221
2230
  fsSnapshot: d,
2222
2231
  queryCreated: p,
2223
- snapshotCreated: m,
2232
+ snapshotCreated: h,
2224
2233
  parentPath: g,
2225
2234
  childsIndexRange: i,
2226
2235
  report: w
@@ -2231,16 +2240,16 @@ async function bs(t, r, s) {
2231
2240
  };
2232
2241
  }
2233
2242
  }
2234
- function Ss(t, r) {
2243
+ function $s(t, r) {
2235
2244
  t(
2236
2245
  "fs-snapshot-browse",
2237
2246
  {
2238
2247
  title: "Browse Filesystem Snapshot",
2239
2248
  description: "Browse and explore filesystem. Use this to efficiently browse, analyze, explore, inspect, etc directory and file structures",
2240
- inputSchema: Ot.shape
2249
+ inputSchema: Rt.shape
2241
2250
  },
2242
2251
  async (s, o) => {
2243
- const e = await bs(s, r, o);
2252
+ const e = await xs(s, r, o);
2244
2253
  if (e.error != null)
2245
2254
  return `Method: fs-snapshot-browse(${JSON.stringify(s)})
2246
2255
  ❌ Error: ${e.error}`;
@@ -2262,7 +2271,7 @@ ${e.report}`, n;
2262
2271
  }
2263
2272
  );
2264
2273
  }
2265
- function Rt(t) {
2274
+ function Dt(t) {
2266
2275
  const r = [], s = t.tree, o = t.query.rootDir ?? ".";
2267
2276
  function e(n) {
2268
2277
  n.type === "file" && n.isMatched && r.push(o + "/" + n.path);
@@ -2274,14 +2283,14 @@ function Rt(t) {
2274
2283
  return e(s.root), r;
2275
2284
  }
2276
2285
  const Ve = /* @__PURE__ */ new Map();
2277
- function xs(t) {
2286
+ function Is(t) {
2278
2287
  const r = H(t);
2279
2288
  let s = Ve.get(r);
2280
- return s == null && (s = new or(), Ve.set(r, s)), s;
2289
+ return s == null && (s = new nr(), Ve.set(r, s)), s;
2281
2290
  }
2282
- async function $s(t) {
2291
+ async function Ms(t) {
2283
2292
  const { filePath: r, func: s } = t;
2284
- return xs(r).lock(
2293
+ return Is(r).lock(
2285
2294
  () => V({
2286
2295
  pool: Se,
2287
2296
  count: 1,
@@ -2289,8 +2298,8 @@ async function $s(t) {
2289
2298
  })
2290
2299
  );
2291
2300
  }
2292
- const Ze = 10, re = 48, Xe = 57, de = 36, Is = 38, Ms = 39, Ts = 60, Cs = 62, vs = 96, se = 0, et = 1, tt = 2, rt = 3, st = 4, Es = 5;
2293
- function Ns(t) {
2301
+ const Ze = 10, re = 48, Xe = 57, de = 36, Ts = 38, Cs = 39, vs = 60, Es = 62, Ns = 96, se = 0, et = 1, tt = 2, rt = 3, st = 4, ks = 5;
2302
+ function Os(t) {
2294
2303
  const { content: r, pattern: s, replacement: o } = t, e = r.length, n = [0];
2295
2304
  for (let b = 0; b < e; b++)
2296
2305
  r.charCodeAt(b) === Ze && b + 1 < e && n.push(b + 1);
@@ -2316,11 +2325,11 @@ function Ns(t) {
2316
2325
  let v = -1, P = 0, O = 2;
2317
2326
  if (S === de)
2318
2327
  v = se, P = "$";
2319
- else if (S === Is)
2328
+ else if (S === Ts)
2320
2329
  v = et;
2321
- else if (S === vs)
2330
+ else if (S === Ns)
2322
2331
  v = tt;
2323
- else if (S === Ms)
2332
+ else if (S === Cs)
2324
2333
  v = rt;
2325
2334
  else if (S >= re && S <= Xe) {
2326
2335
  let I = x + 2;
@@ -2330,11 +2339,11 @@ function Ns(t) {
2330
2339
  I++;
2331
2340
  }
2332
2341
  v = st, P = o.substring(x + 1, I), O = I - x;
2333
- } else if (S === Ts) {
2342
+ } else if (S === vs) {
2334
2343
  let I = x + 2;
2335
- for (; I < b && o.charCodeAt(I) !== Cs; )
2344
+ for (; I < b && o.charCodeAt(I) !== Es; )
2336
2345
  I++;
2337
- I < b && I > x + 2 && (v = Es, P = o.substring(x + 2, I), O = I + 1 - x);
2346
+ I < b && I > x + 2 && (v = ks, P = o.substring(x + 2, I), O = I + 1 - x);
2338
2347
  }
2339
2348
  v >= 0 ? (x > T && (u.push(se), f.push(o.substring(T, x))), u.push(v), f.push(P), x += O, T = x) : x++;
2340
2349
  }
@@ -2342,7 +2351,7 @@ function Ns(t) {
2342
2351
  } else
2343
2352
  l = o;
2344
2353
  }
2345
- let p = "", m = 0, g = 0;
2354
+ let p = "", h = 0, g = 0;
2346
2355
  s.lastIndex = 0;
2347
2356
  let y;
2348
2357
  for (; (y = s.exec(r)) !== null; ) {
@@ -2372,7 +2381,7 @@ function Ns(t) {
2372
2381
  lines: [S, v],
2373
2382
  linesOffset: [P, O]
2374
2383
  }), o != null) {
2375
- p += r.substring(m, b);
2384
+ p += r.substring(h, b);
2376
2385
  let I;
2377
2386
  if (l != null)
2378
2387
  I = l;
@@ -2417,14 +2426,14 @@ function Ns(t) {
2417
2426
  offset: [C, C + I.length],
2418
2427
  lines: [0, 0],
2419
2428
  linesOffset: [0, 0]
2420
- }), g += I.length - T, m = x;
2429
+ }), g += I.length - T, h = x;
2421
2430
  }
2422
2431
  if (T === 0 && s.lastIndex++, !s.global)
2423
2432
  break;
2424
2433
  }
2425
2434
  if (s.lastIndex = 0, o == null)
2426
2435
  return { search: { content: r, matches: a }, replace: null };
2427
- p += r.substring(m);
2436
+ p += r.substring(h);
2428
2437
  const w = p.length, M = [0];
2429
2438
  for (let b = 0; b < w; b++)
2430
2439
  p.charCodeAt(b) === Ze && b + 1 < w && M.push(b + 1);
@@ -2458,7 +2467,7 @@ function Ns(t) {
2458
2467
  replace: { content: p, matches: c }
2459
2468
  };
2460
2469
  }
2461
- function Dt(t) {
2470
+ function Ft(t) {
2462
2471
  if (t.length === 0)
2463
2472
  return [];
2464
2473
  const r = [...t].sort((i, a) => {
@@ -2497,15 +2506,15 @@ function oe(t, r, s, o) {
2497
2506
  return { startLine: i, endLine: l, startLineOfs: a, endLineOfs: c + 1 };
2498
2507
  return { startLine: i, endLine: l, startLineOfs: a, endLineOfs: r };
2499
2508
  }
2500
- function ks(t, r) {
2509
+ function Rs(t, r) {
2501
2510
  if (t.replace == null && r.replace == null) {
2502
2511
  const U = [...t.search.matches, ...r.search.matches];
2503
2512
  return {
2504
- search: { content: t.search.content, matches: Dt(U) },
2513
+ search: { content: t.search.content, matches: Ft(U) },
2505
2514
  replace: null
2506
2515
  };
2507
2516
  }
2508
- const s = t.replace ?? t.search, o = r.replace ?? r.search, e = t.search.content, n = o.content, i = e.length, a = n.length, c = t.search.matches, l = s.matches, u = r.search.matches, f = o.matches, d = l.length, p = u.length, m = [], g = [];
2517
+ const s = t.replace ?? t.search, o = r.replace ?? r.search, e = t.search.content, n = o.content, i = e.length, a = n.length, c = t.search.matches, l = s.matches, u = r.search.matches, f = o.matches, d = l.length, p = u.length, h = [], g = [];
2509
2518
  let y = 0, w = 0, M = 0, E = 0, b = 0, $ = 0, T = 0, x = 0, S = 0, v = 0, P = 0, O = 0, I = 0, C = 0, N = 0, R = 0, K = 0, q = 0, L = 0, B = 0, z = 0, A = 0, _ = 0, D = 0;
2510
2519
  for (; y < d || w < p; )
2511
2520
  if (y < d && (b = l[y].offset[0], $ = l[y].offset[1]), w < p && (T = u[w].offset[0], x = u[w].offset[1]), y < d && w < p && b < x && T < $) {
@@ -2524,7 +2533,7 @@ function ks(t, r) {
2524
2533
  B = u[G].offset[0], z = u[G].offset[1], A = f[G].offset[0], _ = f[G].offset[1], q < B && (D = q + L, D < N && (N = D), D = B + L, D > R && (R = D)), A < N && (N = A), _ > R && (R = _), L += _ - A - z + B, q = z;
2525
2534
  q < S && (D = q + L, D < N && (N = D), D = S + L, D > R && (R = D)), E = L;
2526
2535
  const U = oe(e, i, I, C);
2527
- m.push({
2536
+ h.push({
2528
2537
  offset: [I, C],
2529
2538
  lines: [U.startLine, U.endLine],
2530
2539
  linesOffset: [U.startLineOfs, U.endLineOfs]
@@ -2538,7 +2547,7 @@ function ks(t, r) {
2538
2547
  } else if (w >= p || y < d && b <= T) {
2539
2548
  B = c[y].offset[0], z = c[y].offset[1], A = l[y].offset[0], _ = l[y].offset[1], N = A + E, R = _ + E;
2540
2549
  const U = oe(n, a, N, R);
2541
- m.push(c[y]), g.push({
2550
+ h.push(c[y]), g.push({
2542
2551
  offset: [N, R],
2543
2552
  lines: [U.startLine, U.endLine],
2544
2553
  linesOffset: [U.startLineOfs, U.endLineOfs]
@@ -2546,20 +2555,20 @@ function ks(t, r) {
2546
2555
  } else {
2547
2556
  B = u[w].offset[0], z = u[w].offset[1], A = f[w].offset[0], _ = f[w].offset[1], I = B + M, C = z + M;
2548
2557
  const U = oe(e, i, I, C);
2549
- m.push({
2558
+ h.push({
2550
2559
  offset: [I, C],
2551
2560
  lines: [U.startLine, U.endLine],
2552
2561
  linesOffset: [U.startLineOfs, U.endLineOfs]
2553
2562
  }), g.push(f[w]), E += _ - A - z + B, w++;
2554
2563
  }
2555
2564
  return {
2556
- search: { content: e, matches: m },
2565
+ search: { content: e, matches: h },
2557
2566
  replace: { content: n, matches: g }
2558
2567
  };
2559
2568
  }
2560
- async function Os(t) {
2569
+ async function Ds(t) {
2561
2570
  const { filePath: r, operations: s, dryRun: o } = t;
2562
- return s.length === 0 ? { filePath: r, result: null } : $s({
2571
+ return s.length === 0 ? { filePath: r, result: null } : Ms({
2563
2572
  filePath: r,
2564
2573
  func: async () => {
2565
2574
  let e;
@@ -2585,12 +2594,12 @@ async function Os(t) {
2585
2594
  error: `Invalid RegExp pattern "${c.pattern}": ${d instanceof Error ? d.message : d + ""}`
2586
2595
  };
2587
2596
  }
2588
- const u = n?.replace?.content ?? e, f = Ns({
2597
+ const u = n?.replace?.content ?? e, f = Os({
2589
2598
  content: u,
2590
2599
  pattern: l,
2591
2600
  replacement: c.replacement
2592
2601
  });
2593
- c.replacement != null && (i = !0), n == null ? n = f : n = ks(n, f);
2602
+ c.replacement != null && (i = !0), n == null ? n = f : n = Rs(n, f);
2594
2603
  }
2595
2604
  if (i && n?.replace != null && !o) {
2596
2605
  const a = n.replace.content;
@@ -2628,13 +2637,13 @@ async function $e(t) {
2628
2637
  error: "Not replaced, try again"
2629
2638
  };
2630
2639
  }
2631
- return Os({ filePath: i, operations: s, dryRun: o });
2640
+ return Ds({ filePath: i, operations: s, dryRun: o });
2632
2641
  })
2633
2642
  ) };
2634
2643
  }
2635
- const Rs = 6;
2636
- function Ds(t) {
2637
- const { content: r, startLine: s } = t, o = t.padWidth ?? Rs;
2644
+ const Fs = 6;
2645
+ function Ps(t) {
2646
+ const { content: r, startLine: s } = t, o = t.padWidth ?? Fs;
2638
2647
  let e = "", n = 0, i = 0;
2639
2648
  for (; n < r.length; ) {
2640
2649
  const a = r.indexOf(`
@@ -2649,13 +2658,13 @@ function fe(t) {
2649
2658
  const { content: r, matches: s, outputLimit: o } = t;
2650
2659
  if (s.length === 0)
2651
2660
  return { output: "", truncated: !1 };
2652
- const e = Dt(s);
2661
+ const e = Ft(s);
2653
2662
  let n = "", i = !1;
2654
2663
  for (let a = 0; a < e.length; a++) {
2655
2664
  const c = e[a], l = r.substring(
2656
2665
  c.linesOffset[0],
2657
2666
  c.linesOffset[1]
2658
- ), u = Ds({
2667
+ ), u = Ps({
2659
2668
  content: l,
2660
2669
  startLine: c.lines[0]
2661
2670
  }), f = a > 0 ? 2 : 0;
@@ -2669,15 +2678,15 @@ function fe(t) {
2669
2678
  return { output: n, truncated: i };
2670
2679
  }
2671
2680
  const ot = "BEFORE", nt = "AFTER";
2672
- function Fs(t) {
2681
+ function Bs(t) {
2673
2682
  const { result: r, outputLimit: s } = t;
2674
2683
  if (r.replace == null) {
2675
- const m = fe({
2684
+ const h = fe({
2676
2685
  content: r.search.content,
2677
2686
  matches: r.search.matches,
2678
2687
  outputLimit: s
2679
2688
  });
2680
- return { output: m.output, truncated: m.truncated };
2689
+ return { output: h.output, truncated: h.truncated };
2681
2690
  }
2682
2691
  const o = `<${ot}>
2683
2692
  `, e = `</${ot}>
@@ -2712,7 +2721,7 @@ function Ie(t) {
2712
2721
  }
2713
2722
  if (o || i.result == null || i.result.search.matches.length === 0)
2714
2723
  continue;
2715
- const l = Fs({
2724
+ const l = Bs({
2716
2725
  result: i.result
2717
2726
  });
2718
2727
  l.output.length > 0 && (c > 0 && (e += `
@@ -2721,25 +2730,25 @@ function Ie(t) {
2721
2730
  }
2722
2731
  return e;
2723
2732
  }
2724
- const Ps = h.object({
2725
- pattern: h.string().describe("JS RegExp pattern"),
2726
- flags: h.string().default("gm").describe('JS RegExp flags. Default: "gm"')
2727
- }), Ft = h.object({
2728
- snapshotName: h.string().optional().describe("Name of previously created filesystem snapshot, to use"),
2733
+ const Ls = m.object({
2734
+ pattern: m.string().describe("JS RegExp pattern"),
2735
+ flags: m.string().default("gm").describe('JS RegExp flags. Default: "gm"')
2736
+ }), Pt = m.object({
2737
+ snapshotName: m.string().optional().describe("Name of previously created filesystem snapshot, to use"),
2729
2738
  snapshot: ee.optional().describe(
2730
2739
  "Filesystem snapshot creation options JSON to automatically create snapshot"
2731
2740
  ),
2732
- bulkOperations: h.array(Ps).describe(
2741
+ bulkOperations: m.array(Ls).describe(
2733
2742
  "All search patterns to execute; include every pattern here; never split across multiple calls"
2734
2743
  ),
2735
- outputLimit: h.number().int().min(0).max(J).default(Q).describe(
2744
+ outputLimit: m.number().int().min(0).max(J).default(Q).describe(
2736
2745
  `Maximum output characters. Output exceeding this limit will be truncated. Maximum: ${J}. Default: ${Q}`
2737
2746
  )
2738
2747
  });
2739
- async function Bs(t, r, s) {
2748
+ async function As(t, r, s) {
2740
2749
  let o;
2741
2750
  try {
2742
- o = Ft.parse(t);
2751
+ o = Pt.parse(t);
2743
2752
  } catch (w) {
2744
2753
  return {
2745
2754
  error: F(w)
@@ -2776,11 +2785,11 @@ async function Bs(t, r, s) {
2776
2785
  return {
2777
2786
  error: "Either snapshotName or snapshot must be provided"
2778
2787
  };
2779
- const d = Rt(l), p = l.query.rootDir ?? ".", m = await $e({
2788
+ const d = Dt(l), p = l.query.rootDir ?? ".", h = await $e({
2780
2789
  filePaths: d,
2781
2790
  operations: i
2782
2791
  }), g = Ie({
2783
- result: m,
2792
+ result: h,
2784
2793
  rootDir: p
2785
2794
  });
2786
2795
  return { output: we({
@@ -2789,16 +2798,16 @@ async function Bs(t, r, s) {
2789
2798
  limit: a
2790
2799
  }).content, rootDir: p, fsSnapshot: l, queryCreated: u, snapshotCreated: f };
2791
2800
  }
2792
- function Ls(t, r) {
2801
+ function zs(t, r) {
2793
2802
  t(
2794
2803
  "fs-snapshot-search",
2795
2804
  {
2796
2805
  title: "Search File Contents in Snapshot",
2797
2806
  description: "Search file contents using JS RegExp. Use this to find text patterns across snapshot files. Put all search patterns in the bulkOperations array; use one snapshot with rootDir covering all target files; never split into multiple calls based on file locations, directories, or pattern groups",
2798
- inputSchema: Ft.shape
2807
+ inputSchema: Pt.shape
2799
2808
  },
2800
2809
  async (s, o) => {
2801
- const e = await Bs(
2810
+ const e = await As(
2802
2811
  s,
2803
2812
  r,
2804
2813
  o
@@ -2819,26 +2828,26 @@ Reminder: use one snapshot covering all target files; include all patterns in th
2819
2828
  }
2820
2829
  );
2821
2830
  }
2822
- const As = h.object({
2823
- pattern: h.string().describe("JS RegExp pattern"),
2824
- flags: h.string().default("gm").describe('JS RegExp flags. Default: "gm"'),
2825
- replacement: h.string().describe("JS replacement pattern")
2826
- }), Pt = h.object({
2827
- snapshotName: h.string().optional().describe("Name of previously created filesystem snapshot, to use"),
2831
+ const Us = m.object({
2832
+ pattern: m.string().describe("JS RegExp pattern"),
2833
+ flags: m.string().default("gm").describe('JS RegExp flags. Default: "gm"'),
2834
+ replacement: m.string().describe("JS replacement pattern")
2835
+ }), Bt = m.object({
2836
+ snapshotName: m.string().optional().describe("Name of previously created filesystem snapshot, to use"),
2828
2837
  snapshot: ee.optional().describe(
2829
2838
  "Filesystem snapshot creation options JSON to automatically create snapshot"
2830
2839
  ),
2831
- bulkOperations: h.array(As).describe(
2840
+ bulkOperations: m.array(Us).describe(
2832
2841
  "All replace patterns to execute; include every pattern here; never split across multiple calls"
2833
2842
  ),
2834
- outputLimit: h.number().int().min(0).max(J).default(Q).describe(
2843
+ outputLimit: m.number().int().min(0).max(J).default(Q).describe(
2835
2844
  `Maximum output characters. Output exceeding this limit will be truncated. Maximum: ${J}. Default: ${Q}`
2836
2845
  )
2837
2846
  });
2838
- async function zs(t, r, s) {
2847
+ async function js(t, r, s) {
2839
2848
  let o;
2840
2849
  try {
2841
- o = Pt.parse(t);
2850
+ o = Bt.parse(t);
2842
2851
  } catch (b) {
2843
2852
  return {
2844
2853
  error: F(b)
@@ -2875,16 +2884,16 @@ async function zs(t, r, s) {
2875
2884
  return {
2876
2885
  error: "Either snapshotName or snapshot must be provided"
2877
2886
  };
2878
- const d = Rt(l), p = l.query.rootDir ?? ".", m = {
2887
+ const d = Dt(l), p = l.query.rootDir ?? ".", h = {
2879
2888
  filePaths: d,
2880
2889
  operations: i
2881
2890
  }, g = Date.now(), y = await $e({
2882
- ...m,
2891
+ ...h,
2883
2892
  dryRun: !0
2884
- }), w = ns();
2893
+ }), w = as();
2885
2894
  c.preparedReplace = {
2886
2895
  id: w,
2887
- options: m,
2896
+ options: h,
2888
2897
  rootDir: p,
2889
2898
  dateCreated: g
2890
2899
  };
@@ -2900,16 +2909,16 @@ Review the output carefully before executing. Call fs-snapshot-replace-execute w
2900
2909
  limit: a
2901
2910
  }).content, rootDir: p, fsSnapshot: l, queryCreated: u, snapshotCreated: f };
2902
2911
  }
2903
- function Us(t, r) {
2912
+ function qs(t, r) {
2904
2913
  t(
2905
2914
  "fs-snapshot-replace-prepare",
2906
2915
  {
2907
2916
  title: "Prepare File Content Replacement",
2908
2917
  description: "Prepares text replacement in files using JS RegExp. Use this to perform bulk replacements across snapshot files. Put all replace patterns in the bulkOperations array; use one snapshot with rootDir covering all target files; never split into multiple calls based on file locations, directories, or pattern groups. Read and review full output to the end. If all replacements are valid get replaceId from the end of output and call fs-snapshot-replace-execute to apply it.",
2909
- inputSchema: Pt.shape
2918
+ inputSchema: Bt.shape
2910
2919
  },
2911
2920
  async (s, o) => {
2912
- const e = await zs(
2921
+ const e = await js(
2913
2922
  s,
2914
2923
  r,
2915
2924
  o
@@ -2930,13 +2939,13 @@ Reminder: use one snapshot covering all target files; include all patterns in th
2930
2939
  }
2931
2940
  );
2932
2941
  }
2933
- const Bt = h.object({
2934
- replaceId: h.string().describe("Replace ID from the END of fs-snapshot-replace-prepare output. NEVER fabricate or guess this value.")
2942
+ const Lt = m.object({
2943
+ replaceId: m.string().describe("Replace ID from the END of fs-snapshot-replace-prepare output. NEVER fabricate or guess this value.")
2935
2944
  });
2936
- async function js(t, r, s) {
2945
+ async function _s(t, r, s) {
2937
2946
  let o;
2938
2947
  try {
2939
- o = Bt.parse(t);
2948
+ o = Lt.parse(t);
2940
2949
  } catch (l) {
2941
2950
  return {
2942
2951
  error: F(l)
@@ -2966,16 +2975,16 @@ async function js(t, r, s) {
2966
2975
  errorsOnly: !0
2967
2976
  }) || null };
2968
2977
  }
2969
- function qs(t, r) {
2978
+ function Gs(t, r) {
2970
2979
  t(
2971
2980
  "fs-snapshot-replace-execute",
2972
2981
  {
2973
2982
  title: "Execute Prepared Replacement",
2974
2983
  description: "Executes prepared replacement. Requires replaceId from the end of fs-snapshot-replace-prepare output.",
2975
- inputSchema: Bt.shape
2984
+ inputSchema: Lt.shape
2976
2985
  },
2977
2986
  async (s, o) => {
2978
- const e = await js(
2987
+ const e = await _s(
2979
2988
  s,
2980
2989
  r,
2981
2990
  o
@@ -2990,8 +2999,8 @@ ${e.output}`), n;
2990
2999
  }
2991
3000
  );
2992
3001
  }
2993
- function _s(t, r) {
2994
- r.list && ss(t, r), r.snapshotQueryCreate && as(t, r), r.snapshotCreate && ms(t, r), r.snapshotBrowse && Ss(t, r), r.snapshotSearch && Ls(t, r), r.snapshotReplace && (Us(t, r), qs(t, r)), console.log(
3002
+ function Js(t, r) {
3003
+ r.list && ns(t, r), r.snapshotQueryCreate && cs(t, r), r.snapshotCreate && ws(t, r), r.snapshotBrowse && $s(t, r), r.snapshotSearch && zs(t, r), r.snapshotReplace && (qs(t, r), Gs(t, r)), console.log(
2995
3004
  `File manager:
2996
3005
  - Working directory: ${k.resolve(r.workingDir || "")}
2997
3006
  `
@@ -3004,15 +3013,15 @@ function W(t) {
3004
3013
  domSnapshotQueries: /* @__PURE__ */ new Map()
3005
3014
  }), pe.get(t);
3006
3015
  }
3007
- const Me = h.object({
3008
- name: h.string().describe(
3016
+ const Me = m.object({
3017
+ name: m.string().describe(
3009
3018
  "Unique name for the browser. Recommended format: kebab-case-1, kebab-case-2, ..."
3010
3019
  ),
3011
- browserType: h.enum(["chromium", "firefox", "webkit"]).describe("Browser type to launch"),
3012
- muteAudio: h.boolean().optional().describe("Mute audio in the browser"),
3013
- devTools: h.boolean().optional().describe("Open browser with dev tools")
3020
+ browserType: m.enum(["chromium", "firefox", "webkit"]).describe("Browser type to launch"),
3021
+ muteAudio: m.boolean().optional().describe("Mute audio in the browser"),
3022
+ devTools: m.boolean().optional().describe("Open browser with dev tools")
3014
3023
  });
3015
- async function Lt(t, r, s) {
3024
+ async function At(t, r, s) {
3016
3025
  let o;
3017
3026
  try {
3018
3027
  o = Me.parse(t);
@@ -3029,9 +3038,9 @@ async function Lt(t, r, s) {
3029
3038
  const c = W(s.sessionId);
3030
3039
  try {
3031
3040
  const u = await {
3032
- chromium: cr,
3033
- firefox: lr,
3034
- webkit: ar
3041
+ chromium: ur,
3042
+ firefox: cr,
3043
+ webkit: lr
3035
3044
  }[n].launch({
3036
3045
  headless: !1,
3037
3046
  devtools: a,
@@ -3049,7 +3058,7 @@ async function Lt(t, r, s) {
3049
3058
  };
3050
3059
  }
3051
3060
  }
3052
- function Gs(t, r) {
3061
+ function Ws(t, r) {
3053
3062
  t(
3054
3063
  "playwright-browser-create",
3055
3064
  {
@@ -3058,17 +3067,17 @@ function Gs(t, r) {
3058
3067
  inputSchema: Me.shape
3059
3068
  },
3060
3069
  async (s, o) => {
3061
- const e = await Lt(s, r, o);
3070
+ const e = await At(s, r, o);
3062
3071
  return `Method: playwright-browser-create(${JSON.stringify(s)})
3063
3072
  ${e.error != null ? `❌ Error: ${e.error}` : `✅ Browser "${e.browserInfo.name}" (${e.browserInfo.browserType}) created successfully`}`;
3064
3073
  }
3065
3074
  );
3066
3075
  }
3067
- const At = h.object({});
3068
- async function Js(t, r, s) {
3076
+ const zt = m.object({});
3077
+ async function Ks(t, r, s) {
3069
3078
  let o;
3070
3079
  try {
3071
- o = At.parse(t);
3080
+ o = zt.parse(t);
3072
3081
  } catch (i) {
3073
3082
  return {
3074
3083
  error: F(i)
@@ -3083,16 +3092,16 @@ async function Js(t, r, s) {
3083
3092
  browserInfos: Array.from(e.browsers.values())
3084
3093
  };
3085
3094
  }
3086
- function Ws(t, r) {
3095
+ function Hs(t, r) {
3087
3096
  t(
3088
3097
  "playwright-browser-list",
3089
3098
  {
3090
3099
  title: "List Browsers",
3091
3100
  description: "List active browser instances",
3092
- inputSchema: At.shape
3101
+ inputSchema: zt.shape
3093
3102
  },
3094
3103
  async (s, o) => {
3095
- const e = await Js(s, r, o);
3104
+ const e = await Ks(s, r, o);
3096
3105
  if (e.error != null)
3097
3106
  return `Method: playwright-browser-list(${JSON.stringify(s)})
3098
3107
  ❌ Error: ${e.error}`;
@@ -3104,15 +3113,15 @@ ${n.length === 0 ? "No browsers found" : `Browsers: ${n.join(", ")}`}`;
3104
3113
  }
3105
3114
  );
3106
3115
  }
3107
- const zt = h.object({
3108
- names: h.array(h.string()).optional().describe(
3116
+ const Ut = m.object({
3117
+ names: m.array(m.string()).optional().describe(
3109
3118
  "Names of browsers to close. If not specified, closes all browsers"
3110
3119
  )
3111
3120
  });
3112
- async function Ks(t, r, s) {
3121
+ async function Qs(t, r, s) {
3113
3122
  let o;
3114
3123
  try {
3115
- o = zt.parse(t);
3124
+ o = Ut.parse(t);
3116
3125
  } catch (l) {
3117
3126
  return {
3118
3127
  error: F(l)
@@ -3143,16 +3152,16 @@ async function Ks(t, r, s) {
3143
3152
  ...a.length > 0 && { errors: a }
3144
3153
  };
3145
3154
  }
3146
- function Hs(t, r) {
3155
+ function Ys(t, r) {
3147
3156
  t(
3148
3157
  "playwright-browser-close",
3149
3158
  {
3150
3159
  title: "Close Browsers",
3151
3160
  description: "Close browsers. Automatically closes all contexts and pages within the browsers",
3152
- inputSchema: zt.shape
3161
+ inputSchema: Ut.shape
3153
3162
  },
3154
3163
  async (s, o) => {
3155
- const e = await Ks(s, r, o);
3164
+ const e = await Qs(s, r, o);
3156
3165
  if (e.error != null)
3157
3166
  return `Method: playwright-browser-close(${JSON.stringify(s)})
3158
3167
  ❌ Error: ${e.error}`;
@@ -3169,22 +3178,22 @@ ${n.join(`
3169
3178
  }
3170
3179
  );
3171
3180
  }
3172
- const Te = h.object({
3173
- browserName: h.string().optional().describe("Name of previously created browser, to use"),
3181
+ const Te = m.object({
3182
+ browserName: m.string().optional().describe("Name of previously created browser, to use"),
3174
3183
  browser: Me.optional().describe(
3175
3184
  "Browser creation options JSON to automatically create browser"
3176
3185
  ),
3177
- name: h.string().describe(
3186
+ name: m.string().describe(
3178
3187
  "Unique name for the context. Recommended format: kebab-case-1, kebab-case-2, ..."
3179
3188
  ),
3180
- isMobile: h.boolean().optional().describe("Configure for mobile device simulation"),
3181
- hasTouch: h.boolean().optional().describe("Enable touch events"),
3182
- viewport: h.object({
3183
- width: h.number(),
3184
- height: h.number()
3189
+ isMobile: m.boolean().optional().describe("Configure for mobile device simulation"),
3190
+ hasTouch: m.boolean().optional().describe("Enable touch events"),
3191
+ viewport: m.object({
3192
+ width: m.number(),
3193
+ height: m.number()
3185
3194
  }).optional().describe("Viewport size configuration")
3186
3195
  });
3187
- async function Ut(t, r, s) {
3196
+ async function jt(t, r, s) {
3188
3197
  let o;
3189
3198
  try {
3190
3199
  o = Te.parse(t);
@@ -3210,7 +3219,7 @@ async function Ut(t, r, s) {
3210
3219
  error: `Browser "${n}" not found`
3211
3220
  };
3212
3221
  } else if (i) {
3213
- const p = await Lt(i, r, s);
3222
+ const p = await At(i, r, s);
3214
3223
  if (p.error != null)
3215
3224
  return {
3216
3225
  error: p.error
@@ -3225,16 +3234,16 @@ async function Ut(t, r, s) {
3225
3234
  isMobile: a,
3226
3235
  hasTouch: c,
3227
3236
  viewport: l
3228
- }), m = {
3237
+ }), h = {
3229
3238
  browserInfo: d,
3230
3239
  name: e,
3231
3240
  context: p,
3232
3241
  pages: /* @__PURE__ */ new Map()
3233
3242
  };
3234
- return d.contexts.set(e, m), {
3243
+ return d.contexts.set(e, h), {
3235
3244
  browserInfoCreated: f,
3236
3245
  browserInfo: d,
3237
- contextInfo: m
3246
+ contextInfo: h
3238
3247
  };
3239
3248
  } catch (p) {
3240
3249
  return {
@@ -3242,7 +3251,7 @@ async function Ut(t, r, s) {
3242
3251
  };
3243
3252
  }
3244
3253
  }
3245
- function Qs(t, r) {
3254
+ function Vs(t, r) {
3246
3255
  t(
3247
3256
  "playwright-context-create",
3248
3257
  {
@@ -3251,7 +3260,7 @@ function Qs(t, r) {
3251
3260
  inputSchema: Te.shape
3252
3261
  },
3253
3262
  async (s, o) => {
3254
- const e = await Ut(s, r, o);
3263
+ const e = await jt(s, r, o);
3255
3264
  if (e.error != null)
3256
3265
  return `Method: playwright-context-create(${JSON.stringify(s)})
3257
3266
  ❌ Error: ${e.error}`;
@@ -3262,15 +3271,15 @@ function Qs(t, r) {
3262
3271
  }
3263
3272
  );
3264
3273
  }
3265
- const jt = h.object({
3266
- browserName: h.string().optional().describe(
3274
+ const qt = m.object({
3275
+ browserName: m.string().optional().describe(
3267
3276
  "Name of browser to list contexts from. If not specified, lists contexts from all browsers"
3268
3277
  )
3269
3278
  });
3270
- async function Ys(t, r, s) {
3279
+ async function Zs(t, r, s) {
3271
3280
  let o;
3272
3281
  try {
3273
- o = jt.parse(t);
3282
+ o = qt.parse(t);
3274
3283
  } catch (a) {
3275
3284
  return {
3276
3285
  error: F(a)
@@ -3304,16 +3313,16 @@ async function Ys(t, r, s) {
3304
3313
  contextsByBrowser: i
3305
3314
  };
3306
3315
  }
3307
- function Vs(t, r) {
3316
+ function Xs(t, r) {
3308
3317
  t(
3309
3318
  "playwright-context-list",
3310
3319
  {
3311
3320
  title: "List Browser Contexts",
3312
3321
  description: "List active browser contexts",
3313
- inputSchema: jt.shape
3322
+ inputSchema: qt.shape
3314
3323
  },
3315
3324
  async (s, o) => {
3316
- const e = await Ys(s, r, o);
3325
+ const e = await Zs(s, r, o);
3317
3326
  if ("error" in e)
3318
3327
  return `Method: playwright-context-list(${JSON.stringify(s)})
3319
3328
  ❌ Error: ${e.error}`;
@@ -3326,18 +3335,18 @@ function Vs(t, r) {
3326
3335
  }
3327
3336
  );
3328
3337
  }
3329
- const qt = h.object({
3330
- names: h.array(h.string()).optional().describe(
3338
+ const _t = m.object({
3339
+ names: m.array(m.string()).optional().describe(
3331
3340
  "Names of contexts to close. If not specified, closes all contexts"
3332
3341
  ),
3333
- browserName: h.string().optional().describe(
3342
+ browserName: m.string().optional().describe(
3334
3343
  "Name of browser to close contexts from. If not specified, searches all browsers"
3335
3344
  )
3336
3345
  });
3337
- async function Zs(t, r, s) {
3346
+ async function eo(t, r, s) {
3338
3347
  let o;
3339
3348
  try {
3340
- o = qt.parse(t);
3349
+ o = _t.parse(t);
3341
3350
  } catch (u) {
3342
3351
  return {
3343
3352
  error: F(u)
@@ -3388,16 +3397,16 @@ async function Zs(t, r, s) {
3388
3397
  ...c.length > 0 && { errors: c }
3389
3398
  };
3390
3399
  }
3391
- function Xs(t, r) {
3400
+ function to(t, r) {
3392
3401
  t(
3393
3402
  "playwright-context-close",
3394
3403
  {
3395
3404
  title: "Close Browser Contexts",
3396
3405
  description: "Close browser contexts. Automatically closes all pages within the contexts",
3397
- inputSchema: qt.shape
3406
+ inputSchema: _t.shape
3398
3407
  },
3399
3408
  async (s, o) => {
3400
- const e = await Zs(s, r, o);
3409
+ const e = await eo(s, r, o);
3401
3410
  if ("error" in e)
3402
3411
  return `Method: playwright-context-close(${JSON.stringify(s)})
3403
3412
  ❌ Error: ${e.error}`;
@@ -3414,7 +3423,7 @@ ${n.join(`
3414
3423
  }
3415
3424
  );
3416
3425
  }
3417
- function eo() {
3426
+ function ro() {
3418
3427
  class t {
3419
3428
  prevId = 0;
3420
3429
  objectToId = /* @__PURE__ */ new WeakMap();
@@ -3440,13 +3449,13 @@ function eo() {
3440
3449
  function r(a, c, l) {
3441
3450
  let u = null;
3442
3451
  for (let f = 0, d = c.length; f < d; f++) {
3443
- const p = c[f], m = a(p), g = m == null ? null : r(a, m, l), y = l(p, g);
3452
+ const p = c[f], h = a(p), g = h == null ? null : r(a, h, l), y = l(p, g);
3444
3453
  y != null && (u == null && (u = []), u.push(y));
3445
3454
  }
3446
3455
  return u;
3447
3456
  }
3448
3457
  function s(a) {
3449
- const { getId: c, getChilds: l, rootNodes: u, createSnapshotNode: f } = a, d = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), g = r(
3458
+ const { getId: c, getChilds: l, rootNodes: u, createSnapshotNode: f } = a, d = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map(), g = r(
3450
3459
  l,
3451
3460
  u,
3452
3461
  (w, M) => {
@@ -3455,7 +3464,7 @@ function eo() {
3455
3464
  const b = c(w);
3456
3465
  d.set(b, E), p.set(E, b);
3457
3466
  }
3458
- return E != null && M != null && m.set(
3467
+ return E != null && M != null && h.set(
3459
3468
  p.get(E),
3460
3469
  M.map((b) => p.get(b))
3461
3470
  ), E;
@@ -3463,29 +3472,29 @@ function eo() {
3463
3472
  ), y = f(null, g);
3464
3473
  if (y == null)
3465
3474
  throw new Error("Impossible behavior: rootNode == null");
3466
- return d.set(null, y), g != null && m.set(
3475
+ return d.set(null, y), g != null && h.set(
3467
3476
  null,
3468
3477
  g.map((w) => p.get(w))
3469
3478
  ), {
3470
3479
  idToNode: d,
3471
- idToChildIds: m
3480
+ idToChildIds: h
3472
3481
  };
3473
3482
  }
3474
3483
  const o = (a) => a instanceof HTMLElement ? a.childNodes : null;
3475
3484
  function e(a) {
3476
3485
  return function(l, u) {
3477
3486
  const f = u != null && u.length > 0;
3478
- let d = !1, p = null, m = null;
3487
+ let d = !1, p = null, h = null;
3479
3488
  if (l instanceof HTMLElement) {
3480
- if (p = n.getOrCreateId(l), m = l.tagName.toLowerCase(), d = l.matches(a.cssSelector), !d && !f)
3489
+ if (p = n.getOrCreateId(l), h = l.tagName.toLowerCase(), d = l.matches(a.cssSelector), !d && !f)
3481
3490
  return null;
3482
3491
  } else if (l == null)
3483
- p = null, m = null, d = !1;
3492
+ p = null, h = null, d = !1;
3484
3493
  else
3485
3494
  return null;
3486
3495
  return {
3487
3496
  uid: p,
3488
- tagName: m,
3497
+ tagName: h,
3489
3498
  isMatched: d
3490
3499
  };
3491
3500
  };
@@ -3502,16 +3511,16 @@ function eo() {
3502
3511
  }
3503
3512
  window.__mcp_playwright_tool_tx4byhar35_createDomSnapshotTreeRawDom = i;
3504
3513
  }
3505
- const to = `(function (){function __name(fn){return fn};${eo.toString()}; setupPageGlobals();})()`, Ce = h.object({
3506
- contextName: h.string().optional().describe("Name of previously created context, to use"),
3514
+ const so = `(function (){function __name(fn){return fn};${ro.toString()}; setupPageGlobals();})()`, Ce = m.object({
3515
+ contextName: m.string().optional().describe("Name of previously created context, to use"),
3507
3516
  context: Te.optional().describe(
3508
3517
  "Context creation options JSON to automatically create context"
3509
3518
  ),
3510
- name: h.string().describe(
3519
+ name: m.string().describe(
3511
3520
  "Unique name for the page. Recommended format: kebab-case-1, kebab-case-2, ..."
3512
3521
  )
3513
3522
  });
3514
- async function _t(t, r, s) {
3523
+ async function Gt(t, r, s) {
3515
3524
  let o;
3516
3525
  try {
3517
3526
  o = Ce.parse(t);
@@ -3542,7 +3551,7 @@ async function _t(t, r, s) {
3542
3551
  error: `Context "${n}" not found`
3543
3552
  };
3544
3553
  } else if (i) {
3545
- const f = await Ut(i, r, s);
3554
+ const f = await jt(i, r, s);
3546
3555
  if (f.error != null)
3547
3556
  return {
3548
3557
  error: f.error
@@ -3554,7 +3563,7 @@ async function _t(t, r, s) {
3554
3563
  };
3555
3564
  try {
3556
3565
  const f = await u.context.newPage();
3557
- await f.addInitScript(to), await f.goto("about:blank");
3566
+ await f.addInitScript(so), await f.goto("about:blank");
3558
3567
  const d = {
3559
3568
  contextInfo: u,
3560
3569
  name: e,
@@ -3572,7 +3581,7 @@ async function _t(t, r, s) {
3572
3581
  };
3573
3582
  }
3574
3583
  }
3575
- function ro(t, r) {
3584
+ function oo(t, r) {
3576
3585
  t(
3577
3586
  "playwright-page-create",
3578
3587
  {
@@ -3581,7 +3590,7 @@ function ro(t, r) {
3581
3590
  inputSchema: Ce.shape
3582
3591
  },
3583
3592
  async (s, o) => {
3584
- const e = await _t(s, r, o);
3593
+ const e = await Gt(s, r, o);
3585
3594
  if (e.error != null)
3586
3595
  return `Method: playwright-page-create(${JSON.stringify(s)})
3587
3596
  ❌ Error: ${e.error}`;
@@ -3593,18 +3602,18 @@ function ro(t, r) {
3593
3602
  }
3594
3603
  );
3595
3604
  }
3596
- const Gt = h.object({
3597
- contextName: h.string().optional().describe(
3605
+ const Jt = m.object({
3606
+ contextName: m.string().optional().describe(
3598
3607
  "Name of context to list pages from. If not specified, lists pages from all contexts"
3599
3608
  ),
3600
- browserName: h.string().optional().describe(
3609
+ browserName: m.string().optional().describe(
3601
3610
  "Name of browser to search in. If not specified, searches all browsers"
3602
3611
  )
3603
3612
  });
3604
- async function so(t, r, s) {
3613
+ async function no(t, r, s) {
3605
3614
  let o;
3606
3615
  try {
3607
- o = Gt.parse(t);
3616
+ o = Jt.parse(t);
3608
3617
  } catch (c) {
3609
3618
  return {
3610
3619
  error: F(c)
@@ -3665,16 +3674,16 @@ async function so(t, r, s) {
3665
3674
  pagesByContext: a
3666
3675
  };
3667
3676
  }
3668
- function oo(t, r) {
3677
+ function io(t, r) {
3669
3678
  t(
3670
3679
  "playwright-page-list",
3671
3680
  {
3672
3681
  title: "List Pages",
3673
3682
  description: "List active pages",
3674
- inputSchema: Gt.shape
3683
+ inputSchema: Jt.shape
3675
3684
  },
3676
3685
  async (s, o) => {
3677
- const e = await so(s, r, o);
3686
+ const e = await no(s, r, o);
3678
3687
  if ("error" in e)
3679
3688
  return `Method: playwright-page-list(${JSON.stringify(s)})
3680
3689
  ❌ Error: ${e.error}`;
@@ -3687,19 +3696,19 @@ function oo(t, r) {
3687
3696
  }
3688
3697
  );
3689
3698
  }
3690
- const Jt = h.object({
3691
- names: h.array(h.string()).optional().describe("Names of pages to close. If not specified, closes all pages"),
3692
- contextName: h.string().optional().describe(
3699
+ const Wt = m.object({
3700
+ names: m.array(m.string()).optional().describe("Names of pages to close. If not specified, closes all pages"),
3701
+ contextName: m.string().optional().describe(
3693
3702
  "Name of context to close pages from. If not specified, searches all contexts"
3694
3703
  ),
3695
- browserName: h.string().optional().describe(
3704
+ browserName: m.string().optional().describe(
3696
3705
  "Name of browser to search in. If not specified, searches all browsers"
3697
3706
  )
3698
3707
  });
3699
- async function no(t, r, s) {
3708
+ async function ao(t, r, s) {
3700
3709
  let o;
3701
3710
  try {
3702
- o = Jt.parse(t);
3711
+ o = Wt.parse(t);
3703
3712
  } catch (f) {
3704
3713
  return {
3705
3714
  error: F(f)
@@ -3725,16 +3734,16 @@ async function no(t, r, s) {
3725
3734
  error: `Context "${n}" not found in browser "${f.name}" (${f.browserType})`
3726
3735
  };
3727
3736
  e ? e.forEach((p) => {
3728
- const m = d.pages.get(p);
3729
- m ? u.push(m) : l.push(
3737
+ const h = d.pages.get(p);
3738
+ h ? u.push(h) : l.push(
3730
3739
  `Page "${p}" not found in context "${d.name}" in browser "${f.name}" (${f.browserType})`
3731
3740
  );
3732
3741
  }) : u = Array.from(d.pages.values());
3733
3742
  } else
3734
3743
  for (const d of f.contexts.values())
3735
3744
  e ? e.forEach((p) => {
3736
- const m = d.pages.get(p);
3737
- m ? u.push(m) : l.push(
3745
+ const h = d.pages.get(p);
3746
+ h ? u.push(h) : l.push(
3738
3747
  `Page "${p}" not found in context "${d.name}" in browser "${f.name}" (${f.browserType})`
3739
3748
  );
3740
3749
  }) : u.push(...Array.from(d.pages.values()));
@@ -3742,8 +3751,8 @@ async function no(t, r, s) {
3742
3751
  for (const f of a.browsers.values()) {
3743
3752
  const d = f.contexts.get(n);
3744
3753
  d && (e ? e.forEach((p) => {
3745
- const m = d.pages.get(p);
3746
- m ? u.push(m) : l.push(
3754
+ const h = d.pages.get(p);
3755
+ h ? u.push(h) : l.push(
3747
3756
  `Page "${p}" not found in context "${d.name}" in browser "${f.name}" (${f.browserType})`
3748
3757
  );
3749
3758
  }) : u.push(...Array.from(d.pages.values())));
@@ -3752,8 +3761,8 @@ async function no(t, r, s) {
3752
3761
  for (const f of a.browsers.values())
3753
3762
  for (const d of f.contexts.values())
3754
3763
  e ? e.forEach((p) => {
3755
- const m = d.pages.get(p);
3756
- m ? u.push(m) : l.push(
3764
+ const h = d.pages.get(p);
3765
+ h ? u.push(h) : l.push(
3757
3766
  `Page "${p}" not found in context "${d.name}" in browser "${f.name}" (${f.browserType})`
3758
3767
  );
3759
3768
  }) : u.push(...Array.from(d.pages.values()));
@@ -3774,16 +3783,16 @@ async function no(t, r, s) {
3774
3783
  ...l.length > 0 && { errors: l }
3775
3784
  };
3776
3785
  }
3777
- function io(t, r) {
3786
+ function lo(t, r) {
3778
3787
  t(
3779
3788
  "playwright-page-close",
3780
3789
  {
3781
3790
  title: "Close Pages",
3782
3791
  description: "Close pages",
3783
- inputSchema: Jt.shape
3792
+ inputSchema: Wt.shape
3784
3793
  },
3785
3794
  async (s, o) => {
3786
- const e = await no(s, r, o);
3795
+ const e = await ao(s, r, o);
3787
3796
  if ("error" in e)
3788
3797
  return `Method: playwright-page-close(${JSON.stringify(s)})
3789
3798
  ❌ Error: ${e.error}`;
@@ -3794,14 +3803,14 @@ ${n.join(`
3794
3803
  }
3795
3804
  );
3796
3805
  }
3797
- const Wt = h.object({
3798
- pageName: h.string().optional().describe("Name of previously created page to navigate"),
3806
+ const Kt = m.object({
3807
+ pageName: m.string().optional().describe("Name of previously created page to navigate"),
3799
3808
  page: Ce.optional().describe(
3800
3809
  "Page creation options JSON to automatically create page"
3801
3810
  ),
3802
- url: h.string().describe("URL to navigate to"),
3803
- timeout: h.number().describe("Timeout in seconds"),
3804
- waitUntil: h.enum(["load", "domcontentloaded", "networkidle", "commit"]).describe(
3811
+ url: m.string().describe("URL to navigate to"),
3812
+ timeout: m.number().describe("Timeout in seconds"),
3813
+ waitUntil: m.enum(["load", "domcontentloaded", "networkidle", "commit"]).describe(
3805
3814
  `Wait until event:
3806
3815
  - 'domcontentloaded': DOMContentLoaded event is fired
3807
3816
  - 'load': load event is fired
@@ -3809,13 +3818,13 @@ const Wt = h.object({
3809
3818
  - 'commit': network response received and document started loading`
3810
3819
  )
3811
3820
  });
3812
- async function ao(t, r, s) {
3821
+ async function co(t, r, s) {
3813
3822
  let o;
3814
3823
  try {
3815
- o = Wt.parse(t);
3816
- } catch (m) {
3824
+ o = Kt.parse(t);
3825
+ } catch (h) {
3817
3826
  return {
3818
- error: F(m)
3827
+ error: F(h)
3819
3828
  };
3820
3829
  }
3821
3830
  const { pageName: e, page: n, url: i, timeout: a, waitUntil: c } = o;
@@ -3830,8 +3839,8 @@ async function ao(t, r, s) {
3830
3839
  };
3831
3840
  let u = !1, f = !1, d = !1, p;
3832
3841
  if (e) {
3833
- for (const m of l.browsers.values()) {
3834
- for (const g of m.contexts.values())
3842
+ for (const h of l.browsers.values()) {
3843
+ for (const g of h.contexts.values())
3835
3844
  if (g.pages.has(e)) {
3836
3845
  p = g.pages.get(e);
3837
3846
  break;
@@ -3843,27 +3852,27 @@ async function ao(t, r, s) {
3843
3852
  error: `Page "${e}" not found`
3844
3853
  };
3845
3854
  } else if (n) {
3846
- const m = await _t(n, r, s);
3847
- if (m.error != null)
3855
+ const h = await Gt(n, r, s);
3856
+ if (h.error != null)
3848
3857
  return {
3849
- error: m.error
3858
+ error: h.error
3850
3859
  };
3851
- p = m.pageInfo, u = m.browserInfoCreated, f = m.contextInfoCreated, d = !0;
3860
+ p = h.pageInfo, u = h.browserInfoCreated, f = h.contextInfoCreated, d = !0;
3852
3861
  } else
3853
3862
  return {
3854
3863
  error: "Either pageName or page must be provided"
3855
3864
  };
3856
3865
  try {
3857
- const m = await p.page.goto(i, {
3866
+ const h = await p.page.goto(i, {
3858
3867
  timeout: a * 1e3,
3859
3868
  waitUntil: c
3860
3869
  });
3861
- return m ? {
3870
+ return h ? {
3862
3871
  browserInfoCreated: u,
3863
3872
  contextInfoCreated: f,
3864
3873
  pageInfoCreated: d,
3865
3874
  pageInfo: p,
3866
- status: m.status()
3875
+ status: h.status()
3867
3876
  } : {
3868
3877
  browserInfoCreated: u,
3869
3878
  contextInfoCreated: f,
@@ -3871,22 +3880,22 @@ async function ao(t, r, s) {
3871
3880
  pageInfo: p,
3872
3881
  status: 200
3873
3882
  };
3874
- } catch (m) {
3883
+ } catch (h) {
3875
3884
  return {
3876
- error: `Failed to navigate to "${i}": ${m instanceof Error ? m.message : "Unknown error"}`
3885
+ error: `Failed to navigate to "${i}": ${h instanceof Error ? h.message : "Unknown error"}`
3877
3886
  };
3878
3887
  }
3879
3888
  }
3880
- function lo(t, r) {
3889
+ function uo(t, r) {
3881
3890
  t(
3882
3891
  "playwright-page-goto",
3883
3892
  {
3884
3893
  title: "Navigate Page",
3885
3894
  description: "Navigate page to URL. Use for manual browser interaction",
3886
- inputSchema: Wt.shape
3895
+ inputSchema: Kt.shape
3887
3896
  },
3888
3897
  async (s, o) => {
3889
- const e = await ao(s, r, o);
3898
+ const e = await co(s, r, o);
3890
3899
  if (e.error != null)
3891
3900
  return `Method: playwright-page-goto(${JSON.stringify(s)})
3892
3901
  ❌ Error: ${e.error}`;
@@ -3899,13 +3908,13 @@ function lo(t, r) {
3899
3908
  }
3900
3909
  );
3901
3910
  }
3902
- const ve = h.object({
3903
- name: h.string().describe(
3911
+ const ve = m.object({
3912
+ name: m.string().describe(
3904
3913
  "Unique name for the DOM snapshot query. Recommended format: kebab-case-1, kebab-case-2, ..."
3905
3914
  ),
3906
- cssSelector: h.string().describe("CSS selector to capture page content")
3915
+ cssSelector: m.string().describe("CSS selector to capture page content")
3907
3916
  });
3908
- async function Kt(t, r, s) {
3917
+ async function Ht(t, r, s) {
3909
3918
  let o;
3910
3919
  try {
3911
3920
  o = ve.parse(t);
@@ -3927,7 +3936,7 @@ async function Kt(t, r, s) {
3927
3936
  snapshotQuery: a
3928
3937
  };
3929
3938
  }
3930
- function co(t, r) {
3939
+ function fo(t, r) {
3931
3940
  t(
3932
3941
  "playwright-dom-snapshot-query-create",
3933
3942
  {
@@ -3936,21 +3945,21 @@ function co(t, r) {
3936
3945
  inputSchema: ve.shape
3937
3946
  },
3938
3947
  async (s, o) => {
3939
- const e = await Kt(s, r, o);
3948
+ const e = await Ht(s, r, o);
3940
3949
  return e.error != null ? `Method: playwright-dom-snapshot-query-create(${JSON.stringify(s)})
3941
3950
  ❌ Error: ${e.error}` : `Method: playwright-dom-snapshot-query-create(${JSON.stringify(s)})
3942
3951
  ✅ DOM snapshot query "${e.snapshotQuery.name}" created successfully`;
3943
3952
  }
3944
3953
  );
3945
3954
  }
3946
- function uo(t) {
3955
+ function po(t) {
3947
3956
  return function(s, o) {
3948
3957
  let e, n = 0;
3949
3958
  const i = o ? o.length : 0;
3950
3959
  let a = 1, c = 0, l = 0, u, f;
3951
3960
  if (o)
3952
- for (let m = 0; m < o.length; m++) {
3953
- const g = o[m];
3961
+ for (let h = 0; h < o.length; h++) {
3962
+ const g = o[h];
3954
3963
  n += g.countMatched, a += g.countTotal, c += g.tokens, l += g.tokensTotal;
3955
3964
  }
3956
3965
  s ? (u = s.uid, f = s.tagName, e = s.isMatched, e && (n += 1)) : (u = null, f = null, e = !1);
@@ -3964,7 +3973,7 @@ function uo(t) {
3964
3973
  textOpen: `<root uid:${u}>`,
3965
3974
  textClose: "</root>"
3966
3975
  };
3967
- const p = Et(d);
3976
+ const p = Nt(d);
3968
3977
  return l += p, {
3969
3978
  uid: u,
3970
3979
  tagName: f,
@@ -3979,8 +3988,8 @@ function uo(t) {
3979
3988
  };
3980
3989
  };
3981
3990
  }
3982
- function fo(t, r) {
3983
- const s = le(r), o = s.getChilds(s.root), e = vt({
3991
+ function ho(t, r) {
3992
+ const s = le(r), o = s.getChilds(s.root), e = Et({
3984
3993
  getId: (n) => {
3985
3994
  const i = s.getId(n);
3986
3995
  if (i == null)
@@ -3990,22 +3999,22 @@ function fo(t, r) {
3990
3999
  return i;
3991
4000
  },
3992
4001
  getChilds: (n) => s.getChilds(n),
3993
- createSnapshotNode: uo(),
4002
+ createSnapshotNode: po(),
3994
4003
  rootNodes: o ?? []
3995
4004
  });
3996
4005
  return le(e);
3997
4006
  }
3998
- const Ee = h.object({
3999
- pageName: h.string().describe("Name of previously created page, to create snapshot from"),
4000
- queryName: h.string().optional().describe("Name of previously created DOM snapshot query, to use"),
4007
+ const Ee = m.object({
4008
+ pageName: m.string().describe("Name of previously created page, to create snapshot from"),
4009
+ queryName: m.string().optional().describe("Name of previously created DOM snapshot query, to use"),
4001
4010
  query: ve.optional().describe(
4002
4011
  "DOM snapshot query creation options JSON to automatically create query"
4003
4012
  ),
4004
- name: h.string().describe(
4013
+ name: m.string().describe(
4005
4014
  "Unique name for the DOM snapshot. Recommended format: kebab-case-1, kebab-case-2, ..."
4006
4015
  )
4007
4016
  });
4008
- async function Ht(t, r, s) {
4017
+ async function Qt(t, r, s) {
4009
4018
  let o;
4010
4019
  try {
4011
4020
  o = Ee.parse(t);
@@ -4046,7 +4055,7 @@ async function Ht(t, r, s) {
4046
4055
  };
4047
4056
  u = d;
4048
4057
  } else if (i) {
4049
- const d = await Kt(
4058
+ const d = await Ht(
4050
4059
  i,
4051
4060
  r,
4052
4061
  s
@@ -4076,10 +4085,10 @@ async function Ht(t, r, s) {
4076
4085
  ), p = {
4077
4086
  idToNode: new Map(d.idToNode),
4078
4087
  idToChildIds: new Map(d.idToChildIds)
4079
- }, m = fo(u, p), g = {
4088
+ }, h = ho(u, p), g = {
4080
4089
  name: a,
4081
4090
  query: u,
4082
- tree: m
4091
+ tree: h
4083
4092
  };
4084
4093
  return l.domSnapshots.set(a, g), {
4085
4094
  domSnapshot: g,
@@ -4091,7 +4100,7 @@ async function Ht(t, r, s) {
4091
4100
  };
4092
4101
  }
4093
4102
  }
4094
- function po(t, r) {
4103
+ function mo(t, r) {
4095
4104
  t(
4096
4105
  "playwright-dom-snapshot-create",
4097
4106
  {
@@ -4100,7 +4109,7 @@ function po(t, r) {
4100
4109
  inputSchema: Ee.shape
4101
4110
  },
4102
4111
  async (s, o) => {
4103
- const e = await Ht(s, r, o);
4112
+ const e = await Qt(s, r, o);
4104
4113
  if (e.error != null)
4105
4114
  return `Method: playwright-dom-snapshot-create(${JSON.stringify(s)})
4106
4115
  ❌ Error: ${e.error}`;
@@ -4111,7 +4120,7 @@ function po(t, r) {
4111
4120
  }
4112
4121
  );
4113
4122
  }
4114
- class ho {
4123
+ class go {
4115
4124
  tokens = 20;
4116
4125
  getReportText = (r) => ({
4117
4126
  indent: !0,
@@ -4125,14 +4134,14 @@ class ho {
4125
4134
  tokensGrouped: s.tokens
4126
4135
  } : (r.indexRange[1] = o, r.countGrouped += 1, r.countMatched += s.countMatched, r.tokensGrouped += s.tokens, r);
4127
4136
  }
4128
- const Qt = h.object({
4129
- snapshotName: h.string().optional().describe("Name of previously created DOM snapshot, to use"),
4137
+ const Yt = m.object({
4138
+ snapshotName: m.string().optional().describe("Name of previously created DOM snapshot, to use"),
4130
4139
  snapshot: Ee.optional().describe(
4131
4140
  "DOM snapshot creation options JSON to automatically create snapshot"
4132
4141
  ),
4133
- parentUid: h.number().optional().describe("UID of parent node to browse. Omit to browse the root node"),
4134
- childsIndexRange: h.tuple([h.number(), h.number()]).optional().describe(
4135
- "Child index range to show [start, end]. Only use the exact ranges that appeared in previous snapshot results - do not modify, combine, or split them"
4142
+ parentUid: m.number().optional().describe("UID of parent node to browse. Omit to browse the root node"),
4143
+ childsIndexRange: ft.optional().describe(
4144
+ "Child index range to show. Only use the exact ranges that appeared in previous snapshot results - do not modify, combine, or split them"
4136
4145
  )
4137
4146
  // maxCountTotal: z
4138
4147
  // .number()
@@ -4145,10 +4154,10 @@ const Qt = h.object({
4145
4154
  // maxCountGroup: z.number().default(10).describe('Maximum items per group'),
4146
4155
  // maxTokensGroup: z.number().default(1000).describe('Maximum tokens per group'),
4147
4156
  });
4148
- async function mo(t, r, s) {
4157
+ async function wo(t, r, s) {
4149
4158
  let o;
4150
4159
  try {
4151
- o = Qt.parse(t);
4160
+ o = Yt.parse(t);
4152
4161
  } catch (g) {
4153
4162
  return {
4154
4163
  error: F(g)
@@ -4156,13 +4165,12 @@ async function mo(t, r, s) {
4156
4165
  }
4157
4166
  const {
4158
4167
  snapshotName: e,
4159
- snapshot: n,
4160
- childsIndexRange: i
4168
+ snapshot: n
4161
4169
  // maxCountTotal,
4162
4170
  // maxTokensTotal,
4163
4171
  // maxCountGroup,
4164
4172
  // maxTokensGroup,
4165
- } = o, a = 60, c = 1e3, l = 25, u = 900;
4173
+ } = o, i = o.childsIndexRange?.from != null && o.childsIndexRange?.to != null ? [o.childsIndexRange.from, o.childsIndexRange.to] : null, a = 60, c = 1e3, l = 25, u = 900;
4166
4174
  if (!s.sessionId)
4167
4175
  return {
4168
4176
  error: "Session ID is required"
@@ -4172,7 +4180,7 @@ async function mo(t, r, s) {
4172
4180
  return {
4173
4181
  error: "Either snapshotName or snapshot must be provided, not both"
4174
4182
  };
4175
- let d, p = !1, m = !1;
4183
+ let d, p = !1, h = !1;
4176
4184
  if (e) {
4177
4185
  for (const g of f.browsers.values()) {
4178
4186
  for (const y of g.contexts.values()) {
@@ -4190,7 +4198,7 @@ async function mo(t, r, s) {
4190
4198
  error: `DOM snapshot "${e}" not found`
4191
4199
  };
4192
4200
  } else if (n) {
4193
- const g = await Ht(
4201
+ const g = await Qt(
4194
4202
  n,
4195
4203
  r,
4196
4204
  s
@@ -4199,13 +4207,13 @@ async function mo(t, r, s) {
4199
4207
  return {
4200
4208
  error: g.error
4201
4209
  };
4202
- d = g.domSnapshot, p = g.queryCreated, m = !0;
4210
+ d = g.domSnapshot, p = g.queryCreated, h = !0;
4203
4211
  } else
4204
4212
  return {
4205
4213
  error: "Either snapshotName or snapshot must be provided"
4206
4214
  };
4207
4215
  try {
4208
- const g = o.parentUid, y = Nt({
4216
+ const g = o.parentUid, y = kt({
4209
4217
  tree: d.tree,
4210
4218
  request: {
4211
4219
  parentNodeId: g,
@@ -4217,12 +4225,12 @@ async function mo(t, r, s) {
4217
4225
  maxTokensGroup: u
4218
4226
  }
4219
4227
  },
4220
- indexRangeGroupStrategy: new ho()
4221
- }), w = kt(y);
4228
+ indexRangeGroupStrategy: new go()
4229
+ }), w = Ot(y);
4222
4230
  return {
4223
4231
  domSnapshot: d,
4224
4232
  queryCreated: p,
4225
- snapshotCreated: m,
4233
+ snapshotCreated: h,
4226
4234
  parentUid: g,
4227
4235
  childsIndexRange: i,
4228
4236
  report: w
@@ -4233,16 +4241,16 @@ async function mo(t, r, s) {
4233
4241
  };
4234
4242
  }
4235
4243
  }
4236
- function go(t, r) {
4244
+ function yo(t, r) {
4237
4245
  t(
4238
4246
  "playwright-dom-snapshot-browse",
4239
4247
  {
4240
4248
  title: "Browse DOM Snapshot",
4241
4249
  description: "Browse and explore DOM. Use this to browse, analyze, explore, inspect, etc webpage structure and styles, find elements, or inspect page content",
4242
- inputSchema: Qt.shape
4250
+ inputSchema: Yt.shape
4243
4251
  },
4244
4252
  async (s, o) => {
4245
- const e = await mo(s, r, o);
4253
+ const e = await wo(s, r, o);
4246
4254
  if (e.error != null)
4247
4255
  return `Method: playwright-dom-snapshot-browse(${JSON.stringify(s)})
4248
4256
  ❌ Error: ${e.error}`;
@@ -4263,10 +4271,10 @@ ${e.report}`, n;
4263
4271
  }
4264
4272
  );
4265
4273
  }
4266
- function wo(t, r) {
4267
- r.browserCreate && Gs(t, r), r.browserList && Ws(t, r), r.browserClose && Hs(t, r), r.contextCreate && Qs(t, r), r.contextList && Vs(t, r), r.contextClose && Xs(t, r), r.pageCreate && ro(t, r), r.pageList && oo(t, r), r.pageClose && io(t, r), r.pageGoto && lo(t, r), r.domSnapshotQueryCreate && co(t, r), r.domSnapshotCreate && po(t, r), r.domSnapshotBrowse && go(t, r), console.log("Playwright manager");
4274
+ function bo(t, r) {
4275
+ r.browserCreate && Ws(t, r), r.browserList && Hs(t, r), r.browserClose && Ys(t, r), r.contextCreate && Vs(t, r), r.contextList && Xs(t, r), r.contextClose && to(t, r), r.pageCreate && oo(t, r), r.pageList && io(t, r), r.pageClose && lo(t, r), r.pageGoto && uo(t, r), r.domSnapshotQueryCreate && fo(t, r), r.domSnapshotCreate && mo(t, r), r.domSnapshotBrowse && yo(t, r), console.log("Playwright manager");
4268
4276
  }
4269
- function yo(t) {
4277
+ function So(t) {
4270
4278
  const { logFilePath: r } = t;
4271
4279
  return async function(o, e, n, i) {
4272
4280
  await ie({
@@ -4293,7 +4301,7 @@ const it = [
4293
4301
  "flemist-mcp.config.json5",
4294
4302
  "flemist-mcp.config.yaml"
4295
4303
  ];
4296
- async function bo(t) {
4304
+ async function xo(t) {
4297
4305
  const r = k.resolve(t);
4298
4306
  for (let s = 0, o = it.length; s < o; s++) {
4299
4307
  const e = it[s], n = k.join(r, e);
@@ -4318,7 +4326,7 @@ ${c instanceof Error ? c.message : String(c)}`);
4318
4326
  if (a === ".json5")
4319
4327
  return Ne.parse(i);
4320
4328
  if (a === ".yaml")
4321
- return dr.load(i);
4329
+ return fr.load(i);
4322
4330
  } catch (c) {
4323
4331
  throw new Error(`MCP Error: Failed to parse config file: ${n}
4324
4332
 
@@ -4332,7 +4340,7 @@ Expected one of:
4332
4340
  - flemist-mcp.config.json5
4333
4341
  - flemist-mcp.config.yaml`);
4334
4342
  }
4335
- const So = {
4343
+ const $o = {
4336
4344
  logDir: "tmp/mcp-project-tools/logs",
4337
4345
  tools: {
4338
4346
  processManager: {
@@ -4373,8 +4381,8 @@ const So = {
4373
4381
  }
4374
4382
  }
4375
4383
  };
4376
- async function xo(t) {
4377
- const r = k.resolve(t), s = await bo(r), o = k.join(r, ".flemist-mcpignore");
4384
+ async function Io(t) {
4385
+ const r = k.resolve(t), s = await xo(r), o = k.join(r, ".flemist-mcpignore");
4378
4386
  try {
4379
4387
  await j.promises.stat(o);
4380
4388
  } catch {
@@ -4384,7 +4392,7 @@ Create .flemist-mcpignore file in: ${r}
4384
4392
 
4385
4393
  This file contains glob patterns for files/directories to exclude from MCP operations.`);
4386
4394
  }
4387
- const e = ur(So, s, {
4395
+ const e = dr($o, s, {
4388
4396
  arrayMerge(n, i) {
4389
4397
  return i;
4390
4398
  }
@@ -4406,25 +4414,25 @@ This file contains glob patterns for files/directories to exclude from MCP opera
4406
4414
  n.valueType === "file-contains-patterns" && (a[i].value = k.resolve(r, n.value));
4407
4415
  }), e.logDir = k.resolve(r, e.logDir), e;
4408
4416
  }
4409
- function Yt() {
4417
+ function Vt() {
4410
4418
  return `mcp_${(/* @__PURE__ */ new Date()).toISOString().substring(0, 19).replace(/T/, "_").replace(/:/g, "-")}.log`;
4411
4419
  }
4412
- function $o(t) {
4413
- const r = ne(), s = Io();
4420
+ function Mo(t) {
4421
+ const r = ne(), s = To();
4414
4422
  return r.use(s), r;
4415
4423
  }
4416
- function Io(t) {
4424
+ function To(t) {
4417
4425
  const r = ne.Router();
4418
4426
  return r.use((s, o, e) => {
4419
4427
  s.method === "OPTIONS" ? o.status(403).send("CORS forbidden") : e();
4420
4428
  }), r.use(ne.json()), r;
4421
4429
  }
4422
- function Mo(t) {
4430
+ function Co(t) {
4423
4431
  const r = ne.Router();
4424
- return r.use(fr({ authToken: t.authToken })), r.all("/mcp", wr(t)), r;
4432
+ return r.use(pr({ authToken: t.authToken })), r.all("/mcp", yr(t)), r;
4425
4433
  }
4426
- function To(t, r) {
4427
- return t.use(yo({ logFilePath: r.logFilePath })), new Promise((s, o) => {
4434
+ function vo(t, r) {
4435
+ return t.use(So({ logFilePath: r.logFilePath })), new Promise((s, o) => {
4428
4436
  let e;
4429
4437
  const n = () => {
4430
4438
  s(e);
@@ -4438,7 +4446,7 @@ function To(t, r) {
4438
4446
  }
4439
4447
  });
4440
4448
  }
4441
- function Co(t, r) {
4449
+ function Eo(t, r) {
4442
4450
  if (!t.address())
4443
4451
  throw new Error(
4444
4452
  "Server address is not available. Check your DNS and host configuration."
@@ -4456,20 +4464,20 @@ SSE Endpoint: ${i}/sse
4456
4464
 
4457
4465
  Log File: ${k.resolve(r.logFilePath)}`;
4458
4466
  }
4459
- function vo(t, r) {
4460
- const s = k.join(r.logDir, Yt()), o = _r(t, {
4467
+ function No(t, r) {
4468
+ const s = k.join(r.logDir, Vt()), o = Jr(t, {
4461
4469
  logFilePath: s
4462
4470
  });
4463
- r.tools.processManager && qr(
4471
+ r.tools.processManager && Gr(
4464
4472
  o,
4465
4473
  r.tools.processManager
4466
- ), r.tools.fsManager && _s(o, r.tools.fsManager), r.tools.playwrightManager && wo(
4474
+ ), r.tools.fsManager && Js(o, r.tools.fsManager), r.tools.playwrightManager && bo(
4467
4475
  o,
4468
4476
  r.tools.playwrightManager
4469
- ), Dr(o);
4477
+ ), Pr(o);
4470
4478
  }
4471
- async function Ho(t) {
4472
- const r = k.join(t.logDir, Yt()), s = $o(), o = Mo({
4479
+ async function Yo(t) {
4480
+ const r = k.join(t.logDir, Vt()), s = Mo(), o = Co({
4473
4481
  authToken: t.authToken,
4474
4482
  logFilePath: r,
4475
4483
  createMcpServer: async (n) => {
@@ -4492,22 +4500,22 @@ X-Project-Name header is missing. To configure MCP for this project:
4492
4500
  Ask user to:
4493
4501
  1. Add project to server's projects config: projects: { "${i}": "<project-path>" }
4494
4502
  2. Restart MCP server`);
4495
- const c = await xo(a), l = new Vt({
4503
+ const c = await Io(a), l = new Zt({
4496
4504
  title: t.title,
4497
4505
  name: t.name,
4498
4506
  version: t.version
4499
4507
  });
4500
- return vo(l, c), l;
4508
+ return No(l, c), l;
4501
4509
  }
4502
4510
  });
4503
4511
  s.use(o);
4504
- const e = await To(s, {
4512
+ const e = await vo(s, {
4505
4513
  host: t.host,
4506
4514
  port: t.port,
4507
4515
  logFilePath: r
4508
4516
  });
4509
4517
  return console.log(
4510
- Co(e, {
4518
+ Eo(e, {
4511
4519
  title: t.title,
4512
4520
  name: t.name,
4513
4521
  version: t.version,
@@ -4516,11 +4524,11 @@ Ask user to:
4516
4524
  ), e;
4517
4525
  }
4518
4526
  export {
4519
- Ko as A,
4520
- Wo as S,
4521
- Jo as a,
4522
- Go as b,
4523
- bo as l,
4524
- ts as p,
4525
- Ho as s
4527
+ Qo as A,
4528
+ Ho as S,
4529
+ Ko as a,
4530
+ Wo as b,
4531
+ xo as l,
4532
+ ss as p,
4533
+ Yo as s
4526
4534
  };