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