@flemist/mcp-project-tools 3.0.1 → 3.0.3

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,21 +1,21 @@
1
- import A from "express";
2
- import * as rt from "cors";
3
- import { McpServer as st } from "@modelcontextprotocol/sdk/server/mcp.js";
4
- import { randomBytes as ot } from "crypto";
5
- import { StreamableHTTPServerTransport as nt } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
6
- import * as B from "fs";
1
+ import G from "express";
2
+ import * as st from "cors";
3
+ import { McpServer as ot } from "@modelcontextprotocol/sdk/server/mcp.js";
4
+ import { randomBytes as nt } from "crypto";
5
+ import { StreamableHTTPServerTransport as it } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
6
+ import * as F from "fs";
7
7
  import * as T from "path";
8
- import it from "path";
9
- import { spawn as at } from "child_process";
8
+ import at from "path";
9
+ import { spawn as lt } from "child_process";
10
10
  import { z as p } from "zod";
11
- import J from "tree-kill";
12
- import { Pool as lt, poolRunWait as U } from "@flemist/time-limits";
13
- import { priorityCreate as z } from "@flemist/priority-queue";
14
- import { useAbortController as ct, combineAbortSignals as ut } from "@flemist/async-utils";
15
- import dt from "node:os";
16
- import ft from "picomatch";
17
- import { webkit as mt, firefox as ht, chromium as pt } from "playwright";
18
- function gt(t) {
11
+ import K from "tree-kill";
12
+ import { Pool as ct, poolRunWait as L } from "@flemist/time-limits";
13
+ import { priorityCreate as P } from "@flemist/priority-queue";
14
+ import { useAbortController as ut, combineAbortSignals as dt } from "@flemist/async-utils";
15
+ import ft from "node:os";
16
+ import mt from "picomatch";
17
+ import { webkit as ht, firefox as pt, chromium as gt } from "playwright";
18
+ function wt(t) {
19
19
  const { authToken: r } = t;
20
20
  return function(o, e, n) {
21
21
  if ((o.query.token || o.headers.authorization?.replace("Bearer ", "")) !== r) {
@@ -25,42 +25,42 @@ function gt(t) {
25
25
  n();
26
26
  };
27
27
  }
28
- async function G(t) {
28
+ async function q(t) {
29
29
  const { logFilePath: r, message: s, data: o } = t;
30
30
  try {
31
31
  const e = (/* @__PURE__ */ new Date()).toISOString().replace(/[TZ]/g, " ").trim(), n = typeof o == "string" ? o : JSON.stringify(o, null, 2), i = `[${e}] ${s}
32
32
  ${n}
33
33
 
34
34
  `;
35
- await B.promises.mkdir(T.dirname(r), { recursive: !0 }), await B.promises.appendFile(r, i);
35
+ await F.promises.mkdir(T.dirname(r), { recursive: !0 }), await F.promises.appendFile(r, i);
36
36
  } catch (e) {
37
37
  console.error(`Failed to log "${s}":`, e);
38
38
  }
39
39
  }
40
- const R = /* @__PURE__ */ new Map();
41
- function wt(t, r) {
40
+ const z = /* @__PURE__ */ new Map();
41
+ function yt(t, r) {
42
42
  return async function(o, e) {
43
43
  const n = o.headers["mcp-session-id"] || o.headers["x-session-id"] || o.query.token;
44
44
  let i;
45
- o.method === "POST" ? (await G({
45
+ o.method === "POST" ? (await q({
46
46
  logFilePath: r.logFilePath,
47
47
  message: "REQUEST",
48
48
  data: o.body
49
- }), n && R.has(n) ? i = R.get(n) : (i = new nt({
50
- sessionIdGenerator: () => n || ot(16).toString("hex"),
49
+ }), n && z.has(n) ? i = z.get(n) : (i = new it({
50
+ sessionIdGenerator: () => n || nt(16).toString("hex"),
51
51
  onsessioninitialized: (a) => {
52
- R.set(a, i), console.log(`Session initialized: ${a}`);
52
+ z.set(a, i), console.log(`Session initialized: ${a}`);
53
53
  },
54
54
  enableJsonResponse: r.enableJsonResponse || !1
55
55
  }), i.onclose = () => {
56
- i.sessionId && (R.delete(i.sessionId), console.log(`Session closed: ${i.sessionId}`));
57
- }, await t.connect(i), n && R.set(n, i)), await i.handleRequest(o, e, o.body)) : o.method === "GET" ? n && R.has(n) ? (i = R.get(n), await i.handleRequest(o, e)) : e.status(400).json({ error: "No valid session" }) : e.status(405).json({ error: "Method not allowed" });
56
+ i.sessionId && (z.delete(i.sessionId), console.log(`Session closed: ${i.sessionId}`));
57
+ }, await t.connect(i), n && z.set(n, i)), await i.handleRequest(o, e, o.body)) : o.method === "GET" ? n && z.has(n) ? (i = z.get(n), await i.handleRequest(o, e)) : e.status(400).json({ error: "No valid session" }) : e.status(405).json({ error: "Method not allowed" });
58
58
  };
59
59
  }
60
- const F = /* @__PURE__ */ new Map();
61
- let yt = 0;
62
- const ne = 10, bt = 1800 * 1e3, k = 2e3, $t = 500, xt = 5e3;
63
- function St(t) {
60
+ const O = /* @__PURE__ */ new Map();
61
+ let bt = 0;
62
+ const ie = 10, xt = 1800 * 1e3, k = 2e3, St = 500, $t = 5e3;
63
+ function It(t) {
64
64
  const { commandLine: r, commandLineRules: s } = t;
65
65
  let o = !1;
66
66
  for (const e of s)
@@ -77,20 +77,20 @@ function St(t) {
77
77
  }
78
78
  return o;
79
79
  }
80
- function It() {
81
- return ++yt;
82
- }
83
- let ie = !1;
84
80
  function Mt() {
85
- if (ie)
81
+ return ++bt;
82
+ }
83
+ let ae = !1;
84
+ function Tt() {
85
+ if (ae)
86
86
  return;
87
- ie = !0;
87
+ ae = !0;
88
88
  const t = () => {
89
89
  console.log("Auto-killing all child processes...");
90
- for (const [r, s] of Array.from(F.entries()))
90
+ for (const [r, s] of Array.from(O.entries()))
91
91
  if (s.isRunning && s.pid)
92
92
  try {
93
- J(s.pid, "SIGKILL");
93
+ K(s.pid, "SIGKILL");
94
94
  } catch (o) {
95
95
  console.error(`Error killing process ${r}:`, o);
96
96
  }
@@ -98,16 +98,16 @@ function Mt() {
98
98
  };
99
99
  process.on("SIGINT", t), process.on("SIGTERM", t);
100
100
  }
101
- function W() {
101
+ function Q() {
102
102
  const t = Date.now(), r = [];
103
- for (const [s, o] of Array.from(F.entries()))
104
- !o.isRunning && o.endTime && t - o.endTime.getTime() > bt && r.push(s);
103
+ for (const [s, o] of Array.from(O.entries()))
104
+ !o.isRunning && o.endTime && t - o.endTime.getTime() > xt && r.push(s);
105
105
  for (const s of r)
106
- F.delete(s);
106
+ O.delete(s);
107
107
  }
108
- function Q(t) {
108
+ function H(t) {
109
109
  const { process: r } = t, s = Date.now();
110
- if (s - r.lastOutputTime.getTime() >= $t && (r.output += r.localOutput, r.localOutput = "", r.lastOutputTime = new Date(s), r.output.length > k)) {
110
+ if (s - r.lastOutputTime.getTime() >= St && (r.output += r.localOutput, r.localOutput = "", r.lastOutputTime = new Date(s), r.output.length > k)) {
111
111
  const n = `
112
112
  ... [${r.output.length - k} characters trimmed] ...
113
113
  `, i = k - n.length;
@@ -120,8 +120,8 @@ function Q(t) {
120
120
  r.output = r.output.substring(0, k);
121
121
  }
122
122
  }
123
- function Tt(t, r) {
124
- const s = r.limit - 35;
123
+ function vt(t, r) {
124
+ const s = r.limit;
125
125
  if (t.length <= s) return t;
126
126
  const e = `
127
127
  ... [${t.length - s} characters trimmed] ...
@@ -131,7 +131,12 @@ function Tt(t, r) {
131
131
  const i = Math.floor(n / 2);
132
132
  return t.substring(0, i) + e + t.substring(t.length - (n - i));
133
133
  }
134
- const Se = p.object({
134
+ function C(t) {
135
+ return `Invalid arguments: ${t instanceof Error ? t.message : "Unknown error"}.
136
+
137
+ Provide valid parameters according to schema.`;
138
+ }
139
+ const Ie = p.object({
135
140
  id: p.number().describe(
136
141
  "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"
137
142
  ),
@@ -139,23 +144,23 @@ const Se = p.object({
139
144
  `Maximum number of output characters to capture and return from the process. Output exceeding this limit will be truncated with beginning/end preserved and middle removed. Maximum: ${k} characters. Default: ${k}.`
140
145
  )
141
146
  });
142
- async function H(t, r) {
143
- W();
147
+ async function Y(t, r) {
148
+ Q();
144
149
  let s;
145
150
  try {
146
- s = Se.parse(t);
151
+ s = Ie.parse(t);
147
152
  } catch (u) {
148
153
  return {
149
- error: `Invalid arguments: ${u instanceof Error ? u.message : "Unknown error"}`
154
+ error: C(u)
150
155
  };
151
156
  }
152
- const { id: o, outputLimit: e } = s, n = F.get(o);
157
+ const { id: o, outputLimit: e } = s, n = O.get(o);
153
158
  if (!n)
154
159
  return {
155
160
  error: `Process ${o} 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.`
156
161
  };
157
- Q({ process: n });
158
- const i = n.output + n.localOutput, a = Tt(i, { limit: e });
162
+ H({ process: n });
163
+ const i = n.output + n.localOutput, a = vt(i, { limit: e });
159
164
  return n.output = "", n.localOutput = "", {
160
165
  id: n.id,
161
166
  cwd: T.relative(r.workingDir || "", n.cwd),
@@ -169,16 +174,16 @@ async function H(t, r) {
169
174
  error: n.error
170
175
  };
171
176
  }
172
- function vt(t, r) {
177
+ function Ct(t, r) {
173
178
  t(
174
179
  "process-status",
175
180
  {
176
181
  title: "Get Host Machine Process Status",
177
182
  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. The output is cleared after retrieval to prevent duplication in subsequent calls",
178
- inputSchema: Se.shape
183
+ inputSchema: Ie.shape
179
184
  },
180
185
  async (s) => {
181
- const o = await H(s, r);
186
+ const o = await Y(s, r);
182
187
  if (!("output" in o))
183
188
  return `Method: process-status(${JSON.stringify(s)})
184
189
  ❌ Error: ${o.error}`;
@@ -191,16 +196,16 @@ ${e.trim()}`;
191
196
  }
192
197
  );
193
198
  }
194
- function Ie(t) {
195
- J(t, "SIGTERM", (r) => {
199
+ function Me(t) {
200
+ K(t, "SIGTERM", (r) => {
196
201
  r && !r.message.includes("not found") && console.error(`Error sending SIGTERM to process ${t}:`, r);
197
202
  }), setTimeout(() => {
198
- J(t, "SIGKILL", (r) => {
203
+ K(t, "SIGKILL", (r) => {
199
204
  r && !r.message.includes("not found") && console.error(`Error sending SIGKILL to process ${t}:`, r);
200
205
  });
201
- }, xt);
206
+ }, $t);
202
207
  }
203
- const Me = p.object({
208
+ const Te = p.object({
204
209
  id: p.number().describe(
205
210
  "Process ID to wait for completion. Get process IDs using process-list. The process can be running or already completed. Examples: 1, 42, 123"
206
211
  ),
@@ -214,16 +219,16 @@ const Me = p.object({
214
219
  `Maximum number of output characters to capture and return from the process. Output exceeding this limit will be truncated with beginning/end preserved and middle removed. Maximum: ${k} characters. Default: ${k}.`
215
220
  )
216
221
  });
217
- async function Te(t, r) {
222
+ async function ve(t, r) {
218
223
  let s;
219
224
  try {
220
- s = Me.parse(t);
225
+ s = Te.parse(t);
221
226
  } catch (m) {
222
227
  return {
223
- error: `Invalid arguments: ${m instanceof Error ? m.message : "Unknown error"}`
228
+ error: C(m)
224
229
  };
225
230
  }
226
- const { id: o, waitTime: e, autoKill: n, outputLimit: i } = s, a = F.get(o);
231
+ const { id: o, waitTime: e, autoKill: n, outputLimit: i } = s, a = O.get(o);
227
232
  if (!a)
228
233
  return {
229
234
  error: `Process ${o} 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.`
@@ -232,12 +237,12 @@ async function Te(t, r) {
232
237
  let l = !1, c = !1;
233
238
  e != null && await new Promise((h) => {
234
239
  const g = setInterval(() => {
235
- a.isRunning ? Date.now() - u >= e * 1e3 && (clearInterval(g), l = !0, n && a.pid && (Ie(a.pid), c = !0), h()) : (clearInterval(g), h());
240
+ a.isRunning ? Date.now() - u >= e * 1e3 && (clearInterval(g), l = !0, n && a.pid && (Me(a.pid), c = !0), h()) : (clearInterval(g), h());
236
241
  }, 100);
237
242
  });
238
243
  const f = (Date.now() - u) / 1e3;
239
244
  return {
240
- ...await H({ id: o, outputLimit: i }, r),
245
+ ...await Y({ id: o, outputLimit: i }, r),
241
246
  waitDuration: f,
242
247
  waitTimeExceeded: l,
243
248
  autoKillExecuted: c
@@ -249,10 +254,10 @@ function kt(t, r) {
249
254
  {
250
255
  title: "Wait for Host Machine Process",
251
256
  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",
252
- inputSchema: Me.shape
257
+ inputSchema: Te.shape
253
258
  },
254
259
  async (s) => {
255
- const o = await Te(s, r);
260
+ const o = await ve(s, r);
256
261
  if (!("output" in o))
257
262
  return `Method: process-wait(${JSON.stringify(s)})
258
263
  ❌ Error: ${o.error}`;
@@ -265,7 +270,7 @@ ${e.trim()}`;
265
270
  }
266
271
  );
267
272
  }
268
- const ve = p.object({
273
+ const Ce = p.object({
269
274
  cwd: p.string().optional().describe(
270
275
  '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'
271
276
  ),
@@ -282,18 +287,18 @@ const ve = p.object({
282
287
  `Maximum number of output characters to capture and return from the process. Output exceeding this limit will be truncated with beginning/end preserved and middle removed. Maximum: ${k} characters. Default: ${k}.`
283
288
  )
284
289
  });
285
- async function Ct(t, r) {
286
- W();
290
+ async function Nt(t, r) {
291
+ Q();
287
292
  let s;
288
293
  try {
289
- s = ve.parse(t);
294
+ s = Ce.parse(t);
290
295
  } catch (d) {
291
296
  return {
292
- error: `Invalid arguments: ${d instanceof Error ? d.message : "Unknown error"}`
297
+ error: C(d)
293
298
  };
294
299
  }
295
300
  const { commandLine: o, waitTime: e, autoKill: n, outputLimit: i } = s, { commandLineRules: a } = r, u = T.resolve(r.workingDir || "", s.cwd || "");
296
- if (!St({ commandLine: o, commandLineRules: a })) {
301
+ if (!It({ commandLine: o, commandLineRules: a })) {
297
302
  const d = a.map(
298
303
  (m) => `${m.rule.toUpperCase()}: /${m.regexp}/ (${m.note})`
299
304
  ).join(`
@@ -305,13 +310,13 @@ ${d}
305
310
  To use this command line, ask the user to modify the command line rules in the configuration.`
306
311
  };
307
312
  }
308
- if (Array.from(F.values()).filter(
313
+ if (Array.from(O.values()).filter(
309
314
  (d) => d.isRunning
310
- ).length >= ne)
315
+ ).length >= ie)
311
316
  return {
312
- error: `Maximum concurrent process limit reached (${ne} processes). Cannot start new process until existing processes complete. Use process-list to see active processes, or process-kill to terminate unnecessary processes.`
317
+ error: `Maximum concurrent process limit reached (${ie} processes). Cannot start new process until existing processes complete. Use process-list to see active processes, or process-kill to terminate unnecessary processes.`
313
318
  };
314
- const c = It(), f = {
319
+ const c = Mt(), f = {
315
320
  id: c,
316
321
  cwd: u,
317
322
  commandLine: o,
@@ -321,9 +326,9 @@ To use this command line, ask the user to modify the command line rules in the c
321
326
  localOutput: "",
322
327
  lastOutputTime: /* @__PURE__ */ new Date()
323
328
  };
324
- F.set(c, f);
329
+ O.set(c, f);
325
330
  try {
326
- const d = at(o, [], {
331
+ const d = lt(o, [], {
327
332
  shell: !0,
328
333
  cwd: u,
329
334
  stdio: ["pipe", "pipe", "pipe"]
@@ -331,7 +336,7 @@ To use this command line, ask the user to modify the command line rules in the c
331
336
  f.pid = d.pid;
332
337
  const m = (h) => {
333
338
  const g = h.toString();
334
- f.localOutput += g, Q({ process: f }), console.log(g);
339
+ f.localOutput += g, H({ process: f }), console.log(g);
335
340
  };
336
341
  return d.stdout?.on("data", m), d.stderr?.on("data", m), d.on("close", (h) => {
337
342
  if (f.isRunning = !1, f.endTime = /* @__PURE__ */ new Date(), f.exitCode = h !== null ? h : void 0, f.output += f.localOutput, f.localOutput = "", f.output.length > k) {
@@ -339,9 +344,9 @@ To use this command line, ask the user to modify the command line rules in the c
339
344
  ... [${f.output.length - k} characters trimmed] ...
340
345
  `, y = k - b.length;
341
346
  if (y > 0) {
342
- const $ = Math.floor(y / 2);
343
- f.output = f.output.substring(0, $) + b + f.output.substring(
344
- f.output.length - (y - $)
347
+ const x = Math.floor(y / 2);
348
+ f.output = f.output.substring(0, x) + b + f.output.substring(
349
+ f.output.length - (y - x)
345
350
  );
346
351
  } else
347
352
  f.output = f.output.substring(0, k);
@@ -349,12 +354,12 @@ To use this command line, ask the user to modify the command line rules in the c
349
354
  console.log(`Process ${c} (${o}) exited with code ${h}`);
350
355
  }), d.on("error", (h) => {
351
356
  f.isRunning = !1, f.endTime = /* @__PURE__ */ new Date(), f.error = h.message, console.error(`Process ${c} error:`, h.message);
352
- }), e != null ? Te({ id: c, waitTime: e, autoKill: n, outputLimit: i }, r) : H({ id: c, outputLimit: i }, r);
357
+ }), e != null ? ve({ id: c, waitTime: e, autoKill: n, outputLimit: i }, r) : Y({ id: c, outputLimit: i }, r);
353
358
  } catch (d) {
354
359
  return f.isRunning = !1, f.endTime = /* @__PURE__ */ new Date(), f.error = d instanceof Error ? d.message : "Unknown error", { error: f.error };
355
360
  }
356
361
  }
357
- function Et(t, r) {
362
+ function Dt(t, r) {
358
363
  const s = r.commandLineRules.map((o) => `${o.rule.toUpperCase()}: ${o.regexp} (${o.note})`).join(`
359
364
  `);
360
365
  t(
@@ -363,10 +368,10 @@ function Et(t, r) {
363
368
  title: "Execute Command Line on Host Machine",
364
369
  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:
365
370
  ${s}`,
366
- inputSchema: ve.shape
371
+ inputSchema: Ce.shape
367
372
  },
368
373
  async (o) => {
369
- const e = await Ct(o, r);
374
+ const e = await Nt(o, r);
370
375
  if (!("output" in e))
371
376
  return `Method: process-run(${JSON.stringify(o)})
372
377
  ❌ Error: ${e.error}`;
@@ -393,18 +398,18 @@ const ke = p.object({
393
398
  'Specific process data fields to include in the response. If omitted, returns all available fields. 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'
394
399
  )
395
400
  });
396
- async function Nt(t, r) {
397
- W();
401
+ async function Et(t, r) {
402
+ Q();
398
403
  let s;
399
404
  try {
400
405
  s = ke.parse(t);
401
406
  } catch (l) {
402
407
  return {
403
- error: `Invalid arguments: ${l instanceof Error ? l.message : "Unknown error"}`
408
+ error: C(l)
404
409
  };
405
410
  }
406
411
  const { minOpenDateTime: o, minCloseDateTime: e, activeOnly: n, fields: i } = s;
407
- let a = Array.from(F.values());
412
+ let a = Array.from(O.values());
408
413
  if (o) {
409
414
  const l = new Date(o.replace(/[_\s]/g, "T"));
410
415
  a = a.filter((c) => c.startTime >= l);
@@ -414,10 +419,10 @@ async function Nt(t, r) {
414
419
  a = a.filter((c) => c.endTime && c.endTime >= l);
415
420
  }
416
421
  return n && (a = a.filter((l) => l.isRunning)), { processes: a.map((l) => {
417
- Q({ process: l });
422
+ H({ process: l });
418
423
  let c = {
419
424
  id: l.id,
420
- cwd: it.relative(r.workingDir || "", l.cwd),
425
+ cwd: at.relative(r.workingDir || "", l.cwd),
421
426
  commandLine: l.commandLine,
422
427
  pid: l.pid,
423
428
  startTime: l.startTime.toISOString().replace(/[TZ]/g, " ").trim(),
@@ -436,7 +441,7 @@ async function Nt(t, r) {
436
441
  return c;
437
442
  }) };
438
443
  }
439
- function Dt(t, r) {
444
+ function Bt(t, r) {
440
445
  t(
441
446
  "process-list",
442
447
  {
@@ -445,7 +450,7 @@ function Dt(t, r) {
445
450
  inputSchema: ke.shape
446
451
  },
447
452
  async (s) => {
448
- const o = await Nt(s, r);
453
+ const o = await Et(s, r);
449
454
  if (o.error != null)
450
455
  return `Method: process-list(${JSON.stringify(s)})
451
456
  ❌ Error: ${o.error}`;
@@ -459,21 +464,21 @@ ${e}`;
459
464
  }
460
465
  );
461
466
  }
462
- const Ce = p.object({
467
+ const Ne = p.object({
463
468
  id: p.number().describe(
464
469
  "Process ID of the process to terminate. Get process IDs using process-list. The process must be currently running. Examples: 1, 42, 123"
465
470
  )
466
471
  });
467
- function Bt(t) {
472
+ function Ft(t) {
468
473
  let r;
469
474
  try {
470
- r = Ce.parse(t);
475
+ r = Ne.parse(t);
471
476
  } catch (e) {
472
477
  return {
473
- error: `Invalid arguments: ${e instanceof Error ? e.message : "Unknown error"}`
478
+ error: C(e)
474
479
  };
475
480
  }
476
- const { id: s } = r, o = F.get(s);
481
+ const { id: s } = r, o = O.get(s);
477
482
  if (!o)
478
483
  return {
479
484
  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.`
@@ -487,31 +492,31 @@ function Bt(t) {
487
492
  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.`
488
493
  };
489
494
  try {
490
- return Ie(o.pid), { success: !0, message: `Kill signal sent to process ${s}` };
495
+ return Me(o.pid), { success: !0, message: `Kill signal sent to process ${s}` };
491
496
  } catch (e) {
492
497
  return {
493
498
  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.`
494
499
  };
495
500
  }
496
501
  }
497
- function Ft(t, r) {
502
+ function Ot(t, r) {
498
503
  t(
499
504
  "process-kill",
500
505
  {
501
506
  title: "Kill Host Machine Process",
502
507
  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",
503
- inputSchema: Ce.shape
508
+ inputSchema: Ne.shape
504
509
  },
505
510
  async (s) => {
506
- const o = Bt(s);
511
+ const o = Ft(s);
507
512
  return o.error != null ? `Method: process-kill(${JSON.stringify(s)})
508
513
  ❌ Error: ${o.error}` : `Method: process-kill(${JSON.stringify(s)})
509
514
  ${JSON.stringify(o, null, 2)}`;
510
515
  }
511
516
  );
512
517
  }
513
- function Ot(t, r) {
514
- Mt(), r.run && Et(t, r), r.status && vt(t, r), r.wait && kt(t, r), r.list && Dt(t, r), r.kill && Ft(t);
518
+ function Rt(t, r) {
519
+ Tt(), r.run && Dt(t, r), r.status && Ct(t, r), r.wait && kt(t, r), r.list && Bt(t, r), r.kill && Ot(t);
515
520
  const s = r.commandLineRules?.map(
516
521
  (o) => `${o.rule.toUpperCase()}: ${o.regexp} (${o.note})`
517
522
  ) || [];
@@ -524,16 +529,16 @@ ${s.map((o) => `- ${o}`).join(`
524
529
  `
525
530
  );
526
531
  }
527
- function Rt(t, r) {
532
+ function zt(t, r) {
528
533
  return function(o, e, n) {
529
534
  const i = async (...a) => {
530
- await G({
535
+ await q({
531
536
  logFilePath: r.logFilePath,
532
537
  message: "REQUEST",
533
538
  data: { name: o, args: a }
534
539
  });
535
540
  const u = await n(...a);
536
- return await G({
541
+ return await q({
537
542
  logFilePath: r.logFilePath,
538
543
  message: "RESPONSE",
539
544
  data: u
@@ -553,26 +558,26 @@ function Rt(t, r) {
553
558
  );
554
559
  };
555
560
  }
556
- function zt(t) {
561
+ function Pt(t) {
557
562
  return t.match(/^[/\\]?[^/\\]+/)[0];
558
563
  }
559
- function Ut(t, r) {
560
- return zt(t) + "|" + r.ino;
564
+ function Lt(t, r) {
565
+ return Pt(t) + "|" + r.ino;
561
566
  }
562
- function Pt(t) {
567
+ function Ut(t) {
563
568
  return t.endsWith(":") && (t += "/"), T.resolve(t);
564
569
  }
565
- const Ee = new lt(dt.cpus().length);
566
- function ae(t, r) {
570
+ const De = new ct(ft.cpus().length);
571
+ function le(t, r) {
567
572
  t.totalSize += r.totalSize, t.maxFileDateModified = Math.max(
568
573
  t.maxFileDateModified,
569
574
  r.maxFileDateModified
570
575
  ), t.countFiles += r.countFiles, t.countDirs += r.countDirs, t.countLinks += r.countLinks;
571
576
  }
572
- const Lt = function(r) {
577
+ const At = function(r) {
573
578
  return r.code === "ENOENT";
574
579
  };
575
- function Ne(t) {
580
+ function Ee(t) {
576
581
  const r = t.paths;
577
582
  if (!r || r.length === 0)
578
583
  return Promise.resolve({
@@ -582,16 +587,16 @@ function Ne(t) {
582
587
  countDirs: 0,
583
588
  countLinks: 0
584
589
  });
585
- const s = t.level ?? 0, o = t.walkedIds ?? /* @__PURE__ */ new Set(), e = t.abortSignal, n = t.pool ?? Ee, i = t.handleError, a = t.priority ?? z(0), u = t.walkLinks ?? !1, l = t.log, c = t.handlePath, f = t.matchPath;
590
+ const s = t.level ?? 0, o = t.walkedIds ?? /* @__PURE__ */ new Set(), e = t.abortSignal, n = t.pool ?? De, i = t.handleError, a = t.priority ?? P(0), u = t.walkLinks ?? !1, l = t.log, c = t.handlePath, f = t.matchPath;
586
591
  async function d(h) {
587
- if (!(i && await i(h)) && !Lt(h))
592
+ if (!(i && await i(h)) && !At(h))
588
593
  throw h;
589
594
  }
590
595
  function m(h) {
591
596
  return !(!l || l.minTotalContentSize != null && h < l.minTotalContentSize || l.maxNestedLevel != null && s > l.maxNestedLevel);
592
597
  }
593
- return ct(async (h) => {
594
- const g = ut(e, h), b = {
598
+ return ut(async (h) => {
599
+ const g = dt(e, h), b = {
595
600
  totalSize: 0,
596
601
  maxFileDateModified: 0,
597
602
  countFiles: 0,
@@ -604,8 +609,8 @@ function Ne(t) {
604
609
  l?.handleLog ? l.handleLog(v) : console.log(v);
605
610
  }
606
611
  }
607
- async function $(w, M, S, v) {
608
- return c ? await U({
612
+ async function x(w, M, $, v) {
613
+ return c ? await L({
609
614
  pool: n,
610
615
  func: async () => {
611
616
  try {
@@ -613,12 +618,12 @@ function Ne(t) {
613
618
  level: s,
614
619
  path: w,
615
620
  stat: M,
616
- itemStat: S,
621
+ itemStat: $,
617
622
  totalStat: b,
618
623
  abortSignal: g
619
624
  });
620
- } catch (E) {
621
- return await d(E), !1;
625
+ } catch (D) {
626
+ return await d(D), !1;
622
627
  }
623
628
  },
624
629
  count: 1,
@@ -626,97 +631,97 @@ function Ne(t) {
626
631
  abortSignal: g
627
632
  }) : !0;
628
633
  }
629
- async function I(w, M, S, v) {
634
+ async function I(w, M, $, v) {
630
635
  v || (v = w);
631
- const E = await U({
636
+ const D = await L({
632
637
  pool: n,
633
- func: () => B.promises.lstat(w).catch(d),
638
+ func: () => F.promises.lstat(w).catch(d),
634
639
  count: 1,
635
- priority: z(M, z(1, a)),
640
+ priority: P(M, P(1, a)),
636
641
  abortSignal: g
637
642
  });
638
- if (!E || !S && E.isFile())
643
+ if (!D || !$ && D.isFile())
639
644
  return null;
640
- const oe = Ut(w, E);
641
- if (o.has(oe))
645
+ const ne = Lt(w, D);
646
+ if (o.has(ne))
642
647
  return null;
643
- o.add(oe);
644
- let C = {
645
- totalSize: E.size,
646
- maxFileDateModified: E.isDirectory() ? 0 : E.mtimeMs,
648
+ o.add(ne);
649
+ let N = {
650
+ totalSize: D.size,
651
+ maxFileDateModified: D.isDirectory() ? 0 : D.mtimeMs,
647
652
  countFiles: 0,
648
653
  countDirs: 0,
649
654
  countLinks: 0
650
655
  };
651
- const P = z(
656
+ const U = P(
652
657
  M,
653
- z(E.isDirectory() ? 2 : 3, a)
658
+ P(D.isDirectory() ? 2 : 3, a)
654
659
  );
655
- if (E.isSymbolicLink()) {
660
+ if (D.isSymbolicLink()) {
656
661
  if (u) {
657
- const D = await U({
662
+ const B = await L({
658
663
  pool: n,
659
- func: () => B.promises.readlink(w).catch(d).then((O) => O ?? null),
664
+ func: () => F.promises.readlink(w).catch(d).then((R) => R ?? null),
660
665
  count: 1,
661
- priority: P,
666
+ priority: U,
662
667
  abortSignal: g
663
668
  });
664
- if (D) {
665
- const O = T.isAbsolute(D) ? D : T.resolve(T.dirname(v), D), L = await I(
666
- O,
669
+ if (B) {
670
+ const R = T.isAbsolute(B) ? B : T.resolve(T.dirname(v), B), A = await I(
671
+ R,
667
672
  M,
668
- S,
673
+ $,
669
674
  v
670
675
  );
671
- L && (C = L);
676
+ A && (N = A);
672
677
  }
673
678
  }
674
- return (S || C.countFiles + C.countDirs + C.countLinks > 1) && (C.countLinks += 1, await $(
679
+ return ($ || N.countFiles + N.countDirs + N.countLinks > 1) && (N.countLinks += 1, await x(
675
680
  v,
676
- E,
677
- C,
678
- P
679
- ) && (ae(b, C), y(v, C))), C;
680
- } else if (E.isDirectory()) {
681
- const D = await U({
681
+ D,
682
+ N,
683
+ U
684
+ ) && (le(b, N), y(v, N))), N;
685
+ } else if (D.isDirectory()) {
686
+ const B = await L({
682
687
  pool: n,
683
- func: () => B.promises.readdir(w).catch(d),
688
+ func: () => F.promises.readdir(w).catch(d),
684
689
  count: 1,
685
690
  priority: a,
686
691
  abortSignal: g
687
692
  });
688
- if (D) {
689
- for (let O = 0, L = D.length; O < L; O++)
690
- D[O] = T.join(v, D[O]);
691
- C = await Ne({
693
+ if (B) {
694
+ for (let R = 0, A = B.length; R < A; R++)
695
+ B[R] = T.join(v, B[R]);
696
+ N = await Ee({
692
697
  ...t,
693
- paths: D,
698
+ paths: B,
694
699
  abortSignal: g,
695
- priority: P,
700
+ priority: U,
696
701
  level: s + 1,
697
702
  walkedIds: o
698
703
  });
699
704
  }
700
705
  }
701
- return (S || C.countFiles + C.countDirs + C.countLinks > 1) && (E.isDirectory() ? C.countDirs += 1 : E.isFile() && (C.countFiles += 1), await $(
706
+ return ($ || N.countFiles + N.countDirs + N.countLinks > 1) && (D.isDirectory() ? N.countDirs += 1 : D.isFile() && (N.countFiles += 1), await x(
702
707
  v,
703
- E,
704
- C,
705
- P
706
- ) && (ae(b, C), y(v, C))), C;
708
+ D,
709
+ N,
710
+ U
711
+ ) && (le(b, N), y(v, N))), N;
707
712
  }
708
- const x = [];
713
+ const S = [];
709
714
  for (let w = 0, M = r.length; w < M; w++) {
710
- const S = Pt(r[w]), v = f ? f(S) : !0;
711
- v !== !1 && x.push(I(S, w, v));
715
+ const $ = Ut(r[w]), v = f ? f($) : !0;
716
+ v !== !1 && S.push(I($, w, v));
712
717
  }
713
- return await Promise.all(x), b;
718
+ return await Promise.all(S), b;
714
719
  });
715
720
  }
716
- function De(t) {
717
- return Ne(t);
721
+ function Be(t) {
722
+ return Ee(t);
718
723
  }
719
- function At(t, r) {
724
+ function Gt(t, r) {
720
725
  if (!r || r === ".")
721
726
  return t;
722
727
  const s = t.startsWith("^");
@@ -724,43 +729,43 @@ function At(t, r) {
724
729
  const o = t.startsWith("!");
725
730
  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 = T.normalize(t).replace(/\\/g, "/"), o && (t = "!" + t), s && (t = "^" + t), t;
726
731
  }
727
- function Gt(t) {
732
+ function qt(t) {
728
733
  const r = t.startsWith("!");
729
734
  return r && (t = t.substring(1)), t.startsWith("/") ? t = t.substring(1) : !t.startsWith("**") && !t.startsWith("../") && (t = `**/${t}`), r && (t = "!" + t), t;
730
735
  }
731
- function le(t) {
736
+ function ce(t) {
732
737
  return "^" + t;
733
738
  }
734
- async function qt(t) {
735
- const s = (await B.promises.readFile(t, "utf-8")).split(`
739
+ async function _t(t) {
740
+ const s = (await F.promises.readFile(t, "utf-8")).split(`
736
741
  `), o = [];
737
742
  return s.forEach((e) => {
738
743
  e = e.trim(), !(!e || e.startsWith("#")) && o.push(e);
739
744
  }), o;
740
745
  }
741
- async function Be(t) {
746
+ async function Fe(t) {
742
747
  const r = t.rootDir ?? ".", s = [];
743
748
  if (!t.globs?.length)
744
749
  return s;
745
750
  const o = [];
746
751
  return t.globs.forEach((e) => {
747
- e.value && (e.valueType === "file-contains-patterns" ? o.push(e) : e.valueType === "pattern" && s.push(e.exclude ? le(e.value) : e.value));
752
+ e.value && (e.valueType === "file-contains-patterns" ? o.push(e) : e.valueType === "pattern" && s.push(e.exclude ? ce(e.value) : e.value));
748
753
  }), o.length && await Promise.all(
749
754
  o.map(async (e) => {
750
- await U({
751
- pool: Ee,
755
+ await L({
756
+ pool: De,
752
757
  count: 1,
753
758
  func: async () => {
754
- const n = T.resolve(r, e.value), i = await qt(n), a = T.relative(r, T.dirname(n));
759
+ const n = T.resolve(r, e.value), i = await _t(n), a = T.relative(r, T.dirname(n));
755
760
  i.forEach((u) => {
756
- u = Gt(u), u = At(u, a), s.push(e.exclude ? le(u) : u);
761
+ u = qt(u), u = Gt(u, a), s.push(e.exclude ? ce(u) : u);
757
762
  });
758
763
  }
759
764
  });
760
765
  })
761
766
  ), s;
762
767
  }
763
- function Fe({
768
+ function Oe({
764
769
  globs: t,
765
770
  rootDir: r,
766
771
  noCase: s
@@ -781,7 +786,7 @@ function Fe({
781
786
  return;
782
787
  let u;
783
788
  try {
784
- u = ft(a, {
789
+ u = mt(a, {
785
790
  nocase: s ?? !1,
786
791
  dot: !0,
787
792
  strictBrackets: !0
@@ -808,17 +813,17 @@ function Fe({
808
813
  return a ? !1 : i;
809
814
  };
810
815
  }
811
- async function _t(t) {
816
+ async function jt(t) {
812
817
  const r = t.rootDir ?? ".", s = [], o = {};
813
818
  t.result.countFiles && (o.countFiles = 0), t.result.size && (o.size = 0);
814
- const e = await Be({
819
+ const e = await Fe({
815
820
  rootDir: r,
816
821
  globs: t.globs
817
822
  });
818
- return await De({
823
+ return await Be({
819
824
  paths: [r],
820
825
  walkLinks: !0,
821
- matchPath: Fe({
826
+ matchPath: Oe({
822
827
  globs: e,
823
828
  rootDir: r,
824
829
  noCase: !0
@@ -832,34 +837,34 @@ async function _t(t) {
832
837
  type: d
833
838
  };
834
839
  if (t.result.dateModified && (b.dateModified = m), t.result.size && (b.size = h), t.result.countFiles && (b.countFiles = g), t.dateModified && m != null) {
835
- const [y, $] = t.dateModified;
836
- if (y != null && m < y || $ != null && m > $)
840
+ const [y, x] = t.dateModified;
841
+ if (y != null && m < y || x != null && m > x)
837
842
  return !1;
838
843
  }
839
844
  if (t.totalSize && h != null) {
840
- const [y, $] = t.totalSize;
841
- if (y != null && h < y || $ != null && h > $)
845
+ const [y, x] = t.totalSize;
846
+ if (y != null && h < y || x != null && h > x)
842
847
  return !1;
843
848
  }
844
849
  return d === "file" && (o.countFiles = (o.countFiles ?? 0) + 1), d === "file" && h != null && (o.size = (o.size ?? 0) + h), m != null && (o.dateModified == null || m > o.dateModified) && (o.dateModified = m), l && !t.result.dirs || c && !t.result.files || s.push(b), !0;
845
850
  }
846
851
  }), { items: s, totals: o };
847
852
  }
848
- const ce = ["B", "KB", "MB", "GB", "TB"], ue = 1024;
849
- function de(t) {
853
+ const ue = ["B", "KB", "MB", "GB", "TB"], de = 1024;
854
+ function fe(t) {
850
855
  if (t == null) return "-";
851
856
  let r = t ?? 0, s = 0;
852
- for (; r >= ue && s < ce.length - 1; )
853
- r /= ue, s++;
854
- return `${s === 0 ? r.toString() : r.toFixed(2)}${ce[s]}`;
857
+ for (; r >= de && s < ue.length - 1; )
858
+ r /= de, s++;
859
+ return `${s === 0 ? r.toString() : r.toFixed(2)}${ue[s]}`;
855
860
  }
856
- function fe(t) {
861
+ function me(t) {
857
862
  const s = Date.now() - t;
858
863
  if (s < 0) return "0s";
859
864
  const o = Math.floor(s / 1e3), e = Math.floor(o / 60), n = Math.floor(e / 60), i = Math.floor(n / 24), a = Math.floor(i / 7), u = Math.floor(i / 30), l = Math.floor(i / 365);
860
865
  return l > 0 ? `${l}Y` : u > 0 ? `${u}M` : a > 0 ? `${a}w` : i > 0 ? `${i}d` : n > 0 ? `${n}h` : e > 0 ? `${e}m` : `${o}s`;
861
866
  }
862
- function jt(t, r) {
867
+ function Jt(t, r) {
863
868
  return r?.length ? [...t].sort((s, o) => {
864
869
  for (let e = 0, n = r.length; e < n; e++) {
865
870
  const i = r[e];
@@ -895,8 +900,8 @@ function jt(t, r) {
895
900
  return 0;
896
901
  }) : t;
897
902
  }
898
- function Jt(t, r) {
899
- const s = jt(t.items, r.sort ?? []), o = r.fields && r.fields.length > 0 ? r.fields : [];
903
+ function Kt(t, r) {
904
+ const s = Jt(t.items, r.sort ?? []), o = r.fields && r.fields.length > 0 ? r.fields : [];
900
905
  let e = "";
901
906
  if (s.length > 0 && o.length > 0) {
902
907
  for (let n = 0, i = o.length; n < i; n++) {
@@ -927,10 +932,10 @@ function Jt(t, r) {
927
932
  const c = o[u];
928
933
  switch (u > 0 && (e += " | "), c) {
929
934
  case "dateModified":
930
- e += a.dateModified ? fe(a.dateModified) : "-";
935
+ e += a.dateModified ? me(a.dateModified) : "-";
931
936
  break;
932
937
  case "size":
933
- e += de(a.size);
938
+ e += fe(a.size);
934
939
  break;
935
940
  case "type":
936
941
  e += a.type;
@@ -949,13 +954,13 @@ function Jt(t, r) {
949
954
  e.length > 0 && (e += `
950
955
  ---
951
956
  `);
952
- const n = de(t.totals.size ?? 0), i = t.totals.dateModified ? `, last modified ${fe(t.totals.dateModified)} ago` : "";
957
+ const n = fe(t.totals.size ?? 0), i = t.totals.dateModified ? `, last modified ${me(t.totals.dateModified)} ago` : "";
953
958
  e += `Totals: ${t.totals.countFiles ?? 0} files in dirs, ${n}${i}`;
954
959
  }
955
960
  return e;
956
961
  }
957
- const ns = "project-tools", is = "1.0.0", as = "d00f70240703039df14c76176a055bce6b5484d2b552ba2c89820f03b8e5e60d", me = 25e3;
958
- function he(t) {
962
+ const is = "project-tools", as = "1.0.0", ls = "d00f70240703039df14c76176a055bce6b5484d2b552ba2c89820f03b8e5e60d", he = 25e3;
963
+ function pe(t) {
959
964
  const r = t.match(
960
965
  /^\s*(\d+(?:\.\d+)?)\s*([smhdwMY]|sec(onds?)?|min(utes?)?|hours?|days?|weeks?|months?|years?)\s*$/i
961
966
  );
@@ -986,7 +991,7 @@ function he(t) {
986
991
  );
987
992
  }
988
993
  }
989
- function pe(t) {
994
+ function ge(t) {
990
995
  const r = t.match(/^\s*(\d+(?:\.\d+)?)\s*(B|KB|MB|GB|TB)\s*$/i);
991
996
  if (!r)
992
997
  throw new Error(
@@ -1010,7 +1015,7 @@ function pe(t) {
1010
1015
  );
1011
1016
  }
1012
1017
  }
1013
- const Oe = p.object({
1018
+ const Re = p.object({
1014
1019
  rootDir: p.string().optional().describe(
1015
1020
  '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'
1016
1021
  ),
@@ -1049,13 +1054,13 @@ const Oe = p.object({
1049
1054
  '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'
1050
1055
  )
1051
1056
  });
1052
- async function Kt(t, r) {
1057
+ async function Wt(t, r) {
1053
1058
  let s;
1054
1059
  try {
1055
- s = Oe.parse(t);
1060
+ s = Re.parse(t);
1056
1061
  } catch (g) {
1057
1062
  return {
1058
- error: `Invalid arguments: ${g instanceof Error ? g.message : "Unknown error"}`
1063
+ error: C(g)
1059
1064
  };
1060
1065
  }
1061
1066
  const {
@@ -1088,55 +1093,55 @@ async function Kt(t, r) {
1088
1093
  );
1089
1094
  try {
1090
1095
  try {
1091
- await B.promises.access(h, B.constants.F_OK);
1092
- } catch (S) {
1093
- if (S.code === "ENOENT")
1096
+ await F.promises.access(h, F.constants.F_OK);
1097
+ } catch ($) {
1098
+ if ($.code === "ENOENT")
1094
1099
  return {
1095
1100
  error: `Directory does not exist: "${h}". Verify the path is correct and accessible. If using rootDir parameter, ensure it exists relative to the current working directory. Use fs-list without rootDir to list the current directory, or check parent directories first.`
1096
1101
  };
1097
- throw S;
1102
+ throw $;
1098
1103
  }
1099
- const g = o && o.length > 0 ? o.map((S) => ({
1100
- value: S,
1104
+ const g = o && o.length > 0 ? o.map(($) => ({
1105
+ value: $,
1101
1106
  valueType: "pattern",
1102
1107
  exclude: !1
1103
- })) : [{ value: "**", valueType: "pattern", exclude: !1 }], b = r.globsExclude || [], y = [...g, ...b], $ = {
1108
+ })) : [{ value: "**", valueType: "pattern", exclude: !1 }], b = r.globsExclude || [], y = [...g, ...b], x = {
1104
1109
  files: e ?? !1,
1105
1110
  dirs: n ?? !1,
1106
1111
  dateModified: f.includes("dateModified") || m.includes("dateModified"),
1107
1112
  size: f.includes("size") || m.includes("size"),
1108
1113
  countFiles: f.includes("countFiles") || m.includes("countFiles")
1109
1114
  };
1110
- let I = null, x = null;
1115
+ let I = null, S = null;
1111
1116
  if (a || u)
1112
1117
  try {
1113
- const S = Date.now(), v = u ? S - he(u) : null, E = a ? S - he(a) : null;
1114
- I = [v, E];
1115
- } catch (S) {
1118
+ const $ = Date.now(), v = u ? $ - pe(u) : null, D = a ? $ - pe(a) : null;
1119
+ I = [v, D];
1120
+ } catch ($) {
1116
1121
  return {
1117
- error: S instanceof Error ? S.message : "Unknown error parsing time ago filter"
1122
+ error: $ instanceof Error ? $.message : "Unknown error parsing time ago filter"
1118
1123
  };
1119
1124
  }
1120
1125
  if (l || c)
1121
1126
  try {
1122
- const S = l ? pe(l) : null, v = c ? pe(c) : null;
1123
- x = [S, v];
1124
- } catch (S) {
1127
+ const $ = l ? ge(l) : null, v = c ? ge(c) : null;
1128
+ S = [$, v];
1129
+ } catch ($) {
1125
1130
  return {
1126
- error: S instanceof Error ? S.message : "Unknown error parsing size filter"
1131
+ error: $ instanceof Error ? $.message : "Unknown error parsing size filter"
1127
1132
  };
1128
1133
  }
1129
- const w = await _t({
1134
+ const w = await jt({
1130
1135
  rootDir: h || null,
1131
1136
  globs: y,
1132
- result: $,
1137
+ result: x,
1133
1138
  dateModified: I,
1134
- totalSize: x
1139
+ totalSize: S
1135
1140
  });
1136
- return w.items.length > me ? {
1137
- error: `Number of paths (${w.items.length}) exceeds maximum allowed (${me}). Consider using more specific glob patterns or filters to reduce the result set.`
1141
+ return w.items.length > he ? {
1142
+ error: `Number of paths (${w.items.length}) exceeds maximum allowed (${he}). Consider using more specific glob patterns or filters to reduce the result set.`
1138
1143
  } : {
1139
- output: Jt(w, {
1144
+ output: Kt(w, {
1140
1145
  sort: d,
1141
1146
  fields: f,
1142
1147
  totals: !0
@@ -1146,30 +1151,30 @@ async function Kt(t, r) {
1146
1151
  return { error: g instanceof Error ? g.message : "Unknown error" };
1147
1152
  }
1148
1153
  }
1149
- function Wt(t, r) {
1154
+ function Qt(t, r) {
1150
1155
  t(
1151
1156
  "fs-list",
1152
1157
  {
1153
1158
  title: "List Files and Directories",
1154
1159
  description: "List files and directories with advanced filtering, sorting and formatting options. Use this to analyze filesystem structure",
1155
- inputSchema: Oe.shape
1160
+ inputSchema: Re.shape
1156
1161
  },
1157
1162
  async (s) => {
1158
- const o = await Kt(s, r);
1163
+ const o = await Wt(s, r);
1159
1164
  return o.error ? `Method: fs-list(${JSON.stringify(s)})
1160
1165
  ❌ Error: ${o.error}` : `Method: fs-list(${JSON.stringify(s)})
1161
1166
  ${o.output || JSON.stringify(o, null, 2)}`;
1162
1167
  }
1163
1168
  );
1164
1169
  }
1165
- const _ = /* @__PURE__ */ new Map();
1166
- function Y(t) {
1167
- return _.has(t) || _.set(t, {
1170
+ const j = /* @__PURE__ */ new Map();
1171
+ function V(t) {
1172
+ return j.has(t) || j.set(t, {
1168
1173
  fsSnapshotQueries: /* @__PURE__ */ new Map(),
1169
1174
  fsSnapshots: /* @__PURE__ */ new Map()
1170
- }), _.get(t);
1175
+ }), j.get(t);
1171
1176
  }
1172
- function ge(t) {
1177
+ function we(t) {
1173
1178
  const r = t.match(
1174
1179
  /^\s*(\d+(?:\.\d+)?)\s*([smhdwMY]|sec(onds?)?|min(utes?)?|hours?|days?|weeks?|months?|years?)\s*$/i
1175
1180
  );
@@ -1200,7 +1205,7 @@ function ge(t) {
1200
1205
  );
1201
1206
  }
1202
1207
  }
1203
- function we(t) {
1208
+ function ye(t) {
1204
1209
  const r = t.match(/^\s*(\d+(?:\.\d+)?)\s*(B|KB|MB|GB|TB)\s*$/i);
1205
1210
  if (!r)
1206
1211
  throw new Error(
@@ -1224,7 +1229,7 @@ function we(t) {
1224
1229
  );
1225
1230
  }
1226
1231
  }
1227
- const V = p.object({
1232
+ const Z = p.object({
1228
1233
  name: p.string().describe(
1229
1234
  "Unique name for the filesystem snapshot query. Recommended format: kebab-case-1, kebab-case-2, ..."
1230
1235
  ),
@@ -1255,7 +1260,7 @@ const V = p.object({
1255
1260
  maxTotalSize: p.string().optional().describe(
1256
1261
  'Filter files/directories with total size at most this large. Only items with size <= this value will be included. For directories, uses total size of all contents. Format: number + unit (B/KB/MB/GB/TB). Examples: "1MB" (up to 1 megabyte), "500KB" (up to 500 kilobytes), "10GB" (up to 10 gigabytes). Combine with minTotalSize for size ranges'
1257
1262
  )
1258
- }), ye = new Map(
1263
+ }), be = new Map(
1259
1264
  [
1260
1265
  "name",
1261
1266
  "type",
@@ -1264,17 +1269,17 @@ const V = p.object({
1264
1269
  "dateModified"
1265
1270
  ].map((t, r) => [t, r])
1266
1271
  );
1267
- function Qt(t, r) {
1268
- const s = ye.get(t) ?? 1 / 0, o = ye.get(r) ?? 1 / 0;
1272
+ function Ht(t, r) {
1273
+ const s = be.get(t) ?? 1 / 0, o = be.get(r) ?? 1 / 0;
1269
1274
  return s > o ? 1 : s < o ? -1 : 0;
1270
1275
  }
1271
- async function Re(t, r, s) {
1276
+ async function ze(t, r, s) {
1272
1277
  let o;
1273
1278
  try {
1274
- o = V.parse(t);
1279
+ o = Z.parse(t);
1275
1280
  } catch (h) {
1276
1281
  return {
1277
- error: `Invalid arguments: ${h instanceof Error ? h.message : "Unknown error"}`
1282
+ error: C(h)
1278
1283
  };
1279
1284
  }
1280
1285
  const {
@@ -1291,7 +1296,7 @@ async function Re(t, r, s) {
1291
1296
  return {
1292
1297
  error: "Session ID is required"
1293
1298
  };
1294
- const d = Y(s.sessionId);
1299
+ const d = V(s.sessionId);
1295
1300
  if (d.fsSnapshotQueries.has(e))
1296
1301
  return {
1297
1302
  error: `Filesystem snapshot query "${e}" already exists`
@@ -1299,7 +1304,7 @@ async function Re(t, r, s) {
1299
1304
  const m = T.resolve(r.workingDir || "", o.rootDir || "").replace(/\\/g, "/");
1300
1305
  try {
1301
1306
  try {
1302
- await B.promises.access(m, B.constants.F_OK);
1307
+ await F.promises.access(m, F.constants.F_OK);
1303
1308
  } catch (w) {
1304
1309
  if (w.code === "ENOENT")
1305
1310
  return {
@@ -1308,17 +1313,17 @@ async function Re(t, r, s) {
1308
1313
  throw w;
1309
1314
  }
1310
1315
  const h = o.extraFields ? o.extraFields.map((w) => w === "lastModified" ? "dateModified" : w) : [];
1311
- h.includes("name") || h.push("name"), h.sort(Qt);
1316
+ h.includes("name") || h.push("name"), h.sort(Ht);
1312
1317
  const g = n && n.length > 0 ? n.map((w) => ({
1313
1318
  value: w,
1314
1319
  valueType: "pattern",
1315
1320
  exclude: !1
1316
1321
  })) : [{ value: "**", valueType: "pattern", exclude: !1 }], b = r.globsExclude || [], y = [...g, ...b];
1317
- let $ = null, I = null;
1322
+ let x = null, I = null;
1318
1323
  if (u || l)
1319
1324
  try {
1320
- const w = Date.now(), M = l ? w - ge(l) : null, S = u ? w - ge(u) : null;
1321
- $ = [M, S];
1325
+ const w = Date.now(), M = l ? w - we(l) : null, $ = u ? w - we(u) : null;
1326
+ x = [M, $];
1322
1327
  } catch (w) {
1323
1328
  return {
1324
1329
  error: w instanceof Error ? w.message : "Unknown error parsing time ago filter"
@@ -1326,25 +1331,25 @@ async function Re(t, r, s) {
1326
1331
  }
1327
1332
  if (c || f)
1328
1333
  try {
1329
- const w = c ? we(c) : null, M = f ? we(f) : null;
1334
+ const w = c ? ye(c) : null, M = f ? ye(f) : null;
1330
1335
  I = [w, M];
1331
1336
  } catch (w) {
1332
1337
  return {
1333
1338
  error: w instanceof Error ? w.message : "Unknown error parsing size filter"
1334
1339
  };
1335
1340
  }
1336
- const x = {
1341
+ const S = {
1337
1342
  name: e,
1338
1343
  rootDir: m,
1339
1344
  globs: y,
1340
1345
  matchFiles: i ?? null,
1341
1346
  matchDirs: a ?? null,
1342
- dateModified: $,
1347
+ dateModified: x,
1343
1348
  totalSize: I,
1344
1349
  fields: h
1345
1350
  };
1346
- return d.fsSnapshotQueries.set(e, x), {
1347
- snapshotQuery: x
1351
+ return d.fsSnapshotQueries.set(e, S), {
1352
+ snapshotQuery: S
1348
1353
  };
1349
1354
  } catch (h) {
1350
1355
  return {
@@ -1352,23 +1357,23 @@ async function Re(t, r, s) {
1352
1357
  };
1353
1358
  }
1354
1359
  }
1355
- function Ht(t, r) {
1360
+ function Yt(t, r) {
1356
1361
  t(
1357
1362
  "fs-snapshot-query-create",
1358
1363
  {
1359
1364
  title: "Create Filesystem Snapshot Query",
1360
1365
  description: "Create a filesystem snapshot query. Prefer fs-snapshot-browse if you need to immediately create a query, snapshot and browse it",
1361
- inputSchema: V.shape
1366
+ inputSchema: Z.shape
1362
1367
  },
1363
1368
  async (s, o) => {
1364
- const e = await Re(s, r, o);
1369
+ const e = await ze(s, r, o);
1365
1370
  return e.error != null ? `Method: fs-snapshot-query-create(${JSON.stringify(s)})
1366
1371
  ❌ Error: ${e.error}` : `Method: fs-snapshot-query-create(${JSON.stringify(s)})
1367
1372
  ✅ Filesystem snapshot query "${e.snapshotQuery.name}" created successfully`;
1368
1373
  }
1369
1374
  );
1370
1375
  }
1371
- function q(t) {
1376
+ function _(t) {
1372
1377
  const { idToNode: r, idToChildIds: s } = t, o = r.get(null);
1373
1378
  if (o == null)
1374
1379
  throw new Error(
@@ -1408,16 +1413,16 @@ function q(t) {
1408
1413
  }
1409
1414
  };
1410
1415
  }
1411
- function ze(t, r, s) {
1416
+ function Pe(t, r, s) {
1412
1417
  let o = null;
1413
1418
  for (let e = 0, n = r.length; e < n; e++) {
1414
- const i = r[e], a = t(i), u = a == null ? null : ze(t, a, s), l = s(i, u);
1419
+ const i = r[e], a = t(i), u = a == null ? null : Pe(t, a, s), l = s(i, u);
1415
1420
  l != null && (o == null && (o = []), o.push(l));
1416
1421
  }
1417
1422
  return o;
1418
1423
  }
1419
- function Ue(t) {
1420
- const { getId: r, getChilds: s, rootNodes: o, createSnapshotNode: e } = t, n = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), u = ze(
1424
+ function Le(t) {
1425
+ const { getId: r, getChilds: s, rootNodes: o, createSnapshotNode: e } = t, n = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), u = Pe(
1421
1426
  s,
1422
1427
  o,
1423
1428
  (c, f) => {
@@ -1442,10 +1447,10 @@ function Ue(t) {
1442
1447
  idToChildIds: a
1443
1448
  };
1444
1449
  }
1445
- function K(t) {
1450
+ function W(t) {
1446
1451
  return t = t?.replace(/\\/g, "/").replace(/\/$/, ""), !t || t === "." ? null : t;
1447
1452
  }
1448
- async function Yt(t) {
1453
+ async function Vt(t) {
1449
1454
  const r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), o = T.resolve(t.rootDir || "."), n = {
1450
1455
  path: ".",
1451
1456
  name: T.basename(o),
@@ -1455,14 +1460,14 @@ async function Yt(t) {
1455
1460
  size: 0
1456
1461
  };
1457
1462
  r.set(null, n);
1458
- const i = await Be({
1463
+ const i = await Fe({
1459
1464
  rootDir: o,
1460
1465
  globs: t.globs
1461
1466
  });
1462
- return await De({
1467
+ return await Be({
1463
1468
  paths: [o],
1464
1469
  walkLinks: !0,
1465
- matchPath: Fe({
1470
+ matchPath: Oe({
1466
1471
  globs: i,
1467
1472
  rootDir: o,
1468
1473
  noCase: !0
@@ -1471,7 +1476,7 @@ async function Yt(t) {
1471
1476
  const c = T.relative(o, a), f = u.isDirectory(), d = u.isFile();
1472
1477
  if (!f && !d)
1473
1478
  return !0;
1474
- const m = K(c || "."), h = f ? "dir" : "file", g = f ? null : u.mtimeMs, b = u.size;
1479
+ const m = W(c || "."), h = f ? "dir" : "file", g = f ? null : u.mtimeMs, b = u.size;
1475
1480
  let y = !0;
1476
1481
  if (d && !t.matchFiles && (y = !1), f && !t.matchDirs && (y = !1), y && d && t.dateModified && g != null) {
1477
1482
  const [w, M] = t.dateModified;
@@ -1485,7 +1490,7 @@ async function Yt(t) {
1485
1490
  if (!(l.countFiles && l.countFiles > 0)) return !1;
1486
1491
  } else if (!y)
1487
1492
  return !1;
1488
- const $ = {
1493
+ const x = {
1489
1494
  path: m ?? ".",
1490
1495
  name: T.basename(a),
1491
1496
  type: h,
@@ -1495,17 +1500,17 @@ async function Yt(t) {
1495
1500
  };
1496
1501
  if (m == null)
1497
1502
  return n.dateModified = g, n.size = b, n.isMatched = y, !0;
1498
- r.set(m, $);
1499
- const I = K(T.dirname(m).replace(/\\/g, "/"));
1500
- let x = s.get(I);
1501
- return x || (x = [], s.set(I, x)), x.push(m), !0;
1503
+ r.set(m, x);
1504
+ const I = W(T.dirname(m).replace(/\\/g, "/"));
1505
+ let S = s.get(I);
1506
+ return S || (S = [], s.set(I, S)), S.push(m), !0;
1502
1507
  }
1503
1508
  }), {
1504
1509
  idToNode: r,
1505
1510
  idToChildIds: s
1506
1511
  };
1507
1512
  }
1508
- const Vt = [
1513
+ const Zt = [
1509
1514
  { name: "[ ]", match: (t) => t === 32, min: 2, max: 81 },
1510
1515
  { name: "[\\t]", match: (t) => t === 9, min: 2, max: 20 },
1511
1516
  { name: "[\\n]", match: (t) => t === 10, min: 2, max: 14 },
@@ -1528,7 +1533,7 @@ const Vt = [
1528
1533
  // max: 2,
1529
1534
  // },
1530
1535
  ];
1531
- function be(t, r = Vt) {
1536
+ function xe(t, r = Zt) {
1532
1537
  const s = t.length;
1533
1538
  if (s === 0) return 0;
1534
1539
  const o = r.length;
@@ -1554,25 +1559,25 @@ function be(t, r = Vt) {
1554
1559
  }
1555
1560
  return e;
1556
1561
  }
1557
- function Pe(t) {
1562
+ function Ue(t) {
1558
1563
  let r = 0;
1559
- return r += be(t.textOpen) + 1, t.textClose != null && (r += be(t.textClose) + 1), t.indent && (r += 1), r;
1564
+ return r += xe(t.textOpen) + 1, t.textClose != null && (r += xe(t.textClose) + 1), t.indent && (r += 1), r;
1560
1565
  }
1561
- const $e = ["B", "KB", "MB", "GB", "TB"], xe = 1024;
1562
- function Zt(t) {
1566
+ const Se = ["B", "KB", "MB", "GB", "TB"], $e = 1024;
1567
+ function Xt(t) {
1563
1568
  if (t == null) return "-";
1564
1569
  let r = t ?? 0, s = 0;
1565
- for (; r >= xe && s < $e.length - 1; )
1566
- r /= xe, s++;
1567
- return `${s === 0 ? r.toString() : r.toFixed(2)}${$e[s]}`;
1570
+ for (; r >= $e && s < Se.length - 1; )
1571
+ r /= $e, s++;
1572
+ return `${s === 0 ? r.toString() : r.toFixed(2)}${Se[s]}`;
1568
1573
  }
1569
- function Xt(t) {
1574
+ function er(t) {
1570
1575
  const s = Date.now() - t;
1571
1576
  if (s < 0) return "0s";
1572
1577
  const o = Math.floor(s / 1e3), e = Math.floor(o / 60), n = Math.floor(e / 60), i = Math.floor(n / 24), a = Math.floor(i / 7), u = Math.floor(i / 30), l = Math.floor(i / 365);
1573
1578
  return l > 0 ? `${l}Y` : u > 0 ? `${u}M` : a > 0 ? `${a}w` : i > 0 ? `${i}d` : n > 0 ? `${n}h` : e > 0 ? `${e}m` : `${o}s`;
1574
1579
  }
1575
- function er(t) {
1580
+ function tr(t) {
1576
1581
  return function(s, o) {
1577
1582
  const e = t.get(s), n = t.get(o);
1578
1583
  if (e.type !== n.type)
@@ -1585,26 +1590,26 @@ function er(t) {
1585
1590
  }
1586
1591
  };
1587
1592
  }
1588
- function tr(t) {
1593
+ function rr(t) {
1589
1594
  const r = t.fields ?? [];
1590
1595
  return function(o, e) {
1591
1596
  let n = "", i, a = 0;
1592
1597
  const u = e ? e.length : 0;
1593
- let l = 1, c, f = 0, d = 0, m = 0, h = 0, g = null, b, y, $;
1598
+ let l = 1, c, f = 0, d = 0, m = 0, h = 0, g = null, b, y, x;
1594
1599
  if (e)
1595
- for (let x = 0; x < e.length; x++) {
1596
- const w = e[x];
1600
+ for (let S = 0; S < e.length; S++) {
1601
+ const w = e[S];
1597
1602
  a += w.countMatched, l += w.countTotal, f += w.tokens, d += w.tokensTotal, m += w.size, h += w.countFiles, w.dateModified != null && (g == null || w.dateModified > g) && (g = w.dateModified);
1598
1603
  }
1599
- o ? (b = o.type, y = o.name, $ = o.path, i = o.isMatched, i && (a += 1), o.type === "file" ? (m = o.size || 0, h = 1, g = o.dateModified || null) : o.dateModified != null && (g == null || o.dateModified > g) && (g = o.dateModified)) : (b = "dir", y = "<root>", $ = ".", i = !0);
1600
- for (let x = 0, w = r.length; x < w; x++) {
1601
- const M = r[x];
1602
- switch (x > 0 && (n += " "), M) {
1604
+ o ? (b = o.type, y = o.name, x = o.path, i = o.isMatched, i && (a += 1), o.type === "file" ? (m = o.size || 0, h = 1, g = o.dateModified || null) : o.dateModified != null && (g == null || o.dateModified > g) && (g = o.dateModified)) : (b = "dir", y = "<root>", x = ".", i = !0);
1605
+ for (let S = 0, w = r.length; S < w; S++) {
1606
+ const M = r[S];
1607
+ switch (S > 0 && (n += " "), M) {
1603
1608
  case "dateModified":
1604
- n += g ? Xt(g) : "-";
1609
+ n += g ? er(g) : "-";
1605
1610
  break;
1606
1611
  case "size":
1607
- n += Zt(m);
1612
+ n += Xt(m);
1608
1613
  break;
1609
1614
  case "type":
1610
1615
  n += b;
@@ -1622,10 +1627,10 @@ function tr(t) {
1622
1627
  textOpen: n,
1623
1628
  textClose: null
1624
1629
  };
1625
- return c = Pe(I), d += c, {
1630
+ return c = Ue(I), d += c, {
1626
1631
  type: b,
1627
1632
  name: y,
1628
- path: $,
1633
+ path: x,
1629
1634
  isMatched: i,
1630
1635
  countMatched: a,
1631
1636
  countChilds: u,
@@ -1640,8 +1645,8 @@ function tr(t) {
1640
1645
  };
1641
1646
  };
1642
1647
  }
1643
- async function rr(t) {
1644
- const r = await Yt(t), s = q(r), o = s.getChilds(s.root), e = Ue({
1648
+ async function sr(t) {
1649
+ const r = await Vt(t), s = _(r), o = s.getChilds(s.root), e = Le({
1645
1650
  getId: (i) => {
1646
1651
  const a = s.getId(i);
1647
1652
  if (a == null)
@@ -1651,29 +1656,29 @@ async function rr(t) {
1651
1656
  return a;
1652
1657
  },
1653
1658
  getChilds: (i) => s.getChilds(i),
1654
- createSnapshotNode: tr(t),
1659
+ createSnapshotNode: rr(t),
1655
1660
  rootNodes: o ?? []
1656
- }), n = er(e.idToNode);
1661
+ }), n = tr(e.idToNode);
1657
1662
  return e.idToChildIds.forEach((i) => {
1658
1663
  i.sort(n);
1659
- }), q(e);
1664
+ }), _(e);
1660
1665
  }
1661
- const Z = p.object({
1666
+ const X = p.object({
1662
1667
  queryName: p.string().optional().describe("Name of previously created filesystem snapshot query, to use"),
1663
- query: V.optional().describe(
1664
- "Filesystem snapshot query creation options to automatically create query"
1668
+ query: Z.optional().describe(
1669
+ "Filesystem snapshot query creation options JSON to automatically create query"
1665
1670
  ),
1666
1671
  name: p.string().describe(
1667
1672
  "Unique name for the filesystem snapshot. Recommended format: kebab-case-1, kebab-case-2, ..."
1668
1673
  )
1669
1674
  });
1670
- async function Le(t, r, s) {
1675
+ async function Ae(t, r, s) {
1671
1676
  let o;
1672
1677
  try {
1673
- o = Z.parse(t);
1678
+ o = X.parse(t);
1674
1679
  } catch (c) {
1675
1680
  return {
1676
- error: `Invalid arguments: ${c instanceof Error ? c.message : "Unknown error"}`
1681
+ error: C(c)
1677
1682
  };
1678
1683
  }
1679
1684
  const { name: e, queryName: n, query: i } = o;
@@ -1681,7 +1686,7 @@ async function Le(t, r, s) {
1681
1686
  return {
1682
1687
  error: "Session ID is required"
1683
1688
  };
1684
- const a = Y(s.sessionId);
1689
+ const a = V(s.sessionId);
1685
1690
  if (a.fsSnapshots.has(e))
1686
1691
  return {
1687
1692
  error: `Filesystem snapshot "${e}" already exists`
@@ -1699,7 +1704,7 @@ async function Le(t, r, s) {
1699
1704
  };
1700
1705
  u = c;
1701
1706
  } else if (i) {
1702
- const c = await Re(
1707
+ const c = await ze(
1703
1708
  i,
1704
1709
  r,
1705
1710
  s
@@ -1714,7 +1719,7 @@ async function Le(t, r, s) {
1714
1719
  error: "Either queryName or query must be provided"
1715
1720
  };
1716
1721
  try {
1717
- const c = await rr(u), f = {
1722
+ const c = await sr(u), f = {
1718
1723
  name: e,
1719
1724
  query: u,
1720
1725
  tree: c
@@ -1729,16 +1734,16 @@ async function Le(t, r, s) {
1729
1734
  };
1730
1735
  }
1731
1736
  }
1732
- function sr(t, r) {
1737
+ function or(t, r) {
1733
1738
  t(
1734
1739
  "fs-snapshot-create",
1735
1740
  {
1736
1741
  title: "Create Filesystem Snapshot",
1737
1742
  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",
1738
- inputSchema: Z.shape
1743
+ inputSchema: X.shape
1739
1744
  },
1740
1745
  async (s, o) => {
1741
- const e = await Le(s, r, o);
1746
+ const e = await Ae(s, r, o);
1742
1747
  if (e.error != null)
1743
1748
  return `Method: fs-snapshot-create(${JSON.stringify(s)})
1744
1749
  ❌ Error: ${e.error}`;
@@ -1749,7 +1754,7 @@ function sr(t, r) {
1749
1754
  }
1750
1755
  );
1751
1756
  }
1752
- class or {
1757
+ class nr {
1753
1758
  _first = null;
1754
1759
  _last = null;
1755
1760
  _size = 0;
@@ -1772,8 +1777,8 @@ class or {
1772
1777
  return this._size;
1773
1778
  }
1774
1779
  }
1775
- function nr(t) {
1776
- const r = new or(), {
1780
+ function ir(t) {
1781
+ const r = new nr(), {
1777
1782
  tree: s,
1778
1783
  limits: { maxCountTotal: o, maxTokensTotal: e, maxCountGroup: n, maxTokensGroup: i },
1779
1784
  indexRangeGroupStrategy: a
@@ -1795,36 +1800,36 @@ function nr(t) {
1795
1800
  const b = g * a.tokens;
1796
1801
  if (o != null && c + m.countChilds + g > o || e != null && f + m.tokensChilds + b > e) {
1797
1802
  const y = [];
1798
- let $ = null, I = 0;
1803
+ let x = null, I = 0;
1799
1804
  for (let w = 0, M = h.length; w < M; w++) {
1800
- const S = h[w], v = I * a.tokens;
1801
- $ != null && // Если общий лимит превышен, то не создаем новую группу, а продолжаем текущую. В случае достижения лимитов, последняя группа может содержать больше элементов, чем указано в лимитах группы, и это допустимо. Главное - дать в отчете полную картину.
1802
- !(o != null && c + 1 > o || e != null && f + a.tokens > e) && (n != null && $.countGrouped + 1 + I > n || i != null && $.tokensGrouped + S.tokens + v > i) && (y.push($), c += 1, f += a.tokens, $ = null, I = 0), $ = a.add($, S, w), S.countChilds > 0 && (I += 1);
1805
+ const $ = h[w], v = I * a.tokens;
1806
+ x != null && // Если общий лимит превышен, то не создаем новую группу, а продолжаем текущую. В случае достижения лимитов, последняя группа может содержать больше элементов, чем указано в лимитах группы, и это допустимо. Главное - дать в отчете полную картину.
1807
+ !(o != null && c + 1 > o || e != null && f + a.tokens > e) && (n != null && x.countGrouped + 1 + I > n || i != null && x.tokensGrouped + $.tokens + v > i) && (y.push(x), c += 1, f += a.tokens, x = null, I = 0), x = a.add(x, $, w), $.countChilds > 0 && (I += 1);
1803
1808
  }
1804
- $ != null && (y.push($), c += 1, f += a.tokens);
1805
- const x = y.map((w) => ({
1809
+ x != null && (y.push(x), c += 1, f += a.tokens);
1810
+ const S = y.map((w) => ({
1806
1811
  text: a.getReportText(w)
1807
1812
  }));
1808
1813
  if (d != null) {
1809
1814
  if (d.childs != null)
1810
1815
  throw new Error("Impossible behavior: reportNode.childs != null");
1811
- d.childs = x;
1816
+ d.childs = S;
1812
1817
  } else {
1813
1818
  if (l != null)
1814
1819
  throw new Error("Impossible behavior: reportRootNodes != null");
1815
- l = x;
1820
+ l = S;
1816
1821
  }
1817
1822
  } else {
1818
1823
  c += m.countChilds, f += m.tokensChilds;
1819
1824
  const y = [];
1820
- for (let $ = 0; $ < h.length; $++) {
1821
- const I = h[$], x = {
1825
+ for (let x = 0; x < h.length; x++) {
1826
+ const I = h[x], S = {
1822
1827
  text: I.text
1823
1828
  };
1824
- y.push(x);
1829
+ y.push(S);
1825
1830
  const w = s.getChilds(I);
1826
1831
  w != null && w.length > 0 && r.enqueue({
1827
- reportNode: x,
1832
+ reportNode: S,
1828
1833
  node: I
1829
1834
  });
1830
1835
  }
@@ -1841,7 +1846,7 @@ function nr(t) {
1841
1846
  }
1842
1847
  return l ?? [];
1843
1848
  }
1844
- function Ae(t) {
1849
+ function Ge(t) {
1845
1850
  const {
1846
1851
  tree: r,
1847
1852
  request: { parentNodeId: s, childsIndexRange: o, limits: e },
@@ -1885,14 +1890,14 @@ function Ae(t) {
1885
1890
  root: c,
1886
1891
  getChilds: (d) => d === c ? [u] : d === u ? l : r.getChilds(d)
1887
1892
  };
1888
- return nr({
1893
+ return ir({
1889
1894
  tree: f,
1890
1895
  limits: e,
1891
1896
  indexRangeGroupStrategy: n,
1892
1897
  ...i
1893
1898
  });
1894
1899
  }
1895
- function Ge(t, r) {
1900
+ function qe(t, r) {
1896
1901
  if (t == null || t.length === 0)
1897
1902
  return "No results found";
1898
1903
  let s = "";
@@ -1909,7 +1914,7 @@ function Ge(t, r) {
1909
1914
  }
1910
1915
  return o(t, ""), s;
1911
1916
  }
1912
- class ir {
1917
+ class ar {
1913
1918
  tokens = 16;
1914
1919
  // +1 indent, +1 for line break
1915
1920
  getReportText = (r) => ({
@@ -1924,10 +1929,10 @@ class ir {
1924
1929
  tokensGrouped: s.tokens
1925
1930
  } : (r.indexRange[1] = o, r.countGrouped += 1, r.countMatched += s.countMatched, r.tokensGrouped += s.tokens, r);
1926
1931
  }
1927
- const qe = p.object({
1932
+ const _e = p.object({
1928
1933
  snapshotName: p.string().optional().describe("Name of previously created filesystem snapshot, to use"),
1929
- snapshot: Z.optional().describe(
1930
- "Filesystem snapshot creation options to automatically create snapshot"
1934
+ snapshot: X.optional().describe(
1935
+ "Filesystem snapshot creation options JSON to automatically create snapshot"
1931
1936
  ),
1932
1937
  parentPath: p.string().optional().describe(
1933
1938
  "Path relative to snapshot rootDir to browse. Omit to browse the rootDir itself"
@@ -1946,13 +1951,13 @@ const qe = p.object({
1946
1951
  // maxCountGroup: z.number().default(10).describe('Maximum items per group'),
1947
1952
  // maxTokensGroup: z.number().default(1000).describe('Maximum tokens per group'),
1948
1953
  });
1949
- async function ar(t, r, s) {
1954
+ async function lr(t, r, s) {
1950
1955
  let o;
1951
1956
  try {
1952
- o = qe.parse(t);
1957
+ o = _e.parse(t);
1953
1958
  } catch (g) {
1954
1959
  return {
1955
- error: `Invalid arguments: ${g instanceof Error ? g.message : "Unknown error"}`
1960
+ error: C(g)
1956
1961
  };
1957
1962
  }
1958
1963
  const {
@@ -1968,7 +1973,7 @@ async function ar(t, r, s) {
1968
1973
  return {
1969
1974
  error: "Session ID is required"
1970
1975
  };
1971
- const f = Y(s.sessionId);
1976
+ const f = V(s.sessionId);
1972
1977
  let d, m = !1, h = !1;
1973
1978
  if (e && n)
1974
1979
  return {
@@ -1980,7 +1985,7 @@ async function ar(t, r, s) {
1980
1985
  error: `Filesystem snapshot "${e}" not found`
1981
1986
  };
1982
1987
  } else if (n) {
1983
- const g = await Le(
1988
+ const g = await Ae(
1984
1989
  n,
1985
1990
  r,
1986
1991
  s
@@ -1995,7 +2000,7 @@ async function ar(t, r, s) {
1995
2000
  error: "Either snapshotName or snapshot must be provided"
1996
2001
  };
1997
2002
  try {
1998
- const g = K(o.parentPath), b = Ae({
2003
+ const g = W(o.parentPath), b = Ge({
1999
2004
  tree: d.tree,
2000
2005
  request: {
2001
2006
  parentNodeId: g,
@@ -2007,8 +2012,8 @@ async function ar(t, r, s) {
2007
2012
  maxTokensGroup: c
2008
2013
  }
2009
2014
  },
2010
- indexRangeGroupStrategy: new ir()
2011
- }), y = Ge(b);
2015
+ indexRangeGroupStrategy: new ar()
2016
+ }), y = qe(b);
2012
2017
  return {
2013
2018
  fsSnapshot: d,
2014
2019
  queryCreated: m,
@@ -2023,16 +2028,16 @@ async function ar(t, r, s) {
2023
2028
  };
2024
2029
  }
2025
2030
  }
2026
- function lr(t, r) {
2031
+ function cr(t, r) {
2027
2032
  t(
2028
2033
  "fs-snapshot-browse",
2029
2034
  {
2030
2035
  title: "Browse Filesystem Snapshot",
2031
2036
  description: "Browse and explore filesystem. Use this to efficiently browse, analyze, explore, inspect, etc directory and file structures",
2032
- inputSchema: qe.shape
2037
+ inputSchema: _e.shape
2033
2038
  },
2034
2039
  async (s, o) => {
2035
- const e = await ar(s, r, o);
2040
+ const e = await lr(s, r, o);
2036
2041
  if (e.error != null)
2037
2042
  return `Method: fs-snapshot-browse(${JSON.stringify(s)})
2038
2043
  ❌ Error: ${e.error}`;
@@ -2054,21 +2059,21 @@ ${e.report}`, n;
2054
2059
  }
2055
2060
  );
2056
2061
  }
2057
- function cr(t, r) {
2058
- r.list && Wt(t, r), r.snapshotQueryCreate && Ht(t, r), r.snapshotCreate && sr(t, r), r.snapshotBrowse && lr(t, r), console.log(
2062
+ function ur(t, r) {
2063
+ r.list && Qt(t, r), r.snapshotQueryCreate && Yt(t, r), r.snapshotCreate && or(t, r), r.snapshotBrowse && cr(t, r), console.log(
2059
2064
  `File manager:
2060
2065
  - Working directory: ${T.resolve(r.workingDir || "")}
2061
2066
  `
2062
2067
  );
2063
2068
  }
2064
- const j = /* @__PURE__ */ new Map();
2065
- function N(t) {
2066
- return j.has(t) || j.set(t, {
2069
+ const J = /* @__PURE__ */ new Map();
2070
+ function E(t) {
2071
+ return J.has(t) || J.set(t, {
2067
2072
  browsers: /* @__PURE__ */ new Map(),
2068
2073
  domSnapshotQueries: /* @__PURE__ */ new Map()
2069
- }), j.get(t);
2074
+ }), J.get(t);
2070
2075
  }
2071
- const X = p.object({
2076
+ const ee = p.object({
2072
2077
  name: p.string().describe(
2073
2078
  "Unique name for the browser. Recommended format: kebab-case-1, kebab-case-2, ..."
2074
2079
  ),
@@ -2076,13 +2081,13 @@ const X = p.object({
2076
2081
  muteAudio: p.boolean().optional().describe("Mute audio in the browser"),
2077
2082
  devTools: p.boolean().optional().describe("Open browser with dev tools")
2078
2083
  });
2079
- async function _e(t, r, s) {
2084
+ async function je(t, r, s) {
2080
2085
  let o;
2081
2086
  try {
2082
- o = X.parse(t);
2087
+ o = ee.parse(t);
2083
2088
  } catch (c) {
2084
2089
  return {
2085
- error: `Invalid arguments: ${c instanceof Error ? c.message : "Unknown error"}`
2090
+ error: C(c)
2086
2091
  };
2087
2092
  }
2088
2093
  const { name: e, browserType: n, muteAudio: i, devTools: a } = o;
@@ -2090,16 +2095,16 @@ async function _e(t, r, s) {
2090
2095
  return {
2091
2096
  error: "Session ID is required"
2092
2097
  };
2093
- const u = N(s.sessionId), l = u.browsers.get(e);
2098
+ const u = E(s.sessionId), l = u.browsers.get(e);
2094
2099
  if (l)
2095
2100
  return {
2096
2101
  error: `Browser "${l.name}" (${l.browserType}) already exists`
2097
2102
  };
2098
2103
  try {
2099
2104
  const f = await {
2100
- chromium: pt,
2101
- firefox: ht,
2102
- webkit: mt
2105
+ chromium: gt,
2106
+ firefox: pt,
2107
+ webkit: ht
2103
2108
  }[n].launch({
2104
2109
  headless: !1,
2105
2110
  devtools: a,
@@ -2117,50 +2122,50 @@ async function _e(t, r, s) {
2117
2122
  };
2118
2123
  }
2119
2124
  }
2120
- function ur(t, r) {
2125
+ function dr(t, r) {
2121
2126
  t(
2122
2127
  "playwright-browser-create",
2123
2128
  {
2124
2129
  title: "Create Browser",
2125
2130
  description: "Create a new browser. Prefer page-goto if you need to immediately create a browser, context, page and navigate",
2126
- inputSchema: X.shape
2131
+ inputSchema: ee.shape
2127
2132
  },
2128
2133
  async (s, o) => {
2129
- const e = await _e(s, r, o);
2134
+ const e = await je(s, r, o);
2130
2135
  return `Method: playwright-browser-create(${JSON.stringify(s)})
2131
2136
  ${e.error != null ? `❌ Error: ${e.error}` : `✅ Browser "${e.browserInfo.name}" (${e.browserInfo.browserType}) created successfully`}`;
2132
2137
  }
2133
2138
  );
2134
2139
  }
2135
- const je = p.object({});
2136
- async function dr(t, r, s) {
2140
+ const Je = p.object({});
2141
+ async function fr(t, r, s) {
2137
2142
  let o;
2138
2143
  try {
2139
- o = je.parse(t);
2144
+ o = Je.parse(t);
2140
2145
  } catch (i) {
2141
2146
  return {
2142
- error: `Invalid arguments: ${i instanceof Error ? i.message : "Unknown error"}`
2147
+ error: C(i)
2143
2148
  };
2144
2149
  }
2145
2150
  if (!s.sessionId)
2146
2151
  return {
2147
2152
  error: "Session ID is required"
2148
2153
  };
2149
- const e = N(s.sessionId);
2154
+ const e = E(s.sessionId);
2150
2155
  return {
2151
2156
  browserInfos: Array.from(e.browsers.values())
2152
2157
  };
2153
2158
  }
2154
- function fr(t, r) {
2159
+ function mr(t, r) {
2155
2160
  t(
2156
2161
  "playwright-browser-list",
2157
2162
  {
2158
2163
  title: "List Browsers",
2159
2164
  description: "List active browser instances",
2160
- inputSchema: je.shape
2165
+ inputSchema: Je.shape
2161
2166
  },
2162
2167
  async (s, o) => {
2163
- const e = await dr(s, r, o);
2168
+ const e = await fr(s, r, o);
2164
2169
  if (e.error != null)
2165
2170
  return `Method: playwright-browser-list(${JSON.stringify(s)})
2166
2171
  ❌ Error: ${e.error}`;
@@ -2172,18 +2177,18 @@ ${n.length === 0 ? "No browsers found" : `Browsers: ${n.join(", ")}`}`;
2172
2177
  }
2173
2178
  );
2174
2179
  }
2175
- const Je = p.object({
2180
+ const Ke = p.object({
2176
2181
  names: p.array(p.string()).optional().describe(
2177
2182
  "Names of browsers to close. If not specified, closes all browsers"
2178
2183
  )
2179
2184
  });
2180
- async function mr(t, r, s) {
2185
+ async function hr(t, r, s) {
2181
2186
  let o;
2182
2187
  try {
2183
- o = Je.parse(t);
2188
+ o = Ke.parse(t);
2184
2189
  } catch (l) {
2185
2190
  return {
2186
- error: `Invalid arguments: ${l instanceof Error ? l.message : "Unknown error"}`
2191
+ error: C(l)
2187
2192
  };
2188
2193
  }
2189
2194
  const { names: e } = o;
@@ -2191,7 +2196,7 @@ async function mr(t, r, s) {
2191
2196
  return {
2192
2197
  error: "Session ID is required"
2193
2198
  };
2194
- const n = N(s.sessionId), i = [], a = [];
2199
+ const n = E(s.sessionId), i = [], a = [];
2195
2200
  let u = [];
2196
2201
  return e ? e.forEach((l) => {
2197
2202
  const c = n.browsers.get(l);
@@ -2211,16 +2216,16 @@ async function mr(t, r, s) {
2211
2216
  ...a.length > 0 && { errors: a }
2212
2217
  };
2213
2218
  }
2214
- function hr(t, r) {
2219
+ function pr(t, r) {
2215
2220
  t(
2216
2221
  "playwright-browser-close",
2217
2222
  {
2218
2223
  title: "Close Browsers",
2219
2224
  description: "Close browsers. Automatically closes all contexts and pages within the browsers",
2220
- inputSchema: Je.shape
2225
+ inputSchema: Ke.shape
2221
2226
  },
2222
2227
  async (s, o) => {
2223
- const e = await mr(s, r, o);
2228
+ const e = await hr(s, r, o);
2224
2229
  if (e.error != null)
2225
2230
  return `Method: playwright-browser-close(${JSON.stringify(s)})
2226
2231
  ❌ Error: ${e.error}`;
@@ -2237,10 +2242,10 @@ ${n.join(`
2237
2242
  }
2238
2243
  );
2239
2244
  }
2240
- const ee = p.object({
2245
+ const te = p.object({
2241
2246
  browserName: p.string().optional().describe("Name of previously created browser, to use"),
2242
- browser: X.optional().describe(
2243
- "Browser creation options to automatically create browser"
2247
+ browser: ee.optional().describe(
2248
+ "Browser creation options JSON to automatically create browser"
2244
2249
  ),
2245
2250
  name: p.string().describe(
2246
2251
  "Unique name for the context. Recommended format: kebab-case-1, kebab-case-2, ..."
@@ -2252,13 +2257,13 @@ const ee = p.object({
2252
2257
  height: p.number()
2253
2258
  }).optional().describe("Viewport size configuration")
2254
2259
  });
2255
- async function Ke(t, r, s) {
2260
+ async function We(t, r, s) {
2256
2261
  let o;
2257
2262
  try {
2258
- o = ee.parse(t);
2263
+ o = te.parse(t);
2259
2264
  } catch (m) {
2260
2265
  return {
2261
- error: `Invalid arguments: ${m instanceof Error ? m.message : "Unknown error"}`
2266
+ error: C(m)
2262
2267
  };
2263
2268
  }
2264
2269
  const { name: e, browserName: n, browser: i, isMobile: a, hasTouch: u, viewport: l } = o;
@@ -2266,7 +2271,7 @@ async function Ke(t, r, s) {
2266
2271
  return {
2267
2272
  error: "Session ID is required"
2268
2273
  };
2269
- const c = N(s.sessionId);
2274
+ const c = E(s.sessionId);
2270
2275
  if (n && i)
2271
2276
  return {
2272
2277
  error: "Either browserName or browser must be provided, not both"
@@ -2278,7 +2283,7 @@ async function Ke(t, r, s) {
2278
2283
  error: `Browser "${n}" not found`
2279
2284
  };
2280
2285
  } else if (i) {
2281
- const m = await _e(i, r, s);
2286
+ const m = await je(i, r, s);
2282
2287
  if (m.error != null)
2283
2288
  return {
2284
2289
  error: m.error
@@ -2314,16 +2319,16 @@ async function Ke(t, r, s) {
2314
2319
  };
2315
2320
  }
2316
2321
  }
2317
- function pr(t, r) {
2322
+ function gr(t, r) {
2318
2323
  t(
2319
2324
  "playwright-context-create",
2320
2325
  {
2321
2326
  title: "Create Browser Context",
2322
2327
  description: "Create a new browser context. Prefer page-goto if you need to immediately create a context, page and navigate",
2323
- inputSchema: ee.shape
2328
+ inputSchema: te.shape
2324
2329
  },
2325
2330
  async (s, o) => {
2326
- const e = await Ke(s, r, o);
2331
+ const e = await We(s, r, o);
2327
2332
  if (e.error != null)
2328
2333
  return `Method: playwright-context-create(${JSON.stringify(s)})
2329
2334
  ❌ Error: ${e.error}`;
@@ -2334,18 +2339,18 @@ function pr(t, r) {
2334
2339
  }
2335
2340
  );
2336
2341
  }
2337
- const We = p.object({
2342
+ const Qe = p.object({
2338
2343
  browserName: p.string().optional().describe(
2339
2344
  "Name of browser to list contexts from. If not specified, lists contexts from all browsers"
2340
2345
  )
2341
2346
  });
2342
- async function gr(t, r, s) {
2347
+ async function wr(t, r, s) {
2343
2348
  let o;
2344
2349
  try {
2345
- o = We.parse(t);
2350
+ o = Qe.parse(t);
2346
2351
  } catch (a) {
2347
2352
  return {
2348
- error: `Invalid arguments: ${a instanceof Error ? a.message : "Unknown error"}`
2353
+ error: C(a)
2349
2354
  };
2350
2355
  }
2351
2356
  const { browserName: e } = o;
@@ -2353,7 +2358,7 @@ async function gr(t, r, s) {
2353
2358
  return {
2354
2359
  error: "Session ID is required"
2355
2360
  };
2356
- const n = N(s.sessionId), i = [];
2361
+ const n = E(s.sessionId), i = [];
2357
2362
  if (e) {
2358
2363
  const a = n.browsers.get(e);
2359
2364
  if (!a)
@@ -2376,16 +2381,16 @@ async function gr(t, r, s) {
2376
2381
  contextsByBrowser: i
2377
2382
  };
2378
2383
  }
2379
- function wr(t, r) {
2384
+ function yr(t, r) {
2380
2385
  t(
2381
2386
  "playwright-context-list",
2382
2387
  {
2383
2388
  title: "List Browser Contexts",
2384
2389
  description: "List active browser contexts",
2385
- inputSchema: We.shape
2390
+ inputSchema: Qe.shape
2386
2391
  },
2387
2392
  async (s, o) => {
2388
- const e = await gr(s, r, o);
2393
+ const e = await wr(s, r, o);
2389
2394
  if ("error" in e)
2390
2395
  return `Method: playwright-context-list(${JSON.stringify(s)})
2391
2396
  ❌ Error: ${e.error}`;
@@ -2398,7 +2403,7 @@ function wr(t, r) {
2398
2403
  }
2399
2404
  );
2400
2405
  }
2401
- const Qe = p.object({
2406
+ const He = p.object({
2402
2407
  names: p.array(p.string()).optional().describe(
2403
2408
  "Names of contexts to close. If not specified, closes all contexts"
2404
2409
  ),
@@ -2406,13 +2411,13 @@ const Qe = p.object({
2406
2411
  "Name of browser to close contexts from. If not specified, searches all browsers"
2407
2412
  )
2408
2413
  });
2409
- async function yr(t, r, s) {
2414
+ async function br(t, r, s) {
2410
2415
  let o;
2411
2416
  try {
2412
- o = Qe.parse(t);
2417
+ o = He.parse(t);
2413
2418
  } catch (c) {
2414
2419
  return {
2415
- error: `Invalid arguments: ${c instanceof Error ? c.message : "Unknown error"}`
2420
+ error: C(c)
2416
2421
  };
2417
2422
  }
2418
2423
  const { names: e, browserName: n } = o;
@@ -2420,7 +2425,7 @@ async function yr(t, r, s) {
2420
2425
  return {
2421
2426
  error: "Session ID is required"
2422
2427
  };
2423
- const i = N(s.sessionId), a = [], u = [];
2428
+ const i = E(s.sessionId), a = [], u = [];
2424
2429
  let l = [];
2425
2430
  if (n) {
2426
2431
  const c = i.browsers.get(n);
@@ -2460,16 +2465,16 @@ async function yr(t, r, s) {
2460
2465
  ...u.length > 0 && { errors: u }
2461
2466
  };
2462
2467
  }
2463
- function br(t, r) {
2468
+ function xr(t, r) {
2464
2469
  t(
2465
2470
  "playwright-context-close",
2466
2471
  {
2467
2472
  title: "Close Browser Contexts",
2468
2473
  description: "Close browser contexts. Automatically closes all pages within the contexts",
2469
- inputSchema: Qe.shape
2474
+ inputSchema: He.shape
2470
2475
  },
2471
2476
  async (s, o) => {
2472
- const e = await yr(s, r, o);
2477
+ const e = await br(s, r, o);
2473
2478
  if ("error" in e)
2474
2479
  return `Method: playwright-context-close(${JSON.stringify(s)})
2475
2480
  ❌ Error: ${e.error}`;
@@ -2486,7 +2491,7 @@ ${n.join(`
2486
2491
  }
2487
2492
  );
2488
2493
  }
2489
- function $r() {
2494
+ function Sr() {
2490
2495
  class t {
2491
2496
  prevId = 0;
2492
2497
  objectToId = /* @__PURE__ */ new WeakMap();
@@ -2521,15 +2526,15 @@ function $r() {
2521
2526
  const { getId: u, getChilds: l, rootNodes: c, createSnapshotNode: f } = a, d = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map(), g = r(
2522
2527
  l,
2523
2528
  c,
2524
- (y, $) => {
2525
- const I = f(y, $);
2529
+ (y, x) => {
2530
+ const I = f(y, x);
2526
2531
  if (y != null && I != null) {
2527
- const x = u(y);
2528
- d.set(x, I), m.set(I, x);
2532
+ const S = u(y);
2533
+ d.set(S, I), m.set(I, S);
2529
2534
  }
2530
- return I != null && $ != null && h.set(
2535
+ return I != null && x != null && h.set(
2531
2536
  m.get(I),
2532
- $.map((x) => m.get(x))
2537
+ x.map((S) => m.get(S))
2533
2538
  ), I;
2534
2539
  }
2535
2540
  ), b = f(null, g);
@@ -2574,22 +2579,22 @@ function $r() {
2574
2579
  }
2575
2580
  window.__mcp_playwright_tool_tx4byhar35_createDomSnapshotTreeRawDom = i;
2576
2581
  }
2577
- const xr = `(function (){function __name(fn){return fn};${$r.toString()}; setupPageGlobals();})()`, te = p.object({
2582
+ const $r = `(function (){function __name(fn){return fn};${Sr.toString()}; setupPageGlobals();})()`, re = p.object({
2578
2583
  contextName: p.string().optional().describe("Name of previously created context, to use"),
2579
- context: ee.optional().describe(
2580
- "Context creation options to automatically create context"
2584
+ context: te.optional().describe(
2585
+ "Context creation options JSON to automatically create context"
2581
2586
  ),
2582
2587
  name: p.string().describe(
2583
2588
  "Unique name for the page. Recommended format: kebab-case-1, kebab-case-2, ..."
2584
2589
  )
2585
2590
  });
2586
- async function He(t, r, s) {
2591
+ async function Ye(t, r, s) {
2587
2592
  let o;
2588
2593
  try {
2589
- o = te.parse(t);
2594
+ o = re.parse(t);
2590
2595
  } catch (f) {
2591
2596
  return {
2592
- error: `Invalid arguments: ${f instanceof Error ? f.message : "Unknown error"}`
2597
+ error: C(f)
2593
2598
  };
2594
2599
  }
2595
2600
  const { name: e, contextName: n, context: i } = o;
@@ -2597,7 +2602,7 @@ async function He(t, r, s) {
2597
2602
  return {
2598
2603
  error: "Session ID is required"
2599
2604
  };
2600
- const a = N(s.sessionId);
2605
+ const a = E(s.sessionId);
2601
2606
  if (n && i)
2602
2607
  return {
2603
2608
  error: "Either contextName or context must be provided, not both"
@@ -2614,7 +2619,7 @@ async function He(t, r, s) {
2614
2619
  error: `Context "${n}" not found`
2615
2620
  };
2616
2621
  } else if (i) {
2617
- const f = await Ke(i, r, s);
2622
+ const f = await We(i, r, s);
2618
2623
  if (f.error != null)
2619
2624
  return {
2620
2625
  error: f.error
@@ -2630,7 +2635,7 @@ async function He(t, r, s) {
2630
2635
  };
2631
2636
  try {
2632
2637
  const f = await c.context.newPage();
2633
- await f.addInitScript(xr), await f.goto("about:blank");
2638
+ await f.addInitScript($r), await f.goto("about:blank");
2634
2639
  const d = {
2635
2640
  contextInfo: c,
2636
2641
  name: e,
@@ -2648,16 +2653,16 @@ async function He(t, r, s) {
2648
2653
  };
2649
2654
  }
2650
2655
  }
2651
- function Sr(t, r) {
2656
+ function Ir(t, r) {
2652
2657
  t(
2653
2658
  "playwright-page-create",
2654
2659
  {
2655
2660
  title: "Create Page",
2656
2661
  description: "Create a new page. Prefer page-goto if you need to immediately create a page and navigate",
2657
- inputSchema: te.shape
2662
+ inputSchema: re.shape
2658
2663
  },
2659
2664
  async (s, o) => {
2660
- const e = await He(s, r, o);
2665
+ const e = await Ye(s, r, o);
2661
2666
  if (e.error != null)
2662
2667
  return `Method: playwright-page-create(${JSON.stringify(s)})
2663
2668
  ❌ Error: ${e.error}`;
@@ -2669,7 +2674,7 @@ function Sr(t, r) {
2669
2674
  }
2670
2675
  );
2671
2676
  }
2672
- const Ye = p.object({
2677
+ const Ve = p.object({
2673
2678
  contextName: p.string().optional().describe(
2674
2679
  "Name of context to list pages from. If not specified, lists pages from all contexts"
2675
2680
  ),
@@ -2677,13 +2682,13 @@ const Ye = p.object({
2677
2682
  "Name of browser to search in. If not specified, searches all browsers"
2678
2683
  )
2679
2684
  });
2680
- async function Ir(t, r, s) {
2685
+ async function Mr(t, r, s) {
2681
2686
  let o;
2682
2687
  try {
2683
- o = Ye.parse(t);
2688
+ o = Ve.parse(t);
2684
2689
  } catch (u) {
2685
2690
  return {
2686
- error: `Invalid arguments: ${u instanceof Error ? u.message : "Unknown error"}`
2691
+ error: C(u)
2687
2692
  };
2688
2693
  }
2689
2694
  const { contextName: e, browserName: n } = o;
@@ -2691,7 +2696,7 @@ async function Ir(t, r, s) {
2691
2696
  return {
2692
2697
  error: "Session ID is required"
2693
2698
  };
2694
- const i = N(s.sessionId), a = [];
2699
+ const i = E(s.sessionId), a = [];
2695
2700
  if (n) {
2696
2701
  const u = i.browsers.get(n);
2697
2702
  if (!u)
@@ -2741,16 +2746,16 @@ async function Ir(t, r, s) {
2741
2746
  pagesByContext: a
2742
2747
  };
2743
2748
  }
2744
- function Mr(t, r) {
2749
+ function Tr(t, r) {
2745
2750
  t(
2746
2751
  "playwright-page-list",
2747
2752
  {
2748
2753
  title: "List Pages",
2749
2754
  description: "List active pages",
2750
- inputSchema: Ye.shape
2755
+ inputSchema: Ve.shape
2751
2756
  },
2752
2757
  async (s, o) => {
2753
- const e = await Ir(s, r, o);
2758
+ const e = await Mr(s, r, o);
2754
2759
  if ("error" in e)
2755
2760
  return `Method: playwright-page-list(${JSON.stringify(s)})
2756
2761
  ❌ Error: ${e.error}`;
@@ -2763,7 +2768,7 @@ function Mr(t, r) {
2763
2768
  }
2764
2769
  );
2765
2770
  }
2766
- const Ve = p.object({
2771
+ const Ze = p.object({
2767
2772
  names: p.array(p.string()).optional().describe("Names of pages to close. If not specified, closes all pages"),
2768
2773
  contextName: p.string().optional().describe(
2769
2774
  "Name of context to close pages from. If not specified, searches all contexts"
@@ -2772,13 +2777,13 @@ const Ve = p.object({
2772
2777
  "Name of browser to search in. If not specified, searches all browsers"
2773
2778
  )
2774
2779
  });
2775
- async function Tr(t, r, s) {
2780
+ async function vr(t, r, s) {
2776
2781
  let o;
2777
2782
  try {
2778
- o = Ve.parse(t);
2783
+ o = Ze.parse(t);
2779
2784
  } catch (f) {
2780
2785
  return {
2781
- error: `Invalid arguments: ${f instanceof Error ? f.message : "Unknown error"}`
2786
+ error: C(f)
2782
2787
  };
2783
2788
  }
2784
2789
  const { names: e, contextName: n, browserName: i } = o;
@@ -2786,7 +2791,7 @@ async function Tr(t, r, s) {
2786
2791
  return {
2787
2792
  error: "Session ID is required"
2788
2793
  };
2789
- const a = N(s.sessionId), u = [], l = [];
2794
+ const a = E(s.sessionId), u = [], l = [];
2790
2795
  let c = [];
2791
2796
  if (i) {
2792
2797
  const f = a.browsers.get(i);
@@ -2850,16 +2855,16 @@ async function Tr(t, r, s) {
2850
2855
  ...l.length > 0 && { errors: l }
2851
2856
  };
2852
2857
  }
2853
- function vr(t, r) {
2858
+ function Cr(t, r) {
2854
2859
  t(
2855
2860
  "playwright-page-close",
2856
2861
  {
2857
2862
  title: "Close Pages",
2858
2863
  description: "Close pages",
2859
- inputSchema: Ve.shape
2864
+ inputSchema: Ze.shape
2860
2865
  },
2861
2866
  async (s, o) => {
2862
- const e = await Tr(s, r, o);
2867
+ const e = await vr(s, r, o);
2863
2868
  if ("error" in e)
2864
2869
  return `Method: playwright-page-close(${JSON.stringify(s)})
2865
2870
  ❌ Error: ${e.error}`;
@@ -2870,10 +2875,10 @@ ${n.join(`
2870
2875
  }
2871
2876
  );
2872
2877
  }
2873
- const Ze = p.object({
2878
+ const Xe = p.object({
2874
2879
  pageName: p.string().optional().describe("Name of previously created page to navigate"),
2875
- page: te.optional().describe(
2876
- "Page creation options to automatically create page"
2880
+ page: re.optional().describe(
2881
+ "Page creation options JSON to automatically create page"
2877
2882
  ),
2878
2883
  url: p.string().describe("URL to navigate to"),
2879
2884
  timeout: p.number().describe("Timeout in seconds"),
@@ -2888,10 +2893,10 @@ const Ze = p.object({
2888
2893
  async function kr(t, r, s) {
2889
2894
  let o;
2890
2895
  try {
2891
- o = Ze.parse(t);
2896
+ o = Xe.parse(t);
2892
2897
  } catch (h) {
2893
2898
  return {
2894
- error: `Invalid arguments: ${h instanceof Error ? h.message : "Unknown error"}`
2899
+ error: C(h)
2895
2900
  };
2896
2901
  }
2897
2902
  const { pageName: e, page: n, url: i, timeout: a, waitUntil: u } = o;
@@ -2899,7 +2904,7 @@ async function kr(t, r, s) {
2899
2904
  return {
2900
2905
  error: "Session ID is required"
2901
2906
  };
2902
- const l = N(s.sessionId);
2907
+ const l = E(s.sessionId);
2903
2908
  if (e && n)
2904
2909
  return {
2905
2910
  error: "Either pageName or page must be provided, not both"
@@ -2919,7 +2924,7 @@ async function kr(t, r, s) {
2919
2924
  error: `Page "${e}" not found`
2920
2925
  };
2921
2926
  } else if (n) {
2922
- const h = await He(n, r, s);
2927
+ const h = await Ye(n, r, s);
2923
2928
  if (h.error != null)
2924
2929
  return {
2925
2930
  error: h.error
@@ -2953,13 +2958,13 @@ async function kr(t, r, s) {
2953
2958
  };
2954
2959
  }
2955
2960
  }
2956
- function Cr(t, r) {
2961
+ function Nr(t, r) {
2957
2962
  t(
2958
2963
  "playwright-page-goto",
2959
2964
  {
2960
2965
  title: "Navigate Page",
2961
2966
  description: "Navigate page to URL. Use for manual browser interaction",
2962
- inputSchema: Ze.shape
2967
+ inputSchema: Xe.shape
2963
2968
  },
2964
2969
  async (s, o) => {
2965
2970
  const e = await kr(s, r, o);
@@ -2975,19 +2980,19 @@ function Cr(t, r) {
2975
2980
  }
2976
2981
  );
2977
2982
  }
2978
- const re = p.object({
2983
+ const se = p.object({
2979
2984
  name: p.string().describe(
2980
2985
  "Unique name for the DOM snapshot query. Recommended format: kebab-case-1, kebab-case-2, ..."
2981
2986
  ),
2982
2987
  cssSelector: p.string().describe("CSS selector to capture page content")
2983
2988
  });
2984
- async function Xe(t, r, s) {
2989
+ async function et(t, r, s) {
2985
2990
  let o;
2986
2991
  try {
2987
- o = re.parse(t);
2992
+ o = se.parse(t);
2988
2993
  } catch (u) {
2989
2994
  return {
2990
- error: `Invalid arguments: ${u instanceof Error ? u.message : "Unknown error"}`
2995
+ error: C(u)
2991
2996
  };
2992
2997
  }
2993
2998
  const { name: e, cssSelector: n } = o;
@@ -2995,7 +3000,7 @@ async function Xe(t, r, s) {
2995
3000
  return {
2996
3001
  error: "Session ID is required"
2997
3002
  };
2998
- const i = N(s.sessionId);
3003
+ const i = E(s.sessionId);
2999
3004
  if (i.domSnapshotQueries.has(e))
3000
3005
  return {
3001
3006
  error: `DOM snapshot query "${e}" already exists`
@@ -3008,23 +3013,23 @@ async function Xe(t, r, s) {
3008
3013
  snapshotQuery: a
3009
3014
  };
3010
3015
  }
3011
- function Er(t, r) {
3016
+ function Dr(t, r) {
3012
3017
  t(
3013
3018
  "playwright-dom-snapshot-query-create",
3014
3019
  {
3015
3020
  title: "Create DOM Snapshot Query",
3016
3021
  description: "Create a DOM snapshot query. Prefer dom-snapshot-browse if you need to immediately create a query and snapshot and browse it",
3017
- inputSchema: re.shape
3022
+ inputSchema: se.shape
3018
3023
  },
3019
3024
  async (s, o) => {
3020
- const e = await Xe(s, r, o);
3025
+ const e = await et(s, r, o);
3021
3026
  return e.error != null ? `Method: playwright-dom-snapshot-query-create(${JSON.stringify(s)})
3022
3027
  ❌ Error: ${e.error}` : `Method: playwright-dom-snapshot-query-create(${JSON.stringify(s)})
3023
3028
  ✅ DOM snapshot query "${e.snapshotQuery.name}" created successfully`;
3024
3029
  }
3025
3030
  );
3026
3031
  }
3027
- function Nr(t) {
3032
+ function Er(t) {
3028
3033
  return function(s, o) {
3029
3034
  let e, n = 0;
3030
3035
  const i = o ? o.length : 0;
@@ -3045,7 +3050,7 @@ function Nr(t) {
3045
3050
  textOpen: `<root uid:${c}>`,
3046
3051
  textClose: "</root>"
3047
3052
  };
3048
- const m = Pe(d);
3053
+ const m = Ue(d);
3049
3054
  return l += m, {
3050
3055
  uid: c,
3051
3056
  tagName: f,
@@ -3060,8 +3065,8 @@ function Nr(t) {
3060
3065
  };
3061
3066
  };
3062
3067
  }
3063
- function Dr(t, r) {
3064
- const s = q(r), o = s.getChilds(s.root), e = Ue({
3068
+ function Br(t, r) {
3069
+ const s = _(r), o = s.getChilds(s.root), e = Le({
3065
3070
  getId: (n) => {
3066
3071
  const i = s.getId(n);
3067
3072
  if (i == null)
@@ -3071,28 +3076,28 @@ function Dr(t, r) {
3071
3076
  return i;
3072
3077
  },
3073
3078
  getChilds: (n) => s.getChilds(n),
3074
- createSnapshotNode: Nr(),
3079
+ createSnapshotNode: Er(),
3075
3080
  rootNodes: o ?? []
3076
3081
  });
3077
- return q(e);
3082
+ return _(e);
3078
3083
  }
3079
- const se = p.object({
3084
+ const oe = p.object({
3080
3085
  pageName: p.string().describe("Name of previously created page, to create snapshot from"),
3081
3086
  queryName: p.string().optional().describe("Name of previously created DOM snapshot query, to use"),
3082
- query: re.optional().describe(
3083
- "DOM snapshot query creation options to automatically create query"
3087
+ query: se.optional().describe(
3088
+ "DOM snapshot query creation options JSON to automatically create query"
3084
3089
  ),
3085
3090
  name: p.string().describe(
3086
3091
  "Unique name for the DOM snapshot. Recommended format: kebab-case-1, kebab-case-2, ..."
3087
3092
  )
3088
3093
  });
3089
- async function et(t, r, s) {
3094
+ async function tt(t, r, s) {
3090
3095
  let o;
3091
3096
  try {
3092
- o = se.parse(t);
3097
+ o = oe.parse(t);
3093
3098
  } catch (d) {
3094
3099
  return {
3095
- error: `Invalid arguments: ${d instanceof Error ? d.message : "Unknown error"}`
3100
+ error: C(d)
3096
3101
  };
3097
3102
  }
3098
3103
  const { pageName: e, queryName: n, query: i, name: a } = o;
@@ -3100,7 +3105,7 @@ async function et(t, r, s) {
3100
3105
  return {
3101
3106
  error: "Session ID is required"
3102
3107
  };
3103
- const u = N(s.sessionId);
3108
+ const u = E(s.sessionId);
3104
3109
  let l;
3105
3110
  for (const d of u.browsers.values()) {
3106
3111
  for (const m of d.contexts.values())
@@ -3131,7 +3136,7 @@ async function et(t, r, s) {
3131
3136
  };
3132
3137
  c = d;
3133
3138
  } else if (i) {
3134
- const d = await Xe(
3139
+ const d = await et(
3135
3140
  i,
3136
3141
  r,
3137
3142
  s
@@ -3151,17 +3156,17 @@ async function et(t, r, s) {
3151
3156
  const y = window.__mcp_playwright_tool_tx4byhar35_createDomSnapshotTreeRawDom;
3152
3157
  if (!y)
3153
3158
  throw new Error("DOM snapshot global function not initialized");
3154
- const $ = y(b);
3159
+ const x = y(b);
3155
3160
  return {
3156
- idToNode: Array.from($.idToNode.entries()),
3157
- idToChildIds: Array.from($.idToChildIds.entries())
3161
+ idToNode: Array.from(x.idToNode.entries()),
3162
+ idToChildIds: Array.from(x.idToChildIds.entries())
3158
3163
  };
3159
3164
  },
3160
3165
  c
3161
3166
  ), m = {
3162
3167
  idToNode: new Map(d.idToNode),
3163
3168
  idToChildIds: new Map(d.idToChildIds)
3164
- }, h = Dr(c, m), g = {
3169
+ }, h = Br(c, m), g = {
3165
3170
  name: a,
3166
3171
  query: c,
3167
3172
  tree: h
@@ -3176,16 +3181,16 @@ async function et(t, r, s) {
3176
3181
  };
3177
3182
  }
3178
3183
  }
3179
- function Br(t, r) {
3184
+ function Fr(t, r) {
3180
3185
  t(
3181
3186
  "playwright-dom-snapshot-create",
3182
3187
  {
3183
3188
  title: "Create DOM Snapshot",
3184
3189
  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",
3185
- inputSchema: se.shape
3190
+ inputSchema: oe.shape
3186
3191
  },
3187
3192
  async (s, o) => {
3188
- const e = await et(s, r, o);
3193
+ const e = await tt(s, r, o);
3189
3194
  if (e.error != null)
3190
3195
  return `Method: playwright-dom-snapshot-create(${JSON.stringify(s)})
3191
3196
  ❌ Error: ${e.error}`;
@@ -3196,7 +3201,7 @@ function Br(t, r) {
3196
3201
  }
3197
3202
  );
3198
3203
  }
3199
- class Fr {
3204
+ class Or {
3200
3205
  tokens = 16;
3201
3206
  getReportText = (r) => ({
3202
3207
  indent: !0,
@@ -3210,10 +3215,10 @@ class Fr {
3210
3215
  tokensGrouped: s.tokens
3211
3216
  } : (r.indexRange[1] = o, r.countGrouped += 1, r.countMatched += s.countMatched, r.tokensGrouped += s.tokens, r);
3212
3217
  }
3213
- const tt = p.object({
3218
+ const rt = p.object({
3214
3219
  snapshotName: p.string().optional().describe("Name of previously created DOM snapshot, to use"),
3215
- snapshot: se.optional().describe(
3216
- "DOM snapshot creation options to automatically create snapshot"
3220
+ snapshot: oe.optional().describe(
3221
+ "DOM snapshot creation options JSON to automatically create snapshot"
3217
3222
  ),
3218
3223
  parentUid: p.number().optional().describe("UID of parent node to browse. Omit to browse the root node"),
3219
3224
  childsIndexRange: p.tuple([p.number(), p.number()]).optional().describe(
@@ -3230,13 +3235,13 @@ const tt = p.object({
3230
3235
  // maxCountGroup: z.number().default(10).describe('Maximum items per group'),
3231
3236
  // maxTokensGroup: z.number().default(1000).describe('Maximum tokens per group'),
3232
3237
  });
3233
- async function Or(t, r, s) {
3238
+ async function Rr(t, r, s) {
3234
3239
  let o;
3235
3240
  try {
3236
- o = tt.parse(t);
3241
+ o = rt.parse(t);
3237
3242
  } catch (g) {
3238
3243
  return {
3239
- error: `Invalid arguments: ${g instanceof Error ? g.message : "Unknown error"}`
3244
+ error: C(g)
3240
3245
  };
3241
3246
  }
3242
3247
  const {
@@ -3252,7 +3257,7 @@ async function Or(t, r, s) {
3252
3257
  return {
3253
3258
  error: "Session ID is required"
3254
3259
  };
3255
- const f = N(s.sessionId);
3260
+ const f = E(s.sessionId);
3256
3261
  if (e && n)
3257
3262
  return {
3258
3263
  error: "Either snapshotName or snapshot must be provided, not both"
@@ -3275,7 +3280,7 @@ async function Or(t, r, s) {
3275
3280
  error: `DOM snapshot "${e}" not found`
3276
3281
  };
3277
3282
  } else if (n) {
3278
- const g = await et(
3283
+ const g = await tt(
3279
3284
  n,
3280
3285
  r,
3281
3286
  s
@@ -3290,7 +3295,7 @@ async function Or(t, r, s) {
3290
3295
  error: "Either snapshotName or snapshot must be provided"
3291
3296
  };
3292
3297
  try {
3293
- const g = o.parentUid, b = Ae({
3298
+ const g = o.parentUid, b = Ge({
3294
3299
  tree: d.tree,
3295
3300
  request: {
3296
3301
  parentNodeId: g,
@@ -3302,8 +3307,8 @@ async function Or(t, r, s) {
3302
3307
  maxTokensGroup: c
3303
3308
  }
3304
3309
  },
3305
- indexRangeGroupStrategy: new Fr()
3306
- }), y = Ge(b);
3310
+ indexRangeGroupStrategy: new Or()
3311
+ }), y = qe(b);
3307
3312
  return {
3308
3313
  domSnapshot: d,
3309
3314
  queryCreated: m,
@@ -3318,16 +3323,16 @@ async function Or(t, r, s) {
3318
3323
  };
3319
3324
  }
3320
3325
  }
3321
- function Rr(t, r) {
3326
+ function zr(t, r) {
3322
3327
  t(
3323
3328
  "playwright-dom-snapshot-browse",
3324
3329
  {
3325
3330
  title: "Browse DOM Snapshot",
3326
3331
  description: "Browse and explore DOM. Use this to browse, analyze, explore, inspect, etc webpage structure and styles, find elements, or inspect page content",
3327
- inputSchema: tt.shape
3332
+ inputSchema: rt.shape
3328
3333
  },
3329
3334
  async (s, o) => {
3330
- const e = await Or(s, r, o);
3335
+ const e = await Rr(s, r, o);
3331
3336
  if (e.error != null)
3332
3337
  return `Method: playwright-dom-snapshot-browse(${JSON.stringify(s)})
3333
3338
  ❌ Error: ${e.error}`;
@@ -3348,13 +3353,13 @@ ${e.report}`, n;
3348
3353
  }
3349
3354
  );
3350
3355
  }
3351
- function zr(t, r) {
3352
- r.browserCreate && ur(t, r), r.browserList && fr(t, r), r.browserClose && hr(t, r), r.contextCreate && pr(t, r), r.contextList && wr(t, r), r.contextClose && br(t, r), r.pageCreate && Sr(t, r), r.pageList && Mr(t, r), r.pageClose && vr(t, r), r.pageGoto && Cr(t, r), r.domSnapshotQueryCreate && Er(t, r), r.domSnapshotCreate && Br(t, r), r.domSnapshotBrowse && Rr(t, r), console.log("Playwright manager");
3356
+ function Pr(t, r) {
3357
+ r.browserCreate && dr(t, r), r.browserList && mr(t, r), r.browserClose && pr(t, r), r.contextCreate && gr(t, r), r.contextList && yr(t, r), r.contextClose && xr(t, r), r.pageCreate && Ir(t, r), r.pageList && Tr(t, r), r.pageClose && Cr(t, r), r.pageGoto && Nr(t, r), r.domSnapshotQueryCreate && Dr(t, r), r.domSnapshotCreate && Fr(t, r), r.domSnapshotBrowse && zr(t, r), console.log("Playwright manager");
3353
3358
  }
3354
- function Ur(t) {
3359
+ function Lr(t) {
3355
3360
  const { logFilePath: r } = t;
3356
3361
  return async function(o, e, n, i) {
3357
- await G({
3362
+ await q({
3358
3363
  logFilePath: r,
3359
3364
  message: "ERROR",
3360
3365
  data: {
@@ -3373,28 +3378,28 @@ function Ur(t) {
3373
3378
  });
3374
3379
  };
3375
3380
  }
3376
- function Pr() {
3381
+ function Ur() {
3377
3382
  return `mcp_${(/* @__PURE__ */ new Date()).toISOString().substring(0, 19).replace(/T/, "_").replace(/:/g, "-")}.log`;
3378
3383
  }
3379
- function Lr(t) {
3380
- const r = A(), s = Gr();
3384
+ function Ar(t) {
3385
+ const r = G(), s = qr();
3381
3386
  return r.use(s), r;
3382
3387
  }
3383
- function Ar(t) {
3384
- const r = new st({
3388
+ function Gr(t) {
3389
+ const r = new ot({
3385
3390
  name: t.name,
3386
3391
  version: t.version,
3387
3392
  title: "Project Tools"
3388
- }), s = qr(r, t);
3393
+ }), s = _r(r, t);
3389
3394
  return {
3390
3395
  mcpServer: r,
3391
3396
  mcpRouter: s
3392
3397
  };
3393
3398
  }
3394
- function Gr(t) {
3395
- const r = A.Router();
3399
+ function qr(t) {
3400
+ const r = G.Router();
3396
3401
  return r.use(
3397
- rt.default({
3402
+ st.default({
3398
3403
  origin: "*",
3399
3404
  credentials: !0,
3400
3405
  allowedHeaders: [
@@ -3405,14 +3410,14 @@ function Gr(t) {
3405
3410
  ],
3406
3411
  exposedHeaders: ["mcp-session-id"]
3407
3412
  })
3408
- ), r.use(A.json()), r;
3409
- }
3410
- function qr(t, r) {
3411
- const s = A.Router();
3412
- return s.use(gt({ authToken: r.authToken })), s.all("/mcp", wt(t, r)), s;
3413
+ ), r.use(G.json()), r;
3413
3414
  }
3414
3415
  function _r(t, r) {
3415
- return t.use(Ur({ logFilePath: r.logFilePath })), new Promise((s, o) => {
3416
+ const s = G.Router();
3417
+ return s.use(wt({ authToken: r.authToken })), s.all("/mcp", yt(t, r)), s;
3418
+ }
3419
+ function jr(t, r) {
3420
+ return t.use(Lr({ logFilePath: r.logFilePath })), new Promise((s, o) => {
3416
3421
  let e;
3417
3422
  const n = () => {
3418
3423
  s(e);
@@ -3426,7 +3431,7 @@ function _r(t, r) {
3426
3431
  }
3427
3432
  });
3428
3433
  }
3429
- function jr(t, r) {
3434
+ function Jr(t, r) {
3430
3435
  const s = t.address().family, o = t.address().port;
3431
3436
  let e = t.address().address;
3432
3437
  e === "::" ? e = "localhost" : s === "IPv6" && (e = `[${e}]`);
@@ -3440,25 +3445,25 @@ SSE Endpoint: ${n}/sse
3440
3445
 
3441
3446
  Log File: ${T.resolve(r.logFilePath)}`;
3442
3447
  }
3443
- async function ls(t) {
3444
- const r = T.join(t.logDir, Pr()), s = Lr(), { mcpServer: o, mcpRouter: e } = Ar({
3448
+ async function cs(t) {
3449
+ const r = T.join(t.logDir, Ur()), s = Ar(), { mcpServer: o, mcpRouter: e } = Gr({
3445
3450
  ...t,
3446
3451
  logFilePath: r
3447
3452
  });
3448
3453
  s.use(e);
3449
- const n = Rt(o, {
3454
+ const n = zt(o, {
3450
3455
  logFilePath: r
3451
3456
  });
3452
- t.tools.processManager && Ot(n, t.tools?.processManager), t.tools.fsManager && cr(n, t.tools.fsManager), t.tools.playwrightManager && zr(n, {
3457
+ t.tools.processManager && Rt(n, t.tools?.processManager), t.tools.fsManager && ur(n, t.tools.fsManager), t.tools.playwrightManager && Pr(n, {
3453
3458
  ...t.tools.playwrightManager
3454
3459
  });
3455
- const i = await _r(s, {
3460
+ const i = await jr(s, {
3456
3461
  host: t.host,
3457
3462
  port: t.port,
3458
3463
  logFilePath: r
3459
3464
  });
3460
3465
  return console.log(
3461
- jr(i, {
3466
+ Jr(i, {
3462
3467
  name: t.name,
3463
3468
  version: t.version,
3464
3469
  authToken: t.authToken,
@@ -3468,8 +3473,8 @@ async function ls(t) {
3468
3473
  ), i;
3469
3474
  }
3470
3475
  export {
3471
- as as A,
3472
- is as S,
3473
- ns as a,
3474
- ls as s
3476
+ ls as A,
3477
+ as as S,
3478
+ is as a,
3479
+ cs as s
3475
3480
  };