@flemist/mcp-project-tools 4.0.1 → 4.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.
- package/build/cli.js +28 -23
- package/build/index.d.ts +10 -0
- package/build/index.js +1 -1
- package/build/{startMcpServer-CFc7yLZJ.js → startMcpServer-8ynMpHrk.js} +1156 -1083
- package/flemist-mcp.config.schema.json +12 -0
- package/package.json +32 -29
|
@@ -1,50 +1,50 @@
|
|
|
1
1
|
import ne from "express";
|
|
2
|
-
import { McpServer as
|
|
3
|
-
import { randomUUID as
|
|
2
|
+
import { McpServer as Vt } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
import { randomUUID as Zt } from "crypto";
|
|
4
4
|
import * as j from "fs";
|
|
5
5
|
import * as k from "path";
|
|
6
|
-
import { StreamableHTTPServerTransport as
|
|
7
|
-
import { spawn as
|
|
6
|
+
import { StreamableHTTPServerTransport as Xt } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
7
|
+
import { spawn as er } from "child_process";
|
|
8
8
|
import { z as h } from "zod";
|
|
9
9
|
import he from "tree-kill";
|
|
10
|
-
import { Pool as
|
|
10
|
+
import { Pool as tr, poolRunWait as V } from "@flemist/time-limits";
|
|
11
11
|
import { priorityCreate as X } from "@flemist/priority-queue";
|
|
12
|
-
import { useAbortController as
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import { webkit as
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
function
|
|
20
|
-
const { authToken:
|
|
12
|
+
import { useAbortController as rr, combineAbortSignals as sr, Locker as or } from "@flemist/async-utils";
|
|
13
|
+
import nr from "node:os";
|
|
14
|
+
import ir from "picomatch";
|
|
15
|
+
import { webkit as ar, firefox as lr, chromium as cr } from "playwright";
|
|
16
|
+
import ur from "deepmerge";
|
|
17
|
+
import Ne from "json5";
|
|
18
|
+
import dr from "js-yaml";
|
|
19
|
+
function fr(t) {
|
|
20
|
+
const { authToken: r } = t;
|
|
21
21
|
return function(o, e, n) {
|
|
22
|
-
if ((o.query.token || o.headers.authorization?.replace("Bearer ", "")) !==
|
|
22
|
+
if ((o.query.token || o.headers.authorization?.replace("Bearer ", "")) !== r) {
|
|
23
23
|
e.status(401).json({ error: "Unauthorized" });
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
26
|
n();
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
-
async function ie(
|
|
30
|
-
const { logFilePath:
|
|
29
|
+
async function ie(t) {
|
|
30
|
+
const { logFilePath: r, message: s, data: o } = t;
|
|
31
31
|
try {
|
|
32
32
|
const e = (/* @__PURE__ */ new Date()).toISOString().replace(/[TZ]/g, " ").trim(), n = typeof o == "string" ? o : JSON.stringify(o, null, 2), i = `[${e}] ${s}
|
|
33
33
|
${n}
|
|
34
34
|
|
|
35
35
|
`;
|
|
36
|
-
await j.promises.mkdir(k.dirname(
|
|
36
|
+
await j.promises.mkdir(k.dirname(r), { recursive: !0 }), await j.promises.appendFile(r, i);
|
|
37
37
|
} catch (e) {
|
|
38
38
|
console.error(`Failed to log "${s}":`, e);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
const ae = /* @__PURE__ */ new Map();
|
|
42
|
-
function
|
|
43
|
-
return
|
|
42
|
+
function pr(t) {
|
|
43
|
+
return t.headers["mcp-session-id"] || t.headers["x-session-id"] || t.query.token;
|
|
44
44
|
}
|
|
45
|
-
async function
|
|
46
|
-
const s = await
|
|
47
|
-
sessionIdGenerator:
|
|
45
|
+
async function hr(t, r) {
|
|
46
|
+
const s = await r.createMcpServer(t), o = new Xt({
|
|
47
|
+
sessionIdGenerator: Zt,
|
|
48
48
|
onsessioninitialized: (n) => {
|
|
49
49
|
ae.set(n, o);
|
|
50
50
|
},
|
|
@@ -66,28 +66,28 @@ async function cr(r, t) {
|
|
|
66
66
|
throw await e(), n;
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
async function
|
|
69
|
+
async function mr(t, r, s, o) {
|
|
70
70
|
await ie({
|
|
71
71
|
logFilePath: s.logFilePath,
|
|
72
72
|
message: "REQUEST",
|
|
73
|
-
data:
|
|
73
|
+
data: t.body
|
|
74
74
|
});
|
|
75
75
|
let e = o ? ae.get(o) : null;
|
|
76
|
-
e || (e = await
|
|
76
|
+
e || (e = await hr(t, s)), await e.handleRequest(t, r, t.body);
|
|
77
77
|
}
|
|
78
|
-
async function
|
|
78
|
+
async function gr(t, r, s) {
|
|
79
79
|
const o = s ? ae.get(s) : null;
|
|
80
80
|
if (!o) {
|
|
81
|
-
|
|
81
|
+
r.status(400).json({ error: "No valid session found" });
|
|
82
82
|
return;
|
|
83
83
|
}
|
|
84
|
-
await o.handleRequest(
|
|
84
|
+
await o.handleRequest(t, r);
|
|
85
85
|
}
|
|
86
|
-
function
|
|
86
|
+
function wr(t) {
|
|
87
87
|
return async function(s, o) {
|
|
88
88
|
try {
|
|
89
|
-
const e =
|
|
90
|
-
s.method === "POST" ? await
|
|
89
|
+
const e = pr(s);
|
|
90
|
+
s.method === "POST" ? await mr(s, o, t, e) : s.method === "GET" ? await gr(s, o, e) : o.status(405).json({ error: "Method not allowed" });
|
|
91
91
|
} catch (e) {
|
|
92
92
|
console.error("Unhandled error in streamableHttpHandler", e), o.status(500).json({
|
|
93
93
|
error: "Internal server error: " + (e instanceof Error ? e.message : "Unknown error")
|
|
@@ -96,13 +96,13 @@ function fr(r) {
|
|
|
96
96
|
};
|
|
97
97
|
}
|
|
98
98
|
const Y = /* @__PURE__ */ new Map();
|
|
99
|
-
let
|
|
100
|
-
const
|
|
101
|
-
function
|
|
102
|
-
const { commandLine:
|
|
99
|
+
let yr = 0;
|
|
100
|
+
const ke = 10, br = 1800 * 1e3, J = 1e4, Q = 2e3, Sr = 5e3;
|
|
101
|
+
function xr(t) {
|
|
102
|
+
const { commandLine: r, commandLineRules: s } = t;
|
|
103
103
|
let o = !1;
|
|
104
104
|
for (const e of s)
|
|
105
|
-
if (new RegExp(e.regexp).test(
|
|
105
|
+
if (new RegExp(e.regexp).test(r))
|
|
106
106
|
switch (e.rule) {
|
|
107
107
|
case "allow":
|
|
108
108
|
o = !0;
|
|
@@ -115,65 +115,101 @@ function gr(r) {
|
|
|
115
115
|
}
|
|
116
116
|
return o;
|
|
117
117
|
}
|
|
118
|
-
function
|
|
119
|
-
return ++
|
|
118
|
+
function $r() {
|
|
119
|
+
return ++yr;
|
|
120
120
|
}
|
|
121
|
-
let
|
|
122
|
-
function
|
|
123
|
-
if (
|
|
121
|
+
let Oe = !1;
|
|
122
|
+
function Ir() {
|
|
123
|
+
if (Oe)
|
|
124
124
|
return;
|
|
125
|
-
|
|
126
|
-
const
|
|
125
|
+
Oe = !0;
|
|
126
|
+
const t = () => {
|
|
127
127
|
console.log("Auto-killing all child processes...");
|
|
128
|
-
for (const [
|
|
128
|
+
for (const [r, s] of Array.from(Y.entries()))
|
|
129
129
|
if (s.isRunning && s.pid)
|
|
130
130
|
try {
|
|
131
131
|
he(s.pid, "SIGKILL");
|
|
132
132
|
} catch (o) {
|
|
133
|
-
console.error(`Error killing process ${
|
|
133
|
+
console.error(`Error killing process ${r}:`, o);
|
|
134
134
|
}
|
|
135
135
|
process.exit(0);
|
|
136
136
|
};
|
|
137
|
-
process.on("SIGINT",
|
|
137
|
+
process.on("SIGINT", t), process.on("SIGTERM", t);
|
|
138
138
|
}
|
|
139
139
|
function ge() {
|
|
140
|
-
const
|
|
140
|
+
const t = Date.now(), r = [];
|
|
141
141
|
for (const [s, o] of Array.from(Y.entries()))
|
|
142
|
-
!o.isRunning && o.endTime &&
|
|
143
|
-
for (const s of
|
|
142
|
+
!o.isRunning && o.endTime && t - o.endTime.getTime() > br && r.push(s);
|
|
143
|
+
for (const s of r)
|
|
144
144
|
Y.delete(s);
|
|
145
145
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
function xr() {
|
|
149
|
-
return ++Sr;
|
|
146
|
+
function Re(t) {
|
|
147
|
+
return t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
150
148
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
149
|
+
const De = "[/\\\\]";
|
|
150
|
+
function at(t, r) {
|
|
151
|
+
const s = t.replace(/[\\/]+$/, "");
|
|
152
|
+
let o;
|
|
153
|
+
return r ? o = s.split(/[\\/]/).map(Re).join(De) : o = Re(s), o += `(?=${De}|$)`, new RegExp(o, r ? "gi" : "g");
|
|
154
|
+
}
|
|
155
|
+
function Mr(t, r, s, o) {
|
|
156
|
+
const e = at(r, o);
|
|
157
|
+
return t.replace(e, (n) => s + n.slice(r.length));
|
|
158
|
+
}
|
|
159
|
+
function Tr(t, r, s, o) {
|
|
160
|
+
const e = process.platform === "win32", n = {};
|
|
161
|
+
if (s !== "clear") if (s === "replaceServerPaths" || s === "deleteServerPaths") {
|
|
162
|
+
const i = Fe(t, e), a = Fe(r, e);
|
|
163
|
+
if (i !== a) {
|
|
164
|
+
const l = at(t, e);
|
|
165
|
+
for (const [u, f] of Object.entries(process.env))
|
|
166
|
+
f != null && (l.lastIndex = 0, l.test(f) ? s === "replaceServerPaths" && (n[u] = Mr(f, t, r, e)) : n[u] = f);
|
|
167
|
+
} else
|
|
168
|
+
for (const [l, u] of Object.entries(process.env))
|
|
169
|
+
u != null && (n[l] = u);
|
|
170
|
+
} else
|
|
171
|
+
for (const [i, a] of Object.entries(process.env))
|
|
172
|
+
a != null && (n[i] = a);
|
|
173
|
+
if (o)
|
|
174
|
+
for (const [i, a] of Object.entries(o))
|
|
175
|
+
a === null ? delete n[i] : n[i] = a;
|
|
176
|
+
return n;
|
|
177
|
+
}
|
|
178
|
+
function Fe(t, r) {
|
|
179
|
+
const s = k.normalize(t).replace(/[\\/]+$/, "");
|
|
180
|
+
return r ? s.toLowerCase() : s;
|
|
181
|
+
}
|
|
182
|
+
const Cr = 1800 * 1e3, Be = /* @__PURE__ */ new Map();
|
|
183
|
+
let vr = 0;
|
|
184
|
+
function Er() {
|
|
185
|
+
return ++vr;
|
|
186
|
+
}
|
|
187
|
+
function lt(t) {
|
|
188
|
+
let r = Be.get(t);
|
|
189
|
+
return r == null && (r = {
|
|
154
190
|
storedOutputs: /* @__PURE__ */ new Map()
|
|
155
|
-
},
|
|
191
|
+
}, Be.set(t, r)), r;
|
|
156
192
|
}
|
|
157
|
-
function
|
|
158
|
-
return typeof
|
|
193
|
+
function ct(t) {
|
|
194
|
+
return typeof t == "function" ? t() : t;
|
|
159
195
|
}
|
|
160
|
-
function
|
|
196
|
+
function ut(t, r) {
|
|
161
197
|
return setTimeout(() => {
|
|
162
|
-
|
|
163
|
-
},
|
|
198
|
+
t.storedOutputs.delete(r);
|
|
199
|
+
}, Cr);
|
|
164
200
|
}
|
|
165
|
-
function
|
|
166
|
-
clearTimeout(s.cleanupTimer), s.cleanupTimer =
|
|
201
|
+
function Nr(t, r, s) {
|
|
202
|
+
clearTimeout(s.cleanupTimer), s.cleanupTimer = ut(t, r);
|
|
167
203
|
}
|
|
168
|
-
function
|
|
169
|
-
const { sessionId:
|
|
204
|
+
function kr(t) {
|
|
205
|
+
const { sessionId: r, source: s } = t, o = lt(r), e = Er(), n = {
|
|
170
206
|
source: s,
|
|
171
|
-
cleanupTimer:
|
|
207
|
+
cleanupTimer: ut(o, e)
|
|
172
208
|
};
|
|
173
209
|
return o.storedOutputs.set(e, n), e;
|
|
174
210
|
}
|
|
175
|
-
function
|
|
176
|
-
const { sessionId:
|
|
211
|
+
function dt(t) {
|
|
212
|
+
const { sessionId: r, outputId: s, range: o } = t, [e, n] = o, i = lt(r), a = i.storedOutputs.get(s);
|
|
177
213
|
if (a == null)
|
|
178
214
|
return {
|
|
179
215
|
content: "",
|
|
@@ -181,16 +217,16 @@ function it(r) {
|
|
|
181
217
|
range: [0, 0],
|
|
182
218
|
error: `Stored output with outputId=${s} not found or expired`
|
|
183
219
|
};
|
|
184
|
-
|
|
185
|
-
const c =
|
|
220
|
+
Nr(i, s, a);
|
|
221
|
+
const c = ct(a.source), l = c.length, u = Math.min(Math.max(e, 0), l), f = Math.min(Math.max(n, 0), l);
|
|
186
222
|
return { content: c.substring(u, f), total: l, range: [u, f] };
|
|
187
223
|
}
|
|
188
|
-
function we(
|
|
189
|
-
const { sessionId:
|
|
224
|
+
function we(t) {
|
|
225
|
+
const { sessionId: r, source: s, limit: o } = t, e = ct(s);
|
|
190
226
|
if (e.length <= o)
|
|
191
227
|
return { content: e, outputId: null };
|
|
192
|
-
const n =
|
|
193
|
-
sessionId:
|
|
228
|
+
const n = kr({ sessionId: r, source: s }), i = dt({
|
|
229
|
+
sessionId: r,
|
|
194
230
|
outputId: n,
|
|
195
231
|
range: [0, o]
|
|
196
232
|
}), a = `
|
|
@@ -200,27 +236,27 @@ function we(r) {
|
|
|
200
236
|
outputId: n
|
|
201
237
|
};
|
|
202
238
|
}
|
|
203
|
-
function F(
|
|
204
|
-
return `Invalid arguments: ${
|
|
239
|
+
function F(t) {
|
|
240
|
+
return `Invalid arguments: ${t instanceof Error ? t.message : "Unknown error"}.
|
|
205
241
|
|
|
206
242
|
Provide valid parameters according to schema.`;
|
|
207
243
|
}
|
|
208
|
-
const
|
|
244
|
+
const ft = h.object({
|
|
209
245
|
outputId: h.number().int().describe("Output ID from truncation message"),
|
|
210
246
|
range: h.tuple([h.number().int().min(0), h.number().int().min(0)]).describe(
|
|
211
247
|
`Character range [from, to) to retrieve. Maximum range size: ${J}.`
|
|
212
248
|
)
|
|
213
249
|
});
|
|
214
|
-
function
|
|
250
|
+
function Or(t, r) {
|
|
215
251
|
let s;
|
|
216
252
|
try {
|
|
217
|
-
s =
|
|
253
|
+
s = ft.parse(t);
|
|
218
254
|
} catch (i) {
|
|
219
255
|
return {
|
|
220
256
|
error: F(i)
|
|
221
257
|
};
|
|
222
258
|
}
|
|
223
|
-
if (!
|
|
259
|
+
if (!r.sessionId)
|
|
224
260
|
return {
|
|
225
261
|
error: "Session ID is required"
|
|
226
262
|
};
|
|
@@ -233,28 +269,28 @@ function Mr(r, t) {
|
|
|
233
269
|
return {
|
|
234
270
|
error: `Range size ${e - o} exceeds maximum ${J}`
|
|
235
271
|
};
|
|
236
|
-
const n =
|
|
237
|
-
sessionId:
|
|
272
|
+
const n = dt({
|
|
273
|
+
sessionId: r.sessionId,
|
|
238
274
|
outputId: s.outputId,
|
|
239
275
|
range: s.range
|
|
240
276
|
});
|
|
241
277
|
return n.error != null ? { error: n.error } : { content: n.content, total: n.total, range: n.range };
|
|
242
278
|
}
|
|
243
|
-
function
|
|
244
|
-
|
|
279
|
+
function Rr(t) {
|
|
280
|
+
t(
|
|
245
281
|
"output-read",
|
|
246
282
|
{
|
|
247
283
|
title: "Read Stored Output Range",
|
|
248
284
|
description: "Read any range from stored output. Use outputId from truncation message and specify character range [from, to).",
|
|
249
|
-
inputSchema:
|
|
285
|
+
inputSchema: ft.shape
|
|
250
286
|
},
|
|
251
|
-
async (
|
|
252
|
-
const o =
|
|
287
|
+
async (r, s) => {
|
|
288
|
+
const o = Or(r, s);
|
|
253
289
|
if (o.error != null)
|
|
254
|
-
return `Method: output-read(${JSON.stringify(
|
|
290
|
+
return `Method: output-read(${JSON.stringify(r)})
|
|
255
291
|
❌ Error: ${o.error}`;
|
|
256
292
|
const [e, n] = o.range, i = o.total;
|
|
257
|
-
let a = `Method: output-read(${JSON.stringify(
|
|
293
|
+
let a = `Method: output-read(${JSON.stringify(r)})
|
|
258
294
|
showing [${e}, ${n}) of ${i} chars`;
|
|
259
295
|
return e >= i && (a += `
|
|
260
296
|
⚠️ Warning: requested range is beyond content (total: ${i} chars)`), a += `
|
|
@@ -263,10 +299,10 @@ ${o.content}`, a;
|
|
|
263
299
|
}
|
|
264
300
|
);
|
|
265
301
|
}
|
|
266
|
-
function
|
|
267
|
-
|
|
302
|
+
function Dr(t) {
|
|
303
|
+
Rr(t);
|
|
268
304
|
}
|
|
269
|
-
const
|
|
305
|
+
const pt = h.object({
|
|
270
306
|
id: h.number().describe(
|
|
271
307
|
"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"
|
|
272
308
|
),
|
|
@@ -274,11 +310,11 @@ const lt = h.object({
|
|
|
274
310
|
`Maximum output characters to return. Truncated output can be retrieved via output-read tool using outputId from truncation message. Maximum: ${J}. Default: ${Q}`
|
|
275
311
|
)
|
|
276
312
|
});
|
|
277
|
-
async function ye(
|
|
313
|
+
async function ye(t, r, s) {
|
|
278
314
|
ge();
|
|
279
315
|
let o;
|
|
280
316
|
try {
|
|
281
|
-
o =
|
|
317
|
+
o = pt.parse(t);
|
|
282
318
|
} catch (c) {
|
|
283
319
|
return {
|
|
284
320
|
error: F(c)
|
|
@@ -300,7 +336,7 @@ async function ye(r, t, s) {
|
|
|
300
336
|
}).content;
|
|
301
337
|
return {
|
|
302
338
|
id: i.id,
|
|
303
|
-
cwd: k.relative(
|
|
339
|
+
cwd: k.relative(r.workingDir || "", i.cwd),
|
|
304
340
|
commandLine: i.commandLine,
|
|
305
341
|
pid: i.pid,
|
|
306
342
|
startTime: i.startTime.toISOString().replace(/[TZ]/g, " ").trim(),
|
|
@@ -311,16 +347,16 @@ async function ye(r, t, s) {
|
|
|
311
347
|
error: i.error
|
|
312
348
|
};
|
|
313
349
|
}
|
|
314
|
-
function
|
|
315
|
-
|
|
350
|
+
function Fr(t, r) {
|
|
351
|
+
t(
|
|
316
352
|
"process-status",
|
|
317
353
|
{
|
|
318
354
|
title: "Get Host Machine Process Status",
|
|
319
355
|
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",
|
|
320
|
-
inputSchema:
|
|
356
|
+
inputSchema: pt.shape
|
|
321
357
|
},
|
|
322
358
|
async (s, o) => {
|
|
323
|
-
const e = await ye(s,
|
|
359
|
+
const e = await ye(s, r, o);
|
|
324
360
|
if (!("output" in e))
|
|
325
361
|
return `Method: process-status(${JSON.stringify(s)})
|
|
326
362
|
❌ Error: ${e.error}`;
|
|
@@ -333,16 +369,16 @@ ${n.trim()}`;
|
|
|
333
369
|
}
|
|
334
370
|
);
|
|
335
371
|
}
|
|
336
|
-
function
|
|
337
|
-
he(
|
|
338
|
-
|
|
372
|
+
function ht(t) {
|
|
373
|
+
he(t, "SIGTERM", (r) => {
|
|
374
|
+
r && !r.message.includes("not found") && console.error(`Error sending SIGTERM to process ${t}:`, r);
|
|
339
375
|
}), setTimeout(() => {
|
|
340
|
-
he(
|
|
341
|
-
|
|
376
|
+
he(t, "SIGKILL", (r) => {
|
|
377
|
+
r && !r.message.includes("not found") && console.error(`Error sending SIGKILL to process ${t}:`, r);
|
|
342
378
|
});
|
|
343
|
-
},
|
|
379
|
+
}, Sr);
|
|
344
380
|
}
|
|
345
|
-
const
|
|
381
|
+
const mt = h.object({
|
|
346
382
|
id: h.number().describe(
|
|
347
383
|
"Process ID to wait for completion. Get process IDs using process-list. The process can be running or already completed. Examples: 1, 42, 123"
|
|
348
384
|
),
|
|
@@ -356,13 +392,13 @@ const ut = h.object({
|
|
|
356
392
|
`Maximum output characters to return. Truncated output can be retrieved via output-read tool using outputId from truncation message. Maximum: ${J}. Default: ${Q}`
|
|
357
393
|
)
|
|
358
394
|
});
|
|
359
|
-
async function
|
|
395
|
+
async function gt(t, r, s) {
|
|
360
396
|
let o;
|
|
361
397
|
try {
|
|
362
|
-
o =
|
|
363
|
-
} catch (
|
|
398
|
+
o = mt.parse(t);
|
|
399
|
+
} catch (m) {
|
|
364
400
|
return {
|
|
365
|
-
error: F(
|
|
401
|
+
error: F(m)
|
|
366
402
|
};
|
|
367
403
|
}
|
|
368
404
|
const { id: e, waitTime: n, autoKill: i, outputLimit: a } = o, c = Y.get(e);
|
|
@@ -372,29 +408,29 @@ async function dt(r, t, s) {
|
|
|
372
408
|
};
|
|
373
409
|
const l = Date.now();
|
|
374
410
|
let u = !1, f = !1;
|
|
375
|
-
n != null && await new Promise((
|
|
411
|
+
n != null && await new Promise((g) => {
|
|
376
412
|
const y = setInterval(() => {
|
|
377
|
-
c.isRunning ? Date.now() - l >= n * 1e3 && (clearInterval(y), u = !0, i && c.pid && (
|
|
413
|
+
c.isRunning ? Date.now() - l >= n * 1e3 && (clearInterval(y), u = !0, i && c.pid && (ht(c.pid), f = !0), g()) : (clearInterval(y), g());
|
|
378
414
|
}, 100);
|
|
379
415
|
});
|
|
380
416
|
const d = (Date.now() - l) / 1e3;
|
|
381
417
|
return {
|
|
382
|
-
...await ye({ id: e, outputLimit: a },
|
|
418
|
+
...await ye({ id: e, outputLimit: a }, r, s),
|
|
383
419
|
waitDuration: d,
|
|
384
420
|
waitTimeExceeded: u,
|
|
385
421
|
autoKillExecuted: f
|
|
386
422
|
};
|
|
387
423
|
}
|
|
388
|
-
function
|
|
389
|
-
|
|
424
|
+
function Br(t, r) {
|
|
425
|
+
t(
|
|
390
426
|
"process-wait",
|
|
391
427
|
{
|
|
392
428
|
title: "Wait for Host Machine Process",
|
|
393
429
|
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",
|
|
394
|
-
inputSchema:
|
|
430
|
+
inputSchema: mt.shape
|
|
395
431
|
},
|
|
396
432
|
async (s, o) => {
|
|
397
|
-
const e = await
|
|
433
|
+
const e = await gt(s, r, o);
|
|
398
434
|
if (!("output" in e))
|
|
399
435
|
return `Method: process-wait(${JSON.stringify(s)})
|
|
400
436
|
❌ Error: ${e.error}`;
|
|
@@ -407,7 +443,20 @@ ${n.trim()}`;
|
|
|
407
443
|
}
|
|
408
444
|
);
|
|
409
445
|
}
|
|
410
|
-
|
|
446
|
+
function H(t) {
|
|
447
|
+
return t.replace(/\\/g, "/");
|
|
448
|
+
}
|
|
449
|
+
function be(t, r) {
|
|
450
|
+
if (!t)
|
|
451
|
+
return { error: "Working directory is not configured" };
|
|
452
|
+
const s = H(k.resolve(t)), o = H(
|
|
453
|
+
k.resolve(t, r || "")
|
|
454
|
+
);
|
|
455
|
+
return !o.startsWith(s + "/") && o !== s ? {
|
|
456
|
+
error: `Path "${r}" escapes root directory "${t}". Resolved path: "${o}"`
|
|
457
|
+
} : { path: o };
|
|
458
|
+
}
|
|
459
|
+
const wt = h.object({
|
|
411
460
|
relativeRootDir: h.string().optional().describe(
|
|
412
461
|
'Relative path from project root to working directory for command execution. Use forward slashes. Leave empty for project root. Examples: "src", "src/tools", "tests/unit". Directory must exist'
|
|
413
462
|
),
|
|
@@ -424,81 +473,93 @@ const ft = h.object({
|
|
|
424
473
|
`Maximum output characters to return. Truncated output can be retrieved via output-read tool using outputId from truncation message. Maximum: ${J}. Default: ${Q}`
|
|
425
474
|
)
|
|
426
475
|
});
|
|
427
|
-
async function
|
|
476
|
+
async function Lr(t, r, s) {
|
|
428
477
|
ge();
|
|
429
478
|
let o;
|
|
430
479
|
try {
|
|
431
|
-
o =
|
|
432
|
-
} catch (
|
|
480
|
+
o = wt.parse(t);
|
|
481
|
+
} catch (m) {
|
|
433
482
|
return {
|
|
434
|
-
error: F(
|
|
483
|
+
error: F(m)
|
|
435
484
|
};
|
|
436
485
|
}
|
|
437
|
-
const { commandLine: e, waitTime: n, autoKill: i, outputLimit: a } = o, { commandLineRules: c } =
|
|
438
|
-
|
|
439
|
-
|
|
486
|
+
const { commandLine: e, waitTime: n, autoKill: i, outputLimit: a } = o, { commandLineRules: c } = r, l = be(
|
|
487
|
+
r.workingDir,
|
|
488
|
+
o.relativeRootDir
|
|
489
|
+
);
|
|
490
|
+
if ("error" in l)
|
|
491
|
+
return { error: l.error };
|
|
492
|
+
const u = l.path;
|
|
493
|
+
if (!xr({ commandLine: e, commandLineRules: c })) {
|
|
494
|
+
const m = c.map(
|
|
440
495
|
(g) => `${g.rule.toUpperCase()}: /${g.regexp}/ (${g.note})`
|
|
441
496
|
).join(`
|
|
442
497
|
`);
|
|
443
498
|
return {
|
|
444
499
|
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:
|
|
445
|
-
${
|
|
500
|
+
${m}
|
|
446
501
|
|
|
447
502
|
To use this command line, ask the user to modify the command line rules in the configuration.`
|
|
448
503
|
};
|
|
449
504
|
}
|
|
450
505
|
if (Array.from(Y.values()).filter(
|
|
451
|
-
(
|
|
452
|
-
).length >=
|
|
506
|
+
(m) => m.isRunning
|
|
507
|
+
).length >= ke)
|
|
453
508
|
return {
|
|
454
|
-
error: `Maximum concurrent process limit reached (${
|
|
509
|
+
error: `Maximum concurrent process limit reached (${ke} processes). Cannot start new process until existing processes complete. Use process-list to see active processes, or process-kill to terminate unnecessary processes.`
|
|
455
510
|
};
|
|
456
|
-
const
|
|
457
|
-
id:
|
|
458
|
-
cwd:
|
|
511
|
+
const d = $r(), p = {
|
|
512
|
+
id: d,
|
|
513
|
+
cwd: u,
|
|
459
514
|
commandLine: e,
|
|
460
515
|
startTime: /* @__PURE__ */ new Date(),
|
|
461
516
|
isRunning: !0,
|
|
462
517
|
output: ""
|
|
463
518
|
};
|
|
464
|
-
Y.set(
|
|
519
|
+
Y.set(d, p);
|
|
465
520
|
try {
|
|
466
|
-
const
|
|
521
|
+
const m = Tr(
|
|
522
|
+
process.cwd(),
|
|
523
|
+
u,
|
|
524
|
+
r.envCleanup ?? null,
|
|
525
|
+
r.env
|
|
526
|
+
), g = er(e, [], {
|
|
467
527
|
shell: !0,
|
|
468
|
-
cwd:
|
|
528
|
+
cwd: u,
|
|
529
|
+
env: m,
|
|
469
530
|
stdio: ["pipe", "pipe", "pipe"]
|
|
470
531
|
});
|
|
471
|
-
|
|
472
|
-
const
|
|
473
|
-
const
|
|
474
|
-
|
|
532
|
+
p.pid = g.pid;
|
|
533
|
+
const y = (w) => {
|
|
534
|
+
const M = w.toString();
|
|
535
|
+
p.output += M, console.log(M);
|
|
475
536
|
};
|
|
476
|
-
return
|
|
477
|
-
|
|
478
|
-
}),
|
|
479
|
-
|
|
480
|
-
}), n != null ?
|
|
481
|
-
{ id:
|
|
482
|
-
|
|
537
|
+
return g.stdout?.on("data", y), g.stderr?.on("data", y), g.on("close", (w) => {
|
|
538
|
+
p.isRunning = !1, p.endTime = /* @__PURE__ */ new Date(), p.exitCode = w !== null ? w : void 0, console.log(`Process ${d} (${e}) exited with code ${w}`);
|
|
539
|
+
}), g.on("error", (w) => {
|
|
540
|
+
p.isRunning = !1, p.endTime = /* @__PURE__ */ new Date(), p.error = w.message, console.error(`Process ${d} error:`, w.message);
|
|
541
|
+
}), n != null ? gt(
|
|
542
|
+
{ id: d, waitTime: n, autoKill: i, outputLimit: a },
|
|
543
|
+
r,
|
|
483
544
|
s
|
|
484
|
-
) : ye({ id:
|
|
485
|
-
} catch (
|
|
486
|
-
return
|
|
545
|
+
) : ye({ id: d, outputLimit: a }, r, s);
|
|
546
|
+
} catch (m) {
|
|
547
|
+
return p.isRunning = !1, p.endTime = /* @__PURE__ */ new Date(), p.error = m instanceof Error ? m.message : "Unknown error", { error: p.error };
|
|
487
548
|
}
|
|
488
549
|
}
|
|
489
|
-
function
|
|
490
|
-
const s =
|
|
550
|
+
function Pr(t, r) {
|
|
551
|
+
const s = r.commandLineRules.map((o) => `${o.rule.toUpperCase()}: ${o.regexp} (${o.note})`).join(`
|
|
491
552
|
`);
|
|
492
|
-
|
|
553
|
+
t(
|
|
493
554
|
"process-run",
|
|
494
555
|
{
|
|
495
556
|
title: "Execute Command Line on Host Machine",
|
|
496
557
|
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:
|
|
497
558
|
${s}`,
|
|
498
|
-
inputSchema:
|
|
559
|
+
inputSchema: wt.shape
|
|
499
560
|
},
|
|
500
561
|
async (o, e) => {
|
|
501
|
-
const n = await
|
|
562
|
+
const n = await Lr(o, r, e);
|
|
502
563
|
if (!("output" in n))
|
|
503
564
|
return `Method: process-run(${JSON.stringify(o)})
|
|
504
565
|
❌ Error: ${n.error}`;
|
|
@@ -511,7 +572,7 @@ ${i.trim()}`;
|
|
|
511
572
|
}
|
|
512
573
|
);
|
|
513
574
|
}
|
|
514
|
-
const
|
|
575
|
+
const yt = h.object({
|
|
515
576
|
minOpenDateTime: h.string().optional().describe(
|
|
516
577
|
'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'
|
|
517
578
|
),
|
|
@@ -525,11 +586,11 @@ const pt = h.object({
|
|
|
525
586
|
'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'
|
|
526
587
|
)
|
|
527
588
|
});
|
|
528
|
-
async function
|
|
589
|
+
async function Ar(t, r) {
|
|
529
590
|
ge();
|
|
530
591
|
let s;
|
|
531
592
|
try {
|
|
532
|
-
s =
|
|
593
|
+
s = yt.parse(t);
|
|
533
594
|
} catch (l) {
|
|
534
595
|
return {
|
|
535
596
|
error: F(l)
|
|
@@ -548,7 +609,7 @@ async function Or(r, t) {
|
|
|
548
609
|
return n && (a = a.filter((l) => l.isRunning)), { processes: a.map((l) => {
|
|
549
610
|
let u = {
|
|
550
611
|
id: l.id,
|
|
551
|
-
cwd: k.relative(
|
|
612
|
+
cwd: k.relative(r.workingDir || "", l.cwd),
|
|
552
613
|
commandLine: l.commandLine,
|
|
553
614
|
pid: l.pid,
|
|
554
615
|
startTime: l.startTime.toISOString().replace(/[TZ]/g, " ").trim(),
|
|
@@ -568,16 +629,16 @@ async function Or(r, t) {
|
|
|
568
629
|
return u;
|
|
569
630
|
}) };
|
|
570
631
|
}
|
|
571
|
-
function
|
|
572
|
-
|
|
632
|
+
function zr(t, r) {
|
|
633
|
+
t(
|
|
573
634
|
"process-list",
|
|
574
635
|
{
|
|
575
636
|
title: "List Host Machine Processes",
|
|
576
637
|
description: "List all processes that have been executed on the host machine. Use this to see running processes, check command history, or find process IDs for status/wait operations",
|
|
577
|
-
inputSchema:
|
|
638
|
+
inputSchema: yt.shape
|
|
578
639
|
},
|
|
579
640
|
async (s) => {
|
|
580
|
-
const o = await
|
|
641
|
+
const o = await Ar(s, r);
|
|
581
642
|
if (o.error != null)
|
|
582
643
|
return `Method: process-list(${JSON.stringify(s)})
|
|
583
644
|
❌ Error: ${o.error}`;
|
|
@@ -591,21 +652,21 @@ ${e}`;
|
|
|
591
652
|
}
|
|
592
653
|
);
|
|
593
654
|
}
|
|
594
|
-
const
|
|
655
|
+
const bt = h.object({
|
|
595
656
|
id: h.number().describe(
|
|
596
657
|
"Process ID of the process to terminate. Get process IDs using process-list. The process must be currently running. Examples: 1, 42, 123"
|
|
597
658
|
)
|
|
598
659
|
});
|
|
599
|
-
function
|
|
600
|
-
let
|
|
660
|
+
function Ur(t) {
|
|
661
|
+
let r;
|
|
601
662
|
try {
|
|
602
|
-
|
|
663
|
+
r = bt.parse(t);
|
|
603
664
|
} catch (e) {
|
|
604
665
|
return {
|
|
605
666
|
error: F(e)
|
|
606
667
|
};
|
|
607
668
|
}
|
|
608
|
-
const { id: s } =
|
|
669
|
+
const { id: s } = r, o = Y.get(s);
|
|
609
670
|
if (!o)
|
|
610
671
|
return {
|
|
611
672
|
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.`
|
|
@@ -619,54 +680,54 @@ function Rr(r) {
|
|
|
619
680
|
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.`
|
|
620
681
|
};
|
|
621
682
|
try {
|
|
622
|
-
return
|
|
683
|
+
return ht(o.pid), { success: !0, message: `Kill signal sent to process ${s}` };
|
|
623
684
|
} catch (e) {
|
|
624
685
|
return {
|
|
625
686
|
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.`
|
|
626
687
|
};
|
|
627
688
|
}
|
|
628
689
|
}
|
|
629
|
-
function
|
|
630
|
-
|
|
690
|
+
function jr(t, r) {
|
|
691
|
+
t(
|
|
631
692
|
"process-kill",
|
|
632
693
|
{
|
|
633
694
|
title: "Kill Host Machine Process",
|
|
634
695
|
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",
|
|
635
|
-
inputSchema:
|
|
696
|
+
inputSchema: bt.shape
|
|
636
697
|
},
|
|
637
698
|
async (s) => {
|
|
638
|
-
const o =
|
|
699
|
+
const o = Ur(s);
|
|
639
700
|
return o.error != null ? `Method: process-kill(${JSON.stringify(s)})
|
|
640
701
|
❌ Error: ${o.error}` : `Method: process-kill(${JSON.stringify(s)})
|
|
641
702
|
${JSON.stringify(o, null, 2)}`;
|
|
642
703
|
}
|
|
643
704
|
);
|
|
644
705
|
}
|
|
645
|
-
function
|
|
646
|
-
|
|
647
|
-
const s =
|
|
706
|
+
function qr(t, r) {
|
|
707
|
+
Ir(), r.run && Pr(t, r), r.status && Fr(t, r), r.wait && Br(t, r), r.list && zr(t, r), r.kill && jr(t);
|
|
708
|
+
const s = r.commandLineRules?.map(
|
|
648
709
|
(o) => `${o.rule.toUpperCase()}: ${o.regexp} (${o.note})`
|
|
649
710
|
) || [];
|
|
650
711
|
console.log(
|
|
651
712
|
`Process manager:
|
|
652
|
-
- Working directory: ${k.resolve(
|
|
653
|
-
- Command line rules: ${
|
|
713
|
+
- Working directory: ${k.resolve(r.workingDir || "")}
|
|
714
|
+
- Command line rules: ${r.commandLineRules?.length || 0} rules configured:
|
|
654
715
|
${s.map((o) => `- ${o}`).join(`
|
|
655
716
|
`)}
|
|
656
717
|
`
|
|
657
718
|
);
|
|
658
719
|
}
|
|
659
|
-
function
|
|
720
|
+
function _r(t, r) {
|
|
660
721
|
return function(o, e, n) {
|
|
661
722
|
const i = async (...a) => {
|
|
662
723
|
await ie({
|
|
663
|
-
logFilePath:
|
|
724
|
+
logFilePath: r.logFilePath,
|
|
664
725
|
message: "REQUEST",
|
|
665
726
|
data: { name: o, args: a }
|
|
666
727
|
});
|
|
667
728
|
const c = await n(...a);
|
|
668
729
|
return await ie({
|
|
669
|
-
logFilePath:
|
|
730
|
+
logFilePath: r.logFilePath,
|
|
670
731
|
message: "RESPONSE",
|
|
671
732
|
data: c
|
|
672
733
|
}), {
|
|
@@ -678,35 +739,35 @@ function Lr(r, t) {
|
|
|
678
739
|
]
|
|
679
740
|
};
|
|
680
741
|
};
|
|
681
|
-
return
|
|
742
|
+
return t.registerTool(
|
|
682
743
|
o,
|
|
683
744
|
e,
|
|
684
745
|
i
|
|
685
746
|
);
|
|
686
747
|
};
|
|
687
748
|
}
|
|
688
|
-
function
|
|
689
|
-
return
|
|
749
|
+
function Gr(t) {
|
|
750
|
+
return t.match(/^[/\\]?[^/\\]+/)[0];
|
|
690
751
|
}
|
|
691
|
-
function
|
|
692
|
-
return
|
|
752
|
+
function Jr(t, r) {
|
|
753
|
+
return Gr(t) + "|" + r.ino;
|
|
693
754
|
}
|
|
694
|
-
function
|
|
695
|
-
return
|
|
755
|
+
function Wr(t) {
|
|
756
|
+
return t.endsWith(":") && (t += "/"), k.resolve(t);
|
|
696
757
|
}
|
|
697
|
-
const
|
|
698
|
-
function
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
),
|
|
758
|
+
const Se = new tr(nr.cpus().length);
|
|
759
|
+
function Le(t, r) {
|
|
760
|
+
t.totalSize += r.totalSize, t.maxFileDateModified = Math.max(
|
|
761
|
+
t.maxFileDateModified,
|
|
762
|
+
r.maxFileDateModified
|
|
763
|
+
), t.countFiles += r.countFiles, t.countDirs += r.countDirs, t.countLinks += r.countLinks;
|
|
703
764
|
}
|
|
704
|
-
const
|
|
705
|
-
return
|
|
765
|
+
const Kr = function(r) {
|
|
766
|
+
return r.code === "ENOENT";
|
|
706
767
|
};
|
|
707
|
-
function
|
|
708
|
-
const
|
|
709
|
-
if (!
|
|
768
|
+
function St(t) {
|
|
769
|
+
const r = t.paths;
|
|
770
|
+
if (!r || r.length === 0)
|
|
710
771
|
return Promise.resolve({
|
|
711
772
|
totalSize: 0,
|
|
712
773
|
maxFileDateModified: 0,
|
|
@@ -714,29 +775,29 @@ function mt(r) {
|
|
|
714
775
|
countDirs: 0,
|
|
715
776
|
countLinks: 0
|
|
716
777
|
});
|
|
717
|
-
const s =
|
|
718
|
-
async function d(
|
|
719
|
-
if (!(i && await i(
|
|
720
|
-
throw
|
|
778
|
+
const s = t.level ?? 0, o = t.walkedIds ?? /* @__PURE__ */ new Set(), e = t.abortSignal, n = t.pool ?? Se, i = t.handleError, a = t.priority ?? X(0), c = t.walkLinks ?? !1, l = t.log, u = t.handlePath, f = t.matchPath;
|
|
779
|
+
async function d(m) {
|
|
780
|
+
if (!(i && await i(m)) && !Kr(m))
|
|
781
|
+
throw m;
|
|
721
782
|
}
|
|
722
|
-
function p(
|
|
723
|
-
return !(!l || l.minTotalContentSize != null &&
|
|
783
|
+
function p(m) {
|
|
784
|
+
return !(!l || l.minTotalContentSize != null && m < l.minTotalContentSize || l.maxNestedLevel != null && s > l.maxNestedLevel);
|
|
724
785
|
}
|
|
725
|
-
return
|
|
726
|
-
const
|
|
786
|
+
return rr(async (m) => {
|
|
787
|
+
const g = sr(e, m), y = {
|
|
727
788
|
totalSize: 0,
|
|
728
789
|
maxFileDateModified: 0,
|
|
729
790
|
countFiles: 0,
|
|
730
791
|
countDirs: 0,
|
|
731
792
|
countLinks: 0
|
|
732
793
|
};
|
|
733
|
-
function w($,
|
|
734
|
-
if (p(
|
|
735
|
-
const
|
|
736
|
-
l?.handleLog ? l.handleLog(
|
|
794
|
+
function w($, T) {
|
|
795
|
+
if (p(T.totalSize)) {
|
|
796
|
+
const S = `${T.totalSize.toLocaleString("en-US").replace(/,/g, " ").padStart(19)}: ${$}`;
|
|
797
|
+
l?.handleLog ? l.handleLog(S) : console.log(S);
|
|
737
798
|
}
|
|
738
799
|
}
|
|
739
|
-
async function M($,
|
|
800
|
+
async function M($, T, x, S) {
|
|
740
801
|
return u ? await V({
|
|
741
802
|
pool: n,
|
|
742
803
|
func: async () => {
|
|
@@ -744,32 +805,32 @@ function mt(r) {
|
|
|
744
805
|
return await u({
|
|
745
806
|
level: s,
|
|
746
807
|
path: $,
|
|
747
|
-
stat:
|
|
808
|
+
stat: T,
|
|
748
809
|
itemStat: x,
|
|
749
810
|
totalStat: y,
|
|
750
|
-
abortSignal:
|
|
811
|
+
abortSignal: g
|
|
751
812
|
});
|
|
752
813
|
} catch (v) {
|
|
753
814
|
return await d(v), !1;
|
|
754
815
|
}
|
|
755
816
|
},
|
|
756
817
|
count: 1,
|
|
757
|
-
priority:
|
|
758
|
-
abortSignal:
|
|
818
|
+
priority: S,
|
|
819
|
+
abortSignal: g
|
|
759
820
|
}) : !0;
|
|
760
821
|
}
|
|
761
|
-
async function E($,
|
|
762
|
-
|
|
822
|
+
async function E($, T, x, S) {
|
|
823
|
+
S || (S = $);
|
|
763
824
|
const v = await V({
|
|
764
825
|
pool: n,
|
|
765
826
|
func: () => j.promises.lstat($).catch(d),
|
|
766
827
|
count: 1,
|
|
767
|
-
priority: X(
|
|
768
|
-
abortSignal:
|
|
828
|
+
priority: X(T, X(1, a)),
|
|
829
|
+
abortSignal: g
|
|
769
830
|
});
|
|
770
831
|
if (!v || !x && v.isFile())
|
|
771
832
|
return null;
|
|
772
|
-
const B =
|
|
833
|
+
const B = Jr($, v);
|
|
773
834
|
if (o.has(B))
|
|
774
835
|
return null;
|
|
775
836
|
o.add(B);
|
|
@@ -781,7 +842,7 @@ function mt(r) {
|
|
|
781
842
|
countLinks: 0
|
|
782
843
|
};
|
|
783
844
|
const I = X(
|
|
784
|
-
|
|
845
|
+
T,
|
|
785
846
|
X(v.isDirectory() ? 2 : 3, a)
|
|
786
847
|
);
|
|
787
848
|
if (v.isSymbolicLink()) {
|
|
@@ -791,39 +852,39 @@ function mt(r) {
|
|
|
791
852
|
func: () => j.promises.readlink($).catch(d).then((N) => N ?? null),
|
|
792
853
|
count: 1,
|
|
793
854
|
priority: I,
|
|
794
|
-
abortSignal:
|
|
855
|
+
abortSignal: g
|
|
795
856
|
});
|
|
796
857
|
if (C) {
|
|
797
|
-
const N = k.isAbsolute(C) ? C : k.resolve(k.dirname(
|
|
858
|
+
const N = k.isAbsolute(C) ? C : k.resolve(k.dirname(S), C), R = await E(
|
|
798
859
|
N,
|
|
799
|
-
|
|
860
|
+
T,
|
|
800
861
|
x,
|
|
801
|
-
|
|
862
|
+
S
|
|
802
863
|
);
|
|
803
|
-
|
|
864
|
+
R && (O = R);
|
|
804
865
|
}
|
|
805
866
|
}
|
|
806
867
|
return (x || O.countFiles + O.countDirs + O.countLinks >= 1) && (O.countLinks += 1, await M(
|
|
807
|
-
|
|
868
|
+
S,
|
|
808
869
|
v,
|
|
809
870
|
O,
|
|
810
871
|
I
|
|
811
|
-
) && (
|
|
872
|
+
) && (Le(y, O), w(S, O))), O;
|
|
812
873
|
} else if (v.isDirectory()) {
|
|
813
874
|
const C = await V({
|
|
814
875
|
pool: n,
|
|
815
876
|
func: () => j.promises.readdir($).catch(d),
|
|
816
877
|
count: 1,
|
|
817
878
|
priority: a,
|
|
818
|
-
abortSignal:
|
|
879
|
+
abortSignal: g
|
|
819
880
|
});
|
|
820
881
|
if (C) {
|
|
821
|
-
for (let N = 0,
|
|
822
|
-
C[N] = k.join(
|
|
823
|
-
O = await
|
|
824
|
-
...
|
|
882
|
+
for (let N = 0, R = C.length; N < R; N++)
|
|
883
|
+
C[N] = k.join(S, C[N]);
|
|
884
|
+
O = await St({
|
|
885
|
+
...t,
|
|
825
886
|
paths: C,
|
|
826
|
-
abortSignal:
|
|
887
|
+
abortSignal: g,
|
|
827
888
|
priority: I,
|
|
828
889
|
level: s + 1,
|
|
829
890
|
walkedIds: o
|
|
@@ -831,77 +892,74 @@ function mt(r) {
|
|
|
831
892
|
}
|
|
832
893
|
}
|
|
833
894
|
return (x || O.countFiles + O.countDirs + O.countLinks >= 1) && (v.isDirectory() ? O.countDirs += 1 : v.isFile() && (O.countFiles += 1), await M(
|
|
834
|
-
|
|
895
|
+
S,
|
|
835
896
|
v,
|
|
836
897
|
O,
|
|
837
898
|
I
|
|
838
|
-
) && (
|
|
899
|
+
) && (Le(y, O), w(S, O))), O;
|
|
839
900
|
}
|
|
840
901
|
const b = [];
|
|
841
|
-
for (let $ = 0,
|
|
842
|
-
const x =
|
|
843
|
-
|
|
902
|
+
for (let $ = 0, T = r.length; $ < T; $++) {
|
|
903
|
+
const x = Wr(r[$]), S = f ? f(x) : !0;
|
|
904
|
+
S !== !1 && b.push(E(x, $, S));
|
|
844
905
|
}
|
|
845
906
|
return await Promise.all(b), y;
|
|
846
907
|
});
|
|
847
908
|
}
|
|
848
|
-
function
|
|
849
|
-
return
|
|
850
|
-
}
|
|
851
|
-
function H(r) {
|
|
852
|
-
return r.replace(/\\/g, "/");
|
|
909
|
+
function xt(t) {
|
|
910
|
+
return St(t);
|
|
853
911
|
}
|
|
854
|
-
function
|
|
855
|
-
if (!
|
|
856
|
-
return
|
|
857
|
-
const s =
|
|
858
|
-
s && (
|
|
859
|
-
const o =
|
|
860
|
-
return o && (
|
|
912
|
+
function Hr(t, r) {
|
|
913
|
+
if (!r || r === ".")
|
|
914
|
+
return t;
|
|
915
|
+
const s = t.startsWith("^");
|
|
916
|
+
s && (t = t.substring(1));
|
|
917
|
+
const o = t.startsWith("!");
|
|
918
|
+
return o && (t = t.substring(1)), t.startsWith("/") ? (r.endsWith("/") && (r = r.substring(0, r.length - 1)), t = r + t) : (r.endsWith("/") || (r += "/"), t.startsWith("./") ? t = r + t.substring(2) : t.startsWith("../") ? t = r + t : (r.startsWith("..") && (r = ""), t.startsWith("**") ? t = r + t : t = r + "**/" + t)), t = H(k.normalize(t)), o && (t = "!" + t), s && (t = "^" + t), t;
|
|
861
919
|
}
|
|
862
|
-
function
|
|
863
|
-
const
|
|
864
|
-
return
|
|
920
|
+
function Qr(t) {
|
|
921
|
+
const r = t.startsWith("!");
|
|
922
|
+
return r && (t = t.substring(1)), t.startsWith("/") ? t = t.substring(1) : !t.startsWith("**") && !t.startsWith("../") && (t = `**/${t}`), r && (t = "!" + t), t;
|
|
865
923
|
}
|
|
866
|
-
function
|
|
867
|
-
return "^" +
|
|
924
|
+
function Pe(t) {
|
|
925
|
+
return "^" + t;
|
|
868
926
|
}
|
|
869
|
-
async function
|
|
870
|
-
const s = (await j.promises.readFile(
|
|
927
|
+
async function Yr(t) {
|
|
928
|
+
const s = (await j.promises.readFile(t, "utf-8")).split(`
|
|
871
929
|
`), o = [];
|
|
872
930
|
return s.forEach((e) => {
|
|
873
931
|
e = e.trim(), !(!e || e.startsWith("#")) && o.push(e);
|
|
874
932
|
}), o;
|
|
875
933
|
}
|
|
876
|
-
async function
|
|
877
|
-
const
|
|
878
|
-
if (!
|
|
934
|
+
async function $t(t) {
|
|
935
|
+
const r = t.rootDir ?? ".", s = [];
|
|
936
|
+
if (!t.globs?.length)
|
|
879
937
|
return s;
|
|
880
938
|
const o = [];
|
|
881
|
-
return
|
|
882
|
-
e.value && (e.valueType === "file-contains-patterns" ? o.push(e) : e.valueType === "pattern" && s.push(e.exclude ?
|
|
939
|
+
return t.globs.forEach((e) => {
|
|
940
|
+
e.value && (e.valueType === "file-contains-patterns" ? o.push(e) : e.valueType === "pattern" && s.push(e.exclude ? Pe(e.value) : e.value));
|
|
883
941
|
}), o.length && await Promise.all(
|
|
884
942
|
o.map(async (e) => {
|
|
885
943
|
await V({
|
|
886
|
-
pool:
|
|
944
|
+
pool: Se,
|
|
887
945
|
count: 1,
|
|
888
946
|
func: async () => {
|
|
889
|
-
const n = k.resolve(
|
|
947
|
+
const n = k.resolve(r, e.value), i = await Yr(n), a = k.relative(r, k.dirname(n));
|
|
890
948
|
i.forEach((c) => {
|
|
891
|
-
c =
|
|
949
|
+
c = Qr(c), c = Hr(c, a), s.push(e.exclude ? Pe(c) : c);
|
|
892
950
|
});
|
|
893
951
|
}
|
|
894
952
|
});
|
|
895
953
|
})
|
|
896
954
|
), s;
|
|
897
955
|
}
|
|
898
|
-
function
|
|
899
|
-
globs:
|
|
900
|
-
rootDir:
|
|
956
|
+
function It({
|
|
957
|
+
globs: t,
|
|
958
|
+
rootDir: r,
|
|
901
959
|
noCase: s
|
|
902
960
|
}) {
|
|
903
961
|
const o = [];
|
|
904
|
-
return
|
|
962
|
+
return t.forEach((e) => {
|
|
905
963
|
e = H(e).trim();
|
|
906
964
|
const n = e.startsWith("^");
|
|
907
965
|
n && (e = e.substring(1).trim());
|
|
@@ -911,12 +969,12 @@ function yt({
|
|
|
911
969
|
`Invalid glob pattern: "${e}". The syntax '${e.substring(0, 2)}' is not supported. Valid glob patterns use: * (match any characters), ** (match any directories), ? (match single character), [abc] (character class), ! (negate pattern), ^ (exclude if included). Examples of valid patterns: "*.js", "src/**/*.ts", "!node_modules", "^dist". Avoid starting with '!' after '^' or multiple special prefixes.`
|
|
912
970
|
);
|
|
913
971
|
e.startsWith("/") && (e = "." + e);
|
|
914
|
-
const a = H(
|
|
972
|
+
const a = H(r ? k.resolve(r, e) : e);
|
|
915
973
|
if (!a)
|
|
916
974
|
return;
|
|
917
975
|
let c;
|
|
918
976
|
try {
|
|
919
|
-
c =
|
|
977
|
+
c = ir(a, {
|
|
920
978
|
nocase: s ?? !1,
|
|
921
979
|
dot: !0,
|
|
922
980
|
strictBrackets: !0
|
|
@@ -943,61 +1001,61 @@ function yt({
|
|
|
943
1001
|
return a ? !1 : i;
|
|
944
1002
|
};
|
|
945
1003
|
}
|
|
946
|
-
async function
|
|
947
|
-
const
|
|
948
|
-
|
|
949
|
-
const e = await
|
|
950
|
-
rootDir:
|
|
951
|
-
globs:
|
|
1004
|
+
async function Vr(t) {
|
|
1005
|
+
const r = t.rootDir ?? ".", s = [], o = {};
|
|
1006
|
+
t.result.countFiles && (o.countFiles = 0), t.result.size && (o.size = 0);
|
|
1007
|
+
const e = await $t({
|
|
1008
|
+
rootDir: r,
|
|
1009
|
+
globs: t.globs
|
|
952
1010
|
});
|
|
953
|
-
return await
|
|
954
|
-
paths: [
|
|
1011
|
+
return await xt({
|
|
1012
|
+
paths: [r],
|
|
955
1013
|
walkLinks: !0,
|
|
956
|
-
matchPath:
|
|
1014
|
+
matchPath: It({
|
|
957
1015
|
globs: e,
|
|
958
|
-
rootDir:
|
|
1016
|
+
rootDir: r,
|
|
959
1017
|
noCase: !0
|
|
960
1018
|
}),
|
|
961
1019
|
handlePath: async ({ path: n, stat: i, itemStat: a }) => {
|
|
962
|
-
const c = k.relative(
|
|
1020
|
+
const c = k.relative(r, n), l = i.isDirectory(), u = i.isFile();
|
|
963
1021
|
if (!l && !u)
|
|
964
1022
|
return !0;
|
|
965
|
-
const f = H(c || "."), d = l ? "dir" : "file", p = l ? a.maxFileDateModified || null : i.mtimeMs,
|
|
1023
|
+
const f = H(c || "."), d = l ? "dir" : "file", p = l ? a.maxFileDateModified || null : i.mtimeMs, m = l ? a.totalSize : i.size, g = l ? a.countFiles : null, y = {
|
|
966
1024
|
path: f,
|
|
967
1025
|
type: d
|
|
968
1026
|
};
|
|
969
|
-
if (
|
|
970
|
-
const [w, M] =
|
|
1027
|
+
if (t.result.dateModified && (y.dateModified = p), t.result.size && (y.size = m), t.result.countFiles && (y.countFiles = g), t.dateModified && p != null) {
|
|
1028
|
+
const [w, M] = t.dateModified;
|
|
971
1029
|
if (w != null && p < w || M != null && p > M)
|
|
972
1030
|
return !1;
|
|
973
1031
|
}
|
|
974
|
-
if (
|
|
975
|
-
const [w, M] =
|
|
976
|
-
if (w != null &&
|
|
1032
|
+
if (t.totalSize && m != null) {
|
|
1033
|
+
const [w, M] = t.totalSize;
|
|
1034
|
+
if (w != null && m < w || M != null && m > M)
|
|
977
1035
|
return !1;
|
|
978
1036
|
}
|
|
979
|
-
return d === "file" && (o.countFiles = (o.countFiles ?? 0) + 1), d === "file" &&
|
|
1037
|
+
return d === "file" && (o.countFiles = (o.countFiles ?? 0) + 1), d === "file" && m != null && (o.size = (o.size ?? 0) + m), p != null && (o.dateModified == null || p > o.dateModified) && (o.dateModified = p), l && !t.result.dirs || u && !t.result.files || s.push(y), !0;
|
|
980
1038
|
}
|
|
981
1039
|
}), { items: s, totals: o };
|
|
982
1040
|
}
|
|
983
|
-
const
|
|
984
|
-
function
|
|
985
|
-
if (
|
|
986
|
-
let
|
|
987
|
-
for (;
|
|
988
|
-
|
|
989
|
-
return `${s === 0 ?
|
|
1041
|
+
const Ae = ["B", "KB", "MB", "GB", "TB"], ze = 1024;
|
|
1042
|
+
function Ue(t) {
|
|
1043
|
+
if (t == null) return "-";
|
|
1044
|
+
let r = t ?? 0, s = 0;
|
|
1045
|
+
for (; r >= ze && s < Ae.length - 1; )
|
|
1046
|
+
r /= ze, s++;
|
|
1047
|
+
return `${s === 0 ? r.toString() : r.toFixed(2)}${Ae[s]}`;
|
|
990
1048
|
}
|
|
991
|
-
function
|
|
992
|
-
const s = Date.now() -
|
|
1049
|
+
function je(t) {
|
|
1050
|
+
const s = Date.now() - t;
|
|
993
1051
|
if (s < 0) return "0s";
|
|
994
1052
|
const o = Math.floor(s / 1e3), e = Math.floor(o / 60), n = Math.floor(e / 60), i = Math.floor(n / 24), a = Math.floor(i / 7), c = Math.floor(i / 30), l = Math.floor(i / 365);
|
|
995
1053
|
return l > 0 ? `${l}Y` : c > 0 ? `${c}M` : a > 0 ? `${a}w` : i > 0 ? `${i}d` : n > 0 ? `${n}h` : e > 0 ? `${e}m` : `${o}s`;
|
|
996
1054
|
}
|
|
997
|
-
function
|
|
998
|
-
return
|
|
999
|
-
for (let e = 0, n =
|
|
1000
|
-
const i =
|
|
1055
|
+
function Zr(t, r) {
|
|
1056
|
+
return r?.length ? [...t].sort((s, o) => {
|
|
1057
|
+
for (let e = 0, n = r.length; e < n; e++) {
|
|
1058
|
+
const i = r[e];
|
|
1001
1059
|
let a, c;
|
|
1002
1060
|
switch (i.field) {
|
|
1003
1061
|
case "type":
|
|
@@ -1028,10 +1086,10 @@ function Jr(r, t) {
|
|
|
1028
1086
|
return i.desc ? -l : l;
|
|
1029
1087
|
}
|
|
1030
1088
|
return 0;
|
|
1031
|
-
}) :
|
|
1089
|
+
}) : t;
|
|
1032
1090
|
}
|
|
1033
|
-
function
|
|
1034
|
-
const s =
|
|
1091
|
+
function Xr(t, r) {
|
|
1092
|
+
const s = Zr(t.items, r.sort ?? []), o = r.fields && r.fields.length > 0 ? r.fields : [];
|
|
1035
1093
|
let e = "";
|
|
1036
1094
|
if (s.length > 0 && o.length > 0) {
|
|
1037
1095
|
for (let n = 0, i = o.length; n < i; n++) {
|
|
@@ -1062,10 +1120,10 @@ function Kr(r, t) {
|
|
|
1062
1120
|
const u = o[c];
|
|
1063
1121
|
switch (c > 0 && (e += " | "), u) {
|
|
1064
1122
|
case "dateModified":
|
|
1065
|
-
e += a.dateModified ?
|
|
1123
|
+
e += a.dateModified ? je(a.dateModified) : "-";
|
|
1066
1124
|
break;
|
|
1067
1125
|
case "size":
|
|
1068
|
-
e +=
|
|
1126
|
+
e += Ue(a.size);
|
|
1069
1127
|
break;
|
|
1070
1128
|
case "type":
|
|
1071
1129
|
e += a.type;
|
|
@@ -1084,24 +1142,24 @@ function Kr(r, t) {
|
|
|
1084
1142
|
e.length > 0 && (e += `
|
|
1085
1143
|
---
|
|
1086
1144
|
`);
|
|
1087
|
-
const n =
|
|
1088
|
-
e += `Totals: ${
|
|
1145
|
+
const n = Ue(t.totals.size ?? 0), i = t.totals.dateModified ? `, last modified ${je(t.totals.dateModified)} ago` : "";
|
|
1146
|
+
e += `Totals: ${t.totals.countFiles ?? 0} files in dirs, ${n}${i}`;
|
|
1089
1147
|
}
|
|
1090
1148
|
return e;
|
|
1091
1149
|
}
|
|
1092
|
-
const
|
|
1093
|
-
version:
|
|
1094
|
-
},
|
|
1095
|
-
function
|
|
1096
|
-
const
|
|
1150
|
+
const es = "4.0.2", ts = {
|
|
1151
|
+
version: es
|
|
1152
|
+
}, Go = "Project Tools", Jo = "project-tools", Wo = ts.version, Ko = "d00f70240703039df14c76176a055bce6b5484d2b552ba2c89820f03b8e5e60d", qe = 25e3;
|
|
1153
|
+
function _e(t) {
|
|
1154
|
+
const r = t.match(
|
|
1097
1155
|
/^\s*(\d+(?:\.\d+)?)\s*([smhdwMY]|sec(onds?)?|min(utes?)?|hours?|days?|weeks?|months?|years?)\s*$/i
|
|
1098
1156
|
);
|
|
1099
|
-
if (!
|
|
1157
|
+
if (!r)
|
|
1100
1158
|
throw new Error(
|
|
1101
|
-
`Invalid time ago format: "${
|
|
1159
|
+
`Invalid time ago format: "${t}". Must be a number followed by a time unit. Valid units: s/sec/seconds (seconds), m/min/minutes (minutes), h/hours (hours), d/days (days), w/weeks (weeks), M/months (months), Y/years (years). Examples: "30s", "0.5h", "1.5d", "7d", "3w", "6M", "1Y". Format is case-insensitive except M (months) must be uppercase to distinguish from m (minutes).`
|
|
1102
1160
|
);
|
|
1103
|
-
const s = parseFloat(
|
|
1104
|
-
let o =
|
|
1161
|
+
const s = parseFloat(r[1]);
|
|
1162
|
+
let o = r[2];
|
|
1105
1163
|
switch (o !== "M" && (o = o.toLowerCase(), o.startsWith("month") ? o = "M" : o.length > 1 && (o = o[0])), o) {
|
|
1106
1164
|
case "s":
|
|
1107
1165
|
return s * 1e3;
|
|
@@ -1123,13 +1181,13 @@ function ze(r) {
|
|
|
1123
1181
|
);
|
|
1124
1182
|
}
|
|
1125
1183
|
}
|
|
1126
|
-
function
|
|
1127
|
-
const
|
|
1128
|
-
if (!
|
|
1184
|
+
function Ge(t) {
|
|
1185
|
+
const r = t.match(/^\s*(\d+(?:\.\d+)?)\s*(B|KB|MB|GB|TB)\s*$/i);
|
|
1186
|
+
if (!r)
|
|
1129
1187
|
throw new Error(
|
|
1130
|
-
`Invalid size format: "${
|
|
1188
|
+
`Invalid size format: "${t}". Must be a number (integer or decimal) followed by a size unit. Valid units: B (bytes), KB (kilobytes), MB (megabytes), GB (gigabytes), TB (terabytes). Uses binary units (1024-based). Examples: "1B", "2.5KB", "100MB", "1.2GB", "0.5TB". Units are case-insensitive.`
|
|
1131
1189
|
);
|
|
1132
|
-
const s = parseFloat(
|
|
1190
|
+
const s = parseFloat(r[1]), o = r[2].toUpperCase();
|
|
1133
1191
|
switch (o) {
|
|
1134
1192
|
case "B":
|
|
1135
1193
|
return s;
|
|
@@ -1147,7 +1205,7 @@ function Ue(r) {
|
|
|
1147
1205
|
);
|
|
1148
1206
|
}
|
|
1149
1207
|
}
|
|
1150
|
-
const
|
|
1208
|
+
const Mt = h.object({
|
|
1151
1209
|
relativeRootDir: h.string().optional().describe(
|
|
1152
1210
|
'Relative path from project root to directory for listing. Use forward slashes. Leave empty for project root. Examples: "src", "src/components", "tests". Path must exist'
|
|
1153
1211
|
),
|
|
@@ -1186,13 +1244,13 @@ const bt = h.object({
|
|
|
1186
1244
|
'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'
|
|
1187
1245
|
)
|
|
1188
1246
|
});
|
|
1189
|
-
async function
|
|
1247
|
+
async function rs(t, r) {
|
|
1190
1248
|
let s;
|
|
1191
1249
|
try {
|
|
1192
|
-
s =
|
|
1193
|
-
} catch (
|
|
1250
|
+
s = Mt.parse(t);
|
|
1251
|
+
} catch (y) {
|
|
1194
1252
|
return {
|
|
1195
|
-
error: F(
|
|
1253
|
+
error: F(y)
|
|
1196
1254
|
};
|
|
1197
1255
|
}
|
|
1198
1256
|
const {
|
|
@@ -1209,90 +1267,93 @@ async function Qr(r, t) {
|
|
|
1209
1267
|
return {
|
|
1210
1268
|
error: 'Fields array must include "path" field when fields are specified. The "path" field is required to identify files and directories in the output'
|
|
1211
1269
|
};
|
|
1212
|
-
const f = s.fields ? s.fields.map((
|
|
1213
|
-
let d = i?.map((
|
|
1214
|
-
let
|
|
1215
|
-
return
|
|
1216
|
-
field:
|
|
1217
|
-
desc:
|
|
1270
|
+
const f = s.fields ? s.fields.map((y) => y === "totalCountFiles" ? "countFiles" : y === "lastModified" ? "dateModified" : y) : [];
|
|
1271
|
+
let d = i?.map((y) => {
|
|
1272
|
+
let w = y.field;
|
|
1273
|
+
return w === "totalCountFiles" && (w = "countFiles"), w === "lastModified" && (w = "dateModified"), {
|
|
1274
|
+
field: w,
|
|
1275
|
+
desc: y.desc ?? !1
|
|
1218
1276
|
// Default to ascending if not specified
|
|
1219
1277
|
};
|
|
1220
1278
|
}) ?? null;
|
|
1221
1279
|
(!d || d.length === 0) && (d = [{ field: "path", desc: !1 }]);
|
|
1222
|
-
const p = d?.map((
|
|
1223
|
-
|
|
1224
|
-
s.relativeRootDir
|
|
1280
|
+
const p = d?.map((y) => y.field) || [], m = be(
|
|
1281
|
+
r.workingDir,
|
|
1282
|
+
s.relativeRootDir
|
|
1225
1283
|
);
|
|
1284
|
+
if ("error" in m)
|
|
1285
|
+
return { error: m.error };
|
|
1286
|
+
const g = m.path;
|
|
1226
1287
|
try {
|
|
1227
1288
|
try {
|
|
1228
1289
|
await j.promises.access(g, j.constants.F_OK);
|
|
1229
|
-
} catch (
|
|
1230
|
-
if (
|
|
1290
|
+
} catch (S) {
|
|
1291
|
+
if (S.code === "ENOENT")
|
|
1231
1292
|
return {
|
|
1232
1293
|
error: `Directory does not exist: "${g}". 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.`
|
|
1233
1294
|
};
|
|
1234
|
-
throw
|
|
1295
|
+
throw S;
|
|
1235
1296
|
}
|
|
1236
|
-
const
|
|
1237
|
-
value:
|
|
1297
|
+
const y = o && o.length > 0 ? o.map((S) => ({
|
|
1298
|
+
value: S,
|
|
1238
1299
|
valueType: "pattern",
|
|
1239
1300
|
exclude: !1
|
|
1240
|
-
})) : [{ value: "**", valueType: "pattern", exclude: !1 }],
|
|
1301
|
+
})) : [{ value: "**", valueType: "pattern", exclude: !1 }], w = r.globsExclude || [], M = [...y, ...w], E = {
|
|
1241
1302
|
files: e ?? !1,
|
|
1242
1303
|
dirs: n ?? !1,
|
|
1243
1304
|
dateModified: f.includes("dateModified") || p.includes("dateModified"),
|
|
1244
1305
|
size: f.includes("size") || p.includes("size"),
|
|
1245
1306
|
countFiles: f.includes("countFiles") || p.includes("countFiles")
|
|
1246
1307
|
};
|
|
1247
|
-
let
|
|
1308
|
+
let b = null, $ = null;
|
|
1248
1309
|
if (a || c)
|
|
1249
1310
|
try {
|
|
1250
|
-
const
|
|
1251
|
-
|
|
1252
|
-
} catch (
|
|
1311
|
+
const S = Date.now(), v = c ? S - _e(c) : null, B = a ? S - _e(a) : null;
|
|
1312
|
+
b = [v, B];
|
|
1313
|
+
} catch (S) {
|
|
1253
1314
|
return {
|
|
1254
|
-
error:
|
|
1315
|
+
error: S instanceof Error ? S.message : "Unknown error parsing time ago filter"
|
|
1255
1316
|
};
|
|
1256
1317
|
}
|
|
1257
1318
|
if (l || u)
|
|
1258
1319
|
try {
|
|
1259
|
-
const
|
|
1260
|
-
|
|
1261
|
-
} catch (
|
|
1320
|
+
const S = l ? Ge(l) : null, v = u ? Ge(u) : null;
|
|
1321
|
+
$ = [S, v];
|
|
1322
|
+
} catch (S) {
|
|
1262
1323
|
return {
|
|
1263
|
-
error:
|
|
1324
|
+
error: S instanceof Error ? S.message : "Unknown error parsing size filter"
|
|
1264
1325
|
};
|
|
1265
1326
|
}
|
|
1266
|
-
const
|
|
1327
|
+
const T = await Vr({
|
|
1267
1328
|
rootDir: g || null,
|
|
1268
|
-
globs:
|
|
1269
|
-
result:
|
|
1270
|
-
dateModified:
|
|
1271
|
-
totalSize:
|
|
1329
|
+
globs: M,
|
|
1330
|
+
result: E,
|
|
1331
|
+
dateModified: b,
|
|
1332
|
+
totalSize: $
|
|
1272
1333
|
});
|
|
1273
|
-
return
|
|
1274
|
-
error: `Number of paths (${
|
|
1334
|
+
return T.items.length > qe ? {
|
|
1335
|
+
error: `Number of paths (${T.items.length}) exceeds maximum allowed (${qe}). Consider using more specific glob patterns or filters to reduce the result set.`
|
|
1275
1336
|
} : {
|
|
1276
|
-
output:
|
|
1337
|
+
output: Xr(T, {
|
|
1277
1338
|
sort: d,
|
|
1278
1339
|
fields: f,
|
|
1279
1340
|
totals: !0
|
|
1280
1341
|
})
|
|
1281
1342
|
};
|
|
1282
|
-
} catch (
|
|
1283
|
-
return { error:
|
|
1343
|
+
} catch (y) {
|
|
1344
|
+
return { error: y instanceof Error ? y.message : "Unknown error" };
|
|
1284
1345
|
}
|
|
1285
1346
|
}
|
|
1286
|
-
function
|
|
1287
|
-
|
|
1347
|
+
function ss(t, r) {
|
|
1348
|
+
t(
|
|
1288
1349
|
"fs-list",
|
|
1289
1350
|
{
|
|
1290
1351
|
title: "List Files and Directories",
|
|
1291
1352
|
description: "List files and directories with advanced filtering, sorting and formatting options. Use this to analyze filesystem structure",
|
|
1292
|
-
inputSchema:
|
|
1353
|
+
inputSchema: Mt.shape
|
|
1293
1354
|
},
|
|
1294
1355
|
async (s) => {
|
|
1295
|
-
const o = await
|
|
1356
|
+
const o = await rs(s, r);
|
|
1296
1357
|
return o.error ? `Method: fs-list(${JSON.stringify(s)})
|
|
1297
1358
|
❌ Error: ${o.error}` : `Method: fs-list(${JSON.stringify(s)})
|
|
1298
1359
|
${o.output || JSON.stringify(o, null, 2)}`;
|
|
@@ -1300,27 +1361,27 @@ ${o.output || JSON.stringify(o, null, 2)}`;
|
|
|
1300
1361
|
);
|
|
1301
1362
|
}
|
|
1302
1363
|
const ue = /* @__PURE__ */ new Map();
|
|
1303
|
-
let
|
|
1304
|
-
function
|
|
1305
|
-
return `${++
|
|
1364
|
+
let os = 0;
|
|
1365
|
+
function ns() {
|
|
1366
|
+
return `${++os}-${Math.random().toString(36).slice(2)}`;
|
|
1306
1367
|
}
|
|
1307
|
-
function Z(
|
|
1308
|
-
return ue.has(
|
|
1368
|
+
function Z(t) {
|
|
1369
|
+
return ue.has(t) || ue.set(t, {
|
|
1309
1370
|
fsSnapshotQueries: /* @__PURE__ */ new Map(),
|
|
1310
1371
|
fsSnapshots: /* @__PURE__ */ new Map(),
|
|
1311
1372
|
preparedReplace: null
|
|
1312
|
-
}), ue.get(
|
|
1373
|
+
}), ue.get(t);
|
|
1313
1374
|
}
|
|
1314
|
-
function
|
|
1315
|
-
const
|
|
1375
|
+
function Je(t) {
|
|
1376
|
+
const r = t.match(
|
|
1316
1377
|
/^\s*(\d+(?:\.\d+)?)\s*([smhdwMY]|sec(onds?)?|min(utes?)?|hours?|days?|weeks?|months?|years?)\s*$/i
|
|
1317
1378
|
);
|
|
1318
|
-
if (!
|
|
1379
|
+
if (!r)
|
|
1319
1380
|
throw new Error(
|
|
1320
|
-
`Invalid time ago format: "${
|
|
1381
|
+
`Invalid time ago format: "${t}". Must be a number followed by a time unit. Valid units: s/sec/seconds (seconds), m/min/minutes (minutes), h/hours (hours), d/days (days), w/weeks (weeks), M/months (months), Y/years (years). Examples: "30s", "0.5h", "1.5d", "7d", "3w", "6M", "1Y". Format is case-insensitive except M (months) must be uppercase to distinguish from m (minutes).`
|
|
1321
1382
|
);
|
|
1322
|
-
const s = parseFloat(
|
|
1323
|
-
let o =
|
|
1383
|
+
const s = parseFloat(r[1]);
|
|
1384
|
+
let o = r[2];
|
|
1324
1385
|
switch (o !== "M" && (o = o.toLowerCase(), o.startsWith("month") ? o = "M" : o.length > 1 && (o = o[0])), o) {
|
|
1325
1386
|
case "s":
|
|
1326
1387
|
return s * 1e3;
|
|
@@ -1342,13 +1403,13 @@ function je(r) {
|
|
|
1342
1403
|
);
|
|
1343
1404
|
}
|
|
1344
1405
|
}
|
|
1345
|
-
function
|
|
1346
|
-
const
|
|
1347
|
-
if (!
|
|
1406
|
+
function We(t) {
|
|
1407
|
+
const r = t.match(/^\s*(\d+(?:\.\d+)?)\s*(B|KB|MB|GB|TB)\s*$/i);
|
|
1408
|
+
if (!r)
|
|
1348
1409
|
throw new Error(
|
|
1349
|
-
`Invalid size format: "${
|
|
1410
|
+
`Invalid size format: "${t}". Must be a number (integer or decimal) followed by a size unit. Valid units: B (bytes), KB (kilobytes), MB (megabytes), GB (gigabytes), TB (terabytes). Uses binary units (1024-based). Examples: "1B", "2.5KB", "100MB", "1.2GB", "0.5TB". Units are case-insensitive.`
|
|
1350
1411
|
);
|
|
1351
|
-
const s = parseFloat(
|
|
1412
|
+
const s = parseFloat(r[1]), o = r[2].toUpperCase();
|
|
1352
1413
|
switch (o) {
|
|
1353
1414
|
case "B":
|
|
1354
1415
|
return s;
|
|
@@ -1366,7 +1427,7 @@ function qe(r) {
|
|
|
1366
1427
|
);
|
|
1367
1428
|
}
|
|
1368
1429
|
}
|
|
1369
|
-
const
|
|
1430
|
+
const xe = h.object({
|
|
1370
1431
|
name: h.string().describe(
|
|
1371
1432
|
"Unique name for the filesystem snapshot query. Recommended format: kebab-case-1, kebab-case-2, ..."
|
|
1372
1433
|
),
|
|
@@ -1394,26 +1455,26 @@ const Se = h.object({
|
|
|
1394
1455
|
maxTotalSize: h.string().optional().describe(
|
|
1395
1456
|
'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'
|
|
1396
1457
|
)
|
|
1397
|
-
}),
|
|
1458
|
+
}), Ke = new Map(
|
|
1398
1459
|
[
|
|
1399
1460
|
"name",
|
|
1400
1461
|
"type",
|
|
1401
1462
|
"countMatched",
|
|
1402
1463
|
"size",
|
|
1403
1464
|
"dateModified"
|
|
1404
|
-
].map((
|
|
1465
|
+
].map((t, r) => [t, r])
|
|
1405
1466
|
);
|
|
1406
|
-
function
|
|
1407
|
-
const s =
|
|
1467
|
+
function is(t, r) {
|
|
1468
|
+
const s = Ke.get(t) ?? 1 / 0, o = Ke.get(r) ?? 1 / 0;
|
|
1408
1469
|
return s > o ? 1 : s < o ? -1 : 0;
|
|
1409
1470
|
}
|
|
1410
|
-
async function
|
|
1471
|
+
async function Tt(t, r, s) {
|
|
1411
1472
|
let o;
|
|
1412
1473
|
try {
|
|
1413
|
-
o =
|
|
1414
|
-
} catch (
|
|
1474
|
+
o = xe.parse(t);
|
|
1475
|
+
} catch (m) {
|
|
1415
1476
|
return {
|
|
1416
|
-
error: F(
|
|
1477
|
+
error: F(m)
|
|
1417
1478
|
};
|
|
1418
1479
|
}
|
|
1419
1480
|
const {
|
|
@@ -1429,88 +1490,92 @@ async function St(r, t, s) {
|
|
|
1429
1490
|
return {
|
|
1430
1491
|
error: "Session ID is required"
|
|
1431
1492
|
};
|
|
1432
|
-
const f = Z(s.sessionId), d =
|
|
1433
|
-
|
|
1493
|
+
const f = Z(s.sessionId), d = be(
|
|
1494
|
+
r.workingDir,
|
|
1495
|
+
o.relativeRootDir
|
|
1434
1496
|
);
|
|
1497
|
+
if ("error" in d)
|
|
1498
|
+
return { error: d.error };
|
|
1499
|
+
const p = d.path;
|
|
1435
1500
|
try {
|
|
1436
1501
|
try {
|
|
1437
|
-
await j.promises.access(
|
|
1438
|
-
} catch (
|
|
1439
|
-
if (
|
|
1502
|
+
await j.promises.access(p, j.constants.F_OK);
|
|
1503
|
+
} catch (x) {
|
|
1504
|
+
if (x.code === "ENOENT")
|
|
1440
1505
|
return {
|
|
1441
|
-
error: `Directory does not exist: "${
|
|
1506
|
+
error: `Directory does not exist: "${p}". Verify the path is correct and accessible. If using rootDir parameter, ensure it exists relative to the current working directory. Use fs-snapshot-query-create without rootDir to snapshot the current directory, or check parent directories first.`
|
|
1442
1507
|
};
|
|
1443
|
-
throw
|
|
1508
|
+
throw x;
|
|
1444
1509
|
}
|
|
1445
|
-
const
|
|
1446
|
-
|
|
1447
|
-
const g = n && n.length > 0 ? n.map((
|
|
1448
|
-
value:
|
|
1510
|
+
const m = o.extraFields ? o.extraFields.map((x) => x === "lastModified" ? "dateModified" : x) : [];
|
|
1511
|
+
m.includes("name") || m.push("name"), m.sort(is);
|
|
1512
|
+
const g = n && n.length > 0 ? n.map((x) => ({
|
|
1513
|
+
value: x,
|
|
1449
1514
|
valueType: "pattern",
|
|
1450
1515
|
exclude: !1
|
|
1451
|
-
})) : [{ value: "**", valueType: "pattern", exclude: !1 }],
|
|
1452
|
-
let
|
|
1516
|
+
})) : [{ value: "**", valueType: "pattern", exclude: !1 }], y = r.globsExclude || [], w = [...g, ...y];
|
|
1517
|
+
let M = null, E = null;
|
|
1453
1518
|
if (a || c)
|
|
1454
1519
|
try {
|
|
1455
|
-
const
|
|
1456
|
-
|
|
1457
|
-
} catch (
|
|
1520
|
+
const x = Date.now(), S = c ? x - Je(c) : null, v = a ? x - Je(a) : null;
|
|
1521
|
+
M = [S, v];
|
|
1522
|
+
} catch (x) {
|
|
1458
1523
|
return {
|
|
1459
|
-
error:
|
|
1524
|
+
error: x instanceof Error ? x.message : "Unknown error parsing time ago filter"
|
|
1460
1525
|
};
|
|
1461
1526
|
}
|
|
1462
1527
|
if (l || u)
|
|
1463
1528
|
try {
|
|
1464
|
-
const
|
|
1465
|
-
|
|
1466
|
-
} catch (
|
|
1529
|
+
const x = l ? We(l) : null, S = u ? We(u) : null;
|
|
1530
|
+
E = [x, S];
|
|
1531
|
+
} catch (x) {
|
|
1467
1532
|
return {
|
|
1468
|
-
error:
|
|
1533
|
+
error: x instanceof Error ? x.message : "Unknown error parsing size filter"
|
|
1469
1534
|
};
|
|
1470
1535
|
}
|
|
1471
|
-
const
|
|
1536
|
+
const b = i ? i.includes("file") : !0, $ = i ? i.includes("dir") : !0, T = {
|
|
1472
1537
|
name: e,
|
|
1473
|
-
rootDir:
|
|
1474
|
-
globs:
|
|
1475
|
-
matchFiles:
|
|
1476
|
-
matchDirs:
|
|
1477
|
-
dateModified:
|
|
1478
|
-
totalSize:
|
|
1479
|
-
fields:
|
|
1538
|
+
rootDir: p,
|
|
1539
|
+
globs: w,
|
|
1540
|
+
matchFiles: b,
|
|
1541
|
+
matchDirs: $,
|
|
1542
|
+
dateModified: M,
|
|
1543
|
+
totalSize: E,
|
|
1544
|
+
fields: m
|
|
1480
1545
|
};
|
|
1481
|
-
return f.fsSnapshotQueries.set(e,
|
|
1482
|
-
snapshotQuery:
|
|
1546
|
+
return f.fsSnapshotQueries.set(e, T), {
|
|
1547
|
+
snapshotQuery: T
|
|
1483
1548
|
};
|
|
1484
|
-
} catch (
|
|
1549
|
+
} catch (m) {
|
|
1485
1550
|
return {
|
|
1486
|
-
error:
|
|
1551
|
+
error: m instanceof Error ? m.message : "Unknown error"
|
|
1487
1552
|
};
|
|
1488
1553
|
}
|
|
1489
1554
|
}
|
|
1490
|
-
function
|
|
1491
|
-
|
|
1555
|
+
function as(t, r) {
|
|
1556
|
+
t(
|
|
1492
1557
|
"fs-snapshot-query-create",
|
|
1493
1558
|
{
|
|
1494
1559
|
title: "Create Filesystem Snapshot Query",
|
|
1495
1560
|
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",
|
|
1496
|
-
inputSchema:
|
|
1561
|
+
inputSchema: xe.shape
|
|
1497
1562
|
},
|
|
1498
1563
|
async (s, o) => {
|
|
1499
|
-
const e = await
|
|
1564
|
+
const e = await Tt(s, r, o);
|
|
1500
1565
|
return e.error != null ? `Method: fs-snapshot-query-create(${JSON.stringify(s)})
|
|
1501
1566
|
❌ Error: ${e.error}` : `Method: fs-snapshot-query-create(${JSON.stringify(s)})
|
|
1502
1567
|
✅ Filesystem snapshot query "${e.snapshotQuery.name}" created successfully`;
|
|
1503
1568
|
}
|
|
1504
1569
|
);
|
|
1505
1570
|
}
|
|
1506
|
-
function le(
|
|
1507
|
-
const { idToNode:
|
|
1571
|
+
function le(t) {
|
|
1572
|
+
const { idToNode: r, idToChildIds: s } = t, o = r.get(null);
|
|
1508
1573
|
if (o == null)
|
|
1509
1574
|
throw new Error(
|
|
1510
1575
|
"Impossible behavior: root node (id: null) not found in idToNode"
|
|
1511
1576
|
);
|
|
1512
1577
|
const e = /* @__PURE__ */ new Map();
|
|
1513
|
-
return
|
|
1578
|
+
return r.forEach((n, i) => {
|
|
1514
1579
|
if (n != null) {
|
|
1515
1580
|
if (e.has(n)) {
|
|
1516
1581
|
const a = e.get(n);
|
|
@@ -1522,18 +1587,18 @@ function le(r) {
|
|
|
1522
1587
|
}
|
|
1523
1588
|
}), {
|
|
1524
1589
|
root: o,
|
|
1525
|
-
getNode: (n) =>
|
|
1590
|
+
getNode: (n) => r.get(n) ?? null,
|
|
1526
1591
|
getId: (n) => e.get(n) ?? null,
|
|
1527
1592
|
getChilds: (n) => {
|
|
1528
1593
|
let i = e.get(n);
|
|
1529
1594
|
if (i == null)
|
|
1530
|
-
if (n ===
|
|
1595
|
+
if (n === r.get(null))
|
|
1531
1596
|
i = null;
|
|
1532
1597
|
else
|
|
1533
1598
|
throw new Error("Impossible behavior: node not found in idToNode");
|
|
1534
1599
|
const a = s.get(i);
|
|
1535
1600
|
return a == null ? null : a.map((c) => {
|
|
1536
|
-
const l =
|
|
1601
|
+
const l = r.get(c);
|
|
1537
1602
|
if (l == null)
|
|
1538
1603
|
throw new Error(
|
|
1539
1604
|
`Child node with id '${c}' not found in idToNode`
|
|
@@ -1543,22 +1608,22 @@ function le(r) {
|
|
|
1543
1608
|
}
|
|
1544
1609
|
};
|
|
1545
1610
|
}
|
|
1546
|
-
function
|
|
1611
|
+
function Ct(t, r, s) {
|
|
1547
1612
|
let o = null;
|
|
1548
|
-
for (let e = 0, n =
|
|
1549
|
-
const i =
|
|
1613
|
+
for (let e = 0, n = r.length; e < n; e++) {
|
|
1614
|
+
const i = r[e], a = t(i), c = a == null ? null : Ct(t, a, s), l = s(i, c);
|
|
1550
1615
|
l != null && (o == null && (o = []), o.push(l));
|
|
1551
1616
|
}
|
|
1552
1617
|
return o;
|
|
1553
1618
|
}
|
|
1554
|
-
function
|
|
1555
|
-
const { getId:
|
|
1619
|
+
function vt(t) {
|
|
1620
|
+
const { getId: r, getChilds: s, rootNodes: o, createSnapshotNode: e } = t, n = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), c = Ct(
|
|
1556
1621
|
s,
|
|
1557
1622
|
o,
|
|
1558
1623
|
(u, f) => {
|
|
1559
1624
|
const d = e(u, f);
|
|
1560
1625
|
if (u != null && d != null) {
|
|
1561
|
-
const p =
|
|
1626
|
+
const p = r(u);
|
|
1562
1627
|
n.set(p, d), i.set(d, p);
|
|
1563
1628
|
}
|
|
1564
1629
|
return d != null && f != null && a.set(
|
|
@@ -1577,11 +1642,11 @@ function $t(r) {
|
|
|
1577
1642
|
idToChildIds: a
|
|
1578
1643
|
};
|
|
1579
1644
|
}
|
|
1580
|
-
function me(
|
|
1581
|
-
return
|
|
1645
|
+
function me(t) {
|
|
1646
|
+
return t = t != null ? H(t).replace(/\/$/, "") : null, !t || t === "." ? null : t;
|
|
1582
1647
|
}
|
|
1583
|
-
async function
|
|
1584
|
-
const
|
|
1648
|
+
async function ls(t) {
|
|
1649
|
+
const r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), o = k.resolve(t.rootDir || "."), n = {
|
|
1585
1650
|
path: ".",
|
|
1586
1651
|
name: k.basename(o),
|
|
1587
1652
|
type: "dir",
|
|
@@ -1589,15 +1654,15 @@ async function ts(r) {
|
|
|
1589
1654
|
dateModified: null,
|
|
1590
1655
|
size: 0
|
|
1591
1656
|
};
|
|
1592
|
-
|
|
1593
|
-
const i = await
|
|
1657
|
+
r.set(null, n);
|
|
1658
|
+
const i = await $t({
|
|
1594
1659
|
rootDir: o,
|
|
1595
|
-
globs:
|
|
1660
|
+
globs: t.globs
|
|
1596
1661
|
});
|
|
1597
|
-
return await
|
|
1662
|
+
return await xt({
|
|
1598
1663
|
paths: [o],
|
|
1599
1664
|
walkLinks: !0,
|
|
1600
|
-
matchPath:
|
|
1665
|
+
matchPath: It({
|
|
1601
1666
|
globs: i,
|
|
1602
1667
|
rootDir: o,
|
|
1603
1668
|
noCase: !0
|
|
@@ -1606,15 +1671,15 @@ async function ts(r) {
|
|
|
1606
1671
|
const u = k.relative(o, a), f = c.isDirectory(), d = c.isFile();
|
|
1607
1672
|
if (!f && !d)
|
|
1608
1673
|
return !0;
|
|
1609
|
-
const p = me(u || "."),
|
|
1674
|
+
const p = me(u || "."), m = f ? "dir" : "file", g = f ? null : c.mtimeMs, y = c.size;
|
|
1610
1675
|
let w = !0;
|
|
1611
|
-
if (d && !
|
|
1612
|
-
const [$,
|
|
1613
|
-
($ != null &&
|
|
1676
|
+
if (d && !t.matchFiles && (w = !1), f && !t.matchDirs && (w = !1), w && d && t.dateModified && g != null) {
|
|
1677
|
+
const [$, T] = t.dateModified;
|
|
1678
|
+
($ != null && g < $ || T != null && g > T) && (w = !1);
|
|
1614
1679
|
}
|
|
1615
|
-
if (w && d &&
|
|
1616
|
-
const [$,
|
|
1617
|
-
($ != null && y < $ ||
|
|
1680
|
+
if (w && d && t.totalSize && y != null) {
|
|
1681
|
+
const [$, T] = t.totalSize;
|
|
1682
|
+
($ != null && y < $ || T != null && y > T) && (w = !1);
|
|
1618
1683
|
}
|
|
1619
1684
|
if (f && !w) {
|
|
1620
1685
|
if (!(l.countFiles && l.countFiles > 0)) return !1;
|
|
@@ -1623,33 +1688,33 @@ async function ts(r) {
|
|
|
1623
1688
|
const M = {
|
|
1624
1689
|
path: p ?? ".",
|
|
1625
1690
|
name: k.basename(a),
|
|
1626
|
-
type:
|
|
1627
|
-
dateModified:
|
|
1691
|
+
type: m,
|
|
1692
|
+
dateModified: g,
|
|
1628
1693
|
size: y,
|
|
1629
1694
|
isMatched: w
|
|
1630
1695
|
};
|
|
1631
1696
|
if (p == null)
|
|
1632
|
-
return n.dateModified =
|
|
1633
|
-
|
|
1697
|
+
return n.dateModified = g, n.size = y, n.isMatched = w, !0;
|
|
1698
|
+
r.set(p, M);
|
|
1634
1699
|
const E = me(H(k.dirname(p)));
|
|
1635
1700
|
let b = s.get(E);
|
|
1636
1701
|
return b || (b = [], s.set(E, b)), b.push(p), !0;
|
|
1637
1702
|
}
|
|
1638
1703
|
}), {
|
|
1639
|
-
idToNode:
|
|
1704
|
+
idToNode: r,
|
|
1640
1705
|
idToChildIds: s
|
|
1641
1706
|
};
|
|
1642
1707
|
}
|
|
1643
|
-
const
|
|
1644
|
-
{ name: "[ ]", match: (
|
|
1645
|
-
{ name: "[\\t]", match: (
|
|
1646
|
-
{ name: "[\\n]", match: (
|
|
1647
|
-
{ name: "[-]", match: (
|
|
1648
|
-
{ name: "[=]", match: (
|
|
1649
|
-
{ name: "[_]", match: (
|
|
1650
|
-
{ name: "[*]", match: (
|
|
1651
|
-
{ name: "[.]", match: (
|
|
1652
|
-
{ name: "[0-9]", match: (
|
|
1708
|
+
const cs = [
|
|
1709
|
+
{ name: "[ ]", match: (t) => t === 32, min: 2, max: 81 },
|
|
1710
|
+
{ name: "[\\t]", match: (t) => t === 9, min: 2, max: 20 },
|
|
1711
|
+
{ name: "[\\n]", match: (t) => t === 10, min: 2, max: 14 },
|
|
1712
|
+
{ name: "[-]", match: (t) => t === 45, min: 2, max: 16 },
|
|
1713
|
+
{ name: "[=]", match: (t) => t === 61, min: 2, max: 16 },
|
|
1714
|
+
{ name: "[_]", match: (t) => t === 95, min: 2, max: 16 },
|
|
1715
|
+
{ name: "[*]", match: (t) => t === 42, min: 2, max: 16 },
|
|
1716
|
+
{ name: "[.]", match: (t) => t === 46, min: 2, max: 16 },
|
|
1717
|
+
{ name: "[0-9]", match: (t) => t >= 48 && t <= 57, min: 2, max: 3 }
|
|
1653
1718
|
// { name: '[a-z]', match: c => c >= 97 && c <= 122, min: 2, max: 2 },
|
|
1654
1719
|
// { name: '[A-Z]', match: c => c >= 65 && c <= 90, min: 2, max: 2 },
|
|
1655
1720
|
// Other ASCII symbols
|
|
@@ -1663,21 +1728,21 @@ const rs = [
|
|
|
1663
1728
|
// max: 2,
|
|
1664
1729
|
// },
|
|
1665
1730
|
];
|
|
1666
|
-
function
|
|
1667
|
-
const s =
|
|
1731
|
+
function He(t, r = cs) {
|
|
1732
|
+
const s = t.length;
|
|
1668
1733
|
if (s === 0) return 0;
|
|
1669
|
-
const o =
|
|
1734
|
+
const o = r.length;
|
|
1670
1735
|
if (o === 0)
|
|
1671
1736
|
return s;
|
|
1672
1737
|
let e = 0, n = 0;
|
|
1673
1738
|
for (; n < s; ) {
|
|
1674
|
-
const i =
|
|
1739
|
+
const i = t.charCodeAt(n);
|
|
1675
1740
|
let a = !1;
|
|
1676
1741
|
for (let c = 0; c < o; c++) {
|
|
1677
|
-
const l =
|
|
1742
|
+
const l = r[c];
|
|
1678
1743
|
if (l.match(i)) {
|
|
1679
1744
|
let u = 1;
|
|
1680
|
-
for (; ++n < s && l.match(
|
|
1745
|
+
for (; ++n < s && l.match(t.charCodeAt(n)) && u < l.max; )
|
|
1681
1746
|
u++;
|
|
1682
1747
|
if (u >= l.min) {
|
|
1683
1748
|
e++, a = !0;
|
|
@@ -1689,27 +1754,27 @@ function _e(r, t = rs) {
|
|
|
1689
1754
|
}
|
|
1690
1755
|
return e;
|
|
1691
1756
|
}
|
|
1692
|
-
function
|
|
1693
|
-
let
|
|
1694
|
-
return
|
|
1757
|
+
function Et(t) {
|
|
1758
|
+
let r = 0;
|
|
1759
|
+
return r += He(t.textOpen) + 1, t.textClose != null && (r += He(t.textClose) + 1), t.indent && (r += 1), r;
|
|
1695
1760
|
}
|
|
1696
|
-
const
|
|
1697
|
-
function
|
|
1698
|
-
if (
|
|
1699
|
-
let
|
|
1700
|
-
for (;
|
|
1701
|
-
|
|
1702
|
-
return `${s === 0 ?
|
|
1761
|
+
const Qe = ["B", "KB", "MB", "GB", "TB"], Ye = 1024;
|
|
1762
|
+
function us(t) {
|
|
1763
|
+
if (t == null) return "-";
|
|
1764
|
+
let r = t ?? 0, s = 0;
|
|
1765
|
+
for (; r >= Ye && s < Qe.length - 1; )
|
|
1766
|
+
r /= Ye, s++;
|
|
1767
|
+
return `${s === 0 ? r.toString() : r.toFixed(2)}${Qe[s]}`;
|
|
1703
1768
|
}
|
|
1704
|
-
function
|
|
1705
|
-
const s = Date.now() -
|
|
1769
|
+
function ds(t) {
|
|
1770
|
+
const s = Date.now() - t;
|
|
1706
1771
|
if (s < 0) return "0s";
|
|
1707
1772
|
const o = Math.floor(s / 1e3), e = Math.floor(o / 60), n = Math.floor(e / 60), i = Math.floor(n / 24), a = Math.floor(i / 7), c = Math.floor(i / 30), l = Math.floor(i / 365);
|
|
1708
1773
|
return l > 0 ? `${l}Y` : c > 0 ? `${c}M` : a > 0 ? `${a}w` : i > 0 ? `${i}d` : n > 0 ? `${n}h` : e > 0 ? `${e}m` : `${o}s`;
|
|
1709
1774
|
}
|
|
1710
|
-
function
|
|
1775
|
+
function fs(t) {
|
|
1711
1776
|
return function(s, o) {
|
|
1712
|
-
const e =
|
|
1777
|
+
const e = t.get(s), n = t.get(o);
|
|
1713
1778
|
if (e.type !== n.type)
|
|
1714
1779
|
return e.type === "file" ? -1 : 1;
|
|
1715
1780
|
if (e.type === "file")
|
|
@@ -1720,26 +1785,26 @@ function ns(r) {
|
|
|
1720
1785
|
}
|
|
1721
1786
|
};
|
|
1722
1787
|
}
|
|
1723
|
-
function
|
|
1724
|
-
const
|
|
1788
|
+
function ps(t) {
|
|
1789
|
+
const r = t.fields ?? [];
|
|
1725
1790
|
return function(o, e) {
|
|
1726
1791
|
let n = "", i, a = 0;
|
|
1727
1792
|
const c = e ? e.length : 0;
|
|
1728
|
-
let l = 1, u, f = 0, d = 0, p = 0,
|
|
1793
|
+
let l = 1, u, f = 0, d = 0, p = 0, m = 0, g = null, y, w, M;
|
|
1729
1794
|
if (e)
|
|
1730
1795
|
for (let b = 0; b < e.length; b++) {
|
|
1731
1796
|
const $ = e[b];
|
|
1732
|
-
a += $.countMatched, l += $.countTotal, f += $.tokens, d += $.tokensTotal, p += $.size,
|
|
1797
|
+
a += $.countMatched, l += $.countTotal, f += $.tokens, d += $.tokensTotal, p += $.size, m += $.countFiles, $.dateModified != null && (g == null || $.dateModified > g) && (g = $.dateModified);
|
|
1733
1798
|
}
|
|
1734
|
-
o ? (y = o.type, w = o.name, M = o.path, i = o.isMatched, i && (a += 1), o.type === "file" ? (p = o.size || 0,
|
|
1735
|
-
for (let b = 0, $ =
|
|
1736
|
-
const
|
|
1737
|
-
switch (b > 0 && (n += " "),
|
|
1799
|
+
o ? (y = o.type, w = o.name, M = o.path, i = o.isMatched, i && (a += 1), o.type === "file" ? (p = o.size || 0, m = 1, g = o.dateModified || null) : o.dateModified != null && (g == null || o.dateModified > g) && (g = o.dateModified)) : (y = "dir", w = "<root>", M = ".", i = !0);
|
|
1800
|
+
for (let b = 0, $ = r.length; b < $; b++) {
|
|
1801
|
+
const T = r[b];
|
|
1802
|
+
switch (b > 0 && (n += " "), T) {
|
|
1738
1803
|
case "dateModified":
|
|
1739
|
-
n +=
|
|
1804
|
+
n += g ? ds(g) : "-";
|
|
1740
1805
|
break;
|
|
1741
1806
|
case "size":
|
|
1742
|
-
n +=
|
|
1807
|
+
n += us(p);
|
|
1743
1808
|
break;
|
|
1744
1809
|
case "type":
|
|
1745
1810
|
n += y;
|
|
@@ -1757,7 +1822,7 @@ function is(r) {
|
|
|
1757
1822
|
textOpen: n,
|
|
1758
1823
|
textClose: null
|
|
1759
1824
|
};
|
|
1760
|
-
return u =
|
|
1825
|
+
return u = Et(E), d += u, {
|
|
1761
1826
|
type: y,
|
|
1762
1827
|
name: w,
|
|
1763
1828
|
path: M,
|
|
@@ -1770,13 +1835,13 @@ function is(r) {
|
|
|
1770
1835
|
tokensTotal: d,
|
|
1771
1836
|
text: E,
|
|
1772
1837
|
size: p,
|
|
1773
|
-
countFiles:
|
|
1774
|
-
dateModified:
|
|
1838
|
+
countFiles: m,
|
|
1839
|
+
dateModified: g
|
|
1775
1840
|
};
|
|
1776
1841
|
};
|
|
1777
1842
|
}
|
|
1778
|
-
async function
|
|
1779
|
-
const
|
|
1843
|
+
async function hs(t) {
|
|
1844
|
+
const r = await ls(t), s = le(r), o = s.getChilds(s.root), e = vt({
|
|
1780
1845
|
getId: (i) => {
|
|
1781
1846
|
const a = s.getId(i);
|
|
1782
1847
|
if (a == null)
|
|
@@ -1786,26 +1851,26 @@ async function as(r) {
|
|
|
1786
1851
|
return a;
|
|
1787
1852
|
},
|
|
1788
1853
|
getChilds: (i) => s.getChilds(i),
|
|
1789
|
-
createSnapshotNode:
|
|
1854
|
+
createSnapshotNode: ps(t),
|
|
1790
1855
|
rootNodes: o ?? []
|
|
1791
|
-
}), n =
|
|
1856
|
+
}), n = fs(e.idToNode);
|
|
1792
1857
|
return e.idToChildIds.forEach((i) => {
|
|
1793
1858
|
i.sort(n);
|
|
1794
1859
|
}), le(e);
|
|
1795
1860
|
}
|
|
1796
1861
|
const ee = h.object({
|
|
1797
1862
|
queryName: h.string().optional().describe("Name of previously created filesystem snapshot query, to use"),
|
|
1798
|
-
query:
|
|
1863
|
+
query: xe.optional().describe(
|
|
1799
1864
|
"Filesystem snapshot query creation options JSON to automatically create query"
|
|
1800
1865
|
),
|
|
1801
1866
|
name: h.string().describe(
|
|
1802
1867
|
"Unique name for the filesystem snapshot. Recommended format: kebab-case-1, kebab-case-2, ..."
|
|
1803
1868
|
)
|
|
1804
1869
|
});
|
|
1805
|
-
async function ce(
|
|
1870
|
+
async function ce(t, r, s) {
|
|
1806
1871
|
let o;
|
|
1807
1872
|
try {
|
|
1808
|
-
o = ee.parse(
|
|
1873
|
+
o = ee.parse(t);
|
|
1809
1874
|
} catch (u) {
|
|
1810
1875
|
return {
|
|
1811
1876
|
error: F(u)
|
|
@@ -1830,9 +1895,9 @@ async function ce(r, t, s) {
|
|
|
1830
1895
|
};
|
|
1831
1896
|
c = u;
|
|
1832
1897
|
} else if (i) {
|
|
1833
|
-
const u = await
|
|
1898
|
+
const u = await Tt(
|
|
1834
1899
|
i,
|
|
1835
|
-
|
|
1900
|
+
r,
|
|
1836
1901
|
s
|
|
1837
1902
|
);
|
|
1838
1903
|
if (u.error != null)
|
|
@@ -1845,7 +1910,7 @@ async function ce(r, t, s) {
|
|
|
1845
1910
|
error: "Either queryName or query must be provided"
|
|
1846
1911
|
};
|
|
1847
1912
|
try {
|
|
1848
|
-
const u = await
|
|
1913
|
+
const u = await hs(c), f = {
|
|
1849
1914
|
name: e,
|
|
1850
1915
|
query: c,
|
|
1851
1916
|
tree: u
|
|
@@ -1860,8 +1925,8 @@ async function ce(r, t, s) {
|
|
|
1860
1925
|
};
|
|
1861
1926
|
}
|
|
1862
1927
|
}
|
|
1863
|
-
function
|
|
1864
|
-
|
|
1928
|
+
function ms(t, r) {
|
|
1929
|
+
t(
|
|
1865
1930
|
"fs-snapshot-create",
|
|
1866
1931
|
{
|
|
1867
1932
|
title: "Create Filesystem Snapshot",
|
|
@@ -1869,7 +1934,7 @@ function ls(r, t) {
|
|
|
1869
1934
|
inputSchema: ee.shape
|
|
1870
1935
|
},
|
|
1871
1936
|
async (s, o) => {
|
|
1872
|
-
const e = await ce(s,
|
|
1937
|
+
const e = await ce(s, r, o);
|
|
1873
1938
|
if (e.error != null)
|
|
1874
1939
|
return `Method: fs-snapshot-create(${JSON.stringify(s)})
|
|
1875
1940
|
❌ Error: ${e.error}`;
|
|
@@ -1880,18 +1945,18 @@ function ls(r, t) {
|
|
|
1880
1945
|
}
|
|
1881
1946
|
);
|
|
1882
1947
|
}
|
|
1883
|
-
class
|
|
1948
|
+
class gs {
|
|
1884
1949
|
_first = null;
|
|
1885
1950
|
_last = null;
|
|
1886
1951
|
_size = 0;
|
|
1887
|
-
enqueue(
|
|
1888
|
-
const s = { item:
|
|
1952
|
+
enqueue(r) {
|
|
1953
|
+
const s = { item: r, next: null };
|
|
1889
1954
|
this._last ? this._last.next = s : this._first = s, this._last = s, this._size += 1;
|
|
1890
1955
|
}
|
|
1891
1956
|
dequeue() {
|
|
1892
1957
|
if (!this._first) return null;
|
|
1893
|
-
const
|
|
1894
|
-
return this._first = this._first.next, this._first || (this._last = null), this._size -= 1,
|
|
1958
|
+
const r = this._first.item;
|
|
1959
|
+
return this._first = this._first.next, this._first || (this._last = null), this._size -= 1, r;
|
|
1895
1960
|
}
|
|
1896
1961
|
peek() {
|
|
1897
1962
|
return this._first ? this._first.item : null;
|
|
@@ -1903,34 +1968,34 @@ class cs {
|
|
|
1903
1968
|
return this._size;
|
|
1904
1969
|
}
|
|
1905
1970
|
}
|
|
1906
|
-
function
|
|
1907
|
-
const
|
|
1971
|
+
function ws(t) {
|
|
1972
|
+
const r = new gs(), {
|
|
1908
1973
|
tree: s,
|
|
1909
1974
|
limits: { maxCountTotal: o, maxTokensTotal: e, maxCountGroup: n, maxTokensGroup: i },
|
|
1910
1975
|
indexRangeGroupStrategy: a
|
|
1911
|
-
} =
|
|
1912
|
-
c != null && c.length > 0 &&
|
|
1976
|
+
} = t, c = s.getChilds(s.root);
|
|
1977
|
+
c != null && c.length > 0 && r.enqueue({
|
|
1913
1978
|
reportNode: null,
|
|
1914
1979
|
node: s.root
|
|
1915
1980
|
});
|
|
1916
1981
|
let l = null, u = 0, f = 0;
|
|
1917
|
-
for (; !
|
|
1918
|
-
const { reportNode: d, node: p } =
|
|
1919
|
-
if (
|
|
1982
|
+
for (; !r.isEmpty(); ) {
|
|
1983
|
+
const { reportNode: d, node: p } = r.dequeue(), m = s.getChilds(p);
|
|
1984
|
+
if (m == null || p.countChilds === 0 || m.length !== p.countChilds)
|
|
1920
1985
|
throw new Error(
|
|
1921
1986
|
"Impossible behavior: nodeChilds is null or length mismatch"
|
|
1922
1987
|
);
|
|
1923
|
-
let
|
|
1924
|
-
for (let w = 0; w <
|
|
1925
|
-
|
|
1926
|
-
const y =
|
|
1927
|
-
if (o != null && u + p.countChilds +
|
|
1988
|
+
let g = r.size();
|
|
1989
|
+
for (let w = 0; w < m.length; w++)
|
|
1990
|
+
m[w].countChilds > 0 && (g += 1);
|
|
1991
|
+
const y = g * a.tokens;
|
|
1992
|
+
if (o != null && u + p.countChilds + g > o || e != null && f + p.tokensChilds + y > e) {
|
|
1928
1993
|
const w = [];
|
|
1929
1994
|
let M = null, E = 0;
|
|
1930
|
-
for (let $ = 0,
|
|
1931
|
-
const x =
|
|
1995
|
+
for (let $ = 0, T = m.length; $ < T; $++) {
|
|
1996
|
+
const x = m[$], S = E * a.tokens;
|
|
1932
1997
|
M != null && // Если общий лимит превышен, то не создаем новую группу, а продолжаем текущую. В случае достижения лимитов, последняя группа может содержать больше элементов, чем указано в лимитах группы, и это допустимо. Главное - дать в отчете полную картину.
|
|
1933
|
-
!(o != null && u + 1 > o || e != null && f + a.tokens > e) && (n != null && M.countGrouped + 1 + E > n || i != null && M.tokensGrouped + x.tokens +
|
|
1998
|
+
!(o != null && u + 1 > o || e != null && f + a.tokens > e) && (n != null && M.countGrouped + 1 + E > n || i != null && M.tokensGrouped + x.tokens + S > i) && (w.push(M), u += 1, f += a.tokens, M = null, E = 0), M = a.add(M, x, $), x.countChilds > 0 && (E += 1);
|
|
1934
1999
|
}
|
|
1935
2000
|
M != null && (w.push(M), u += 1, f += a.tokens);
|
|
1936
2001
|
const b = w.map(($) => ({
|
|
@@ -1948,13 +2013,13 @@ function us(r) {
|
|
|
1948
2013
|
} else {
|
|
1949
2014
|
u += p.countChilds, f += p.tokensChilds;
|
|
1950
2015
|
const w = [];
|
|
1951
|
-
for (let M = 0; M <
|
|
1952
|
-
const E =
|
|
2016
|
+
for (let M = 0; M < m.length; M++) {
|
|
2017
|
+
const E = m[M], b = {
|
|
1953
2018
|
text: E.text
|
|
1954
2019
|
};
|
|
1955
2020
|
w.push(b);
|
|
1956
2021
|
const $ = s.getChilds(E);
|
|
1957
|
-
$ != null && $.length > 0 &&
|
|
2022
|
+
$ != null && $.length > 0 && r.enqueue({
|
|
1958
2023
|
reportNode: b,
|
|
1959
2024
|
node: E
|
|
1960
2025
|
});
|
|
@@ -1972,39 +2037,39 @@ function us(r) {
|
|
|
1972
2037
|
}
|
|
1973
2038
|
return l ?? [];
|
|
1974
2039
|
}
|
|
1975
|
-
function
|
|
2040
|
+
function Nt(t) {
|
|
1976
2041
|
const {
|
|
1977
|
-
tree:
|
|
2042
|
+
tree: r,
|
|
1978
2043
|
request: { parentNodeId: s, childsIndexRange: o, limits: e },
|
|
1979
2044
|
indexRangeGroupStrategy: n,
|
|
1980
2045
|
...i
|
|
1981
|
-
} =
|
|
2046
|
+
} = t;
|
|
1982
2047
|
let a;
|
|
1983
2048
|
if (s != null) {
|
|
1984
|
-
const d =
|
|
2049
|
+
const d = r.getNode(s);
|
|
1985
2050
|
if (d == null)
|
|
1986
2051
|
throw new Error(`Parent node "${s}" not found`);
|
|
1987
2052
|
a = d;
|
|
1988
2053
|
} else
|
|
1989
|
-
a =
|
|
1990
|
-
let c, l =
|
|
2054
|
+
a = r.root;
|
|
2055
|
+
let c, l = r.getChilds(a) ?? [];
|
|
1991
2056
|
if (o != null) {
|
|
1992
2057
|
const [d, p] = o;
|
|
1993
2058
|
if (d < 0 || p <= d || p >= l.length)
|
|
1994
2059
|
throw new Error(
|
|
1995
2060
|
`Invalid index range: ${d}-${p} for root nodes length ${l.length}`
|
|
1996
2061
|
);
|
|
1997
|
-
const
|
|
1998
|
-
let
|
|
2062
|
+
const m = [];
|
|
2063
|
+
let g = null;
|
|
1999
2064
|
for (let y = d; y <= p; y++) {
|
|
2000
2065
|
const w = l[y];
|
|
2001
|
-
|
|
2066
|
+
m.push(w), g = n.add(g, w, y);
|
|
2002
2067
|
}
|
|
2003
|
-
l =
|
|
2068
|
+
l = m, c = {
|
|
2004
2069
|
...a,
|
|
2005
|
-
text: n.getReportText(
|
|
2006
|
-
countChilds:
|
|
2007
|
-
tokensChilds:
|
|
2070
|
+
text: n.getReportText(g),
|
|
2071
|
+
countChilds: g.countGrouped,
|
|
2072
|
+
tokensChilds: g.tokensGrouped
|
|
2008
2073
|
};
|
|
2009
2074
|
} else
|
|
2010
2075
|
c = a;
|
|
@@ -2012,19 +2077,19 @@ function Mt(r) {
|
|
|
2012
2077
|
countChilds: 1,
|
|
2013
2078
|
tokensChilds: c.tokens
|
|
2014
2079
|
}, f = {
|
|
2015
|
-
...
|
|
2080
|
+
...r,
|
|
2016
2081
|
root: u,
|
|
2017
|
-
getChilds: (d) => d === u ? [c] : d === c ? l :
|
|
2082
|
+
getChilds: (d) => d === u ? [c] : d === c ? l : r.getChilds(d)
|
|
2018
2083
|
};
|
|
2019
|
-
return
|
|
2084
|
+
return ws({
|
|
2020
2085
|
tree: f,
|
|
2021
2086
|
limits: e,
|
|
2022
2087
|
indexRangeGroupStrategy: n,
|
|
2023
2088
|
...i
|
|
2024
2089
|
});
|
|
2025
2090
|
}
|
|
2026
|
-
function
|
|
2027
|
-
if (
|
|
2091
|
+
function kt(t, r) {
|
|
2092
|
+
if (t == null || t.length === 0)
|
|
2028
2093
|
return "No results found";
|
|
2029
2094
|
let s = "";
|
|
2030
2095
|
function o(e, n) {
|
|
@@ -2038,24 +2103,24 @@ function Tt(r, t) {
|
|
|
2038
2103
|
`);
|
|
2039
2104
|
}
|
|
2040
2105
|
}
|
|
2041
|
-
return o(
|
|
2106
|
+
return o(t, ""), s;
|
|
2042
2107
|
}
|
|
2043
|
-
class
|
|
2108
|
+
class ys {
|
|
2044
2109
|
tokens = 16;
|
|
2045
2110
|
// +1 indent, +1 for line break
|
|
2046
|
-
getReportText = (
|
|
2111
|
+
getReportText = (r) => ({
|
|
2047
2112
|
indent: !0,
|
|
2048
|
-
textOpen: `[${
|
|
2113
|
+
textOpen: `[${r.indexRange[0]}-${r.indexRange[1]}] see more ${r.countMatched} matched ${r.tokensGrouped} tokens`,
|
|
2049
2114
|
textClose: null
|
|
2050
2115
|
});
|
|
2051
|
-
add = (
|
|
2116
|
+
add = (r, s, o) => r == null ? {
|
|
2052
2117
|
indexRange: [o, o],
|
|
2053
2118
|
countGrouped: 1,
|
|
2054
2119
|
countMatched: s.countMatched,
|
|
2055
2120
|
tokensGrouped: s.tokens
|
|
2056
|
-
} : (
|
|
2121
|
+
} : (r.indexRange[1] = o, r.countGrouped += 1, r.countMatched += s.countMatched, r.tokensGrouped += s.tokens, r);
|
|
2057
2122
|
}
|
|
2058
|
-
const
|
|
2123
|
+
const Ot = h.object({
|
|
2059
2124
|
snapshotName: h.string().optional().describe("Name of previously created filesystem snapshot, to use"),
|
|
2060
2125
|
snapshot: ee.optional().describe(
|
|
2061
2126
|
"Filesystem snapshot creation options JSON to automatically create snapshot"
|
|
@@ -2077,13 +2142,13 @@ const Ct = h.object({
|
|
|
2077
2142
|
// maxCountGroup: z.number().default(10).describe('Maximum items per group'),
|
|
2078
2143
|
// maxTokensGroup: z.number().default(1000).describe('Maximum tokens per group'),
|
|
2079
2144
|
});
|
|
2080
|
-
async function
|
|
2145
|
+
async function bs(t, r, s) {
|
|
2081
2146
|
let o;
|
|
2082
2147
|
try {
|
|
2083
|
-
o =
|
|
2084
|
-
} catch (
|
|
2148
|
+
o = Ot.parse(t);
|
|
2149
|
+
} catch (g) {
|
|
2085
2150
|
return {
|
|
2086
|
-
error: F(
|
|
2151
|
+
error: F(g)
|
|
2087
2152
|
};
|
|
2088
2153
|
}
|
|
2089
2154
|
const {
|
|
@@ -2104,32 +2169,32 @@ async function fs(r, t, s) {
|
|
|
2104
2169
|
return {
|
|
2105
2170
|
error: "Either snapshotName or snapshot must be provided, not both"
|
|
2106
2171
|
};
|
|
2107
|
-
let d, p = !1,
|
|
2172
|
+
let d, p = !1, m = !1;
|
|
2108
2173
|
if (e) {
|
|
2109
2174
|
if (d = f.fsSnapshots.get(e), d == null)
|
|
2110
2175
|
return {
|
|
2111
2176
|
error: `Filesystem snapshot "${e}" not found`
|
|
2112
2177
|
};
|
|
2113
2178
|
} else if (n) {
|
|
2114
|
-
const
|
|
2179
|
+
const g = await ce(
|
|
2115
2180
|
n,
|
|
2116
|
-
|
|
2181
|
+
r,
|
|
2117
2182
|
s
|
|
2118
2183
|
);
|
|
2119
|
-
if (
|
|
2184
|
+
if (g.error != null)
|
|
2120
2185
|
return {
|
|
2121
|
-
error:
|
|
2186
|
+
error: g.error
|
|
2122
2187
|
};
|
|
2123
|
-
d =
|
|
2188
|
+
d = g.fsSnapshot, p = g.queryCreated, m = !0;
|
|
2124
2189
|
} else
|
|
2125
2190
|
return {
|
|
2126
2191
|
error: "Either snapshotName or snapshot must be provided"
|
|
2127
2192
|
};
|
|
2128
2193
|
try {
|
|
2129
|
-
const
|
|
2194
|
+
const g = me(o.parentPath), y = Nt({
|
|
2130
2195
|
tree: d.tree,
|
|
2131
2196
|
request: {
|
|
2132
|
-
parentNodeId:
|
|
2197
|
+
parentNodeId: g,
|
|
2133
2198
|
childsIndexRange: i,
|
|
2134
2199
|
limits: {
|
|
2135
2200
|
maxCountTotal: a,
|
|
@@ -2138,32 +2203,32 @@ async function fs(r, t, s) {
|
|
|
2138
2203
|
maxTokensGroup: u
|
|
2139
2204
|
}
|
|
2140
2205
|
},
|
|
2141
|
-
indexRangeGroupStrategy: new
|
|
2142
|
-
}), w =
|
|
2206
|
+
indexRangeGroupStrategy: new ys()
|
|
2207
|
+
}), w = kt(y);
|
|
2143
2208
|
return {
|
|
2144
2209
|
fsSnapshot: d,
|
|
2145
2210
|
queryCreated: p,
|
|
2146
|
-
snapshotCreated:
|
|
2147
|
-
parentPath:
|
|
2211
|
+
snapshotCreated: m,
|
|
2212
|
+
parentPath: g,
|
|
2148
2213
|
childsIndexRange: i,
|
|
2149
2214
|
report: w
|
|
2150
2215
|
};
|
|
2151
|
-
} catch (
|
|
2216
|
+
} catch (g) {
|
|
2152
2217
|
return {
|
|
2153
|
-
error: `Failed to browse filesystem snapshot: ${
|
|
2218
|
+
error: `Failed to browse filesystem snapshot: ${g instanceof Error ? g.message : "Unknown error"}`
|
|
2154
2219
|
};
|
|
2155
2220
|
}
|
|
2156
2221
|
}
|
|
2157
|
-
function
|
|
2158
|
-
|
|
2222
|
+
function Ss(t, r) {
|
|
2223
|
+
t(
|
|
2159
2224
|
"fs-snapshot-browse",
|
|
2160
2225
|
{
|
|
2161
2226
|
title: "Browse Filesystem Snapshot",
|
|
2162
2227
|
description: "Browse and explore filesystem. Use this to efficiently browse, analyze, explore, inspect, etc directory and file structures",
|
|
2163
|
-
inputSchema:
|
|
2228
|
+
inputSchema: Ot.shape
|
|
2164
2229
|
},
|
|
2165
2230
|
async (s, o) => {
|
|
2166
|
-
const e = await
|
|
2231
|
+
const e = await bs(s, r, o);
|
|
2167
2232
|
if (e.error != null)
|
|
2168
2233
|
return `Method: fs-snapshot-browse(${JSON.stringify(s)})
|
|
2169
2234
|
❌ Error: ${e.error}`;
|
|
@@ -2185,148 +2250,148 @@ ${e.report}`, n;
|
|
|
2185
2250
|
}
|
|
2186
2251
|
);
|
|
2187
2252
|
}
|
|
2188
|
-
function
|
|
2189
|
-
const
|
|
2253
|
+
function Rt(t) {
|
|
2254
|
+
const r = [], s = t.tree, o = t.query.rootDir ?? ".";
|
|
2190
2255
|
function e(n) {
|
|
2191
|
-
n.type === "file" && n.isMatched &&
|
|
2256
|
+
n.type === "file" && n.isMatched && r.push(o + "/" + n.path);
|
|
2192
2257
|
const i = s.getChilds(n);
|
|
2193
2258
|
if (i != null)
|
|
2194
2259
|
for (let a = 0; a < i.length; a++)
|
|
2195
2260
|
e(i[a]);
|
|
2196
2261
|
}
|
|
2197
|
-
return e(s.root),
|
|
2262
|
+
return e(s.root), r;
|
|
2198
2263
|
}
|
|
2199
|
-
const
|
|
2200
|
-
function
|
|
2201
|
-
const
|
|
2202
|
-
let s =
|
|
2203
|
-
return s == null && (s = new
|
|
2264
|
+
const Ve = /* @__PURE__ */ new Map();
|
|
2265
|
+
function xs(t) {
|
|
2266
|
+
const r = H(t);
|
|
2267
|
+
let s = Ve.get(r);
|
|
2268
|
+
return s == null && (s = new or(), Ve.set(r, s)), s;
|
|
2204
2269
|
}
|
|
2205
|
-
async function
|
|
2206
|
-
const { filePath:
|
|
2207
|
-
return
|
|
2270
|
+
async function $s(t) {
|
|
2271
|
+
const { filePath: r, func: s } = t;
|
|
2272
|
+
return xs(r).lock(
|
|
2208
2273
|
() => V({
|
|
2209
|
-
pool:
|
|
2274
|
+
pool: Se,
|
|
2210
2275
|
count: 1,
|
|
2211
2276
|
func: s
|
|
2212
2277
|
})
|
|
2213
2278
|
);
|
|
2214
2279
|
}
|
|
2215
|
-
const
|
|
2216
|
-
function
|
|
2217
|
-
const { content:
|
|
2280
|
+
const Ze = 10, re = 48, Xe = 57, de = 36, Is = 38, Ms = 39, Ts = 60, Cs = 62, vs = 96, se = 0, et = 1, tt = 2, rt = 3, st = 4, Es = 5;
|
|
2281
|
+
function Ns(t) {
|
|
2282
|
+
const { content: r, pattern: s, replacement: o } = t, e = r.length, n = [0];
|
|
2218
2283
|
for (let b = 0; b < e; b++)
|
|
2219
|
-
|
|
2284
|
+
r.charCodeAt(b) === Ze && b + 1 < e && n.push(b + 1);
|
|
2220
2285
|
const i = n.length, a = [], c = [];
|
|
2221
2286
|
let l = null, u = null, f = null, d = 0;
|
|
2222
2287
|
if (o != null) {
|
|
2223
2288
|
const b = o.length;
|
|
2224
2289
|
let $ = !1;
|
|
2225
|
-
for (let
|
|
2226
|
-
if (o.charCodeAt(
|
|
2290
|
+
for (let T = 0; T < b; T++)
|
|
2291
|
+
if (o.charCodeAt(T) === de) {
|
|
2227
2292
|
$ = !0;
|
|
2228
2293
|
break;
|
|
2229
2294
|
}
|
|
2230
2295
|
if ($) {
|
|
2231
2296
|
u = [], f = [];
|
|
2232
|
-
let
|
|
2297
|
+
let T = 0, x = 0;
|
|
2233
2298
|
for (; x < b; ) {
|
|
2234
2299
|
if (o.charCodeAt(x) !== de || x + 1 >= b) {
|
|
2235
2300
|
x++;
|
|
2236
2301
|
continue;
|
|
2237
2302
|
}
|
|
2238
|
-
const
|
|
2303
|
+
const S = o.charCodeAt(x + 1);
|
|
2239
2304
|
let v = -1, B = 0, O = 2;
|
|
2240
|
-
if (
|
|
2305
|
+
if (S === de)
|
|
2241
2306
|
v = se, B = "$";
|
|
2242
|
-
else if (
|
|
2243
|
-
v =
|
|
2244
|
-
else if (
|
|
2245
|
-
v =
|
|
2246
|
-
else if (
|
|
2247
|
-
v =
|
|
2248
|
-
else if (
|
|
2307
|
+
else if (S === Is)
|
|
2308
|
+
v = et;
|
|
2309
|
+
else if (S === vs)
|
|
2310
|
+
v = tt;
|
|
2311
|
+
else if (S === Ms)
|
|
2312
|
+
v = rt;
|
|
2313
|
+
else if (S >= re && S <= Xe) {
|
|
2249
2314
|
let I = x + 2;
|
|
2250
2315
|
for (; I < b; ) {
|
|
2251
2316
|
const C = o.charCodeAt(I);
|
|
2252
|
-
if (C < re || C >
|
|
2317
|
+
if (C < re || C > Xe) break;
|
|
2253
2318
|
I++;
|
|
2254
2319
|
}
|
|
2255
|
-
v =
|
|
2256
|
-
} else if (
|
|
2320
|
+
v = st, B = o.substring(x + 1, I), O = I - x;
|
|
2321
|
+
} else if (S === Ts) {
|
|
2257
2322
|
let I = x + 2;
|
|
2258
|
-
for (; I < b && o.charCodeAt(I) !==
|
|
2323
|
+
for (; I < b && o.charCodeAt(I) !== Cs; )
|
|
2259
2324
|
I++;
|
|
2260
|
-
I < b && I > x + 2 && (v =
|
|
2325
|
+
I < b && I > x + 2 && (v = Es, B = o.substring(x + 2, I), O = I + 1 - x);
|
|
2261
2326
|
}
|
|
2262
|
-
v >= 0 ? (x >
|
|
2327
|
+
v >= 0 ? (x > T && (u.push(se), f.push(o.substring(T, x))), u.push(v), f.push(B), x += O, T = x) : x++;
|
|
2263
2328
|
}
|
|
2264
|
-
|
|
2329
|
+
T < b && (u.push(se), f.push(o.substring(T))), d = u.length;
|
|
2265
2330
|
} else
|
|
2266
2331
|
l = o;
|
|
2267
2332
|
}
|
|
2268
|
-
let p = "",
|
|
2333
|
+
let p = "", m = 0, g = 0;
|
|
2269
2334
|
s.lastIndex = 0;
|
|
2270
2335
|
let y;
|
|
2271
|
-
for (; (y = s.exec(
|
|
2272
|
-
const b = y.index, $ = y[0],
|
|
2273
|
-
let
|
|
2336
|
+
for (; (y = s.exec(r)) !== null; ) {
|
|
2337
|
+
const b = y.index, $ = y[0], T = $.length, x = b + T;
|
|
2338
|
+
let S, v, B, O;
|
|
2274
2339
|
if (i === 1)
|
|
2275
|
-
|
|
2340
|
+
S = 0, v = 1, B = 0, O = e;
|
|
2276
2341
|
else {
|
|
2277
2342
|
let I = 0, C = i - 1;
|
|
2278
2343
|
for (; I < C; ) {
|
|
2279
2344
|
const N = I + C + 1 >> 1;
|
|
2280
2345
|
n[N] <= b ? I = N : C = N - 1;
|
|
2281
2346
|
}
|
|
2282
|
-
if (
|
|
2347
|
+
if (S = I, T > 0) {
|
|
2283
2348
|
const N = x - 1;
|
|
2284
2349
|
for (C = i - 1; I < C; ) {
|
|
2285
|
-
const
|
|
2286
|
-
n[
|
|
2350
|
+
const R = I + C + 1 >> 1;
|
|
2351
|
+
n[R] <= N ? I = R : C = R - 1;
|
|
2287
2352
|
}
|
|
2288
2353
|
v = I + 1;
|
|
2289
2354
|
} else
|
|
2290
|
-
v =
|
|
2291
|
-
B = n[
|
|
2355
|
+
v = S + 1;
|
|
2356
|
+
B = n[S], O = v < i ? n[v] : e;
|
|
2292
2357
|
}
|
|
2293
2358
|
if (a.push({
|
|
2294
2359
|
offset: [b, x],
|
|
2295
|
-
lines: [
|
|
2360
|
+
lines: [S, v],
|
|
2296
2361
|
linesOffset: [B, O]
|
|
2297
2362
|
}), o != null) {
|
|
2298
|
-
p +=
|
|
2363
|
+
p += r.substring(m, b);
|
|
2299
2364
|
let I;
|
|
2300
2365
|
if (l != null)
|
|
2301
2366
|
I = l;
|
|
2302
2367
|
else {
|
|
2303
2368
|
I = "";
|
|
2304
|
-
const N = y.groups,
|
|
2305
|
-
for (let
|
|
2306
|
-
const q = u[
|
|
2369
|
+
const N = y.groups, R = y.length - 1;
|
|
2370
|
+
for (let K = 0; K < d; K++) {
|
|
2371
|
+
const q = u[K], P = f[K];
|
|
2307
2372
|
switch (q) {
|
|
2308
2373
|
case se:
|
|
2309
2374
|
I += P;
|
|
2310
2375
|
break;
|
|
2311
|
-
case
|
|
2376
|
+
case et:
|
|
2312
2377
|
I += $;
|
|
2313
2378
|
break;
|
|
2314
|
-
case
|
|
2315
|
-
I +=
|
|
2379
|
+
case tt:
|
|
2380
|
+
I += r.substring(0, b);
|
|
2316
2381
|
break;
|
|
2317
|
-
case
|
|
2318
|
-
I +=
|
|
2382
|
+
case rt:
|
|
2383
|
+
I += r.substring(x);
|
|
2319
2384
|
break;
|
|
2320
|
-
case
|
|
2385
|
+
case st: {
|
|
2321
2386
|
const L = P, z = L.length, A = L.charCodeAt(0) - re;
|
|
2322
2387
|
if (z >= 2) {
|
|
2323
|
-
const
|
|
2324
|
-
if (
|
|
2325
|
-
I += y[
|
|
2388
|
+
const _ = L.charCodeAt(1) - re, D = A * 10 + _;
|
|
2389
|
+
if (D >= 1 && D <= R) {
|
|
2390
|
+
I += y[D] ?? "", z > 2 && (I += L.substring(2));
|
|
2326
2391
|
break;
|
|
2327
2392
|
}
|
|
2328
2393
|
}
|
|
2329
|
-
A >= 1 && A <=
|
|
2394
|
+
A >= 1 && A <= R ? (I += y[A] ?? "", z > 1 && (I += L.substring(1))) : I += "$" + L;
|
|
2330
2395
|
break;
|
|
2331
2396
|
}
|
|
2332
2397
|
default:
|
|
@@ -2335,65 +2400,65 @@ function $s(r) {
|
|
|
2335
2400
|
}
|
|
2336
2401
|
}
|
|
2337
2402
|
p += I;
|
|
2338
|
-
const C = b +
|
|
2403
|
+
const C = b + g;
|
|
2339
2404
|
c.push({
|
|
2340
2405
|
offset: [C, C + I.length],
|
|
2341
2406
|
lines: [0, 0],
|
|
2342
2407
|
linesOffset: [0, 0]
|
|
2343
|
-
}),
|
|
2408
|
+
}), g += I.length - T, m = x;
|
|
2344
2409
|
}
|
|
2345
|
-
if (
|
|
2410
|
+
if (T === 0 && s.lastIndex++, !s.global)
|
|
2346
2411
|
break;
|
|
2347
2412
|
}
|
|
2348
2413
|
if (s.lastIndex = 0, o == null)
|
|
2349
|
-
return { search: { content:
|
|
2350
|
-
p +=
|
|
2414
|
+
return { search: { content: r, matches: a }, replace: null };
|
|
2415
|
+
p += r.substring(m);
|
|
2351
2416
|
const w = p.length, M = [0];
|
|
2352
2417
|
for (let b = 0; b < w; b++)
|
|
2353
|
-
p.charCodeAt(b) ===
|
|
2418
|
+
p.charCodeAt(b) === Ze && b + 1 < w && M.push(b + 1);
|
|
2354
2419
|
const E = M.length;
|
|
2355
2420
|
for (let b = 0, $ = c.length; b < $; b++) {
|
|
2356
|
-
const
|
|
2421
|
+
const T = c[b], x = T.offset[0], S = T.offset[1];
|
|
2357
2422
|
let v, B, O, I;
|
|
2358
2423
|
if (E === 1)
|
|
2359
2424
|
v = 0, B = 1, O = 0, I = w;
|
|
2360
2425
|
else {
|
|
2361
2426
|
let C = 0, N = E - 1;
|
|
2362
2427
|
for (; C < N; ) {
|
|
2363
|
-
const
|
|
2364
|
-
M[
|
|
2428
|
+
const R = C + N + 1 >> 1;
|
|
2429
|
+
M[R] <= x ? C = R : N = R - 1;
|
|
2365
2430
|
}
|
|
2366
|
-
if (v = C,
|
|
2367
|
-
const
|
|
2431
|
+
if (v = C, S > x) {
|
|
2432
|
+
const R = S - 1;
|
|
2368
2433
|
for (N = E - 1; C < N; ) {
|
|
2369
|
-
const
|
|
2370
|
-
M[
|
|
2434
|
+
const K = C + N + 1 >> 1;
|
|
2435
|
+
M[K] <= R ? C = K : N = K - 1;
|
|
2371
2436
|
}
|
|
2372
2437
|
B = C + 1;
|
|
2373
2438
|
} else
|
|
2374
2439
|
B = v + 1;
|
|
2375
2440
|
O = M[v], I = B < E ? M[B] : w;
|
|
2376
2441
|
}
|
|
2377
|
-
|
|
2442
|
+
T.lines[0] = v, T.lines[1] = B, T.linesOffset[0] = O, T.linesOffset[1] = I;
|
|
2378
2443
|
}
|
|
2379
2444
|
return {
|
|
2380
|
-
search: { content:
|
|
2445
|
+
search: { content: r, matches: a },
|
|
2381
2446
|
replace: { content: p, matches: c }
|
|
2382
2447
|
};
|
|
2383
2448
|
}
|
|
2384
|
-
function
|
|
2385
|
-
if (
|
|
2449
|
+
function Dt(t) {
|
|
2450
|
+
if (t.length === 0)
|
|
2386
2451
|
return [];
|
|
2387
|
-
const
|
|
2452
|
+
const r = [...t].sort((i, a) => {
|
|
2388
2453
|
const c = i.lines[0], l = a.lines[0];
|
|
2389
2454
|
if (c > l) return 1;
|
|
2390
2455
|
if (c < l) return -1;
|
|
2391
2456
|
const u = i.lines[1], f = a.lines[1];
|
|
2392
2457
|
return u > f ? 1 : u < f ? -1 : 0;
|
|
2393
2458
|
}), s = [];
|
|
2394
|
-
let o = [...
|
|
2395
|
-
for (let i = 1; i <
|
|
2396
|
-
const a =
|
|
2459
|
+
let o = [...r[0].offset], e = [...r[0].lines], n = [...r[0].linesOffset];
|
|
2460
|
+
for (let i = 1; i < r.length; i++) {
|
|
2461
|
+
const a = r[i];
|
|
2397
2462
|
a.lines[0] <= e[1] ? (a.offset[0] < o[0] && (o[0] = a.offset[0]), a.offset[1] > o[1] && (o[1] = a.offset[1]), a.lines[1] > e[1] && (e[1] = a.lines[1], n[1] = a.linesOffset[1])) : (s.push({
|
|
2398
2463
|
offset: o,
|
|
2399
2464
|
lines: e,
|
|
@@ -2406,91 +2471,91 @@ function Et(r) {
|
|
|
2406
2471
|
linesOffset: n
|
|
2407
2472
|
}), s;
|
|
2408
2473
|
}
|
|
2409
|
-
function oe(
|
|
2474
|
+
function oe(t, r, s, o) {
|
|
2410
2475
|
let e = 0, n = 0;
|
|
2411
2476
|
for (let u = 0; u < s; u++)
|
|
2412
|
-
|
|
2477
|
+
t.charCodeAt(u) === 10 && (n = u + 1, e++);
|
|
2413
2478
|
const i = e, a = n;
|
|
2414
2479
|
let c = s;
|
|
2415
2480
|
for (; c < o; c++)
|
|
2416
|
-
|
|
2481
|
+
t.charCodeAt(c) === 10 && e++;
|
|
2417
2482
|
const l = e + 1;
|
|
2418
|
-
for (; c <
|
|
2419
|
-
if (
|
|
2483
|
+
for (; c < r; c++)
|
|
2484
|
+
if (t.charCodeAt(c) === 10)
|
|
2420
2485
|
return { startLine: i, endLine: l, startLineOfs: a, endLineOfs: c + 1 };
|
|
2421
|
-
return { startLine: i, endLine: l, startLineOfs: a, endLineOfs:
|
|
2486
|
+
return { startLine: i, endLine: l, startLineOfs: a, endLineOfs: r };
|
|
2422
2487
|
}
|
|
2423
|
-
function
|
|
2424
|
-
if (
|
|
2425
|
-
const U = [...
|
|
2488
|
+
function ks(t, r) {
|
|
2489
|
+
if (t.replace == null && r.replace == null) {
|
|
2490
|
+
const U = [...t.search.matches, ...r.search.matches];
|
|
2426
2491
|
return {
|
|
2427
|
-
search: { content:
|
|
2492
|
+
search: { content: t.search.content, matches: Dt(U) },
|
|
2428
2493
|
replace: null
|
|
2429
2494
|
};
|
|
2430
2495
|
}
|
|
2431
|
-
const s =
|
|
2432
|
-
let y = 0, w = 0, M = 0, E = 0, b = 0, $ = 0,
|
|
2496
|
+
const s = t.replace ?? t.search, o = r.replace ?? r.search, e = t.search.content, n = o.content, i = e.length, a = n.length, c = t.search.matches, l = s.matches, u = r.search.matches, f = o.matches, d = l.length, p = u.length, m = [], g = [];
|
|
2497
|
+
let y = 0, w = 0, M = 0, E = 0, b = 0, $ = 0, T = 0, x = 0, S = 0, v = 0, B = 0, O = 0, I = 0, C = 0, N = 0, R = 0, K = 0, q = 0, P = 0, L = 0, z = 0, A = 0, _ = 0, D = 0;
|
|
2433
2498
|
for (; y < d || w < p; )
|
|
2434
|
-
if (y < d && (b = l[y].offset[0], $ = l[y].offset[1]), w < p && (
|
|
2435
|
-
|
|
2499
|
+
if (y < d && (b = l[y].offset[0], $ = l[y].offset[1]), w < p && (T = u[w].offset[0], x = u[w].offset[1]), y < d && w < p && b < x && T < $) {
|
|
2500
|
+
K = b < T ? b : T, S = $ > x ? $ : x, B = y, O = w, y++, w++;
|
|
2436
2501
|
do {
|
|
2437
|
-
for (v =
|
|
2438
|
-
$ = l[y].offset[1], $ >
|
|
2439
|
-
for (; w < p && u[w].offset[0] <
|
|
2440
|
-
x = u[w].offset[1], x >
|
|
2441
|
-
} while (
|
|
2442
|
-
I = 1 / 0, C = -1 / 0, q =
|
|
2443
|
-
for (let
|
|
2444
|
-
L = c[
|
|
2445
|
-
q <
|
|
2446
|
-
for (let
|
|
2447
|
-
L = u[
|
|
2448
|
-
q <
|
|
2502
|
+
for (v = S; y < d && l[y].offset[0] < S; )
|
|
2503
|
+
$ = l[y].offset[1], $ > S && (S = $), y++;
|
|
2504
|
+
for (; w < p && u[w].offset[0] < S; )
|
|
2505
|
+
x = u[w].offset[1], x > S && (S = x), w++;
|
|
2506
|
+
} while (S !== v);
|
|
2507
|
+
I = 1 / 0, C = -1 / 0, q = K, P = M;
|
|
2508
|
+
for (let G = B; G < y; G++)
|
|
2509
|
+
L = c[G].offset[0], z = c[G].offset[1], A = l[G].offset[0], _ = l[G].offset[1], q < A && (D = q + P, D < I && (I = D), D = A + P, D > C && (C = D)), L < I && (I = L), z > C && (C = z), P += z - L - _ + A, q = _;
|
|
2510
|
+
q < S && (D = q + P, D < I && (I = D), D = S + P, D > C && (C = D)), M = P, N = 1 / 0, R = -1 / 0, q = K, P = E;
|
|
2511
|
+
for (let G = O; G < w; G++)
|
|
2512
|
+
L = u[G].offset[0], z = u[G].offset[1], A = f[G].offset[0], _ = f[G].offset[1], q < L && (D = q + P, D < N && (N = D), D = L + P, D > R && (R = D)), A < N && (N = A), _ > R && (R = _), P += _ - A - z + L, q = z;
|
|
2513
|
+
q < S && (D = q + P, D < N && (N = D), D = S + P, D > R && (R = D)), E = P;
|
|
2449
2514
|
const U = oe(e, i, I, C);
|
|
2450
|
-
|
|
2515
|
+
m.push({
|
|
2451
2516
|
offset: [I, C],
|
|
2452
2517
|
lines: [U.startLine, U.endLine],
|
|
2453
2518
|
linesOffset: [U.startLineOfs, U.endLineOfs]
|
|
2454
2519
|
});
|
|
2455
|
-
const te = oe(n, a, N,
|
|
2456
|
-
|
|
2457
|
-
offset: [N,
|
|
2520
|
+
const te = oe(n, a, N, R);
|
|
2521
|
+
g.push({
|
|
2522
|
+
offset: [N, R],
|
|
2458
2523
|
lines: [te.startLine, te.endLine],
|
|
2459
2524
|
linesOffset: [te.startLineOfs, te.endLineOfs]
|
|
2460
2525
|
});
|
|
2461
|
-
} else if (w >= p || y < d && b <=
|
|
2462
|
-
L = c[y].offset[0], z = c[y].offset[1], A = l[y].offset[0],
|
|
2463
|
-
const U = oe(n, a, N,
|
|
2464
|
-
|
|
2465
|
-
offset: [N,
|
|
2526
|
+
} else if (w >= p || y < d && b <= T) {
|
|
2527
|
+
L = c[y].offset[0], z = c[y].offset[1], A = l[y].offset[0], _ = l[y].offset[1], N = A + E, R = _ + E;
|
|
2528
|
+
const U = oe(n, a, N, R);
|
|
2529
|
+
m.push(c[y]), g.push({
|
|
2530
|
+
offset: [N, R],
|
|
2466
2531
|
lines: [U.startLine, U.endLine],
|
|
2467
2532
|
linesOffset: [U.startLineOfs, U.endLineOfs]
|
|
2468
|
-
}), M += z - L -
|
|
2533
|
+
}), M += z - L - _ + A, y++;
|
|
2469
2534
|
} else {
|
|
2470
|
-
L = u[w].offset[0], z = u[w].offset[1], A = f[w].offset[0],
|
|
2535
|
+
L = u[w].offset[0], z = u[w].offset[1], A = f[w].offset[0], _ = f[w].offset[1], I = L + M, C = z + M;
|
|
2471
2536
|
const U = oe(e, i, I, C);
|
|
2472
|
-
|
|
2537
|
+
m.push({
|
|
2473
2538
|
offset: [I, C],
|
|
2474
2539
|
lines: [U.startLine, U.endLine],
|
|
2475
2540
|
linesOffset: [U.startLineOfs, U.endLineOfs]
|
|
2476
|
-
}),
|
|
2541
|
+
}), g.push(f[w]), E += _ - A - z + L, w++;
|
|
2477
2542
|
}
|
|
2478
2543
|
return {
|
|
2479
|
-
search: { content: e, matches:
|
|
2480
|
-
replace: { content: n, matches:
|
|
2544
|
+
search: { content: e, matches: m },
|
|
2545
|
+
replace: { content: n, matches: g }
|
|
2481
2546
|
};
|
|
2482
2547
|
}
|
|
2483
|
-
async function
|
|
2484
|
-
const { filePath:
|
|
2485
|
-
return s.length === 0 ? { filePath:
|
|
2486
|
-
filePath:
|
|
2548
|
+
async function Os(t) {
|
|
2549
|
+
const { filePath: r, operations: s, dryRun: o } = t;
|
|
2550
|
+
return s.length === 0 ? { filePath: r, result: null } : $s({
|
|
2551
|
+
filePath: r,
|
|
2487
2552
|
func: async () => {
|
|
2488
2553
|
let e;
|
|
2489
2554
|
try {
|
|
2490
|
-
e = await j.promises.readFile(
|
|
2555
|
+
e = await j.promises.readFile(r, "utf-8");
|
|
2491
2556
|
} catch (a) {
|
|
2492
2557
|
return {
|
|
2493
|
-
filePath:
|
|
2558
|
+
filePath: r,
|
|
2494
2559
|
result: null,
|
|
2495
2560
|
error: `Failed to read file: ${a instanceof Error ? a.message : a + ""}`
|
|
2496
2561
|
};
|
|
@@ -2503,39 +2568,39 @@ async function Ms(r) {
|
|
|
2503
2568
|
l = new RegExp(c.pattern, c.flags ?? "");
|
|
2504
2569
|
} catch (d) {
|
|
2505
2570
|
return {
|
|
2506
|
-
filePath:
|
|
2571
|
+
filePath: r,
|
|
2507
2572
|
result: null,
|
|
2508
2573
|
error: `Invalid RegExp pattern "${c.pattern}": ${d instanceof Error ? d.message : d + ""}`
|
|
2509
2574
|
};
|
|
2510
2575
|
}
|
|
2511
|
-
const u = n?.replace?.content ?? e, f =
|
|
2576
|
+
const u = n?.replace?.content ?? e, f = Ns({
|
|
2512
2577
|
content: u,
|
|
2513
2578
|
pattern: l,
|
|
2514
2579
|
replacement: c.replacement
|
|
2515
2580
|
});
|
|
2516
|
-
c.replacement != null && (i = !0), n == null ? n = f : n =
|
|
2581
|
+
c.replacement != null && (i = !0), n == null ? n = f : n = ks(n, f);
|
|
2517
2582
|
}
|
|
2518
2583
|
if (i && n?.replace != null && !o) {
|
|
2519
2584
|
const a = n.replace.content;
|
|
2520
2585
|
if (a !== e)
|
|
2521
2586
|
try {
|
|
2522
|
-
await j.promises.writeFile(
|
|
2587
|
+
await j.promises.writeFile(r, a, "utf-8");
|
|
2523
2588
|
} catch (c) {
|
|
2524
2589
|
return {
|
|
2525
|
-
filePath:
|
|
2590
|
+
filePath: r,
|
|
2526
2591
|
result: n,
|
|
2527
2592
|
error: `Failed to write file: ${c instanceof Error ? c.message : c + ""}`
|
|
2528
2593
|
};
|
|
2529
2594
|
}
|
|
2530
2595
|
}
|
|
2531
|
-
return { filePath:
|
|
2596
|
+
return { filePath: r, result: n };
|
|
2532
2597
|
}
|
|
2533
2598
|
});
|
|
2534
2599
|
}
|
|
2535
|
-
async function
|
|
2536
|
-
const { filePaths:
|
|
2600
|
+
async function $e(t) {
|
|
2601
|
+
const { filePaths: r, operations: s, dryRun: o, dateModifiedMax: e } = t;
|
|
2537
2602
|
return { results: await Promise.all(
|
|
2538
|
-
|
|
2603
|
+
r.map(async (i) => {
|
|
2539
2604
|
if (e != null) {
|
|
2540
2605
|
const a = await j.promises.stat(i).catch(() => null);
|
|
2541
2606
|
if (a == null)
|
|
@@ -2551,34 +2616,34 @@ async function xe(r) {
|
|
|
2551
2616
|
error: "Not replaced, try again"
|
|
2552
2617
|
};
|
|
2553
2618
|
}
|
|
2554
|
-
return
|
|
2619
|
+
return Os({ filePath: i, operations: s, dryRun: o });
|
|
2555
2620
|
})
|
|
2556
2621
|
) };
|
|
2557
2622
|
}
|
|
2558
|
-
const
|
|
2559
|
-
function
|
|
2560
|
-
const { content:
|
|
2623
|
+
const Rs = 6;
|
|
2624
|
+
function Ds(t) {
|
|
2625
|
+
const { content: r, startLine: s } = t, o = t.padWidth ?? Rs;
|
|
2561
2626
|
let e = "", n = 0, i = 0;
|
|
2562
|
-
for (; n <
|
|
2563
|
-
const a =
|
|
2564
|
-
`, n), c = a === -1 ?
|
|
2565
|
-
e += String(s + i + 1).padStart(o) + "→" +
|
|
2627
|
+
for (; n < r.length; ) {
|
|
2628
|
+
const a = r.indexOf(`
|
|
2629
|
+
`, n), c = a === -1 ? r.length : a + 1;
|
|
2630
|
+
e += String(s + i + 1).padStart(o) + "→" + r.substring(n, c), n = c, i++;
|
|
2566
2631
|
}
|
|
2567
2632
|
return e.length > 0 && !e.endsWith(`
|
|
2568
2633
|
`) && (e += `
|
|
2569
2634
|
`), e;
|
|
2570
2635
|
}
|
|
2571
|
-
function fe(
|
|
2572
|
-
const { content:
|
|
2636
|
+
function fe(t) {
|
|
2637
|
+
const { content: r, matches: s, outputLimit: o } = t;
|
|
2573
2638
|
if (s.length === 0)
|
|
2574
2639
|
return { output: "", truncated: !1 };
|
|
2575
|
-
const e =
|
|
2640
|
+
const e = Dt(s);
|
|
2576
2641
|
let n = "", i = !1;
|
|
2577
2642
|
for (let a = 0; a < e.length; a++) {
|
|
2578
|
-
const c = e[a], l =
|
|
2643
|
+
const c = e[a], l = r.substring(
|
|
2579
2644
|
c.linesOffset[0],
|
|
2580
2645
|
c.linesOffset[1]
|
|
2581
|
-
), u =
|
|
2646
|
+
), u = Ds({
|
|
2582
2647
|
content: l,
|
|
2583
2648
|
startLine: c.lines[0]
|
|
2584
2649
|
}), f = a > 0 ? 2 : 0;
|
|
@@ -2591,40 +2656,40 @@ function fe(r) {
|
|
|
2591
2656
|
}
|
|
2592
2657
|
return { output: n, truncated: i };
|
|
2593
2658
|
}
|
|
2594
|
-
const
|
|
2595
|
-
function
|
|
2596
|
-
const { result:
|
|
2597
|
-
if (
|
|
2598
|
-
const
|
|
2599
|
-
content:
|
|
2600
|
-
matches:
|
|
2659
|
+
const ot = "BEFORE", nt = "AFTER";
|
|
2660
|
+
function Fs(t) {
|
|
2661
|
+
const { result: r, outputLimit: s } = t;
|
|
2662
|
+
if (r.replace == null) {
|
|
2663
|
+
const m = fe({
|
|
2664
|
+
content: r.search.content,
|
|
2665
|
+
matches: r.search.matches,
|
|
2601
2666
|
outputLimit: s
|
|
2602
2667
|
});
|
|
2603
|
-
return { output:
|
|
2668
|
+
return { output: m.output, truncated: m.truncated };
|
|
2604
2669
|
}
|
|
2605
|
-
const o = `<${
|
|
2606
|
-
`, e = `</${
|
|
2607
|
-
`, n = `<${
|
|
2608
|
-
`, i = `</${
|
|
2670
|
+
const o = `<${ot}>
|
|
2671
|
+
`, e = `</${ot}>
|
|
2672
|
+
`, n = `<${nt}>
|
|
2673
|
+
`, i = `</${nt}>
|
|
2609
2674
|
`, a = o.length + e.length + n.length + i.length;
|
|
2610
2675
|
if (s != null && s < a)
|
|
2611
2676
|
return { output: "", truncated: !0 };
|
|
2612
2677
|
const c = s != null ? s - a : void 0, l = c != null ? Math.floor(c / 2) : void 0, u = fe({
|
|
2613
|
-
content:
|
|
2614
|
-
matches:
|
|
2678
|
+
content: r.search.content,
|
|
2679
|
+
matches: r.search.matches,
|
|
2615
2680
|
outputLimit: l
|
|
2616
2681
|
}), f = c != null ? c - u.output.length : void 0, d = fe({
|
|
2617
|
-
content:
|
|
2618
|
-
matches:
|
|
2682
|
+
content: r.replace.content,
|
|
2683
|
+
matches: r.replace.matches,
|
|
2619
2684
|
outputLimit: f
|
|
2620
2685
|
});
|
|
2621
2686
|
return { output: o + u.output + e + n + d.output + i, truncated: u.truncated || d.truncated };
|
|
2622
2687
|
}
|
|
2623
|
-
function
|
|
2624
|
-
const { result:
|
|
2688
|
+
function Ie(t) {
|
|
2689
|
+
const { result: r, rootDir: s, errorsOnly: o } = t;
|
|
2625
2690
|
let e = "";
|
|
2626
|
-
for (let n = 0; n <
|
|
2627
|
-
const i =
|
|
2691
|
+
for (let n = 0; n < r.results.length; n++) {
|
|
2692
|
+
const i = r.results[n], a = k.relative(s, i.filePath), c = e.length > 0 ? 1 : 0;
|
|
2628
2693
|
if (i.error != null) {
|
|
2629
2694
|
const u = a + `
|
|
2630
2695
|
❌ ` + i.error + `
|
|
@@ -2635,7 +2700,7 @@ function $e(r) {
|
|
|
2635
2700
|
}
|
|
2636
2701
|
if (o || i.result == null || i.result.search.matches.length === 0)
|
|
2637
2702
|
continue;
|
|
2638
|
-
const l =
|
|
2703
|
+
const l = Fs({
|
|
2639
2704
|
result: i.result
|
|
2640
2705
|
});
|
|
2641
2706
|
l.output.length > 0 && (c > 0 && (e += `
|
|
@@ -2644,25 +2709,25 @@ function $e(r) {
|
|
|
2644
2709
|
}
|
|
2645
2710
|
return e;
|
|
2646
2711
|
}
|
|
2647
|
-
const
|
|
2712
|
+
const Bs = h.object({
|
|
2648
2713
|
pattern: h.string().describe("JS RegExp pattern"),
|
|
2649
2714
|
flags: h.string().default("gm").describe('JS RegExp flags. Default: "gm"')
|
|
2650
|
-
}),
|
|
2715
|
+
}), Ft = h.object({
|
|
2651
2716
|
snapshotName: h.string().optional().describe("Name of previously created filesystem snapshot, to use"),
|
|
2652
2717
|
snapshot: ee.optional().describe(
|
|
2653
2718
|
"Filesystem snapshot creation options JSON to automatically create snapshot"
|
|
2654
2719
|
),
|
|
2655
|
-
bulkOperations: h.array(
|
|
2720
|
+
bulkOperations: h.array(Bs).describe(
|
|
2656
2721
|
"All search patterns to execute; include every pattern here; never split across multiple calls"
|
|
2657
2722
|
),
|
|
2658
2723
|
outputLimit: h.number().int().min(0).max(J).default(Q).describe(
|
|
2659
2724
|
`Maximum output characters. Output exceeding this limit will be truncated. Maximum: ${J}. Default: ${Q}`
|
|
2660
2725
|
)
|
|
2661
2726
|
});
|
|
2662
|
-
async function
|
|
2727
|
+
async function Ls(t, r, s) {
|
|
2663
2728
|
let o;
|
|
2664
2729
|
try {
|
|
2665
|
-
o =
|
|
2730
|
+
o = Ft.parse(t);
|
|
2666
2731
|
} catch (w) {
|
|
2667
2732
|
return {
|
|
2668
2733
|
error: F(w)
|
|
@@ -2687,7 +2752,7 @@ async function Ns(r, t, s) {
|
|
|
2687
2752
|
} else if (n) {
|
|
2688
2753
|
const w = await ce(
|
|
2689
2754
|
n,
|
|
2690
|
-
|
|
2755
|
+
r,
|
|
2691
2756
|
s
|
|
2692
2757
|
);
|
|
2693
2758
|
if (w.error != null)
|
|
@@ -2699,31 +2764,31 @@ async function Ns(r, t, s) {
|
|
|
2699
2764
|
return {
|
|
2700
2765
|
error: "Either snapshotName or snapshot must be provided"
|
|
2701
2766
|
};
|
|
2702
|
-
const d =
|
|
2767
|
+
const d = Rt(l), p = l.query.rootDir ?? ".", m = await $e({
|
|
2703
2768
|
filePaths: d,
|
|
2704
2769
|
operations: i
|
|
2705
|
-
}),
|
|
2706
|
-
result:
|
|
2770
|
+
}), g = Ie({
|
|
2771
|
+
result: m,
|
|
2707
2772
|
rootDir: p
|
|
2708
2773
|
});
|
|
2709
2774
|
return { output: we({
|
|
2710
2775
|
sessionId: s.sessionId,
|
|
2711
|
-
source:
|
|
2776
|
+
source: g,
|
|
2712
2777
|
limit: a
|
|
2713
2778
|
}).content, rootDir: p, fsSnapshot: l, queryCreated: u, snapshotCreated: f };
|
|
2714
2779
|
}
|
|
2715
|
-
function
|
|
2716
|
-
|
|
2780
|
+
function Ps(t, r) {
|
|
2781
|
+
t(
|
|
2717
2782
|
"fs-snapshot-search",
|
|
2718
2783
|
{
|
|
2719
2784
|
title: "Search File Contents in Snapshot",
|
|
2720
2785
|
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",
|
|
2721
|
-
inputSchema:
|
|
2786
|
+
inputSchema: Ft.shape
|
|
2722
2787
|
},
|
|
2723
2788
|
async (s, o) => {
|
|
2724
|
-
const e = await
|
|
2789
|
+
const e = await Ls(
|
|
2725
2790
|
s,
|
|
2726
|
-
|
|
2791
|
+
r,
|
|
2727
2792
|
o
|
|
2728
2793
|
);
|
|
2729
2794
|
if (e.error != null)
|
|
@@ -2742,26 +2807,26 @@ Reminder: use one snapshot covering all target files; include all patterns in th
|
|
|
2742
2807
|
}
|
|
2743
2808
|
);
|
|
2744
2809
|
}
|
|
2745
|
-
const
|
|
2810
|
+
const As = h.object({
|
|
2746
2811
|
pattern: h.string().describe("JS RegExp pattern"),
|
|
2747
2812
|
flags: h.string().default("gm").describe('JS RegExp flags. Default: "gm"'),
|
|
2748
2813
|
replacement: h.string().describe("JS replacement pattern")
|
|
2749
|
-
}),
|
|
2814
|
+
}), Bt = h.object({
|
|
2750
2815
|
snapshotName: h.string().optional().describe("Name of previously created filesystem snapshot, to use"),
|
|
2751
2816
|
snapshot: ee.optional().describe(
|
|
2752
2817
|
"Filesystem snapshot creation options JSON to automatically create snapshot"
|
|
2753
2818
|
),
|
|
2754
|
-
bulkOperations: h.array(
|
|
2819
|
+
bulkOperations: h.array(As).describe(
|
|
2755
2820
|
"All replace patterns to execute; include every pattern here; never split across multiple calls"
|
|
2756
2821
|
),
|
|
2757
2822
|
outputLimit: h.number().int().min(0).max(J).default(Q).describe(
|
|
2758
2823
|
`Maximum output characters. Output exceeding this limit will be truncated. Maximum: ${J}. Default: ${Q}`
|
|
2759
2824
|
)
|
|
2760
2825
|
});
|
|
2761
|
-
async function
|
|
2826
|
+
async function zs(t, r, s) {
|
|
2762
2827
|
let o;
|
|
2763
2828
|
try {
|
|
2764
|
-
o =
|
|
2829
|
+
o = Bt.parse(t);
|
|
2765
2830
|
} catch (b) {
|
|
2766
2831
|
return {
|
|
2767
2832
|
error: F(b)
|
|
@@ -2786,7 +2851,7 @@ async function Ds(r, t, s) {
|
|
|
2786
2851
|
} else if (n) {
|
|
2787
2852
|
const b = await ce(
|
|
2788
2853
|
n,
|
|
2789
|
-
|
|
2854
|
+
r,
|
|
2790
2855
|
s
|
|
2791
2856
|
);
|
|
2792
2857
|
if (b.error != null)
|
|
@@ -2798,20 +2863,20 @@ async function Ds(r, t, s) {
|
|
|
2798
2863
|
return {
|
|
2799
2864
|
error: "Either snapshotName or snapshot must be provided"
|
|
2800
2865
|
};
|
|
2801
|
-
const d =
|
|
2866
|
+
const d = Rt(l), p = l.query.rootDir ?? ".", m = {
|
|
2802
2867
|
filePaths: d,
|
|
2803
2868
|
operations: i
|
|
2804
|
-
},
|
|
2805
|
-
...
|
|
2869
|
+
}, g = Date.now(), y = await $e({
|
|
2870
|
+
...m,
|
|
2806
2871
|
dryRun: !0
|
|
2807
|
-
}), w =
|
|
2872
|
+
}), w = ns();
|
|
2808
2873
|
c.preparedReplace = {
|
|
2809
2874
|
id: w,
|
|
2810
|
-
options:
|
|
2875
|
+
options: m,
|
|
2811
2876
|
rootDir: p,
|
|
2812
|
-
dateCreated:
|
|
2877
|
+
dateCreated: g
|
|
2813
2878
|
};
|
|
2814
|
-
const M =
|
|
2879
|
+
const M = Ie({
|
|
2815
2880
|
result: y,
|
|
2816
2881
|
rootDir: p
|
|
2817
2882
|
}) + `
|
|
@@ -2823,18 +2888,18 @@ Review the output carefully before executing. Call fs-snapshot-replace-execute w
|
|
|
2823
2888
|
limit: a
|
|
2824
2889
|
}).content, rootDir: p, fsSnapshot: l, queryCreated: u, snapshotCreated: f };
|
|
2825
2890
|
}
|
|
2826
|
-
function
|
|
2827
|
-
|
|
2891
|
+
function Us(t, r) {
|
|
2892
|
+
t(
|
|
2828
2893
|
"fs-snapshot-replace-prepare",
|
|
2829
2894
|
{
|
|
2830
2895
|
title: "Prepare File Content Replacement",
|
|
2831
2896
|
description: "Prepares text replacement in files 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. Read and review full output to the end. If all replacements are valid get replaceId from the end of output and call fs-snapshot-replace-execute to apply it.",
|
|
2832
|
-
inputSchema:
|
|
2897
|
+
inputSchema: Bt.shape
|
|
2833
2898
|
},
|
|
2834
2899
|
async (s, o) => {
|
|
2835
|
-
const e = await
|
|
2900
|
+
const e = await zs(
|
|
2836
2901
|
s,
|
|
2837
|
-
|
|
2902
|
+
r,
|
|
2838
2903
|
o
|
|
2839
2904
|
);
|
|
2840
2905
|
if (e.error != null)
|
|
@@ -2853,13 +2918,13 @@ Reminder: use one snapshot covering all target files; include all patterns in th
|
|
|
2853
2918
|
}
|
|
2854
2919
|
);
|
|
2855
2920
|
}
|
|
2856
|
-
const
|
|
2857
|
-
replaceId: h.string().describe("Replace ID from fs-snapshot-replace-prepare output")
|
|
2921
|
+
const Lt = h.object({
|
|
2922
|
+
replaceId: h.string().describe("Replace ID from the END of fs-snapshot-replace-prepare output. NEVER fabricate or guess this value.")
|
|
2858
2923
|
});
|
|
2859
|
-
async function
|
|
2924
|
+
async function js(t, r, s) {
|
|
2860
2925
|
let o;
|
|
2861
2926
|
try {
|
|
2862
|
-
o =
|
|
2927
|
+
o = Lt.parse(t);
|
|
2863
2928
|
} catch (l) {
|
|
2864
2929
|
return {
|
|
2865
2930
|
error: F(l)
|
|
@@ -2877,30 +2942,30 @@ async function Fs(r, t, s) {
|
|
|
2877
2942
|
};
|
|
2878
2943
|
if (i.id !== e)
|
|
2879
2944
|
return {
|
|
2880
|
-
error: `Invalid replaceId "${e}"
|
|
2945
|
+
error: `Invalid replaceId "${e}". The replaceId is located at the END of fs-snapshot-replace-prepare output. Read the ENTIRE output to find it. NEVER fabricate or guess this value.`
|
|
2881
2946
|
};
|
|
2882
|
-
const a = await
|
|
2947
|
+
const a = await $e({
|
|
2883
2948
|
...i.options,
|
|
2884
2949
|
dateModifiedMax: i.dateCreated
|
|
2885
2950
|
});
|
|
2886
|
-
return n.preparedReplace = null, { output:
|
|
2951
|
+
return n.preparedReplace = null, { output: Ie({
|
|
2887
2952
|
result: a,
|
|
2888
2953
|
rootDir: i.rootDir,
|
|
2889
2954
|
errorsOnly: !0
|
|
2890
2955
|
}) || null };
|
|
2891
2956
|
}
|
|
2892
|
-
function
|
|
2893
|
-
|
|
2957
|
+
function qs(t, r) {
|
|
2958
|
+
t(
|
|
2894
2959
|
"fs-snapshot-replace-execute",
|
|
2895
2960
|
{
|
|
2896
2961
|
title: "Execute Prepared Replacement",
|
|
2897
2962
|
description: "Executes prepared replacement. Requires replaceId from the end of fs-snapshot-replace-prepare output.",
|
|
2898
|
-
inputSchema:
|
|
2963
|
+
inputSchema: Lt.shape
|
|
2899
2964
|
},
|
|
2900
2965
|
async (s, o) => {
|
|
2901
|
-
const e = await
|
|
2966
|
+
const e = await js(
|
|
2902
2967
|
s,
|
|
2903
|
-
|
|
2968
|
+
r,
|
|
2904
2969
|
o
|
|
2905
2970
|
);
|
|
2906
2971
|
if (e.error != null)
|
|
@@ -2913,21 +2978,21 @@ ${e.output}`), n;
|
|
|
2913
2978
|
}
|
|
2914
2979
|
);
|
|
2915
2980
|
}
|
|
2916
|
-
function
|
|
2917
|
-
|
|
2981
|
+
function _s(t, r) {
|
|
2982
|
+
r.list && ss(t, r), r.snapshotQueryCreate && as(t, r), r.snapshotCreate && ms(t, r), r.snapshotBrowse && Ss(t, r), r.snapshotSearch && Ps(t, r), r.snapshotReplace && (Us(t, r), qs(t, r)), console.log(
|
|
2918
2983
|
`File manager:
|
|
2919
|
-
- Working directory: ${k.resolve(
|
|
2984
|
+
- Working directory: ${k.resolve(r.workingDir || "")}
|
|
2920
2985
|
`
|
|
2921
2986
|
);
|
|
2922
2987
|
}
|
|
2923
2988
|
const pe = /* @__PURE__ */ new Map();
|
|
2924
|
-
function
|
|
2925
|
-
return pe.has(
|
|
2989
|
+
function W(t) {
|
|
2990
|
+
return pe.has(t) || pe.set(t, {
|
|
2926
2991
|
browsers: /* @__PURE__ */ new Map(),
|
|
2927
2992
|
domSnapshotQueries: /* @__PURE__ */ new Map()
|
|
2928
|
-
}), pe.get(
|
|
2993
|
+
}), pe.get(t);
|
|
2929
2994
|
}
|
|
2930
|
-
const
|
|
2995
|
+
const Me = h.object({
|
|
2931
2996
|
name: h.string().describe(
|
|
2932
2997
|
"Unique name for the browser. Recommended format: kebab-case-1, kebab-case-2, ..."
|
|
2933
2998
|
),
|
|
@@ -2935,10 +3000,10 @@ const Ie = h.object({
|
|
|
2935
3000
|
muteAudio: h.boolean().optional().describe("Mute audio in the browser"),
|
|
2936
3001
|
devTools: h.boolean().optional().describe("Open browser with dev tools")
|
|
2937
3002
|
});
|
|
2938
|
-
async function
|
|
3003
|
+
async function Pt(t, r, s) {
|
|
2939
3004
|
let o;
|
|
2940
3005
|
try {
|
|
2941
|
-
o =
|
|
3006
|
+
o = Me.parse(t);
|
|
2942
3007
|
} catch (l) {
|
|
2943
3008
|
return {
|
|
2944
3009
|
error: F(l)
|
|
@@ -2949,12 +3014,12 @@ async function Dt(r, t, s) {
|
|
|
2949
3014
|
return {
|
|
2950
3015
|
error: "Session ID is required"
|
|
2951
3016
|
};
|
|
2952
|
-
const c =
|
|
3017
|
+
const c = W(s.sessionId);
|
|
2953
3018
|
try {
|
|
2954
3019
|
const u = await {
|
|
2955
|
-
chromium:
|
|
2956
|
-
firefox:
|
|
2957
|
-
webkit:
|
|
3020
|
+
chromium: cr,
|
|
3021
|
+
firefox: lr,
|
|
3022
|
+
webkit: ar
|
|
2958
3023
|
}[n].launch({
|
|
2959
3024
|
headless: !1,
|
|
2960
3025
|
devtools: a,
|
|
@@ -2972,26 +3037,26 @@ async function Dt(r, t, s) {
|
|
|
2972
3037
|
};
|
|
2973
3038
|
}
|
|
2974
3039
|
}
|
|
2975
|
-
function
|
|
2976
|
-
|
|
3040
|
+
function Gs(t, r) {
|
|
3041
|
+
t(
|
|
2977
3042
|
"playwright-browser-create",
|
|
2978
3043
|
{
|
|
2979
3044
|
title: "Create Browser",
|
|
2980
3045
|
description: "Create a new browser. Prefer page-goto if you need to immediately create a browser, context, page and navigate",
|
|
2981
|
-
inputSchema:
|
|
3046
|
+
inputSchema: Me.shape
|
|
2982
3047
|
},
|
|
2983
3048
|
async (s, o) => {
|
|
2984
|
-
const e = await
|
|
3049
|
+
const e = await Pt(s, r, o);
|
|
2985
3050
|
return `Method: playwright-browser-create(${JSON.stringify(s)})
|
|
2986
3051
|
${e.error != null ? `❌ Error: ${e.error}` : `✅ Browser "${e.browserInfo.name}" (${e.browserInfo.browserType}) created successfully`}`;
|
|
2987
3052
|
}
|
|
2988
3053
|
);
|
|
2989
3054
|
}
|
|
2990
|
-
const
|
|
2991
|
-
async function
|
|
3055
|
+
const At = h.object({});
|
|
3056
|
+
async function Js(t, r, s) {
|
|
2992
3057
|
let o;
|
|
2993
3058
|
try {
|
|
2994
|
-
o =
|
|
3059
|
+
o = At.parse(t);
|
|
2995
3060
|
} catch (i) {
|
|
2996
3061
|
return {
|
|
2997
3062
|
error: F(i)
|
|
@@ -3001,21 +3066,21 @@ async function As(r, t, s) {
|
|
|
3001
3066
|
return {
|
|
3002
3067
|
error: "Session ID is required"
|
|
3003
3068
|
};
|
|
3004
|
-
const e =
|
|
3069
|
+
const e = W(s.sessionId);
|
|
3005
3070
|
return {
|
|
3006
3071
|
browserInfos: Array.from(e.browsers.values())
|
|
3007
3072
|
};
|
|
3008
3073
|
}
|
|
3009
|
-
function
|
|
3010
|
-
|
|
3074
|
+
function Ws(t, r) {
|
|
3075
|
+
t(
|
|
3011
3076
|
"playwright-browser-list",
|
|
3012
3077
|
{
|
|
3013
3078
|
title: "List Browsers",
|
|
3014
3079
|
description: "List active browser instances",
|
|
3015
|
-
inputSchema:
|
|
3080
|
+
inputSchema: At.shape
|
|
3016
3081
|
},
|
|
3017
3082
|
async (s, o) => {
|
|
3018
|
-
const e = await
|
|
3083
|
+
const e = await Js(s, r, o);
|
|
3019
3084
|
if (e.error != null)
|
|
3020
3085
|
return `Method: playwright-browser-list(${JSON.stringify(s)})
|
|
3021
3086
|
❌ Error: ${e.error}`;
|
|
@@ -3027,15 +3092,15 @@ ${n.length === 0 ? "No browsers found" : `Browsers: ${n.join(", ")}`}`;
|
|
|
3027
3092
|
}
|
|
3028
3093
|
);
|
|
3029
3094
|
}
|
|
3030
|
-
const
|
|
3095
|
+
const zt = h.object({
|
|
3031
3096
|
names: h.array(h.string()).optional().describe(
|
|
3032
3097
|
"Names of browsers to close. If not specified, closes all browsers"
|
|
3033
3098
|
)
|
|
3034
3099
|
});
|
|
3035
|
-
async function
|
|
3100
|
+
async function Ks(t, r, s) {
|
|
3036
3101
|
let o;
|
|
3037
3102
|
try {
|
|
3038
|
-
o =
|
|
3103
|
+
o = zt.parse(t);
|
|
3039
3104
|
} catch (l) {
|
|
3040
3105
|
return {
|
|
3041
3106
|
error: F(l)
|
|
@@ -3046,7 +3111,7 @@ async function Us(r, t, s) {
|
|
|
3046
3111
|
return {
|
|
3047
3112
|
error: "Session ID is required"
|
|
3048
3113
|
};
|
|
3049
|
-
const n =
|
|
3114
|
+
const n = W(s.sessionId), i = [], a = [];
|
|
3050
3115
|
let c = [];
|
|
3051
3116
|
return e ? e.forEach((l) => {
|
|
3052
3117
|
const u = n.browsers.get(l);
|
|
@@ -3066,16 +3131,16 @@ async function Us(r, t, s) {
|
|
|
3066
3131
|
...a.length > 0 && { errors: a }
|
|
3067
3132
|
};
|
|
3068
3133
|
}
|
|
3069
|
-
function
|
|
3070
|
-
|
|
3134
|
+
function Hs(t, r) {
|
|
3135
|
+
t(
|
|
3071
3136
|
"playwright-browser-close",
|
|
3072
3137
|
{
|
|
3073
3138
|
title: "Close Browsers",
|
|
3074
3139
|
description: "Close browsers. Automatically closes all contexts and pages within the browsers",
|
|
3075
|
-
inputSchema:
|
|
3140
|
+
inputSchema: zt.shape
|
|
3076
3141
|
},
|
|
3077
3142
|
async (s, o) => {
|
|
3078
|
-
const e = await
|
|
3143
|
+
const e = await Ks(s, r, o);
|
|
3079
3144
|
if (e.error != null)
|
|
3080
3145
|
return `Method: playwright-browser-close(${JSON.stringify(s)})
|
|
3081
3146
|
❌ Error: ${e.error}`;
|
|
@@ -3092,9 +3157,9 @@ ${n.join(`
|
|
|
3092
3157
|
}
|
|
3093
3158
|
);
|
|
3094
3159
|
}
|
|
3095
|
-
const
|
|
3160
|
+
const Te = h.object({
|
|
3096
3161
|
browserName: h.string().optional().describe("Name of previously created browser, to use"),
|
|
3097
|
-
browser:
|
|
3162
|
+
browser: Me.optional().describe(
|
|
3098
3163
|
"Browser creation options JSON to automatically create browser"
|
|
3099
3164
|
),
|
|
3100
3165
|
name: h.string().describe(
|
|
@@ -3107,10 +3172,10 @@ const Me = h.object({
|
|
|
3107
3172
|
height: h.number()
|
|
3108
3173
|
}).optional().describe("Viewport size configuration")
|
|
3109
3174
|
});
|
|
3110
|
-
async function
|
|
3175
|
+
async function Ut(t, r, s) {
|
|
3111
3176
|
let o;
|
|
3112
3177
|
try {
|
|
3113
|
-
o =
|
|
3178
|
+
o = Te.parse(t);
|
|
3114
3179
|
} catch (p) {
|
|
3115
3180
|
return {
|
|
3116
3181
|
error: F(p)
|
|
@@ -3121,7 +3186,7 @@ async function Bt(r, t, s) {
|
|
|
3121
3186
|
return {
|
|
3122
3187
|
error: "Session ID is required"
|
|
3123
3188
|
};
|
|
3124
|
-
const u =
|
|
3189
|
+
const u = W(s.sessionId);
|
|
3125
3190
|
if (n && i)
|
|
3126
3191
|
return {
|
|
3127
3192
|
error: "Either browserName or browser must be provided, not both"
|
|
@@ -3133,7 +3198,7 @@ async function Bt(r, t, s) {
|
|
|
3133
3198
|
error: `Browser "${n}" not found`
|
|
3134
3199
|
};
|
|
3135
3200
|
} else if (i) {
|
|
3136
|
-
const p = await
|
|
3201
|
+
const p = await Pt(i, r, s);
|
|
3137
3202
|
if (p.error != null)
|
|
3138
3203
|
return {
|
|
3139
3204
|
error: p.error
|
|
@@ -3148,16 +3213,16 @@ async function Bt(r, t, s) {
|
|
|
3148
3213
|
isMobile: a,
|
|
3149
3214
|
hasTouch: c,
|
|
3150
3215
|
viewport: l
|
|
3151
|
-
}),
|
|
3216
|
+
}), m = {
|
|
3152
3217
|
browserInfo: d,
|
|
3153
3218
|
name: e,
|
|
3154
3219
|
context: p,
|
|
3155
3220
|
pages: /* @__PURE__ */ new Map()
|
|
3156
3221
|
};
|
|
3157
|
-
return d.contexts.set(e,
|
|
3222
|
+
return d.contexts.set(e, m), {
|
|
3158
3223
|
browserInfoCreated: f,
|
|
3159
3224
|
browserInfo: d,
|
|
3160
|
-
contextInfo:
|
|
3225
|
+
contextInfo: m
|
|
3161
3226
|
};
|
|
3162
3227
|
} catch (p) {
|
|
3163
3228
|
return {
|
|
@@ -3165,16 +3230,16 @@ async function Bt(r, t, s) {
|
|
|
3165
3230
|
};
|
|
3166
3231
|
}
|
|
3167
3232
|
}
|
|
3168
|
-
function
|
|
3169
|
-
|
|
3233
|
+
function Qs(t, r) {
|
|
3234
|
+
t(
|
|
3170
3235
|
"playwright-context-create",
|
|
3171
3236
|
{
|
|
3172
3237
|
title: "Create Browser Context",
|
|
3173
3238
|
description: "Create a new browser context. Prefer page-goto if you need to immediately create a context, page and navigate",
|
|
3174
|
-
inputSchema:
|
|
3239
|
+
inputSchema: Te.shape
|
|
3175
3240
|
},
|
|
3176
3241
|
async (s, o) => {
|
|
3177
|
-
const e = await
|
|
3242
|
+
const e = await Ut(s, r, o);
|
|
3178
3243
|
if (e.error != null)
|
|
3179
3244
|
return `Method: playwright-context-create(${JSON.stringify(s)})
|
|
3180
3245
|
❌ Error: ${e.error}`;
|
|
@@ -3185,15 +3250,15 @@ function qs(r, t) {
|
|
|
3185
3250
|
}
|
|
3186
3251
|
);
|
|
3187
3252
|
}
|
|
3188
|
-
const
|
|
3253
|
+
const jt = h.object({
|
|
3189
3254
|
browserName: h.string().optional().describe(
|
|
3190
3255
|
"Name of browser to list contexts from. If not specified, lists contexts from all browsers"
|
|
3191
3256
|
)
|
|
3192
3257
|
});
|
|
3193
|
-
async function
|
|
3258
|
+
async function Ys(t, r, s) {
|
|
3194
3259
|
let o;
|
|
3195
3260
|
try {
|
|
3196
|
-
o =
|
|
3261
|
+
o = jt.parse(t);
|
|
3197
3262
|
} catch (a) {
|
|
3198
3263
|
return {
|
|
3199
3264
|
error: F(a)
|
|
@@ -3204,7 +3269,7 @@ async function Gs(r, t, s) {
|
|
|
3204
3269
|
return {
|
|
3205
3270
|
error: "Session ID is required"
|
|
3206
3271
|
};
|
|
3207
|
-
const n =
|
|
3272
|
+
const n = W(s.sessionId), i = [];
|
|
3208
3273
|
if (e) {
|
|
3209
3274
|
const a = n.browsers.get(e);
|
|
3210
3275
|
if (!a)
|
|
@@ -3227,16 +3292,16 @@ async function Gs(r, t, s) {
|
|
|
3227
3292
|
contextsByBrowser: i
|
|
3228
3293
|
};
|
|
3229
3294
|
}
|
|
3230
|
-
function
|
|
3231
|
-
|
|
3295
|
+
function Vs(t, r) {
|
|
3296
|
+
t(
|
|
3232
3297
|
"playwright-context-list",
|
|
3233
3298
|
{
|
|
3234
3299
|
title: "List Browser Contexts",
|
|
3235
3300
|
description: "List active browser contexts",
|
|
3236
|
-
inputSchema:
|
|
3301
|
+
inputSchema: jt.shape
|
|
3237
3302
|
},
|
|
3238
3303
|
async (s, o) => {
|
|
3239
|
-
const e = await
|
|
3304
|
+
const e = await Ys(s, r, o);
|
|
3240
3305
|
if ("error" in e)
|
|
3241
3306
|
return `Method: playwright-context-list(${JSON.stringify(s)})
|
|
3242
3307
|
❌ Error: ${e.error}`;
|
|
@@ -3249,7 +3314,7 @@ function _s(r, t) {
|
|
|
3249
3314
|
}
|
|
3250
3315
|
);
|
|
3251
3316
|
}
|
|
3252
|
-
const
|
|
3317
|
+
const qt = h.object({
|
|
3253
3318
|
names: h.array(h.string()).optional().describe(
|
|
3254
3319
|
"Names of contexts to close. If not specified, closes all contexts"
|
|
3255
3320
|
),
|
|
@@ -3257,10 +3322,10 @@ const Pt = h.object({
|
|
|
3257
3322
|
"Name of browser to close contexts from. If not specified, searches all browsers"
|
|
3258
3323
|
)
|
|
3259
3324
|
});
|
|
3260
|
-
async function
|
|
3325
|
+
async function Zs(t, r, s) {
|
|
3261
3326
|
let o;
|
|
3262
3327
|
try {
|
|
3263
|
-
o =
|
|
3328
|
+
o = qt.parse(t);
|
|
3264
3329
|
} catch (u) {
|
|
3265
3330
|
return {
|
|
3266
3331
|
error: F(u)
|
|
@@ -3271,7 +3336,7 @@ async function Js(r, t, s) {
|
|
|
3271
3336
|
return {
|
|
3272
3337
|
error: "Session ID is required"
|
|
3273
3338
|
};
|
|
3274
|
-
const i =
|
|
3339
|
+
const i = W(s.sessionId), a = [], c = [];
|
|
3275
3340
|
let l = [];
|
|
3276
3341
|
if (n) {
|
|
3277
3342
|
const u = i.browsers.get(n);
|
|
@@ -3311,16 +3376,16 @@ async function Js(r, t, s) {
|
|
|
3311
3376
|
...c.length > 0 && { errors: c }
|
|
3312
3377
|
};
|
|
3313
3378
|
}
|
|
3314
|
-
function
|
|
3315
|
-
|
|
3379
|
+
function Xs(t, r) {
|
|
3380
|
+
t(
|
|
3316
3381
|
"playwright-context-close",
|
|
3317
3382
|
{
|
|
3318
3383
|
title: "Close Browser Contexts",
|
|
3319
3384
|
description: "Close browser contexts. Automatically closes all pages within the contexts",
|
|
3320
|
-
inputSchema:
|
|
3385
|
+
inputSchema: qt.shape
|
|
3321
3386
|
},
|
|
3322
3387
|
async (s, o) => {
|
|
3323
|
-
const e = await
|
|
3388
|
+
const e = await Zs(s, r, o);
|
|
3324
3389
|
if ("error" in e)
|
|
3325
3390
|
return `Method: playwright-context-close(${JSON.stringify(s)})
|
|
3326
3391
|
❌ Error: ${e.error}`;
|
|
@@ -3337,8 +3402,8 @@ ${n.join(`
|
|
|
3337
3402
|
}
|
|
3338
3403
|
);
|
|
3339
3404
|
}
|
|
3340
|
-
function
|
|
3341
|
-
class
|
|
3405
|
+
function eo() {
|
|
3406
|
+
class t {
|
|
3342
3407
|
prevId = 0;
|
|
3343
3408
|
objectToId = /* @__PURE__ */ new WeakMap();
|
|
3344
3409
|
idToObject = /* @__PURE__ */ new Map();
|
|
@@ -3360,16 +3425,16 @@ function Ws() {
|
|
|
3360
3425
|
return u ?? (this.idToObject.delete(c), null);
|
|
3361
3426
|
}
|
|
3362
3427
|
}
|
|
3363
|
-
function
|
|
3428
|
+
function r(a, c, l) {
|
|
3364
3429
|
let u = null;
|
|
3365
3430
|
for (let f = 0, d = c.length; f < d; f++) {
|
|
3366
|
-
const p = c[f],
|
|
3431
|
+
const p = c[f], m = a(p), g = m == null ? null : r(a, m, l), y = l(p, g);
|
|
3367
3432
|
y != null && (u == null && (u = []), u.push(y));
|
|
3368
3433
|
}
|
|
3369
3434
|
return u;
|
|
3370
3435
|
}
|
|
3371
3436
|
function s(a) {
|
|
3372
|
-
const { getId: c, getChilds: l, rootNodes: u, createSnapshotNode: f } = a, d = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(),
|
|
3437
|
+
const { getId: c, getChilds: l, rootNodes: u, createSnapshotNode: f } = a, d = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), g = r(
|
|
3373
3438
|
l,
|
|
3374
3439
|
u,
|
|
3375
3440
|
(w, M) => {
|
|
@@ -3378,42 +3443,42 @@ function Ws() {
|
|
|
3378
3443
|
const b = c(w);
|
|
3379
3444
|
d.set(b, E), p.set(E, b);
|
|
3380
3445
|
}
|
|
3381
|
-
return E != null && M != null &&
|
|
3446
|
+
return E != null && M != null && m.set(
|
|
3382
3447
|
p.get(E),
|
|
3383
3448
|
M.map((b) => p.get(b))
|
|
3384
3449
|
), E;
|
|
3385
3450
|
}
|
|
3386
|
-
), y = f(null,
|
|
3451
|
+
), y = f(null, g);
|
|
3387
3452
|
if (y == null)
|
|
3388
3453
|
throw new Error("Impossible behavior: rootNode == null");
|
|
3389
|
-
return d.set(null, y),
|
|
3454
|
+
return d.set(null, y), g != null && m.set(
|
|
3390
3455
|
null,
|
|
3391
|
-
|
|
3456
|
+
g.map((w) => p.get(w))
|
|
3392
3457
|
), {
|
|
3393
3458
|
idToNode: d,
|
|
3394
|
-
idToChildIds:
|
|
3459
|
+
idToChildIds: m
|
|
3395
3460
|
};
|
|
3396
3461
|
}
|
|
3397
3462
|
const o = (a) => a instanceof HTMLElement ? a.childNodes : null;
|
|
3398
3463
|
function e(a) {
|
|
3399
3464
|
return function(l, u) {
|
|
3400
3465
|
const f = u != null && u.length > 0;
|
|
3401
|
-
let d = !1, p = null,
|
|
3466
|
+
let d = !1, p = null, m = null;
|
|
3402
3467
|
if (l instanceof HTMLElement) {
|
|
3403
|
-
if (p = n.getOrCreateId(l),
|
|
3468
|
+
if (p = n.getOrCreateId(l), m = l.tagName.toLowerCase(), d = l.matches(a.cssSelector), !d && !f)
|
|
3404
3469
|
return null;
|
|
3405
3470
|
} else if (l == null)
|
|
3406
|
-
p = null,
|
|
3471
|
+
p = null, m = null, d = !1;
|
|
3407
3472
|
else
|
|
3408
3473
|
return null;
|
|
3409
3474
|
return {
|
|
3410
3475
|
uid: p,
|
|
3411
|
-
tagName:
|
|
3476
|
+
tagName: m,
|
|
3412
3477
|
isMatched: d
|
|
3413
3478
|
};
|
|
3414
3479
|
};
|
|
3415
3480
|
}
|
|
3416
|
-
const n = new
|
|
3481
|
+
const n = new t();
|
|
3417
3482
|
function i(a) {
|
|
3418
3483
|
const c = e(a);
|
|
3419
3484
|
return s({
|
|
@@ -3425,19 +3490,19 @@ function Ws() {
|
|
|
3425
3490
|
}
|
|
3426
3491
|
window.__mcp_playwright_tool_tx4byhar35_createDomSnapshotTreeRawDom = i;
|
|
3427
3492
|
}
|
|
3428
|
-
const
|
|
3493
|
+
const to = `(function (){function __name(fn){return fn};${eo.toString()}; setupPageGlobals();})()`, Ce = h.object({
|
|
3429
3494
|
contextName: h.string().optional().describe("Name of previously created context, to use"),
|
|
3430
|
-
context:
|
|
3495
|
+
context: Te.optional().describe(
|
|
3431
3496
|
"Context creation options JSON to automatically create context"
|
|
3432
3497
|
),
|
|
3433
3498
|
name: h.string().describe(
|
|
3434
3499
|
"Unique name for the page. Recommended format: kebab-case-1, kebab-case-2, ..."
|
|
3435
3500
|
)
|
|
3436
3501
|
});
|
|
3437
|
-
async function
|
|
3502
|
+
async function _t(t, r, s) {
|
|
3438
3503
|
let o;
|
|
3439
3504
|
try {
|
|
3440
|
-
o =
|
|
3505
|
+
o = Ce.parse(t);
|
|
3441
3506
|
} catch (f) {
|
|
3442
3507
|
return {
|
|
3443
3508
|
error: F(f)
|
|
@@ -3448,7 +3513,7 @@ async function At(r, t, s) {
|
|
|
3448
3513
|
return {
|
|
3449
3514
|
error: "Session ID is required"
|
|
3450
3515
|
};
|
|
3451
|
-
const a =
|
|
3516
|
+
const a = W(s.sessionId);
|
|
3452
3517
|
if (n && i)
|
|
3453
3518
|
return {
|
|
3454
3519
|
error: "Either contextName or context must be provided, not both"
|
|
@@ -3465,7 +3530,7 @@ async function At(r, t, s) {
|
|
|
3465
3530
|
error: `Context "${n}" not found`
|
|
3466
3531
|
};
|
|
3467
3532
|
} else if (i) {
|
|
3468
|
-
const f = await
|
|
3533
|
+
const f = await Ut(i, r, s);
|
|
3469
3534
|
if (f.error != null)
|
|
3470
3535
|
return {
|
|
3471
3536
|
error: f.error
|
|
@@ -3477,7 +3542,7 @@ async function At(r, t, s) {
|
|
|
3477
3542
|
};
|
|
3478
3543
|
try {
|
|
3479
3544
|
const f = await u.context.newPage();
|
|
3480
|
-
await f.addInitScript(
|
|
3545
|
+
await f.addInitScript(to), await f.goto("about:blank");
|
|
3481
3546
|
const d = {
|
|
3482
3547
|
contextInfo: u,
|
|
3483
3548
|
name: e,
|
|
@@ -3495,16 +3560,16 @@ async function At(r, t, s) {
|
|
|
3495
3560
|
};
|
|
3496
3561
|
}
|
|
3497
3562
|
}
|
|
3498
|
-
function
|
|
3499
|
-
|
|
3563
|
+
function ro(t, r) {
|
|
3564
|
+
t(
|
|
3500
3565
|
"playwright-page-create",
|
|
3501
3566
|
{
|
|
3502
3567
|
title: "Create Page",
|
|
3503
3568
|
description: "Create a new page. Prefer page-goto if you need to immediately create a page and navigate",
|
|
3504
|
-
inputSchema:
|
|
3569
|
+
inputSchema: Ce.shape
|
|
3505
3570
|
},
|
|
3506
3571
|
async (s, o) => {
|
|
3507
|
-
const e = await
|
|
3572
|
+
const e = await _t(s, r, o);
|
|
3508
3573
|
if (e.error != null)
|
|
3509
3574
|
return `Method: playwright-page-create(${JSON.stringify(s)})
|
|
3510
3575
|
❌ Error: ${e.error}`;
|
|
@@ -3516,7 +3581,7 @@ function Qs(r, t) {
|
|
|
3516
3581
|
}
|
|
3517
3582
|
);
|
|
3518
3583
|
}
|
|
3519
|
-
const
|
|
3584
|
+
const Gt = h.object({
|
|
3520
3585
|
contextName: h.string().optional().describe(
|
|
3521
3586
|
"Name of context to list pages from. If not specified, lists pages from all contexts"
|
|
3522
3587
|
),
|
|
@@ -3524,10 +3589,10 @@ const zt = h.object({
|
|
|
3524
3589
|
"Name of browser to search in. If not specified, searches all browsers"
|
|
3525
3590
|
)
|
|
3526
3591
|
});
|
|
3527
|
-
async function
|
|
3592
|
+
async function so(t, r, s) {
|
|
3528
3593
|
let o;
|
|
3529
3594
|
try {
|
|
3530
|
-
o =
|
|
3595
|
+
o = Gt.parse(t);
|
|
3531
3596
|
} catch (c) {
|
|
3532
3597
|
return {
|
|
3533
3598
|
error: F(c)
|
|
@@ -3538,7 +3603,7 @@ async function Ys(r, t, s) {
|
|
|
3538
3603
|
return {
|
|
3539
3604
|
error: "Session ID is required"
|
|
3540
3605
|
};
|
|
3541
|
-
const i =
|
|
3606
|
+
const i = W(s.sessionId), a = [];
|
|
3542
3607
|
if (n) {
|
|
3543
3608
|
const c = i.browsers.get(n);
|
|
3544
3609
|
if (!c)
|
|
@@ -3588,16 +3653,16 @@ async function Ys(r, t, s) {
|
|
|
3588
3653
|
pagesByContext: a
|
|
3589
3654
|
};
|
|
3590
3655
|
}
|
|
3591
|
-
function
|
|
3592
|
-
|
|
3656
|
+
function oo(t, r) {
|
|
3657
|
+
t(
|
|
3593
3658
|
"playwright-page-list",
|
|
3594
3659
|
{
|
|
3595
3660
|
title: "List Pages",
|
|
3596
3661
|
description: "List active pages",
|
|
3597
|
-
inputSchema:
|
|
3662
|
+
inputSchema: Gt.shape
|
|
3598
3663
|
},
|
|
3599
3664
|
async (s, o) => {
|
|
3600
|
-
const e = await
|
|
3665
|
+
const e = await so(s, r, o);
|
|
3601
3666
|
if ("error" in e)
|
|
3602
3667
|
return `Method: playwright-page-list(${JSON.stringify(s)})
|
|
3603
3668
|
❌ Error: ${e.error}`;
|
|
@@ -3610,7 +3675,7 @@ function Vs(r, t) {
|
|
|
3610
3675
|
}
|
|
3611
3676
|
);
|
|
3612
3677
|
}
|
|
3613
|
-
const
|
|
3678
|
+
const Jt = h.object({
|
|
3614
3679
|
names: h.array(h.string()).optional().describe("Names of pages to close. If not specified, closes all pages"),
|
|
3615
3680
|
contextName: h.string().optional().describe(
|
|
3616
3681
|
"Name of context to close pages from. If not specified, searches all contexts"
|
|
@@ -3619,10 +3684,10 @@ const Ut = h.object({
|
|
|
3619
3684
|
"Name of browser to search in. If not specified, searches all browsers"
|
|
3620
3685
|
)
|
|
3621
3686
|
});
|
|
3622
|
-
async function
|
|
3687
|
+
async function no(t, r, s) {
|
|
3623
3688
|
let o;
|
|
3624
3689
|
try {
|
|
3625
|
-
o =
|
|
3690
|
+
o = Jt.parse(t);
|
|
3626
3691
|
} catch (f) {
|
|
3627
3692
|
return {
|
|
3628
3693
|
error: F(f)
|
|
@@ -3633,7 +3698,7 @@ async function Zs(r, t, s) {
|
|
|
3633
3698
|
return {
|
|
3634
3699
|
error: "Session ID is required"
|
|
3635
3700
|
};
|
|
3636
|
-
const a =
|
|
3701
|
+
const a = W(s.sessionId), c = [], l = [];
|
|
3637
3702
|
let u = [];
|
|
3638
3703
|
if (i) {
|
|
3639
3704
|
const f = a.browsers.get(i);
|
|
@@ -3648,16 +3713,16 @@ async function Zs(r, t, s) {
|
|
|
3648
3713
|
error: `Context "${n}" not found in browser "${f.name}" (${f.browserType})`
|
|
3649
3714
|
};
|
|
3650
3715
|
e ? e.forEach((p) => {
|
|
3651
|
-
const
|
|
3652
|
-
|
|
3716
|
+
const m = d.pages.get(p);
|
|
3717
|
+
m ? u.push(m) : l.push(
|
|
3653
3718
|
`Page "${p}" not found in context "${d.name}" in browser "${f.name}" (${f.browserType})`
|
|
3654
3719
|
);
|
|
3655
3720
|
}) : u = Array.from(d.pages.values());
|
|
3656
3721
|
} else
|
|
3657
3722
|
for (const d of f.contexts.values())
|
|
3658
3723
|
e ? e.forEach((p) => {
|
|
3659
|
-
const
|
|
3660
|
-
|
|
3724
|
+
const m = d.pages.get(p);
|
|
3725
|
+
m ? u.push(m) : l.push(
|
|
3661
3726
|
`Page "${p}" not found in context "${d.name}" in browser "${f.name}" (${f.browserType})`
|
|
3662
3727
|
);
|
|
3663
3728
|
}) : u.push(...Array.from(d.pages.values()));
|
|
@@ -3665,8 +3730,8 @@ async function Zs(r, t, s) {
|
|
|
3665
3730
|
for (const f of a.browsers.values()) {
|
|
3666
3731
|
const d = f.contexts.get(n);
|
|
3667
3732
|
d && (e ? e.forEach((p) => {
|
|
3668
|
-
const
|
|
3669
|
-
|
|
3733
|
+
const m = d.pages.get(p);
|
|
3734
|
+
m ? u.push(m) : l.push(
|
|
3670
3735
|
`Page "${p}" not found in context "${d.name}" in browser "${f.name}" (${f.browserType})`
|
|
3671
3736
|
);
|
|
3672
3737
|
}) : u.push(...Array.from(d.pages.values())));
|
|
@@ -3675,8 +3740,8 @@ async function Zs(r, t, s) {
|
|
|
3675
3740
|
for (const f of a.browsers.values())
|
|
3676
3741
|
for (const d of f.contexts.values())
|
|
3677
3742
|
e ? e.forEach((p) => {
|
|
3678
|
-
const
|
|
3679
|
-
|
|
3743
|
+
const m = d.pages.get(p);
|
|
3744
|
+
m ? u.push(m) : l.push(
|
|
3680
3745
|
`Page "${p}" not found in context "${d.name}" in browser "${f.name}" (${f.browserType})`
|
|
3681
3746
|
);
|
|
3682
3747
|
}) : u.push(...Array.from(d.pages.values()));
|
|
@@ -3697,16 +3762,16 @@ async function Zs(r, t, s) {
|
|
|
3697
3762
|
...l.length > 0 && { errors: l }
|
|
3698
3763
|
};
|
|
3699
3764
|
}
|
|
3700
|
-
function
|
|
3701
|
-
|
|
3765
|
+
function io(t, r) {
|
|
3766
|
+
t(
|
|
3702
3767
|
"playwright-page-close",
|
|
3703
3768
|
{
|
|
3704
3769
|
title: "Close Pages",
|
|
3705
3770
|
description: "Close pages",
|
|
3706
|
-
inputSchema:
|
|
3771
|
+
inputSchema: Jt.shape
|
|
3707
3772
|
},
|
|
3708
3773
|
async (s, o) => {
|
|
3709
|
-
const e = await
|
|
3774
|
+
const e = await no(s, r, o);
|
|
3710
3775
|
if ("error" in e)
|
|
3711
3776
|
return `Method: playwright-page-close(${JSON.stringify(s)})
|
|
3712
3777
|
❌ Error: ${e.error}`;
|
|
@@ -3717,9 +3782,9 @@ ${n.join(`
|
|
|
3717
3782
|
}
|
|
3718
3783
|
);
|
|
3719
3784
|
}
|
|
3720
|
-
const
|
|
3785
|
+
const Wt = h.object({
|
|
3721
3786
|
pageName: h.string().optional().describe("Name of previously created page to navigate"),
|
|
3722
|
-
page:
|
|
3787
|
+
page: Ce.optional().describe(
|
|
3723
3788
|
"Page creation options JSON to automatically create page"
|
|
3724
3789
|
),
|
|
3725
3790
|
url: h.string().describe("URL to navigate to"),
|
|
@@ -3732,13 +3797,13 @@ const jt = h.object({
|
|
|
3732
3797
|
- 'commit': network response received and document started loading`
|
|
3733
3798
|
)
|
|
3734
3799
|
});
|
|
3735
|
-
async function
|
|
3800
|
+
async function ao(t, r, s) {
|
|
3736
3801
|
let o;
|
|
3737
3802
|
try {
|
|
3738
|
-
o =
|
|
3739
|
-
} catch (
|
|
3803
|
+
o = Wt.parse(t);
|
|
3804
|
+
} catch (m) {
|
|
3740
3805
|
return {
|
|
3741
|
-
error: F(
|
|
3806
|
+
error: F(m)
|
|
3742
3807
|
};
|
|
3743
3808
|
}
|
|
3744
3809
|
const { pageName: e, page: n, url: i, timeout: a, waitUntil: c } = o;
|
|
@@ -3746,17 +3811,17 @@ async function eo(r, t, s) {
|
|
|
3746
3811
|
return {
|
|
3747
3812
|
error: "Session ID is required"
|
|
3748
3813
|
};
|
|
3749
|
-
const l =
|
|
3814
|
+
const l = W(s.sessionId);
|
|
3750
3815
|
if (e && n)
|
|
3751
3816
|
return {
|
|
3752
3817
|
error: "Either pageName or page must be provided, not both"
|
|
3753
3818
|
};
|
|
3754
3819
|
let u = !1, f = !1, d = !1, p;
|
|
3755
3820
|
if (e) {
|
|
3756
|
-
for (const
|
|
3757
|
-
for (const
|
|
3758
|
-
if (
|
|
3759
|
-
p =
|
|
3821
|
+
for (const m of l.browsers.values()) {
|
|
3822
|
+
for (const g of m.contexts.values())
|
|
3823
|
+
if (g.pages.has(e)) {
|
|
3824
|
+
p = g.pages.get(e);
|
|
3760
3825
|
break;
|
|
3761
3826
|
}
|
|
3762
3827
|
if (p) break;
|
|
@@ -3766,27 +3831,27 @@ async function eo(r, t, s) {
|
|
|
3766
3831
|
error: `Page "${e}" not found`
|
|
3767
3832
|
};
|
|
3768
3833
|
} else if (n) {
|
|
3769
|
-
const
|
|
3770
|
-
if (
|
|
3834
|
+
const m = await _t(n, r, s);
|
|
3835
|
+
if (m.error != null)
|
|
3771
3836
|
return {
|
|
3772
|
-
error:
|
|
3837
|
+
error: m.error
|
|
3773
3838
|
};
|
|
3774
|
-
p =
|
|
3839
|
+
p = m.pageInfo, u = m.browserInfoCreated, f = m.contextInfoCreated, d = !0;
|
|
3775
3840
|
} else
|
|
3776
3841
|
return {
|
|
3777
3842
|
error: "Either pageName or page must be provided"
|
|
3778
3843
|
};
|
|
3779
3844
|
try {
|
|
3780
|
-
const
|
|
3845
|
+
const m = await p.page.goto(i, {
|
|
3781
3846
|
timeout: a * 1e3,
|
|
3782
3847
|
waitUntil: c
|
|
3783
3848
|
});
|
|
3784
|
-
return
|
|
3849
|
+
return m ? {
|
|
3785
3850
|
browserInfoCreated: u,
|
|
3786
3851
|
contextInfoCreated: f,
|
|
3787
3852
|
pageInfoCreated: d,
|
|
3788
3853
|
pageInfo: p,
|
|
3789
|
-
status:
|
|
3854
|
+
status: m.status()
|
|
3790
3855
|
} : {
|
|
3791
3856
|
browserInfoCreated: u,
|
|
3792
3857
|
contextInfoCreated: f,
|
|
@@ -3794,22 +3859,22 @@ async function eo(r, t, s) {
|
|
|
3794
3859
|
pageInfo: p,
|
|
3795
3860
|
status: 200
|
|
3796
3861
|
};
|
|
3797
|
-
} catch (
|
|
3862
|
+
} catch (m) {
|
|
3798
3863
|
return {
|
|
3799
|
-
error: `Failed to navigate to "${i}": ${
|
|
3864
|
+
error: `Failed to navigate to "${i}": ${m instanceof Error ? m.message : "Unknown error"}`
|
|
3800
3865
|
};
|
|
3801
3866
|
}
|
|
3802
3867
|
}
|
|
3803
|
-
function
|
|
3804
|
-
|
|
3868
|
+
function lo(t, r) {
|
|
3869
|
+
t(
|
|
3805
3870
|
"playwright-page-goto",
|
|
3806
3871
|
{
|
|
3807
3872
|
title: "Navigate Page",
|
|
3808
3873
|
description: "Navigate page to URL. Use for manual browser interaction",
|
|
3809
|
-
inputSchema:
|
|
3874
|
+
inputSchema: Wt.shape
|
|
3810
3875
|
},
|
|
3811
3876
|
async (s, o) => {
|
|
3812
|
-
const e = await
|
|
3877
|
+
const e = await ao(s, r, o);
|
|
3813
3878
|
if (e.error != null)
|
|
3814
3879
|
return `Method: playwright-page-goto(${JSON.stringify(s)})
|
|
3815
3880
|
❌ Error: ${e.error}`;
|
|
@@ -3822,16 +3887,16 @@ function to(r, t) {
|
|
|
3822
3887
|
}
|
|
3823
3888
|
);
|
|
3824
3889
|
}
|
|
3825
|
-
const
|
|
3890
|
+
const ve = h.object({
|
|
3826
3891
|
name: h.string().describe(
|
|
3827
3892
|
"Unique name for the DOM snapshot query. Recommended format: kebab-case-1, kebab-case-2, ..."
|
|
3828
3893
|
),
|
|
3829
3894
|
cssSelector: h.string().describe("CSS selector to capture page content")
|
|
3830
3895
|
});
|
|
3831
|
-
async function
|
|
3896
|
+
async function Kt(t, r, s) {
|
|
3832
3897
|
let o;
|
|
3833
3898
|
try {
|
|
3834
|
-
o =
|
|
3899
|
+
o = ve.parse(t);
|
|
3835
3900
|
} catch (c) {
|
|
3836
3901
|
return {
|
|
3837
3902
|
error: F(c)
|
|
@@ -3842,7 +3907,7 @@ async function qt(r, t, s) {
|
|
|
3842
3907
|
return {
|
|
3843
3908
|
error: "Session ID is required"
|
|
3844
3909
|
};
|
|
3845
|
-
const i =
|
|
3910
|
+
const i = W(s.sessionId), a = {
|
|
3846
3911
|
name: e,
|
|
3847
3912
|
cssSelector: n
|
|
3848
3913
|
};
|
|
@@ -3850,31 +3915,31 @@ async function qt(r, t, s) {
|
|
|
3850
3915
|
snapshotQuery: a
|
|
3851
3916
|
};
|
|
3852
3917
|
}
|
|
3853
|
-
function
|
|
3854
|
-
|
|
3918
|
+
function co(t, r) {
|
|
3919
|
+
t(
|
|
3855
3920
|
"playwright-dom-snapshot-query-create",
|
|
3856
3921
|
{
|
|
3857
3922
|
title: "Create DOM Snapshot Query",
|
|
3858
3923
|
description: "Create a DOM snapshot query. Prefer dom-snapshot-browse if you need to immediately create a query and snapshot and browse it",
|
|
3859
|
-
inputSchema:
|
|
3924
|
+
inputSchema: ve.shape
|
|
3860
3925
|
},
|
|
3861
3926
|
async (s, o) => {
|
|
3862
|
-
const e = await
|
|
3927
|
+
const e = await Kt(s, r, o);
|
|
3863
3928
|
return e.error != null ? `Method: playwright-dom-snapshot-query-create(${JSON.stringify(s)})
|
|
3864
3929
|
❌ Error: ${e.error}` : `Method: playwright-dom-snapshot-query-create(${JSON.stringify(s)})
|
|
3865
3930
|
✅ DOM snapshot query "${e.snapshotQuery.name}" created successfully`;
|
|
3866
3931
|
}
|
|
3867
3932
|
);
|
|
3868
3933
|
}
|
|
3869
|
-
function
|
|
3934
|
+
function uo(t) {
|
|
3870
3935
|
return function(s, o) {
|
|
3871
3936
|
let e, n = 0;
|
|
3872
3937
|
const i = o ? o.length : 0;
|
|
3873
3938
|
let a = 1, c = 0, l = 0, u, f;
|
|
3874
3939
|
if (o)
|
|
3875
|
-
for (let
|
|
3876
|
-
const
|
|
3877
|
-
n +=
|
|
3940
|
+
for (let m = 0; m < o.length; m++) {
|
|
3941
|
+
const g = o[m];
|
|
3942
|
+
n += g.countMatched, a += g.countTotal, c += g.tokens, l += g.tokensTotal;
|
|
3878
3943
|
}
|
|
3879
3944
|
s ? (u = s.uid, f = s.tagName, e = s.isMatched, e && (n += 1)) : (u = null, f = null, e = !1);
|
|
3880
3945
|
let d;
|
|
@@ -3887,7 +3952,7 @@ function so(r) {
|
|
|
3887
3952
|
textOpen: `<root uid:${u}>`,
|
|
3888
3953
|
textClose: "</root>"
|
|
3889
3954
|
};
|
|
3890
|
-
const p =
|
|
3955
|
+
const p = Et(d);
|
|
3891
3956
|
return l += p, {
|
|
3892
3957
|
uid: u,
|
|
3893
3958
|
tagName: f,
|
|
@@ -3902,8 +3967,8 @@ function so(r) {
|
|
|
3902
3967
|
};
|
|
3903
3968
|
};
|
|
3904
3969
|
}
|
|
3905
|
-
function
|
|
3906
|
-
const s = le(
|
|
3970
|
+
function fo(t, r) {
|
|
3971
|
+
const s = le(r), o = s.getChilds(s.root), e = vt({
|
|
3907
3972
|
getId: (n) => {
|
|
3908
3973
|
const i = s.getId(n);
|
|
3909
3974
|
if (i == null)
|
|
@@ -3913,25 +3978,25 @@ function oo(r, t) {
|
|
|
3913
3978
|
return i;
|
|
3914
3979
|
},
|
|
3915
3980
|
getChilds: (n) => s.getChilds(n),
|
|
3916
|
-
createSnapshotNode:
|
|
3981
|
+
createSnapshotNode: uo(),
|
|
3917
3982
|
rootNodes: o ?? []
|
|
3918
3983
|
});
|
|
3919
3984
|
return le(e);
|
|
3920
3985
|
}
|
|
3921
|
-
const
|
|
3986
|
+
const Ee = h.object({
|
|
3922
3987
|
pageName: h.string().describe("Name of previously created page, to create snapshot from"),
|
|
3923
3988
|
queryName: h.string().optional().describe("Name of previously created DOM snapshot query, to use"),
|
|
3924
|
-
query:
|
|
3989
|
+
query: ve.optional().describe(
|
|
3925
3990
|
"DOM snapshot query creation options JSON to automatically create query"
|
|
3926
3991
|
),
|
|
3927
3992
|
name: h.string().describe(
|
|
3928
3993
|
"Unique name for the DOM snapshot. Recommended format: kebab-case-1, kebab-case-2, ..."
|
|
3929
3994
|
)
|
|
3930
3995
|
});
|
|
3931
|
-
async function
|
|
3996
|
+
async function Ht(t, r, s) {
|
|
3932
3997
|
let o;
|
|
3933
3998
|
try {
|
|
3934
|
-
o =
|
|
3999
|
+
o = Ee.parse(t);
|
|
3935
4000
|
} catch (d) {
|
|
3936
4001
|
return {
|
|
3937
4002
|
error: F(d)
|
|
@@ -3942,7 +4007,7 @@ async function Gt(r, t, s) {
|
|
|
3942
4007
|
return {
|
|
3943
4008
|
error: "Session ID is required"
|
|
3944
4009
|
};
|
|
3945
|
-
const c =
|
|
4010
|
+
const c = W(s.sessionId);
|
|
3946
4011
|
let l;
|
|
3947
4012
|
for (const d of c.browsers.values()) {
|
|
3948
4013
|
for (const p of d.contexts.values())
|
|
@@ -3969,9 +4034,9 @@ async function Gt(r, t, s) {
|
|
|
3969
4034
|
};
|
|
3970
4035
|
u = d;
|
|
3971
4036
|
} else if (i) {
|
|
3972
|
-
const d = await
|
|
4037
|
+
const d = await Kt(
|
|
3973
4038
|
i,
|
|
3974
|
-
|
|
4039
|
+
r,
|
|
3975
4040
|
s
|
|
3976
4041
|
);
|
|
3977
4042
|
if (d.error != null)
|
|
@@ -3999,13 +4064,13 @@ async function Gt(r, t, s) {
|
|
|
3999
4064
|
), p = {
|
|
4000
4065
|
idToNode: new Map(d.idToNode),
|
|
4001
4066
|
idToChildIds: new Map(d.idToChildIds)
|
|
4002
|
-
},
|
|
4067
|
+
}, m = fo(u, p), g = {
|
|
4003
4068
|
name: a,
|
|
4004
4069
|
query: u,
|
|
4005
|
-
tree:
|
|
4070
|
+
tree: m
|
|
4006
4071
|
};
|
|
4007
|
-
return l.domSnapshots.set(a,
|
|
4008
|
-
domSnapshot:
|
|
4072
|
+
return l.domSnapshots.set(a, g), {
|
|
4073
|
+
domSnapshot: g,
|
|
4009
4074
|
queryCreated: f
|
|
4010
4075
|
};
|
|
4011
4076
|
} catch (d) {
|
|
@@ -4014,16 +4079,16 @@ async function Gt(r, t, s) {
|
|
|
4014
4079
|
};
|
|
4015
4080
|
}
|
|
4016
4081
|
}
|
|
4017
|
-
function
|
|
4018
|
-
|
|
4082
|
+
function po(t, r) {
|
|
4083
|
+
t(
|
|
4019
4084
|
"playwright-dom-snapshot-create",
|
|
4020
4085
|
{
|
|
4021
4086
|
title: "Create DOM Snapshot",
|
|
4022
4087
|
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",
|
|
4023
|
-
inputSchema:
|
|
4088
|
+
inputSchema: Ee.shape
|
|
4024
4089
|
},
|
|
4025
4090
|
async (s, o) => {
|
|
4026
|
-
const e = await
|
|
4091
|
+
const e = await Ht(s, r, o);
|
|
4027
4092
|
if (e.error != null)
|
|
4028
4093
|
return `Method: playwright-dom-snapshot-create(${JSON.stringify(s)})
|
|
4029
4094
|
❌ Error: ${e.error}`;
|
|
@@ -4034,23 +4099,23 @@ function no(r, t) {
|
|
|
4034
4099
|
}
|
|
4035
4100
|
);
|
|
4036
4101
|
}
|
|
4037
|
-
class
|
|
4102
|
+
class ho {
|
|
4038
4103
|
tokens = 20;
|
|
4039
|
-
getReportText = (
|
|
4104
|
+
getReportText = (r) => ({
|
|
4040
4105
|
indent: !0,
|
|
4041
|
-
textOpen: `[${
|
|
4106
|
+
textOpen: `[${r.indexRange[0]}-${r.indexRange[1]}] see more ${r.countMatched} matched ${r.tokensGrouped} tokens`,
|
|
4042
4107
|
textClose: null
|
|
4043
4108
|
});
|
|
4044
|
-
add = (
|
|
4109
|
+
add = (r, s, o) => r == null ? {
|
|
4045
4110
|
indexRange: [o, o],
|
|
4046
4111
|
countGrouped: 1,
|
|
4047
4112
|
countMatched: s.countMatched,
|
|
4048
4113
|
tokensGrouped: s.tokens
|
|
4049
|
-
} : (
|
|
4114
|
+
} : (r.indexRange[1] = o, r.countGrouped += 1, r.countMatched += s.countMatched, r.tokensGrouped += s.tokens, r);
|
|
4050
4115
|
}
|
|
4051
|
-
const
|
|
4116
|
+
const Qt = h.object({
|
|
4052
4117
|
snapshotName: h.string().optional().describe("Name of previously created DOM snapshot, to use"),
|
|
4053
|
-
snapshot:
|
|
4118
|
+
snapshot: Ee.optional().describe(
|
|
4054
4119
|
"DOM snapshot creation options JSON to automatically create snapshot"
|
|
4055
4120
|
),
|
|
4056
4121
|
parentUid: h.number().optional().describe("UID of parent node to browse. Omit to browse the root node"),
|
|
@@ -4068,13 +4133,13 @@ const _t = h.object({
|
|
|
4068
4133
|
// maxCountGroup: z.number().default(10).describe('Maximum items per group'),
|
|
4069
4134
|
// maxTokensGroup: z.number().default(1000).describe('Maximum tokens per group'),
|
|
4070
4135
|
});
|
|
4071
|
-
async function
|
|
4136
|
+
async function mo(t, r, s) {
|
|
4072
4137
|
let o;
|
|
4073
4138
|
try {
|
|
4074
|
-
o =
|
|
4075
|
-
} catch (
|
|
4139
|
+
o = Qt.parse(t);
|
|
4140
|
+
} catch (g) {
|
|
4076
4141
|
return {
|
|
4077
|
-
error: F(
|
|
4142
|
+
error: F(g)
|
|
4078
4143
|
};
|
|
4079
4144
|
}
|
|
4080
4145
|
const {
|
|
@@ -4090,15 +4155,15 @@ async function ao(r, t, s) {
|
|
|
4090
4155
|
return {
|
|
4091
4156
|
error: "Session ID is required"
|
|
4092
4157
|
};
|
|
4093
|
-
const f =
|
|
4158
|
+
const f = W(s.sessionId);
|
|
4094
4159
|
if (e && n)
|
|
4095
4160
|
return {
|
|
4096
4161
|
error: "Either snapshotName or snapshot must be provided, not both"
|
|
4097
4162
|
};
|
|
4098
|
-
let d, p = !1,
|
|
4163
|
+
let d, p = !1, m = !1;
|
|
4099
4164
|
if (e) {
|
|
4100
|
-
for (const
|
|
4101
|
-
for (const y of
|
|
4165
|
+
for (const g of f.browsers.values()) {
|
|
4166
|
+
for (const y of g.contexts.values()) {
|
|
4102
4167
|
for (const w of y.pages.values())
|
|
4103
4168
|
if (w.domSnapshots.has(e)) {
|
|
4104
4169
|
d = w.domSnapshots.get(e);
|
|
@@ -4113,25 +4178,25 @@ async function ao(r, t, s) {
|
|
|
4113
4178
|
error: `DOM snapshot "${e}" not found`
|
|
4114
4179
|
};
|
|
4115
4180
|
} else if (n) {
|
|
4116
|
-
const
|
|
4181
|
+
const g = await Ht(
|
|
4117
4182
|
n,
|
|
4118
|
-
|
|
4183
|
+
r,
|
|
4119
4184
|
s
|
|
4120
4185
|
);
|
|
4121
|
-
if (
|
|
4186
|
+
if (g.error != null)
|
|
4122
4187
|
return {
|
|
4123
|
-
error:
|
|
4188
|
+
error: g.error
|
|
4124
4189
|
};
|
|
4125
|
-
d =
|
|
4190
|
+
d = g.domSnapshot, p = g.queryCreated, m = !0;
|
|
4126
4191
|
} else
|
|
4127
4192
|
return {
|
|
4128
4193
|
error: "Either snapshotName or snapshot must be provided"
|
|
4129
4194
|
};
|
|
4130
4195
|
try {
|
|
4131
|
-
const
|
|
4196
|
+
const g = o.parentUid, y = Nt({
|
|
4132
4197
|
tree: d.tree,
|
|
4133
4198
|
request: {
|
|
4134
|
-
parentNodeId:
|
|
4199
|
+
parentNodeId: g,
|
|
4135
4200
|
childsIndexRange: i,
|
|
4136
4201
|
limits: {
|
|
4137
4202
|
maxCountTotal: a,
|
|
@@ -4140,32 +4205,32 @@ async function ao(r, t, s) {
|
|
|
4140
4205
|
maxTokensGroup: u
|
|
4141
4206
|
}
|
|
4142
4207
|
},
|
|
4143
|
-
indexRangeGroupStrategy: new
|
|
4144
|
-
}), w =
|
|
4208
|
+
indexRangeGroupStrategy: new ho()
|
|
4209
|
+
}), w = kt(y);
|
|
4145
4210
|
return {
|
|
4146
4211
|
domSnapshot: d,
|
|
4147
4212
|
queryCreated: p,
|
|
4148
|
-
snapshotCreated:
|
|
4149
|
-
parentUid:
|
|
4213
|
+
snapshotCreated: m,
|
|
4214
|
+
parentUid: g,
|
|
4150
4215
|
childsIndexRange: i,
|
|
4151
4216
|
report: w
|
|
4152
4217
|
};
|
|
4153
|
-
} catch (
|
|
4218
|
+
} catch (g) {
|
|
4154
4219
|
return {
|
|
4155
|
-
error: `Failed to browse DOM snapshot: ${
|
|
4220
|
+
error: `Failed to browse DOM snapshot: ${g instanceof Error ? g.message : "Unknown error"}`
|
|
4156
4221
|
};
|
|
4157
4222
|
}
|
|
4158
4223
|
}
|
|
4159
|
-
function
|
|
4160
|
-
|
|
4224
|
+
function go(t, r) {
|
|
4225
|
+
t(
|
|
4161
4226
|
"playwright-dom-snapshot-browse",
|
|
4162
4227
|
{
|
|
4163
4228
|
title: "Browse DOM Snapshot",
|
|
4164
4229
|
description: "Browse and explore DOM. Use this to browse, analyze, explore, inspect, etc webpage structure and styles, find elements, or inspect page content",
|
|
4165
|
-
inputSchema:
|
|
4230
|
+
inputSchema: Qt.shape
|
|
4166
4231
|
},
|
|
4167
4232
|
async (s, o) => {
|
|
4168
|
-
const e = await
|
|
4233
|
+
const e = await mo(s, r, o);
|
|
4169
4234
|
if (e.error != null)
|
|
4170
4235
|
return `Method: playwright-dom-snapshot-browse(${JSON.stringify(s)})
|
|
4171
4236
|
❌ Error: ${e.error}`;
|
|
@@ -4186,14 +4251,14 @@ ${e.report}`, n;
|
|
|
4186
4251
|
}
|
|
4187
4252
|
);
|
|
4188
4253
|
}
|
|
4189
|
-
function
|
|
4190
|
-
|
|
4254
|
+
function wo(t, r) {
|
|
4255
|
+
r.browserCreate && Gs(t, r), r.browserList && Ws(t, r), r.browserClose && Hs(t, r), r.contextCreate && Qs(t, r), r.contextList && Vs(t, r), r.contextClose && Xs(t, r), r.pageCreate && ro(t, r), r.pageList && oo(t, r), r.pageClose && io(t, r), r.pageGoto && lo(t, r), r.domSnapshotQueryCreate && co(t, r), r.domSnapshotCreate && po(t, r), r.domSnapshotBrowse && go(t, r), console.log("Playwright manager");
|
|
4191
4256
|
}
|
|
4192
|
-
function
|
|
4193
|
-
const { logFilePath:
|
|
4257
|
+
function yo(t) {
|
|
4258
|
+
const { logFilePath: r } = t;
|
|
4194
4259
|
return async function(o, e, n, i) {
|
|
4195
4260
|
await ie({
|
|
4196
|
-
logFilePath:
|
|
4261
|
+
logFilePath: r,
|
|
4197
4262
|
message: "ERROR",
|
|
4198
4263
|
data: {
|
|
4199
4264
|
request: {
|
|
@@ -4211,15 +4276,15 @@ function uo(r) {
|
|
|
4211
4276
|
});
|
|
4212
4277
|
};
|
|
4213
4278
|
}
|
|
4214
|
-
const
|
|
4279
|
+
const it = [
|
|
4215
4280
|
"flemist-mcp.config.json",
|
|
4216
4281
|
"flemist-mcp.config.json5",
|
|
4217
4282
|
"flemist-mcp.config.yaml"
|
|
4218
4283
|
];
|
|
4219
|
-
async function
|
|
4220
|
-
const
|
|
4221
|
-
for (let s = 0, o =
|
|
4222
|
-
const e =
|
|
4284
|
+
async function bo(t) {
|
|
4285
|
+
const r = k.resolve(t);
|
|
4286
|
+
for (let s = 0, o = it.length; s < o; s++) {
|
|
4287
|
+
const e = it[s], n = k.join(r, e);
|
|
4223
4288
|
try {
|
|
4224
4289
|
await j.promises.stat(n);
|
|
4225
4290
|
} catch {
|
|
@@ -4237,30 +4302,32 @@ ${c instanceof Error ? c.message : String(c)}`);
|
|
|
4237
4302
|
const a = k.extname(e);
|
|
4238
4303
|
try {
|
|
4239
4304
|
if (a === ".json")
|
|
4240
|
-
return
|
|
4305
|
+
return Ne.parse(i);
|
|
4241
4306
|
if (a === ".json5")
|
|
4242
|
-
return
|
|
4307
|
+
return Ne.parse(i);
|
|
4243
4308
|
if (a === ".yaml")
|
|
4244
|
-
return
|
|
4309
|
+
return dr.load(i);
|
|
4245
4310
|
} catch (c) {
|
|
4246
4311
|
throw new Error(`MCP Error: Failed to parse config file: ${n}
|
|
4247
4312
|
|
|
4248
4313
|
${c instanceof Error ? c.message : String(c)}`);
|
|
4249
4314
|
}
|
|
4250
4315
|
}
|
|
4251
|
-
throw new Error(`MCP Error: No configuration file found in: ${
|
|
4316
|
+
throw new Error(`MCP Error: No configuration file found in: ${r}
|
|
4252
4317
|
|
|
4253
4318
|
Expected one of:
|
|
4254
4319
|
- flemist-mcp.config.json
|
|
4255
4320
|
- flemist-mcp.config.json5
|
|
4256
4321
|
- flemist-mcp.config.yaml`);
|
|
4257
4322
|
}
|
|
4258
|
-
const
|
|
4323
|
+
const So = {
|
|
4259
4324
|
logDir: "tmp/mcp-project-tools/logs",
|
|
4260
4325
|
tools: {
|
|
4261
4326
|
processManager: {
|
|
4262
4327
|
workingDir: null,
|
|
4263
4328
|
commandLineRules: [],
|
|
4329
|
+
env: null,
|
|
4330
|
+
envCleanup: null,
|
|
4264
4331
|
run: !0,
|
|
4265
4332
|
status: !0,
|
|
4266
4333
|
wait: !0,
|
|
@@ -4294,23 +4361,29 @@ const po = {
|
|
|
4294
4361
|
}
|
|
4295
4362
|
}
|
|
4296
4363
|
};
|
|
4297
|
-
async function
|
|
4298
|
-
const
|
|
4364
|
+
async function xo(t) {
|
|
4365
|
+
const r = k.resolve(t), s = await bo(r), o = k.join(r, ".flemist-mcpignore");
|
|
4299
4366
|
try {
|
|
4300
4367
|
await j.promises.stat(o);
|
|
4301
4368
|
} catch {
|
|
4302
4369
|
throw new Error(`MCP Error: .flemist-mcpignore file not found in project directory.
|
|
4303
4370
|
|
|
4304
|
-
Create .flemist-mcpignore file in: ${
|
|
4371
|
+
Create .flemist-mcpignore file in: ${r}
|
|
4305
4372
|
|
|
4306
4373
|
This file contains glob patterns for files/directories to exclude from MCP operations.`);
|
|
4307
4374
|
}
|
|
4308
|
-
const e =
|
|
4375
|
+
const e = ur(So, s, {
|
|
4309
4376
|
arrayMerge(n, i) {
|
|
4310
4377
|
return i;
|
|
4311
4378
|
}
|
|
4312
4379
|
});
|
|
4313
|
-
return e.tools?.processManager &&
|
|
4380
|
+
return e.tools?.processManager && (e.tools.processManager.workingDir = k.resolve(
|
|
4381
|
+
r,
|
|
4382
|
+
e.tools.processManager.workingDir || ""
|
|
4383
|
+
)), e.tools?.fsManager && (e.tools.fsManager.workingDir = k.resolve(
|
|
4384
|
+
r,
|
|
4385
|
+
e.tools.fsManager.workingDir || ""
|
|
4386
|
+
)), e.tools?.fsManager && (e.tools.fsManager.globsExclude = [
|
|
4314
4387
|
{
|
|
4315
4388
|
value: o,
|
|
4316
4389
|
valueType: "file-contains-patterns",
|
|
@@ -4318,34 +4391,34 @@ This file contains glob patterns for files/directories to exclude from MCP opera
|
|
|
4318
4391
|
},
|
|
4319
4392
|
...e.tools.fsManager.globsExclude || []
|
|
4320
4393
|
]), e.tools.fsManager?.globsExclude?.forEach((n, i, a) => {
|
|
4321
|
-
n.valueType === "file-contains-patterns" && (a[i].value = k.resolve(
|
|
4322
|
-
}), e.logDir = k.resolve(
|
|
4394
|
+
n.valueType === "file-contains-patterns" && (a[i].value = k.resolve(r, n.value));
|
|
4395
|
+
}), e.logDir = k.resolve(r, e.logDir), e;
|
|
4323
4396
|
}
|
|
4324
|
-
function
|
|
4397
|
+
function Yt() {
|
|
4325
4398
|
return `mcp_${(/* @__PURE__ */ new Date()).toISOString().substring(0, 19).replace(/T/, "_").replace(/:/g, "-")}.log`;
|
|
4326
4399
|
}
|
|
4327
|
-
function
|
|
4328
|
-
const
|
|
4329
|
-
return
|
|
4400
|
+
function $o(t) {
|
|
4401
|
+
const r = ne(), s = Io();
|
|
4402
|
+
return r.use(s), r;
|
|
4330
4403
|
}
|
|
4331
|
-
function
|
|
4332
|
-
const
|
|
4333
|
-
return
|
|
4404
|
+
function Io(t) {
|
|
4405
|
+
const r = ne.Router();
|
|
4406
|
+
return r.use((s, o, e) => {
|
|
4334
4407
|
s.method === "OPTIONS" ? o.status(403).send("CORS forbidden") : e();
|
|
4335
|
-
}),
|
|
4408
|
+
}), r.use(ne.json()), r;
|
|
4336
4409
|
}
|
|
4337
|
-
function
|
|
4338
|
-
const
|
|
4339
|
-
return
|
|
4410
|
+
function Mo(t) {
|
|
4411
|
+
const r = ne.Router();
|
|
4412
|
+
return r.use(fr({ authToken: t.authToken })), r.all("/mcp", wr(t)), r;
|
|
4340
4413
|
}
|
|
4341
|
-
function
|
|
4342
|
-
return
|
|
4414
|
+
function To(t, r) {
|
|
4415
|
+
return t.use(yo({ logFilePath: r.logFilePath })), new Promise((s, o) => {
|
|
4343
4416
|
let e;
|
|
4344
4417
|
const n = () => {
|
|
4345
4418
|
s(e);
|
|
4346
4419
|
};
|
|
4347
4420
|
try {
|
|
4348
|
-
e =
|
|
4421
|
+
e = r.host ? t.listen(r.port ?? 0, r.host, n) : t.listen(r.port ?? 0, n), e.addListener("error", (i) => {
|
|
4349
4422
|
o(i);
|
|
4350
4423
|
});
|
|
4351
4424
|
} catch (i) {
|
|
@@ -4353,40 +4426,40 @@ function yo(r, t) {
|
|
|
4353
4426
|
}
|
|
4354
4427
|
});
|
|
4355
4428
|
}
|
|
4356
|
-
function
|
|
4357
|
-
if (!
|
|
4429
|
+
function Co(t, r) {
|
|
4430
|
+
if (!t.address())
|
|
4358
4431
|
throw new Error(
|
|
4359
4432
|
"Server address is not available. Check your DNS and host configuration."
|
|
4360
4433
|
);
|
|
4361
|
-
const o =
|
|
4362
|
-
let n =
|
|
4434
|
+
const o = t.address().family, e = t.address().port;
|
|
4435
|
+
let n = t.address().address;
|
|
4363
4436
|
n === "::" ? n = "localhost" : o === "IPv6" && (n = `[${n}]`);
|
|
4364
4437
|
const i = `http://${o === "IPv6" ? `[${n}]` : n}:${e}`;
|
|
4365
4438
|
return `Project Tools - MCP Server Started
|
|
4366
4439
|
|
|
4367
|
-
Server Name: ${
|
|
4368
|
-
Server Version: ${
|
|
4440
|
+
Server Name: ${r.name}
|
|
4441
|
+
Server Version: ${r.version}
|
|
4369
4442
|
Server URL: ${i}/mcp
|
|
4370
4443
|
SSE Endpoint: ${i}/sse
|
|
4371
4444
|
|
|
4372
|
-
Log File: ${k.resolve(
|
|
4445
|
+
Log File: ${k.resolve(r.logFilePath)}`;
|
|
4373
4446
|
}
|
|
4374
|
-
function
|
|
4375
|
-
const s = k.join(
|
|
4447
|
+
function vo(t, r) {
|
|
4448
|
+
const s = k.join(r.logDir, Yt()), o = _r(t, {
|
|
4376
4449
|
logFilePath: s
|
|
4377
4450
|
});
|
|
4378
|
-
|
|
4451
|
+
r.tools.processManager && qr(
|
|
4379
4452
|
o,
|
|
4380
|
-
|
|
4381
|
-
),
|
|
4453
|
+
r.tools.processManager
|
|
4454
|
+
), r.tools.fsManager && _s(o, r.tools.fsManager), r.tools.playwrightManager && wo(
|
|
4382
4455
|
o,
|
|
4383
|
-
|
|
4384
|
-
),
|
|
4456
|
+
r.tools.playwrightManager
|
|
4457
|
+
), Dr(o);
|
|
4385
4458
|
}
|
|
4386
|
-
async function
|
|
4387
|
-
const
|
|
4388
|
-
authToken:
|
|
4389
|
-
logFilePath:
|
|
4459
|
+
async function Ho(t) {
|
|
4460
|
+
const r = k.join(t.logDir, Yt()), s = $o(), o = Mo({
|
|
4461
|
+
authToken: t.authToken,
|
|
4462
|
+
logFilePath: r,
|
|
4390
4463
|
createMcpServer: async (n) => {
|
|
4391
4464
|
const i = n.headers["x-project-name"];
|
|
4392
4465
|
if (!i)
|
|
@@ -4400,42 +4473,42 @@ X-Project-Name header is missing. To configure MCP for this project:
|
|
|
4400
4473
|
4. Create .mcp.json in project root with X-Project-Name header set to project name
|
|
4401
4474
|
5. Ask user to add project to server's projects config if not already present
|
|
4402
4475
|
6. Ask user to restart Claude Code`);
|
|
4403
|
-
const a =
|
|
4476
|
+
const a = t.projects[i];
|
|
4404
4477
|
if (!a)
|
|
4405
4478
|
throw new Error(`MCP Error: Project "${i}" not found in server configuration.
|
|
4406
4479
|
|
|
4407
4480
|
Ask user to:
|
|
4408
4481
|
1. Add project to server's projects config: projects: { "${i}": "<project-path>" }
|
|
4409
4482
|
2. Restart MCP server`);
|
|
4410
|
-
const c = await
|
|
4411
|
-
title:
|
|
4412
|
-
name:
|
|
4413
|
-
version:
|
|
4483
|
+
const c = await xo(a), l = new Vt({
|
|
4484
|
+
title: t.title,
|
|
4485
|
+
name: t.name,
|
|
4486
|
+
version: t.version
|
|
4414
4487
|
});
|
|
4415
|
-
return
|
|
4488
|
+
return vo(l, c), l;
|
|
4416
4489
|
}
|
|
4417
4490
|
});
|
|
4418
4491
|
s.use(o);
|
|
4419
|
-
const e = await
|
|
4420
|
-
host:
|
|
4421
|
-
port:
|
|
4422
|
-
logFilePath:
|
|
4492
|
+
const e = await To(s, {
|
|
4493
|
+
host: t.host,
|
|
4494
|
+
port: t.port,
|
|
4495
|
+
logFilePath: r
|
|
4423
4496
|
});
|
|
4424
4497
|
return console.log(
|
|
4425
|
-
|
|
4426
|
-
title:
|
|
4427
|
-
name:
|
|
4428
|
-
version:
|
|
4429
|
-
logFilePath:
|
|
4498
|
+
Co(e, {
|
|
4499
|
+
title: t.title,
|
|
4500
|
+
name: t.name,
|
|
4501
|
+
version: t.version,
|
|
4502
|
+
logFilePath: r
|
|
4430
4503
|
})
|
|
4431
4504
|
), e;
|
|
4432
4505
|
}
|
|
4433
4506
|
export {
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4507
|
+
Ko as A,
|
|
4508
|
+
Wo as S,
|
|
4509
|
+
Jo as a,
|
|
4510
|
+
Go as b,
|
|
4511
|
+
bo as l,
|
|
4512
|
+
ts as p,
|
|
4513
|
+
Ho as s
|
|
4441
4514
|
};
|