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