@flemist/mcp-project-tools 4.0.3 → 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,43 +152,55 @@ 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);
163
163
  if (i !== a) {
164
164
  const l = at(t, e);
165
- for (const [u, f] of Object.entries(process.env))
166
- f != null && (l.lastIndex = 0, l.test(f) ? s === "replaceServerPaths" && (n[u] = Mr(f, t, r, e)) : n[u] = f);
165
+ for (const u in process.env) {
166
+ if (!Object.prototype.hasOwnProperty.call(process.env, u)) continue;
167
+ const f = process.env[u];
168
+ f != null && (l.lastIndex = 0, l.test(f) ? s === "replaceServerPaths" && (n[u] = Tr(f, t, r, e)) : n[u] = f);
169
+ }
167
170
  } else
168
- for (const [l, u] of Object.entries(process.env))
171
+ for (const l in process.env) {
172
+ if (!Object.prototype.hasOwnProperty.call(process.env, l)) continue;
173
+ const u = process.env[l];
169
174
  u != null && (n[l] = u);
175
+ }
170
176
  } else
171
- for (const [i, a] of Object.entries(process.env))
177
+ for (const i in process.env) {
178
+ if (!Object.prototype.hasOwnProperty.call(process.env, i)) continue;
179
+ const a = process.env[i];
172
180
  a != null && (n[i] = a);
181
+ }
173
182
  if (o)
174
- for (const [i, a] of Object.entries(o))
183
+ for (const i in o) {
184
+ if (!Object.prototype.hasOwnProperty.call(o, i)) continue;
185
+ const a = o[i];
175
186
  a === null ? delete n[i] : n[i] = a;
187
+ }
176
188
  return n;
177
189
  }
178
190
  function Fe(t, r) {
179
191
  const s = k.normalize(t).replace(/[\\/]+$/, "");
180
192
  return r ? s.toLowerCase() : s;
181
193
  }
182
- const Cr = 1800 * 1e3, Be = /* @__PURE__ */ new Map();
183
- let vr = 0;
184
- function Er() {
185
- return ++vr;
194
+ const vr = 1800 * 1e3, Pe = /* @__PURE__ */ new Map();
195
+ let Er = 0;
196
+ function Nr() {
197
+ return ++Er;
186
198
  }
187
199
  function lt(t) {
188
- let r = Be.get(t);
200
+ let r = Pe.get(t);
189
201
  return r == null && (r = {
190
202
  storedOutputs: /* @__PURE__ */ new Map()
191
- }, Be.set(t, r)), r;
203
+ }, Pe.set(t, r)), r;
192
204
  }
193
205
  function ct(t) {
194
206
  return typeof t == "function" ? t() : t;
@@ -196,13 +208,13 @@ function ct(t) {
196
208
  function ut(t, r) {
197
209
  return setTimeout(() => {
198
210
  t.storedOutputs.delete(r);
199
- }, Cr);
211
+ }, vr);
200
212
  }
201
- function Nr(t, r, s) {
213
+ function kr(t, r, s) {
202
214
  clearTimeout(s.cleanupTimer), s.cleanupTimer = ut(t, r);
203
215
  }
204
- function kr(t) {
205
- 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 = {
206
218
  source: s,
207
219
  cleanupTimer: ut(o, e)
208
220
  };
@@ -217,7 +229,7 @@ function dt(t) {
217
229
  range: [0, 0],
218
230
  error: `Stored output with outputId=${s} not found or expired`
219
231
  };
220
- Nr(i, s, a);
232
+ kr(i, s, a);
221
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);
222
234
  return { content: c.substring(u, f), total: l, range: [u, f] };
223
235
  }
@@ -225,7 +237,7 @@ function we(t) {
225
237
  const { sessionId: r, source: s, limit: o } = t, e = ct(s);
226
238
  if (e.length <= o)
227
239
  return { content: e, outputId: null };
228
- const n = kr({ sessionId: r, source: s }), i = dt({
240
+ const n = Or({ sessionId: r, source: s }), i = dt({
229
241
  sessionId: r,
230
242
  outputId: n,
231
243
  range: [0, o]
@@ -241,16 +253,22 @@ function F(t) {
241
253
 
242
254
  Provide valid parameters according to schema.`;
243
255
  }
244
- const ft = h.object({
245
- outputId: h.number().int().describe("Output ID from truncation message"),
246
- range: h.tuple([h.number().int().min(0), h.number().int().min(0)]).describe(
247
- `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}.`
248
266
  )
249
267
  });
250
- function Or(t, r) {
268
+ function Dr(t, r) {
251
269
  let s;
252
270
  try {
253
- s = ft.parse(t);
271
+ s = pt.parse(t);
254
272
  } catch (i) {
255
273
  return {
256
274
  error: F(i)
@@ -260,7 +278,7 @@ function Or(t, r) {
260
278
  return {
261
279
  error: "Session ID is required"
262
280
  };
263
- const [o, e] = s.range;
281
+ const { from: o, toExclusive: e } = s.range;
264
282
  if (e <= o)
265
283
  return {
266
284
  error: `Invalid range: to (${e}) must be greater than from (${o})`
@@ -272,20 +290,24 @@ function Or(t, r) {
272
290
  const n = dt({
273
291
  sessionId: r.sessionId,
274
292
  outputId: s.outputId,
275
- range: s.range
293
+ range: [o, e]
276
294
  });
277
- 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
+ };
278
300
  }
279
- function Rr(t) {
301
+ function Fr(t) {
280
302
  t(
281
303
  "output-read",
282
304
  {
283
305
  title: "Read Stored Output Range",
284
306
  description: "Read any range from stored output. Use outputId from truncation message and specify character range [from, to).",
285
- inputSchema: ft.shape
307
+ inputSchema: pt.shape
286
308
  },
287
309
  async (r, s) => {
288
- const o = Or(r, s);
310
+ const o = Dr(r, s);
289
311
  if (o.error != null)
290
312
  return `Method: output-read(${JSON.stringify(r)})
291
313
  ❌ Error: ${o.error}`;
@@ -299,14 +321,14 @@ ${o.content}`, a;
299
321
  }
300
322
  );
301
323
  }
302
- function Dr(t) {
303
- Rr(t);
324
+ function Pr(t) {
325
+ Fr(t);
304
326
  }
305
- const pt = h.object({
306
- id: h.number().describe(
327
+ const ht = m.object({
328
+ id: m.number().describe(
307
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"
308
330
  ),
309
- outputLimit: h.number().int().min(0).max(J).default(Q).describe(
331
+ outputLimit: m.number().int().min(0).max(J).default(Q).describe(
310
332
  `Maximum output characters to return. Truncated output can be retrieved via output-read tool using outputId from truncation message. Maximum: ${J}. Default: ${Q}`
311
333
  )
312
334
  });
@@ -314,7 +336,7 @@ async function ye(t, r, s) {
314
336
  ge();
315
337
  let o;
316
338
  try {
317
- o = pt.parse(t);
339
+ o = ht.parse(t);
318
340
  } catch (c) {
319
341
  return {
320
342
  error: F(c)
@@ -347,13 +369,13 @@ async function ye(t, r, s) {
347
369
  error: i.error
348
370
  };
349
371
  }
350
- function Fr(t, r) {
372
+ function Br(t, r) {
351
373
  t(
352
374
  "process-status",
353
375
  {
354
376
  title: "Get Host Machine Process Status",
355
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",
356
- inputSchema: pt.shape
378
+ inputSchema: ht.shape
357
379
  },
358
380
  async (s, o) => {
359
381
  const e = await ye(s, r, o);
@@ -369,36 +391,36 @@ ${n.trim()}`;
369
391
  }
370
392
  );
371
393
  }
372
- function ht(t) {
394
+ function mt(t) {
373
395
  he(t, "SIGTERM", (r) => {
374
396
  r && !r.message.includes("not found") && console.error(`Error sending SIGTERM to process ${t}:`, r);
375
397
  }), setTimeout(() => {
376
398
  he(t, "SIGKILL", (r) => {
377
399
  r && !r.message.includes("not found") && console.error(`Error sending SIGKILL to process ${t}:`, r);
378
400
  });
379
- }, Sr);
401
+ }, xr);
380
402
  }
381
- const mt = h.object({
382
- id: h.number().describe(
403
+ const gt = m.object({
404
+ id: m.number().describe(
383
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"
384
406
  ),
385
- waitTime: h.number().optional().describe(
407
+ waitTime: m.number().optional().describe(
386
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)"
387
409
  ),
388
- autoKill: h.boolean().default(!1).describe(
410
+ autoKill: m.boolean().default(!1).describe(
389
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"
390
412
  ),
391
- outputLimit: h.number().int().min(0).max(J).default(Q).describe(
413
+ outputLimit: m.number().int().min(0).max(J).default(Q).describe(
392
414
  `Maximum output characters to return. Truncated output can be retrieved via output-read tool using outputId from truncation message. Maximum: ${J}. Default: ${Q}`
393
415
  )
394
416
  });
395
- async function gt(t, r, s) {
417
+ async function wt(t, r, s) {
396
418
  let o;
397
419
  try {
398
- o = mt.parse(t);
399
- } catch (m) {
420
+ o = gt.parse(t);
421
+ } catch (h) {
400
422
  return {
401
- error: F(m)
423
+ error: F(h)
402
424
  };
403
425
  }
404
426
  const { id: e, waitTime: n, autoKill: i, outputLimit: a } = o, c = Y.get(e);
@@ -410,7 +432,7 @@ async function gt(t, r, s) {
410
432
  let u = !1, f = !1;
411
433
  n != null && await new Promise((g) => {
412
434
  const y = setInterval(() => {
413
- 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());
414
436
  }, 100);
415
437
  });
416
438
  const d = (Date.now() - l) / 1e3;
@@ -421,16 +443,16 @@ async function gt(t, r, s) {
421
443
  autoKillExecuted: f
422
444
  };
423
445
  }
424
- function Br(t, r) {
446
+ function Lr(t, r) {
425
447
  t(
426
448
  "process-wait",
427
449
  {
428
450
  title: "Wait for Host Machine Process",
429
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",
430
- inputSchema: mt.shape
452
+ inputSchema: gt.shape
431
453
  },
432
454
  async (s, o) => {
433
- const e = await gt(s, r, o);
455
+ const e = await wt(s, r, o);
434
456
  if (!("output" in e))
435
457
  return `Method: process-wait(${JSON.stringify(s)})
436
458
  ❌ Error: ${e.error}`;
@@ -456,31 +478,31 @@ function be(t, r) {
456
478
  error: `Path "${r}" escapes root directory "${t}". Resolved path: "${o}"`
457
479
  } : { path: o };
458
480
  }
459
- const wt = h.object({
460
- relativeRootDir: h.string().optional().describe(
481
+ const yt = m.object({
482
+ relativeRootDir: m.string().optional().describe(
461
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'
462
484
  ),
463
- commandLine: h.string().describe(
485
+ commandLine: m.string().describe(
464
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'
465
487
  ),
466
- waitTime: h.number().optional().describe(
488
+ waitTime: m.number().optional().describe(
467
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)"
468
490
  ),
469
- autoKill: h.boolean().default(!1).describe(
491
+ autoKill: m.boolean().default(!1).describe(
470
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"
471
493
  ),
472
- outputLimit: h.number().int().min(0).max(J).default(Q).describe(
494
+ outputLimit: m.number().int().min(0).max(J).default(Q).describe(
473
495
  `Maximum output characters to return. Truncated output can be retrieved via output-read tool using outputId from truncation message. Maximum: ${J}. Default: ${Q}`
474
496
  )
475
497
  });
476
- async function Lr(t, r, s) {
498
+ async function Ar(t, r, s) {
477
499
  ge();
478
500
  let o;
479
501
  try {
480
- o = wt.parse(t);
481
- } catch (m) {
502
+ o = yt.parse(t);
503
+ } catch (h) {
482
504
  return {
483
- error: F(m)
505
+ error: F(h)
484
506
  };
485
507
  }
486
508
  const { commandLine: e, waitTime: n, autoKill: i, outputLimit: a } = o, { commandLineRules: c } = r, l = be(
@@ -490,25 +512,25 @@ async function Lr(t, r, s) {
490
512
  if ("error" in l)
491
513
  return { error: l.error };
492
514
  const u = l.path;
493
- if (!xr({ commandLine: e, commandLineRules: c })) {
494
- const m = c.map(
515
+ if (!$r({ commandLine: e, commandLineRules: c })) {
516
+ const h = c.map(
495
517
  (g) => `${g.rule.toUpperCase()}: /${g.regexp}/ (${g.note})`
496
518
  ).join(`
497
519
  `);
498
520
  return {
499
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:
500
- ${m}
522
+ ${h}
501
523
 
502
524
  To use this command line, ask the user to modify the command line rules in the configuration.`
503
525
  };
504
526
  }
505
527
  if (Array.from(Y.values()).filter(
506
- (m) => m.isRunning
528
+ (h) => h.isRunning
507
529
  ).length >= ke)
508
530
  return {
509
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.`
510
532
  };
511
- const d = $r(), p = {
533
+ const d = Ir(), p = {
512
534
  id: d,
513
535
  cwd: u,
514
536
  commandLine: e,
@@ -518,15 +540,15 @@ To use this command line, ask the user to modify the command line rules in the c
518
540
  };
519
541
  Y.set(d, p);
520
542
  try {
521
- const m = Tr(
543
+ const h = Cr(
522
544
  process.cwd(),
523
545
  u,
524
- r.envCleanup ?? null,
546
+ r.envCleanup ?? "deleteServerPaths",
525
547
  r.env
526
- ), g = er(e, [], {
548
+ ), g = tr(e, [], {
527
549
  shell: !0,
528
550
  cwd: u,
529
- env: m,
551
+ env: h,
530
552
  stdio: ["pipe", "pipe", "pipe"]
531
553
  });
532
554
  p.pid = g.pid;
@@ -538,16 +560,16 @@ To use this command line, ask the user to modify the command line rules in the c
538
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}`);
539
561
  }), g.on("error", (w) => {
540
562
  p.isRunning = !1, p.endTime = /* @__PURE__ */ new Date(), p.error = w.message, console.error(`Process ${d} error:`, w.message);
541
- }), n != null ? gt(
563
+ }), n != null ? wt(
542
564
  { id: d, waitTime: n, autoKill: i, outputLimit: a },
543
565
  r,
544
566
  s
545
567
  ) : ye({ id: d, outputLimit: a }, r, s);
546
- } catch (m) {
547
- 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 };
548
570
  }
549
571
  }
550
- function Pr(t, r) {
572
+ function zr(t, r) {
551
573
  const s = r.commandLineRules.map((o) => `${o.rule.toUpperCase()}: ${o.regexp} (${o.note})`).join(`
552
574
  `);
553
575
  t(
@@ -556,10 +578,10 @@ function Pr(t, r) {
556
578
  title: "Execute Command Line on Host Machine",
557
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:
558
580
  ${s}`,
559
- inputSchema: wt.shape
581
+ inputSchema: yt.shape
560
582
  },
561
583
  async (o, e) => {
562
- const n = await Lr(o, r, e);
584
+ const n = await Ar(o, r, e);
563
585
  if (!("output" in n))
564
586
  return `Method: process-run(${JSON.stringify(o)})
565
587
  ❌ Error: ${n.error}`;
@@ -572,25 +594,25 @@ ${i.trim()}`;
572
594
  }
573
595
  );
574
596
  }
575
- const yt = h.object({
576
- minOpenDateTime: h.string().optional().describe(
597
+ const bt = m.object({
598
+ minOpenDateTime: m.string().optional().describe(
577
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'
578
600
  ),
579
- minCloseDateTime: h.string().optional().describe(
601
+ minCloseDateTime: m.string().optional().describe(
580
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'
581
603
  ),
582
- activeOnly: h.boolean().default(!1).describe(
604
+ activeOnly: m.boolean().default(!1).describe(
583
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)"
584
606
  ),
585
- fields: h.array(h.string()).optional().describe(
607
+ fields: m.array(m.string()).optional().describe(
586
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'
587
609
  )
588
610
  });
589
- async function Ar(t, r) {
611
+ async function Ur(t, r) {
590
612
  ge();
591
613
  let s;
592
614
  try {
593
- s = yt.parse(t);
615
+ s = bt.parse(t);
594
616
  } catch (l) {
595
617
  return {
596
618
  error: F(l)
@@ -629,16 +651,16 @@ async function Ar(t, r) {
629
651
  return u;
630
652
  }) };
631
653
  }
632
- function zr(t, r) {
654
+ function jr(t, r) {
633
655
  t(
634
656
  "process-list",
635
657
  {
636
658
  title: "List Host Machine Processes",
637
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",
638
- inputSchema: yt.shape
660
+ inputSchema: bt.shape
639
661
  },
640
662
  async (s) => {
641
- const o = await Ar(s, r);
663
+ const o = await Ur(s, r);
642
664
  if (o.error != null)
643
665
  return `Method: process-list(${JSON.stringify(s)})
644
666
  ❌ Error: ${o.error}`;
@@ -652,15 +674,15 @@ ${e}`;
652
674
  }
653
675
  );
654
676
  }
655
- const bt = h.object({
656
- id: h.number().describe(
677
+ const St = m.object({
678
+ id: m.number().describe(
657
679
  "Process ID of the process to terminate. Get process IDs using process-list. The process must be currently running. Examples: 1, 42, 123"
658
680
  )
659
681
  });
660
- function Ur(t) {
682
+ function qr(t) {
661
683
  let r;
662
684
  try {
663
- r = bt.parse(t);
685
+ r = St.parse(t);
664
686
  } catch (e) {
665
687
  return {
666
688
  error: F(e)
@@ -680,31 +702,31 @@ function Ur(t) {
680
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.`
681
703
  };
682
704
  try {
683
- 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}` };
684
706
  } catch (e) {
685
707
  return {
686
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.`
687
709
  };
688
710
  }
689
711
  }
690
- function jr(t, r) {
712
+ function _r(t, r) {
691
713
  t(
692
714
  "process-kill",
693
715
  {
694
716
  title: "Kill Host Machine Process",
695
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",
696
- inputSchema: bt.shape
718
+ inputSchema: St.shape
697
719
  },
698
720
  async (s) => {
699
- const o = Ur(s);
721
+ const o = qr(s);
700
722
  return o.error != null ? `Method: process-kill(${JSON.stringify(s)})
701
723
  ❌ Error: ${o.error}` : `Method: process-kill(${JSON.stringify(s)})
702
724
  ${JSON.stringify(o, null, 2)}`;
703
725
  }
704
726
  );
705
727
  }
706
- function qr(t, r) {
707
- Ir(), r.run && Pr(t, r), r.status && Fr(t, r), r.wait && Br(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);
708
730
  const s = r.commandLineRules?.map(
709
731
  (o) => `${o.rule.toUpperCase()}: ${o.regexp} (${o.note})`
710
732
  ) || [];
@@ -717,7 +739,7 @@ ${s.map((o) => `- ${o}`).join(`
717
739
  `
718
740
  );
719
741
  }
720
- function _r(t, r) {
742
+ function Jr(t, r) {
721
743
  return function(o, e, n) {
722
744
  const i = async (...a) => {
723
745
  await ie({
@@ -746,26 +768,26 @@ function _r(t, r) {
746
768
  );
747
769
  };
748
770
  }
749
- function Gr(t) {
771
+ function Wr(t) {
750
772
  return t.match(/^[/\\]?[^/\\]+/)[0];
751
773
  }
752
- function Jr(t, r) {
753
- return Gr(t) + "|" + r.ino;
774
+ function Kr(t, r) {
775
+ return Wr(t) + "|" + r.ino;
754
776
  }
755
- function Wr(t) {
777
+ function Hr(t) {
756
778
  return t.endsWith(":") && (t += "/"), k.resolve(t);
757
779
  }
758
- const Se = new tr(nr.cpus().length);
759
- function Le(t, r) {
780
+ const Se = new rr(ir.cpus().length);
781
+ function Be(t, r) {
760
782
  t.totalSize += r.totalSize, t.maxFileDateModified = Math.max(
761
783
  t.maxFileDateModified,
762
784
  r.maxFileDateModified
763
785
  ), t.countFiles += r.countFiles, t.countDirs += r.countDirs, t.countLinks += r.countLinks;
764
786
  }
765
- const Kr = function(r) {
787
+ const Qr = function(r) {
766
788
  return r.code === "ENOENT";
767
789
  };
768
- function St(t) {
790
+ function xt(t) {
769
791
  const r = t.paths;
770
792
  if (!r || r.length === 0)
771
793
  return Promise.resolve({
@@ -776,15 +798,15 @@ function St(t) {
776
798
  countLinks: 0
777
799
  });
778
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;
779
- async function d(m) {
780
- if (!(i && await i(m)) && !Kr(m))
781
- throw m;
801
+ async function d(h) {
802
+ if (!(i && await i(h)) && !Qr(h))
803
+ throw h;
782
804
  }
783
- function p(m) {
784
- 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);
785
807
  }
786
- return rr(async (m) => {
787
- const g = sr(e, m), y = {
808
+ return sr(async (h) => {
809
+ const g = or(e, h), y = {
788
810
  totalSize: 0,
789
811
  maxFileDateModified: 0,
790
812
  countFiles: 0,
@@ -830,10 +852,10 @@ function St(t) {
830
852
  });
831
853
  if (!v || !x && v.isFile())
832
854
  return null;
833
- const B = Jr($, v);
834
- if (o.has(B))
855
+ const P = Kr($, v);
856
+ if (o.has(P))
835
857
  return null;
836
- o.add(B);
858
+ o.add(P);
837
859
  let O = {
838
860
  totalSize: v.size,
839
861
  maxFileDateModified: v.isDirectory() ? 0 : v.mtimeMs,
@@ -869,7 +891,7 @@ function St(t) {
869
891
  v,
870
892
  O,
871
893
  I
872
- ) && (Le(y, O), w(S, O))), O;
894
+ ) && (Be(y, O), w(S, O))), O;
873
895
  } else if (v.isDirectory()) {
874
896
  const C = await V({
875
897
  pool: n,
@@ -881,7 +903,7 @@ function St(t) {
881
903
  if (C) {
882
904
  for (let N = 0, R = C.length; N < R; N++)
883
905
  C[N] = k.join(S, C[N]);
884
- O = await St({
906
+ O = await xt({
885
907
  ...t,
886
908
  paths: C,
887
909
  abortSignal: g,
@@ -896,20 +918,20 @@ function St(t) {
896
918
  v,
897
919
  O,
898
920
  I
899
- ) && (Le(y, O), w(S, O))), O;
921
+ ) && (Be(y, O), w(S, O))), O;
900
922
  }
901
923
  const b = [];
902
924
  for (let $ = 0, T = r.length; $ < T; $++) {
903
- const x = Wr(r[$]), S = f ? f(x) : !0;
925
+ const x = Hr(r[$]), S = f ? f(x) : !0;
904
926
  S !== !1 && b.push(E(x, $, S));
905
927
  }
906
928
  return await Promise.all(b), y;
907
929
  });
908
930
  }
909
- function xt(t) {
910
- return St(t);
931
+ function $t(t) {
932
+ return xt(t);
911
933
  }
912
- function Hr(t, r) {
934
+ function Yr(t, r) {
913
935
  if (!r || r === ".")
914
936
  return t;
915
937
  const s = t.startsWith("^");
@@ -917,43 +939,43 @@ function Hr(t, r) {
917
939
  const o = t.startsWith("!");
918
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;
919
941
  }
920
- function Qr(t) {
942
+ function Vr(t) {
921
943
  const r = t.startsWith("!");
922
944
  return r && (t = t.substring(1)), t.startsWith("/") ? t = t.substring(1) : !t.startsWith("**") && !t.startsWith("../") && (t = `**/${t}`), r && (t = "!" + t), t;
923
945
  }
924
- function Pe(t) {
946
+ function Le(t) {
925
947
  return "^" + t;
926
948
  }
927
- async function Yr(t) {
949
+ async function Zr(t) {
928
950
  const s = (await j.promises.readFile(t, "utf-8")).split(`
929
951
  `), o = [];
930
952
  return s.forEach((e) => {
931
953
  e = e.trim(), !(!e || e.startsWith("#")) && o.push(e);
932
954
  }), o;
933
955
  }
934
- async function $t(t) {
956
+ async function It(t) {
935
957
  const r = t.rootDir ?? ".", s = [];
936
958
  if (!t.globs?.length)
937
959
  return s;
938
960
  const o = [];
939
961
  return t.globs.forEach((e) => {
940
- e.value && (e.valueType === "file-contains-patterns" ? o.push(e) : e.valueType === "pattern" && s.push(e.exclude ? Pe(e.value) : e.value));
962
+ e.value && (e.valueType === "file-contains-patterns" ? o.push(e) : e.valueType === "pattern" && s.push(e.exclude ? Le(e.value) : e.value));
941
963
  }), o.length && await Promise.all(
942
964
  o.map(async (e) => {
943
965
  await V({
944
966
  pool: Se,
945
967
  count: 1,
946
968
  func: async () => {
947
- 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));
948
970
  i.forEach((c) => {
949
- c = Qr(c), c = Hr(c, a), s.push(e.exclude ? Pe(c) : c);
971
+ c = Vr(c), c = Yr(c, a), s.push(e.exclude ? Le(c) : c);
950
972
  });
951
973
  }
952
974
  });
953
975
  })
954
976
  ), s;
955
977
  }
956
- function It({
978
+ function Mt({
957
979
  globs: t,
958
980
  rootDir: r,
959
981
  noCase: s
@@ -974,7 +996,7 @@ function It({
974
996
  return;
975
997
  let c;
976
998
  try {
977
- c = ir(a, {
999
+ c = ar(a, {
978
1000
  nocase: s ?? !1,
979
1001
  dot: !0,
980
1002
  strictBrackets: !0
@@ -1001,17 +1023,17 @@ function It({
1001
1023
  return a ? !1 : i;
1002
1024
  };
1003
1025
  }
1004
- async function Vr(t) {
1026
+ async function Xr(t) {
1005
1027
  const r = t.rootDir ?? ".", s = [], o = {};
1006
1028
  t.result.countFiles && (o.countFiles = 0), t.result.size && (o.size = 0);
1007
- const e = await $t({
1029
+ const e = await It({
1008
1030
  rootDir: r,
1009
1031
  globs: t.globs
1010
1032
  });
1011
- return await xt({
1033
+ return await $t({
1012
1034
  paths: [r],
1013
1035
  walkLinks: !0,
1014
- matchPath: It({
1036
+ matchPath: Mt({
1015
1037
  globs: e,
1016
1038
  rootDir: r,
1017
1039
  noCase: !0
@@ -1020,21 +1042,21 @@ async function Vr(t) {
1020
1042
  const c = k.relative(r, n), l = i.isDirectory(), u = i.isFile();
1021
1043
  if (!l && !u)
1022
1044
  return !0;
1023
- 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 = {
1024
1046
  path: f,
1025
1047
  type: d
1026
1048
  };
1027
- 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) {
1028
1050
  const [w, M] = t.dateModified;
1029
1051
  if (w != null && p < w || M != null && p > M)
1030
1052
  return !1;
1031
1053
  }
1032
- if (t.totalSize && m != null) {
1054
+ if (t.totalSize && h != null) {
1033
1055
  const [w, M] = t.totalSize;
1034
- if (w != null && m < w || M != null && m > M)
1056
+ if (w != null && h < w || M != null && h > M)
1035
1057
  return !1;
1036
1058
  }
1037
- 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;
1038
1060
  }
1039
1061
  }), { items: s, totals: o };
1040
1062
  }
@@ -1052,7 +1074,7 @@ function je(t) {
1052
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);
1053
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`;
1054
1076
  }
1055
- function Zr(t, r) {
1077
+ function es(t, r) {
1056
1078
  return r?.length ? [...t].sort((s, o) => {
1057
1079
  for (let e = 0, n = r.length; e < n; e++) {
1058
1080
  const i = r[e];
@@ -1088,8 +1110,8 @@ function Zr(t, r) {
1088
1110
  return 0;
1089
1111
  }) : t;
1090
1112
  }
1091
- function Xr(t, r) {
1092
- 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 : [];
1093
1115
  let e = "";
1094
1116
  if (s.length > 0 && o.length > 0) {
1095
1117
  for (let n = 0, i = o.length; n < i; n++) {
@@ -1147,9 +1169,9 @@ function Xr(t, r) {
1147
1169
  }
1148
1170
  return e;
1149
1171
  }
1150
- const es = "4.0.2", ts = {
1151
- version: es
1152
- }, 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;
1153
1175
  function _e(t) {
1154
1176
  const r = t.match(
1155
1177
  /^\s*(\d+(?:\.\d+)?)\s*([smhdwMY]|sec(onds?)?|min(utes?)?|hours?|days?|weeks?|months?|years?)\s*$/i
@@ -1205,49 +1227,49 @@ function Ge(t) {
1205
1227
  );
1206
1228
  }
1207
1229
  }
1208
- const Mt = h.object({
1209
- relativeRootDir: h.string().optional().describe(
1230
+ const Tt = m.object({
1231
+ relativeRootDir: m.string().optional().describe(
1210
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'
1211
1233
  ),
1212
- globs: h.array(h.string()).optional().describe(
1234
+ globs: m.array(m.string()).optional().describe(
1213
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)'
1214
1236
  ),
1215
- showFiles: h.boolean().optional().describe(
1237
+ showFiles: m.boolean().optional().describe(
1216
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)"
1217
1239
  ),
1218
- showDirs: h.boolean().optional().describe(
1240
+ showDirs: m.boolean().optional().describe(
1219
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)"
1220
1242
  ),
1221
- sortBy: h.array(
1222
- h.object({
1223
- 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(
1224
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)'
1225
1247
  ),
1226
- 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)")
1227
1249
  })
1228
1250
  ).optional().describe(
1229
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'
1230
1252
  ),
1231
- 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(
1232
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'
1233
1255
  ),
1234
- minTimeAgo: h.string().optional().describe(
1256
+ minTimeAgo: m.string().optional().describe(
1235
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)'
1236
1258
  ),
1237
- maxTimeAgo: h.string().optional().describe(
1259
+ maxTimeAgo: m.string().optional().describe(
1238
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'
1239
1261
  ),
1240
- minTotalSize: h.string().optional().describe(
1262
+ minTotalSize: m.string().optional().describe(
1241
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)'
1242
1264
  ),
1243
- maxTotalSize: h.string().optional().describe(
1265
+ maxTotalSize: m.string().optional().describe(
1244
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'
1245
1267
  )
1246
1268
  });
1247
- async function rs(t, r) {
1269
+ async function os(t, r) {
1248
1270
  let s;
1249
1271
  try {
1250
- s = Mt.parse(t);
1272
+ s = Tt.parse(t);
1251
1273
  } catch (y) {
1252
1274
  return {
1253
1275
  error: F(y)
@@ -1277,13 +1299,13 @@ async function rs(t, r) {
1277
1299
  };
1278
1300
  }) ?? null;
1279
1301
  (!d || d.length === 0) && (d = [{ field: "path", desc: !1 }]);
1280
- const p = d?.map((y) => y.field) || [], m = be(
1302
+ const p = d?.map((y) => y.field) || [], h = be(
1281
1303
  r.workingDir,
1282
1304
  s.relativeRootDir
1283
1305
  );
1284
- if ("error" in m)
1285
- return { error: m.error };
1286
- const g = m.path;
1306
+ if ("error" in h)
1307
+ return { error: h.error };
1308
+ const g = h.path;
1287
1309
  try {
1288
1310
  try {
1289
1311
  await j.promises.access(g, j.constants.F_OK);
@@ -1308,8 +1330,8 @@ async function rs(t, r) {
1308
1330
  let b = null, $ = null;
1309
1331
  if (a || c)
1310
1332
  try {
1311
- const S = Date.now(), v = c ? S - _e(c) : null, B = a ? S - _e(a) : null;
1312
- b = [v, B];
1333
+ const S = Date.now(), v = c ? S - _e(c) : null, P = a ? S - _e(a) : null;
1334
+ b = [v, P];
1313
1335
  } catch (S) {
1314
1336
  return {
1315
1337
  error: S instanceof Error ? S.message : "Unknown error parsing time ago filter"
@@ -1324,7 +1346,7 @@ async function rs(t, r) {
1324
1346
  error: S instanceof Error ? S.message : "Unknown error parsing size filter"
1325
1347
  };
1326
1348
  }
1327
- const T = await Vr({
1349
+ const T = await Xr({
1328
1350
  rootDir: g || null,
1329
1351
  globs: M,
1330
1352
  result: E,
@@ -1334,7 +1356,7 @@ async function rs(t, r) {
1334
1356
  return T.items.length > qe ? {
1335
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.`
1336
1358
  } : {
1337
- output: Xr(T, {
1359
+ output: ts(T, {
1338
1360
  sort: d,
1339
1361
  fields: f,
1340
1362
  totals: !0
@@ -1344,16 +1366,16 @@ async function rs(t, r) {
1344
1366
  return { error: y instanceof Error ? y.message : "Unknown error" };
1345
1367
  }
1346
1368
  }
1347
- function ss(t, r) {
1369
+ function ns(t, r) {
1348
1370
  t(
1349
1371
  "fs-list",
1350
1372
  {
1351
1373
  title: "List Files and Directories",
1352
1374
  description: "List files and directories with advanced filtering, sorting and formatting options. Use this to analyze filesystem structure",
1353
- inputSchema: Mt.shape
1375
+ inputSchema: Tt.shape
1354
1376
  },
1355
1377
  async (s) => {
1356
- const o = await rs(s, r);
1378
+ const o = await os(s, r);
1357
1379
  return o.error ? `Method: fs-list(${JSON.stringify(s)})
1358
1380
  ❌ Error: ${o.error}` : `Method: fs-list(${JSON.stringify(s)})
1359
1381
  ${o.output || JSON.stringify(o, null, 2)}`;
@@ -1361,9 +1383,9 @@ ${o.output || JSON.stringify(o, null, 2)}`;
1361
1383
  );
1362
1384
  }
1363
1385
  const ue = /* @__PURE__ */ new Map();
1364
- let os = 0;
1365
- function ns() {
1366
- return `${++os}-${Math.random().toString(36).slice(2)}`;
1386
+ let is = 0;
1387
+ function as() {
1388
+ return `${++is}-${Math.random().toString(36).slice(2)}`;
1367
1389
  }
1368
1390
  function Z(t) {
1369
1391
  return ue.has(t) || ue.set(t, {
@@ -1427,32 +1449,32 @@ function We(t) {
1427
1449
  );
1428
1450
  }
1429
1451
  }
1430
- const xe = h.object({
1431
- name: h.string().describe(
1452
+ const xe = m.object({
1453
+ name: m.string().describe(
1432
1454
  "Unique name for the filesystem snapshot query. Recommended format: kebab-case-1, kebab-case-2, ..."
1433
1455
  ),
1434
- relativeRootDir: h.string().optional().describe(
1456
+ relativeRootDir: m.string().optional().describe(
1435
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'
1436
1458
  ),
1437
- bulkGlobs: h.array(h.string()).optional().describe(
1459
+ bulkGlobs: m.array(m.string()).optional().describe(
1438
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)'
1439
1461
  ),
1440
- types: h.array(h.enum(["file", "dir"])).optional().describe(
1462
+ types: m.array(m.enum(["file", "dir"])).optional().describe(
1441
1463
  "Types of items to include in the snapshot. If omitted, includes both files and directories"
1442
1464
  ),
1443
- extraFields: h.array(h.enum(["lastModified", "size", "countMatched"])).optional().describe(
1465
+ extraFields: m.array(m.enum(["lastModified", "size", "countMatched"])).optional().describe(
1444
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'
1445
1467
  ),
1446
- minTimeAgo: h.string().optional().describe(
1468
+ minTimeAgo: m.string().optional().describe(
1447
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)'
1448
1470
  ),
1449
- maxTimeAgo: h.string().optional().describe(
1471
+ maxTimeAgo: m.string().optional().describe(
1450
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'
1451
1473
  ),
1452
- minTotalSize: h.string().optional().describe(
1474
+ minTotalSize: m.string().optional().describe(
1453
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)'
1454
1476
  ),
1455
- maxTotalSize: h.string().optional().describe(
1477
+ maxTotalSize: m.string().optional().describe(
1456
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'
1457
1479
  )
1458
1480
  }), Ke = new Map(
@@ -1464,17 +1486,17 @@ const xe = h.object({
1464
1486
  "dateModified"
1465
1487
  ].map((t, r) => [t, r])
1466
1488
  );
1467
- function is(t, r) {
1489
+ function ls(t, r) {
1468
1490
  const s = Ke.get(t) ?? 1 / 0, o = Ke.get(r) ?? 1 / 0;
1469
1491
  return s > o ? 1 : s < o ? -1 : 0;
1470
1492
  }
1471
- async function Tt(t, r, s) {
1493
+ async function Ct(t, r, s) {
1472
1494
  let o;
1473
1495
  try {
1474
1496
  o = xe.parse(t);
1475
- } catch (m) {
1497
+ } catch (h) {
1476
1498
  return {
1477
- error: F(m)
1499
+ error: F(h)
1478
1500
  };
1479
1501
  }
1480
1502
  const {
@@ -1507,8 +1529,8 @@ async function Tt(t, r, s) {
1507
1529
  };
1508
1530
  throw x;
1509
1531
  }
1510
- const m = o.extraFields ? o.extraFields.map((x) => x === "lastModified" ? "dateModified" : x) : [];
1511
- 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);
1512
1534
  const g = n && n.length > 0 ? n.map((x) => ({
1513
1535
  value: x,
1514
1536
  valueType: "pattern",
@@ -1541,18 +1563,18 @@ async function Tt(t, r, s) {
1541
1563
  matchDirs: $,
1542
1564
  dateModified: M,
1543
1565
  totalSize: E,
1544
- fields: m
1566
+ fields: h
1545
1567
  };
1546
1568
  return f.fsSnapshotQueries.set(e, T), {
1547
1569
  snapshotQuery: T
1548
1570
  };
1549
- } catch (m) {
1571
+ } catch (h) {
1550
1572
  return {
1551
- error: m instanceof Error ? m.message : "Unknown error"
1573
+ error: h instanceof Error ? h.message : "Unknown error"
1552
1574
  };
1553
1575
  }
1554
1576
  }
1555
- function as(t, r) {
1577
+ function cs(t, r) {
1556
1578
  t(
1557
1579
  "fs-snapshot-query-create",
1558
1580
  {
@@ -1561,7 +1583,7 @@ function as(t, r) {
1561
1583
  inputSchema: xe.shape
1562
1584
  },
1563
1585
  async (s, o) => {
1564
- const e = await Tt(s, r, o);
1586
+ const e = await Ct(s, r, o);
1565
1587
  return e.error != null ? `Method: fs-snapshot-query-create(${JSON.stringify(s)})
1566
1588
  ❌ Error: ${e.error}` : `Method: fs-snapshot-query-create(${JSON.stringify(s)})
1567
1589
  ✅ Filesystem snapshot query "${e.snapshotQuery.name}" created successfully`;
@@ -1608,16 +1630,16 @@ function le(t) {
1608
1630
  }
1609
1631
  };
1610
1632
  }
1611
- function Ct(t, r, s) {
1633
+ function vt(t, r, s) {
1612
1634
  let o = null;
1613
1635
  for (let e = 0, n = r.length; e < n; e++) {
1614
- 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);
1615
1637
  l != null && (o == null && (o = []), o.push(l));
1616
1638
  }
1617
1639
  return o;
1618
1640
  }
1619
- function vt(t) {
1620
- 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(
1621
1643
  s,
1622
1644
  o,
1623
1645
  (u, f) => {
@@ -1645,7 +1667,7 @@ function vt(t) {
1645
1667
  function me(t) {
1646
1668
  return t = t != null ? H(t).replace(/\/$/, "") : null, !t || t === "." ? null : t;
1647
1669
  }
1648
- async function ls(t) {
1670
+ async function us(t) {
1649
1671
  const r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), o = k.resolve(t.rootDir || "."), n = {
1650
1672
  path: ".",
1651
1673
  name: k.basename(o),
@@ -1655,14 +1677,14 @@ async function ls(t) {
1655
1677
  size: 0
1656
1678
  };
1657
1679
  r.set(null, n);
1658
- const i = await $t({
1680
+ const i = await It({
1659
1681
  rootDir: o,
1660
1682
  globs: t.globs
1661
1683
  });
1662
- return await xt({
1684
+ return await $t({
1663
1685
  paths: [o],
1664
1686
  walkLinks: !0,
1665
- matchPath: It({
1687
+ matchPath: Mt({
1666
1688
  globs: i,
1667
1689
  rootDir: o,
1668
1690
  noCase: !0
@@ -1671,7 +1693,7 @@ async function ls(t) {
1671
1693
  const u = k.relative(o, a), f = c.isDirectory(), d = c.isFile();
1672
1694
  if (!f && !d)
1673
1695
  return !0;
1674
- 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;
1675
1697
  let w = !0;
1676
1698
  if (d && !t.matchFiles && (w = !1), f && !t.matchDirs && (w = !1), w && d && t.dateModified && g != null) {
1677
1699
  const [$, T] = t.dateModified;
@@ -1688,7 +1710,7 @@ async function ls(t) {
1688
1710
  const M = {
1689
1711
  path: p ?? ".",
1690
1712
  name: k.basename(a),
1691
- type: m,
1713
+ type: h,
1692
1714
  dateModified: g,
1693
1715
  size: y,
1694
1716
  isMatched: w
@@ -1705,7 +1727,7 @@ async function ls(t) {
1705
1727
  idToChildIds: s
1706
1728
  };
1707
1729
  }
1708
- const cs = [
1730
+ const ds = [
1709
1731
  { name: "[ ]", match: (t) => t === 32, min: 2, max: 81 },
1710
1732
  { name: "[\\t]", match: (t) => t === 9, min: 2, max: 20 },
1711
1733
  { name: "[\\n]", match: (t) => t === 10, min: 2, max: 14 },
@@ -1728,7 +1750,7 @@ const cs = [
1728
1750
  // max: 2,
1729
1751
  // },
1730
1752
  ];
1731
- function He(t, r = cs) {
1753
+ function He(t, r = ds) {
1732
1754
  const s = t.length;
1733
1755
  if (s === 0) return 0;
1734
1756
  const o = r.length;
@@ -1754,25 +1776,25 @@ function He(t, r = cs) {
1754
1776
  }
1755
1777
  return e;
1756
1778
  }
1757
- function Et(t) {
1779
+ function Nt(t) {
1758
1780
  let r = 0;
1759
1781
  return r += He(t.textOpen) + 1, t.textClose != null && (r += He(t.textClose) + 1), t.indent && (r += 1), r;
1760
1782
  }
1761
1783
  const Qe = ["B", "KB", "MB", "GB", "TB"], Ye = 1024;
1762
- function us(t) {
1784
+ function fs(t) {
1763
1785
  if (t == null) return "-";
1764
1786
  let r = t ?? 0, s = 0;
1765
1787
  for (; r >= Ye && s < Qe.length - 1; )
1766
1788
  r /= Ye, s++;
1767
1789
  return `${s === 0 ? r.toString() : r.toFixed(2)}${Qe[s]}`;
1768
1790
  }
1769
- function ds(t) {
1791
+ function ps(t) {
1770
1792
  const s = Date.now() - t;
1771
1793
  if (s < 0) return "0s";
1772
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);
1773
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`;
1774
1796
  }
1775
- function fs(t) {
1797
+ function hs(t) {
1776
1798
  return function(s, o) {
1777
1799
  const e = t.get(s), n = t.get(o);
1778
1800
  if (e.type !== n.type)
@@ -1785,26 +1807,26 @@ function fs(t) {
1785
1807
  }
1786
1808
  };
1787
1809
  }
1788
- function ps(t) {
1810
+ function ms(t) {
1789
1811
  const r = t.fields ?? [];
1790
1812
  return function(o, e) {
1791
1813
  let n = "", i, a = 0;
1792
1814
  const c = e ? e.length : 0;
1793
- 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;
1794
1816
  if (e)
1795
1817
  for (let b = 0; b < e.length; b++) {
1796
1818
  const $ = e[b];
1797
- 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);
1798
1820
  }
1799
- 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);
1800
1822
  for (let b = 0, $ = r.length; b < $; b++) {
1801
1823
  const T = r[b];
1802
1824
  switch (b > 0 && (n += " "), T) {
1803
1825
  case "dateModified":
1804
- n += g ? ds(g) : "-";
1826
+ n += g ? ps(g) : "-";
1805
1827
  break;
1806
1828
  case "size":
1807
- n += us(p);
1829
+ n += fs(p);
1808
1830
  break;
1809
1831
  case "type":
1810
1832
  n += y;
@@ -1822,7 +1844,7 @@ function ps(t) {
1822
1844
  textOpen: n,
1823
1845
  textClose: null
1824
1846
  };
1825
- return u = Et(E), d += u, {
1847
+ return u = Nt(E), d += u, {
1826
1848
  type: y,
1827
1849
  name: w,
1828
1850
  path: M,
@@ -1835,13 +1857,13 @@ function ps(t) {
1835
1857
  tokensTotal: d,
1836
1858
  text: E,
1837
1859
  size: p,
1838
- countFiles: m,
1860
+ countFiles: h,
1839
1861
  dateModified: g
1840
1862
  };
1841
1863
  };
1842
1864
  }
1843
- async function hs(t) {
1844
- 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({
1845
1867
  getId: (i) => {
1846
1868
  const a = s.getId(i);
1847
1869
  if (a == null)
@@ -1851,19 +1873,19 @@ async function hs(t) {
1851
1873
  return a;
1852
1874
  },
1853
1875
  getChilds: (i) => s.getChilds(i),
1854
- createSnapshotNode: ps(t),
1876
+ createSnapshotNode: ms(t),
1855
1877
  rootNodes: o ?? []
1856
- }), n = fs(e.idToNode);
1878
+ }), n = hs(e.idToNode);
1857
1879
  return e.idToChildIds.forEach((i) => {
1858
1880
  i.sort(n);
1859
1881
  }), le(e);
1860
1882
  }
1861
- const ee = h.object({
1862
- 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"),
1863
1885
  query: xe.optional().describe(
1864
1886
  "Filesystem snapshot query creation options JSON to automatically create query"
1865
1887
  ),
1866
- name: h.string().describe(
1888
+ name: m.string().describe(
1867
1889
  "Unique name for the filesystem snapshot. Recommended format: kebab-case-1, kebab-case-2, ..."
1868
1890
  )
1869
1891
  });
@@ -1895,7 +1917,7 @@ async function ce(t, r, s) {
1895
1917
  };
1896
1918
  c = u;
1897
1919
  } else if (i) {
1898
- const u = await Tt(
1920
+ const u = await Ct(
1899
1921
  i,
1900
1922
  r,
1901
1923
  s
@@ -1910,7 +1932,7 @@ async function ce(t, r, s) {
1910
1932
  error: "Either queryName or query must be provided"
1911
1933
  };
1912
1934
  try {
1913
- const u = await hs(c), f = {
1935
+ const u = await gs(c), f = {
1914
1936
  name: e,
1915
1937
  query: c,
1916
1938
  tree: u
@@ -1925,7 +1947,7 @@ async function ce(t, r, s) {
1925
1947
  };
1926
1948
  }
1927
1949
  }
1928
- function ms(t, r) {
1950
+ function ws(t, r) {
1929
1951
  t(
1930
1952
  "fs-snapshot-create",
1931
1953
  {
@@ -1945,7 +1967,7 @@ function ms(t, r) {
1945
1967
  }
1946
1968
  );
1947
1969
  }
1948
- class gs {
1970
+ class ys {
1949
1971
  _first = null;
1950
1972
  _last = null;
1951
1973
  _size = 0;
@@ -1968,8 +1990,8 @@ class gs {
1968
1990
  return this._size;
1969
1991
  }
1970
1992
  }
1971
- function ws(t) {
1972
- const r = new gs(), {
1993
+ function bs(t) {
1994
+ const r = new ys(), {
1973
1995
  tree: s,
1974
1996
  limits: { maxCountTotal: o, maxTokensTotal: e, maxCountGroup: n, maxTokensGroup: i },
1975
1997
  indexRangeGroupStrategy: a
@@ -1980,20 +2002,20 @@ function ws(t) {
1980
2002
  });
1981
2003
  let l = null, u = 0, f = 0;
1982
2004
  for (; !r.isEmpty(); ) {
1983
- const { reportNode: d, node: p } = r.dequeue(), m = s.getChilds(p);
1984
- 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)
1985
2007
  throw new Error(
1986
2008
  "Impossible behavior: nodeChilds is null or length mismatch"
1987
2009
  );
1988
2010
  let g = r.size();
1989
- for (let w = 0; w < m.length; w++)
1990
- m[w].countChilds > 0 && (g += 1);
2011
+ for (let w = 0; w < h.length; w++)
2012
+ h[w].countChilds > 0 && (g += 1);
1991
2013
  const y = g * a.tokens;
1992
2014
  if (o != null && u + p.countChilds + g > o || e != null && f + p.tokensChilds + y > e) {
1993
2015
  const w = [];
1994
2016
  let M = null, E = 0;
1995
- for (let $ = 0, T = m.length; $ < T; $++) {
1996
- const x = m[$], S = E * a.tokens;
2017
+ for (let $ = 0, T = h.length; $ < T; $++) {
2018
+ const x = h[$], S = E * a.tokens;
1997
2019
  M != null && // Если общий лимит превышен, то не создаем новую группу, а продолжаем текущую. В случае достижения лимитов, последняя группа может содержать больше элементов, чем указано в лимитах группы, и это допустимо. Главное - дать в отчете полную картину.
1998
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);
1999
2021
  }
@@ -2013,8 +2035,8 @@ function ws(t) {
2013
2035
  } else {
2014
2036
  u += p.countChilds, f += p.tokensChilds;
2015
2037
  const w = [];
2016
- for (let M = 0; M < m.length; M++) {
2017
- const E = m[M], b = {
2038
+ for (let M = 0; M < h.length; M++) {
2039
+ const E = h[M], b = {
2018
2040
  text: E.text
2019
2041
  };
2020
2042
  w.push(b);
@@ -2037,7 +2059,7 @@ function ws(t) {
2037
2059
  }
2038
2060
  return l ?? [];
2039
2061
  }
2040
- function Nt(t) {
2062
+ function kt(t) {
2041
2063
  const {
2042
2064
  tree: r,
2043
2065
  request: { parentNodeId: s, childsIndexRange: o, limits: e },
@@ -2059,13 +2081,13 @@ function Nt(t) {
2059
2081
  throw new Error(
2060
2082
  `Invalid index range: ${d}-${p} for root nodes length ${l.length}`
2061
2083
  );
2062
- const m = [];
2084
+ const h = [];
2063
2085
  let g = null;
2064
2086
  for (let y = d; y <= p; y++) {
2065
2087
  const w = l[y];
2066
- m.push(w), g = n.add(g, w, y);
2088
+ h.push(w), g = n.add(g, w, y);
2067
2089
  }
2068
- l = m, c = {
2090
+ l = h, c = {
2069
2091
  ...a,
2070
2092
  text: n.getReportText(g),
2071
2093
  countChilds: g.countGrouped,
@@ -2081,14 +2103,14 @@ function Nt(t) {
2081
2103
  root: u,
2082
2104
  getChilds: (d) => d === u ? [c] : d === c ? l : r.getChilds(d)
2083
2105
  };
2084
- return ws({
2106
+ return bs({
2085
2107
  tree: f,
2086
2108
  limits: e,
2087
2109
  indexRangeGroupStrategy: n,
2088
2110
  ...i
2089
2111
  });
2090
2112
  }
2091
- function kt(t, r) {
2113
+ function Ot(t, r) {
2092
2114
  if (t == null || t.length === 0)
2093
2115
  return "No results found";
2094
2116
  let s = "";
@@ -2105,7 +2127,7 @@ function kt(t, r) {
2105
2127
  }
2106
2128
  return o(t, ""), s;
2107
2129
  }
2108
- class ys {
2130
+ class Ss {
2109
2131
  tokens = 16;
2110
2132
  // +1 indent, +1 for line break
2111
2133
  getReportText = (r) => ({
@@ -2120,16 +2142,16 @@ class ys {
2120
2142
  tokensGrouped: s.tokens
2121
2143
  } : (r.indexRange[1] = o, r.countGrouped += 1, r.countMatched += s.countMatched, r.tokensGrouped += s.tokens, r);
2122
2144
  }
2123
- const Ot = h.object({
2124
- 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"),
2125
2147
  snapshot: ee.optional().describe(
2126
2148
  "Filesystem snapshot creation options JSON to automatically create snapshot"
2127
2149
  ),
2128
- parentPath: h.string().optional().describe(
2150
+ parentPath: m.string().optional().describe(
2129
2151
  "Path relative to snapshot rootDir to browse. Omit to browse the rootDir itself"
2130
2152
  ),
2131
- childsIndexRange: h.tuple([h.number(), h.number()]).optional().describe(
2132
- "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"
2133
2155
  )
2134
2156
  // maxCountTotal: z
2135
2157
  // .number()
@@ -2142,10 +2164,10 @@ const Ot = h.object({
2142
2164
  // maxCountGroup: z.number().default(10).describe('Maximum items per group'),
2143
2165
  // maxTokensGroup: z.number().default(1000).describe('Maximum tokens per group'),
2144
2166
  });
2145
- async function bs(t, r, s) {
2167
+ async function xs(t, r, s) {
2146
2168
  let o;
2147
2169
  try {
2148
- o = Ot.parse(t);
2170
+ o = Rt.parse(t);
2149
2171
  } catch (g) {
2150
2172
  return {
2151
2173
  error: F(g)
@@ -2153,13 +2175,12 @@ async function bs(t, r, s) {
2153
2175
  }
2154
2176
  const {
2155
2177
  snapshotName: e,
2156
- snapshot: n,
2157
- childsIndexRange: i
2178
+ snapshot: n
2158
2179
  // maxCountTotal,
2159
2180
  // maxTokensTotal,
2160
2181
  // maxCountGroup,
2161
2182
  // maxTokensGroup,
2162
- } = 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;
2163
2184
  if (!s.sessionId)
2164
2185
  return {
2165
2186
  error: "Session ID is required"
@@ -2169,7 +2190,7 @@ async function bs(t, r, s) {
2169
2190
  return {
2170
2191
  error: "Either snapshotName or snapshot must be provided, not both"
2171
2192
  };
2172
- let d, p = !1, m = !1;
2193
+ let d, p = !1, h = !1;
2173
2194
  if (e) {
2174
2195
  if (d = f.fsSnapshots.get(e), d == null)
2175
2196
  return {
@@ -2185,13 +2206,13 @@ async function bs(t, r, s) {
2185
2206
  return {
2186
2207
  error: g.error
2187
2208
  };
2188
- d = g.fsSnapshot, p = g.queryCreated, m = !0;
2209
+ d = g.fsSnapshot, p = g.queryCreated, h = !0;
2189
2210
  } else
2190
2211
  return {
2191
2212
  error: "Either snapshotName or snapshot must be provided"
2192
2213
  };
2193
2214
  try {
2194
- const g = me(o.parentPath), y = Nt({
2215
+ const g = me(o.parentPath), y = kt({
2195
2216
  tree: d.tree,
2196
2217
  request: {
2197
2218
  parentNodeId: g,
@@ -2203,12 +2224,12 @@ async function bs(t, r, s) {
2203
2224
  maxTokensGroup: u
2204
2225
  }
2205
2226
  },
2206
- indexRangeGroupStrategy: new ys()
2207
- }), w = kt(y);
2227
+ indexRangeGroupStrategy: new Ss()
2228
+ }), w = Ot(y);
2208
2229
  return {
2209
2230
  fsSnapshot: d,
2210
2231
  queryCreated: p,
2211
- snapshotCreated: m,
2232
+ snapshotCreated: h,
2212
2233
  parentPath: g,
2213
2234
  childsIndexRange: i,
2214
2235
  report: w
@@ -2219,16 +2240,16 @@ async function bs(t, r, s) {
2219
2240
  };
2220
2241
  }
2221
2242
  }
2222
- function Ss(t, r) {
2243
+ function $s(t, r) {
2223
2244
  t(
2224
2245
  "fs-snapshot-browse",
2225
2246
  {
2226
2247
  title: "Browse Filesystem Snapshot",
2227
2248
  description: "Browse and explore filesystem. Use this to efficiently browse, analyze, explore, inspect, etc directory and file structures",
2228
- inputSchema: Ot.shape
2249
+ inputSchema: Rt.shape
2229
2250
  },
2230
2251
  async (s, o) => {
2231
- const e = await bs(s, r, o);
2252
+ const e = await xs(s, r, o);
2232
2253
  if (e.error != null)
2233
2254
  return `Method: fs-snapshot-browse(${JSON.stringify(s)})
2234
2255
  ❌ Error: ${e.error}`;
@@ -2250,7 +2271,7 @@ ${e.report}`, n;
2250
2271
  }
2251
2272
  );
2252
2273
  }
2253
- function Rt(t) {
2274
+ function Dt(t) {
2254
2275
  const r = [], s = t.tree, o = t.query.rootDir ?? ".";
2255
2276
  function e(n) {
2256
2277
  n.type === "file" && n.isMatched && r.push(o + "/" + n.path);
@@ -2262,14 +2283,14 @@ function Rt(t) {
2262
2283
  return e(s.root), r;
2263
2284
  }
2264
2285
  const Ve = /* @__PURE__ */ new Map();
2265
- function xs(t) {
2286
+ function Is(t) {
2266
2287
  const r = H(t);
2267
2288
  let s = Ve.get(r);
2268
- return s == null && (s = new or(), Ve.set(r, s)), s;
2289
+ return s == null && (s = new nr(), Ve.set(r, s)), s;
2269
2290
  }
2270
- async function $s(t) {
2291
+ async function Ms(t) {
2271
2292
  const { filePath: r, func: s } = t;
2272
- return xs(r).lock(
2293
+ return Is(r).lock(
2273
2294
  () => V({
2274
2295
  pool: Se,
2275
2296
  count: 1,
@@ -2277,8 +2298,8 @@ async function $s(t) {
2277
2298
  })
2278
2299
  );
2279
2300
  }
2280
- 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;
2281
- 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) {
2282
2303
  const { content: r, pattern: s, replacement: o } = t, e = r.length, n = [0];
2283
2304
  for (let b = 0; b < e; b++)
2284
2305
  r.charCodeAt(b) === Ze && b + 1 < e && n.push(b + 1);
@@ -2301,14 +2322,14 @@ function Ns(t) {
2301
2322
  continue;
2302
2323
  }
2303
2324
  const S = o.charCodeAt(x + 1);
2304
- let v = -1, B = 0, O = 2;
2325
+ let v = -1, P = 0, O = 2;
2305
2326
  if (S === de)
2306
- v = se, B = "$";
2307
- else if (S === Is)
2327
+ v = se, P = "$";
2328
+ else if (S === Ts)
2308
2329
  v = et;
2309
- else if (S === vs)
2330
+ else if (S === Ns)
2310
2331
  v = tt;
2311
- else if (S === Ms)
2332
+ else if (S === Cs)
2312
2333
  v = rt;
2313
2334
  else if (S >= re && S <= Xe) {
2314
2335
  let I = x + 2;
@@ -2317,27 +2338,27 @@ function Ns(t) {
2317
2338
  if (C < re || C > Xe) break;
2318
2339
  I++;
2319
2340
  }
2320
- v = st, B = o.substring(x + 1, I), O = I - x;
2321
- } else if (S === Ts) {
2341
+ v = st, P = o.substring(x + 1, I), O = I - x;
2342
+ } else if (S === vs) {
2322
2343
  let I = x + 2;
2323
- for (; I < b && o.charCodeAt(I) !== Cs; )
2344
+ for (; I < b && o.charCodeAt(I) !== Es; )
2324
2345
  I++;
2325
- I < b && I > x + 2 && (v = Es, B = 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);
2326
2347
  }
2327
- v >= 0 ? (x > T && (u.push(se), f.push(o.substring(T, x))), u.push(v), f.push(B), x += O, T = x) : x++;
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++;
2328
2349
  }
2329
2350
  T < b && (u.push(se), f.push(o.substring(T))), d = u.length;
2330
2351
  } else
2331
2352
  l = o;
2332
2353
  }
2333
- let p = "", m = 0, g = 0;
2354
+ let p = "", h = 0, g = 0;
2334
2355
  s.lastIndex = 0;
2335
2356
  let y;
2336
2357
  for (; (y = s.exec(r)) !== null; ) {
2337
2358
  const b = y.index, $ = y[0], T = $.length, x = b + T;
2338
- let S, v, B, O;
2359
+ let S, v, P, O;
2339
2360
  if (i === 1)
2340
- S = 0, v = 1, B = 0, O = e;
2361
+ S = 0, v = 1, P = 0, O = e;
2341
2362
  else {
2342
2363
  let I = 0, C = i - 1;
2343
2364
  for (; I < C; ) {
@@ -2353,14 +2374,14 @@ function Ns(t) {
2353
2374
  v = I + 1;
2354
2375
  } else
2355
2376
  v = S + 1;
2356
- B = n[S], O = v < i ? n[v] : e;
2377
+ P = n[S], O = v < i ? n[v] : e;
2357
2378
  }
2358
2379
  if (a.push({
2359
2380
  offset: [b, x],
2360
2381
  lines: [S, v],
2361
- linesOffset: [B, O]
2382
+ linesOffset: [P, O]
2362
2383
  }), o != null) {
2363
- p += r.substring(m, b);
2384
+ p += r.substring(h, b);
2364
2385
  let I;
2365
2386
  if (l != null)
2366
2387
  I = l;
@@ -2368,10 +2389,10 @@ function Ns(t) {
2368
2389
  I = "";
2369
2390
  const N = y.groups, R = y.length - 1;
2370
2391
  for (let K = 0; K < d; K++) {
2371
- const q = u[K], P = f[K];
2392
+ const q = u[K], L = f[K];
2372
2393
  switch (q) {
2373
2394
  case se:
2374
- I += P;
2395
+ I += L;
2375
2396
  break;
2376
2397
  case et:
2377
2398
  I += $;
@@ -2383,19 +2404,19 @@ function Ns(t) {
2383
2404
  I += r.substring(x);
2384
2405
  break;
2385
2406
  case st: {
2386
- const L = P, z = L.length, A = L.charCodeAt(0) - re;
2407
+ const B = L, z = B.length, A = B.charCodeAt(0) - re;
2387
2408
  if (z >= 2) {
2388
- const _ = L.charCodeAt(1) - re, D = A * 10 + _;
2409
+ const _ = B.charCodeAt(1) - re, D = A * 10 + _;
2389
2410
  if (D >= 1 && D <= R) {
2390
- I += y[D] ?? "", z > 2 && (I += L.substring(2));
2411
+ I += y[D] ?? "", z > 2 && (I += B.substring(2));
2391
2412
  break;
2392
2413
  }
2393
2414
  }
2394
- A >= 1 && A <= R ? (I += y[A] ?? "", z > 1 && (I += L.substring(1))) : I += "$" + L;
2415
+ A >= 1 && A <= R ? (I += y[A] ?? "", z > 1 && (I += B.substring(1))) : I += "$" + B;
2395
2416
  break;
2396
2417
  }
2397
2418
  default:
2398
- N != null ? I += N[P] ?? "" : I += "$<" + P + ">";
2419
+ N != null ? I += N[L] ?? "" : I += "$<" + L + ">";
2399
2420
  }
2400
2421
  }
2401
2422
  }
@@ -2405,23 +2426,23 @@ function Ns(t) {
2405
2426
  offset: [C, C + I.length],
2406
2427
  lines: [0, 0],
2407
2428
  linesOffset: [0, 0]
2408
- }), g += I.length - T, m = x;
2429
+ }), g += I.length - T, h = x;
2409
2430
  }
2410
2431
  if (T === 0 && s.lastIndex++, !s.global)
2411
2432
  break;
2412
2433
  }
2413
2434
  if (s.lastIndex = 0, o == null)
2414
2435
  return { search: { content: r, matches: a }, replace: null };
2415
- p += r.substring(m);
2436
+ p += r.substring(h);
2416
2437
  const w = p.length, M = [0];
2417
2438
  for (let b = 0; b < w; b++)
2418
2439
  p.charCodeAt(b) === Ze && b + 1 < w && M.push(b + 1);
2419
2440
  const E = M.length;
2420
2441
  for (let b = 0, $ = c.length; b < $; b++) {
2421
2442
  const T = c[b], x = T.offset[0], S = T.offset[1];
2422
- let v, B, O, I;
2443
+ let v, P, O, I;
2423
2444
  if (E === 1)
2424
- v = 0, B = 1, O = 0, I = w;
2445
+ v = 0, P = 1, O = 0, I = w;
2425
2446
  else {
2426
2447
  let C = 0, N = E - 1;
2427
2448
  for (; C < N; ) {
@@ -2434,19 +2455,19 @@ function Ns(t) {
2434
2455
  const K = C + N + 1 >> 1;
2435
2456
  M[K] <= R ? C = K : N = K - 1;
2436
2457
  }
2437
- B = C + 1;
2458
+ P = C + 1;
2438
2459
  } else
2439
- B = v + 1;
2440
- O = M[v], I = B < E ? M[B] : w;
2460
+ P = v + 1;
2461
+ O = M[v], I = P < E ? M[P] : w;
2441
2462
  }
2442
- T.lines[0] = v, T.lines[1] = B, T.linesOffset[0] = O, T.linesOffset[1] = I;
2463
+ T.lines[0] = v, T.lines[1] = P, T.linesOffset[0] = O, T.linesOffset[1] = I;
2443
2464
  }
2444
2465
  return {
2445
2466
  search: { content: r, matches: a },
2446
2467
  replace: { content: p, matches: c }
2447
2468
  };
2448
2469
  }
2449
- function Dt(t) {
2470
+ function Ft(t) {
2450
2471
  if (t.length === 0)
2451
2472
  return [];
2452
2473
  const r = [...t].sort((i, a) => {
@@ -2485,34 +2506,34 @@ function oe(t, r, s, o) {
2485
2506
  return { startLine: i, endLine: l, startLineOfs: a, endLineOfs: c + 1 };
2486
2507
  return { startLine: i, endLine: l, startLineOfs: a, endLineOfs: r };
2487
2508
  }
2488
- function ks(t, r) {
2509
+ function Rs(t, r) {
2489
2510
  if (t.replace == null && r.replace == null) {
2490
2511
  const U = [...t.search.matches, ...r.search.matches];
2491
2512
  return {
2492
- search: { content: t.search.content, matches: Dt(U) },
2513
+ search: { content: t.search.content, matches: Ft(U) },
2493
2514
  replace: null
2494
2515
  };
2495
2516
  }
2496
- 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 = [];
2497
- let y = 0, w = 0, M = 0, E = 0, b = 0, $ = 0, T = 0, x = 0, S = 0, v = 0, B = 0, O = 0, I = 0, C = 0, N = 0, R = 0, K = 0, q = 0, P = 0, L = 0, z = 0, A = 0, _ = 0, D = 0;
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 = [];
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;
2498
2519
  for (; y < d || w < p; )
2499
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 < $) {
2500
- K = b < T ? b : T, S = $ > x ? $ : x, B = y, O = w, y++, w++;
2521
+ K = b < T ? b : T, S = $ > x ? $ : x, P = y, O = w, y++, w++;
2501
2522
  do {
2502
2523
  for (v = S; y < d && l[y].offset[0] < S; )
2503
2524
  $ = l[y].offset[1], $ > S && (S = $), y++;
2504
2525
  for (; w < p && u[w].offset[0] < S; )
2505
2526
  x = u[w].offset[1], x > S && (S = x), w++;
2506
2527
  } while (S !== v);
2507
- I = 1 / 0, C = -1 / 0, q = K, P = M;
2508
- for (let G = B; G < y; G++)
2509
- L = c[G].offset[0], z = c[G].offset[1], A = l[G].offset[0], _ = l[G].offset[1], q < A && (D = q + P, D < I && (I = D), D = A + P, D > C && (C = D)), L < I && (I = L), z > C && (C = z), P += z - L - _ + A, q = _;
2510
- q < S && (D = q + P, D < I && (I = D), D = S + P, D > C && (C = D)), M = P, N = 1 / 0, R = -1 / 0, q = K, P = E;
2528
+ I = 1 / 0, C = -1 / 0, q = K, L = M;
2529
+ for (let G = P; G < y; G++)
2530
+ B = c[G].offset[0], z = c[G].offset[1], A = l[G].offset[0], _ = l[G].offset[1], q < A && (D = q + L, D < I && (I = D), D = A + L, D > C && (C = D)), B < I && (I = B), z > C && (C = z), L += z - B - _ + A, q = _;
2531
+ q < S && (D = q + L, D < I && (I = D), D = S + L, D > C && (C = D)), M = L, N = 1 / 0, R = -1 / 0, q = K, L = E;
2511
2532
  for (let G = O; G < w; G++)
2512
- L = u[G].offset[0], z = u[G].offset[1], A = f[G].offset[0], _ = f[G].offset[1], q < L && (D = q + P, D < N && (N = D), D = L + P, D > R && (R = D)), A < N && (N = A), _ > R && (R = _), P += _ - A - z + L, q = z;
2513
- q < S && (D = q + P, D < N && (N = D), D = S + P, D > R && (R = D)), E = P;
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;
2534
+ q < S && (D = q + L, D < N && (N = D), D = S + L, D > R && (R = D)), E = L;
2514
2535
  const U = oe(e, i, I, C);
2515
- m.push({
2536
+ h.push({
2516
2537
  offset: [I, C],
2517
2538
  lines: [U.startLine, U.endLine],
2518
2539
  linesOffset: [U.startLineOfs, U.endLineOfs]
@@ -2524,30 +2545,30 @@ function ks(t, r) {
2524
2545
  linesOffset: [te.startLineOfs, te.endLineOfs]
2525
2546
  });
2526
2547
  } else if (w >= p || y < d && b <= T) {
2527
- L = c[y].offset[0], z = c[y].offset[1], A = l[y].offset[0], _ = l[y].offset[1], N = A + E, R = _ + E;
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;
2528
2549
  const U = oe(n, a, N, R);
2529
- m.push(c[y]), g.push({
2550
+ h.push(c[y]), g.push({
2530
2551
  offset: [N, R],
2531
2552
  lines: [U.startLine, U.endLine],
2532
2553
  linesOffset: [U.startLineOfs, U.endLineOfs]
2533
- }), M += z - L - _ + A, y++;
2554
+ }), M += z - B - _ + A, y++;
2534
2555
  } else {
2535
- L = u[w].offset[0], z = u[w].offset[1], A = f[w].offset[0], _ = f[w].offset[1], I = L + M, C = z + M;
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;
2536
2557
  const U = oe(e, i, I, C);
2537
- m.push({
2558
+ h.push({
2538
2559
  offset: [I, C],
2539
2560
  lines: [U.startLine, U.endLine],
2540
2561
  linesOffset: [U.startLineOfs, U.endLineOfs]
2541
- }), g.push(f[w]), E += _ - A - z + L, w++;
2562
+ }), g.push(f[w]), E += _ - A - z + B, w++;
2542
2563
  }
2543
2564
  return {
2544
- search: { content: e, matches: m },
2565
+ search: { content: e, matches: h },
2545
2566
  replace: { content: n, matches: g }
2546
2567
  };
2547
2568
  }
2548
- async function Os(t) {
2569
+ async function Ds(t) {
2549
2570
  const { filePath: r, operations: s, dryRun: o } = t;
2550
- return s.length === 0 ? { filePath: r, result: null } : $s({
2571
+ return s.length === 0 ? { filePath: r, result: null } : Ms({
2551
2572
  filePath: r,
2552
2573
  func: async () => {
2553
2574
  let e;
@@ -2573,12 +2594,12 @@ async function Os(t) {
2573
2594
  error: `Invalid RegExp pattern "${c.pattern}": ${d instanceof Error ? d.message : d + ""}`
2574
2595
  };
2575
2596
  }
2576
- const u = n?.replace?.content ?? e, f = Ns({
2597
+ const u = n?.replace?.content ?? e, f = Os({
2577
2598
  content: u,
2578
2599
  pattern: l,
2579
2600
  replacement: c.replacement
2580
2601
  });
2581
- 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);
2582
2603
  }
2583
2604
  if (i && n?.replace != null && !o) {
2584
2605
  const a = n.replace.content;
@@ -2616,13 +2637,13 @@ async function $e(t) {
2616
2637
  error: "Not replaced, try again"
2617
2638
  };
2618
2639
  }
2619
- return Os({ filePath: i, operations: s, dryRun: o });
2640
+ return Ds({ filePath: i, operations: s, dryRun: o });
2620
2641
  })
2621
2642
  ) };
2622
2643
  }
2623
- const Rs = 6;
2624
- function Ds(t) {
2625
- 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;
2626
2647
  let e = "", n = 0, i = 0;
2627
2648
  for (; n < r.length; ) {
2628
2649
  const a = r.indexOf(`
@@ -2637,13 +2658,13 @@ function fe(t) {
2637
2658
  const { content: r, matches: s, outputLimit: o } = t;
2638
2659
  if (s.length === 0)
2639
2660
  return { output: "", truncated: !1 };
2640
- const e = Dt(s);
2661
+ const e = Ft(s);
2641
2662
  let n = "", i = !1;
2642
2663
  for (let a = 0; a < e.length; a++) {
2643
2664
  const c = e[a], l = r.substring(
2644
2665
  c.linesOffset[0],
2645
2666
  c.linesOffset[1]
2646
- ), u = Ds({
2667
+ ), u = Ps({
2647
2668
  content: l,
2648
2669
  startLine: c.lines[0]
2649
2670
  }), f = a > 0 ? 2 : 0;
@@ -2657,15 +2678,15 @@ function fe(t) {
2657
2678
  return { output: n, truncated: i };
2658
2679
  }
2659
2680
  const ot = "BEFORE", nt = "AFTER";
2660
- function Fs(t) {
2681
+ function Bs(t) {
2661
2682
  const { result: r, outputLimit: s } = t;
2662
2683
  if (r.replace == null) {
2663
- const m = fe({
2684
+ const h = fe({
2664
2685
  content: r.search.content,
2665
2686
  matches: r.search.matches,
2666
2687
  outputLimit: s
2667
2688
  });
2668
- return { output: m.output, truncated: m.truncated };
2689
+ return { output: h.output, truncated: h.truncated };
2669
2690
  }
2670
2691
  const o = `<${ot}>
2671
2692
  `, e = `</${ot}>
@@ -2700,7 +2721,7 @@ function Ie(t) {
2700
2721
  }
2701
2722
  if (o || i.result == null || i.result.search.matches.length === 0)
2702
2723
  continue;
2703
- const l = Fs({
2724
+ const l = Bs({
2704
2725
  result: i.result
2705
2726
  });
2706
2727
  l.output.length > 0 && (c > 0 && (e += `
@@ -2709,25 +2730,25 @@ function Ie(t) {
2709
2730
  }
2710
2731
  return e;
2711
2732
  }
2712
- const Bs = h.object({
2713
- pattern: h.string().describe("JS RegExp pattern"),
2714
- flags: h.string().default("gm").describe('JS RegExp flags. Default: "gm"')
2715
- }), Ft = h.object({
2716
- 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"),
2717
2738
  snapshot: ee.optional().describe(
2718
2739
  "Filesystem snapshot creation options JSON to automatically create snapshot"
2719
2740
  ),
2720
- bulkOperations: h.array(Bs).describe(
2741
+ bulkOperations: m.array(Ls).describe(
2721
2742
  "All search patterns to execute; include every pattern here; never split across multiple calls"
2722
2743
  ),
2723
- outputLimit: h.number().int().min(0).max(J).default(Q).describe(
2744
+ outputLimit: m.number().int().min(0).max(J).default(Q).describe(
2724
2745
  `Maximum output characters. Output exceeding this limit will be truncated. Maximum: ${J}. Default: ${Q}`
2725
2746
  )
2726
2747
  });
2727
- async function Ls(t, r, s) {
2748
+ async function As(t, r, s) {
2728
2749
  let o;
2729
2750
  try {
2730
- o = Ft.parse(t);
2751
+ o = Pt.parse(t);
2731
2752
  } catch (w) {
2732
2753
  return {
2733
2754
  error: F(w)
@@ -2764,11 +2785,11 @@ async function Ls(t, r, s) {
2764
2785
  return {
2765
2786
  error: "Either snapshotName or snapshot must be provided"
2766
2787
  };
2767
- const d = Rt(l), p = l.query.rootDir ?? ".", m = await $e({
2788
+ const d = Dt(l), p = l.query.rootDir ?? ".", h = await $e({
2768
2789
  filePaths: d,
2769
2790
  operations: i
2770
2791
  }), g = Ie({
2771
- result: m,
2792
+ result: h,
2772
2793
  rootDir: p
2773
2794
  });
2774
2795
  return { output: we({
@@ -2777,16 +2798,16 @@ async function Ls(t, r, s) {
2777
2798
  limit: a
2778
2799
  }).content, rootDir: p, fsSnapshot: l, queryCreated: u, snapshotCreated: f };
2779
2800
  }
2780
- function Ps(t, r) {
2801
+ function zs(t, r) {
2781
2802
  t(
2782
2803
  "fs-snapshot-search",
2783
2804
  {
2784
2805
  title: "Search File Contents in Snapshot",
2785
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",
2786
- inputSchema: Ft.shape
2807
+ inputSchema: Pt.shape
2787
2808
  },
2788
2809
  async (s, o) => {
2789
- const e = await Ls(
2810
+ const e = await As(
2790
2811
  s,
2791
2812
  r,
2792
2813
  o
@@ -2807,23 +2828,23 @@ Reminder: use one snapshot covering all target files; include all patterns in th
2807
2828
  }
2808
2829
  );
2809
2830
  }
2810
- const As = h.object({
2811
- pattern: h.string().describe("JS RegExp pattern"),
2812
- flags: h.string().default("gm").describe('JS RegExp flags. Default: "gm"'),
2813
- replacement: h.string().describe("JS replacement pattern")
2814
- }), Bt = h.object({
2815
- 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"),
2816
2837
  snapshot: ee.optional().describe(
2817
2838
  "Filesystem snapshot creation options JSON to automatically create snapshot"
2818
2839
  ),
2819
- bulkOperations: h.array(As).describe(
2840
+ bulkOperations: m.array(Us).describe(
2820
2841
  "All replace patterns to execute; include every pattern here; never split across multiple calls"
2821
2842
  ),
2822
- outputLimit: h.number().int().min(0).max(J).default(Q).describe(
2843
+ outputLimit: m.number().int().min(0).max(J).default(Q).describe(
2823
2844
  `Maximum output characters. Output exceeding this limit will be truncated. Maximum: ${J}. Default: ${Q}`
2824
2845
  )
2825
2846
  });
2826
- async function zs(t, r, s) {
2847
+ async function js(t, r, s) {
2827
2848
  let o;
2828
2849
  try {
2829
2850
  o = Bt.parse(t);
@@ -2863,16 +2884,16 @@ async function zs(t, r, s) {
2863
2884
  return {
2864
2885
  error: "Either snapshotName or snapshot must be provided"
2865
2886
  };
2866
- const d = Rt(l), p = l.query.rootDir ?? ".", m = {
2887
+ const d = Dt(l), p = l.query.rootDir ?? ".", h = {
2867
2888
  filePaths: d,
2868
2889
  operations: i
2869
2890
  }, g = Date.now(), y = await $e({
2870
- ...m,
2891
+ ...h,
2871
2892
  dryRun: !0
2872
- }), w = ns();
2893
+ }), w = as();
2873
2894
  c.preparedReplace = {
2874
2895
  id: w,
2875
- options: m,
2896
+ options: h,
2876
2897
  rootDir: p,
2877
2898
  dateCreated: g
2878
2899
  };
@@ -2888,7 +2909,7 @@ Review the output carefully before executing. Call fs-snapshot-replace-execute w
2888
2909
  limit: a
2889
2910
  }).content, rootDir: p, fsSnapshot: l, queryCreated: u, snapshotCreated: f };
2890
2911
  }
2891
- function Us(t, r) {
2912
+ function qs(t, r) {
2892
2913
  t(
2893
2914
  "fs-snapshot-replace-prepare",
2894
2915
  {
@@ -2897,7 +2918,7 @@ function Us(t, r) {
2897
2918
  inputSchema: Bt.shape
2898
2919
  },
2899
2920
  async (s, o) => {
2900
- const e = await zs(
2921
+ const e = await js(
2901
2922
  s,
2902
2923
  r,
2903
2924
  o
@@ -2918,10 +2939,10 @@ Reminder: use one snapshot covering all target files; include all patterns in th
2918
2939
  }
2919
2940
  );
2920
2941
  }
2921
- const Lt = h.object({
2922
- 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.")
2923
2944
  });
2924
- async function js(t, r, s) {
2945
+ async function _s(t, r, s) {
2925
2946
  let o;
2926
2947
  try {
2927
2948
  o = Lt.parse(t);
@@ -2954,7 +2975,7 @@ async function js(t, r, s) {
2954
2975
  errorsOnly: !0
2955
2976
  }) || null };
2956
2977
  }
2957
- function qs(t, r) {
2978
+ function Gs(t, r) {
2958
2979
  t(
2959
2980
  "fs-snapshot-replace-execute",
2960
2981
  {
@@ -2963,7 +2984,7 @@ function qs(t, r) {
2963
2984
  inputSchema: Lt.shape
2964
2985
  },
2965
2986
  async (s, o) => {
2966
- const e = await js(
2987
+ const e = await _s(
2967
2988
  s,
2968
2989
  r,
2969
2990
  o
@@ -2978,8 +2999,8 @@ ${e.output}`), n;
2978
2999
  }
2979
3000
  );
2980
3001
  }
2981
- function _s(t, r) {
2982
- r.list && ss(t, r), r.snapshotQueryCreate && as(t, r), r.snapshotCreate && ms(t, r), r.snapshotBrowse && Ss(t, r), r.snapshotSearch && Ps(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(
2983
3004
  `File manager:
2984
3005
  - Working directory: ${k.resolve(r.workingDir || "")}
2985
3006
  `
@@ -2992,15 +3013,15 @@ function W(t) {
2992
3013
  domSnapshotQueries: /* @__PURE__ */ new Map()
2993
3014
  }), pe.get(t);
2994
3015
  }
2995
- const Me = h.object({
2996
- name: h.string().describe(
3016
+ const Me = m.object({
3017
+ name: m.string().describe(
2997
3018
  "Unique name for the browser. Recommended format: kebab-case-1, kebab-case-2, ..."
2998
3019
  ),
2999
- browserType: h.enum(["chromium", "firefox", "webkit"]).describe("Browser type to launch"),
3000
- muteAudio: h.boolean().optional().describe("Mute audio in the browser"),
3001
- 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")
3002
3023
  });
3003
- async function Pt(t, r, s) {
3024
+ async function At(t, r, s) {
3004
3025
  let o;
3005
3026
  try {
3006
3027
  o = Me.parse(t);
@@ -3017,9 +3038,9 @@ async function Pt(t, r, s) {
3017
3038
  const c = W(s.sessionId);
3018
3039
  try {
3019
3040
  const u = await {
3020
- chromium: cr,
3021
- firefox: lr,
3022
- webkit: ar
3041
+ chromium: ur,
3042
+ firefox: cr,
3043
+ webkit: lr
3023
3044
  }[n].launch({
3024
3045
  headless: !1,
3025
3046
  devtools: a,
@@ -3037,7 +3058,7 @@ async function Pt(t, r, s) {
3037
3058
  };
3038
3059
  }
3039
3060
  }
3040
- function Gs(t, r) {
3061
+ function Ws(t, r) {
3041
3062
  t(
3042
3063
  "playwright-browser-create",
3043
3064
  {
@@ -3046,17 +3067,17 @@ function Gs(t, r) {
3046
3067
  inputSchema: Me.shape
3047
3068
  },
3048
3069
  async (s, o) => {
3049
- const e = await Pt(s, r, o);
3070
+ const e = await At(s, r, o);
3050
3071
  return `Method: playwright-browser-create(${JSON.stringify(s)})
3051
3072
  ${e.error != null ? `❌ Error: ${e.error}` : `✅ Browser "${e.browserInfo.name}" (${e.browserInfo.browserType}) created successfully`}`;
3052
3073
  }
3053
3074
  );
3054
3075
  }
3055
- const At = h.object({});
3056
- async function Js(t, r, s) {
3076
+ const zt = m.object({});
3077
+ async function Ks(t, r, s) {
3057
3078
  let o;
3058
3079
  try {
3059
- o = At.parse(t);
3080
+ o = zt.parse(t);
3060
3081
  } catch (i) {
3061
3082
  return {
3062
3083
  error: F(i)
@@ -3071,16 +3092,16 @@ async function Js(t, r, s) {
3071
3092
  browserInfos: Array.from(e.browsers.values())
3072
3093
  };
3073
3094
  }
3074
- function Ws(t, r) {
3095
+ function Hs(t, r) {
3075
3096
  t(
3076
3097
  "playwright-browser-list",
3077
3098
  {
3078
3099
  title: "List Browsers",
3079
3100
  description: "List active browser instances",
3080
- inputSchema: At.shape
3101
+ inputSchema: zt.shape
3081
3102
  },
3082
3103
  async (s, o) => {
3083
- const e = await Js(s, r, o);
3104
+ const e = await Ks(s, r, o);
3084
3105
  if (e.error != null)
3085
3106
  return `Method: playwright-browser-list(${JSON.stringify(s)})
3086
3107
  ❌ Error: ${e.error}`;
@@ -3092,15 +3113,15 @@ ${n.length === 0 ? "No browsers found" : `Browsers: ${n.join(", ")}`}`;
3092
3113
  }
3093
3114
  );
3094
3115
  }
3095
- const zt = h.object({
3096
- names: h.array(h.string()).optional().describe(
3116
+ const Ut = m.object({
3117
+ names: m.array(m.string()).optional().describe(
3097
3118
  "Names of browsers to close. If not specified, closes all browsers"
3098
3119
  )
3099
3120
  });
3100
- async function Ks(t, r, s) {
3121
+ async function Qs(t, r, s) {
3101
3122
  let o;
3102
3123
  try {
3103
- o = zt.parse(t);
3124
+ o = Ut.parse(t);
3104
3125
  } catch (l) {
3105
3126
  return {
3106
3127
  error: F(l)
@@ -3131,16 +3152,16 @@ async function Ks(t, r, s) {
3131
3152
  ...a.length > 0 && { errors: a }
3132
3153
  };
3133
3154
  }
3134
- function Hs(t, r) {
3155
+ function Ys(t, r) {
3135
3156
  t(
3136
3157
  "playwright-browser-close",
3137
3158
  {
3138
3159
  title: "Close Browsers",
3139
3160
  description: "Close browsers. Automatically closes all contexts and pages within the browsers",
3140
- inputSchema: zt.shape
3161
+ inputSchema: Ut.shape
3141
3162
  },
3142
3163
  async (s, o) => {
3143
- const e = await Ks(s, r, o);
3164
+ const e = await Qs(s, r, o);
3144
3165
  if (e.error != null)
3145
3166
  return `Method: playwright-browser-close(${JSON.stringify(s)})
3146
3167
  ❌ Error: ${e.error}`;
@@ -3157,22 +3178,22 @@ ${n.join(`
3157
3178
  }
3158
3179
  );
3159
3180
  }
3160
- const Te = h.object({
3161
- 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"),
3162
3183
  browser: Me.optional().describe(
3163
3184
  "Browser creation options JSON to automatically create browser"
3164
3185
  ),
3165
- name: h.string().describe(
3186
+ name: m.string().describe(
3166
3187
  "Unique name for the context. Recommended format: kebab-case-1, kebab-case-2, ..."
3167
3188
  ),
3168
- isMobile: h.boolean().optional().describe("Configure for mobile device simulation"),
3169
- hasTouch: h.boolean().optional().describe("Enable touch events"),
3170
- viewport: h.object({
3171
- width: h.number(),
3172
- 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()
3173
3194
  }).optional().describe("Viewport size configuration")
3174
3195
  });
3175
- async function Ut(t, r, s) {
3196
+ async function jt(t, r, s) {
3176
3197
  let o;
3177
3198
  try {
3178
3199
  o = Te.parse(t);
@@ -3198,7 +3219,7 @@ async function Ut(t, r, s) {
3198
3219
  error: `Browser "${n}" not found`
3199
3220
  };
3200
3221
  } else if (i) {
3201
- const p = await Pt(i, r, s);
3222
+ const p = await At(i, r, s);
3202
3223
  if (p.error != null)
3203
3224
  return {
3204
3225
  error: p.error
@@ -3213,16 +3234,16 @@ async function Ut(t, r, s) {
3213
3234
  isMobile: a,
3214
3235
  hasTouch: c,
3215
3236
  viewport: l
3216
- }), m = {
3237
+ }), h = {
3217
3238
  browserInfo: d,
3218
3239
  name: e,
3219
3240
  context: p,
3220
3241
  pages: /* @__PURE__ */ new Map()
3221
3242
  };
3222
- return d.contexts.set(e, m), {
3243
+ return d.contexts.set(e, h), {
3223
3244
  browserInfoCreated: f,
3224
3245
  browserInfo: d,
3225
- contextInfo: m
3246
+ contextInfo: h
3226
3247
  };
3227
3248
  } catch (p) {
3228
3249
  return {
@@ -3230,7 +3251,7 @@ async function Ut(t, r, s) {
3230
3251
  };
3231
3252
  }
3232
3253
  }
3233
- function Qs(t, r) {
3254
+ function Vs(t, r) {
3234
3255
  t(
3235
3256
  "playwright-context-create",
3236
3257
  {
@@ -3239,7 +3260,7 @@ function Qs(t, r) {
3239
3260
  inputSchema: Te.shape
3240
3261
  },
3241
3262
  async (s, o) => {
3242
- const e = await Ut(s, r, o);
3263
+ const e = await jt(s, r, o);
3243
3264
  if (e.error != null)
3244
3265
  return `Method: playwright-context-create(${JSON.stringify(s)})
3245
3266
  ❌ Error: ${e.error}`;
@@ -3250,15 +3271,15 @@ function Qs(t, r) {
3250
3271
  }
3251
3272
  );
3252
3273
  }
3253
- const jt = h.object({
3254
- browserName: h.string().optional().describe(
3274
+ const qt = m.object({
3275
+ browserName: m.string().optional().describe(
3255
3276
  "Name of browser to list contexts from. If not specified, lists contexts from all browsers"
3256
3277
  )
3257
3278
  });
3258
- async function Ys(t, r, s) {
3279
+ async function Zs(t, r, s) {
3259
3280
  let o;
3260
3281
  try {
3261
- o = jt.parse(t);
3282
+ o = qt.parse(t);
3262
3283
  } catch (a) {
3263
3284
  return {
3264
3285
  error: F(a)
@@ -3292,16 +3313,16 @@ async function Ys(t, r, s) {
3292
3313
  contextsByBrowser: i
3293
3314
  };
3294
3315
  }
3295
- function Vs(t, r) {
3316
+ function Xs(t, r) {
3296
3317
  t(
3297
3318
  "playwright-context-list",
3298
3319
  {
3299
3320
  title: "List Browser Contexts",
3300
3321
  description: "List active browser contexts",
3301
- inputSchema: jt.shape
3322
+ inputSchema: qt.shape
3302
3323
  },
3303
3324
  async (s, o) => {
3304
- const e = await Ys(s, r, o);
3325
+ const e = await Zs(s, r, o);
3305
3326
  if ("error" in e)
3306
3327
  return `Method: playwright-context-list(${JSON.stringify(s)})
3307
3328
  ❌ Error: ${e.error}`;
@@ -3314,18 +3335,18 @@ function Vs(t, r) {
3314
3335
  }
3315
3336
  );
3316
3337
  }
3317
- const qt = h.object({
3318
- names: h.array(h.string()).optional().describe(
3338
+ const _t = m.object({
3339
+ names: m.array(m.string()).optional().describe(
3319
3340
  "Names of contexts to close. If not specified, closes all contexts"
3320
3341
  ),
3321
- browserName: h.string().optional().describe(
3342
+ browserName: m.string().optional().describe(
3322
3343
  "Name of browser to close contexts from. If not specified, searches all browsers"
3323
3344
  )
3324
3345
  });
3325
- async function Zs(t, r, s) {
3346
+ async function eo(t, r, s) {
3326
3347
  let o;
3327
3348
  try {
3328
- o = qt.parse(t);
3349
+ o = _t.parse(t);
3329
3350
  } catch (u) {
3330
3351
  return {
3331
3352
  error: F(u)
@@ -3376,16 +3397,16 @@ async function Zs(t, r, s) {
3376
3397
  ...c.length > 0 && { errors: c }
3377
3398
  };
3378
3399
  }
3379
- function Xs(t, r) {
3400
+ function to(t, r) {
3380
3401
  t(
3381
3402
  "playwright-context-close",
3382
3403
  {
3383
3404
  title: "Close Browser Contexts",
3384
3405
  description: "Close browser contexts. Automatically closes all pages within the contexts",
3385
- inputSchema: qt.shape
3406
+ inputSchema: _t.shape
3386
3407
  },
3387
3408
  async (s, o) => {
3388
- const e = await Zs(s, r, o);
3409
+ const e = await eo(s, r, o);
3389
3410
  if ("error" in e)
3390
3411
  return `Method: playwright-context-close(${JSON.stringify(s)})
3391
3412
  ❌ Error: ${e.error}`;
@@ -3402,7 +3423,7 @@ ${n.join(`
3402
3423
  }
3403
3424
  );
3404
3425
  }
3405
- function eo() {
3426
+ function ro() {
3406
3427
  class t {
3407
3428
  prevId = 0;
3408
3429
  objectToId = /* @__PURE__ */ new WeakMap();
@@ -3428,13 +3449,13 @@ function eo() {
3428
3449
  function r(a, c, l) {
3429
3450
  let u = null;
3430
3451
  for (let f = 0, d = c.length; f < d; f++) {
3431
- 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);
3432
3453
  y != null && (u == null && (u = []), u.push(y));
3433
3454
  }
3434
3455
  return u;
3435
3456
  }
3436
3457
  function s(a) {
3437
- 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(
3438
3459
  l,
3439
3460
  u,
3440
3461
  (w, M) => {
@@ -3443,7 +3464,7 @@ function eo() {
3443
3464
  const b = c(w);
3444
3465
  d.set(b, E), p.set(E, b);
3445
3466
  }
3446
- return E != null && M != null && m.set(
3467
+ return E != null && M != null && h.set(
3447
3468
  p.get(E),
3448
3469
  M.map((b) => p.get(b))
3449
3470
  ), E;
@@ -3451,29 +3472,29 @@ function eo() {
3451
3472
  ), y = f(null, g);
3452
3473
  if (y == null)
3453
3474
  throw new Error("Impossible behavior: rootNode == null");
3454
- return d.set(null, y), g != null && m.set(
3475
+ return d.set(null, y), g != null && h.set(
3455
3476
  null,
3456
3477
  g.map((w) => p.get(w))
3457
3478
  ), {
3458
3479
  idToNode: d,
3459
- idToChildIds: m
3480
+ idToChildIds: h
3460
3481
  };
3461
3482
  }
3462
3483
  const o = (a) => a instanceof HTMLElement ? a.childNodes : null;
3463
3484
  function e(a) {
3464
3485
  return function(l, u) {
3465
3486
  const f = u != null && u.length > 0;
3466
- let d = !1, p = null, m = null;
3487
+ let d = !1, p = null, h = null;
3467
3488
  if (l instanceof HTMLElement) {
3468
- 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)
3469
3490
  return null;
3470
3491
  } else if (l == null)
3471
- p = null, m = null, d = !1;
3492
+ p = null, h = null, d = !1;
3472
3493
  else
3473
3494
  return null;
3474
3495
  return {
3475
3496
  uid: p,
3476
- tagName: m,
3497
+ tagName: h,
3477
3498
  isMatched: d
3478
3499
  };
3479
3500
  };
@@ -3490,16 +3511,16 @@ function eo() {
3490
3511
  }
3491
3512
  window.__mcp_playwright_tool_tx4byhar35_createDomSnapshotTreeRawDom = i;
3492
3513
  }
3493
- const to = `(function (){function __name(fn){return fn};${eo.toString()}; setupPageGlobals();})()`, Ce = h.object({
3494
- 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"),
3495
3516
  context: Te.optional().describe(
3496
3517
  "Context creation options JSON to automatically create context"
3497
3518
  ),
3498
- name: h.string().describe(
3519
+ name: m.string().describe(
3499
3520
  "Unique name for the page. Recommended format: kebab-case-1, kebab-case-2, ..."
3500
3521
  )
3501
3522
  });
3502
- async function _t(t, r, s) {
3523
+ async function Gt(t, r, s) {
3503
3524
  let o;
3504
3525
  try {
3505
3526
  o = Ce.parse(t);
@@ -3530,7 +3551,7 @@ async function _t(t, r, s) {
3530
3551
  error: `Context "${n}" not found`
3531
3552
  };
3532
3553
  } else if (i) {
3533
- const f = await Ut(i, r, s);
3554
+ const f = await jt(i, r, s);
3534
3555
  if (f.error != null)
3535
3556
  return {
3536
3557
  error: f.error
@@ -3542,7 +3563,7 @@ async function _t(t, r, s) {
3542
3563
  };
3543
3564
  try {
3544
3565
  const f = await u.context.newPage();
3545
- await f.addInitScript(to), await f.goto("about:blank");
3566
+ await f.addInitScript(so), await f.goto("about:blank");
3546
3567
  const d = {
3547
3568
  contextInfo: u,
3548
3569
  name: e,
@@ -3560,7 +3581,7 @@ async function _t(t, r, s) {
3560
3581
  };
3561
3582
  }
3562
3583
  }
3563
- function ro(t, r) {
3584
+ function oo(t, r) {
3564
3585
  t(
3565
3586
  "playwright-page-create",
3566
3587
  {
@@ -3569,7 +3590,7 @@ function ro(t, r) {
3569
3590
  inputSchema: Ce.shape
3570
3591
  },
3571
3592
  async (s, o) => {
3572
- const e = await _t(s, r, o);
3593
+ const e = await Gt(s, r, o);
3573
3594
  if (e.error != null)
3574
3595
  return `Method: playwright-page-create(${JSON.stringify(s)})
3575
3596
  ❌ Error: ${e.error}`;
@@ -3581,18 +3602,18 @@ function ro(t, r) {
3581
3602
  }
3582
3603
  );
3583
3604
  }
3584
- const Gt = h.object({
3585
- contextName: h.string().optional().describe(
3605
+ const Jt = m.object({
3606
+ contextName: m.string().optional().describe(
3586
3607
  "Name of context to list pages from. If not specified, lists pages from all contexts"
3587
3608
  ),
3588
- browserName: h.string().optional().describe(
3609
+ browserName: m.string().optional().describe(
3589
3610
  "Name of browser to search in. If not specified, searches all browsers"
3590
3611
  )
3591
3612
  });
3592
- async function so(t, r, s) {
3613
+ async function no(t, r, s) {
3593
3614
  let o;
3594
3615
  try {
3595
- o = Gt.parse(t);
3616
+ o = Jt.parse(t);
3596
3617
  } catch (c) {
3597
3618
  return {
3598
3619
  error: F(c)
@@ -3653,16 +3674,16 @@ async function so(t, r, s) {
3653
3674
  pagesByContext: a
3654
3675
  };
3655
3676
  }
3656
- function oo(t, r) {
3677
+ function io(t, r) {
3657
3678
  t(
3658
3679
  "playwright-page-list",
3659
3680
  {
3660
3681
  title: "List Pages",
3661
3682
  description: "List active pages",
3662
- inputSchema: Gt.shape
3683
+ inputSchema: Jt.shape
3663
3684
  },
3664
3685
  async (s, o) => {
3665
- const e = await so(s, r, o);
3686
+ const e = await no(s, r, o);
3666
3687
  if ("error" in e)
3667
3688
  return `Method: playwright-page-list(${JSON.stringify(s)})
3668
3689
  ❌ Error: ${e.error}`;
@@ -3675,19 +3696,19 @@ function oo(t, r) {
3675
3696
  }
3676
3697
  );
3677
3698
  }
3678
- const Jt = h.object({
3679
- names: h.array(h.string()).optional().describe("Names of pages to close. If not specified, closes all pages"),
3680
- 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(
3681
3702
  "Name of context to close pages from. If not specified, searches all contexts"
3682
3703
  ),
3683
- browserName: h.string().optional().describe(
3704
+ browserName: m.string().optional().describe(
3684
3705
  "Name of browser to search in. If not specified, searches all browsers"
3685
3706
  )
3686
3707
  });
3687
- async function no(t, r, s) {
3708
+ async function ao(t, r, s) {
3688
3709
  let o;
3689
3710
  try {
3690
- o = Jt.parse(t);
3711
+ o = Wt.parse(t);
3691
3712
  } catch (f) {
3692
3713
  return {
3693
3714
  error: F(f)
@@ -3713,16 +3734,16 @@ async function no(t, r, s) {
3713
3734
  error: `Context "${n}" not found in browser "${f.name}" (${f.browserType})`
3714
3735
  };
3715
3736
  e ? e.forEach((p) => {
3716
- const m = d.pages.get(p);
3717
- m ? u.push(m) : l.push(
3737
+ const h = d.pages.get(p);
3738
+ h ? u.push(h) : l.push(
3718
3739
  `Page "${p}" not found in context "${d.name}" in browser "${f.name}" (${f.browserType})`
3719
3740
  );
3720
3741
  }) : u = Array.from(d.pages.values());
3721
3742
  } else
3722
3743
  for (const d of f.contexts.values())
3723
3744
  e ? e.forEach((p) => {
3724
- const m = d.pages.get(p);
3725
- m ? u.push(m) : l.push(
3745
+ const h = d.pages.get(p);
3746
+ h ? u.push(h) : l.push(
3726
3747
  `Page "${p}" not found in context "${d.name}" in browser "${f.name}" (${f.browserType})`
3727
3748
  );
3728
3749
  }) : u.push(...Array.from(d.pages.values()));
@@ -3730,8 +3751,8 @@ async function no(t, r, s) {
3730
3751
  for (const f of a.browsers.values()) {
3731
3752
  const d = f.contexts.get(n);
3732
3753
  d && (e ? e.forEach((p) => {
3733
- const m = d.pages.get(p);
3734
- m ? u.push(m) : l.push(
3754
+ const h = d.pages.get(p);
3755
+ h ? u.push(h) : l.push(
3735
3756
  `Page "${p}" not found in context "${d.name}" in browser "${f.name}" (${f.browserType})`
3736
3757
  );
3737
3758
  }) : u.push(...Array.from(d.pages.values())));
@@ -3740,8 +3761,8 @@ async function no(t, r, s) {
3740
3761
  for (const f of a.browsers.values())
3741
3762
  for (const d of f.contexts.values())
3742
3763
  e ? e.forEach((p) => {
3743
- const m = d.pages.get(p);
3744
- m ? u.push(m) : l.push(
3764
+ const h = d.pages.get(p);
3765
+ h ? u.push(h) : l.push(
3745
3766
  `Page "${p}" not found in context "${d.name}" in browser "${f.name}" (${f.browserType})`
3746
3767
  );
3747
3768
  }) : u.push(...Array.from(d.pages.values()));
@@ -3762,16 +3783,16 @@ async function no(t, r, s) {
3762
3783
  ...l.length > 0 && { errors: l }
3763
3784
  };
3764
3785
  }
3765
- function io(t, r) {
3786
+ function lo(t, r) {
3766
3787
  t(
3767
3788
  "playwright-page-close",
3768
3789
  {
3769
3790
  title: "Close Pages",
3770
3791
  description: "Close pages",
3771
- inputSchema: Jt.shape
3792
+ inputSchema: Wt.shape
3772
3793
  },
3773
3794
  async (s, o) => {
3774
- const e = await no(s, r, o);
3795
+ const e = await ao(s, r, o);
3775
3796
  if ("error" in e)
3776
3797
  return `Method: playwright-page-close(${JSON.stringify(s)})
3777
3798
  ❌ Error: ${e.error}`;
@@ -3782,14 +3803,14 @@ ${n.join(`
3782
3803
  }
3783
3804
  );
3784
3805
  }
3785
- const Wt = h.object({
3786
- 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"),
3787
3808
  page: Ce.optional().describe(
3788
3809
  "Page creation options JSON to automatically create page"
3789
3810
  ),
3790
- url: h.string().describe("URL to navigate to"),
3791
- timeout: h.number().describe("Timeout in seconds"),
3792
- 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(
3793
3814
  `Wait until event:
3794
3815
  - 'domcontentloaded': DOMContentLoaded event is fired
3795
3816
  - 'load': load event is fired
@@ -3797,13 +3818,13 @@ const Wt = h.object({
3797
3818
  - 'commit': network response received and document started loading`
3798
3819
  )
3799
3820
  });
3800
- async function ao(t, r, s) {
3821
+ async function co(t, r, s) {
3801
3822
  let o;
3802
3823
  try {
3803
- o = Wt.parse(t);
3804
- } catch (m) {
3824
+ o = Kt.parse(t);
3825
+ } catch (h) {
3805
3826
  return {
3806
- error: F(m)
3827
+ error: F(h)
3807
3828
  };
3808
3829
  }
3809
3830
  const { pageName: e, page: n, url: i, timeout: a, waitUntil: c } = o;
@@ -3818,8 +3839,8 @@ async function ao(t, r, s) {
3818
3839
  };
3819
3840
  let u = !1, f = !1, d = !1, p;
3820
3841
  if (e) {
3821
- for (const m of l.browsers.values()) {
3822
- for (const g of m.contexts.values())
3842
+ for (const h of l.browsers.values()) {
3843
+ for (const g of h.contexts.values())
3823
3844
  if (g.pages.has(e)) {
3824
3845
  p = g.pages.get(e);
3825
3846
  break;
@@ -3831,27 +3852,27 @@ async function ao(t, r, s) {
3831
3852
  error: `Page "${e}" not found`
3832
3853
  };
3833
3854
  } else if (n) {
3834
- const m = await _t(n, r, s);
3835
- if (m.error != null)
3855
+ const h = await Gt(n, r, s);
3856
+ if (h.error != null)
3836
3857
  return {
3837
- error: m.error
3858
+ error: h.error
3838
3859
  };
3839
- p = m.pageInfo, u = m.browserInfoCreated, f = m.contextInfoCreated, d = !0;
3860
+ p = h.pageInfo, u = h.browserInfoCreated, f = h.contextInfoCreated, d = !0;
3840
3861
  } else
3841
3862
  return {
3842
3863
  error: "Either pageName or page must be provided"
3843
3864
  };
3844
3865
  try {
3845
- const m = await p.page.goto(i, {
3866
+ const h = await p.page.goto(i, {
3846
3867
  timeout: a * 1e3,
3847
3868
  waitUntil: c
3848
3869
  });
3849
- return m ? {
3870
+ return h ? {
3850
3871
  browserInfoCreated: u,
3851
3872
  contextInfoCreated: f,
3852
3873
  pageInfoCreated: d,
3853
3874
  pageInfo: p,
3854
- status: m.status()
3875
+ status: h.status()
3855
3876
  } : {
3856
3877
  browserInfoCreated: u,
3857
3878
  contextInfoCreated: f,
@@ -3859,22 +3880,22 @@ async function ao(t, r, s) {
3859
3880
  pageInfo: p,
3860
3881
  status: 200
3861
3882
  };
3862
- } catch (m) {
3883
+ } catch (h) {
3863
3884
  return {
3864
- 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"}`
3865
3886
  };
3866
3887
  }
3867
3888
  }
3868
- function lo(t, r) {
3889
+ function uo(t, r) {
3869
3890
  t(
3870
3891
  "playwright-page-goto",
3871
3892
  {
3872
3893
  title: "Navigate Page",
3873
3894
  description: "Navigate page to URL. Use for manual browser interaction",
3874
- inputSchema: Wt.shape
3895
+ inputSchema: Kt.shape
3875
3896
  },
3876
3897
  async (s, o) => {
3877
- const e = await ao(s, r, o);
3898
+ const e = await co(s, r, o);
3878
3899
  if (e.error != null)
3879
3900
  return `Method: playwright-page-goto(${JSON.stringify(s)})
3880
3901
  ❌ Error: ${e.error}`;
@@ -3887,13 +3908,13 @@ function lo(t, r) {
3887
3908
  }
3888
3909
  );
3889
3910
  }
3890
- const ve = h.object({
3891
- name: h.string().describe(
3911
+ const ve = m.object({
3912
+ name: m.string().describe(
3892
3913
  "Unique name for the DOM snapshot query. Recommended format: kebab-case-1, kebab-case-2, ..."
3893
3914
  ),
3894
- cssSelector: h.string().describe("CSS selector to capture page content")
3915
+ cssSelector: m.string().describe("CSS selector to capture page content")
3895
3916
  });
3896
- async function Kt(t, r, s) {
3917
+ async function Ht(t, r, s) {
3897
3918
  let o;
3898
3919
  try {
3899
3920
  o = ve.parse(t);
@@ -3915,7 +3936,7 @@ async function Kt(t, r, s) {
3915
3936
  snapshotQuery: a
3916
3937
  };
3917
3938
  }
3918
- function co(t, r) {
3939
+ function fo(t, r) {
3919
3940
  t(
3920
3941
  "playwright-dom-snapshot-query-create",
3921
3942
  {
@@ -3924,21 +3945,21 @@ function co(t, r) {
3924
3945
  inputSchema: ve.shape
3925
3946
  },
3926
3947
  async (s, o) => {
3927
- const e = await Kt(s, r, o);
3948
+ const e = await Ht(s, r, o);
3928
3949
  return e.error != null ? `Method: playwright-dom-snapshot-query-create(${JSON.stringify(s)})
3929
3950
  ❌ Error: ${e.error}` : `Method: playwright-dom-snapshot-query-create(${JSON.stringify(s)})
3930
3951
  ✅ DOM snapshot query "${e.snapshotQuery.name}" created successfully`;
3931
3952
  }
3932
3953
  );
3933
3954
  }
3934
- function uo(t) {
3955
+ function po(t) {
3935
3956
  return function(s, o) {
3936
3957
  let e, n = 0;
3937
3958
  const i = o ? o.length : 0;
3938
3959
  let a = 1, c = 0, l = 0, u, f;
3939
3960
  if (o)
3940
- for (let m = 0; m < o.length; m++) {
3941
- const g = o[m];
3961
+ for (let h = 0; h < o.length; h++) {
3962
+ const g = o[h];
3942
3963
  n += g.countMatched, a += g.countTotal, c += g.tokens, l += g.tokensTotal;
3943
3964
  }
3944
3965
  s ? (u = s.uid, f = s.tagName, e = s.isMatched, e && (n += 1)) : (u = null, f = null, e = !1);
@@ -3952,7 +3973,7 @@ function uo(t) {
3952
3973
  textOpen: `<root uid:${u}>`,
3953
3974
  textClose: "</root>"
3954
3975
  };
3955
- const p = Et(d);
3976
+ const p = Nt(d);
3956
3977
  return l += p, {
3957
3978
  uid: u,
3958
3979
  tagName: f,
@@ -3967,8 +3988,8 @@ function uo(t) {
3967
3988
  };
3968
3989
  };
3969
3990
  }
3970
- function fo(t, r) {
3971
- 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({
3972
3993
  getId: (n) => {
3973
3994
  const i = s.getId(n);
3974
3995
  if (i == null)
@@ -3978,22 +3999,22 @@ function fo(t, r) {
3978
3999
  return i;
3979
4000
  },
3980
4001
  getChilds: (n) => s.getChilds(n),
3981
- createSnapshotNode: uo(),
4002
+ createSnapshotNode: po(),
3982
4003
  rootNodes: o ?? []
3983
4004
  });
3984
4005
  return le(e);
3985
4006
  }
3986
- const Ee = h.object({
3987
- pageName: h.string().describe("Name of previously created page, to create snapshot from"),
3988
- 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"),
3989
4010
  query: ve.optional().describe(
3990
4011
  "DOM snapshot query creation options JSON to automatically create query"
3991
4012
  ),
3992
- name: h.string().describe(
4013
+ name: m.string().describe(
3993
4014
  "Unique name for the DOM snapshot. Recommended format: kebab-case-1, kebab-case-2, ..."
3994
4015
  )
3995
4016
  });
3996
- async function Ht(t, r, s) {
4017
+ async function Qt(t, r, s) {
3997
4018
  let o;
3998
4019
  try {
3999
4020
  o = Ee.parse(t);
@@ -4034,7 +4055,7 @@ async function Ht(t, r, s) {
4034
4055
  };
4035
4056
  u = d;
4036
4057
  } else if (i) {
4037
- const d = await Kt(
4058
+ const d = await Ht(
4038
4059
  i,
4039
4060
  r,
4040
4061
  s
@@ -4064,10 +4085,10 @@ async function Ht(t, r, s) {
4064
4085
  ), p = {
4065
4086
  idToNode: new Map(d.idToNode),
4066
4087
  idToChildIds: new Map(d.idToChildIds)
4067
- }, m = fo(u, p), g = {
4088
+ }, h = ho(u, p), g = {
4068
4089
  name: a,
4069
4090
  query: u,
4070
- tree: m
4091
+ tree: h
4071
4092
  };
4072
4093
  return l.domSnapshots.set(a, g), {
4073
4094
  domSnapshot: g,
@@ -4079,7 +4100,7 @@ async function Ht(t, r, s) {
4079
4100
  };
4080
4101
  }
4081
4102
  }
4082
- function po(t, r) {
4103
+ function mo(t, r) {
4083
4104
  t(
4084
4105
  "playwright-dom-snapshot-create",
4085
4106
  {
@@ -4088,7 +4109,7 @@ function po(t, r) {
4088
4109
  inputSchema: Ee.shape
4089
4110
  },
4090
4111
  async (s, o) => {
4091
- const e = await Ht(s, r, o);
4112
+ const e = await Qt(s, r, o);
4092
4113
  if (e.error != null)
4093
4114
  return `Method: playwright-dom-snapshot-create(${JSON.stringify(s)})
4094
4115
  ❌ Error: ${e.error}`;
@@ -4099,7 +4120,7 @@ function po(t, r) {
4099
4120
  }
4100
4121
  );
4101
4122
  }
4102
- class ho {
4123
+ class go {
4103
4124
  tokens = 20;
4104
4125
  getReportText = (r) => ({
4105
4126
  indent: !0,
@@ -4113,14 +4134,14 @@ class ho {
4113
4134
  tokensGrouped: s.tokens
4114
4135
  } : (r.indexRange[1] = o, r.countGrouped += 1, r.countMatched += s.countMatched, r.tokensGrouped += s.tokens, r);
4115
4136
  }
4116
- const Qt = h.object({
4117
- 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"),
4118
4139
  snapshot: Ee.optional().describe(
4119
4140
  "DOM snapshot creation options JSON to automatically create snapshot"
4120
4141
  ),
4121
- parentUid: h.number().optional().describe("UID of parent node to browse. Omit to browse the root node"),
4122
- childsIndexRange: h.tuple([h.number(), h.number()]).optional().describe(
4123
- "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"
4124
4145
  )
4125
4146
  // maxCountTotal: z
4126
4147
  // .number()
@@ -4133,10 +4154,10 @@ const Qt = h.object({
4133
4154
  // maxCountGroup: z.number().default(10).describe('Maximum items per group'),
4134
4155
  // maxTokensGroup: z.number().default(1000).describe('Maximum tokens per group'),
4135
4156
  });
4136
- async function mo(t, r, s) {
4157
+ async function wo(t, r, s) {
4137
4158
  let o;
4138
4159
  try {
4139
- o = Qt.parse(t);
4160
+ o = Yt.parse(t);
4140
4161
  } catch (g) {
4141
4162
  return {
4142
4163
  error: F(g)
@@ -4144,13 +4165,12 @@ async function mo(t, r, s) {
4144
4165
  }
4145
4166
  const {
4146
4167
  snapshotName: e,
4147
- snapshot: n,
4148
- childsIndexRange: i
4168
+ snapshot: n
4149
4169
  // maxCountTotal,
4150
4170
  // maxTokensTotal,
4151
4171
  // maxCountGroup,
4152
4172
  // maxTokensGroup,
4153
- } = 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;
4154
4174
  if (!s.sessionId)
4155
4175
  return {
4156
4176
  error: "Session ID is required"
@@ -4160,7 +4180,7 @@ async function mo(t, r, s) {
4160
4180
  return {
4161
4181
  error: "Either snapshotName or snapshot must be provided, not both"
4162
4182
  };
4163
- let d, p = !1, m = !1;
4183
+ let d, p = !1, h = !1;
4164
4184
  if (e) {
4165
4185
  for (const g of f.browsers.values()) {
4166
4186
  for (const y of g.contexts.values()) {
@@ -4178,7 +4198,7 @@ async function mo(t, r, s) {
4178
4198
  error: `DOM snapshot "${e}" not found`
4179
4199
  };
4180
4200
  } else if (n) {
4181
- const g = await Ht(
4201
+ const g = await Qt(
4182
4202
  n,
4183
4203
  r,
4184
4204
  s
@@ -4187,13 +4207,13 @@ async function mo(t, r, s) {
4187
4207
  return {
4188
4208
  error: g.error
4189
4209
  };
4190
- d = g.domSnapshot, p = g.queryCreated, m = !0;
4210
+ d = g.domSnapshot, p = g.queryCreated, h = !0;
4191
4211
  } else
4192
4212
  return {
4193
4213
  error: "Either snapshotName or snapshot must be provided"
4194
4214
  };
4195
4215
  try {
4196
- const g = o.parentUid, y = Nt({
4216
+ const g = o.parentUid, y = kt({
4197
4217
  tree: d.tree,
4198
4218
  request: {
4199
4219
  parentNodeId: g,
@@ -4205,12 +4225,12 @@ async function mo(t, r, s) {
4205
4225
  maxTokensGroup: u
4206
4226
  }
4207
4227
  },
4208
- indexRangeGroupStrategy: new ho()
4209
- }), w = kt(y);
4228
+ indexRangeGroupStrategy: new go()
4229
+ }), w = Ot(y);
4210
4230
  return {
4211
4231
  domSnapshot: d,
4212
4232
  queryCreated: p,
4213
- snapshotCreated: m,
4233
+ snapshotCreated: h,
4214
4234
  parentUid: g,
4215
4235
  childsIndexRange: i,
4216
4236
  report: w
@@ -4221,16 +4241,16 @@ async function mo(t, r, s) {
4221
4241
  };
4222
4242
  }
4223
4243
  }
4224
- function go(t, r) {
4244
+ function yo(t, r) {
4225
4245
  t(
4226
4246
  "playwright-dom-snapshot-browse",
4227
4247
  {
4228
4248
  title: "Browse DOM Snapshot",
4229
4249
  description: "Browse and explore DOM. Use this to browse, analyze, explore, inspect, etc webpage structure and styles, find elements, or inspect page content",
4230
- inputSchema: Qt.shape
4250
+ inputSchema: Yt.shape
4231
4251
  },
4232
4252
  async (s, o) => {
4233
- const e = await mo(s, r, o);
4253
+ const e = await wo(s, r, o);
4234
4254
  if (e.error != null)
4235
4255
  return `Method: playwright-dom-snapshot-browse(${JSON.stringify(s)})
4236
4256
  ❌ Error: ${e.error}`;
@@ -4251,10 +4271,10 @@ ${e.report}`, n;
4251
4271
  }
4252
4272
  );
4253
4273
  }
4254
- function wo(t, r) {
4255
- 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");
4256
4276
  }
4257
- function yo(t) {
4277
+ function So(t) {
4258
4278
  const { logFilePath: r } = t;
4259
4279
  return async function(o, e, n, i) {
4260
4280
  await ie({
@@ -4281,7 +4301,7 @@ const it = [
4281
4301
  "flemist-mcp.config.json5",
4282
4302
  "flemist-mcp.config.yaml"
4283
4303
  ];
4284
- async function bo(t) {
4304
+ async function xo(t) {
4285
4305
  const r = k.resolve(t);
4286
4306
  for (let s = 0, o = it.length; s < o; s++) {
4287
4307
  const e = it[s], n = k.join(r, e);
@@ -4306,7 +4326,7 @@ ${c instanceof Error ? c.message : String(c)}`);
4306
4326
  if (a === ".json5")
4307
4327
  return Ne.parse(i);
4308
4328
  if (a === ".yaml")
4309
- return dr.load(i);
4329
+ return fr.load(i);
4310
4330
  } catch (c) {
4311
4331
  throw new Error(`MCP Error: Failed to parse config file: ${n}
4312
4332
 
@@ -4320,7 +4340,7 @@ Expected one of:
4320
4340
  - flemist-mcp.config.json5
4321
4341
  - flemist-mcp.config.yaml`);
4322
4342
  }
4323
- const So = {
4343
+ const $o = {
4324
4344
  logDir: "tmp/mcp-project-tools/logs",
4325
4345
  tools: {
4326
4346
  processManager: {
@@ -4361,8 +4381,8 @@ const So = {
4361
4381
  }
4362
4382
  }
4363
4383
  };
4364
- async function xo(t) {
4365
- 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");
4366
4386
  try {
4367
4387
  await j.promises.stat(o);
4368
4388
  } catch {
@@ -4372,7 +4392,7 @@ Create .flemist-mcpignore file in: ${r}
4372
4392
 
4373
4393
  This file contains glob patterns for files/directories to exclude from MCP operations.`);
4374
4394
  }
4375
- const e = ur(So, s, {
4395
+ const e = dr($o, s, {
4376
4396
  arrayMerge(n, i) {
4377
4397
  return i;
4378
4398
  }
@@ -4394,25 +4414,25 @@ This file contains glob patterns for files/directories to exclude from MCP opera
4394
4414
  n.valueType === "file-contains-patterns" && (a[i].value = k.resolve(r, n.value));
4395
4415
  }), e.logDir = k.resolve(r, e.logDir), e;
4396
4416
  }
4397
- function Yt() {
4417
+ function Vt() {
4398
4418
  return `mcp_${(/* @__PURE__ */ new Date()).toISOString().substring(0, 19).replace(/T/, "_").replace(/:/g, "-")}.log`;
4399
4419
  }
4400
- function $o(t) {
4401
- const r = ne(), s = Io();
4420
+ function Mo(t) {
4421
+ const r = ne(), s = To();
4402
4422
  return r.use(s), r;
4403
4423
  }
4404
- function Io(t) {
4424
+ function To(t) {
4405
4425
  const r = ne.Router();
4406
4426
  return r.use((s, o, e) => {
4407
4427
  s.method === "OPTIONS" ? o.status(403).send("CORS forbidden") : e();
4408
4428
  }), r.use(ne.json()), r;
4409
4429
  }
4410
- function Mo(t) {
4430
+ function Co(t) {
4411
4431
  const r = ne.Router();
4412
- 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;
4413
4433
  }
4414
- function To(t, r) {
4415
- 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) => {
4416
4436
  let e;
4417
4437
  const n = () => {
4418
4438
  s(e);
@@ -4426,7 +4446,7 @@ function To(t, r) {
4426
4446
  }
4427
4447
  });
4428
4448
  }
4429
- function Co(t, r) {
4449
+ function Eo(t, r) {
4430
4450
  if (!t.address())
4431
4451
  throw new Error(
4432
4452
  "Server address is not available. Check your DNS and host configuration."
@@ -4444,20 +4464,20 @@ SSE Endpoint: ${i}/sse
4444
4464
 
4445
4465
  Log File: ${k.resolve(r.logFilePath)}`;
4446
4466
  }
4447
- function vo(t, r) {
4448
- 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, {
4449
4469
  logFilePath: s
4450
4470
  });
4451
- r.tools.processManager && qr(
4471
+ r.tools.processManager && Gr(
4452
4472
  o,
4453
4473
  r.tools.processManager
4454
- ), 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(
4455
4475
  o,
4456
4476
  r.tools.playwrightManager
4457
- ), Dr(o);
4477
+ ), Pr(o);
4458
4478
  }
4459
- async function Ho(t) {
4460
- 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({
4461
4481
  authToken: t.authToken,
4462
4482
  logFilePath: r,
4463
4483
  createMcpServer: async (n) => {
@@ -4480,22 +4500,22 @@ X-Project-Name header is missing. To configure MCP for this project:
4480
4500
  Ask user to:
4481
4501
  1. Add project to server's projects config: projects: { "${i}": "<project-path>" }
4482
4502
  2. Restart MCP server`);
4483
- const c = await xo(a), l = new Vt({
4503
+ const c = await Io(a), l = new Zt({
4484
4504
  title: t.title,
4485
4505
  name: t.name,
4486
4506
  version: t.version
4487
4507
  });
4488
- return vo(l, c), l;
4508
+ return No(l, c), l;
4489
4509
  }
4490
4510
  });
4491
4511
  s.use(o);
4492
- const e = await To(s, {
4512
+ const e = await vo(s, {
4493
4513
  host: t.host,
4494
4514
  port: t.port,
4495
4515
  logFilePath: r
4496
4516
  });
4497
4517
  return console.log(
4498
- Co(e, {
4518
+ Eo(e, {
4499
4519
  title: t.title,
4500
4520
  name: t.name,
4501
4521
  version: t.version,
@@ -4504,11 +4524,11 @@ Ask user to:
4504
4524
  ), e;
4505
4525
  }
4506
4526
  export {
4507
- Ko as A,
4508
- Wo as S,
4509
- Jo as a,
4510
- Go as b,
4511
- bo as l,
4512
- ts as p,
4513
- 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
4514
4534
  };