@flemist/mcp-project-tools 3.0.15 → 3.0.17

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,19 +1,19 @@
1
- import oe from "express";
1
+ import ne from "express";
2
2
  import { McpServer as _t } from "@modelcontextprotocol/sdk/server/mcp.js";
3
- import { randomUUID as Gt } from "crypto";
3
+ import { randomUUID as Jt } from "crypto";
4
4
  import * as W from "fs";
5
5
  import * as R from "path";
6
- import { StreamableHTTPServerTransport as Jt } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
7
- import { spawn as jt } from "child_process";
8
- import { z as p } from "zod";
6
+ import { StreamableHTTPServerTransport as jt } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
7
+ import { spawn as Kt } from "child_process";
8
+ import { z as h } from "zod";
9
9
  import he from "tree-kill";
10
- import { Pool as Kt, poolRunWait as Y } from "@flemist/time-limits";
11
- import { priorityCreate as V } from "@flemist/priority-queue";
12
- import { useAbortController as Wt, combineAbortSignals as Ht, Locker as Qt } from "@flemist/async-utils";
13
- import Yt from "node:os";
14
- import Vt from "picomatch";
15
- import { webkit as Zt, firefox as Xt, chromium as er } from "playwright";
16
- function tr(t) {
10
+ import { Pool as Wt, poolRunWait as V } from "@flemist/time-limits";
11
+ import { priorityCreate as Z } from "@flemist/priority-queue";
12
+ import { useAbortController as Ht, combineAbortSignals as Qt, Locker as Yt } from "@flemist/async-utils";
13
+ import Vt from "node:os";
14
+ import Zt from "picomatch";
15
+ import { webkit as Xt, firefox as er, chromium as tr } from "playwright";
16
+ function rr(t) {
17
17
  const { authToken: r } = t;
18
18
  return function(o, e, n) {
19
19
  if ((o.query.token || o.headers.authorization?.replace("Bearer ", "")) !== r) {
@@ -23,7 +23,7 @@ function tr(t) {
23
23
  n();
24
24
  };
25
25
  }
26
- async function ne(t) {
26
+ async function ie(t) {
27
27
  const { logFilePath: r, message: s, data: o } = t;
28
28
  try {
29
29
  const e = (/* @__PURE__ */ new Date()).toISOString().replace(/[TZ]/g, " ").trim(), n = typeof o == "string" ? o : JSON.stringify(o, null, 2), a = `[${e}] ${s}
@@ -35,21 +35,21 @@ ${n}
35
35
  console.error(`Failed to log "${s}":`, e);
36
36
  }
37
37
  }
38
- const ie = /* @__PURE__ */ new Map();
39
- function rr(t) {
38
+ const ae = /* @__PURE__ */ new Map();
39
+ function sr(t) {
40
40
  return t.headers["mcp-session-id"] || t.headers["x-session-id"] || t.query.token;
41
41
  }
42
- async function sr(t, r) {
43
- const s = t.createMcpServer(), o = new Jt({
44
- sessionIdGenerator: () => r || Gt(),
42
+ async function or(t, r) {
43
+ const s = t.createMcpServer(), o = new jt({
44
+ sessionIdGenerator: () => r || Jt(),
45
45
  onsessioninitialized: (n) => {
46
- ie.set(n, o);
46
+ ae.set(n, o);
47
47
  },
48
48
  enableJsonResponse: !0
49
49
  });
50
50
  async function e() {
51
51
  const n = o.sessionId;
52
- n && ie.delete(n);
52
+ n && ae.delete(n);
53
53
  try {
54
54
  await s.close();
55
55
  } catch (a) {
@@ -63,28 +63,28 @@ async function sr(t, r) {
63
63
  throw await e(), n;
64
64
  }
65
65
  }
66
- async function or(t, r, s, o) {
67
- await ne({
66
+ async function nr(t, r, s, o) {
67
+ await ie({
68
68
  logFilePath: s.logFilePath,
69
69
  message: "REQUEST",
70
70
  data: t.body
71
71
  });
72
- let e = o ? ie.get(o) : null;
73
- e || (e = await sr(s, o)), await e.handleRequest(t, r, t.body);
72
+ let e = o ? ae.get(o) : null;
73
+ e || (e = await or(s, o)), await e.handleRequest(t, r, t.body);
74
74
  }
75
- async function nr(t, r, s) {
76
- const o = s ? ie.get(s) : null;
75
+ async function ir(t, r, s) {
76
+ const o = s ? ae.get(s) : null;
77
77
  if (!o) {
78
78
  r.status(400).json({ error: "No valid session found" });
79
79
  return;
80
80
  }
81
81
  await o.handleRequest(t, r);
82
82
  }
83
- function ir(t) {
83
+ function ar(t) {
84
84
  return async function(s, o) {
85
85
  try {
86
- const e = rr(s);
87
- s.method === "POST" ? await or(s, o, t, e) : s.method === "GET" ? await nr(s, o, e) : o.status(405).json({ error: "Method not allowed" });
86
+ const e = sr(s);
87
+ s.method === "POST" ? await nr(s, o, t, e) : s.method === "GET" ? await ir(s, o, e) : o.status(405).json({ error: "Method not allowed" });
88
88
  } catch (e) {
89
89
  console.error("Unhandled error in streamableHttpHandler", e), o.status(500).json({
90
90
  error: "Internal server error: " + (e instanceof Error ? e.message : "Unknown error")
@@ -92,10 +92,10 @@ function ir(t) {
92
92
  }
93
93
  };
94
94
  }
95
- const Q = /* @__PURE__ */ new Map();
96
- let ar = 0;
97
- const Te = 10, lr = 1800 * 1e3, B = 1e4, cr = 5e3;
98
- function ur(t) {
95
+ const Y = /* @__PURE__ */ new Map();
96
+ let lr = 0;
97
+ const Ce = 10, cr = 1800 * 1e3, J = 1e4, Q = 2e3, ur = 5e3;
98
+ function dr(t) {
99
99
  const { commandLine: r, commandLineRules: s } = t;
100
100
  let o = !1;
101
101
  for (const e of s)
@@ -112,17 +112,17 @@ function ur(t) {
112
112
  }
113
113
  return o;
114
114
  }
115
- function dr() {
116
- return ++ar;
117
- }
118
- let Ce = !1;
119
115
  function fr() {
120
- if (Ce)
116
+ return ++lr;
117
+ }
118
+ let ve = !1;
119
+ function pr() {
120
+ if (ve)
121
121
  return;
122
- Ce = !0;
122
+ ve = !0;
123
123
  const t = () => {
124
124
  console.log("Auto-killing all child processes...");
125
- for (const [r, s] of Array.from(Q.entries()))
125
+ for (const [r, s] of Array.from(Y.entries()))
126
126
  if (s.isRunning && s.pid)
127
127
  try {
128
128
  he(s.pid, "SIGKILL");
@@ -133,44 +133,44 @@ function fr() {
133
133
  };
134
134
  process.on("SIGINT", t), process.on("SIGTERM", t);
135
135
  }
136
- function me() {
136
+ function ge() {
137
137
  const t = Date.now(), r = [];
138
- for (const [s, o] of Array.from(Q.entries()))
139
- !o.isRunning && o.endTime && t - o.endTime.getTime() > lr && r.push(s);
138
+ for (const [s, o] of Array.from(Y.entries()))
139
+ !o.isRunning && o.endTime && t - o.endTime.getTime() > cr && r.push(s);
140
140
  for (const s of r)
141
- Q.delete(s);
141
+ Y.delete(s);
142
142
  }
143
143
  const hr = 1800 * 1e3, Ne = /* @__PURE__ */ new Map();
144
- let pr = 0;
145
- function mr() {
146
- return ++pr;
144
+ let mr = 0;
145
+ function gr() {
146
+ return ++mr;
147
147
  }
148
- function Ze(t) {
148
+ function Xe(t) {
149
149
  let r = Ne.get(t);
150
150
  return r == null && (r = {
151
151
  storedOutputs: /* @__PURE__ */ new Map()
152
152
  }, Ne.set(t, r)), r;
153
153
  }
154
- function Xe(t) {
154
+ function et(t) {
155
155
  return typeof t == "function" ? t() : t;
156
156
  }
157
- function et(t, r) {
157
+ function tt(t, r) {
158
158
  return setTimeout(() => {
159
159
  t.storedOutputs.delete(r);
160
160
  }, hr);
161
161
  }
162
- function gr(t, r, s) {
163
- clearTimeout(s.cleanupTimer), s.cleanupTimer = et(t, r);
162
+ function wr(t, r, s) {
163
+ clearTimeout(s.cleanupTimer), s.cleanupTimer = tt(t, r);
164
164
  }
165
- function wr(t) {
166
- const { sessionId: r, source: s } = t, o = Ze(r), e = mr(), n = {
165
+ function yr(t) {
166
+ const { sessionId: r, source: s } = t, o = Xe(r), e = gr(), n = {
167
167
  source: s,
168
- cleanupTimer: et(o, e)
168
+ cleanupTimer: tt(o, e)
169
169
  };
170
170
  return o.storedOutputs.set(e, n), e;
171
171
  }
172
- function tt(t) {
173
- const { sessionId: r, outputId: s, range: o } = t, [e, n] = o, a = Ze(r), i = a.storedOutputs.get(s);
172
+ function rt(t) {
173
+ const { sessionId: r, outputId: s, range: o } = t, [e, n] = o, a = Xe(r), i = a.storedOutputs.get(s);
174
174
  if (i == null)
175
175
  return {
176
176
  content: "",
@@ -178,15 +178,15 @@ function tt(t) {
178
178
  range: [0, 0],
179
179
  error: `Stored output with outputId=${s} not found or expired`
180
180
  };
181
- gr(a, s, i);
182
- const c = Xe(i.source), l = c.length, u = Math.min(Math.max(e, 0), l), f = Math.min(Math.max(n, 0), l);
181
+ wr(a, s, i);
182
+ const c = et(i.source), l = c.length, u = Math.min(Math.max(e, 0), l), f = Math.min(Math.max(n, 0), l);
183
183
  return { content: c.substring(u, f), total: l, range: [u, f] };
184
184
  }
185
- function ge(t) {
186
- const { sessionId: r, source: s, limit: o } = t, e = Xe(s);
185
+ function we(t) {
186
+ const { sessionId: r, source: s, limit: o } = t, e = et(s);
187
187
  if (e.length <= o)
188
188
  return { content: e, outputId: null };
189
- const n = wr({ sessionId: r, source: s }), a = tt({
189
+ const n = yr({ sessionId: r, source: s }), a = rt({
190
190
  sessionId: r,
191
191
  outputId: n,
192
192
  range: [0, o]
@@ -202,16 +202,16 @@ function F(t) {
202
202
 
203
203
  Provide valid parameters according to schema.`;
204
204
  }
205
- const rt = 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(
208
- `Character range [from, to) to retrieve. Maximum range size: ${B}.`
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
+ `Character range [from, to) to retrieve. Maximum range size: ${J}.`
209
209
  )
210
210
  });
211
- function yr(t, r) {
211
+ function br(t, r) {
212
212
  let s;
213
213
  try {
214
- s = rt.parse(t);
214
+ s = st.parse(t);
215
215
  } catch (a) {
216
216
  return {
217
217
  error: F(a)
@@ -226,27 +226,27 @@ function yr(t, r) {
226
226
  return {
227
227
  error: `Invalid range: to (${e}) must be greater than from (${o})`
228
228
  };
229
- if (e - o > B)
229
+ if (e - o > J)
230
230
  return {
231
- error: `Range size ${e - o} exceeds maximum ${B}`
231
+ error: `Range size ${e - o} exceeds maximum ${J}`
232
232
  };
233
- const n = tt({
233
+ const n = rt({
234
234
  sessionId: r.sessionId,
235
235
  outputId: s.outputId,
236
236
  range: s.range
237
237
  });
238
238
  return n.error != null ? { error: n.error } : { content: n.content, total: n.total, range: n.range };
239
239
  }
240
- function br(t) {
240
+ function Sr(t) {
241
241
  t(
242
242
  "output-read",
243
243
  {
244
244
  title: "Read Stored Output Range",
245
245
  description: "Read any range from stored output. Use outputId from truncation message and specify character range [from, to).",
246
- inputSchema: rt.shape
246
+ inputSchema: st.shape
247
247
  },
248
248
  async (r, s) => {
249
- const o = yr(r, s);
249
+ const o = br(r, s);
250
250
  if (o.error != null)
251
251
  return `Method: output-read(${JSON.stringify(r)})
252
252
  ❌ Error: ${o.error}`;
@@ -260,28 +260,28 @@ ${o.content}`, i;
260
260
  }
261
261
  );
262
262
  }
263
- function Sr(t) {
264
- br(t);
263
+ function xr(t) {
264
+ Sr(t);
265
265
  }
266
- const st = 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(B).default(B).describe(
271
- `Maximum output characters to return. Truncated output can be retrieved via output-read tool using outputId from truncation message. Maximum: ${B}. Default: ${B}`
270
+ outputLimit: h.number().int().min(0).max(J).default(Q).describe(
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
  });
274
- async function we(t, r, s) {
275
- me();
274
+ async function ye(t, r, s) {
275
+ ge();
276
276
  let o;
277
277
  try {
278
- o = st.parse(t);
278
+ o = ot.parse(t);
279
279
  } catch (c) {
280
280
  return {
281
281
  error: F(c)
282
282
  };
283
283
  }
284
- const { id: e, outputLimit: n } = o, a = Q.get(e);
284
+ const { id: e, outputLimit: n } = o, a = Y.get(e);
285
285
  if (!a)
286
286
  return {
287
287
  error: `Process ${e} not found. The process may have already completed and been cleaned up after 30 minutes, or the ID may be incorrect. Use process-list to see available processes and their current status.`
@@ -290,7 +290,7 @@ async function we(t, r, s) {
290
290
  return {
291
291
  error: "Session ID is required"
292
292
  };
293
- const i = ge({
293
+ const i = we({
294
294
  sessionId: s.sessionId,
295
295
  source: () => a.output,
296
296
  limit: n
@@ -308,16 +308,16 @@ async function we(t, r, s) {
308
308
  error: a.error
309
309
  };
310
310
  }
311
- function xr(t, r) {
311
+ function $r(t, r) {
312
312
  t(
313
313
  "process-status",
314
314
  {
315
315
  title: "Get Host Machine Process Status",
316
316
  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",
317
- inputSchema: st.shape
317
+ inputSchema: ot.shape
318
318
  },
319
319
  async (s, o) => {
320
- const e = await we(s, r, o);
320
+ const e = await ye(s, r, o);
321
321
  if (!("output" in e))
322
322
  return `Method: process-status(${JSON.stringify(s)})
323
323
  ❌ Error: ${e.error}`;
@@ -330,39 +330,39 @@ ${n.trim()}`;
330
330
  }
331
331
  );
332
332
  }
333
- function ot(t) {
333
+ function nt(t) {
334
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
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
- }, cr);
340
+ }, ur);
341
341
  }
342
- const nt = 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(B).default(B).describe(
353
- `Maximum output characters to return. Truncated output can be retrieved via output-read tool using outputId from truncation message. Maximum: ${B}. Default: ${B}`
352
+ outputLimit: h.number().int().min(0).max(J).default(Q).describe(
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
  });
356
- async function it(t, r, s) {
356
+ async function at(t, r, s) {
357
357
  let o;
358
358
  try {
359
- o = nt.parse(t);
359
+ o = it.parse(t);
360
360
  } catch (g) {
361
361
  return {
362
362
  error: F(g)
363
363
  };
364
364
  }
365
- const { id: e, waitTime: n, autoKill: a, outputLimit: i } = o, c = Q.get(e);
365
+ const { id: e, waitTime: n, autoKill: a, outputLimit: i } = o, c = Y.get(e);
366
366
  if (!c)
367
367
  return {
368
368
  error: `Process ${e} not found. The process may have already completed and been cleaned up after 30 minutes, or the ID may be incorrect. Use process-list to see available processes and their current status.`
@@ -371,27 +371,27 @@ async function it(t, r, s) {
371
371
  let u = !1, f = !1;
372
372
  n != null && await new Promise((m) => {
373
373
  const y = setInterval(() => {
374
- c.isRunning ? Date.now() - l >= n * 1e3 && (clearInterval(y), u = !0, a && c.pid && (ot(c.pid), f = !0), m()) : (clearInterval(y), m());
374
+ c.isRunning ? Date.now() - l >= n * 1e3 && (clearInterval(y), u = !0, a && c.pid && (nt(c.pid), f = !0), m()) : (clearInterval(y), m());
375
375
  }, 100);
376
376
  });
377
377
  const d = (Date.now() - l) / 1e3;
378
378
  return {
379
- ...await we({ id: e, outputLimit: i }, r, s),
379
+ ...await ye({ id: e, outputLimit: i }, r, s),
380
380
  waitDuration: d,
381
381
  waitTimeExceeded: u,
382
382
  autoKillExecuted: f
383
383
  };
384
384
  }
385
- function $r(t, r) {
385
+ function Ir(t, r) {
386
386
  t(
387
387
  "process-wait",
388
388
  {
389
389
  title: "Wait for Host Machine Process",
390
390
  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",
391
- inputSchema: nt.shape
391
+ inputSchema: it.shape
392
392
  },
393
393
  async (s, o) => {
394
- const e = await it(s, r, o);
394
+ const e = await at(s, r, o);
395
395
  if (!("output" in e))
396
396
  return `Method: process-wait(${JSON.stringify(s)})
397
397
  ❌ Error: ${e.error}`;
@@ -404,53 +404,53 @@ ${n.trim()}`;
404
404
  }
405
405
  );
406
406
  }
407
- const at = 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(B).default(B).describe(
421
- `Maximum output characters to return. Truncated output can be retrieved via output-read tool using outputId from truncation message. Maximum: ${B}. Default: ${B}`
420
+ outputLimit: h.number().int().min(0).max(J).default(Q).describe(
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
  });
424
- async function Ir(t, r, s) {
425
- me();
424
+ async function Mr(t, r, s) {
425
+ ge();
426
426
  let o;
427
427
  try {
428
- o = at.parse(t);
429
- } catch (h) {
428
+ o = lt.parse(t);
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
- if (!ur({ commandLine: e, commandLineRules: c })) {
436
- const h = c.map(
435
+ if (!dr({ commandLine: e, commandLineRules: c })) {
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
- if (Array.from(Q.values()).filter(
448
- (h) => h.isRunning
449
- ).length >= Te)
447
+ if (Array.from(Y.values()).filter(
448
+ (p) => p.isRunning
449
+ ).length >= Ce)
450
450
  return {
451
- error: `Maximum concurrent process limit reached (${Te} processes). Cannot start new process until existing processes complete. Use process-list to see active processes, or process-kill to terminate unnecessary processes.`
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.`
452
452
  };
453
- const f = dr(), d = {
453
+ const f = fr(), d = {
454
454
  id: f,
455
455
  cwd: l,
456
456
  commandLine: e,
@@ -458,32 +458,32 @@ To use this command line, ask the user to modify the command line rules in the c
458
458
  isRunning: !0,
459
459
  output: ""
460
460
  };
461
- Q.set(f, d);
461
+ Y.set(f, d);
462
462
  try {
463
- const h = jt(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
- }), n != null ? it(
477
+ }), n != null ? at(
478
478
  { id: f, waitTime: n, autoKill: a, outputLimit: i },
479
479
  r,
480
480
  s
481
- ) : we({ 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 };
481
+ ) : ye({ id: f, outputLimit: i }, r, s);
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
- function Mr(t, r) {
486
+ function Tr(t, r) {
487
487
  const s = r.commandLineRules.map((o) => `${o.rule.toUpperCase()}: ${o.regexp} (${o.note})`).join(`
488
488
  `);
489
489
  t(
@@ -492,10 +492,10 @@ function Mr(t, r) {
492
492
  title: "Execute Command Line on Host Machine",
493
493
  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:
494
494
  ${s}`,
495
- inputSchema: at.shape
495
+ inputSchema: lt.shape
496
496
  },
497
497
  async (o, e) => {
498
- const n = await Ir(o, r, e);
498
+ const n = await Mr(o, r, e);
499
499
  if (!("output" in n))
500
500
  return `Method: process-run(${JSON.stringify(o)})
501
501
  ❌ Error: ${n.error}`;
@@ -508,32 +508,32 @@ ${a.trim()}`;
508
508
  }
509
509
  );
510
510
  }
511
- const lt = 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
  });
525
- async function Tr(t, r) {
526
- me();
525
+ async function Cr(t, r) {
526
+ ge();
527
527
  let s;
528
528
  try {
529
- s = lt.parse(t);
529
+ s = ct.parse(t);
530
530
  } catch (l) {
531
531
  return {
532
532
  error: F(l)
533
533
  };
534
534
  }
535
535
  const { minOpenDateTime: o, minCloseDateTime: e, activeOnly: n, fields: a } = s;
536
- let i = Array.from(Q.values());
536
+ let i = Array.from(Y.values());
537
537
  if (o) {
538
538
  const l = new Date(o.replace(/[_\s]/g, "T"));
539
539
  i = i.filter((u) => u.startTime >= l);
@@ -565,16 +565,16 @@ async function Tr(t, r) {
565
565
  return u;
566
566
  }) };
567
567
  }
568
- function Cr(t, r) {
568
+ function vr(t, r) {
569
569
  t(
570
570
  "process-list",
571
571
  {
572
572
  title: "List Host Machine Processes",
573
573
  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",
574
- inputSchema: lt.shape
574
+ inputSchema: ct.shape
575
575
  },
576
576
  async (s) => {
577
- const o = await Tr(s, r);
577
+ const o = await Cr(s, r);
578
578
  if (o.error != null)
579
579
  return `Method: process-list(${JSON.stringify(s)})
580
580
  ❌ Error: ${o.error}`;
@@ -588,21 +588,21 @@ ${e}`;
588
588
  }
589
589
  );
590
590
  }
591
- const ct = 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
596
  function Nr(t) {
597
597
  let r;
598
598
  try {
599
- r = ct.parse(t);
599
+ r = ut.parse(t);
600
600
  } catch (e) {
601
601
  return {
602
602
  error: F(e)
603
603
  };
604
604
  }
605
- const { id: s } = r, o = Q.get(s);
605
+ const { id: s } = r, o = Y.get(s);
606
606
  if (!o)
607
607
  return {
608
608
  error: `Process ${s} not found. The process may have already completed, been cleaned up after 30 minutes, or the ID may be incorrect. Use process-list to see available processes and their current status.`
@@ -616,20 +616,20 @@ function Nr(t) {
616
616
  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.`
617
617
  };
618
618
  try {
619
- return ot(o.pid), { success: !0, message: `Kill signal sent to process ${s}` };
619
+ return nt(o.pid), { success: !0, message: `Kill signal sent to process ${s}` };
620
620
  } catch (e) {
621
621
  return {
622
622
  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.`
623
623
  };
624
624
  }
625
625
  }
626
- function vr(t, r) {
626
+ function Er(t, r) {
627
627
  t(
628
628
  "process-kill",
629
629
  {
630
630
  title: "Kill Host Machine Process",
631
631
  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",
632
- inputSchema: ct.shape
632
+ inputSchema: ut.shape
633
633
  },
634
634
  async (s) => {
635
635
  const o = Nr(s);
@@ -639,8 +639,8 @@ ${JSON.stringify(o, null, 2)}`;
639
639
  }
640
640
  );
641
641
  }
642
- function Er(t, r) {
643
- fr(), r.run && Mr(t, r), r.status && xr(t, r), r.wait && $r(t, r), r.list && Cr(t, r), r.kill && vr(t);
642
+ function kr(t, r) {
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
  ) || [];
@@ -653,16 +653,16 @@ ${s.map((o) => `- ${o}`).join(`
653
653
  `
654
654
  );
655
655
  }
656
- function kr(t, r) {
656
+ function Or(t, r) {
657
657
  return function(o, e, n) {
658
658
  const a = async (...i) => {
659
- await ne({
659
+ await ie({
660
660
  logFilePath: r.logFilePath,
661
661
  message: "REQUEST",
662
662
  data: { name: o, args: i }
663
663
  });
664
664
  const c = await n(...i);
665
- return await ne({
665
+ return await ie({
666
666
  logFilePath: r.logFilePath,
667
667
  message: "RESPONSE",
668
668
  data: c
@@ -682,26 +682,26 @@ function kr(t, r) {
682
682
  );
683
683
  };
684
684
  }
685
- function Or(t) {
685
+ function Dr(t) {
686
686
  return t.match(/^[/\\]?[^/\\]+/)[0];
687
687
  }
688
- function Dr(t, r) {
689
- return Or(t) + "|" + r.ino;
688
+ function Rr(t, r) {
689
+ return Dr(t) + "|" + r.ino;
690
690
  }
691
- function Rr(t) {
691
+ function Fr(t) {
692
692
  return t.endsWith(":") && (t += "/"), R.resolve(t);
693
693
  }
694
- const ye = new Kt(Yt.cpus().length);
695
- function ve(t, r) {
694
+ const be = new Wt(Vt.cpus().length);
695
+ function Ee(t, r) {
696
696
  t.totalSize += r.totalSize, t.maxFileDateModified = Math.max(
697
697
  t.maxFileDateModified,
698
698
  r.maxFileDateModified
699
699
  ), t.countFiles += r.countFiles, t.countDirs += r.countDirs, t.countLinks += r.countLinks;
700
700
  }
701
- const Fr = function(r) {
701
+ const Br = function(r) {
702
702
  return r.code === "ENOENT";
703
703
  };
704
- function ut(t) {
704
+ function dt(t) {
705
705
  const r = t.paths;
706
706
  if (!r || r.length === 0)
707
707
  return Promise.resolve({
@@ -711,16 +711,16 @@ function ut(t) {
711
711
  countDirs: 0,
712
712
  countLinks: 0
713
713
  });
714
- const s = t.level ?? 0, o = t.walkedIds ?? /* @__PURE__ */ new Set(), e = t.abortSignal, n = t.pool ?? ye, a = t.handleError, i = t.priority ?? V(0), c = t.walkLinks ?? !1, l = t.log, u = t.handlePath, f = t.matchPath;
714
+ const s = t.level ?? 0, o = t.walkedIds ?? /* @__PURE__ */ new Set(), e = t.abortSignal, n = t.pool ?? be, a = t.handleError, i = t.priority ?? Z(0), c = t.walkLinks ?? !1, l = t.log, u = t.handlePath, f = t.matchPath;
715
715
  async function d(g) {
716
- if (!(a && await a(g)) && !Fr(g))
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
- return Wt(async (g) => {
723
- const m = Ht(e, g), y = {
722
+ return Ht(async (g) => {
723
+ const m = Qt(e, g), y = {
724
724
  totalSize: 0,
725
725
  maxFileDateModified: 0,
726
726
  countFiles: 0,
@@ -728,13 +728,13 @@ function ut(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
  }
735
735
  }
736
736
  async function I($, S, x, T) {
737
- return u ? await Y({
737
+ return u ? await V({
738
738
  pool: n,
739
739
  func: async () => {
740
740
  try {
@@ -746,8 +746,8 @@ function ut(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,35 +755,35 @@ function ut(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 Y({
760
+ const v = await V({
761
761
  pool: n,
762
762
  func: () => W.promises.lstat($).catch(d),
763
763
  count: 1,
764
- priority: V(S, V(1, i)),
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 L = Dr($, N);
770
- if (o.has(L))
769
+ const B = Rr($, v);
770
+ if (o.has(B))
771
771
  return null;
772
- o.add(L);
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
- const M = V(
780
+ const M = Z(
781
781
  S,
782
- V(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
- const C = await Y({
786
+ const C = await V({
787
787
  pool: n,
788
788
  func: () => W.promises.readlink($).catch(d).then((E) => E ?? null),
789
789
  count: 1,
@@ -791,7 +791,7 @@ function ut(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,12 +802,12 @@ function ut(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
- ) && (ve(y, k), w(T, k))), k;
809
- } else if (N.isDirectory()) {
810
- const C = await Y({
808
+ ) && (Ee(y, k), w(T, k))), k;
809
+ } else if (v.isDirectory()) {
810
+ const C = await V({
811
811
  pool: n,
812
812
  func: () => W.promises.readdir($).catch(d),
813
813
  count: 1,
@@ -817,7 +817,7 @@ function ut(t) {
817
817
  if (C) {
818
818
  for (let E = 0, O = C.length; E < O; E++)
819
819
  C[E] = R.join(T, C[E]);
820
- k = await ut({
820
+ k = await dt({
821
821
  ...t,
822
822
  paths: C,
823
823
  abortSignal: m,
@@ -827,28 +827,28 @@ function ut(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
- ) && (ve(y, k), w(T, k))), k;
835
+ ) && (Ee(y, k), w(T, k))), k;
836
836
  }
837
837
  const b = [];
838
838
  for (let $ = 0, S = r.length; $ < S; $++) {
839
- const x = Rr(r[$]), T = f ? f(x) : !0;
840
- T !== !1 && b.push(v(x, $, T));
839
+ const x = Fr(r[$]), T = f ? f(x) : !0;
840
+ T !== !1 && b.push(N(x, $, T));
841
841
  }
842
842
  return await Promise.all(b), y;
843
843
  });
844
844
  }
845
- function dt(t) {
846
- return ut(t);
845
+ function ft(t) {
846
+ return dt(t);
847
847
  }
848
848
  function H(t) {
849
849
  return t.replace(/\\/g, "/");
850
850
  }
851
- function Br(t, r) {
851
+ function Lr(t, r) {
852
852
  if (!r || r === ".")
853
853
  return t;
854
854
  const s = t.startsWith("^");
@@ -856,36 +856,36 @@ function Br(t, r) {
856
856
  const o = t.startsWith("!");
857
857
  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(R.normalize(t)), o && (t = "!" + t), s && (t = "^" + t), t;
858
858
  }
859
- function Lr(t) {
859
+ function Pr(t) {
860
860
  const r = t.startsWith("!");
861
861
  return r && (t = t.substring(1)), t.startsWith("/") ? t = t.substring(1) : !t.startsWith("**") && !t.startsWith("../") && (t = `**/${t}`), r && (t = "!" + t), t;
862
862
  }
863
- function Ee(t) {
863
+ function ke(t) {
864
864
  return "^" + t;
865
865
  }
866
- async function Pr(t) {
866
+ async function Ar(t) {
867
867
  const s = (await W.promises.readFile(t, "utf-8")).split(`
868
868
  `), o = [];
869
869
  return s.forEach((e) => {
870
870
  e = e.trim(), !(!e || e.startsWith("#")) && o.push(e);
871
871
  }), o;
872
872
  }
873
- async function ft(t) {
873
+ async function pt(t) {
874
874
  const r = t.rootDir ?? ".", s = [];
875
875
  if (!t.globs?.length)
876
876
  return s;
877
877
  const o = [];
878
878
  return t.globs.forEach((e) => {
879
- e.value && (e.valueType === "file-contains-patterns" ? o.push(e) : e.valueType === "pattern" && s.push(e.exclude ? Ee(e.value) : e.value));
879
+ e.value && (e.valueType === "file-contains-patterns" ? o.push(e) : e.valueType === "pattern" && s.push(e.exclude ? ke(e.value) : e.value));
880
880
  }), o.length && await Promise.all(
881
881
  o.map(async (e) => {
882
- await Y({
883
- pool: ye,
882
+ await V({
883
+ pool: be,
884
884
  count: 1,
885
885
  func: async () => {
886
- const n = R.resolve(r, e.value), a = await Pr(n), i = R.relative(r, R.dirname(n));
886
+ const n = R.resolve(r, e.value), a = await Ar(n), i = R.relative(r, R.dirname(n));
887
887
  a.forEach((c) => {
888
- c = Lr(c), c = Br(c, i), s.push(e.exclude ? Ee(c) : c);
888
+ c = Pr(c), c = Lr(c, i), s.push(e.exclude ? ke(c) : c);
889
889
  });
890
890
  }
891
891
  });
@@ -913,7 +913,7 @@ function ht({
913
913
  return;
914
914
  let c;
915
915
  try {
916
- c = Vt(i, {
916
+ c = Zt(i, {
917
917
  nocase: s ?? !1,
918
918
  dot: !0,
919
919
  strictBrackets: !0
@@ -940,14 +940,14 @@ function ht({
940
940
  return i ? !1 : a;
941
941
  };
942
942
  }
943
- async function Ar(t) {
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 ft({
946
+ const e = await pt({
947
947
  rootDir: r,
948
948
  globs: t.globs
949
949
  });
950
- return await dt({
950
+ return await ft({
951
951
  paths: [r],
952
952
  walkLinks: !0,
953
953
  matchPath: ht({
@@ -959,13 +959,13 @@ async function Ar(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,25 +973,25 @@ async function Ar(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
  }
980
- const ke = ["B", "KB", "MB", "GB", "TB"], Oe = 1024;
981
- function De(t) {
980
+ const Oe = ["B", "KB", "MB", "GB", "TB"], De = 1024;
981
+ function Re(t) {
982
982
  if (t == null) return "-";
983
983
  let r = t ?? 0, s = 0;
984
- for (; r >= Oe && s < ke.length - 1; )
985
- r /= Oe, s++;
986
- return `${s === 0 ? r.toString() : r.toFixed(2)}${ke[s]}`;
984
+ for (; r >= De && s < Oe.length - 1; )
985
+ r /= De, s++;
986
+ return `${s === 0 ? r.toString() : r.toFixed(2)}${Oe[s]}`;
987
987
  }
988
- function Re(t) {
988
+ function Fe(t) {
989
989
  const s = Date.now() - t;
990
990
  if (s < 0) return "0s";
991
991
  const o = Math.floor(s / 1e3), e = Math.floor(o / 60), n = Math.floor(e / 60), a = Math.floor(n / 24), i = Math.floor(a / 7), c = Math.floor(a / 30), l = Math.floor(a / 365);
992
992
  return l > 0 ? `${l}Y` : c > 0 ? `${c}M` : i > 0 ? `${i}w` : a > 0 ? `${a}d` : n > 0 ? `${n}h` : e > 0 ? `${e}m` : `${o}s`;
993
993
  }
994
- function zr(t, r) {
994
+ function Ur(t, r) {
995
995
  return r?.length ? [...t].sort((s, o) => {
996
996
  for (let e = 0, n = r.length; e < n; e++) {
997
997
  const a = r[e];
@@ -1027,8 +1027,8 @@ function zr(t, r) {
1027
1027
  return 0;
1028
1028
  }) : t;
1029
1029
  }
1030
- function Ur(t, r) {
1031
- const s = zr(t.items, r.sort ?? []), o = r.fields && r.fields.length > 0 ? r.fields : [];
1030
+ function qr(t, r) {
1031
+ const s = Ur(t.items, r.sort ?? []), o = r.fields && r.fields.length > 0 ? r.fields : [];
1032
1032
  let e = "";
1033
1033
  if (s.length > 0 && o.length > 0) {
1034
1034
  for (let n = 0, a = o.length; n < a; n++) {
@@ -1059,10 +1059,10 @@ function Ur(t, r) {
1059
1059
  const u = o[c];
1060
1060
  switch (c > 0 && (e += " | "), u) {
1061
1061
  case "dateModified":
1062
- e += i.dateModified ? Re(i.dateModified) : "-";
1062
+ e += i.dateModified ? Fe(i.dateModified) : "-";
1063
1063
  break;
1064
1064
  case "size":
1065
- e += De(i.size);
1065
+ e += Re(i.size);
1066
1066
  break;
1067
1067
  case "type":
1068
1068
  e += i.type;
@@ -1081,15 +1081,15 @@ function Ur(t, r) {
1081
1081
  e.length > 0 && (e += `
1082
1082
  ---
1083
1083
  `);
1084
- const n = De(t.totals.size ?? 0), a = t.totals.dateModified ? `, last modified ${Re(t.totals.dateModified)} ago` : "";
1084
+ const n = Re(t.totals.size ?? 0), a = t.totals.dateModified ? `, last modified ${Fe(t.totals.dateModified)} ago` : "";
1085
1085
  e += `Totals: ${t.totals.countFiles ?? 0} files in dirs, ${n}${a}`;
1086
1086
  }
1087
1087
  return e;
1088
1088
  }
1089
- const qr = "3.0.15", _r = {
1090
- version: qr
1091
- }, xo = "Project Tools", $o = "project-tools", Io = _r.version, Mo = "d00f70240703039df14c76176a055bce6b5484d2b552ba2c89820f03b8e5e60d", Fe = 25e3;
1092
- function Be(t) {
1089
+ const Gr = "3.0.17", _r = {
1090
+ version: Gr
1091
+ }, $o = "Project Tools", Io = "project-tools", Mo = _r.version, To = "d00f70240703039df14c76176a055bce6b5484d2b552ba2c89820f03b8e5e60d", Be = 25e3;
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
1095
1095
  );
@@ -1120,7 +1120,7 @@ function Be(t) {
1120
1120
  );
1121
1121
  }
1122
1122
  }
1123
- function Le(t) {
1123
+ function Pe(t) {
1124
1124
  const r = t.match(/^\s*(\d+(?:\.\d+)?)\s*(B|KB|MB|GB|TB)\s*$/i);
1125
1125
  if (!r)
1126
1126
  throw new Error(
@@ -1144,49 +1144,49 @@ function Le(t) {
1144
1144
  );
1145
1145
  }
1146
1146
  }
1147
- const pt = 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
  });
1186
- async function Gr(t, r) {
1186
+ async function Jr(t, r) {
1187
1187
  let s;
1188
1188
  try {
1189
- s = pt.parse(t);
1189
+ s = mt.parse(t);
1190
1190
  } catch (m) {
1191
1191
  return {
1192
1192
  error: F(m)
@@ -1216,7 +1216,7 @@ async function Gr(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 Gr(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 - Be(c) : null, N = i ? x - Be(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"
@@ -1253,24 +1253,24 @@ async function Gr(t, r) {
1253
1253
  }
1254
1254
  if (l || u)
1255
1255
  try {
1256
- const x = l ? Le(l) : null, T = u ? Le(u) : null;
1256
+ const x = l ? Pe(l) : null, T = u ? Pe(u) : null;
1257
1257
  b = [x, T];
1258
1258
  } catch (x) {
1259
1259
  return {
1260
1260
  error: x instanceof Error ? x.message : "Unknown error parsing size filter"
1261
1261
  };
1262
1262
  }
1263
- const $ = await Ar({
1263
+ const $ = await zr({
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
- return $.items.length > Fe ? {
1271
- error: `Number of paths (${$.items.length}) exceeds maximum allowed (${Fe}). Consider using more specific glob patterns or filters to reduce the result set.`
1270
+ return $.items.length > Be ? {
1271
+ error: `Number of paths (${$.items.length}) exceeds maximum allowed (${Be}). Consider using more specific glob patterns or filters to reduce the result set.`
1272
1272
  } : {
1273
- output: Ur($, {
1273
+ output: qr($, {
1274
1274
  sort: d,
1275
1275
  fields: f,
1276
1276
  totals: !0
@@ -1280,30 +1280,30 @@ async function Gr(t, r) {
1280
1280
  return { error: m instanceof Error ? m.message : "Unknown error" };
1281
1281
  }
1282
1282
  }
1283
- function Jr(t, r) {
1283
+ function jr(t, r) {
1284
1284
  t(
1285
1285
  "fs-list",
1286
1286
  {
1287
1287
  title: "List Files and Directories",
1288
1288
  description: "List files and directories with advanced filtering, sorting and formatting options. Use this to analyze filesystem structure",
1289
- inputSchema: pt.shape
1289
+ inputSchema: mt.shape
1290
1290
  },
1291
1291
  async (s) => {
1292
- const o = await Gr(s, r);
1292
+ const o = await Jr(s, r);
1293
1293
  return o.error ? `Method: fs-list(${JSON.stringify(s)})
1294
1294
  ❌ Error: ${o.error}` : `Method: fs-list(${JSON.stringify(s)})
1295
1295
  ${o.output || JSON.stringify(o, null, 2)}`;
1296
1296
  }
1297
1297
  );
1298
1298
  }
1299
- const ce = /* @__PURE__ */ new Map();
1300
- function Z(t) {
1301
- return ce.has(t) || ce.set(t, {
1299
+ const ue = /* @__PURE__ */ new Map();
1300
+ function X(t) {
1301
+ return ue.has(t) || ue.set(t, {
1302
1302
  fsSnapshotQueries: /* @__PURE__ */ new Map(),
1303
1303
  fsSnapshots: /* @__PURE__ */ new Map()
1304
- }), ce.get(t);
1304
+ }), ue.get(t);
1305
1305
  }
1306
- function Pe(t) {
1306
+ function Ae(t) {
1307
1307
  const r = t.match(
1308
1308
  /^\s*(\d+(?:\.\d+)?)\s*([smhdwMY]|sec(onds?)?|min(utes?)?|hours?|days?|weeks?|months?|years?)\s*$/i
1309
1309
  );
@@ -1334,7 +1334,7 @@ function Pe(t) {
1334
1334
  );
1335
1335
  }
1336
1336
  }
1337
- function Ae(t) {
1337
+ function ze(t) {
1338
1338
  const r = t.match(/^\s*(\d+(?:\.\d+)?)\s*(B|KB|MB|GB|TB)\s*$/i);
1339
1339
  if (!r)
1340
1340
  throw new Error(
@@ -1358,35 +1358,35 @@ function Ae(t) {
1358
1358
  );
1359
1359
  }
1360
1360
  }
1361
- const be = 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
- }), ze = new Map(
1389
+ }), Ue = new Map(
1390
1390
  [
1391
1391
  "name",
1392
1392
  "type",
@@ -1395,22 +1395,22 @@ const be = p.object({
1395
1395
  "dateModified"
1396
1396
  ].map((t, r) => [t, r])
1397
1397
  );
1398
- function jr(t, r) {
1399
- const s = ze.get(t) ?? 1 / 0, o = ze.get(r) ?? 1 / 0;
1398
+ function Kr(t, r) {
1399
+ const s = Ue.get(t) ?? 1 / 0, o = Ue.get(r) ?? 1 / 0;
1400
1400
  return s > o ? 1 : s < o ? -1 : 0;
1401
1401
  }
1402
- async function mt(t, r, s) {
1402
+ async function gt(t, r, s) {
1403
1403
  let o;
1404
1404
  try {
1405
- o = be.parse(t);
1406
- } catch (h) {
1405
+ o = Se.parse(t);
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,
@@ -1421,7 +1421,7 @@ async function mt(t, r, s) {
1421
1421
  return {
1422
1422
  error: "Session ID is required"
1423
1423
  };
1424
- const f = Z(s.sessionId), d = H(
1424
+ const f = X(s.sessionId), d = H(
1425
1425
  R.resolve(r.workingDir || "", o.rootDir || "")
1426
1426
  );
1427
1427
  try {
@@ -1434,8 +1434,8 @@ async function mt(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(jr);
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",
@@ -1444,7 +1444,7 @@ async function mt(t, r, s) {
1444
1444
  let w = null, I = null;
1445
1445
  if (i || c)
1446
1446
  try {
1447
- const S = Date.now(), x = c ? S - Pe(c) : null, T = i ? S - Pe(i) : null;
1447
+ const S = Date.now(), x = c ? S - Ae(c) : null, T = i ? S - Ae(i) : null;
1448
1448
  w = [x, T];
1449
1449
  } catch (S) {
1450
1450
  return {
@@ -1453,49 +1453,49 @@ async function mt(t, r, s) {
1453
1453
  }
1454
1454
  if (l || u)
1455
1455
  try {
1456
- const S = l ? Ae(l) : null, x = u ? Ae(u) : null;
1456
+ const S = l ? ze(l) : null, x = u ? ze(u) : null;
1457
1457
  I = [S, x];
1458
1458
  } catch (S) {
1459
1459
  return {
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
  }
1482
- function Kr(t, r) {
1482
+ function Wr(t, r) {
1483
1483
  t(
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",
1488
- inputSchema: be.shape
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
+ inputSchema: Se.shape
1489
1489
  },
1490
1490
  async (s, o) => {
1491
- const e = await mt(s, r, o);
1491
+ const e = await gt(s, r, o);
1492
1492
  return e.error != null ? `Method: fs-snapshot-query-create(${JSON.stringify(s)})
1493
1493
  ❌ Error: ${e.error}` : `Method: fs-snapshot-query-create(${JSON.stringify(s)})
1494
1494
  ✅ Filesystem snapshot query "${e.snapshotQuery.name}" created successfully`;
1495
1495
  }
1496
1496
  );
1497
1497
  }
1498
- function ae(t) {
1498
+ function le(t) {
1499
1499
  const { idToNode: r, idToChildIds: s } = t, o = r.get(null);
1500
1500
  if (o == null)
1501
1501
  throw new Error(
@@ -1535,27 +1535,27 @@ function ae(t) {
1535
1535
  }
1536
1536
  };
1537
1537
  }
1538
- function gt(t, r, s) {
1538
+ function wt(t, r, s) {
1539
1539
  let o = null;
1540
1540
  for (let e = 0, n = r.length; e < n; e++) {
1541
- const a = r[e], i = t(a), c = i == null ? null : gt(t, i, s), l = s(a, c);
1541
+ const a = r[e], i = t(a), c = i == null ? null : wt(t, i, s), l = s(a, c);
1542
1542
  l != null && (o == null && (o = []), o.push(l));
1543
1543
  }
1544
1544
  return o;
1545
1545
  }
1546
- function wt(t) {
1547
- const { getId: r, getChilds: s, rootNodes: o, createSnapshotNode: e } = t, n = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), c = gt(
1546
+ function yt(t) {
1547
+ const { getId: r, getChilds: s, rootNodes: o, createSnapshotNode: e } = t, n = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), c = wt(
1548
1548
  s,
1549
1549
  o,
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);
@@ -1569,10 +1569,10 @@ function wt(t) {
1569
1569
  idToChildIds: i
1570
1570
  };
1571
1571
  }
1572
- function pe(t) {
1572
+ function me(t) {
1573
1573
  return t = t != null ? H(t).replace(/\/$/, "") : null, !t || t === "." ? null : t;
1574
1574
  }
1575
- async function Wr(t) {
1575
+ async function Hr(t) {
1576
1576
  const r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), o = R.resolve(t.rootDir || "."), n = {
1577
1577
  path: ".",
1578
1578
  name: R.basename(o),
@@ -1582,11 +1582,11 @@ async function Wr(t) {
1582
1582
  size: 0
1583
1583
  };
1584
1584
  r.set(null, n);
1585
- const a = await ft({
1585
+ const a = await pt({
1586
1586
  rootDir: o,
1587
1587
  globs: t.globs
1588
1588
  });
1589
- return await dt({
1589
+ return await ft({
1590
1590
  paths: [o],
1591
1591
  walkLinks: !0,
1592
1592
  matchPath: ht({
@@ -1598,7 +1598,7 @@ async function Wr(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 = pe(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,26 +1613,26 @@ async function Wr(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 = pe(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,
1632
1632
  idToChildIds: s
1633
1633
  };
1634
1634
  }
1635
- const Hr = [
1635
+ const Qr = [
1636
1636
  { name: "[ ]", match: (t) => t === 32, min: 2, max: 81 },
1637
1637
  { name: "[\\t]", match: (t) => t === 9, min: 2, max: 20 },
1638
1638
  { name: "[\\n]", match: (t) => t === 10, min: 2, max: 14 },
@@ -1655,7 +1655,7 @@ const Hr = [
1655
1655
  // max: 2,
1656
1656
  // },
1657
1657
  ];
1658
- function Ue(t, r = Hr) {
1658
+ function qe(t, r = Qr) {
1659
1659
  const s = t.length;
1660
1660
  if (s === 0) return 0;
1661
1661
  const o = r.length;
@@ -1681,25 +1681,25 @@ function Ue(t, r = Hr) {
1681
1681
  }
1682
1682
  return e;
1683
1683
  }
1684
- function yt(t) {
1684
+ function bt(t) {
1685
1685
  let r = 0;
1686
- return r += Ue(t.textOpen) + 1, t.textClose != null && (r += Ue(t.textClose) + 1), t.indent && (r += 1), r;
1686
+ return r += qe(t.textOpen) + 1, t.textClose != null && (r += qe(t.textClose) + 1), t.indent && (r += 1), r;
1687
1687
  }
1688
- const qe = ["B", "KB", "MB", "GB", "TB"], _e = 1024;
1689
- function Qr(t) {
1688
+ const Ge = ["B", "KB", "MB", "GB", "TB"], _e = 1024;
1689
+ function Yr(t) {
1690
1690
  if (t == null) return "-";
1691
1691
  let r = t ?? 0, s = 0;
1692
- for (; r >= _e && s < qe.length - 1; )
1692
+ for (; r >= _e && s < Ge.length - 1; )
1693
1693
  r /= _e, s++;
1694
- return `${s === 0 ? r.toString() : r.toFixed(2)}${qe[s]}`;
1694
+ return `${s === 0 ? r.toString() : r.toFixed(2)}${Ge[s]}`;
1695
1695
  }
1696
- function Yr(t) {
1696
+ function Vr(t) {
1697
1697
  const s = Date.now() - t;
1698
1698
  if (s < 0) return "0s";
1699
1699
  const o = Math.floor(s / 1e3), e = Math.floor(o / 60), n = Math.floor(e / 60), a = Math.floor(n / 24), i = Math.floor(a / 7), c = Math.floor(a / 30), l = Math.floor(a / 365);
1700
1700
  return l > 0 ? `${l}Y` : c > 0 ? `${c}M` : i > 0 ? `${i}w` : a > 0 ? `${a}d` : n > 0 ? `${n}h` : e > 0 ? `${e}m` : `${o}s`;
1701
1701
  }
1702
- function Vr(t) {
1702
+ function Zr(t) {
1703
1703
  return function(s, o) {
1704
1704
  const e = t.get(s), n = t.get(o);
1705
1705
  if (e.type !== n.type)
@@ -1712,26 +1712,26 @@ function Vr(t) {
1712
1712
  }
1713
1713
  };
1714
1714
  }
1715
- function Zr(t) {
1715
+ function Xr(t) {
1716
1716
  const r = t.fields ?? [];
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) {
1730
1730
  case "dateModified":
1731
- n += m ? Yr(m) : "-";
1731
+ n += m ? Vr(m) : "-";
1732
1732
  break;
1733
1733
  case "size":
1734
- n += Qr(h);
1734
+ n += Yr(p);
1735
1735
  break;
1736
1736
  case "type":
1737
1737
  n += y;
@@ -1744,12 +1744,12 @@ function Zr(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 = yt(v), d += u, {
1752
+ return u = bt(N), d += u, {
1753
1753
  type: y,
1754
1754
  name: w,
1755
1755
  path: I,
@@ -1760,15 +1760,15 @@ function Zr(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
  };
1768
1768
  };
1769
1769
  }
1770
- async function Xr(t) {
1771
- const r = await Wr(t), s = ae(r), o = s.getChilds(s.root), e = wt({
1770
+ async function es(t) {
1771
+ const r = await Hr(t), s = le(r), o = s.getChilds(s.root), e = yt({
1772
1772
  getId: (a) => {
1773
1773
  const i = s.getId(a);
1774
1774
  if (i == null)
@@ -1778,26 +1778,26 @@ async function Xr(t) {
1778
1778
  return i;
1779
1779
  },
1780
1780
  getChilds: (a) => s.getChilds(a),
1781
- createSnapshotNode: Zr(t),
1781
+ createSnapshotNode: Xr(t),
1782
1782
  rootNodes: o ?? []
1783
- }), n = Vr(e.idToNode);
1783
+ }), n = Zr(e.idToNode);
1784
1784
  return e.idToChildIds.forEach((a) => {
1785
1785
  a.sort(n);
1786
- }), ae(e);
1786
+ }), le(e);
1787
1787
  }
1788
- const X = p.object({
1789
- queryName: p.string().optional().describe("Name of previously created filesystem snapshot query, to use"),
1790
- query: be.optional().describe(
1788
+ const ee = h.object({
1789
+ queryName: h.string().optional().describe("Name of previously created filesystem snapshot query, to use"),
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
  });
1797
- async function le(t, r, s) {
1797
+ async function ce(t, r, s) {
1798
1798
  let o;
1799
1799
  try {
1800
- o = X.parse(t);
1800
+ o = ee.parse(t);
1801
1801
  } catch (u) {
1802
1802
  return {
1803
1803
  error: F(u)
@@ -1808,7 +1808,7 @@ async function le(t, r, s) {
1808
1808
  return {
1809
1809
  error: "Session ID is required"
1810
1810
  };
1811
- const i = Z(s.sessionId);
1811
+ const i = X(s.sessionId);
1812
1812
  if (n && a)
1813
1813
  return {
1814
1814
  error: "Either queryName or query must be provided, not both"
@@ -1822,7 +1822,7 @@ async function le(t, r, s) {
1822
1822
  };
1823
1823
  c = u;
1824
1824
  } else if (a) {
1825
- const u = await mt(
1825
+ const u = await gt(
1826
1826
  a,
1827
1827
  r,
1828
1828
  s
@@ -1837,7 +1837,7 @@ async function le(t, r, s) {
1837
1837
  error: "Either queryName or query must be provided"
1838
1838
  };
1839
1839
  try {
1840
- const u = await Xr(c), f = {
1840
+ const u = await es(c), f = {
1841
1841
  name: e,
1842
1842
  query: c,
1843
1843
  tree: u
@@ -1852,16 +1852,16 @@ async function le(t, r, s) {
1852
1852
  };
1853
1853
  }
1854
1854
  }
1855
- function es(t, r) {
1855
+ function ts(t, r) {
1856
1856
  t(
1857
1857
  "fs-snapshot-create",
1858
1858
  {
1859
1859
  title: "Create Filesystem Snapshot",
1860
1860
  description: "Create a filesystem snapshot. Use this to capture filesystem state for later browsing. Prefer fs-snapshot-browse if you need to immediately create and browse a snapshot",
1861
- inputSchema: X.shape
1861
+ inputSchema: ee.shape
1862
1862
  },
1863
1863
  async (s, o) => {
1864
- const e = await le(s, r, o);
1864
+ const e = await ce(s, r, o);
1865
1865
  if (e.error != null)
1866
1866
  return `Method: fs-snapshot-create(${JSON.stringify(s)})
1867
1867
  ❌ Error: ${e.error}`;
@@ -1872,7 +1872,7 @@ function es(t, r) {
1872
1872
  }
1873
1873
  );
1874
1874
  }
1875
- class ts {
1875
+ class rs {
1876
1876
  _first = null;
1877
1877
  _last = null;
1878
1878
  _size = 0;
@@ -1895,8 +1895,8 @@ class ts {
1895
1895
  return this._size;
1896
1896
  }
1897
1897
  }
1898
- function rs(t) {
1899
- const r = new ts(), {
1898
+ function ss(t) {
1899
+ const r = new rs(), {
1900
1900
  tree: s,
1901
1901
  limits: { maxCountTotal: o, maxTokensTotal: e, maxCountGroup: n, maxTokensGroup: a },
1902
1902
  indexRangeGroupStrategy: i
@@ -1907,8 +1907,8 @@ function rs(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 rs(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 rs(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) {
@@ -1964,7 +1964,7 @@ function rs(t) {
1964
1964
  }
1965
1965
  return l ?? [];
1966
1966
  }
1967
- function bt(t) {
1967
+ function St(t) {
1968
1968
  const {
1969
1969
  tree: r,
1970
1970
  request: { parentNodeId: s, childsIndexRange: o, limits: e },
@@ -1981,14 +1981,14 @@ function bt(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
  }
@@ -2008,14 +2008,14 @@ function bt(t) {
2008
2008
  root: u,
2009
2009
  getChilds: (d) => d === u ? [c] : d === c ? l : r.getChilds(d)
2010
2010
  };
2011
- return rs({
2011
+ return ss({
2012
2012
  tree: f,
2013
2013
  limits: e,
2014
2014
  indexRangeGroupStrategy: n,
2015
2015
  ...a
2016
2016
  });
2017
2017
  }
2018
- function St(t, r) {
2018
+ function xt(t, r) {
2019
2019
  if (t == null || t.length === 0)
2020
2020
  return "No results found";
2021
2021
  let s = "";
@@ -2032,7 +2032,7 @@ function St(t, r) {
2032
2032
  }
2033
2033
  return o(t, ""), s;
2034
2034
  }
2035
- class ss {
2035
+ class os {
2036
2036
  tokens = 16;
2037
2037
  // +1 indent, +1 for line break
2038
2038
  getReportText = (r) => ({
@@ -2047,15 +2047,15 @@ class ss {
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 xt = p.object({
2051
- snapshotName: p.string().optional().describe("Name of previously created filesystem snapshot, to use"),
2052
- snapshot: X.optional().describe(
2050
+ const $t = h.object({
2051
+ snapshotName: h.string().optional().describe("Name of previously created filesystem snapshot, to use"),
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
@@ -2069,10 +2069,10 @@ const xt = p.object({
2069
2069
  // maxCountGroup: z.number().default(10).describe('Maximum items per group'),
2070
2070
  // maxTokensGroup: z.number().default(1000).describe('Maximum tokens per group'),
2071
2071
  });
2072
- async function os(t, r, s) {
2072
+ async function ns(t, r, s) {
2073
2073
  let o;
2074
2074
  try {
2075
- o = xt.parse(t);
2075
+ o = $t.parse(t);
2076
2076
  } catch (m) {
2077
2077
  return {
2078
2078
  error: F(m)
@@ -2091,19 +2091,19 @@ async function os(t, r, s) {
2091
2091
  return {
2092
2092
  error: "Session ID is required"
2093
2093
  };
2094
- const f = Z(s.sessionId);
2094
+ const f = X(s.sessionId);
2095
2095
  if (e && n)
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 {
2103
2103
  error: `Filesystem snapshot "${e}" not found`
2104
2104
  };
2105
2105
  } else if (n) {
2106
- const m = await le(
2106
+ const m = await ce(
2107
2107
  n,
2108
2108
  r,
2109
2109
  s
@@ -2112,13 +2112,13 @@ async function os(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"
2119
2119
  };
2120
2120
  try {
2121
- const m = pe(o.parentPath), y = bt({
2121
+ const m = me(o.parentPath), y = St({
2122
2122
  tree: d.tree,
2123
2123
  request: {
2124
2124
  parentNodeId: m,
@@ -2130,11 +2130,11 @@ async function os(t, r, s) {
2130
2130
  maxTokensGroup: u
2131
2131
  }
2132
2132
  },
2133
- indexRangeGroupStrategy: new ss()
2134
- }), w = St(y);
2133
+ indexRangeGroupStrategy: new os()
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,
@@ -2146,16 +2146,16 @@ async function os(t, r, s) {
2146
2146
  };
2147
2147
  }
2148
2148
  }
2149
- function ns(t, r) {
2149
+ function is(t, r) {
2150
2150
  t(
2151
2151
  "fs-snapshot-browse",
2152
2152
  {
2153
2153
  title: "Browse Filesystem Snapshot",
2154
2154
  description: "Browse and explore filesystem. Use this to efficiently browse, analyze, explore, inspect, etc directory and file structures",
2155
- inputSchema: xt.shape
2155
+ inputSchema: $t.shape
2156
2156
  },
2157
2157
  async (s, o) => {
2158
- const e = await os(s, r, o);
2158
+ const e = await ns(s, r, o);
2159
2159
  if (e.error != null)
2160
2160
  return `Method: fs-snapshot-browse(${JSON.stringify(s)})
2161
2161
  ❌ Error: ${e.error}`;
@@ -2177,7 +2177,7 @@ ${e.report}`, n;
2177
2177
  }
2178
2178
  );
2179
2179
  }
2180
- function $t(t) {
2180
+ function It(t) {
2181
2181
  const r = [], s = t.tree, o = t.query.rootDir ?? ".";
2182
2182
  function e(n) {
2183
2183
  n.type === "file" && n.isMatched && r.push(o + "/" + n.path);
@@ -2188,34 +2188,34 @@ function $t(t) {
2188
2188
  }
2189
2189
  return e(s.root), r;
2190
2190
  }
2191
- const Ge = /* @__PURE__ */ new Map();
2192
- function is(t) {
2191
+ const Je = /* @__PURE__ */ new Map();
2192
+ function as(t) {
2193
2193
  const r = H(t);
2194
- let s = Ge.get(r);
2195
- return s == null && (s = new Qt(), Ge.set(r, s)), s;
2194
+ let s = Je.get(r);
2195
+ return s == null && (s = new Yt(), Je.set(r, s)), s;
2196
2196
  }
2197
- async function as(t) {
2197
+ async function ls(t) {
2198
2198
  const { filePath: r, func: s } = t;
2199
- return is(r).lock(
2200
- () => Y({
2201
- pool: ye,
2199
+ return as(r).lock(
2200
+ () => V({
2201
+ pool: be,
2202
2202
  count: 1,
2203
2203
  func: s
2204
2204
  })
2205
2205
  );
2206
2206
  }
2207
- const Je = 10, te = 48, je = 57, ue = 36, ls = 38, cs = 39, us = 60, ds = 62, fs = 96, re = 0, Ke = 1, We = 2, He = 3, Qe = 4, hs = 5;
2208
- function ps(t) {
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
+ 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++)
2211
- r.charCodeAt(b) === Je && b + 1 < e && n.push(b + 1);
2211
+ r.charCodeAt(b) === je && b + 1 < e && n.push(b + 1);
2212
2212
  const a = n.length, i = [], c = [];
2213
2213
  let l = null, u = null, f = null, d = 0;
2214
2214
  if (o != null) {
2215
2215
  const b = o.length;
2216
2216
  let $ = !1;
2217
2217
  for (let S = 0; S < b; S++)
2218
- if (o.charCodeAt(S) === ue) {
2218
+ if (o.charCodeAt(S) === de) {
2219
2219
  $ = !0;
2220
2220
  break;
2221
2221
  }
@@ -2223,48 +2223,48 @@ function ps(t) {
2223
2223
  u = [], f = [];
2224
2224
  let S = 0, x = 0;
2225
2225
  for (; x < b; ) {
2226
- if (o.charCodeAt(x) !== ue || x + 1 >= b) {
2226
+ if (o.charCodeAt(x) !== de || x + 1 >= b) {
2227
2227
  x++;
2228
2228
  continue;
2229
2229
  }
2230
2230
  const T = o.charCodeAt(x + 1);
2231
- let N = -1, L = 0, k = 2;
2232
- if (T === ue)
2233
- N = re, L = "$";
2234
- else if (T === ls)
2235
- N = Ke;
2236
- else if (T === fs)
2237
- N = We;
2231
+ let v = -1, B = 0, k = 2;
2232
+ if (T === de)
2233
+ v = se, B = "$";
2238
2234
  else if (T === cs)
2239
- N = He;
2240
- else if (T >= te && T <= je) {
2235
+ v = We;
2236
+ else if (T === ps)
2237
+ v = He;
2238
+ else if (T === us)
2239
+ v = Qe;
2240
+ else if (T >= re && T <= Ke) {
2241
2241
  let M = x + 2;
2242
2242
  for (; M < b; ) {
2243
2243
  const C = o.charCodeAt(M);
2244
- if (C < te || C > je) break;
2244
+ if (C < re || C > Ke) break;
2245
2245
  M++;
2246
2246
  }
2247
- N = Qe, L = o.substring(x + 1, M), k = M - x;
2248
- } else if (T === us) {
2247
+ v = Ye, B = o.substring(x + 1, M), k = M - x;
2248
+ } else if (T === ds) {
2249
2249
  let M = x + 2;
2250
- for (; M < b && o.charCodeAt(M) !== ds; )
2250
+ for (; M < b && o.charCodeAt(M) !== fs; )
2251
2251
  M++;
2252
- M < b && M > x + 2 && (N = hs, L = 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(re), f.push(o.substring(S, x))), u.push(N), f.push(L), 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
- S < b && (u.push(re), f.push(o.substring(S))), d = u.length;
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, L, k;
2265
+ let T, v, B, k;
2266
2266
  if (a === 1)
2267
- T = 0, N = 1, L = 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 ps(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
- L = 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],
2288
- linesOffset: [L, k]
2287
+ lines: [T, v],
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;
@@ -2295,38 +2295,38 @@ function ps(t) {
2295
2295
  M = "";
2296
2296
  const E = y.groups, O = y.length - 1;
2297
2297
  for (let K = 0; K < d; K++) {
2298
- const _ = u[K], A = f[K];
2299
- switch (_) {
2300
- case re:
2301
- M += A;
2298
+ const q = u[K], P = f[K];
2299
+ switch (q) {
2300
+ case se:
2301
+ M += P;
2302
2302
  break;
2303
- case Ke:
2303
+ case We:
2304
2304
  M += $;
2305
2305
  break;
2306
- case We:
2306
+ case He:
2307
2307
  M += r.substring(0, b);
2308
2308
  break;
2309
- case He:
2309
+ case Qe:
2310
2310
  M += r.substring(x);
2311
2311
  break;
2312
- case Qe: {
2313
- const P = A, U = P.length, z = P.charCodeAt(0) - te;
2314
- if (U >= 2) {
2315
- const G = P.charCodeAt(1) - te, D = z * 10 + G;
2312
+ case Ye: {
2313
+ const L = P, z = L.length, A = L.charCodeAt(0) - re;
2314
+ if (z >= 2) {
2315
+ const G = L.charCodeAt(1) - re, D = A * 10 + G;
2316
2316
  if (D >= 1 && D <= O) {
2317
- M += y[D] ?? "", U > 2 && (M += P.substring(2));
2317
+ M += y[D] ?? "", z > 2 && (M += L.substring(2));
2318
2318
  break;
2319
2319
  }
2320
2320
  }
2321
- z >= 1 && z <= O ? (M += y[z] ?? "", U > 1 && (M += P.substring(1))) : M += "$" + P;
2321
+ A >= 1 && A <= O ? (M += y[A] ?? "", z > 1 && (M += L.substring(1))) : M += "$" + L;
2322
2322
  break;
2323
2323
  }
2324
2324
  default:
2325
- E != null ? M += E[A] ?? "" : M += "$<" + A + ">";
2325
+ E != null ? M += E[P] ?? "" : M += "$<" + P + ">";
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,41 +2339,41 @@ function ps(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, L, k, M;
2350
- if (v === 1)
2351
- N = 0, L = 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
- L = C + 1;
2364
+ B = C + 1;
2365
2365
  } else
2366
- L = N + 1;
2367
- k = I[N], M = L < v ? I[L] : 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] = L, 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
- function It(t) {
2376
+ function Mt(t) {
2377
2377
  if (t.length === 0)
2378
2378
  return [];
2379
2379
  const r = [...t].sort((a, i) => {
@@ -2398,7 +2398,7 @@ function It(t) {
2398
2398
  linesOffset: n
2399
2399
  }), s;
2400
2400
  }
2401
- function se(t, r, s, o) {
2401
+ function oe(t, r, s, o) {
2402
2402
  let e = 0, n = 0;
2403
2403
  for (let u = 0; u < s; u++)
2404
2404
  t.charCodeAt(u) === 10 && (n = u + 1, e++);
@@ -2412,69 +2412,69 @@ function se(t, r, s, o) {
2412
2412
  return { startLine: a, endLine: l, startLineOfs: i, endLineOfs: c + 1 };
2413
2413
  return { startLine: a, endLine: l, startLineOfs: i, endLineOfs: r };
2414
2414
  }
2415
- function ms(t, r) {
2415
+ function gs(t, r) {
2416
2416
  if (t.replace == null && r.replace == null) {
2417
- const q = [...t.search.matches, ...r.search.matches];
2417
+ const U = [...t.search.matches, ...r.search.matches];
2418
2418
  return {
2419
- search: { content: t.search.content, matches: It(q) },
2419
+ search: { content: t.search.content, matches: Mt(U) },
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, L = 0, k = 0, M = 0, C = 0, E = 0, O = 0, K = 0, _ = 0, A = 0, P = 0, U = 0, z = 0, G = 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 < $) {
2427
- K = b < S ? b : S, T = $ > x ? $ : x, L = y, k = w, y++, w++;
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
+ 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);
2434
- M = 1 / 0, C = -1 / 0, _ = K, A = I;
2435
- for (let J = L; J < y; J++)
2436
- P = c[J].offset[0], U = c[J].offset[1], z = l[J].offset[0], G = l[J].offset[1], _ < z && (D = _ + A, D < M && (M = D), D = z + A, D > C && (C = D)), P < M && (M = P), U > C && (C = U), A += U - P - G + z, _ = G;
2437
- _ < T && (D = _ + A, D < M && (M = D), D = T + A, D > C && (C = D)), I = A, E = 1 / 0, O = -1 / 0, _ = K, A = v;
2438
- for (let J = k; J < w; J++)
2439
- P = u[J].offset[0], U = u[J].offset[1], z = f[J].offset[0], G = f[J].offset[1], _ < P && (D = _ + A, D < E && (E = D), D = P + A, D > O && (O = D)), z < E && (E = z), G > O && (O = G), A += G - z - U + P, _ = U;
2440
- _ < T && (D = _ + A, D < E && (E = D), D = T + A, D > O && (O = D)), v = A;
2441
- const q = se(e, a, M, C);
2433
+ } while (T !== v);
2434
+ M = 1 / 0, C = -1 / 0, q = K, P = I;
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
+ const U = oe(e, a, M, C);
2442
2442
  g.push({
2443
2443
  offset: [M, C],
2444
- lines: [q.startLine, q.endLine],
2445
- linesOffset: [q.startLineOfs, q.endLineOfs]
2444
+ lines: [U.startLine, U.endLine],
2445
+ linesOffset: [U.startLineOfs, U.endLineOfs]
2446
2446
  });
2447
- const ee = se(n, i, E, O);
2447
+ const te = oe(n, i, E, O);
2448
2448
  m.push({
2449
2449
  offset: [E, O],
2450
- lines: [ee.startLine, ee.endLine],
2451
- linesOffset: [ee.startLineOfs, ee.endLineOfs]
2450
+ lines: [te.startLine, te.endLine],
2451
+ linesOffset: [te.startLineOfs, te.endLineOfs]
2452
2452
  });
2453
- } else if (w >= h || y < d && b <= S) {
2454
- P = c[y].offset[0], U = c[y].offset[1], z = l[y].offset[0], G = l[y].offset[1], E = z + v, O = G + v;
2455
- const q = se(n, i, E, O);
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
+ const U = oe(n, i, E, O);
2456
2456
  g.push(c[y]), m.push({
2457
2457
  offset: [E, O],
2458
- lines: [q.startLine, q.endLine],
2459
- linesOffset: [q.startLineOfs, q.endLineOfs]
2460
- }), I += U - P - G + z, y++;
2458
+ lines: [U.startLine, U.endLine],
2459
+ linesOffset: [U.startLineOfs, U.endLineOfs]
2460
+ }), I += z - L - G + A, y++;
2461
2461
  } else {
2462
- P = u[w].offset[0], U = u[w].offset[1], z = f[w].offset[0], G = f[w].offset[1], M = P + I, C = U + I;
2463
- const q = se(e, a, M, C);
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
+ const U = oe(e, a, M, C);
2464
2464
  g.push({
2465
2465
  offset: [M, C],
2466
- lines: [q.startLine, q.endLine],
2467
- linesOffset: [q.startLineOfs, q.endLineOfs]
2468
- }), m.push(f[w]), v += G - z - U + P, w++;
2466
+ lines: [U.startLine, U.endLine],
2467
+ linesOffset: [U.startLineOfs, U.endLineOfs]
2468
+ }), m.push(f[w]), N += G - A - z + L, w++;
2469
2469
  }
2470
2470
  return {
2471
2471
  search: { content: e, matches: g },
2472
2472
  replace: { content: n, matches: m }
2473
2473
  };
2474
2474
  }
2475
- async function gs(t) {
2475
+ async function ws(t) {
2476
2476
  const { filePath: r, operations: s, dryRun: o } = t;
2477
- return s.length === 0 ? { filePath: r, result: null } : as({
2477
+ return s.length === 0 ? { filePath: r, result: null } : ls({
2478
2478
  filePath: r,
2479
2479
  func: async () => {
2480
2480
  let e;
@@ -2500,12 +2500,12 @@ async function gs(t) {
2500
2500
  error: `Invalid RegExp pattern "${c.pattern}": ${d instanceof Error ? d.message : d + ""}`
2501
2501
  };
2502
2502
  }
2503
- const u = n?.replace?.content ?? e, f = ps({
2503
+ const u = n?.replace?.content ?? e, f = ms({
2504
2504
  content: u,
2505
2505
  pattern: l,
2506
2506
  replacement: c.replacement
2507
2507
  });
2508
- c.replacement != null && (a = !0), n == null ? n = f : n = ms(n, f);
2508
+ c.replacement != null && (a = !0), n == null ? n = f : n = gs(n, f);
2509
2509
  }
2510
2510
  if (a && n?.replace != null && !o) {
2511
2511
  const i = n.replace.content;
@@ -2524,17 +2524,17 @@ async function gs(t) {
2524
2524
  }
2525
2525
  });
2526
2526
  }
2527
- async function Mt(t) {
2527
+ async function Tt(t) {
2528
2528
  const { filePaths: r, operations: s, dryRun: o } = t;
2529
2529
  return { results: await Promise.all(
2530
2530
  r.map(
2531
- (n) => gs({ filePath: n, operations: s, dryRun: o })
2531
+ (n) => ws({ filePath: n, operations: s, dryRun: o })
2532
2532
  )
2533
2533
  ) };
2534
2534
  }
2535
- const ws = 6;
2536
- function ys(t) {
2537
- const { content: r, startLine: s } = t, o = t.padWidth ?? ws;
2535
+ const ys = 6;
2536
+ function bs(t) {
2537
+ const { content: r, startLine: s } = t, o = t.padWidth ?? ys;
2538
2538
  let e = "", n = 0, a = 0;
2539
2539
  for (; n < r.length; ) {
2540
2540
  const i = r.indexOf(`
@@ -2545,17 +2545,17 @@ function ys(t) {
2545
2545
  `) && (e += `
2546
2546
  `), e;
2547
2547
  }
2548
- function de(t) {
2548
+ function fe(t) {
2549
2549
  const { content: r, matches: s, outputLimit: o } = t;
2550
2550
  if (s.length === 0)
2551
2551
  return { output: "", truncated: !1 };
2552
- const e = It(s);
2552
+ const e = Mt(s);
2553
2553
  let n = "", a = !1;
2554
2554
  for (let i = 0; i < e.length; i++) {
2555
2555
  const c = e[i], l = r.substring(
2556
2556
  c.linesOffset[0],
2557
2557
  c.linesOffset[1]
2558
- ), u = ys({
2558
+ ), u = bs({
2559
2559
  content: l,
2560
2560
  startLine: c.lines[0]
2561
2561
  }), f = i > 0 ? 2 : 0;
@@ -2568,36 +2568,36 @@ function de(t) {
2568
2568
  }
2569
2569
  return { output: n, truncated: a };
2570
2570
  }
2571
- const Ye = "BEFORE", Ve = "AFTER";
2572
- function bs(t) {
2571
+ const Ve = "BEFORE", Ze = "AFTER";
2572
+ function Ss(t) {
2573
2573
  const { result: r, outputLimit: s } = t;
2574
2574
  if (r.replace == null) {
2575
- const g = de({
2575
+ const g = fe({
2576
2576
  content: r.search.content,
2577
2577
  matches: r.search.matches,
2578
2578
  outputLimit: s
2579
2579
  });
2580
2580
  return { output: g.output, truncated: g.truncated };
2581
2581
  }
2582
- const o = `<${Ye}>
2583
- `, e = `</${Ye}>
2584
- `, n = `<${Ve}>
2585
- `, a = `</${Ve}>
2582
+ const o = `<${Ve}>
2583
+ `, e = `</${Ve}>
2584
+ `, n = `<${Ze}>
2585
+ `, a = `</${Ze}>
2586
2586
  `, i = o.length + e.length + n.length + a.length;
2587
2587
  if (s != null && s < i)
2588
2588
  return { output: "", truncated: !0 };
2589
- const c = s != null ? s - i : void 0, l = c != null ? Math.floor(c / 2) : void 0, u = de({
2589
+ const c = s != null ? s - i : void 0, l = c != null ? Math.floor(c / 2) : void 0, u = fe({
2590
2590
  content: r.search.content,
2591
2591
  matches: r.search.matches,
2592
2592
  outputLimit: l
2593
- }), f = c != null ? c - u.output.length : void 0, d = de({
2593
+ }), f = c != null ? c - u.output.length : void 0, d = fe({
2594
2594
  content: r.replace.content,
2595
2595
  matches: r.replace.matches,
2596
2596
  outputLimit: f
2597
2597
  });
2598
2598
  return { output: o + u.output + e + n + d.output + a, truncated: u.truncated || d.truncated };
2599
2599
  }
2600
- function Tt(t) {
2600
+ function Ct(t) {
2601
2601
  const { result: r, rootDir: s } = t;
2602
2602
  let o = "";
2603
2603
  for (let e = 0; e < r.results.length; e++) {
@@ -2612,7 +2612,7 @@ function Tt(t) {
2612
2612
  }
2613
2613
  if (n.result == null || n.result.search.matches.length === 0)
2614
2614
  continue;
2615
- const c = bs({
2615
+ const c = Ss({
2616
2616
  result: n.result
2617
2617
  });
2618
2618
  c.output.length > 0 && (i > 0 && (o += `
@@ -2621,34 +2621,34 @@ function Tt(t) {
2621
2621
  }
2622
2622
  return o;
2623
2623
  }
2624
- const Ss = p.object({
2625
- pattern: p.string().describe("JS RegExp pattern"),
2626
- flags: p.string().optional().describe("JS RegExp flags")
2627
- }), Ct = p.object({
2628
- snapshotName: p.string().optional().describe("Name of previously created filesystem snapshot, to use"),
2629
- snapshot: X.optional().describe(
2624
+ const xs = h.object({
2625
+ pattern: h.string().describe("JS RegExp pattern"),
2626
+ flags: h.string().optional().describe("JS RegExp flags")
2627
+ }), vt = h.object({
2628
+ snapshotName: h.string().optional().describe("Name of previously created filesystem snapshot, to use"),
2629
+ snapshot: ee.optional().describe(
2630
2630
  "Filesystem snapshot creation options JSON to automatically create snapshot"
2631
2631
  ),
2632
- operations: p.array(Ss).describe("Search operations to execute sequentially on each file"),
2633
- outputLimit: p.number().int().min(0).max(B).default(B).describe(
2634
- `Maximum output characters. Output exceeding this limit will be truncated. Maximum: ${B}. Default: ${B}`
2632
+ bulkOperations: h.array(xs).describe("All search patterns to execute; include every pattern here; never split across multiple calls"),
2633
+ outputLimit: h.number().int().min(0).max(J).default(Q).describe(
2634
+ `Maximum output characters. Output exceeding this limit will be truncated. Maximum: ${J}. Default: ${Q}`
2635
2635
  )
2636
2636
  });
2637
- async function xs(t, r, s) {
2637
+ async function $s(t, r, s) {
2638
2638
  let o;
2639
2639
  try {
2640
- o = Ct.parse(t);
2640
+ o = vt.parse(t);
2641
2641
  } catch (w) {
2642
2642
  return {
2643
2643
  error: F(w)
2644
2644
  };
2645
2645
  }
2646
- const { snapshotName: e, snapshot: n, operations: a, outputLimit: i } = o;
2646
+ const { snapshotName: e, snapshot: n, bulkOperations: a, outputLimit: i } = o;
2647
2647
  if (!s.sessionId)
2648
2648
  return {
2649
2649
  error: "Session ID is required"
2650
2650
  };
2651
- const c = Z(s.sessionId);
2651
+ const c = X(s.sessionId);
2652
2652
  if (e && n)
2653
2653
  return {
2654
2654
  error: "Either snapshotName or snapshot must be provided, not both"
@@ -2660,7 +2660,7 @@ async function xs(t, r, s) {
2660
2660
  error: `Filesystem snapshot "${e}" not found`
2661
2661
  };
2662
2662
  } else if (n) {
2663
- const w = await le(
2663
+ const w = await ce(
2664
2664
  n,
2665
2665
  r,
2666
2666
  s
@@ -2674,29 +2674,29 @@ async function xs(t, r, s) {
2674
2674
  return {
2675
2675
  error: "Either snapshotName or snapshot must be provided"
2676
2676
  };
2677
- const d = $t(l), h = l.query.rootDir ?? ".", g = await Mt({
2677
+ const d = It(l), p = l.query.rootDir ?? ".", g = await Tt({
2678
2678
  filePaths: d,
2679
2679
  operations: a
2680
- }), m = Tt({
2680
+ }), m = Ct({
2681
2681
  result: g,
2682
- rootDir: h
2682
+ rootDir: p
2683
2683
  });
2684
- return { output: ge({
2684
+ return { output: we({
2685
2685
  sessionId: s.sessionId,
2686
2686
  source: m,
2687
2687
  limit: i
2688
- }).content, rootDir: h, fsSnapshot: l, queryCreated: u, snapshotCreated: f };
2688
+ }).content, rootDir: p, fsSnapshot: l, queryCreated: u, snapshotCreated: f };
2689
2689
  }
2690
- function $s(t, r) {
2690
+ function Is(t, r) {
2691
2691
  t(
2692
2692
  "fs-snapshot-search",
2693
2693
  {
2694
2694
  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: Ct.shape
2695
+ 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",
2696
+ inputSchema: vt.shape
2697
2697
  },
2698
2698
  async (s, o) => {
2699
- const e = await xs(
2699
+ const e = await $s(
2700
2700
  s,
2701
2701
  r,
2702
2702
  o
@@ -2711,28 +2711,30 @@ function $s(t, r) {
2711
2711
  `), n += `✅ Search in snapshot "${e.fsSnapshot.name}":
2712
2712
  `, n += `Root directory (<root>/): ${e.rootDir}
2713
2713
  `, 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;
2714
+ ${e.output}`, n += `
2715
+
2716
+ 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
2717
  }
2716
2718
  );
2717
2719
  }
2718
- const Is = 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
- }), Nt = p.object({
2723
- snapshotName: p.string().optional().describe("Name of previously created filesystem snapshot, to use"),
2724
- snapshot: X.optional().describe(
2720
+ const Ms = h.object({
2721
+ pattern: h.string().describe("JS RegExp pattern"),
2722
+ flags: h.string().optional().describe("JS RegExp flags"),
2723
+ replacement: h.string().describe("JS replacement pattern")
2724
+ }), Nt = h.object({
2725
+ snapshotName: h.string().optional().describe("Name of previously created filesystem snapshot, to use"),
2726
+ snapshot: ee.optional().describe(
2725
2727
  "Filesystem snapshot creation options JSON to automatically create snapshot"
2726
2728
  ),
2727
- operations: p.array(Is).describe("Replace operations to execute sequentially on each file"),
2728
- outputLimit: p.number().int().min(0).max(B).default(B).describe(
2729
- `Maximum output characters. Output exceeding this limit will be truncated. Maximum: ${B}. Default: ${B}`
2729
+ bulkOperations: h.array(Ms).describe("All replace patterns to execute; include every pattern here; never split across multiple calls"),
2730
+ outputLimit: h.number().int().min(0).max(J).default(Q).describe(
2731
+ `Maximum output characters. Output exceeding this limit will be truncated. Maximum: ${J}. Default: ${Q}`
2730
2732
  ),
2731
- dryRun: p.boolean().optional().describe(
2733
+ dryRun: h.boolean().optional().describe(
2732
2734
  "Preview changes without writing files. When true, shows what would be replaced but does not modify files"
2733
2735
  )
2734
2736
  });
2735
- async function Ms(t, r, s) {
2737
+ async function Ts(t, r, s) {
2736
2738
  let o;
2737
2739
  try {
2738
2740
  o = Nt.parse(t);
@@ -2741,12 +2743,12 @@ async function Ms(t, r, s) {
2741
2743
  error: F(I)
2742
2744
  };
2743
2745
  }
2744
- const { snapshotName: e, snapshot: n, operations: a, outputLimit: i, dryRun: c } = o;
2746
+ const { snapshotName: e, snapshot: n, bulkOperations: a, outputLimit: i, dryRun: c } = o;
2745
2747
  if (!s.sessionId)
2746
2748
  return {
2747
2749
  error: "Session ID is required"
2748
2750
  };
2749
- const l = Z(s.sessionId);
2751
+ const l = X(s.sessionId);
2750
2752
  if (e && n)
2751
2753
  return {
2752
2754
  error: "Either snapshotName or snapshot must be provided, not both"
@@ -2758,7 +2760,7 @@ async function Ms(t, r, s) {
2758
2760
  error: `Filesystem snapshot "${e}" not found`
2759
2761
  };
2760
2762
  } else if (n) {
2761
- const I = await le(
2763
+ const I = await ce(
2762
2764
  n,
2763
2765
  r,
2764
2766
  s
@@ -2772,30 +2774,30 @@ async function Ms(t, r, s) {
2772
2774
  return {
2773
2775
  error: "Either snapshotName or snapshot must be provided"
2774
2776
  };
2775
- const h = $t(u), g = u.query.rootDir ?? ".", m = await Mt({
2776
- filePaths: h,
2777
+ const p = It(u), g = u.query.rootDir ?? ".", m = await Tt({
2778
+ filePaths: p,
2777
2779
  operations: a,
2778
2780
  dryRun: c
2779
- }), y = Tt({
2781
+ }), y = Ct({
2780
2782
  result: m,
2781
2783
  rootDir: g
2782
2784
  });
2783
- return { output: ge({
2785
+ return { output: we({
2784
2786
  sessionId: s.sessionId,
2785
2787
  source: y,
2786
2788
  limit: i
2787
2789
  }).content, rootDir: g, fsSnapshot: u, queryCreated: f, snapshotCreated: d };
2788
2790
  }
2789
- function Ts(t, r) {
2791
+ function Cs(t, r) {
2790
2792
  t(
2791
2793
  "fs-snapshot-replace",
2792
2794
  {
2793
2795
  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",
2796
+ 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",
2795
2797
  inputSchema: Nt.shape
2796
2798
  },
2797
2799
  async (s, o) => {
2798
- const e = await Ms(
2800
+ const e = await Ts(
2799
2801
  s,
2800
2802
  r,
2801
2803
  o
@@ -2810,36 +2812,38 @@ function Ts(t, r) {
2810
2812
  `), n += `✅ Replace in snapshot "${e.fsSnapshot.name}":
2811
2813
  `, n += `Root directory (<root>/): ${e.rootDir}
2812
2814
  `, 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;
2815
+ ${e.output}`, n += `
2816
+
2817
+ 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
2818
  }
2815
2819
  );
2816
2820
  }
2817
- function Cs(t, r) {
2818
- r.list && Jr(t, r), r.snapshotQueryCreate && Kr(t, r), r.snapshotCreate && es(t, r), r.snapshotBrowse && ns(t, r), r.snapshotSearch && $s(t, r), r.snapshotReplace && Ts(t, r), console.log(
2821
+ function vs(t, r) {
2822
+ 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
2823
  `File manager:
2820
2824
  - Working directory: ${R.resolve(r.workingDir || "")}
2821
2825
  `
2822
2826
  );
2823
2827
  }
2824
- const fe = /* @__PURE__ */ new Map();
2828
+ const pe = /* @__PURE__ */ new Map();
2825
2829
  function j(t) {
2826
- return fe.has(t) || fe.set(t, {
2830
+ return pe.has(t) || pe.set(t, {
2827
2831
  browsers: /* @__PURE__ */ new Map(),
2828
2832
  domSnapshotQueries: /* @__PURE__ */ new Map()
2829
- }), fe.get(t);
2833
+ }), pe.get(t);
2830
2834
  }
2831
- const Se = p.object({
2832
- name: p.string().describe(
2835
+ const xe = h.object({
2836
+ name: h.string().describe(
2833
2837
  "Unique name for the browser. Recommended format: kebab-case-1, kebab-case-2, ..."
2834
2838
  ),
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")
2839
+ browserType: h.enum(["chromium", "firefox", "webkit"]).describe("Browser type to launch"),
2840
+ muteAudio: h.boolean().optional().describe("Mute audio in the browser"),
2841
+ devTools: h.boolean().optional().describe("Open browser with dev tools")
2838
2842
  });
2839
- async function vt(t, r, s) {
2843
+ async function Et(t, r, s) {
2840
2844
  let o;
2841
2845
  try {
2842
- o = Se.parse(t);
2846
+ o = xe.parse(t);
2843
2847
  } catch (l) {
2844
2848
  return {
2845
2849
  error: F(l)
@@ -2853,9 +2857,9 @@ async function vt(t, r, s) {
2853
2857
  const c = j(s.sessionId);
2854
2858
  try {
2855
2859
  const u = await {
2856
- chromium: er,
2857
- firefox: Xt,
2858
- webkit: Zt
2860
+ chromium: tr,
2861
+ firefox: er,
2862
+ webkit: Xt
2859
2863
  }[n].launch({
2860
2864
  headless: !1,
2861
2865
  devtools: i,
@@ -2879,20 +2883,20 @@ function Ns(t, r) {
2879
2883
  {
2880
2884
  title: "Create Browser",
2881
2885
  description: "Create a new browser. Prefer page-goto if you need to immediately create a browser, context, page and navigate",
2882
- inputSchema: Se.shape
2886
+ inputSchema: xe.shape
2883
2887
  },
2884
2888
  async (s, o) => {
2885
- const e = await vt(s, r, o);
2889
+ const e = await Et(s, r, o);
2886
2890
  return `Method: playwright-browser-create(${JSON.stringify(s)})
2887
2891
  ${e.error != null ? `❌ Error: ${e.error}` : `✅ Browser "${e.browserInfo.name}" (${e.browserInfo.browserType}) created successfully`}`;
2888
2892
  }
2889
2893
  );
2890
2894
  }
2891
- const Et = p.object({});
2892
- async function vs(t, r, s) {
2895
+ const kt = h.object({});
2896
+ async function Es(t, r, s) {
2893
2897
  let o;
2894
2898
  try {
2895
- o = Et.parse(t);
2899
+ o = kt.parse(t);
2896
2900
  } catch (a) {
2897
2901
  return {
2898
2902
  error: F(a)
@@ -2907,16 +2911,16 @@ async function vs(t, r, s) {
2907
2911
  browserInfos: Array.from(e.browsers.values())
2908
2912
  };
2909
2913
  }
2910
- function Es(t, r) {
2914
+ function ks(t, r) {
2911
2915
  t(
2912
2916
  "playwright-browser-list",
2913
2917
  {
2914
2918
  title: "List Browsers",
2915
2919
  description: "List active browser instances",
2916
- inputSchema: Et.shape
2920
+ inputSchema: kt.shape
2917
2921
  },
2918
2922
  async (s, o) => {
2919
- const e = await vs(s, r, o);
2923
+ const e = await Es(s, r, o);
2920
2924
  if (e.error != null)
2921
2925
  return `Method: playwright-browser-list(${JSON.stringify(s)})
2922
2926
  ❌ Error: ${e.error}`;
@@ -2928,15 +2932,15 @@ ${n.length === 0 ? "No browsers found" : `Browsers: ${n.join(", ")}`}`;
2928
2932
  }
2929
2933
  );
2930
2934
  }
2931
- const kt = p.object({
2932
- names: p.array(p.string()).optional().describe(
2935
+ const Ot = h.object({
2936
+ names: h.array(h.string()).optional().describe(
2933
2937
  "Names of browsers to close. If not specified, closes all browsers"
2934
2938
  )
2935
2939
  });
2936
- async function ks(t, r, s) {
2940
+ async function Os(t, r, s) {
2937
2941
  let o;
2938
2942
  try {
2939
- o = kt.parse(t);
2943
+ o = Ot.parse(t);
2940
2944
  } catch (l) {
2941
2945
  return {
2942
2946
  error: F(l)
@@ -2967,16 +2971,16 @@ async function ks(t, r, s) {
2967
2971
  ...i.length > 0 && { errors: i }
2968
2972
  };
2969
2973
  }
2970
- function Os(t, r) {
2974
+ function Ds(t, r) {
2971
2975
  t(
2972
2976
  "playwright-browser-close",
2973
2977
  {
2974
2978
  title: "Close Browsers",
2975
2979
  description: "Close browsers. Automatically closes all contexts and pages within the browsers",
2976
- inputSchema: kt.shape
2980
+ inputSchema: Ot.shape
2977
2981
  },
2978
2982
  async (s, o) => {
2979
- const e = await ks(s, r, o);
2983
+ const e = await Os(s, r, o);
2980
2984
  if (e.error != null)
2981
2985
  return `Method: playwright-browser-close(${JSON.stringify(s)})
2982
2986
  ❌ Error: ${e.error}`;
@@ -2993,28 +2997,28 @@ ${n.join(`
2993
2997
  }
2994
2998
  );
2995
2999
  }
2996
- const xe = p.object({
2997
- browserName: p.string().optional().describe("Name of previously created browser, to use"),
2998
- browser: Se.optional().describe(
3000
+ const $e = h.object({
3001
+ browserName: h.string().optional().describe("Name of previously created browser, to use"),
3002
+ browser: xe.optional().describe(
2999
3003
  "Browser creation options JSON to automatically create browser"
3000
3004
  ),
3001
- name: p.string().describe(
3005
+ name: h.string().describe(
3002
3006
  "Unique name for the context. Recommended format: kebab-case-1, kebab-case-2, ..."
3003
3007
  ),
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()
3008
+ isMobile: h.boolean().optional().describe("Configure for mobile device simulation"),
3009
+ hasTouch: h.boolean().optional().describe("Enable touch events"),
3010
+ viewport: h.object({
3011
+ width: h.number(),
3012
+ height: h.number()
3009
3013
  }).optional().describe("Viewport size configuration")
3010
3014
  });
3011
- async function Ot(t, r, s) {
3015
+ async function Dt(t, r, s) {
3012
3016
  let o;
3013
3017
  try {
3014
- o = xe.parse(t);
3015
- } catch (h) {
3018
+ o = $e.parse(t);
3019
+ } catch (p) {
3016
3020
  return {
3017
- error: F(h)
3021
+ error: F(p)
3018
3022
  };
3019
3023
  }
3020
3024
  const { name: e, browserName: n, browser: a, isMobile: i, hasTouch: c, viewport: l } = o;
@@ -3034,25 +3038,25 @@ async function Ot(t, r, s) {
3034
3038
  error: `Browser "${n}" not found`
3035
3039
  };
3036
3040
  } else if (a) {
3037
- const h = await vt(a, r, s);
3038
- if (h.error != null)
3041
+ const p = await Et(a, r, s);
3042
+ if (p.error != null)
3039
3043
  return {
3040
- error: h.error
3044
+ error: p.error
3041
3045
  };
3042
- d = h.browserInfo, f = !0;
3046
+ d = p.browserInfo, f = !0;
3043
3047
  } else
3044
3048
  return {
3045
3049
  error: "Either browserName or browser must be provided"
3046
3050
  };
3047
3051
  try {
3048
- const h = await d.browser.newContext({
3052
+ const p = await d.browser.newContext({
3049
3053
  isMobile: i,
3050
3054
  hasTouch: c,
3051
3055
  viewport: l
3052
3056
  }), g = {
3053
3057
  browserInfo: d,
3054
3058
  name: e,
3055
- context: h,
3059
+ context: p,
3056
3060
  pages: /* @__PURE__ */ new Map()
3057
3061
  };
3058
3062
  return d.contexts.set(e, g), {
@@ -3060,22 +3064,22 @@ async function Ot(t, r, s) {
3060
3064
  browserInfo: d,
3061
3065
  contextInfo: g
3062
3066
  };
3063
- } catch (h) {
3067
+ } catch (p) {
3064
3068
  return {
3065
- error: `Failed to create context: ${h instanceof Error ? h.message : "Unknown error"} in browser "${d.name}" (${d.browserType})`
3069
+ error: `Failed to create context: ${p instanceof Error ? p.message : "Unknown error"} in browser "${d.name}" (${d.browserType})`
3066
3070
  };
3067
3071
  }
3068
3072
  }
3069
- function Ds(t, r) {
3073
+ function Rs(t, r) {
3070
3074
  t(
3071
3075
  "playwright-context-create",
3072
3076
  {
3073
3077
  title: "Create Browser Context",
3074
3078
  description: "Create a new browser context. Prefer page-goto if you need to immediately create a context, page and navigate",
3075
- inputSchema: xe.shape
3079
+ inputSchema: $e.shape
3076
3080
  },
3077
3081
  async (s, o) => {
3078
- const e = await Ot(s, r, o);
3082
+ const e = await Dt(s, r, o);
3079
3083
  if (e.error != null)
3080
3084
  return `Method: playwright-context-create(${JSON.stringify(s)})
3081
3085
  ❌ Error: ${e.error}`;
@@ -3086,15 +3090,15 @@ function Ds(t, r) {
3086
3090
  }
3087
3091
  );
3088
3092
  }
3089
- const Dt = p.object({
3090
- browserName: p.string().optional().describe(
3093
+ const Rt = h.object({
3094
+ browserName: h.string().optional().describe(
3091
3095
  "Name of browser to list contexts from. If not specified, lists contexts from all browsers"
3092
3096
  )
3093
3097
  });
3094
- async function Rs(t, r, s) {
3098
+ async function Fs(t, r, s) {
3095
3099
  let o;
3096
3100
  try {
3097
- o = Dt.parse(t);
3101
+ o = Rt.parse(t);
3098
3102
  } catch (i) {
3099
3103
  return {
3100
3104
  error: F(i)
@@ -3128,16 +3132,16 @@ async function Rs(t, r, s) {
3128
3132
  contextsByBrowser: a
3129
3133
  };
3130
3134
  }
3131
- function Fs(t, r) {
3135
+ function Bs(t, r) {
3132
3136
  t(
3133
3137
  "playwright-context-list",
3134
3138
  {
3135
3139
  title: "List Browser Contexts",
3136
3140
  description: "List active browser contexts",
3137
- inputSchema: Dt.shape
3141
+ inputSchema: Rt.shape
3138
3142
  },
3139
3143
  async (s, o) => {
3140
- const e = await Rs(s, r, o);
3144
+ const e = await Fs(s, r, o);
3141
3145
  if ("error" in e)
3142
3146
  return `Method: playwright-context-list(${JSON.stringify(s)})
3143
3147
  ❌ Error: ${e.error}`;
@@ -3150,18 +3154,18 @@ function Fs(t, r) {
3150
3154
  }
3151
3155
  );
3152
3156
  }
3153
- const Rt = p.object({
3154
- names: p.array(p.string()).optional().describe(
3157
+ const Ft = h.object({
3158
+ names: h.array(h.string()).optional().describe(
3155
3159
  "Names of contexts to close. If not specified, closes all contexts"
3156
3160
  ),
3157
- browserName: p.string().optional().describe(
3161
+ browserName: h.string().optional().describe(
3158
3162
  "Name of browser to close contexts from. If not specified, searches all browsers"
3159
3163
  )
3160
3164
  });
3161
- async function Bs(t, r, s) {
3165
+ async function Ls(t, r, s) {
3162
3166
  let o;
3163
3167
  try {
3164
- o = Rt.parse(t);
3168
+ o = Ft.parse(t);
3165
3169
  } catch (u) {
3166
3170
  return {
3167
3171
  error: F(u)
@@ -3212,16 +3216,16 @@ async function Bs(t, r, s) {
3212
3216
  ...c.length > 0 && { errors: c }
3213
3217
  };
3214
3218
  }
3215
- function Ls(t, r) {
3219
+ function Ps(t, r) {
3216
3220
  t(
3217
3221
  "playwright-context-close",
3218
3222
  {
3219
3223
  title: "Close Browser Contexts",
3220
3224
  description: "Close browser contexts. Automatically closes all pages within the contexts",
3221
- inputSchema: Rt.shape
3225
+ inputSchema: Ft.shape
3222
3226
  },
3223
3227
  async (s, o) => {
3224
- const e = await Bs(s, r, o);
3228
+ const e = await Ls(s, r, o);
3225
3229
  if ("error" in e)
3226
3230
  return `Method: playwright-context-close(${JSON.stringify(s)})
3227
3231
  ❌ Error: ${e.error}`;
@@ -3238,7 +3242,7 @@ ${n.join(`
3238
3242
  }
3239
3243
  );
3240
3244
  }
3241
- function Ps() {
3245
+ function As() {
3242
3246
  class t {
3243
3247
  prevId = 0;
3244
3248
  objectToId = /* @__PURE__ */ new WeakMap();
@@ -3264,32 +3268,32 @@ function Ps() {
3264
3268
  function r(i, c, l) {
3265
3269
  let u = null;
3266
3270
  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);
3271
+ const p = c[f], g = i(p), m = g == null ? null : r(i, g, l), y = l(p, m);
3268
3272
  y != null && (u == null && (u = []), u.push(y));
3269
3273
  }
3270
3274
  return u;
3271
3275
  }
3272
3276
  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(
3277
+ 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
3278
  l,
3275
3279
  u,
3276
3280
  (w, I) => {
3277
- const v = f(w, I);
3278
- if (w != null && v != null) {
3281
+ const N = f(w, I);
3282
+ if (w != null && N != null) {
3279
3283
  const b = c(w);
3280
- d.set(b, v), h.set(v, b);
3284
+ d.set(b, N), p.set(N, b);
3281
3285
  }
3282
- return v != null && I != null && g.set(
3283
- h.get(v),
3284
- I.map((b) => h.get(b))
3285
- ), v;
3286
+ return N != null && I != null && g.set(
3287
+ p.get(N),
3288
+ I.map((b) => p.get(b))
3289
+ ), N;
3286
3290
  }
3287
3291
  ), y = f(null, m);
3288
3292
  if (y == null)
3289
3293
  throw new Error("Impossible behavior: rootNode == null");
3290
3294
  return d.set(null, y), m != null && g.set(
3291
3295
  null,
3292
- m.map((w) => h.get(w))
3296
+ m.map((w) => p.get(w))
3293
3297
  ), {
3294
3298
  idToNode: d,
3295
3299
  idToChildIds: g
@@ -3299,16 +3303,16 @@ function Ps() {
3299
3303
  function e(i) {
3300
3304
  return function(l, u) {
3301
3305
  const f = u != null && u.length > 0;
3302
- let d = !1, h = null, g = null;
3306
+ let d = !1, p = null, g = null;
3303
3307
  if (l instanceof HTMLElement) {
3304
- if (h = n.getOrCreateId(l), g = l.tagName.toLowerCase(), d = l.matches(i.cssSelector), !d && !f)
3308
+ if (p = n.getOrCreateId(l), g = l.tagName.toLowerCase(), d = l.matches(i.cssSelector), !d && !f)
3305
3309
  return null;
3306
3310
  } else if (l == null)
3307
- h = null, g = null, d = !1;
3311
+ p = null, g = null, d = !1;
3308
3312
  else
3309
3313
  return null;
3310
3314
  return {
3311
- uid: h,
3315
+ uid: p,
3312
3316
  tagName: g,
3313
3317
  isMatched: d
3314
3318
  };
@@ -3326,19 +3330,19 @@ function Ps() {
3326
3330
  }
3327
3331
  window.__mcp_playwright_tool_tx4byhar35_createDomSnapshotTreeRawDom = a;
3328
3332
  }
3329
- const As = `(function (){function __name(fn){return fn};${Ps.toString()}; setupPageGlobals();})()`, $e = p.object({
3330
- contextName: p.string().optional().describe("Name of previously created context, to use"),
3331
- context: xe.optional().describe(
3333
+ const zs = `(function (){function __name(fn){return fn};${As.toString()}; setupPageGlobals();})()`, Ie = h.object({
3334
+ contextName: h.string().optional().describe("Name of previously created context, to use"),
3335
+ context: $e.optional().describe(
3332
3336
  "Context creation options JSON to automatically create context"
3333
3337
  ),
3334
- name: p.string().describe(
3338
+ name: h.string().describe(
3335
3339
  "Unique name for the page. Recommended format: kebab-case-1, kebab-case-2, ..."
3336
3340
  )
3337
3341
  });
3338
- async function Ft(t, r, s) {
3342
+ async function Bt(t, r, s) {
3339
3343
  let o;
3340
3344
  try {
3341
- o = $e.parse(t);
3345
+ o = Ie.parse(t);
3342
3346
  } catch (f) {
3343
3347
  return {
3344
3348
  error: F(f)
@@ -3366,7 +3370,7 @@ async function Ft(t, r, s) {
3366
3370
  error: `Context "${n}" not found`
3367
3371
  };
3368
3372
  } else if (a) {
3369
- const f = await Ot(a, r, s);
3373
+ const f = await Dt(a, r, s);
3370
3374
  if (f.error != null)
3371
3375
  return {
3372
3376
  error: f.error
@@ -3378,7 +3382,7 @@ async function Ft(t, r, s) {
3378
3382
  };
3379
3383
  try {
3380
3384
  const f = await u.context.newPage();
3381
- await f.addInitScript(As), await f.goto("about:blank");
3385
+ await f.addInitScript(zs), await f.goto("about:blank");
3382
3386
  const d = {
3383
3387
  contextInfo: u,
3384
3388
  name: e,
@@ -3396,16 +3400,16 @@ async function Ft(t, r, s) {
3396
3400
  };
3397
3401
  }
3398
3402
  }
3399
- function zs(t, r) {
3403
+ function Us(t, r) {
3400
3404
  t(
3401
3405
  "playwright-page-create",
3402
3406
  {
3403
3407
  title: "Create Page",
3404
3408
  description: "Create a new page. Prefer page-goto if you need to immediately create a page and navigate",
3405
- inputSchema: $e.shape
3409
+ inputSchema: Ie.shape
3406
3410
  },
3407
3411
  async (s, o) => {
3408
- const e = await Ft(s, r, o);
3412
+ const e = await Bt(s, r, o);
3409
3413
  if (e.error != null)
3410
3414
  return `Method: playwright-page-create(${JSON.stringify(s)})
3411
3415
  ❌ Error: ${e.error}`;
@@ -3417,18 +3421,18 @@ function zs(t, r) {
3417
3421
  }
3418
3422
  );
3419
3423
  }
3420
- const Bt = p.object({
3421
- contextName: p.string().optional().describe(
3424
+ const Lt = h.object({
3425
+ contextName: h.string().optional().describe(
3422
3426
  "Name of context to list pages from. If not specified, lists pages from all contexts"
3423
3427
  ),
3424
- browserName: p.string().optional().describe(
3428
+ browserName: h.string().optional().describe(
3425
3429
  "Name of browser to search in. If not specified, searches all browsers"
3426
3430
  )
3427
3431
  });
3428
- async function Us(t, r, s) {
3432
+ async function qs(t, r, s) {
3429
3433
  let o;
3430
3434
  try {
3431
- o = Bt.parse(t);
3435
+ o = Lt.parse(t);
3432
3436
  } catch (c) {
3433
3437
  return {
3434
3438
  error: F(c)
@@ -3489,16 +3493,16 @@ async function Us(t, r, s) {
3489
3493
  pagesByContext: i
3490
3494
  };
3491
3495
  }
3492
- function qs(t, r) {
3496
+ function Gs(t, r) {
3493
3497
  t(
3494
3498
  "playwright-page-list",
3495
3499
  {
3496
3500
  title: "List Pages",
3497
3501
  description: "List active pages",
3498
- inputSchema: Bt.shape
3502
+ inputSchema: Lt.shape
3499
3503
  },
3500
3504
  async (s, o) => {
3501
- const e = await Us(s, r, o);
3505
+ const e = await qs(s, r, o);
3502
3506
  if ("error" in e)
3503
3507
  return `Method: playwright-page-list(${JSON.stringify(s)})
3504
3508
  ❌ Error: ${e.error}`;
@@ -3511,19 +3515,19 @@ function qs(t, r) {
3511
3515
  }
3512
3516
  );
3513
3517
  }
3514
- const Lt = 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(
3518
+ const Pt = h.object({
3519
+ names: h.array(h.string()).optional().describe("Names of pages to close. If not specified, closes all pages"),
3520
+ contextName: h.string().optional().describe(
3517
3521
  "Name of context to close pages from. If not specified, searches all contexts"
3518
3522
  ),
3519
- browserName: p.string().optional().describe(
3523
+ browserName: h.string().optional().describe(
3520
3524
  "Name of browser to search in. If not specified, searches all browsers"
3521
3525
  )
3522
3526
  });
3523
3527
  async function _s(t, r, s) {
3524
3528
  let o;
3525
3529
  try {
3526
- o = Lt.parse(t);
3530
+ o = Pt.parse(t);
3527
3531
  } catch (f) {
3528
3532
  return {
3529
3533
  error: F(f)
@@ -3548,37 +3552,37 @@ async function _s(t, r, s) {
3548
3552
  return {
3549
3553
  error: `Context "${n}" not found in browser "${f.name}" (${f.browserType})`
3550
3554
  };
3551
- e ? e.forEach((h) => {
3552
- const g = d.pages.get(h);
3555
+ e ? e.forEach((p) => {
3556
+ const g = d.pages.get(p);
3553
3557
  g ? u.push(g) : l.push(
3554
- `Page "${h}" not found in context "${d.name}" in browser "${f.name}" (${f.browserType})`
3558
+ `Page "${p}" not found in context "${d.name}" in browser "${f.name}" (${f.browserType})`
3555
3559
  );
3556
3560
  }) : u = Array.from(d.pages.values());
3557
3561
  } else
3558
3562
  for (const d of f.contexts.values())
3559
- e ? e.forEach((h) => {
3560
- const g = d.pages.get(h);
3563
+ e ? e.forEach((p) => {
3564
+ const g = d.pages.get(p);
3561
3565
  g ? u.push(g) : l.push(
3562
- `Page "${h}" not found in context "${d.name}" in browser "${f.name}" (${f.browserType})`
3566
+ `Page "${p}" not found in context "${d.name}" in browser "${f.name}" (${f.browserType})`
3563
3567
  );
3564
3568
  }) : u.push(...Array.from(d.pages.values()));
3565
3569
  } else if (n)
3566
3570
  for (const f of i.browsers.values()) {
3567
3571
  const d = f.contexts.get(n);
3568
- d && (e ? e.forEach((h) => {
3569
- const g = d.pages.get(h);
3572
+ d && (e ? e.forEach((p) => {
3573
+ const g = d.pages.get(p);
3570
3574
  g ? u.push(g) : l.push(
3571
- `Page "${h}" not found in context "${d.name}" in browser "${f.name}" (${f.browserType})`
3575
+ `Page "${p}" not found in context "${d.name}" in browser "${f.name}" (${f.browserType})`
3572
3576
  );
3573
3577
  }) : u.push(...Array.from(d.pages.values())));
3574
3578
  }
3575
3579
  else
3576
3580
  for (const f of i.browsers.values())
3577
3581
  for (const d of f.contexts.values())
3578
- e ? e.forEach((h) => {
3579
- const g = d.pages.get(h);
3582
+ e ? e.forEach((p) => {
3583
+ const g = d.pages.get(p);
3580
3584
  g ? u.push(g) : l.push(
3581
- `Page "${h}" not found in context "${d.name}" in browser "${f.name}" (${f.browserType})`
3585
+ `Page "${p}" not found in context "${d.name}" in browser "${f.name}" (${f.browserType})`
3582
3586
  );
3583
3587
  }) : u.push(...Array.from(d.pages.values()));
3584
3588
  return await Promise.all(
@@ -3598,13 +3602,13 @@ async function _s(t, r, s) {
3598
3602
  ...l.length > 0 && { errors: l }
3599
3603
  };
3600
3604
  }
3601
- function Gs(t, r) {
3605
+ function Js(t, r) {
3602
3606
  t(
3603
3607
  "playwright-page-close",
3604
3608
  {
3605
3609
  title: "Close Pages",
3606
3610
  description: "Close pages",
3607
- inputSchema: Lt.shape
3611
+ inputSchema: Pt.shape
3608
3612
  },
3609
3613
  async (s, o) => {
3610
3614
  const e = await _s(s, r, o);
@@ -3618,14 +3622,14 @@ ${n.join(`
3618
3622
  }
3619
3623
  );
3620
3624
  }
3621
- const Pt = p.object({
3622
- pageName: p.string().optional().describe("Name of previously created page to navigate"),
3623
- page: $e.optional().describe(
3625
+ const At = h.object({
3626
+ pageName: h.string().optional().describe("Name of previously created page to navigate"),
3627
+ page: Ie.optional().describe(
3624
3628
  "Page creation options JSON to automatically create page"
3625
3629
  ),
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(
3630
+ url: h.string().describe("URL to navigate to"),
3631
+ timeout: h.number().describe("Timeout in seconds"),
3632
+ waitUntil: h.enum(["load", "domcontentloaded", "networkidle", "commit"]).describe(
3629
3633
  `Wait until event:
3630
3634
  - 'domcontentloaded': DOMContentLoaded event is fired
3631
3635
  - 'load': load event is fired
@@ -3633,10 +3637,10 @@ const Pt = p.object({
3633
3637
  - 'commit': network response received and document started loading`
3634
3638
  )
3635
3639
  });
3636
- async function Js(t, r, s) {
3640
+ async function js(t, r, s) {
3637
3641
  let o;
3638
3642
  try {
3639
- o = Pt.parse(t);
3643
+ o = At.parse(t);
3640
3644
  } catch (g) {
3641
3645
  return {
3642
3646
  error: F(g)
@@ -3652,33 +3656,33 @@ async function Js(t, r, s) {
3652
3656
  return {
3653
3657
  error: "Either pageName or page must be provided, not both"
3654
3658
  };
3655
- let u = !1, f = !1, d = !1, h;
3659
+ let u = !1, f = !1, d = !1, p;
3656
3660
  if (e) {
3657
3661
  for (const g of l.browsers.values()) {
3658
3662
  for (const m of g.contexts.values())
3659
3663
  if (m.pages.has(e)) {
3660
- h = m.pages.get(e);
3664
+ p = m.pages.get(e);
3661
3665
  break;
3662
3666
  }
3663
- if (h) break;
3667
+ if (p) break;
3664
3668
  }
3665
- if (!h)
3669
+ if (!p)
3666
3670
  return {
3667
3671
  error: `Page "${e}" not found`
3668
3672
  };
3669
3673
  } else if (n) {
3670
- const g = await Ft(n, r, s);
3674
+ const g = await Bt(n, r, s);
3671
3675
  if (g.error != null)
3672
3676
  return {
3673
3677
  error: g.error
3674
3678
  };
3675
- h = g.pageInfo, u = g.browserInfoCreated, f = g.contextInfoCreated, d = !0;
3679
+ p = g.pageInfo, u = g.browserInfoCreated, f = g.contextInfoCreated, d = !0;
3676
3680
  } else
3677
3681
  return {
3678
3682
  error: "Either pageName or page must be provided"
3679
3683
  };
3680
3684
  try {
3681
- const g = await h.page.goto(a, {
3685
+ const g = await p.page.goto(a, {
3682
3686
  timeout: i * 1e3,
3683
3687
  waitUntil: c
3684
3688
  });
@@ -3686,13 +3690,13 @@ async function Js(t, r, s) {
3686
3690
  browserInfoCreated: u,
3687
3691
  contextInfoCreated: f,
3688
3692
  pageInfoCreated: d,
3689
- pageInfo: h,
3693
+ pageInfo: p,
3690
3694
  status: g.status()
3691
3695
  } : {
3692
3696
  browserInfoCreated: u,
3693
3697
  contextInfoCreated: f,
3694
3698
  pageInfoCreated: d,
3695
- pageInfo: h,
3699
+ pageInfo: p,
3696
3700
  status: 200
3697
3701
  };
3698
3702
  } catch (g) {
@@ -3701,16 +3705,16 @@ async function Js(t, r, s) {
3701
3705
  };
3702
3706
  }
3703
3707
  }
3704
- function js(t, r) {
3708
+ function Ks(t, r) {
3705
3709
  t(
3706
3710
  "playwright-page-goto",
3707
3711
  {
3708
3712
  title: "Navigate Page",
3709
3713
  description: "Navigate page to URL. Use for manual browser interaction",
3710
- inputSchema: Pt.shape
3714
+ inputSchema: At.shape
3711
3715
  },
3712
3716
  async (s, o) => {
3713
- const e = await Js(s, r, o);
3717
+ const e = await js(s, r, o);
3714
3718
  if (e.error != null)
3715
3719
  return `Method: playwright-page-goto(${JSON.stringify(s)})
3716
3720
  ❌ Error: ${e.error}`;
@@ -3723,16 +3727,16 @@ function js(t, r) {
3723
3727
  }
3724
3728
  );
3725
3729
  }
3726
- const Ie = p.object({
3727
- name: p.string().describe(
3730
+ const Me = h.object({
3731
+ name: h.string().describe(
3728
3732
  "Unique name for the DOM snapshot query. Recommended format: kebab-case-1, kebab-case-2, ..."
3729
3733
  ),
3730
- cssSelector: p.string().describe("CSS selector to capture page content")
3734
+ cssSelector: h.string().describe("CSS selector to capture page content")
3731
3735
  });
3732
- async function At(t, r, s) {
3736
+ async function zt(t, r, s) {
3733
3737
  let o;
3734
3738
  try {
3735
- o = Ie.parse(t);
3739
+ o = Me.parse(t);
3736
3740
  } catch (c) {
3737
3741
  return {
3738
3742
  error: F(c)
@@ -3751,23 +3755,23 @@ async function At(t, r, s) {
3751
3755
  snapshotQuery: i
3752
3756
  };
3753
3757
  }
3754
- function Ks(t, r) {
3758
+ function Ws(t, r) {
3755
3759
  t(
3756
3760
  "playwright-dom-snapshot-query-create",
3757
3761
  {
3758
3762
  title: "Create DOM Snapshot Query",
3759
3763
  description: "Create a DOM snapshot query. Prefer dom-snapshot-browse if you need to immediately create a query and snapshot and browse it",
3760
- inputSchema: Ie.shape
3764
+ inputSchema: Me.shape
3761
3765
  },
3762
3766
  async (s, o) => {
3763
- const e = await At(s, r, o);
3767
+ const e = await zt(s, r, o);
3764
3768
  return e.error != null ? `Method: playwright-dom-snapshot-query-create(${JSON.stringify(s)})
3765
3769
  ❌ Error: ${e.error}` : `Method: playwright-dom-snapshot-query-create(${JSON.stringify(s)})
3766
3770
  ✅ DOM snapshot query "${e.snapshotQuery.name}" created successfully`;
3767
3771
  }
3768
3772
  );
3769
3773
  }
3770
- function Ws(t) {
3774
+ function Hs(t) {
3771
3775
  return function(s, o) {
3772
3776
  let e, n = 0;
3773
3777
  const a = o ? o.length : 0;
@@ -3788,23 +3792,23 @@ function Ws(t) {
3788
3792
  textOpen: `<root uid:${u}>`,
3789
3793
  textClose: "</root>"
3790
3794
  };
3791
- const h = yt(d);
3792
- return l += h, {
3795
+ const p = bt(d);
3796
+ return l += p, {
3793
3797
  uid: u,
3794
3798
  tagName: f,
3795
3799
  isMatched: e,
3796
3800
  countMatched: n,
3797
3801
  countChilds: a,
3798
3802
  countTotal: i,
3799
- tokens: h,
3803
+ tokens: p,
3800
3804
  tokensChilds: c,
3801
3805
  tokensTotal: l,
3802
3806
  text: d
3803
3807
  };
3804
3808
  };
3805
3809
  }
3806
- function Hs(t, r) {
3807
- const s = ae(r), o = s.getChilds(s.root), e = wt({
3810
+ function Qs(t, r) {
3811
+ const s = le(r), o = s.getChilds(s.root), e = yt({
3808
3812
  getId: (n) => {
3809
3813
  const a = s.getId(n);
3810
3814
  if (a == null)
@@ -3814,25 +3818,25 @@ function Hs(t, r) {
3814
3818
  return a;
3815
3819
  },
3816
3820
  getChilds: (n) => s.getChilds(n),
3817
- createSnapshotNode: Ws(),
3821
+ createSnapshotNode: Hs(),
3818
3822
  rootNodes: o ?? []
3819
3823
  });
3820
- return ae(e);
3824
+ return le(e);
3821
3825
  }
3822
- const Me = 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"),
3825
- query: Ie.optional().describe(
3826
+ const Te = h.object({
3827
+ pageName: h.string().describe("Name of previously created page, to create snapshot from"),
3828
+ queryName: h.string().optional().describe("Name of previously created DOM snapshot query, to use"),
3829
+ query: Me.optional().describe(
3826
3830
  "DOM snapshot query creation options JSON to automatically create query"
3827
3831
  ),
3828
- name: p.string().describe(
3832
+ name: h.string().describe(
3829
3833
  "Unique name for the DOM snapshot. Recommended format: kebab-case-1, kebab-case-2, ..."
3830
3834
  )
3831
3835
  });
3832
- async function zt(t, r, s) {
3836
+ async function Ut(t, r, s) {
3833
3837
  let o;
3834
3838
  try {
3835
- o = Me.parse(t);
3839
+ o = Te.parse(t);
3836
3840
  } catch (d) {
3837
3841
  return {
3838
3842
  error: F(d)
@@ -3846,9 +3850,9 @@ async function zt(t, r, s) {
3846
3850
  const c = j(s.sessionId);
3847
3851
  let l;
3848
3852
  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);
3853
+ for (const p of d.contexts.values())
3854
+ if (p.pages.has(e)) {
3855
+ l = p.pages.get(e);
3852
3856
  break;
3853
3857
  }
3854
3858
  if (l) break;
@@ -3870,7 +3874,7 @@ async function zt(t, r, s) {
3870
3874
  };
3871
3875
  u = d;
3872
3876
  } else if (a) {
3873
- const d = await At(
3877
+ const d = await zt(
3874
3878
  a,
3875
3879
  r,
3876
3880
  s
@@ -3897,10 +3901,10 @@ async function zt(t, r, s) {
3897
3901
  };
3898
3902
  },
3899
3903
  u
3900
- ), h = {
3904
+ ), p = {
3901
3905
  idToNode: new Map(d.idToNode),
3902
3906
  idToChildIds: new Map(d.idToChildIds)
3903
- }, g = Hs(u, h), m = {
3907
+ }, g = Qs(u, p), m = {
3904
3908
  name: i,
3905
3909
  query: u,
3906
3910
  tree: g
@@ -3915,16 +3919,16 @@ async function zt(t, r, s) {
3915
3919
  };
3916
3920
  }
3917
3921
  }
3918
- function Qs(t, r) {
3922
+ function Ys(t, r) {
3919
3923
  t(
3920
3924
  "playwright-dom-snapshot-create",
3921
3925
  {
3922
3926
  title: "Create DOM Snapshot",
3923
3927
  description: "Create a DOM snapshot of page. Use this to capture webpage state for later browsing. Prefer dom-snapshot-browse if you need to immediately create and browse a snapshot",
3924
- inputSchema: Me.shape
3928
+ inputSchema: Te.shape
3925
3929
  },
3926
3930
  async (s, o) => {
3927
- const e = await zt(s, r, o);
3931
+ const e = await Ut(s, r, o);
3928
3932
  if (e.error != null)
3929
3933
  return `Method: playwright-dom-snapshot-create(${JSON.stringify(s)})
3930
3934
  ❌ Error: ${e.error}`;
@@ -3935,7 +3939,7 @@ function Qs(t, r) {
3935
3939
  }
3936
3940
  );
3937
3941
  }
3938
- class Ys {
3942
+ class Vs {
3939
3943
  tokens = 20;
3940
3944
  getReportText = (r) => ({
3941
3945
  indent: !0,
@@ -3949,13 +3953,13 @@ class Ys {
3949
3953
  tokensGrouped: s.tokens
3950
3954
  } : (r.indexRange[1] = o, r.countGrouped += 1, r.countMatched += s.countMatched, r.tokensGrouped += s.tokens, r);
3951
3955
  }
3952
- const Ut = p.object({
3953
- snapshotName: p.string().optional().describe("Name of previously created DOM snapshot, to use"),
3954
- snapshot: Me.optional().describe(
3956
+ const qt = h.object({
3957
+ snapshotName: h.string().optional().describe("Name of previously created DOM snapshot, to use"),
3958
+ snapshot: Te.optional().describe(
3955
3959
  "DOM snapshot creation options JSON to automatically create snapshot"
3956
3960
  ),
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(
3961
+ parentUid: h.number().optional().describe("UID of parent node to browse. Omit to browse the root node"),
3962
+ childsIndexRange: h.tuple([h.number(), h.number()]).optional().describe(
3959
3963
  "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
3964
  )
3961
3965
  // maxCountTotal: z
@@ -3969,10 +3973,10 @@ const Ut = p.object({
3969
3973
  // maxCountGroup: z.number().default(10).describe('Maximum items per group'),
3970
3974
  // maxTokensGroup: z.number().default(1000).describe('Maximum tokens per group'),
3971
3975
  });
3972
- async function Vs(t, r, s) {
3976
+ async function Zs(t, r, s) {
3973
3977
  let o;
3974
3978
  try {
3975
- o = Ut.parse(t);
3979
+ o = qt.parse(t);
3976
3980
  } catch (m) {
3977
3981
  return {
3978
3982
  error: F(m)
@@ -3996,7 +4000,7 @@ async function Vs(t, r, s) {
3996
4000
  return {
3997
4001
  error: "Either snapshotName or snapshot must be provided, not both"
3998
4002
  };
3999
- let d, h = !1, g = !1;
4003
+ let d, p = !1, g = !1;
4000
4004
  if (e) {
4001
4005
  for (const m of f.browsers.values()) {
4002
4006
  for (const y of m.contexts.values()) {
@@ -4014,7 +4018,7 @@ async function Vs(t, r, s) {
4014
4018
  error: `DOM snapshot "${e}" not found`
4015
4019
  };
4016
4020
  } else if (n) {
4017
- const m = await zt(
4021
+ const m = await Ut(
4018
4022
  n,
4019
4023
  r,
4020
4024
  s
@@ -4023,13 +4027,13 @@ async function Vs(t, r, s) {
4023
4027
  return {
4024
4028
  error: m.error
4025
4029
  };
4026
- d = m.domSnapshot, h = m.queryCreated, g = !0;
4030
+ d = m.domSnapshot, p = m.queryCreated, g = !0;
4027
4031
  } else
4028
4032
  return {
4029
4033
  error: "Either snapshotName or snapshot must be provided"
4030
4034
  };
4031
4035
  try {
4032
- const m = o.parentUid, y = bt({
4036
+ const m = o.parentUid, y = St({
4033
4037
  tree: d.tree,
4034
4038
  request: {
4035
4039
  parentNodeId: m,
@@ -4041,11 +4045,11 @@ async function Vs(t, r, s) {
4041
4045
  maxTokensGroup: u
4042
4046
  }
4043
4047
  },
4044
- indexRangeGroupStrategy: new Ys()
4045
- }), w = St(y);
4048
+ indexRangeGroupStrategy: new Vs()
4049
+ }), w = xt(y);
4046
4050
  return {
4047
4051
  domSnapshot: d,
4048
- queryCreated: h,
4052
+ queryCreated: p,
4049
4053
  snapshotCreated: g,
4050
4054
  parentUid: m,
4051
4055
  childsIndexRange: a,
@@ -4057,16 +4061,16 @@ async function Vs(t, r, s) {
4057
4061
  };
4058
4062
  }
4059
4063
  }
4060
- function Zs(t, r) {
4064
+ function Xs(t, r) {
4061
4065
  t(
4062
4066
  "playwright-dom-snapshot-browse",
4063
4067
  {
4064
4068
  title: "Browse DOM Snapshot",
4065
4069
  description: "Browse and explore DOM. Use this to browse, analyze, explore, inspect, etc webpage structure and styles, find elements, or inspect page content",
4066
- inputSchema: Ut.shape
4070
+ inputSchema: qt.shape
4067
4071
  },
4068
4072
  async (s, o) => {
4069
- const e = await Vs(s, r, o);
4073
+ const e = await Zs(s, r, o);
4070
4074
  if (e.error != null)
4071
4075
  return `Method: playwright-dom-snapshot-browse(${JSON.stringify(s)})
4072
4076
  ❌ Error: ${e.error}`;
@@ -4087,13 +4091,13 @@ ${e.report}`, n;
4087
4091
  }
4088
4092
  );
4089
4093
  }
4090
- function Xs(t, r) {
4091
- r.browserCreate && Ns(t, r), r.browserList && Es(t, r), r.browserClose && Os(t, r), r.contextCreate && Ds(t, r), r.contextList && Fs(t, r), r.contextClose && Ls(t, r), r.pageCreate && zs(t, r), r.pageList && qs(t, r), r.pageClose && Gs(t, r), r.pageGoto && js(t, r), r.domSnapshotQueryCreate && Ks(t, r), r.domSnapshotCreate && Qs(t, r), r.domSnapshotBrowse && Zs(t, r), console.log("Playwright manager");
4094
+ function eo(t, r) {
4095
+ 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
4096
  }
4093
- function eo(t) {
4097
+ function to(t) {
4094
4098
  const { logFilePath: r } = t;
4095
4099
  return async function(o, e, n, a) {
4096
- await ne({
4100
+ await ie({
4097
4101
  logFilePath: r,
4098
4102
  message: "ERROR",
4099
4103
  data: {
@@ -4112,25 +4116,25 @@ function eo(t) {
4112
4116
  });
4113
4117
  };
4114
4118
  }
4115
- function qt() {
4119
+ function Gt() {
4116
4120
  return `mcp_${(/* @__PURE__ */ new Date()).toISOString().substring(0, 19).replace(/T/, "_").replace(/:/g, "-")}.log`;
4117
4121
  }
4118
- function to(t) {
4119
- const r = oe(), s = ro();
4122
+ function ro(t) {
4123
+ const r = ne(), s = so();
4120
4124
  return r.use(s), r;
4121
4125
  }
4122
- function ro(t) {
4123
- const r = oe.Router();
4126
+ function so(t) {
4127
+ const r = ne.Router();
4124
4128
  return r.use((s, o, e) => {
4125
4129
  s.method === "OPTIONS" ? o.status(403).send("CORS forbidden") : e();
4126
- }), r.use(oe.json()), r;
4130
+ }), r.use(ne.json()), r;
4127
4131
  }
4128
- function so(t) {
4129
- const r = oe.Router();
4130
- return r.use(tr({ authToken: t.authToken })), r.all("/mcp", ir(t)), r;
4132
+ function oo(t) {
4133
+ const r = ne.Router();
4134
+ return r.use(rr({ authToken: t.authToken })), r.all("/mcp", ar(t)), r;
4131
4135
  }
4132
- function oo(t, r) {
4133
- return t.use(eo({ logFilePath: r.logFilePath })), new Promise((s, o) => {
4136
+ function no(t, r) {
4137
+ return t.use(to({ logFilePath: r.logFilePath })), new Promise((s, o) => {
4134
4138
  let e;
4135
4139
  const n = () => {
4136
4140
  s(e);
@@ -4144,7 +4148,7 @@ function oo(t, r) {
4144
4148
  }
4145
4149
  });
4146
4150
  }
4147
- function no(t, r) {
4151
+ function io(t, r) {
4148
4152
  if (!t.address())
4149
4153
  throw new Error(
4150
4154
  "Server address is not available. Check your DNS and host configuration."
@@ -4162,16 +4166,16 @@ SSE Endpoint: ${a}/sse
4162
4166
 
4163
4167
  Log File: ${R.resolve(r.logFilePath)}`;
4164
4168
  }
4165
- function io(t, r) {
4166
- const s = R.join(r.logDir, qt()), o = kr(t, {
4169
+ function ao(t, r) {
4170
+ const s = R.join(r.logDir, Gt()), o = Or(t, {
4167
4171
  logFilePath: s
4168
4172
  });
4169
- r.tools.processManager && Er(o, r.tools.processManager), r.tools.fsManager && Cs(o, r.tools.fsManager), r.tools.playwrightManager && Xs(o, {
4173
+ r.tools.processManager && kr(o, r.tools.processManager), r.tools.fsManager && vs(o, r.tools.fsManager), r.tools.playwrightManager && eo(o, {
4170
4174
  ...r.tools.playwrightManager
4171
- }), Sr(o);
4175
+ }), xr(o);
4172
4176
  }
4173
- async function To(t) {
4174
- const r = R.join(t.logDir, qt()), s = to(), o = so({
4177
+ async function Co(t) {
4178
+ const r = R.join(t.logDir, Gt()), s = ro(), o = oo({
4175
4179
  ...t,
4176
4180
  logFilePath: r,
4177
4181
  createMcpServer: () => {
@@ -4180,17 +4184,17 @@ async function To(t) {
4180
4184
  name: t.name,
4181
4185
  version: t.version
4182
4186
  });
4183
- return io(n, t), n;
4187
+ return ao(n, t), n;
4184
4188
  }
4185
4189
  });
4186
4190
  s.use(o);
4187
- const e = await oo(s, {
4191
+ const e = await no(s, {
4188
4192
  host: t.host,
4189
4193
  port: t.port,
4190
4194
  logFilePath: r
4191
4195
  });
4192
4196
  return console.log(
4193
- no(e, {
4197
+ io(e, {
4194
4198
  title: t.title,
4195
4199
  name: t.name,
4196
4200
  version: t.version,
@@ -4199,10 +4203,10 @@ async function To(t) {
4199
4203
  ), e;
4200
4204
  }
4201
4205
  export {
4202
- Mo as A,
4203
- Io as S,
4204
- $o as a,
4205
- xo as b,
4206
+ To as A,
4207
+ Mo as S,
4208
+ Io as a,
4209
+ $o as b,
4206
4210
  _r as p,
4207
- To as s
4211
+ Co as s
4208
4212
  };