@flemist/mcp-project-tools 3.0.16 → 3.0.18

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,12 +1,12 @@
1
1
  import ne from "express";
2
- import { McpServer as Gt } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import { McpServer as _t } from "@modelcontextprotocol/sdk/server/mcp.js";
3
3
  import { randomUUID as Jt } from "crypto";
4
4
  import * as W from "fs";
5
5
  import * as R from "path";
6
6
  import { StreamableHTTPServerTransport as jt } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
7
7
  import { spawn as Kt } from "child_process";
8
- import { z as p } from "zod";
9
- import pe from "tree-kill";
8
+ import { z as h } from "zod";
9
+ import he from "tree-kill";
10
10
  import { Pool as Wt, poolRunWait as V } from "@flemist/time-limits";
11
11
  import { priorityCreate as Z } from "@flemist/priority-queue";
12
12
  import { useAbortController as Ht, combineAbortSignals as Qt, Locker as Yt } from "@flemist/async-utils";
@@ -115,17 +115,17 @@ function dr(t) {
115
115
  function fr() {
116
116
  return ++lr;
117
117
  }
118
- let Ne = !1;
119
- function hr() {
120
- if (Ne)
118
+ let ve = !1;
119
+ function pr() {
120
+ if (ve)
121
121
  return;
122
- Ne = !0;
122
+ ve = !0;
123
123
  const t = () => {
124
124
  console.log("Auto-killing all child processes...");
125
125
  for (const [r, s] of Array.from(Y.entries()))
126
126
  if (s.isRunning && s.pid)
127
127
  try {
128
- pe(s.pid, "SIGKILL");
128
+ he(s.pid, "SIGKILL");
129
129
  } catch (o) {
130
130
  console.error(`Error killing process ${r}:`, o);
131
131
  }
@@ -140,16 +140,16 @@ function ge() {
140
140
  for (const s of r)
141
141
  Y.delete(s);
142
142
  }
143
- const pr = 1800 * 1e3, ve = /* @__PURE__ */ new Map();
143
+ const hr = 1800 * 1e3, Ne = /* @__PURE__ */ new Map();
144
144
  let mr = 0;
145
145
  function gr() {
146
146
  return ++mr;
147
147
  }
148
148
  function Xe(t) {
149
- let r = ve.get(t);
149
+ let r = Ne.get(t);
150
150
  return r == null && (r = {
151
151
  storedOutputs: /* @__PURE__ */ new Map()
152
- }, ve.set(t, r)), r;
152
+ }, Ne.set(t, r)), r;
153
153
  }
154
154
  function et(t) {
155
155
  return typeof t == "function" ? t() : t;
@@ -157,7 +157,7 @@ function et(t) {
157
157
  function tt(t, r) {
158
158
  return setTimeout(() => {
159
159
  t.storedOutputs.delete(r);
160
- }, pr);
160
+ }, hr);
161
161
  }
162
162
  function wr(t, r, s) {
163
163
  clearTimeout(s.cleanupTimer), s.cleanupTimer = tt(t, r);
@@ -202,9 +202,9 @@ function F(t) {
202
202
 
203
203
  Provide valid parameters according to schema.`;
204
204
  }
205
- const st = p.object({
206
- outputId: p.number().int().describe("Output ID from truncation message"),
207
- range: p.tuple([p.number().int().min(0), p.number().int().min(0)]).describe(
205
+ const st = h.object({
206
+ outputId: h.number().int().describe("Output ID from truncation message"),
207
+ range: h.tuple([h.number().int().min(0), h.number().int().min(0)]).describe(
208
208
  `Character range [from, to) to retrieve. Maximum range size: ${J}.`
209
209
  )
210
210
  });
@@ -263,11 +263,11 @@ ${o.content}`, i;
263
263
  function xr(t) {
264
264
  Sr(t);
265
265
  }
266
- const ot = p.object({
267
- id: p.number().describe(
266
+ const ot = h.object({
267
+ id: h.number().describe(
268
268
  "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"
269
269
  ),
270
- outputLimit: p.number().int().min(0).max(J).default(Q).describe(
270
+ outputLimit: h.number().int().min(0).max(J).default(Q).describe(
271
271
  `Maximum output characters to return. Truncated output can be retrieved via output-read tool using outputId from truncation message. Maximum: ${J}. Default: ${Q}`
272
272
  )
273
273
  });
@@ -331,25 +331,25 @@ ${n.trim()}`;
331
331
  );
332
332
  }
333
333
  function nt(t) {
334
- pe(t, "SIGTERM", (r) => {
334
+ he(t, "SIGTERM", (r) => {
335
335
  r && !r.message.includes("not found") && console.error(`Error sending SIGTERM to process ${t}:`, r);
336
336
  }), setTimeout(() => {
337
- pe(t, "SIGKILL", (r) => {
337
+ he(t, "SIGKILL", (r) => {
338
338
  r && !r.message.includes("not found") && console.error(`Error sending SIGKILL to process ${t}:`, r);
339
339
  });
340
340
  }, ur);
341
341
  }
342
- const it = p.object({
343
- id: p.number().describe(
342
+ const it = h.object({
343
+ id: h.number().describe(
344
344
  "Process ID to wait for completion. Get process IDs using process-list. The process can be running or already completed. Examples: 1, 42, 123"
345
345
  ),
346
- waitTime: p.number().optional().describe(
346
+ waitTime: h.number().optional().describe(
347
347
  "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)"
348
348
  ),
349
- autoKill: p.boolean().default(!1).describe(
349
+ autoKill: h.boolean().default(!1).describe(
350
350
  "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"
351
351
  ),
352
- outputLimit: p.number().int().min(0).max(J).default(Q).describe(
352
+ outputLimit: h.number().int().min(0).max(J).default(Q).describe(
353
353
  `Maximum output characters to return. Truncated output can be retrieved via output-read tool using outputId from truncation message. Maximum: ${J}. Default: ${Q}`
354
354
  )
355
355
  });
@@ -404,20 +404,20 @@ ${n.trim()}`;
404
404
  }
405
405
  );
406
406
  }
407
- const lt = p.object({
408
- cwd: p.string().optional().describe(
407
+ const lt = h.object({
408
+ cwd: h.string().optional().describe(
409
409
  'Working directory for command execution, resolved relative to the current working directory. Leave empty to use current directory. Examples: "src" (run in src/ subdirectory), "../parent" (run in parent directory), "build/output" (run in nested subdirectory). Directory must exist'
410
410
  ),
411
- commandLine: p.string().describe(
411
+ commandLine: h.string().describe(
412
412
  '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'
413
413
  ),
414
- waitTime: p.number().optional().describe(
414
+ waitTime: h.number().optional().describe(
415
415
  "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)"
416
416
  ),
417
- autoKill: p.boolean().default(!1).describe(
417
+ autoKill: h.boolean().default(!1).describe(
418
418
  "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"
419
419
  ),
420
- outputLimit: p.number().int().min(0).max(J).default(Q).describe(
420
+ outputLimit: h.number().int().min(0).max(J).default(Q).describe(
421
421
  `Maximum output characters to return. Truncated output can be retrieved via output-read tool using outputId from truncation message. Maximum: ${J}. Default: ${Q}`
422
422
  )
423
423
  });
@@ -426,26 +426,26 @@ async function Mr(t, r, s) {
426
426
  let o;
427
427
  try {
428
428
  o = lt.parse(t);
429
- } catch (h) {
429
+ } catch (p) {
430
430
  return {
431
- error: F(h)
431
+ error: F(p)
432
432
  };
433
433
  }
434
434
  const { commandLine: e, waitTime: n, autoKill: a, outputLimit: i } = o, { commandLineRules: c } = r, l = R.resolve(r.workingDir || "", o.cwd || "");
435
435
  if (!dr({ commandLine: e, commandLineRules: c })) {
436
- const h = c.map(
436
+ const p = c.map(
437
437
  (g) => `${g.rule.toUpperCase()}: /${g.regexp}/ (${g.note})`
438
438
  ).join(`
439
439
  `);
440
440
  return {
441
441
  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:
442
- ${h}
442
+ ${p}
443
443
 
444
444
  To use this command line, ask the user to modify the command line rules in the configuration.`
445
445
  };
446
446
  }
447
447
  if (Array.from(Y.values()).filter(
448
- (h) => h.isRunning
448
+ (p) => p.isRunning
449
449
  ).length >= Ce)
450
450
  return {
451
451
  error: `Maximum concurrent process limit reached (${Ce} processes). Cannot start new process until existing processes complete. Use process-list to see active processes, or process-kill to terminate unnecessary processes.`
@@ -460,27 +460,27 @@ To use this command line, ask the user to modify the command line rules in the c
460
460
  };
461
461
  Y.set(f, d);
462
462
  try {
463
- const h = Kt(e, [], {
463
+ const p = Kt(e, [], {
464
464
  shell: !0,
465
465
  cwd: l,
466
466
  stdio: ["pipe", "pipe", "pipe"]
467
467
  });
468
- d.pid = h.pid;
468
+ d.pid = p.pid;
469
469
  const g = (m) => {
470
470
  const y = m.toString();
471
471
  d.output += y, console.log(y);
472
472
  };
473
- return h.stdout?.on("data", g), h.stderr?.on("data", g), h.on("close", (m) => {
473
+ return p.stdout?.on("data", g), p.stderr?.on("data", g), p.on("close", (m) => {
474
474
  d.isRunning = !1, d.endTime = /* @__PURE__ */ new Date(), d.exitCode = m !== null ? m : void 0, console.log(`Process ${f} (${e}) exited with code ${m}`);
475
- }), h.on("error", (m) => {
475
+ }), p.on("error", (m) => {
476
476
  d.isRunning = !1, d.endTime = /* @__PURE__ */ new Date(), d.error = m.message, console.error(`Process ${f} error:`, m.message);
477
477
  }), n != null ? at(
478
478
  { id: f, waitTime: n, autoKill: a, outputLimit: i },
479
479
  r,
480
480
  s
481
481
  ) : ye({ id: f, outputLimit: i }, r, s);
482
- } catch (h) {
483
- return d.isRunning = !1, d.endTime = /* @__PURE__ */ new Date(), d.error = h instanceof Error ? h.message : "Unknown error", { error: d.error };
482
+ } catch (p) {
483
+ return d.isRunning = !1, d.endTime = /* @__PURE__ */ new Date(), d.error = p instanceof Error ? p.message : "Unknown error", { error: d.error };
484
484
  }
485
485
  }
486
486
  function Tr(t, r) {
@@ -508,17 +508,17 @@ ${a.trim()}`;
508
508
  }
509
509
  );
510
510
  }
511
- const ct = p.object({
512
- minOpenDateTime: p.string().optional().describe(
511
+ const ct = h.object({
512
+ minOpenDateTime: h.string().optional().describe(
513
513
  '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'
514
514
  ),
515
- minCloseDateTime: p.string().optional().describe(
515
+ minCloseDateTime: h.string().optional().describe(
516
516
  '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'
517
517
  ),
518
- activeOnly: p.boolean().default(!1).describe(
518
+ activeOnly: h.boolean().default(!1).describe(
519
519
  "Show only currently running processes. Set to true to exclude completed processes, false to show all processes (running and completed). Default: false (show all)"
520
520
  ),
521
- fields: p.array(p.string()).optional().describe(
521
+ fields: h.array(h.string()).optional().describe(
522
522
  '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'
523
523
  )
524
524
  });
@@ -565,7 +565,7 @@ async function Cr(t, r) {
565
565
  return u;
566
566
  }) };
567
567
  }
568
- function Nr(t, r) {
568
+ function vr(t, r) {
569
569
  t(
570
570
  "process-list",
571
571
  {
@@ -588,12 +588,12 @@ ${e}`;
588
588
  }
589
589
  );
590
590
  }
591
- const ut = p.object({
592
- id: p.number().describe(
591
+ const ut = h.object({
592
+ id: h.number().describe(
593
593
  "Process ID of the process to terminate. Get process IDs using process-list. The process must be currently running. Examples: 1, 42, 123"
594
594
  )
595
595
  });
596
- function vr(t) {
596
+ function Nr(t) {
597
597
  let r;
598
598
  try {
599
599
  r = ut.parse(t);
@@ -632,7 +632,7 @@ function Er(t, r) {
632
632
  inputSchema: ut.shape
633
633
  },
634
634
  async (s) => {
635
- const o = vr(s);
635
+ const o = Nr(s);
636
636
  return o.error != null ? `Method: process-kill(${JSON.stringify(s)})
637
637
  ❌ Error: ${o.error}` : `Method: process-kill(${JSON.stringify(s)})
638
638
  ${JSON.stringify(o, null, 2)}`;
@@ -640,7 +640,7 @@ ${JSON.stringify(o, null, 2)}`;
640
640
  );
641
641
  }
642
642
  function kr(t, r) {
643
- hr(), r.run && Tr(t, r), r.status && $r(t, r), r.wait && Ir(t, r), r.list && Nr(t, r), r.kill && Er(t);
643
+ pr(), r.run && Tr(t, r), r.status && $r(t, r), r.wait && Ir(t, r), r.list && vr(t, r), r.kill && Er(t);
644
644
  const s = r.commandLineRules?.map(
645
645
  (o) => `${o.rule.toUpperCase()}: ${o.regexp} (${o.note})`
646
646
  ) || [];
@@ -716,7 +716,7 @@ function dt(t) {
716
716
  if (!(a && await a(g)) && !Br(g))
717
717
  throw g;
718
718
  }
719
- function h(g) {
719
+ function p(g) {
720
720
  return !(!l || l.minTotalContentSize != null && g < l.minTotalContentSize || l.maxNestedLevel != null && s > l.maxNestedLevel);
721
721
  }
722
722
  return Ht(async (g) => {
@@ -728,7 +728,7 @@ function dt(t) {
728
728
  countLinks: 0
729
729
  };
730
730
  function w($, S) {
731
- if (h(S.totalSize)) {
731
+ if (p(S.totalSize)) {
732
732
  const T = `${S.totalSize.toLocaleString("en-US").replace(/,/g, " ").padStart(19)}: ${$}`;
733
733
  l?.handleLog ? l.handleLog(T) : console.log(T);
734
734
  }
@@ -746,8 +746,8 @@ function dt(t) {
746
746
  totalStat: y,
747
747
  abortSignal: m
748
748
  });
749
- } catch (N) {
750
- return await d(N), !1;
749
+ } catch (v) {
750
+ return await d(v), !1;
751
751
  }
752
752
  },
753
753
  count: 1,
@@ -755,33 +755,33 @@ function dt(t) {
755
755
  abortSignal: m
756
756
  }) : !0;
757
757
  }
758
- async function v($, S, x, T) {
758
+ async function N($, S, x, T) {
759
759
  T || (T = $);
760
- const N = await V({
760
+ const v = await V({
761
761
  pool: n,
762
762
  func: () => W.promises.lstat($).catch(d),
763
763
  count: 1,
764
764
  priority: Z(S, Z(1, i)),
765
765
  abortSignal: m
766
766
  });
767
- if (!N || !x && N.isFile())
767
+ if (!v || !x && v.isFile())
768
768
  return null;
769
- const B = Rr($, N);
769
+ const B = Rr($, v);
770
770
  if (o.has(B))
771
771
  return null;
772
772
  o.add(B);
773
773
  let k = {
774
- totalSize: N.size,
775
- maxFileDateModified: N.isDirectory() ? 0 : N.mtimeMs,
774
+ totalSize: v.size,
775
+ maxFileDateModified: v.isDirectory() ? 0 : v.mtimeMs,
776
776
  countFiles: 0,
777
777
  countDirs: 0,
778
778
  countLinks: 0
779
779
  };
780
780
  const M = Z(
781
781
  S,
782
- Z(N.isDirectory() ? 2 : 3, i)
782
+ Z(v.isDirectory() ? 2 : 3, i)
783
783
  );
784
- if (N.isSymbolicLink()) {
784
+ if (v.isSymbolicLink()) {
785
785
  if (c) {
786
786
  const C = await V({
787
787
  pool: n,
@@ -791,7 +791,7 @@ function dt(t) {
791
791
  abortSignal: m
792
792
  });
793
793
  if (C) {
794
- const E = R.isAbsolute(C) ? C : R.resolve(R.dirname(T), C), O = await v(
794
+ const E = R.isAbsolute(C) ? C : R.resolve(R.dirname(T), C), O = await N(
795
795
  E,
796
796
  S,
797
797
  x,
@@ -802,11 +802,11 @@ function dt(t) {
802
802
  }
803
803
  return (x || k.countFiles + k.countDirs + k.countLinks >= 1) && (k.countLinks += 1, await I(
804
804
  T,
805
- N,
805
+ v,
806
806
  k,
807
807
  M
808
808
  ) && (Ee(y, k), w(T, k))), k;
809
- } else if (N.isDirectory()) {
809
+ } else if (v.isDirectory()) {
810
810
  const C = await V({
811
811
  pool: n,
812
812
  func: () => W.promises.readdir($).catch(d),
@@ -827,9 +827,9 @@ function dt(t) {
827
827
  });
828
828
  }
829
829
  }
830
- return (x || k.countFiles + k.countDirs + k.countLinks >= 1) && (N.isDirectory() ? k.countDirs += 1 : N.isFile() && (k.countFiles += 1), await I(
830
+ return (x || k.countFiles + k.countDirs + k.countLinks >= 1) && (v.isDirectory() ? k.countDirs += 1 : v.isFile() && (k.countFiles += 1), await I(
831
831
  T,
832
- N,
832
+ v,
833
833
  k,
834
834
  M
835
835
  ) && (Ee(y, k), w(T, k))), k;
@@ -837,7 +837,7 @@ function dt(t) {
837
837
  const b = [];
838
838
  for (let $ = 0, S = r.length; $ < S; $++) {
839
839
  const x = Fr(r[$]), T = f ? f(x) : !0;
840
- T !== !1 && b.push(v(x, $, T));
840
+ T !== !1 && b.push(N(x, $, T));
841
841
  }
842
842
  return await Promise.all(b), y;
843
843
  });
@@ -870,7 +870,7 @@ async function Ar(t) {
870
870
  e = e.trim(), !(!e || e.startsWith("#")) && o.push(e);
871
871
  }), o;
872
872
  }
873
- async function ht(t) {
873
+ async function pt(t) {
874
874
  const r = t.rootDir ?? ".", s = [];
875
875
  if (!t.globs?.length)
876
876
  return s;
@@ -892,7 +892,7 @@ async function ht(t) {
892
892
  })
893
893
  ), s;
894
894
  }
895
- function pt({
895
+ function ht({
896
896
  globs: t,
897
897
  rootDir: r,
898
898
  noCase: s
@@ -943,14 +943,14 @@ function pt({
943
943
  async function zr(t) {
944
944
  const r = t.rootDir ?? ".", s = [], o = {};
945
945
  t.result.countFiles && (o.countFiles = 0), t.result.size && (o.size = 0);
946
- const e = await ht({
946
+ const e = await pt({
947
947
  rootDir: r,
948
948
  globs: t.globs
949
949
  });
950
950
  return await ft({
951
951
  paths: [r],
952
952
  walkLinks: !0,
953
- matchPath: pt({
953
+ matchPath: ht({
954
954
  globs: e,
955
955
  rootDir: r,
956
956
  noCase: !0
@@ -959,13 +959,13 @@ async function zr(t) {
959
959
  const c = R.relative(r, n), l = a.isDirectory(), u = a.isFile();
960
960
  if (!l && !u)
961
961
  return !0;
962
- const f = H(c || "."), d = l ? "dir" : "file", h = l ? i.maxFileDateModified || null : a.mtimeMs, g = l ? i.totalSize : a.size, m = l ? i.countFiles : null, y = {
962
+ const f = H(c || "."), d = l ? "dir" : "file", p = l ? i.maxFileDateModified || null : a.mtimeMs, g = l ? i.totalSize : a.size, m = l ? i.countFiles : null, y = {
963
963
  path: f,
964
964
  type: d
965
965
  };
966
- if (t.result.dateModified && (y.dateModified = h), t.result.size && (y.size = g), t.result.countFiles && (y.countFiles = m), t.dateModified && h != null) {
966
+ if (t.result.dateModified && (y.dateModified = p), t.result.size && (y.size = g), t.result.countFiles && (y.countFiles = m), t.dateModified && p != null) {
967
967
  const [w, I] = t.dateModified;
968
- if (w != null && h < w || I != null && h > I)
968
+ if (w != null && p < w || I != null && p > I)
969
969
  return !1;
970
970
  }
971
971
  if (t.totalSize && g != null) {
@@ -973,7 +973,7 @@ async function zr(t) {
973
973
  if (w != null && g < w || I != null && g > I)
974
974
  return !1;
975
975
  }
976
- return d === "file" && (o.countFiles = (o.countFiles ?? 0) + 1), d === "file" && g != null && (o.size = (o.size ?? 0) + g), h != null && (o.dateModified == null || h > o.dateModified) && (o.dateModified = h), l && !t.result.dirs || u && !t.result.files || s.push(y), !0;
976
+ return d === "file" && (o.countFiles = (o.countFiles ?? 0) + 1), d === "file" && g != null && (o.size = (o.size ?? 0) + g), p != null && (o.dateModified == null || p > o.dateModified) && (o.dateModified = p), l && !t.result.dirs || u && !t.result.files || s.push(y), !0;
977
977
  }
978
978
  }), { items: s, totals: o };
979
979
  }
@@ -1086,9 +1086,9 @@ function qr(t, r) {
1086
1086
  }
1087
1087
  return e;
1088
1088
  }
1089
- const _r = "3.0.16", Gr = {
1090
- version: _r
1091
- }, $o = "Project Tools", Io = "project-tools", Mo = Gr.version, To = "d00f70240703039df14c76176a055bce6b5484d2b552ba2c89820f03b8e5e60d", Be = 25e3;
1089
+ const Gr = "3.0.18", _r = {
1090
+ version: Gr
1091
+ }, $o = "Project Tools", Io = "project-tools", Mo = _r.version, To = "d00f70240703039df14c76176a055bce6b5484d2b552ba2c89820f03b8e5e60d", Be = 25e3;
1092
1092
  function Le(t) {
1093
1093
  const r = t.match(
1094
1094
  /^\s*(\d+(?:\.\d+)?)\s*([smhdwMY]|sec(onds?)?|min(utes?)?|hours?|days?|weeks?|months?|years?)\s*$/i
@@ -1144,42 +1144,42 @@ function Pe(t) {
1144
1144
  );
1145
1145
  }
1146
1146
  }
1147
- const mt = p.object({
1148
- rootDir: p.string().optional().describe(
1147
+ const mt = h.object({
1148
+ rootDir: h.string().optional().describe(
1149
1149
  'Root directory to list files from, resolved relative to the current working directory. Leave empty to use current directory. Examples: "src" (list src/ subdirectory), "../parent" (list parent directory), "docs/api" (list nested subdirectory). Path must exist and be accessible'
1150
1150
  ),
1151
- globs: p.array(p.string()).optional().describe(
1151
+ globs: h.array(h.string()).optional().describe(
1152
1152
  '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)'
1153
1153
  ),
1154
- showFiles: p.boolean().optional().describe(
1154
+ showFiles: h.boolean().optional().describe(
1155
1155
  "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)"
1156
1156
  ),
1157
- showDirs: p.boolean().optional().describe(
1157
+ showDirs: h.boolean().optional().describe(
1158
1158
  "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)"
1159
1159
  ),
1160
- sortBy: p.array(
1161
- p.object({
1162
- field: p.enum(["type", "path", "lastModified", "size", "totalCountFiles"]).describe(
1160
+ sortBy: h.array(
1161
+ h.object({
1162
+ field: h.enum(["type", "path", "lastModified", "size", "totalCountFiles"]).describe(
1163
1163
  '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)'
1164
1164
  ),
1165
- desc: p.boolean().optional().describe("Sort in descending order (largest/newest first)")
1165
+ desc: h.boolean().optional().describe("Sort in descending order (largest/newest first)")
1166
1166
  })
1167
1167
  ).optional().describe(
1168
1168
  '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'
1169
1169
  ),
1170
- fields: p.array(p.enum(["type", "path", "lastModified", "size", "totalCountFiles"])).optional().describe(
1170
+ fields: h.array(h.enum(["type", "path", "lastModified", "size", "totalCountFiles"])).optional().describe(
1171
1171
  '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'
1172
1172
  ),
1173
- minTimeAgo: p.string().optional().describe(
1173
+ minTimeAgo: h.string().optional().describe(
1174
1174
  '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)'
1175
1175
  ),
1176
- maxTimeAgo: p.string().optional().describe(
1176
+ maxTimeAgo: h.string().optional().describe(
1177
1177
  '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'
1178
1178
  ),
1179
- minTotalSize: p.string().optional().describe(
1179
+ minTotalSize: h.string().optional().describe(
1180
1180
  '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)'
1181
1181
  ),
1182
- maxTotalSize: p.string().optional().describe(
1182
+ maxTotalSize: h.string().optional().describe(
1183
1183
  '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'
1184
1184
  )
1185
1185
  });
@@ -1216,7 +1216,7 @@ async function Jr(t, r) {
1216
1216
  };
1217
1217
  }) ?? null;
1218
1218
  (!d || d.length === 0) && (d = [{ field: "path", desc: !1 }]);
1219
- const h = d?.map((m) => m.field) || [], g = R.resolve(
1219
+ const p = d?.map((m) => m.field) || [], g = R.resolve(
1220
1220
  r.workingDir || "",
1221
1221
  s.rootDir || ""
1222
1222
  );
@@ -1237,15 +1237,15 @@ async function Jr(t, r) {
1237
1237
  })) : [{ value: "**", valueType: "pattern", exclude: !1 }], y = r.globsExclude || [], w = [...m, ...y], I = {
1238
1238
  files: e ?? !1,
1239
1239
  dirs: n ?? !1,
1240
- dateModified: f.includes("dateModified") || h.includes("dateModified"),
1241
- size: f.includes("size") || h.includes("size"),
1242
- countFiles: f.includes("countFiles") || h.includes("countFiles")
1240
+ dateModified: f.includes("dateModified") || p.includes("dateModified"),
1241
+ size: f.includes("size") || p.includes("size"),
1242
+ countFiles: f.includes("countFiles") || p.includes("countFiles")
1243
1243
  };
1244
- let v = null, b = null;
1244
+ let N = null, b = null;
1245
1245
  if (i || c)
1246
1246
  try {
1247
- const x = Date.now(), T = c ? x - Le(c) : null, N = i ? x - Le(i) : null;
1248
- v = [T, N];
1247
+ const x = Date.now(), T = c ? x - Le(c) : null, v = i ? x - Le(i) : null;
1248
+ N = [T, v];
1249
1249
  } catch (x) {
1250
1250
  return {
1251
1251
  error: x instanceof Error ? x.message : "Unknown error parsing time ago filter"
@@ -1264,7 +1264,7 @@ async function Jr(t, r) {
1264
1264
  rootDir: g || null,
1265
1265
  globs: w,
1266
1266
  result: I,
1267
- dateModified: v,
1267
+ dateModified: N,
1268
1268
  totalSize: b
1269
1269
  });
1270
1270
  return $.items.length > Be ? {
@@ -1358,32 +1358,32 @@ function ze(t) {
1358
1358
  );
1359
1359
  }
1360
1360
  }
1361
- const Se = p.object({
1362
- name: p.string().describe(
1361
+ const Se = h.object({
1362
+ name: h.string().describe(
1363
1363
  "Unique name for the filesystem snapshot query. Recommended format: kebab-case-1, kebab-case-2, ..."
1364
1364
  ),
1365
- rootDir: p.string().optional().describe(
1365
+ rootDir: h.string().optional().describe(
1366
1366
  'Root directory to snapshot, resolved relative to the current working directory. Leave empty to use current directory. Examples: "src" (snapshot src/ subdirectory), "../parent" (snapshot parent directory), "docs/api" (snapshot nested subdirectory). Path must exist and be accessible'
1367
1367
  ),
1368
- globs: p.array(p.string()).optional().describe(
1369
- 'Glob patterns to filter which files/directories to include in snapshot. 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)'
1368
+ bulkGlobs: h.array(h.string()).optional().describe(
1369
+ '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)'
1370
1370
  ),
1371
- types: p.array(p.enum(["file", "dir"])).optional().describe(
1371
+ types: h.array(h.enum(["file", "dir"])).optional().describe(
1372
1372
  "Types of items to include in the snapshot. If omitted, includes both files and directories"
1373
1373
  ),
1374
- extraFields: p.array(p.enum(["lastModified", "size", "countMatched"])).optional().describe(
1374
+ extraFields: h.array(h.enum(["lastModified", "size", "countMatched"])).optional().describe(
1375
1375
  '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'
1376
1376
  ),
1377
- minTimeAgo: p.string().optional().describe(
1377
+ minTimeAgo: h.string().optional().describe(
1378
1378
  '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)'
1379
1379
  ),
1380
- maxTimeAgo: p.string().optional().describe(
1380
+ maxTimeAgo: h.string().optional().describe(
1381
1381
  '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'
1382
1382
  ),
1383
- minTotalSize: p.string().optional().describe(
1383
+ minTotalSize: h.string().optional().describe(
1384
1384
  '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)'
1385
1385
  ),
1386
- maxTotalSize: p.string().optional().describe(
1386
+ maxTotalSize: h.string().optional().describe(
1387
1387
  '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'
1388
1388
  )
1389
1389
  }), Ue = new Map(
@@ -1403,14 +1403,14 @@ async function gt(t, r, s) {
1403
1403
  let o;
1404
1404
  try {
1405
1405
  o = Se.parse(t);
1406
- } catch (h) {
1406
+ } catch (p) {
1407
1407
  return {
1408
- error: F(h)
1408
+ error: F(p)
1409
1409
  };
1410
1410
  }
1411
1411
  const {
1412
1412
  name: e,
1413
- globs: n,
1413
+ bulkGlobs: n,
1414
1414
  types: a,
1415
1415
  minTimeAgo: i,
1416
1416
  maxTimeAgo: c,
@@ -1434,8 +1434,8 @@ async function gt(t, r, s) {
1434
1434
  };
1435
1435
  throw S;
1436
1436
  }
1437
- const h = o.extraFields ? o.extraFields.map((S) => S === "lastModified" ? "dateModified" : S) : [];
1438
- h.includes("name") || h.push("name"), h.sort(Kr);
1437
+ const p = o.extraFields ? o.extraFields.map((S) => S === "lastModified" ? "dateModified" : S) : [];
1438
+ p.includes("name") || p.push("name"), p.sort(Kr);
1439
1439
  const g = n && n.length > 0 ? n.map((S) => ({
1440
1440
  value: S,
1441
1441
  valueType: "pattern",
@@ -1460,22 +1460,22 @@ async function gt(t, r, s) {
1460
1460
  error: S instanceof Error ? S.message : "Unknown error parsing size filter"
1461
1461
  };
1462
1462
  }
1463
- const v = a ? a.includes("file") : !0, b = a ? a.includes("dir") : !0, $ = {
1463
+ const N = a ? a.includes("file") : !0, b = a ? a.includes("dir") : !0, $ = {
1464
1464
  name: e,
1465
1465
  rootDir: d,
1466
1466
  globs: y,
1467
- matchFiles: v,
1467
+ matchFiles: N,
1468
1468
  matchDirs: b,
1469
1469
  dateModified: w,
1470
1470
  totalSize: I,
1471
- fields: h
1471
+ fields: p
1472
1472
  };
1473
1473
  return f.fsSnapshotQueries.set(e, $), {
1474
1474
  snapshotQuery: $
1475
1475
  };
1476
- } catch (h) {
1476
+ } catch (p) {
1477
1477
  return {
1478
- error: h instanceof Error ? h.message : "Unknown error"
1478
+ error: p instanceof Error ? p.message : "Unknown error"
1479
1479
  };
1480
1480
  }
1481
1481
  }
@@ -1484,7 +1484,7 @@ function Wr(t, r) {
1484
1484
  "fs-snapshot-query-create",
1485
1485
  {
1486
1486
  title: "Create Filesystem Snapshot Query",
1487
- description: "Create a filesystem snapshot query. Prefer fs-snapshot-browse if you need to immediately create a query, snapshot and browse it",
1487
+ description: "Create a filesystem snapshot query. Include all glob patterns in the bulkGlobs array; never split globs across multiple queries. Prefer fs-snapshot-browse if you need to immediately create a query, snapshot and browse it",
1488
1488
  inputSchema: Se.shape
1489
1489
  },
1490
1490
  async (s, o) => {
@@ -1550,12 +1550,12 @@ function yt(t) {
1550
1550
  (u, f) => {
1551
1551
  const d = e(u, f);
1552
1552
  if (u != null && d != null) {
1553
- const h = r(u);
1554
- n.set(h, d), a.set(d, h);
1553
+ const p = r(u);
1554
+ n.set(p, d), a.set(d, p);
1555
1555
  }
1556
1556
  return d != null && f != null && i.set(
1557
1557
  a.get(d),
1558
- f.map((h) => a.get(h))
1558
+ f.map((p) => a.get(p))
1559
1559
  ), d;
1560
1560
  }
1561
1561
  ), l = e(null, c);
@@ -1582,14 +1582,14 @@ async function Hr(t) {
1582
1582
  size: 0
1583
1583
  };
1584
1584
  r.set(null, n);
1585
- const a = await ht({
1585
+ const a = await pt({
1586
1586
  rootDir: o,
1587
1587
  globs: t.globs
1588
1588
  });
1589
1589
  return await ft({
1590
1590
  paths: [o],
1591
1591
  walkLinks: !0,
1592
- matchPath: pt({
1592
+ matchPath: ht({
1593
1593
  globs: a,
1594
1594
  rootDir: o,
1595
1595
  noCase: !0
@@ -1598,7 +1598,7 @@ async function Hr(t) {
1598
1598
  const u = R.relative(o, i), f = c.isDirectory(), d = c.isFile();
1599
1599
  if (!f && !d)
1600
1600
  return !0;
1601
- const h = me(u || "."), g = f ? "dir" : "file", m = f ? null : c.mtimeMs, y = c.size;
1601
+ const p = me(u || "."), g = f ? "dir" : "file", m = f ? null : c.mtimeMs, y = c.size;
1602
1602
  let w = !0;
1603
1603
  if (d && !t.matchFiles && (w = !1), f && !t.matchDirs && (w = !1), w && d && t.dateModified && m != null) {
1604
1604
  const [$, S] = t.dateModified;
@@ -1613,19 +1613,19 @@ async function Hr(t) {
1613
1613
  } else if (!w)
1614
1614
  return !1;
1615
1615
  const I = {
1616
- path: h ?? ".",
1616
+ path: p ?? ".",
1617
1617
  name: R.basename(i),
1618
1618
  type: g,
1619
1619
  dateModified: m,
1620
1620
  size: y,
1621
1621
  isMatched: w
1622
1622
  };
1623
- if (h == null)
1623
+ if (p == null)
1624
1624
  return n.dateModified = m, n.size = y, n.isMatched = w, !0;
1625
- r.set(h, I);
1626
- const v = me(H(R.dirname(h)));
1627
- let b = s.get(v);
1628
- return b || (b = [], s.set(v, b)), b.push(h), !0;
1625
+ r.set(p, I);
1626
+ const N = me(H(R.dirname(p)));
1627
+ let b = s.get(N);
1628
+ return b || (b = [], s.set(N, b)), b.push(p), !0;
1629
1629
  }
1630
1630
  }), {
1631
1631
  idToNode: r,
@@ -1685,13 +1685,13 @@ function bt(t) {
1685
1685
  let r = 0;
1686
1686
  return r += qe(t.textOpen) + 1, t.textClose != null && (r += qe(t.textClose) + 1), t.indent && (r += 1), r;
1687
1687
  }
1688
- const _e = ["B", "KB", "MB", "GB", "TB"], Ge = 1024;
1688
+ const Ge = ["B", "KB", "MB", "GB", "TB"], _e = 1024;
1689
1689
  function Yr(t) {
1690
1690
  if (t == null) return "-";
1691
1691
  let r = t ?? 0, s = 0;
1692
- for (; r >= Ge && s < _e.length - 1; )
1693
- r /= Ge, s++;
1694
- return `${s === 0 ? r.toString() : r.toFixed(2)}${_e[s]}`;
1692
+ for (; r >= _e && s < Ge.length - 1; )
1693
+ r /= _e, s++;
1694
+ return `${s === 0 ? r.toString() : r.toFixed(2)}${Ge[s]}`;
1695
1695
  }
1696
1696
  function Vr(t) {
1697
1697
  const s = Date.now() - t;
@@ -1717,13 +1717,13 @@ function Xr(t) {
1717
1717
  return function(o, e) {
1718
1718
  let n = "", a, i = 0;
1719
1719
  const c = e ? e.length : 0;
1720
- let l = 1, u, f = 0, d = 0, h = 0, g = 0, m = null, y, w, I;
1720
+ let l = 1, u, f = 0, d = 0, p = 0, g = 0, m = null, y, w, I;
1721
1721
  if (e)
1722
1722
  for (let b = 0; b < e.length; b++) {
1723
1723
  const $ = e[b];
1724
- i += $.countMatched, l += $.countTotal, f += $.tokens, d += $.tokensTotal, h += $.size, g += $.countFiles, $.dateModified != null && (m == null || $.dateModified > m) && (m = $.dateModified);
1724
+ i += $.countMatched, l += $.countTotal, f += $.tokens, d += $.tokensTotal, p += $.size, g += $.countFiles, $.dateModified != null && (m == null || $.dateModified > m) && (m = $.dateModified);
1725
1725
  }
1726
- o ? (y = o.type, w = o.name, I = o.path, a = o.isMatched, a && (i += 1), o.type === "file" ? (h = o.size || 0, g = 1, m = o.dateModified || null) : o.dateModified != null && (m == null || o.dateModified > m) && (m = o.dateModified)) : (y = "dir", w = "<root>", I = ".", a = !0);
1726
+ o ? (y = o.type, w = o.name, I = o.path, a = o.isMatched, a && (i += 1), o.type === "file" ? (p = o.size || 0, g = 1, m = o.dateModified || null) : o.dateModified != null && (m == null || o.dateModified > m) && (m = o.dateModified)) : (y = "dir", w = "<root>", I = ".", a = !0);
1727
1727
  for (let b = 0, $ = r.length; b < $; b++) {
1728
1728
  const S = r[b];
1729
1729
  switch (b > 0 && (n += " "), S) {
@@ -1731,7 +1731,7 @@ function Xr(t) {
1731
1731
  n += m ? Vr(m) : "-";
1732
1732
  break;
1733
1733
  case "size":
1734
- n += Yr(h);
1734
+ n += Yr(p);
1735
1735
  break;
1736
1736
  case "type":
1737
1737
  n += y;
@@ -1744,12 +1744,12 @@ function Xr(t) {
1744
1744
  break;
1745
1745
  }
1746
1746
  }
1747
- const v = {
1747
+ const N = {
1748
1748
  indent: !0,
1749
1749
  textOpen: n,
1750
1750
  textClose: null
1751
1751
  };
1752
- return u = bt(v), d += u, {
1752
+ return u = bt(N), d += u, {
1753
1753
  type: y,
1754
1754
  name: w,
1755
1755
  path: I,
@@ -1760,8 +1760,8 @@ function Xr(t) {
1760
1760
  tokens: u,
1761
1761
  tokensChilds: f,
1762
1762
  tokensTotal: d,
1763
- text: v,
1764
- size: h,
1763
+ text: N,
1764
+ size: p,
1765
1765
  countFiles: g,
1766
1766
  dateModified: m
1767
1767
  };
@@ -1785,12 +1785,12 @@ async function es(t) {
1785
1785
  a.sort(n);
1786
1786
  }), le(e);
1787
1787
  }
1788
- const ee = p.object({
1789
- queryName: p.string().optional().describe("Name of previously created filesystem snapshot query, to use"),
1788
+ const ee = h.object({
1789
+ queryName: h.string().optional().describe("Name of previously created filesystem snapshot query, to use"),
1790
1790
  query: Se.optional().describe(
1791
1791
  "Filesystem snapshot query creation options JSON to automatically create query"
1792
1792
  ),
1793
- name: p.string().describe(
1793
+ name: h.string().describe(
1794
1794
  "Unique name for the filesystem snapshot. Recommended format: kebab-case-1, kebab-case-2, ..."
1795
1795
  )
1796
1796
  });
@@ -1907,8 +1907,8 @@ function ss(t) {
1907
1907
  });
1908
1908
  let l = null, u = 0, f = 0;
1909
1909
  for (; !r.isEmpty(); ) {
1910
- const { reportNode: d, node: h } = r.dequeue(), g = s.getChilds(h);
1911
- if (g == null || h.countChilds === 0 || g.length !== h.countChilds)
1910
+ const { reportNode: d, node: p } = r.dequeue(), g = s.getChilds(p);
1911
+ if (g == null || p.countChilds === 0 || g.length !== p.countChilds)
1912
1912
  throw new Error(
1913
1913
  "Impossible behavior: nodeChilds is null or length mismatch"
1914
1914
  );
@@ -1916,13 +1916,13 @@ function ss(t) {
1916
1916
  for (let w = 0; w < g.length; w++)
1917
1917
  g[w].countChilds > 0 && (m += 1);
1918
1918
  const y = m * i.tokens;
1919
- if (o != null && u + h.countChilds + m > o || e != null && f + h.tokensChilds + y > e) {
1919
+ if (o != null && u + p.countChilds + m > o || e != null && f + p.tokensChilds + y > e) {
1920
1920
  const w = [];
1921
- let I = null, v = 0;
1921
+ let I = null, N = 0;
1922
1922
  for (let $ = 0, S = g.length; $ < S; $++) {
1923
- const x = g[$], T = v * i.tokens;
1923
+ const x = g[$], T = N * i.tokens;
1924
1924
  I != null && // Если общий лимит превышен, то не создаем новую группу, а продолжаем текущую. В случае достижения лимитов, последняя группа может содержать больше элементов, чем указано в лимитах группы, и это допустимо. Главное - дать в отчете полную картину.
1925
- !(o != null && u + 1 > o || e != null && f + i.tokens > e) && (n != null && I.countGrouped + 1 + v > n || a != null && I.tokensGrouped + x.tokens + T > a) && (w.push(I), u += 1, f += i.tokens, I = null, v = 0), I = i.add(I, x, $), x.countChilds > 0 && (v += 1);
1925
+ !(o != null && u + 1 > o || e != null && f + i.tokens > e) && (n != null && I.countGrouped + 1 + N > n || a != null && I.tokensGrouped + x.tokens + T > a) && (w.push(I), u += 1, f += i.tokens, I = null, N = 0), I = i.add(I, x, $), x.countChilds > 0 && (N += 1);
1926
1926
  }
1927
1927
  I != null && (w.push(I), u += 1, f += i.tokens);
1928
1928
  const b = w.map(($) => ({
@@ -1938,17 +1938,17 @@ function ss(t) {
1938
1938
  l = b;
1939
1939
  }
1940
1940
  } else {
1941
- u += h.countChilds, f += h.tokensChilds;
1941
+ u += p.countChilds, f += p.tokensChilds;
1942
1942
  const w = [];
1943
1943
  for (let I = 0; I < g.length; I++) {
1944
- const v = g[I], b = {
1945
- text: v.text
1944
+ const N = g[I], b = {
1945
+ text: N.text
1946
1946
  };
1947
1947
  w.push(b);
1948
- const $ = s.getChilds(v);
1948
+ const $ = s.getChilds(N);
1949
1949
  $ != null && $.length > 0 && r.enqueue({
1950
1950
  reportNode: b,
1951
- node: v
1951
+ node: N
1952
1952
  });
1953
1953
  }
1954
1954
  if (d != null) {
@@ -1981,14 +1981,14 @@ function St(t) {
1981
1981
  i = r.root;
1982
1982
  let c, l = r.getChilds(i) ?? [];
1983
1983
  if (o != null) {
1984
- const [d, h] = o;
1985
- if (d < 0 || h <= d || h >= l.length)
1984
+ const [d, p] = o;
1985
+ if (d < 0 || p <= d || p >= l.length)
1986
1986
  throw new Error(
1987
- `Invalid index range: ${d}-${h} for root nodes length ${l.length}`
1987
+ `Invalid index range: ${d}-${p} for root nodes length ${l.length}`
1988
1988
  );
1989
1989
  const g = [];
1990
1990
  let m = null;
1991
- for (let y = d; y <= h; y++) {
1991
+ for (let y = d; y <= p; y++) {
1992
1992
  const w = l[y];
1993
1993
  g.push(w), m = n.add(m, w, y);
1994
1994
  }
@@ -2047,15 +2047,15 @@ class os {
2047
2047
  tokensGrouped: s.tokens
2048
2048
  } : (r.indexRange[1] = o, r.countGrouped += 1, r.countMatched += s.countMatched, r.tokensGrouped += s.tokens, r);
2049
2049
  }
2050
- const $t = p.object({
2051
- snapshotName: p.string().optional().describe("Name of previously created filesystem snapshot, to use"),
2050
+ const $t = h.object({
2051
+ snapshotName: h.string().optional().describe("Name of previously created filesystem snapshot, to use"),
2052
2052
  snapshot: ee.optional().describe(
2053
2053
  "Filesystem snapshot creation options JSON to automatically create snapshot"
2054
2054
  ),
2055
- parentPath: p.string().optional().describe(
2055
+ parentPath: h.string().optional().describe(
2056
2056
  "Path relative to snapshot rootDir to browse. Omit to browse the rootDir itself"
2057
2057
  ),
2058
- childsIndexRange: p.tuple([p.number(), p.number()]).optional().describe(
2058
+ childsIndexRange: h.tuple([h.number(), h.number()]).optional().describe(
2059
2059
  "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"
2060
2060
  )
2061
2061
  // maxCountTotal: z
@@ -2096,7 +2096,7 @@ async function ns(t, r, s) {
2096
2096
  return {
2097
2097
  error: "Either snapshotName or snapshot must be provided, not both"
2098
2098
  };
2099
- let d, h = !1, g = !1;
2099
+ let d, p = !1, g = !1;
2100
2100
  if (e) {
2101
2101
  if (d = f.fsSnapshots.get(e), d == null)
2102
2102
  return {
@@ -2112,7 +2112,7 @@ async function ns(t, r, s) {
2112
2112
  return {
2113
2113
  error: m.error
2114
2114
  };
2115
- d = m.fsSnapshot, h = m.queryCreated, g = !0;
2115
+ d = m.fsSnapshot, p = m.queryCreated, g = !0;
2116
2116
  } else
2117
2117
  return {
2118
2118
  error: "Either snapshotName or snapshot must be provided"
@@ -2134,7 +2134,7 @@ async function ns(t, r, s) {
2134
2134
  }), w = xt(y);
2135
2135
  return {
2136
2136
  fsSnapshot: d,
2137
- queryCreated: h,
2137
+ queryCreated: p,
2138
2138
  snapshotCreated: g,
2139
2139
  parentPath: m,
2140
2140
  childsIndexRange: a,
@@ -2204,7 +2204,7 @@ async function ls(t) {
2204
2204
  })
2205
2205
  );
2206
2206
  }
2207
- const je = 10, re = 48, Ke = 57, de = 36, cs = 38, us = 39, ds = 60, fs = 62, hs = 96, se = 0, We = 1, He = 2, Qe = 3, Ye = 4, ps = 5;
2207
+ const je = 10, re = 48, Ke = 57, de = 36, cs = 38, us = 39, ds = 60, fs = 62, ps = 96, se = 0, We = 1, He = 2, Qe = 3, Ye = 4, hs = 5;
2208
2208
  function ms(t) {
2209
2209
  const { content: r, pattern: s, replacement: o } = t, e = r.length, n = [0];
2210
2210
  for (let b = 0; b < e; b++)
@@ -2228,15 +2228,15 @@ function ms(t) {
2228
2228
  continue;
2229
2229
  }
2230
2230
  const T = o.charCodeAt(x + 1);
2231
- let N = -1, B = 0, k = 2;
2231
+ let v = -1, B = 0, k = 2;
2232
2232
  if (T === de)
2233
- N = se, B = "$";
2233
+ v = se, B = "$";
2234
2234
  else if (T === cs)
2235
- N = We;
2236
- else if (T === hs)
2237
- N = He;
2235
+ v = We;
2236
+ else if (T === ps)
2237
+ v = He;
2238
2238
  else if (T === us)
2239
- N = Qe;
2239
+ v = Qe;
2240
2240
  else if (T >= re && T <= Ke) {
2241
2241
  let M = x + 2;
2242
2242
  for (; M < b; ) {
@@ -2244,27 +2244,27 @@ function ms(t) {
2244
2244
  if (C < re || C > Ke) break;
2245
2245
  M++;
2246
2246
  }
2247
- N = Ye, B = o.substring(x + 1, M), k = M - x;
2247
+ v = Ye, B = o.substring(x + 1, M), k = M - x;
2248
2248
  } else if (T === ds) {
2249
2249
  let M = x + 2;
2250
2250
  for (; M < b && o.charCodeAt(M) !== fs; )
2251
2251
  M++;
2252
- M < b && M > x + 2 && (N = ps, B = o.substring(x + 2, M), k = M + 1 - x);
2252
+ M < b && M > x + 2 && (v = hs, B = o.substring(x + 2, M), k = M + 1 - x);
2253
2253
  }
2254
- N >= 0 ? (x > S && (u.push(se), f.push(o.substring(S, x))), u.push(N), f.push(B), x += k, S = x) : x++;
2254
+ v >= 0 ? (x > S && (u.push(se), f.push(o.substring(S, x))), u.push(v), f.push(B), x += k, S = x) : x++;
2255
2255
  }
2256
2256
  S < b && (u.push(se), f.push(o.substring(S))), d = u.length;
2257
2257
  } else
2258
2258
  l = o;
2259
2259
  }
2260
- let h = "", g = 0, m = 0;
2260
+ let p = "", g = 0, m = 0;
2261
2261
  s.lastIndex = 0;
2262
2262
  let y;
2263
2263
  for (; (y = s.exec(r)) !== null; ) {
2264
2264
  const b = y.index, $ = y[0], S = $.length, x = b + S;
2265
- let T, N, B, k;
2265
+ let T, v, B, k;
2266
2266
  if (a === 1)
2267
- T = 0, N = 1, B = 0, k = e;
2267
+ T = 0, v = 1, B = 0, k = e;
2268
2268
  else {
2269
2269
  let M = 0, C = a - 1;
2270
2270
  for (; M < C; ) {
@@ -2277,17 +2277,17 @@ function ms(t) {
2277
2277
  const O = M + C + 1 >> 1;
2278
2278
  n[O] <= E ? M = O : C = O - 1;
2279
2279
  }
2280
- N = M + 1;
2280
+ v = M + 1;
2281
2281
  } else
2282
- N = T + 1;
2283
- B = n[T], k = N < a ? n[N] : e;
2282
+ v = T + 1;
2283
+ B = n[T], k = v < a ? n[v] : e;
2284
2284
  }
2285
2285
  if (i.push({
2286
2286
  offset: [b, x],
2287
- lines: [T, N],
2287
+ lines: [T, v],
2288
2288
  linesOffset: [B, k]
2289
2289
  }), o != null) {
2290
- h += r.substring(g, b);
2290
+ p += r.substring(g, b);
2291
2291
  let M;
2292
2292
  if (l != null)
2293
2293
  M = l;
@@ -2312,7 +2312,7 @@ function ms(t) {
2312
2312
  case Ye: {
2313
2313
  const L = P, z = L.length, A = L.charCodeAt(0) - re;
2314
2314
  if (z >= 2) {
2315
- const _ = L.charCodeAt(1) - re, D = A * 10 + _;
2315
+ const G = L.charCodeAt(1) - re, D = A * 10 + G;
2316
2316
  if (D >= 1 && D <= O) {
2317
2317
  M += y[D] ?? "", z > 2 && (M += L.substring(2));
2318
2318
  break;
@@ -2326,7 +2326,7 @@ function ms(t) {
2326
2326
  }
2327
2327
  }
2328
2328
  }
2329
- h += M;
2329
+ p += M;
2330
2330
  const C = b + m;
2331
2331
  c.push({
2332
2332
  offset: [C, C + M.length],
@@ -2339,38 +2339,38 @@ function ms(t) {
2339
2339
  }
2340
2340
  if (s.lastIndex = 0, o == null)
2341
2341
  return { search: { content: r, matches: i }, replace: null };
2342
- h += r.substring(g);
2343
- const w = h.length, I = [0];
2342
+ p += r.substring(g);
2343
+ const w = p.length, I = [0];
2344
2344
  for (let b = 0; b < w; b++)
2345
- h.charCodeAt(b) === je && b + 1 < w && I.push(b + 1);
2346
- const v = I.length;
2345
+ p.charCodeAt(b) === je && b + 1 < w && I.push(b + 1);
2346
+ const N = I.length;
2347
2347
  for (let b = 0, $ = c.length; b < $; b++) {
2348
2348
  const S = c[b], x = S.offset[0], T = S.offset[1];
2349
- let N, B, k, M;
2350
- if (v === 1)
2351
- N = 0, B = 1, k = 0, M = w;
2349
+ let v, B, k, M;
2350
+ if (N === 1)
2351
+ v = 0, B = 1, k = 0, M = w;
2352
2352
  else {
2353
- let C = 0, E = v - 1;
2353
+ let C = 0, E = N - 1;
2354
2354
  for (; C < E; ) {
2355
2355
  const O = C + E + 1 >> 1;
2356
2356
  I[O] <= x ? C = O : E = O - 1;
2357
2357
  }
2358
- if (N = C, T > x) {
2358
+ if (v = C, T > x) {
2359
2359
  const O = T - 1;
2360
- for (E = v - 1; C < E; ) {
2360
+ for (E = N - 1; C < E; ) {
2361
2361
  const K = C + E + 1 >> 1;
2362
2362
  I[K] <= O ? C = K : E = K - 1;
2363
2363
  }
2364
2364
  B = C + 1;
2365
2365
  } else
2366
- B = N + 1;
2367
- k = I[N], M = B < v ? I[B] : w;
2366
+ B = v + 1;
2367
+ k = I[v], M = B < N ? I[B] : w;
2368
2368
  }
2369
- S.lines[0] = N, S.lines[1] = B, S.linesOffset[0] = k, S.linesOffset[1] = M;
2369
+ S.lines[0] = v, S.lines[1] = B, S.linesOffset[0] = k, S.linesOffset[1] = M;
2370
2370
  }
2371
2371
  return {
2372
2372
  search: { content: r, matches: i },
2373
- replace: { content: h, matches: c }
2373
+ replace: { content: p, matches: c }
2374
2374
  };
2375
2375
  }
2376
2376
  function Mt(t) {
@@ -2420,24 +2420,24 @@ function gs(t, r) {
2420
2420
  replace: null
2421
2421
  };
2422
2422
  }
2423
- const s = t.replace ?? t.search, o = r.replace ?? r.search, e = t.search.content, n = o.content, a = e.length, i = n.length, c = t.search.matches, l = s.matches, u = r.search.matches, f = o.matches, d = l.length, h = u.length, g = [], m = [];
2424
- let y = 0, w = 0, I = 0, v = 0, b = 0, $ = 0, S = 0, x = 0, T = 0, N = 0, B = 0, k = 0, M = 0, C = 0, E = 0, O = 0, K = 0, q = 0, P = 0, L = 0, z = 0, A = 0, _ = 0, D = 0;
2425
- for (; y < d || w < h; )
2426
- if (y < d && (b = l[y].offset[0], $ = l[y].offset[1]), w < h && (S = u[w].offset[0], x = u[w].offset[1]), y < d && w < h && b < x && S < $) {
2423
+ const s = t.replace ?? t.search, o = r.replace ?? r.search, e = t.search.content, n = o.content, a = e.length, i = n.length, c = t.search.matches, l = s.matches, u = r.search.matches, f = o.matches, d = l.length, p = u.length, g = [], m = [];
2424
+ let y = 0, w = 0, I = 0, N = 0, b = 0, $ = 0, S = 0, x = 0, T = 0, v = 0, B = 0, k = 0, M = 0, C = 0, E = 0, O = 0, K = 0, q = 0, P = 0, L = 0, z = 0, A = 0, G = 0, D = 0;
2425
+ for (; y < d || w < p; )
2426
+ if (y < d && (b = l[y].offset[0], $ = l[y].offset[1]), w < p && (S = u[w].offset[0], x = u[w].offset[1]), y < d && w < p && b < x && S < $) {
2427
2427
  K = b < S ? b : S, T = $ > x ? $ : x, B = y, k = w, y++, w++;
2428
2428
  do {
2429
- for (N = T; y < d && l[y].offset[0] < T; )
2429
+ for (v = T; y < d && l[y].offset[0] < T; )
2430
2430
  $ = l[y].offset[1], $ > T && (T = $), y++;
2431
- for (; w < h && u[w].offset[0] < T; )
2431
+ for (; w < p && u[w].offset[0] < T; )
2432
2432
  x = u[w].offset[1], x > T && (T = x), w++;
2433
- } while (T !== N);
2433
+ } while (T !== v);
2434
2434
  M = 1 / 0, C = -1 / 0, q = K, P = I;
2435
- for (let G = B; G < y; G++)
2436
- 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 < M && (M = D), D = A + P, D > C && (C = D)), L < M && (M = L), z > C && (C = z), P += z - L - _ + A, q = _;
2437
- q < T && (D = q + P, D < M && (M = D), D = T + P, D > C && (C = D)), I = P, E = 1 / 0, O = -1 / 0, q = K, P = v;
2438
- for (let G = k; G < w; G++)
2439
- 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 < E && (E = D), D = L + P, D > O && (O = D)), A < E && (E = A), _ > O && (O = _), P += _ - A - z + L, q = z;
2440
- q < T && (D = q + P, D < E && (E = D), D = T + P, D > O && (O = D)), v = P;
2435
+ for (let _ = B; _ < y; _++)
2436
+ L = c[_].offset[0], z = c[_].offset[1], A = l[_].offset[0], G = l[_].offset[1], q < A && (D = q + P, D < M && (M = D), D = A + P, D > C && (C = D)), L < M && (M = L), z > C && (C = z), P += z - L - G + A, q = G;
2437
+ q < T && (D = q + P, D < M && (M = D), D = T + P, D > C && (C = D)), I = P, E = 1 / 0, O = -1 / 0, q = K, P = N;
2438
+ for (let _ = k; _ < w; _++)
2439
+ L = u[_].offset[0], z = u[_].offset[1], A = f[_].offset[0], G = f[_].offset[1], q < L && (D = q + P, D < E && (E = D), D = L + P, D > O && (O = D)), A < E && (E = A), G > O && (O = G), P += G - A - z + L, q = z;
2440
+ q < T && (D = q + P, D < E && (E = D), D = T + P, D > O && (O = D)), N = P;
2441
2441
  const U = oe(e, a, M, C);
2442
2442
  g.push({
2443
2443
  offset: [M, C],
@@ -2450,22 +2450,22 @@ function gs(t, r) {
2450
2450
  lines: [te.startLine, te.endLine],
2451
2451
  linesOffset: [te.startLineOfs, te.endLineOfs]
2452
2452
  });
2453
- } else if (w >= h || y < d && b <= S) {
2454
- L = c[y].offset[0], z = c[y].offset[1], A = l[y].offset[0], _ = l[y].offset[1], E = A + v, O = _ + v;
2453
+ } else if (w >= p || y < d && b <= S) {
2454
+ L = c[y].offset[0], z = c[y].offset[1], A = l[y].offset[0], G = l[y].offset[1], E = A + N, O = G + N;
2455
2455
  const U = oe(n, i, E, O);
2456
2456
  g.push(c[y]), m.push({
2457
2457
  offset: [E, O],
2458
2458
  lines: [U.startLine, U.endLine],
2459
2459
  linesOffset: [U.startLineOfs, U.endLineOfs]
2460
- }), I += z - L - _ + A, y++;
2460
+ }), I += z - L - G + A, y++;
2461
2461
  } else {
2462
- L = u[w].offset[0], z = u[w].offset[1], A = f[w].offset[0], _ = f[w].offset[1], M = L + I, C = z + I;
2462
+ L = u[w].offset[0], z = u[w].offset[1], A = f[w].offset[0], G = f[w].offset[1], M = L + I, C = z + I;
2463
2463
  const U = oe(e, a, M, C);
2464
2464
  g.push({
2465
2465
  offset: [M, C],
2466
2466
  lines: [U.startLine, U.endLine],
2467
2467
  linesOffset: [U.startLineOfs, U.endLineOfs]
2468
- }), m.push(f[w]), v += _ - A - z + L, w++;
2468
+ }), m.push(f[w]), N += G - A - z + L, w++;
2469
2469
  }
2470
2470
  return {
2471
2471
  search: { content: e, matches: g },
@@ -2621,29 +2621,31 @@ function Ct(t) {
2621
2621
  }
2622
2622
  return o;
2623
2623
  }
2624
- const xs = p.object({
2625
- pattern: p.string().describe("JS RegExp pattern"),
2626
- flags: p.string().optional().describe("JS RegExp flags")
2627
- }), Nt = p.object({
2628
- snapshotName: p.string().optional().describe("Name of previously created filesystem snapshot, to use"),
2624
+ const xs = h.object({
2625
+ pattern: h.string().describe("JS RegExp pattern"),
2626
+ flags: h.string().default("gm").describe('JS RegExp flags. Default: "gm"')
2627
+ }), vt = h.object({
2628
+ snapshotName: h.string().optional().describe("Name of previously created filesystem snapshot, to use"),
2629
2629
  snapshot: ee.optional().describe(
2630
2630
  "Filesystem snapshot creation options JSON to automatically create snapshot"
2631
2631
  ),
2632
- operations: p.array(xs).describe("Search operations to execute sequentially on each file"),
2633
- outputLimit: p.number().int().min(0).max(J).default(Q).describe(
2632
+ bulkOperations: h.array(xs).describe(
2633
+ "All search patterns to execute; include every pattern here; never split across multiple calls"
2634
+ ),
2635
+ outputLimit: h.number().int().min(0).max(J).default(Q).describe(
2634
2636
  `Maximum output characters. Output exceeding this limit will be truncated. Maximum: ${J}. Default: ${Q}`
2635
2637
  )
2636
2638
  });
2637
2639
  async function $s(t, r, s) {
2638
2640
  let o;
2639
2641
  try {
2640
- o = Nt.parse(t);
2642
+ o = vt.parse(t);
2641
2643
  } catch (w) {
2642
2644
  return {
2643
2645
  error: F(w)
2644
2646
  };
2645
2647
  }
2646
- const { snapshotName: e, snapshot: n, operations: a, outputLimit: i } = o;
2648
+ const { snapshotName: e, snapshot: n, bulkOperations: a, outputLimit: i } = o;
2647
2649
  if (!s.sessionId)
2648
2650
  return {
2649
2651
  error: "Session ID is required"
@@ -2674,26 +2676,26 @@ async function $s(t, r, s) {
2674
2676
  return {
2675
2677
  error: "Either snapshotName or snapshot must be provided"
2676
2678
  };
2677
- const d = It(l), h = l.query.rootDir ?? ".", g = await Tt({
2679
+ const d = It(l), p = l.query.rootDir ?? ".", g = await Tt({
2678
2680
  filePaths: d,
2679
2681
  operations: a
2680
2682
  }), m = Ct({
2681
2683
  result: g,
2682
- rootDir: h
2684
+ rootDir: p
2683
2685
  });
2684
2686
  return { output: we({
2685
2687
  sessionId: s.sessionId,
2686
2688
  source: m,
2687
2689
  limit: i
2688
- }).content, rootDir: h, fsSnapshot: l, queryCreated: u, snapshotCreated: f };
2690
+ }).content, rootDir: p, fsSnapshot: l, queryCreated: u, snapshotCreated: f };
2689
2691
  }
2690
2692
  function Is(t, r) {
2691
2693
  t(
2692
2694
  "fs-snapshot-search",
2693
2695
  {
2694
2696
  title: "Search File Contents in Snapshot",
2695
- description: "Search file contents using JS RegExp. Use this to find text patterns across snapshot files. Combine all patterns into the `operations` array within one tool call; never split patterns across multiple tool calls",
2696
- inputSchema: Nt.shape
2697
+ 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",
2698
+ inputSchema: vt.shape
2697
2699
  },
2698
2700
  async (s, o) => {
2699
2701
  const e = await $s(
@@ -2711,37 +2713,39 @@ function Is(t, r) {
2711
2713
  `), n += `✅ Search in snapshot "${e.fsSnapshot.name}":
2712
2714
  `, n += `Root directory (<root>/): ${e.rootDir}
2713
2715
  `, n += `
2714
- ${e.output}`, n += "\n\nReminder: combine all patterns into one `operations` array in one tool call; never split patterns across multiple tool calls", n;
2716
+ ${e.output}`, n += `
2717
+
2718
+ Reminder: use one snapshot covering all target files; include all patterns in the bulkOperations array; never split into multiple calls based on file locations or pattern groups`, n;
2715
2719
  }
2716
2720
  );
2717
2721
  }
2718
- const Ms = p.object({
2719
- pattern: p.string().describe("JS RegExp pattern"),
2720
- flags: p.string().optional().describe("JS RegExp flags"),
2721
- replacement: p.string().describe("JS replacement pattern")
2722
- }), vt = p.object({
2723
- snapshotName: p.string().optional().describe("Name of previously created filesystem snapshot, to use"),
2722
+ const Ms = h.object({
2723
+ pattern: h.string().describe("JS RegExp pattern"),
2724
+ flags: h.string().default("gm").describe('JS RegExp flags. Default: "gm"'),
2725
+ replacement: h.string().describe("JS replacement pattern")
2726
+ }), Nt = h.object({
2727
+ snapshotName: h.string().optional().describe("Name of previously created filesystem snapshot, to use"),
2724
2728
  snapshot: ee.optional().describe(
2725
2729
  "Filesystem snapshot creation options JSON to automatically create snapshot"
2726
2730
  ),
2727
- operations: p.array(Ms).describe("Replace operations to execute sequentially on each file"),
2728
- outputLimit: p.number().int().min(0).max(J).default(Q).describe(
2731
+ bulkOperations: h.array(Ms).describe("All replace patterns to execute; include every pattern here; never split across multiple calls"),
2732
+ outputLimit: h.number().int().min(0).max(J).default(Q).describe(
2729
2733
  `Maximum output characters. Output exceeding this limit will be truncated. Maximum: ${J}. Default: ${Q}`
2730
2734
  ),
2731
- dryRun: p.boolean().optional().describe(
2735
+ dryRun: h.boolean().optional().describe(
2732
2736
  "Preview changes without writing files. When true, shows what would be replaced but does not modify files"
2733
2737
  )
2734
2738
  });
2735
2739
  async function Ts(t, r, s) {
2736
2740
  let o;
2737
2741
  try {
2738
- o = vt.parse(t);
2742
+ o = Nt.parse(t);
2739
2743
  } catch (I) {
2740
2744
  return {
2741
2745
  error: F(I)
2742
2746
  };
2743
2747
  }
2744
- const { snapshotName: e, snapshot: n, operations: a, outputLimit: i, dryRun: c } = o;
2748
+ const { snapshotName: e, snapshot: n, bulkOperations: a, outputLimit: i, dryRun: c } = o;
2745
2749
  if (!s.sessionId)
2746
2750
  return {
2747
2751
  error: "Session ID is required"
@@ -2772,8 +2776,8 @@ async function Ts(t, r, s) {
2772
2776
  return {
2773
2777
  error: "Either snapshotName or snapshot must be provided"
2774
2778
  };
2775
- const h = It(u), g = u.query.rootDir ?? ".", m = await Tt({
2776
- filePaths: h,
2779
+ const p = It(u), g = u.query.rootDir ?? ".", m = await Tt({
2780
+ filePaths: p,
2777
2781
  operations: a,
2778
2782
  dryRun: c
2779
2783
  }), y = Ct({
@@ -2791,8 +2795,8 @@ function Cs(t, r) {
2791
2795
  "fs-snapshot-replace",
2792
2796
  {
2793
2797
  title: "Replace File Contents in Snapshot",
2794
- description: "Replace file contents using JS RegExp. Use this to perform bulk replacements across snapshot files. Combine all patterns into the `operations` array within one tool call; never split patterns across multiple tool calls",
2795
- inputSchema: vt.shape
2798
+ description: "Replace file contents using JS RegExp. Use this to perform bulk replacements across snapshot files. Put all replace patterns in the bulkOperations array; use one snapshot with rootDir covering all target files; never split into multiple calls based on file locations, directories, or pattern groups",
2799
+ inputSchema: Nt.shape
2796
2800
  },
2797
2801
  async (s, o) => {
2798
2802
  const e = await Ts(
@@ -2810,31 +2814,33 @@ function Cs(t, r) {
2810
2814
  `), n += `✅ Replace in snapshot "${e.fsSnapshot.name}":
2811
2815
  `, n += `Root directory (<root>/): ${e.rootDir}
2812
2816
  `, n += `
2813
- ${e.output}`, n += "\n\nReminder: combine all patterns into one `operations` array in one tool call; never split patterns across multiple tool calls", n;
2817
+ ${e.output}`, n += `
2818
+
2819
+ Reminder: use one snapshot covering all target files; include all patterns in the bulkOperations array; never split into multiple calls based on file locations or pattern groups`, n;
2814
2820
  }
2815
2821
  );
2816
2822
  }
2817
- function Ns(t, r) {
2823
+ function vs(t, r) {
2818
2824
  r.list && jr(t, r), r.snapshotQueryCreate && Wr(t, r), r.snapshotCreate && ts(t, r), r.snapshotBrowse && is(t, r), r.snapshotSearch && Is(t, r), r.snapshotReplace && Cs(t, r), console.log(
2819
2825
  `File manager:
2820
2826
  - Working directory: ${R.resolve(r.workingDir || "")}
2821
2827
  `
2822
2828
  );
2823
2829
  }
2824
- const he = /* @__PURE__ */ new Map();
2830
+ const pe = /* @__PURE__ */ new Map();
2825
2831
  function j(t) {
2826
- return he.has(t) || he.set(t, {
2832
+ return pe.has(t) || pe.set(t, {
2827
2833
  browsers: /* @__PURE__ */ new Map(),
2828
2834
  domSnapshotQueries: /* @__PURE__ */ new Map()
2829
- }), he.get(t);
2835
+ }), pe.get(t);
2830
2836
  }
2831
- const xe = p.object({
2832
- name: p.string().describe(
2837
+ const xe = h.object({
2838
+ name: h.string().describe(
2833
2839
  "Unique name for the browser. Recommended format: kebab-case-1, kebab-case-2, ..."
2834
2840
  ),
2835
- browserType: p.enum(["chromium", "firefox", "webkit"]).describe("Browser type to launch"),
2836
- muteAudio: p.boolean().optional().describe("Mute audio in the browser"),
2837
- devTools: p.boolean().optional().describe("Open browser with dev tools")
2841
+ browserType: h.enum(["chromium", "firefox", "webkit"]).describe("Browser type to launch"),
2842
+ muteAudio: h.boolean().optional().describe("Mute audio in the browser"),
2843
+ devTools: h.boolean().optional().describe("Open browser with dev tools")
2838
2844
  });
2839
2845
  async function Et(t, r, s) {
2840
2846
  let o;
@@ -2873,7 +2879,7 @@ async function Et(t, r, s) {
2873
2879
  };
2874
2880
  }
2875
2881
  }
2876
- function vs(t, r) {
2882
+ function Ns(t, r) {
2877
2883
  t(
2878
2884
  "playwright-browser-create",
2879
2885
  {
@@ -2888,7 +2894,7 @@ ${e.error != null ? `❌ Error: ${e.error}` : `✅ Browser "${e.browserInfo.name
2888
2894
  }
2889
2895
  );
2890
2896
  }
2891
- const kt = p.object({});
2897
+ const kt = h.object({});
2892
2898
  async function Es(t, r, s) {
2893
2899
  let o;
2894
2900
  try {
@@ -2928,8 +2934,8 @@ ${n.length === 0 ? "No browsers found" : `Browsers: ${n.join(", ")}`}`;
2928
2934
  }
2929
2935
  );
2930
2936
  }
2931
- const Ot = p.object({
2932
- names: p.array(p.string()).optional().describe(
2937
+ const Ot = h.object({
2938
+ names: h.array(h.string()).optional().describe(
2933
2939
  "Names of browsers to close. If not specified, closes all browsers"
2934
2940
  )
2935
2941
  });
@@ -2993,28 +2999,28 @@ ${n.join(`
2993
2999
  }
2994
3000
  );
2995
3001
  }
2996
- const $e = p.object({
2997
- browserName: p.string().optional().describe("Name of previously created browser, to use"),
3002
+ const $e = h.object({
3003
+ browserName: h.string().optional().describe("Name of previously created browser, to use"),
2998
3004
  browser: xe.optional().describe(
2999
3005
  "Browser creation options JSON to automatically create browser"
3000
3006
  ),
3001
- name: p.string().describe(
3007
+ name: h.string().describe(
3002
3008
  "Unique name for the context. Recommended format: kebab-case-1, kebab-case-2, ..."
3003
3009
  ),
3004
- isMobile: p.boolean().optional().describe("Configure for mobile device simulation"),
3005
- hasTouch: p.boolean().optional().describe("Enable touch events"),
3006
- viewport: p.object({
3007
- width: p.number(),
3008
- height: p.number()
3010
+ isMobile: h.boolean().optional().describe("Configure for mobile device simulation"),
3011
+ hasTouch: h.boolean().optional().describe("Enable touch events"),
3012
+ viewport: h.object({
3013
+ width: h.number(),
3014
+ height: h.number()
3009
3015
  }).optional().describe("Viewport size configuration")
3010
3016
  });
3011
3017
  async function Dt(t, r, s) {
3012
3018
  let o;
3013
3019
  try {
3014
3020
  o = $e.parse(t);
3015
- } catch (h) {
3021
+ } catch (p) {
3016
3022
  return {
3017
- error: F(h)
3023
+ error: F(p)
3018
3024
  };
3019
3025
  }
3020
3026
  const { name: e, browserName: n, browser: a, isMobile: i, hasTouch: c, viewport: l } = o;
@@ -3034,25 +3040,25 @@ async function Dt(t, r, s) {
3034
3040
  error: `Browser "${n}" not found`
3035
3041
  };
3036
3042
  } else if (a) {
3037
- const h = await Et(a, r, s);
3038
- if (h.error != null)
3043
+ const p = await Et(a, r, s);
3044
+ if (p.error != null)
3039
3045
  return {
3040
- error: h.error
3046
+ error: p.error
3041
3047
  };
3042
- d = h.browserInfo, f = !0;
3048
+ d = p.browserInfo, f = !0;
3043
3049
  } else
3044
3050
  return {
3045
3051
  error: "Either browserName or browser must be provided"
3046
3052
  };
3047
3053
  try {
3048
- const h = await d.browser.newContext({
3054
+ const p = await d.browser.newContext({
3049
3055
  isMobile: i,
3050
3056
  hasTouch: c,
3051
3057
  viewport: l
3052
3058
  }), g = {
3053
3059
  browserInfo: d,
3054
3060
  name: e,
3055
- context: h,
3061
+ context: p,
3056
3062
  pages: /* @__PURE__ */ new Map()
3057
3063
  };
3058
3064
  return d.contexts.set(e, g), {
@@ -3060,9 +3066,9 @@ async function Dt(t, r, s) {
3060
3066
  browserInfo: d,
3061
3067
  contextInfo: g
3062
3068
  };
3063
- } catch (h) {
3069
+ } catch (p) {
3064
3070
  return {
3065
- error: `Failed to create context: ${h instanceof Error ? h.message : "Unknown error"} in browser "${d.name}" (${d.browserType})`
3071
+ error: `Failed to create context: ${p instanceof Error ? p.message : "Unknown error"} in browser "${d.name}" (${d.browserType})`
3066
3072
  };
3067
3073
  }
3068
3074
  }
@@ -3086,8 +3092,8 @@ function Rs(t, r) {
3086
3092
  }
3087
3093
  );
3088
3094
  }
3089
- const Rt = p.object({
3090
- browserName: p.string().optional().describe(
3095
+ const Rt = h.object({
3096
+ browserName: h.string().optional().describe(
3091
3097
  "Name of browser to list contexts from. If not specified, lists contexts from all browsers"
3092
3098
  )
3093
3099
  });
@@ -3150,11 +3156,11 @@ function Bs(t, r) {
3150
3156
  }
3151
3157
  );
3152
3158
  }
3153
- const Ft = p.object({
3154
- names: p.array(p.string()).optional().describe(
3159
+ const Ft = h.object({
3160
+ names: h.array(h.string()).optional().describe(
3155
3161
  "Names of contexts to close. If not specified, closes all contexts"
3156
3162
  ),
3157
- browserName: p.string().optional().describe(
3163
+ browserName: h.string().optional().describe(
3158
3164
  "Name of browser to close contexts from. If not specified, searches all browsers"
3159
3165
  )
3160
3166
  });
@@ -3264,32 +3270,32 @@ function As() {
3264
3270
  function r(i, c, l) {
3265
3271
  let u = null;
3266
3272
  for (let f = 0, d = c.length; f < d; f++) {
3267
- const h = c[f], g = i(h), m = g == null ? null : r(i, g, l), y = l(h, m);
3273
+ const p = c[f], g = i(p), m = g == null ? null : r(i, g, l), y = l(p, m);
3268
3274
  y != null && (u == null && (u = []), u.push(y));
3269
3275
  }
3270
3276
  return u;
3271
3277
  }
3272
3278
  function s(i) {
3273
- const { getId: c, getChilds: l, rootNodes: u, createSnapshotNode: f } = i, d = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map(), m = r(
3279
+ const { getId: c, getChilds: l, rootNodes: u, createSnapshotNode: f } = i, d = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map(), m = r(
3274
3280
  l,
3275
3281
  u,
3276
3282
  (w, I) => {
3277
- const v = f(w, I);
3278
- if (w != null && v != null) {
3283
+ const N = f(w, I);
3284
+ if (w != null && N != null) {
3279
3285
  const b = c(w);
3280
- d.set(b, v), h.set(v, b);
3286
+ d.set(b, N), p.set(N, b);
3281
3287
  }
3282
- return v != null && I != null && g.set(
3283
- h.get(v),
3284
- I.map((b) => h.get(b))
3285
- ), v;
3288
+ return N != null && I != null && g.set(
3289
+ p.get(N),
3290
+ I.map((b) => p.get(b))
3291
+ ), N;
3286
3292
  }
3287
3293
  ), y = f(null, m);
3288
3294
  if (y == null)
3289
3295
  throw new Error("Impossible behavior: rootNode == null");
3290
3296
  return d.set(null, y), m != null && g.set(
3291
3297
  null,
3292
- m.map((w) => h.get(w))
3298
+ m.map((w) => p.get(w))
3293
3299
  ), {
3294
3300
  idToNode: d,
3295
3301
  idToChildIds: g
@@ -3299,16 +3305,16 @@ function As() {
3299
3305
  function e(i) {
3300
3306
  return function(l, u) {
3301
3307
  const f = u != null && u.length > 0;
3302
- let d = !1, h = null, g = null;
3308
+ let d = !1, p = null, g = null;
3303
3309
  if (l instanceof HTMLElement) {
3304
- if (h = n.getOrCreateId(l), g = l.tagName.toLowerCase(), d = l.matches(i.cssSelector), !d && !f)
3310
+ if (p = n.getOrCreateId(l), g = l.tagName.toLowerCase(), d = l.matches(i.cssSelector), !d && !f)
3305
3311
  return null;
3306
3312
  } else if (l == null)
3307
- h = null, g = null, d = !1;
3313
+ p = null, g = null, d = !1;
3308
3314
  else
3309
3315
  return null;
3310
3316
  return {
3311
- uid: h,
3317
+ uid: p,
3312
3318
  tagName: g,
3313
3319
  isMatched: d
3314
3320
  };
@@ -3326,12 +3332,12 @@ function As() {
3326
3332
  }
3327
3333
  window.__mcp_playwright_tool_tx4byhar35_createDomSnapshotTreeRawDom = a;
3328
3334
  }
3329
- const zs = `(function (){function __name(fn){return fn};${As.toString()}; setupPageGlobals();})()`, Ie = p.object({
3330
- contextName: p.string().optional().describe("Name of previously created context, to use"),
3335
+ const zs = `(function (){function __name(fn){return fn};${As.toString()}; setupPageGlobals();})()`, Ie = h.object({
3336
+ contextName: h.string().optional().describe("Name of previously created context, to use"),
3331
3337
  context: $e.optional().describe(
3332
3338
  "Context creation options JSON to automatically create context"
3333
3339
  ),
3334
- name: p.string().describe(
3340
+ name: h.string().describe(
3335
3341
  "Unique name for the page. Recommended format: kebab-case-1, kebab-case-2, ..."
3336
3342
  )
3337
3343
  });
@@ -3417,11 +3423,11 @@ function Us(t, r) {
3417
3423
  }
3418
3424
  );
3419
3425
  }
3420
- const Lt = p.object({
3421
- contextName: p.string().optional().describe(
3426
+ const Lt = h.object({
3427
+ contextName: h.string().optional().describe(
3422
3428
  "Name of context to list pages from. If not specified, lists pages from all contexts"
3423
3429
  ),
3424
- browserName: p.string().optional().describe(
3430
+ browserName: h.string().optional().describe(
3425
3431
  "Name of browser to search in. If not specified, searches all browsers"
3426
3432
  )
3427
3433
  });
@@ -3489,7 +3495,7 @@ async function qs(t, r, s) {
3489
3495
  pagesByContext: i
3490
3496
  };
3491
3497
  }
3492
- function _s(t, r) {
3498
+ function Gs(t, r) {
3493
3499
  t(
3494
3500
  "playwright-page-list",
3495
3501
  {
@@ -3511,16 +3517,16 @@ function _s(t, r) {
3511
3517
  }
3512
3518
  );
3513
3519
  }
3514
- const Pt = p.object({
3515
- names: p.array(p.string()).optional().describe("Names of pages to close. If not specified, closes all pages"),
3516
- contextName: p.string().optional().describe(
3520
+ const Pt = h.object({
3521
+ names: h.array(h.string()).optional().describe("Names of pages to close. If not specified, closes all pages"),
3522
+ contextName: h.string().optional().describe(
3517
3523
  "Name of context to close pages from. If not specified, searches all contexts"
3518
3524
  ),
3519
- browserName: p.string().optional().describe(
3525
+ browserName: h.string().optional().describe(
3520
3526
  "Name of browser to search in. If not specified, searches all browsers"
3521
3527
  )
3522
3528
  });
3523
- async function Gs(t, r, s) {
3529
+ async function _s(t, r, s) {
3524
3530
  let o;
3525
3531
  try {
3526
3532
  o = Pt.parse(t);
@@ -3548,37 +3554,37 @@ async function Gs(t, r, s) {
3548
3554
  return {
3549
3555
  error: `Context "${n}" not found in browser "${f.name}" (${f.browserType})`
3550
3556
  };
3551
- e ? e.forEach((h) => {
3552
- const g = d.pages.get(h);
3557
+ e ? e.forEach((p) => {
3558
+ const g = d.pages.get(p);
3553
3559
  g ? u.push(g) : l.push(
3554
- `Page "${h}" not found in context "${d.name}" in browser "${f.name}" (${f.browserType})`
3560
+ `Page "${p}" not found in context "${d.name}" in browser "${f.name}" (${f.browserType})`
3555
3561
  );
3556
3562
  }) : u = Array.from(d.pages.values());
3557
3563
  } else
3558
3564
  for (const d of f.contexts.values())
3559
- e ? e.forEach((h) => {
3560
- const g = d.pages.get(h);
3565
+ e ? e.forEach((p) => {
3566
+ const g = d.pages.get(p);
3561
3567
  g ? u.push(g) : l.push(
3562
- `Page "${h}" not found in context "${d.name}" in browser "${f.name}" (${f.browserType})`
3568
+ `Page "${p}" not found in context "${d.name}" in browser "${f.name}" (${f.browserType})`
3563
3569
  );
3564
3570
  }) : u.push(...Array.from(d.pages.values()));
3565
3571
  } else if (n)
3566
3572
  for (const f of i.browsers.values()) {
3567
3573
  const d = f.contexts.get(n);
3568
- d && (e ? e.forEach((h) => {
3569
- const g = d.pages.get(h);
3574
+ d && (e ? e.forEach((p) => {
3575
+ const g = d.pages.get(p);
3570
3576
  g ? u.push(g) : l.push(
3571
- `Page "${h}" not found in context "${d.name}" in browser "${f.name}" (${f.browserType})`
3577
+ `Page "${p}" not found in context "${d.name}" in browser "${f.name}" (${f.browserType})`
3572
3578
  );
3573
3579
  }) : u.push(...Array.from(d.pages.values())));
3574
3580
  }
3575
3581
  else
3576
3582
  for (const f of i.browsers.values())
3577
3583
  for (const d of f.contexts.values())
3578
- e ? e.forEach((h) => {
3579
- const g = d.pages.get(h);
3584
+ e ? e.forEach((p) => {
3585
+ const g = d.pages.get(p);
3580
3586
  g ? u.push(g) : l.push(
3581
- `Page "${h}" not found in context "${d.name}" in browser "${f.name}" (${f.browserType})`
3587
+ `Page "${p}" not found in context "${d.name}" in browser "${f.name}" (${f.browserType})`
3582
3588
  );
3583
3589
  }) : u.push(...Array.from(d.pages.values()));
3584
3590
  return await Promise.all(
@@ -3607,7 +3613,7 @@ function Js(t, r) {
3607
3613
  inputSchema: Pt.shape
3608
3614
  },
3609
3615
  async (s, o) => {
3610
- const e = await Gs(s, r, o);
3616
+ const e = await _s(s, r, o);
3611
3617
  if ("error" in e)
3612
3618
  return `Method: playwright-page-close(${JSON.stringify(s)})
3613
3619
  ❌ Error: ${e.error}`;
@@ -3618,14 +3624,14 @@ ${n.join(`
3618
3624
  }
3619
3625
  );
3620
3626
  }
3621
- const At = p.object({
3622
- pageName: p.string().optional().describe("Name of previously created page to navigate"),
3627
+ const At = h.object({
3628
+ pageName: h.string().optional().describe("Name of previously created page to navigate"),
3623
3629
  page: Ie.optional().describe(
3624
3630
  "Page creation options JSON to automatically create page"
3625
3631
  ),
3626
- url: p.string().describe("URL to navigate to"),
3627
- timeout: p.number().describe("Timeout in seconds"),
3628
- waitUntil: p.enum(["load", "domcontentloaded", "networkidle", "commit"]).describe(
3632
+ url: h.string().describe("URL to navigate to"),
3633
+ timeout: h.number().describe("Timeout in seconds"),
3634
+ waitUntil: h.enum(["load", "domcontentloaded", "networkidle", "commit"]).describe(
3629
3635
  `Wait until event:
3630
3636
  - 'domcontentloaded': DOMContentLoaded event is fired
3631
3637
  - 'load': load event is fired
@@ -3652,17 +3658,17 @@ async function js(t, r, s) {
3652
3658
  return {
3653
3659
  error: "Either pageName or page must be provided, not both"
3654
3660
  };
3655
- let u = !1, f = !1, d = !1, h;
3661
+ let u = !1, f = !1, d = !1, p;
3656
3662
  if (e) {
3657
3663
  for (const g of l.browsers.values()) {
3658
3664
  for (const m of g.contexts.values())
3659
3665
  if (m.pages.has(e)) {
3660
- h = m.pages.get(e);
3666
+ p = m.pages.get(e);
3661
3667
  break;
3662
3668
  }
3663
- if (h) break;
3669
+ if (p) break;
3664
3670
  }
3665
- if (!h)
3671
+ if (!p)
3666
3672
  return {
3667
3673
  error: `Page "${e}" not found`
3668
3674
  };
@@ -3672,13 +3678,13 @@ async function js(t, r, s) {
3672
3678
  return {
3673
3679
  error: g.error
3674
3680
  };
3675
- h = g.pageInfo, u = g.browserInfoCreated, f = g.contextInfoCreated, d = !0;
3681
+ p = g.pageInfo, u = g.browserInfoCreated, f = g.contextInfoCreated, d = !0;
3676
3682
  } else
3677
3683
  return {
3678
3684
  error: "Either pageName or page must be provided"
3679
3685
  };
3680
3686
  try {
3681
- const g = await h.page.goto(a, {
3687
+ const g = await p.page.goto(a, {
3682
3688
  timeout: i * 1e3,
3683
3689
  waitUntil: c
3684
3690
  });
@@ -3686,13 +3692,13 @@ async function js(t, r, s) {
3686
3692
  browserInfoCreated: u,
3687
3693
  contextInfoCreated: f,
3688
3694
  pageInfoCreated: d,
3689
- pageInfo: h,
3695
+ pageInfo: p,
3690
3696
  status: g.status()
3691
3697
  } : {
3692
3698
  browserInfoCreated: u,
3693
3699
  contextInfoCreated: f,
3694
3700
  pageInfoCreated: d,
3695
- pageInfo: h,
3701
+ pageInfo: p,
3696
3702
  status: 200
3697
3703
  };
3698
3704
  } catch (g) {
@@ -3723,11 +3729,11 @@ function Ks(t, r) {
3723
3729
  }
3724
3730
  );
3725
3731
  }
3726
- const Me = p.object({
3727
- name: p.string().describe(
3732
+ const Me = h.object({
3733
+ name: h.string().describe(
3728
3734
  "Unique name for the DOM snapshot query. Recommended format: kebab-case-1, kebab-case-2, ..."
3729
3735
  ),
3730
- cssSelector: p.string().describe("CSS selector to capture page content")
3736
+ cssSelector: h.string().describe("CSS selector to capture page content")
3731
3737
  });
3732
3738
  async function zt(t, r, s) {
3733
3739
  let o;
@@ -3788,15 +3794,15 @@ function Hs(t) {
3788
3794
  textOpen: `<root uid:${u}>`,
3789
3795
  textClose: "</root>"
3790
3796
  };
3791
- const h = bt(d);
3792
- return l += h, {
3797
+ const p = bt(d);
3798
+ return l += p, {
3793
3799
  uid: u,
3794
3800
  tagName: f,
3795
3801
  isMatched: e,
3796
3802
  countMatched: n,
3797
3803
  countChilds: a,
3798
3804
  countTotal: i,
3799
- tokens: h,
3805
+ tokens: p,
3800
3806
  tokensChilds: c,
3801
3807
  tokensTotal: l,
3802
3808
  text: d
@@ -3819,13 +3825,13 @@ function Qs(t, r) {
3819
3825
  });
3820
3826
  return le(e);
3821
3827
  }
3822
- const Te = p.object({
3823
- pageName: p.string().describe("Name of previously created page, to create snapshot from"),
3824
- queryName: p.string().optional().describe("Name of previously created DOM snapshot query, to use"),
3828
+ const Te = h.object({
3829
+ pageName: h.string().describe("Name of previously created page, to create snapshot from"),
3830
+ queryName: h.string().optional().describe("Name of previously created DOM snapshot query, to use"),
3825
3831
  query: Me.optional().describe(
3826
3832
  "DOM snapshot query creation options JSON to automatically create query"
3827
3833
  ),
3828
- name: p.string().describe(
3834
+ name: h.string().describe(
3829
3835
  "Unique name for the DOM snapshot. Recommended format: kebab-case-1, kebab-case-2, ..."
3830
3836
  )
3831
3837
  });
@@ -3846,9 +3852,9 @@ async function Ut(t, r, s) {
3846
3852
  const c = j(s.sessionId);
3847
3853
  let l;
3848
3854
  for (const d of c.browsers.values()) {
3849
- for (const h of d.contexts.values())
3850
- if (h.pages.has(e)) {
3851
- l = h.pages.get(e);
3855
+ for (const p of d.contexts.values())
3856
+ if (p.pages.has(e)) {
3857
+ l = p.pages.get(e);
3852
3858
  break;
3853
3859
  }
3854
3860
  if (l) break;
@@ -3897,10 +3903,10 @@ async function Ut(t, r, s) {
3897
3903
  };
3898
3904
  },
3899
3905
  u
3900
- ), h = {
3906
+ ), p = {
3901
3907
  idToNode: new Map(d.idToNode),
3902
3908
  idToChildIds: new Map(d.idToChildIds)
3903
- }, g = Qs(u, h), m = {
3909
+ }, g = Qs(u, p), m = {
3904
3910
  name: i,
3905
3911
  query: u,
3906
3912
  tree: g
@@ -3949,13 +3955,13 @@ class Vs {
3949
3955
  tokensGrouped: s.tokens
3950
3956
  } : (r.indexRange[1] = o, r.countGrouped += 1, r.countMatched += s.countMatched, r.tokensGrouped += s.tokens, r);
3951
3957
  }
3952
- const qt = p.object({
3953
- snapshotName: p.string().optional().describe("Name of previously created DOM snapshot, to use"),
3958
+ const qt = h.object({
3959
+ snapshotName: h.string().optional().describe("Name of previously created DOM snapshot, to use"),
3954
3960
  snapshot: Te.optional().describe(
3955
3961
  "DOM snapshot creation options JSON to automatically create snapshot"
3956
3962
  ),
3957
- parentUid: p.number().optional().describe("UID of parent node to browse. Omit to browse the root node"),
3958
- childsIndexRange: p.tuple([p.number(), p.number()]).optional().describe(
3963
+ parentUid: h.number().optional().describe("UID of parent node to browse. Omit to browse the root node"),
3964
+ childsIndexRange: h.tuple([h.number(), h.number()]).optional().describe(
3959
3965
  "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"
3960
3966
  )
3961
3967
  // maxCountTotal: z
@@ -3996,7 +4002,7 @@ async function Zs(t, r, s) {
3996
4002
  return {
3997
4003
  error: "Either snapshotName or snapshot must be provided, not both"
3998
4004
  };
3999
- let d, h = !1, g = !1;
4005
+ let d, p = !1, g = !1;
4000
4006
  if (e) {
4001
4007
  for (const m of f.browsers.values()) {
4002
4008
  for (const y of m.contexts.values()) {
@@ -4023,7 +4029,7 @@ async function Zs(t, r, s) {
4023
4029
  return {
4024
4030
  error: m.error
4025
4031
  };
4026
- d = m.domSnapshot, h = m.queryCreated, g = !0;
4032
+ d = m.domSnapshot, p = m.queryCreated, g = !0;
4027
4033
  } else
4028
4034
  return {
4029
4035
  error: "Either snapshotName or snapshot must be provided"
@@ -4045,7 +4051,7 @@ async function Zs(t, r, s) {
4045
4051
  }), w = xt(y);
4046
4052
  return {
4047
4053
  domSnapshot: d,
4048
- queryCreated: h,
4054
+ queryCreated: p,
4049
4055
  snapshotCreated: g,
4050
4056
  parentUid: m,
4051
4057
  childsIndexRange: a,
@@ -4088,7 +4094,7 @@ ${e.report}`, n;
4088
4094
  );
4089
4095
  }
4090
4096
  function eo(t, r) {
4091
- r.browserCreate && vs(t, r), r.browserList && ks(t, r), r.browserClose && Ds(t, r), r.contextCreate && Rs(t, r), r.contextList && Bs(t, r), r.contextClose && Ps(t, r), r.pageCreate && Us(t, r), r.pageList && _s(t, r), r.pageClose && Js(t, r), r.pageGoto && Ks(t, r), r.domSnapshotQueryCreate && Ws(t, r), r.domSnapshotCreate && Ys(t, r), r.domSnapshotBrowse && Xs(t, r), console.log("Playwright manager");
4097
+ r.browserCreate && Ns(t, r), r.browserList && ks(t, r), r.browserClose && Ds(t, r), r.contextCreate && Rs(t, r), r.contextList && Bs(t, r), r.contextClose && Ps(t, r), r.pageCreate && Us(t, r), r.pageList && Gs(t, r), r.pageClose && Js(t, r), r.pageGoto && Ks(t, r), r.domSnapshotQueryCreate && Ws(t, r), r.domSnapshotCreate && Ys(t, r), r.domSnapshotBrowse && Xs(t, r), console.log("Playwright manager");
4092
4098
  }
4093
4099
  function to(t) {
4094
4100
  const { logFilePath: r } = t;
@@ -4112,7 +4118,7 @@ function to(t) {
4112
4118
  });
4113
4119
  };
4114
4120
  }
4115
- function _t() {
4121
+ function Gt() {
4116
4122
  return `mcp_${(/* @__PURE__ */ new Date()).toISOString().substring(0, 19).replace(/T/, "_").replace(/:/g, "-")}.log`;
4117
4123
  }
4118
4124
  function ro(t) {
@@ -4163,19 +4169,19 @@ SSE Endpoint: ${a}/sse
4163
4169
  Log File: ${R.resolve(r.logFilePath)}`;
4164
4170
  }
4165
4171
  function ao(t, r) {
4166
- const s = R.join(r.logDir, _t()), o = Or(t, {
4172
+ const s = R.join(r.logDir, Gt()), o = Or(t, {
4167
4173
  logFilePath: s
4168
4174
  });
4169
- r.tools.processManager && kr(o, r.tools.processManager), r.tools.fsManager && Ns(o, r.tools.fsManager), r.tools.playwrightManager && eo(o, {
4175
+ r.tools.processManager && kr(o, r.tools.processManager), r.tools.fsManager && vs(o, r.tools.fsManager), r.tools.playwrightManager && eo(o, {
4170
4176
  ...r.tools.playwrightManager
4171
4177
  }), xr(o);
4172
4178
  }
4173
4179
  async function Co(t) {
4174
- const r = R.join(t.logDir, _t()), s = ro(), o = oo({
4180
+ const r = R.join(t.logDir, Gt()), s = ro(), o = oo({
4175
4181
  ...t,
4176
4182
  logFilePath: r,
4177
4183
  createMcpServer: () => {
4178
- const n = new Gt({
4184
+ const n = new _t({
4179
4185
  title: t.title,
4180
4186
  name: t.name,
4181
4187
  version: t.version
@@ -4203,6 +4209,6 @@ export {
4203
4209
  Mo as S,
4204
4210
  Io as a,
4205
4211
  $o as b,
4206
- Gr as p,
4212
+ _r as p,
4207
4213
  Co as s
4208
4214
  };