@probelabs/probe 0.6.0-rc173 → 0.6.0-rc175
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/agent/ProbeAgent.d.ts +6 -0
- package/build/agent/ProbeAgent.js +69 -1
- package/build/agent/index.js +418 -281
- package/build/agent/probeTool.js +4 -13
- package/build/downloader.js +6 -2
- package/build/extract.js +13 -5
- package/build/extractor.js +6 -2
- package/build/query.js +9 -2
- package/build/search.js +10 -2
- package/build/tools/bash.js +5 -5
- package/build/tools/edit.js +7 -7
- package/build/tools/langchain.js +12 -3
- package/build/tools/vercel.js +25 -29
- package/build/utils/file-lister.js +9 -2
- package/build/utils/path-validation.js +58 -0
- package/build/utils/symlink-utils.js +63 -0
- package/cjs/agent/ProbeAgent.cjs +515 -376
- package/cjs/index.cjs +535 -387
- package/index.d.ts +12 -1
- package/package.json +2 -2
- package/src/agent/ProbeAgent.d.ts +6 -0
- package/src/agent/ProbeAgent.js +69 -1
- package/src/agent/probeTool.js +4 -13
- package/src/downloader.js +6 -2
- package/src/extract.js +13 -5
- package/src/extractor.js +6 -2
- package/src/query.js +9 -2
- package/src/search.js +10 -2
- package/src/tools/bash.js +5 -5
- package/src/tools/edit.js +7 -7
- package/src/tools/langchain.js +12 -3
- package/src/tools/vercel.js +25 -29
- package/src/utils/file-lister.js +9 -2
- package/src/utils/path-validation.js +58 -0
- package/src/utils/symlink-utils.js +63 -0
package/cjs/index.cjs
CHANGED
|
@@ -104,8 +104,8 @@ var require_package = __commonJS({
|
|
|
104
104
|
// node_modules/dotenv/lib/main.js
|
|
105
105
|
var require_main = __commonJS({
|
|
106
106
|
"node_modules/dotenv/lib/main.js"(exports2, module2) {
|
|
107
|
-
var
|
|
108
|
-
var
|
|
107
|
+
var fs10 = require("fs");
|
|
108
|
+
var path9 = require("path");
|
|
109
109
|
var os4 = require("os");
|
|
110
110
|
var crypto2 = require("crypto");
|
|
111
111
|
var packageJson = require_package();
|
|
@@ -213,7 +213,7 @@ var require_main = __commonJS({
|
|
|
213
213
|
if (options && options.path && options.path.length > 0) {
|
|
214
214
|
if (Array.isArray(options.path)) {
|
|
215
215
|
for (const filepath of options.path) {
|
|
216
|
-
if (
|
|
216
|
+
if (fs10.existsSync(filepath)) {
|
|
217
217
|
possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
|
|
218
218
|
}
|
|
219
219
|
}
|
|
@@ -221,15 +221,15 @@ var require_main = __commonJS({
|
|
|
221
221
|
possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
|
|
222
222
|
}
|
|
223
223
|
} else {
|
|
224
|
-
possibleVaultPath =
|
|
224
|
+
possibleVaultPath = path9.resolve(process.cwd(), ".env.vault");
|
|
225
225
|
}
|
|
226
|
-
if (
|
|
226
|
+
if (fs10.existsSync(possibleVaultPath)) {
|
|
227
227
|
return possibleVaultPath;
|
|
228
228
|
}
|
|
229
229
|
return null;
|
|
230
230
|
}
|
|
231
231
|
function _resolveHome(envPath) {
|
|
232
|
-
return envPath[0] === "~" ?
|
|
232
|
+
return envPath[0] === "~" ? path9.join(os4.homedir(), envPath.slice(1)) : envPath;
|
|
233
233
|
}
|
|
234
234
|
function _configVault(options) {
|
|
235
235
|
const debug = Boolean(options && options.debug);
|
|
@@ -246,7 +246,7 @@ var require_main = __commonJS({
|
|
|
246
246
|
return { parsed };
|
|
247
247
|
}
|
|
248
248
|
function configDotenv(options) {
|
|
249
|
-
const dotenvPath =
|
|
249
|
+
const dotenvPath = path9.resolve(process.cwd(), ".env");
|
|
250
250
|
let encoding = "utf8";
|
|
251
251
|
const debug = Boolean(options && options.debug);
|
|
252
252
|
const quiet = options && "quiet" in options ? options.quiet : true;
|
|
@@ -270,13 +270,13 @@ var require_main = __commonJS({
|
|
|
270
270
|
}
|
|
271
271
|
let lastError;
|
|
272
272
|
const parsedAll = {};
|
|
273
|
-
for (const
|
|
273
|
+
for (const path10 of optionPaths) {
|
|
274
274
|
try {
|
|
275
|
-
const parsed = DotenvModule.parse(
|
|
275
|
+
const parsed = DotenvModule.parse(fs10.readFileSync(path10, { encoding }));
|
|
276
276
|
DotenvModule.populate(parsedAll, parsed, options);
|
|
277
277
|
} catch (e4) {
|
|
278
278
|
if (debug) {
|
|
279
|
-
_debug(`Failed to load ${
|
|
279
|
+
_debug(`Failed to load ${path10} ${e4.message}`);
|
|
280
280
|
}
|
|
281
281
|
lastError = e4;
|
|
282
282
|
}
|
|
@@ -291,7 +291,7 @@ var require_main = __commonJS({
|
|
|
291
291
|
const shortPaths = [];
|
|
292
292
|
for (const filePath of optionPaths) {
|
|
293
293
|
try {
|
|
294
|
-
const relative =
|
|
294
|
+
const relative = path9.relative(process.cwd(), filePath);
|
|
295
295
|
shortPaths.push(relative);
|
|
296
296
|
} catch (e4) {
|
|
297
297
|
if (debug) {
|
|
@@ -563,6 +563,48 @@ var init_directory_resolver = __esm({
|
|
|
563
563
|
}
|
|
564
564
|
});
|
|
565
565
|
|
|
566
|
+
// src/utils/symlink-utils.js
|
|
567
|
+
async function getEntryType(entry, fullPath) {
|
|
568
|
+
try {
|
|
569
|
+
const stats = await import_fs2.promises.stat(fullPath);
|
|
570
|
+
return {
|
|
571
|
+
isFile: stats.isFile(),
|
|
572
|
+
isDirectory: stats.isDirectory(),
|
|
573
|
+
size: stats.size
|
|
574
|
+
};
|
|
575
|
+
} catch {
|
|
576
|
+
return {
|
|
577
|
+
isFile: entry.isFile(),
|
|
578
|
+
isDirectory: entry.isDirectory(),
|
|
579
|
+
size: 0
|
|
580
|
+
};
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
function getEntryTypeSync(entry, fullPath) {
|
|
584
|
+
try {
|
|
585
|
+
const stats = import_fs.default.statSync(fullPath);
|
|
586
|
+
return {
|
|
587
|
+
isFile: stats.isFile(),
|
|
588
|
+
isDirectory: stats.isDirectory(),
|
|
589
|
+
size: stats.size
|
|
590
|
+
};
|
|
591
|
+
} catch {
|
|
592
|
+
return {
|
|
593
|
+
isFile: entry.isFile(),
|
|
594
|
+
isDirectory: entry.isDirectory(),
|
|
595
|
+
size: 0
|
|
596
|
+
};
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
var import_fs, import_fs2;
|
|
600
|
+
var init_symlink_utils = __esm({
|
|
601
|
+
"src/utils/symlink-utils.js"() {
|
|
602
|
+
"use strict";
|
|
603
|
+
import_fs = __toESM(require("fs"), 1);
|
|
604
|
+
import_fs2 = require("fs");
|
|
605
|
+
}
|
|
606
|
+
});
|
|
607
|
+
|
|
566
608
|
// src/downloader.js
|
|
567
609
|
function sanitizeError(err) {
|
|
568
610
|
try {
|
|
@@ -1077,10 +1119,11 @@ async function extractBinary(assetPath, outputDir) {
|
|
|
1077
1119
|
const entries = await import_fs_extra2.default.readdir(dir, { withFileTypes: true });
|
|
1078
1120
|
for (const entry of entries) {
|
|
1079
1121
|
const fullPath = import_path2.default.join(dir, entry.name);
|
|
1080
|
-
|
|
1122
|
+
const entryType = await getEntryType(entry, fullPath);
|
|
1123
|
+
if (entryType.isDirectory) {
|
|
1081
1124
|
const result = await findBinary(fullPath);
|
|
1082
1125
|
if (result) return result;
|
|
1083
|
-
} else if (
|
|
1126
|
+
} else if (entryType.isFile) {
|
|
1084
1127
|
if (entry.name === binaryName || entry.name === BINARY_NAME || isWindows && entry.name.endsWith(".exe")) {
|
|
1085
1128
|
return fullPath;
|
|
1086
1129
|
}
|
|
@@ -1293,6 +1336,7 @@ var init_downloader = __esm({
|
|
|
1293
1336
|
import_url2 = require("url");
|
|
1294
1337
|
init_utils();
|
|
1295
1338
|
init_directory_resolver();
|
|
1339
|
+
init_symlink_utils();
|
|
1296
1340
|
exec = (0, import_util.promisify)(import_child_process.exec);
|
|
1297
1341
|
REPO_OWNER = "probelabs";
|
|
1298
1342
|
REPO_NAME = "probe";
|
|
@@ -1384,6 +1428,32 @@ var init_utils = __esm({
|
|
|
1384
1428
|
}
|
|
1385
1429
|
});
|
|
1386
1430
|
|
|
1431
|
+
// src/utils/path-validation.js
|
|
1432
|
+
async function validateCwdPath(inputPath, defaultPath = process.cwd()) {
|
|
1433
|
+
const targetPath = inputPath || defaultPath;
|
|
1434
|
+
const normalizedPath = import_path4.default.normalize(import_path4.default.resolve(targetPath));
|
|
1435
|
+
try {
|
|
1436
|
+
const stats = await import_fs3.promises.stat(normalizedPath);
|
|
1437
|
+
if (!stats.isDirectory()) {
|
|
1438
|
+
throw new Error(`Path is not a directory: ${normalizedPath}`);
|
|
1439
|
+
}
|
|
1440
|
+
} catch (error2) {
|
|
1441
|
+
if (error2.code === "ENOENT") {
|
|
1442
|
+
throw new Error(`Path does not exist: ${normalizedPath}`);
|
|
1443
|
+
}
|
|
1444
|
+
throw error2;
|
|
1445
|
+
}
|
|
1446
|
+
return normalizedPath;
|
|
1447
|
+
}
|
|
1448
|
+
var import_path4, import_fs3;
|
|
1449
|
+
var init_path_validation = __esm({
|
|
1450
|
+
"src/utils/path-validation.js"() {
|
|
1451
|
+
"use strict";
|
|
1452
|
+
import_path4 = __toESM(require("path"), 1);
|
|
1453
|
+
import_fs3 = require("fs");
|
|
1454
|
+
}
|
|
1455
|
+
});
|
|
1456
|
+
|
|
1387
1457
|
// src/search.js
|
|
1388
1458
|
async function search(options) {
|
|
1389
1459
|
if (!options || !options.path) {
|
|
@@ -1423,9 +1493,11 @@ async function search(options) {
|
|
|
1423
1493
|
options.session = process.env.PROBE_SESSION_ID;
|
|
1424
1494
|
}
|
|
1425
1495
|
const queries = Array.isArray(options.query) ? options.query : [options.query];
|
|
1496
|
+
const cwd = await validateCwdPath(options.cwd);
|
|
1426
1497
|
if (process.env.DEBUG === "1") {
|
|
1427
1498
|
let logMessage = `
|
|
1428
1499
|
Search: query="${queries[0]}" path="${options.path}"`;
|
|
1500
|
+
if (options.cwd) logMessage += ` cwd="${options.cwd}"`;
|
|
1429
1501
|
if (options.maxResults) logMessage += ` maxResults=${options.maxResults}`;
|
|
1430
1502
|
logMessage += ` maxTokens=${options.maxTokens}`;
|
|
1431
1503
|
logMessage += ` timeout=${options.timeout}`;
|
|
@@ -1445,6 +1517,7 @@ Search: query="${queries[0]}" path="${options.path}"`;
|
|
|
1445
1517
|
}
|
|
1446
1518
|
try {
|
|
1447
1519
|
const { stdout, stderr } = await execFileAsync(binaryPath, args, {
|
|
1520
|
+
cwd,
|
|
1448
1521
|
timeout: options.timeout * 1e3,
|
|
1449
1522
|
// Convert seconds to milliseconds
|
|
1450
1523
|
maxBuffer: 50 * 1024 * 1024
|
|
@@ -1498,13 +1571,15 @@ Search results: ${resultCount} matches, ${tokenCount} tokens`;
|
|
|
1498
1571
|
if (error2.code === "ETIMEDOUT" || error2.killed) {
|
|
1499
1572
|
const timeoutMessage = `Search operation timed out after ${options.timeout} seconds.
|
|
1500
1573
|
Binary: ${binaryPath}
|
|
1501
|
-
Args: ${args.join(" ")}
|
|
1574
|
+
Args: ${args.join(" ")}
|
|
1575
|
+
Cwd: ${cwd}`;
|
|
1502
1576
|
console.error(timeoutMessage);
|
|
1503
1577
|
throw new Error(timeoutMessage);
|
|
1504
1578
|
}
|
|
1505
1579
|
const errorMessage = `Error executing search command: ${error2.message}
|
|
1506
1580
|
Binary: ${binaryPath}
|
|
1507
|
-
Args: ${args.join(" ")}
|
|
1581
|
+
Args: ${args.join(" ")}
|
|
1582
|
+
Cwd: ${cwd}`;
|
|
1508
1583
|
throw new Error(errorMessage);
|
|
1509
1584
|
}
|
|
1510
1585
|
}
|
|
@@ -1515,6 +1590,7 @@ var init_search = __esm({
|
|
|
1515
1590
|
import_child_process2 = require("child_process");
|
|
1516
1591
|
import_util2 = require("util");
|
|
1517
1592
|
init_utils();
|
|
1593
|
+
init_path_validation();
|
|
1518
1594
|
execFileAsync = (0, import_util2.promisify)(import_child_process2.execFile);
|
|
1519
1595
|
SEARCH_FLAG_MAP = {
|
|
1520
1596
|
filesOnly: "--files-only",
|
|
@@ -1552,8 +1628,10 @@ async function query(options) {
|
|
|
1552
1628
|
cliArgs.push("--format", "json");
|
|
1553
1629
|
}
|
|
1554
1630
|
cliArgs.push(escapeString(options.pattern), escapeString(options.path));
|
|
1631
|
+
const cwd = await validateCwdPath(options.cwd);
|
|
1555
1632
|
if (process.env.DEBUG === "1") {
|
|
1556
1633
|
let logMessage = `Query: pattern="${options.pattern}" path="${options.path}"`;
|
|
1634
|
+
if (options.cwd) logMessage += ` cwd="${options.cwd}"`;
|
|
1557
1635
|
if (options.language) logMessage += ` language=${options.language}`;
|
|
1558
1636
|
if (options.maxResults) logMessage += ` maxResults=${options.maxResults}`;
|
|
1559
1637
|
if (options.allowTests) logMessage += " allowTests=true";
|
|
@@ -1561,7 +1639,7 @@ async function query(options) {
|
|
|
1561
1639
|
}
|
|
1562
1640
|
const command = `${binaryPath} query ${cliArgs.join(" ")}`;
|
|
1563
1641
|
try {
|
|
1564
|
-
const { stdout, stderr } = await execAsync(command);
|
|
1642
|
+
const { stdout, stderr } = await execAsync(command, { cwd });
|
|
1565
1643
|
if (stderr) {
|
|
1566
1644
|
console.error(`stderr: ${stderr}`);
|
|
1567
1645
|
}
|
|
@@ -1586,7 +1664,8 @@ async function query(options) {
|
|
|
1586
1664
|
return stdout;
|
|
1587
1665
|
} catch (error2) {
|
|
1588
1666
|
const errorMessage = `Error executing query command: ${error2.message}
|
|
1589
|
-
Command: ${command}
|
|
1667
|
+
Command: ${command}
|
|
1668
|
+
Cwd: ${cwd}`;
|
|
1590
1669
|
throw new Error(errorMessage);
|
|
1591
1670
|
}
|
|
1592
1671
|
}
|
|
@@ -1597,6 +1676,7 @@ var init_query = __esm({
|
|
|
1597
1676
|
import_child_process3 = require("child_process");
|
|
1598
1677
|
import_util3 = require("util");
|
|
1599
1678
|
init_utils();
|
|
1679
|
+
init_path_validation();
|
|
1600
1680
|
execAsync = (0, import_util3.promisify)(import_child_process3.exec);
|
|
1601
1681
|
QUERY_FLAG_MAP = {
|
|
1602
1682
|
language: "--language",
|
|
@@ -1631,6 +1711,7 @@ async function extract(options) {
|
|
|
1631
1711
|
cliArgs.push(escapeString(file));
|
|
1632
1712
|
}
|
|
1633
1713
|
}
|
|
1714
|
+
const cwd = await validateCwdPath(options.cwd);
|
|
1634
1715
|
if (process.env.DEBUG === "1") {
|
|
1635
1716
|
let logMessage = `
|
|
1636
1717
|
Extract:`;
|
|
@@ -1639,6 +1720,7 @@ Extract:`;
|
|
|
1639
1720
|
}
|
|
1640
1721
|
if (options.inputFile) logMessage += ` inputFile="${options.inputFile}"`;
|
|
1641
1722
|
if (options.content) logMessage += ` content=(${typeof options.content === "string" ? options.content.length : options.content.byteLength} bytes)`;
|
|
1723
|
+
if (options.cwd) logMessage += ` cwd="${cwd}"`;
|
|
1642
1724
|
if (options.allowTests) logMessage += " allowTests=true";
|
|
1643
1725
|
if (options.contextLines) logMessage += ` contextLines=${options.contextLines}`;
|
|
1644
1726
|
if (options.format) logMessage += ` format=${options.format}`;
|
|
@@ -1646,25 +1728,27 @@ Extract:`;
|
|
|
1646
1728
|
console.error(logMessage);
|
|
1647
1729
|
}
|
|
1648
1730
|
if (hasContent) {
|
|
1649
|
-
return extractWithStdin(binaryPath, cliArgs, options.content, options);
|
|
1731
|
+
return extractWithStdin(binaryPath, cliArgs, options.content, options, cwd);
|
|
1650
1732
|
}
|
|
1651
1733
|
const command = `${binaryPath} extract ${cliArgs.join(" ")}`;
|
|
1652
1734
|
try {
|
|
1653
|
-
const { stdout, stderr } = await execAsync2(command);
|
|
1735
|
+
const { stdout, stderr } = await execAsync2(command, { cwd });
|
|
1654
1736
|
if (stderr) {
|
|
1655
1737
|
console.error(`stderr: ${stderr}`);
|
|
1656
1738
|
}
|
|
1657
1739
|
return processExtractOutput(stdout, options);
|
|
1658
1740
|
} catch (error2) {
|
|
1659
1741
|
const errorMessage = `Error executing extract command: ${error2.message}
|
|
1660
|
-
Command: ${command}
|
|
1742
|
+
Command: ${command}
|
|
1743
|
+
Cwd: ${cwd}`;
|
|
1661
1744
|
throw new Error(errorMessage);
|
|
1662
1745
|
}
|
|
1663
1746
|
}
|
|
1664
|
-
function extractWithStdin(binaryPath, cliArgs, content, options) {
|
|
1747
|
+
function extractWithStdin(binaryPath, cliArgs, content, options, cwd) {
|
|
1665
1748
|
return new Promise((resolve5, reject2) => {
|
|
1666
1749
|
const childProcess = (0, import_child_process4.spawn)(binaryPath, ["extract", ...cliArgs], {
|
|
1667
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
1750
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
1751
|
+
cwd
|
|
1668
1752
|
});
|
|
1669
1753
|
let stdout = "";
|
|
1670
1754
|
let stderr = "";
|
|
@@ -1755,6 +1839,7 @@ var init_extract = __esm({
|
|
|
1755
1839
|
import_child_process4 = require("child_process");
|
|
1756
1840
|
import_util4 = require("util");
|
|
1757
1841
|
init_utils();
|
|
1842
|
+
init_path_validation();
|
|
1758
1843
|
execAsync2 = (0, import_util4.promisify)(import_child_process4.exec);
|
|
1759
1844
|
EXTRACT_FLAG_MAP = {
|
|
1760
1845
|
allowTests: "--allow-tests",
|
|
@@ -3126,9 +3211,9 @@ var init_createPaginator = __esm({
|
|
|
3126
3211
|
command = withCommand(command) ?? command;
|
|
3127
3212
|
return await client.send(command, ...args);
|
|
3128
3213
|
};
|
|
3129
|
-
get = (fromObject,
|
|
3214
|
+
get = (fromObject, path9) => {
|
|
3130
3215
|
let cursor2 = fromObject;
|
|
3131
|
-
const pathComponents =
|
|
3216
|
+
const pathComponents = path9.split(".");
|
|
3132
3217
|
for (const step of pathComponents) {
|
|
3133
3218
|
if (!cursor2 || typeof cursor2 !== "object") {
|
|
3134
3219
|
return void 0;
|
|
@@ -4091,12 +4176,12 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
4091
4176
|
const password = request.password ?? "";
|
|
4092
4177
|
auth = `${username}:${password}`;
|
|
4093
4178
|
}
|
|
4094
|
-
let
|
|
4179
|
+
let path9 = request.path;
|
|
4095
4180
|
if (queryString) {
|
|
4096
|
-
|
|
4181
|
+
path9 += `?${queryString}`;
|
|
4097
4182
|
}
|
|
4098
4183
|
if (request.fragment) {
|
|
4099
|
-
|
|
4184
|
+
path9 += `#${request.fragment}`;
|
|
4100
4185
|
}
|
|
4101
4186
|
let hostname = request.hostname ?? "";
|
|
4102
4187
|
if (hostname[0] === "[" && hostname.endsWith("]")) {
|
|
@@ -4108,7 +4193,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
4108
4193
|
headers: request.headers,
|
|
4109
4194
|
host: hostname,
|
|
4110
4195
|
method: request.method,
|
|
4111
|
-
path:
|
|
4196
|
+
path: path9,
|
|
4112
4197
|
port: request.port,
|
|
4113
4198
|
agent,
|
|
4114
4199
|
auth
|
|
@@ -4363,16 +4448,16 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
4363
4448
|
reject2(err);
|
|
4364
4449
|
};
|
|
4365
4450
|
const queryString = querystringBuilder.buildQueryString(query2 || {});
|
|
4366
|
-
let
|
|
4451
|
+
let path9 = request.path;
|
|
4367
4452
|
if (queryString) {
|
|
4368
|
-
|
|
4453
|
+
path9 += `?${queryString}`;
|
|
4369
4454
|
}
|
|
4370
4455
|
if (request.fragment) {
|
|
4371
|
-
|
|
4456
|
+
path9 += `#${request.fragment}`;
|
|
4372
4457
|
}
|
|
4373
4458
|
const req = session.request({
|
|
4374
4459
|
...request.headers,
|
|
4375
|
-
[http2.constants.HTTP2_HEADER_PATH]:
|
|
4460
|
+
[http2.constants.HTTP2_HEADER_PATH]: path9,
|
|
4376
4461
|
[http2.constants.HTTP2_HEADER_METHOD]: method
|
|
4377
4462
|
});
|
|
4378
4463
|
session.ref();
|
|
@@ -4561,13 +4646,13 @@ var require_dist_cjs16 = __commonJS({
|
|
|
4561
4646
|
abortError.name = "AbortError";
|
|
4562
4647
|
return Promise.reject(abortError);
|
|
4563
4648
|
}
|
|
4564
|
-
let
|
|
4649
|
+
let path9 = request.path;
|
|
4565
4650
|
const queryString = querystringBuilder.buildQueryString(request.query || {});
|
|
4566
4651
|
if (queryString) {
|
|
4567
|
-
|
|
4652
|
+
path9 += `?${queryString}`;
|
|
4568
4653
|
}
|
|
4569
4654
|
if (request.fragment) {
|
|
4570
|
-
|
|
4655
|
+
path9 += `#${request.fragment}`;
|
|
4571
4656
|
}
|
|
4572
4657
|
let auth = "";
|
|
4573
4658
|
if (request.username != null || request.password != null) {
|
|
@@ -4576,7 +4661,7 @@ var require_dist_cjs16 = __commonJS({
|
|
|
4576
4661
|
auth = `${username}:${password}@`;
|
|
4577
4662
|
}
|
|
4578
4663
|
const { port, method } = request;
|
|
4579
|
-
const url = `${request.protocol}//${auth}${request.hostname}${port ? `:${port}` : ""}${
|
|
4664
|
+
const url = `${request.protocol}//${auth}${request.hostname}${port ? `:${port}` : ""}${path9}`;
|
|
4580
4665
|
const body = method === "GET" || method === "HEAD" ? void 0 : request.body;
|
|
4581
4666
|
const requestOptions = {
|
|
4582
4667
|
body,
|
|
@@ -6638,13 +6723,13 @@ function __disposeResources(env) {
|
|
|
6638
6723
|
}
|
|
6639
6724
|
return next();
|
|
6640
6725
|
}
|
|
6641
|
-
function __rewriteRelativeImportExtension(
|
|
6642
|
-
if (typeof
|
|
6643
|
-
return
|
|
6726
|
+
function __rewriteRelativeImportExtension(path9, preserveJsx) {
|
|
6727
|
+
if (typeof path9 === "string" && /^\.\.?\//.test(path9)) {
|
|
6728
|
+
return path9.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(m4, tsx, d4, ext2, cm) {
|
|
6644
6729
|
return tsx ? preserveJsx ? ".jsx" : ".js" : d4 && (!ext2 || !cm) ? m4 : d4 + ext2 + "." + cm.toLowerCase() + "js";
|
|
6645
6730
|
});
|
|
6646
6731
|
}
|
|
6647
|
-
return
|
|
6732
|
+
return path9;
|
|
6648
6733
|
}
|
|
6649
6734
|
var extendStatics, __assign, __createBinding, __setModuleDefault, ownKeys, _SuppressedError, tslib_es6_default;
|
|
6650
6735
|
var init_tslib_es6 = __esm({
|
|
@@ -7517,11 +7602,11 @@ var init_HttpBindingProtocol = __esm({
|
|
|
7517
7602
|
const opTraits = translateTraits(operationSchema.traits);
|
|
7518
7603
|
if (opTraits.http) {
|
|
7519
7604
|
request.method = opTraits.http[0];
|
|
7520
|
-
const [
|
|
7605
|
+
const [path9, search2] = opTraits.http[1].split("?");
|
|
7521
7606
|
if (request.path == "/") {
|
|
7522
|
-
request.path =
|
|
7607
|
+
request.path = path9;
|
|
7523
7608
|
} else {
|
|
7524
|
-
request.path +=
|
|
7609
|
+
request.path += path9;
|
|
7525
7610
|
}
|
|
7526
7611
|
const traitSearchParams = new URLSearchParams(search2 ?? "");
|
|
7527
7612
|
Object.assign(query2, Object.fromEntries(traitSearchParams));
|
|
@@ -7899,8 +7984,8 @@ var init_requestBuilder = __esm({
|
|
|
7899
7984
|
return this;
|
|
7900
7985
|
}
|
|
7901
7986
|
p(memberName, labelValueProvider, uriLabel, isGreedyLabel) {
|
|
7902
|
-
this.resolvePathStack.push((
|
|
7903
|
-
this.path = resolvedPath(
|
|
7987
|
+
this.resolvePathStack.push((path9) => {
|
|
7988
|
+
this.path = resolvedPath(path9, this.input, memberName, labelValueProvider, uriLabel, isGreedyLabel);
|
|
7904
7989
|
});
|
|
7905
7990
|
return this;
|
|
7906
7991
|
}
|
|
@@ -8550,18 +8635,18 @@ var require_dist_cjs20 = __commonJS({
|
|
|
8550
8635
|
}
|
|
8551
8636
|
};
|
|
8552
8637
|
var booleanEquals = (value1, value2) => value1 === value2;
|
|
8553
|
-
var getAttrPathList = (
|
|
8554
|
-
const parts =
|
|
8638
|
+
var getAttrPathList = (path9) => {
|
|
8639
|
+
const parts = path9.split(".");
|
|
8555
8640
|
const pathList = [];
|
|
8556
8641
|
for (const part of parts) {
|
|
8557
8642
|
const squareBracketIndex = part.indexOf("[");
|
|
8558
8643
|
if (squareBracketIndex !== -1) {
|
|
8559
8644
|
if (part.indexOf("]") !== part.length - 1) {
|
|
8560
|
-
throw new EndpointError(`Path: '${
|
|
8645
|
+
throw new EndpointError(`Path: '${path9}' does not end with ']'`);
|
|
8561
8646
|
}
|
|
8562
8647
|
const arrayIndex = part.slice(squareBracketIndex + 1, -1);
|
|
8563
8648
|
if (Number.isNaN(parseInt(arrayIndex))) {
|
|
8564
|
-
throw new EndpointError(`Invalid array index: '${arrayIndex}' in path: '${
|
|
8649
|
+
throw new EndpointError(`Invalid array index: '${arrayIndex}' in path: '${path9}'`);
|
|
8565
8650
|
}
|
|
8566
8651
|
if (squareBracketIndex !== 0) {
|
|
8567
8652
|
pathList.push(part.slice(0, squareBracketIndex));
|
|
@@ -8573,9 +8658,9 @@ var require_dist_cjs20 = __commonJS({
|
|
|
8573
8658
|
}
|
|
8574
8659
|
return pathList;
|
|
8575
8660
|
};
|
|
8576
|
-
var getAttr = (value,
|
|
8661
|
+
var getAttr = (value, path9) => getAttrPathList(path9).reduce((acc, index) => {
|
|
8577
8662
|
if (typeof acc !== "object") {
|
|
8578
|
-
throw new EndpointError(`Index '${index}' in '${
|
|
8663
|
+
throw new EndpointError(`Index '${index}' in '${path9}' not found in '${JSON.stringify(value)}'`);
|
|
8579
8664
|
} else if (Array.isArray(acc)) {
|
|
8580
8665
|
return acc[parseInt(index)];
|
|
8581
8666
|
}
|
|
@@ -8594,8 +8679,8 @@ var require_dist_cjs20 = __commonJS({
|
|
|
8594
8679
|
return value;
|
|
8595
8680
|
}
|
|
8596
8681
|
if (typeof value === "object" && "hostname" in value) {
|
|
8597
|
-
const { hostname: hostname2, port, protocol: protocol2 = "", path:
|
|
8598
|
-
const url = new URL(`${protocol2}//${hostname2}${port ? `:${port}` : ""}${
|
|
8682
|
+
const { hostname: hostname2, port, protocol: protocol2 = "", path: path9 = "", query: query2 = {} } = value;
|
|
8683
|
+
const url = new URL(`${protocol2}//${hostname2}${port ? `:${port}` : ""}${path9}`);
|
|
8599
8684
|
url.search = Object.entries(query2).map(([k4, v4]) => `${k4}=${v4}`).join("&");
|
|
8600
8685
|
return url;
|
|
8601
8686
|
}
|
|
@@ -10110,10 +10195,10 @@ ${longDate}
|
|
|
10110
10195
|
${credentialScope}
|
|
10111
10196
|
${utilHexEncoding.toHex(hashedRequest)}`;
|
|
10112
10197
|
}
|
|
10113
|
-
getCanonicalPath({ path:
|
|
10198
|
+
getCanonicalPath({ path: path9 }) {
|
|
10114
10199
|
if (this.uriEscapePath) {
|
|
10115
10200
|
const normalizedPathSegments = [];
|
|
10116
|
-
for (const pathSegment of
|
|
10201
|
+
for (const pathSegment of path9.split("/")) {
|
|
10117
10202
|
if (pathSegment?.length === 0)
|
|
10118
10203
|
continue;
|
|
10119
10204
|
if (pathSegment === ".")
|
|
@@ -10124,11 +10209,11 @@ ${utilHexEncoding.toHex(hashedRequest)}`;
|
|
|
10124
10209
|
normalizedPathSegments.push(pathSegment);
|
|
10125
10210
|
}
|
|
10126
10211
|
}
|
|
10127
|
-
const normalizedPath = `${
|
|
10212
|
+
const normalizedPath = `${path9?.startsWith("/") ? "/" : ""}${normalizedPathSegments.join("/")}${normalizedPathSegments.length > 0 && path9?.endsWith("/") ? "/" : ""}`;
|
|
10128
10213
|
const doubleEncoded = utilUriEscape.escapeUri(normalizedPath);
|
|
10129
10214
|
return doubleEncoded.replace(/%2F/g, "/");
|
|
10130
10215
|
}
|
|
10131
|
-
return
|
|
10216
|
+
return path9;
|
|
10132
10217
|
}
|
|
10133
10218
|
validateResolvedCredentials(credentials) {
|
|
10134
10219
|
if (typeof credentials !== "object" || typeof credentials.accessKeyId !== "string" || typeof credentials.secretAccessKey !== "string") {
|
|
@@ -11389,11 +11474,11 @@ var init_SmithyRpcV2CborProtocol = __esm({
|
|
|
11389
11474
|
}
|
|
11390
11475
|
}
|
|
11391
11476
|
const { service, operation: operation2 } = (0, import_util_middleware5.getSmithyContext)(context);
|
|
11392
|
-
const
|
|
11477
|
+
const path9 = `/service/${service}/operation/${operation2}`;
|
|
11393
11478
|
if (request.path.endsWith("/")) {
|
|
11394
|
-
request.path +=
|
|
11479
|
+
request.path += path9.slice(1);
|
|
11395
11480
|
} else {
|
|
11396
|
-
request.path +=
|
|
11481
|
+
request.path += path9;
|
|
11397
11482
|
}
|
|
11398
11483
|
return request;
|
|
11399
11484
|
}
|
|
@@ -16309,15 +16394,15 @@ var require_dist_cjs34 = __commonJS({
|
|
|
16309
16394
|
var querystringBuilder = require_dist_cjs14();
|
|
16310
16395
|
function formatUrl(request) {
|
|
16311
16396
|
const { port, query: query2 } = request;
|
|
16312
|
-
let { protocol, path:
|
|
16397
|
+
let { protocol, path: path9, hostname } = request;
|
|
16313
16398
|
if (protocol && protocol.slice(-1) !== ":") {
|
|
16314
16399
|
protocol += ":";
|
|
16315
16400
|
}
|
|
16316
16401
|
if (port) {
|
|
16317
16402
|
hostname += `:${port}`;
|
|
16318
16403
|
}
|
|
16319
|
-
if (
|
|
16320
|
-
|
|
16404
|
+
if (path9 && path9.charAt(0) !== "/") {
|
|
16405
|
+
path9 = `/${path9}`;
|
|
16321
16406
|
}
|
|
16322
16407
|
let queryString = query2 ? querystringBuilder.buildQueryString(query2) : "";
|
|
16323
16408
|
if (queryString && queryString[0] !== "?") {
|
|
@@ -16333,7 +16418,7 @@ var require_dist_cjs34 = __commonJS({
|
|
|
16333
16418
|
if (request.fragment) {
|
|
16334
16419
|
fragment = `#${request.fragment}`;
|
|
16335
16420
|
}
|
|
16336
|
-
return `${protocol}//${auth}${hostname}${
|
|
16421
|
+
return `${protocol}//${auth}${hostname}${path9}${queryString}${fragment}`;
|
|
16337
16422
|
}
|
|
16338
16423
|
exports2.formatUrl = formatUrl;
|
|
16339
16424
|
}
|
|
@@ -17190,14 +17275,14 @@ var require_readFile = __commonJS({
|
|
|
17190
17275
|
var promises_1 = require("node:fs/promises");
|
|
17191
17276
|
exports2.filePromises = {};
|
|
17192
17277
|
exports2.fileIntercept = {};
|
|
17193
|
-
var readFile2 = (
|
|
17194
|
-
if (exports2.fileIntercept[
|
|
17195
|
-
return exports2.fileIntercept[
|
|
17278
|
+
var readFile2 = (path9, options) => {
|
|
17279
|
+
if (exports2.fileIntercept[path9] !== void 0) {
|
|
17280
|
+
return exports2.fileIntercept[path9];
|
|
17196
17281
|
}
|
|
17197
|
-
if (!exports2.filePromises[
|
|
17198
|
-
exports2.filePromises[
|
|
17282
|
+
if (!exports2.filePromises[path9] || options?.ignoreCache) {
|
|
17283
|
+
exports2.filePromises[path9] = (0, promises_1.readFile)(path9, "utf8");
|
|
17199
17284
|
}
|
|
17200
|
-
return exports2.filePromises[
|
|
17285
|
+
return exports2.filePromises[path9];
|
|
17201
17286
|
};
|
|
17202
17287
|
exports2.readFile = readFile2;
|
|
17203
17288
|
}
|
|
@@ -17210,7 +17295,7 @@ var require_dist_cjs42 = __commonJS({
|
|
|
17210
17295
|
var getHomeDir = require_getHomeDir();
|
|
17211
17296
|
var getSSOTokenFilepath = require_getSSOTokenFilepath();
|
|
17212
17297
|
var getSSOTokenFromFile = require_getSSOTokenFromFile();
|
|
17213
|
-
var
|
|
17298
|
+
var path9 = require("path");
|
|
17214
17299
|
var types2 = require_dist_cjs();
|
|
17215
17300
|
var readFile2 = require_readFile();
|
|
17216
17301
|
var ENV_PROFILE = "AWS_PROFILE";
|
|
@@ -17232,9 +17317,9 @@ var require_dist_cjs42 = __commonJS({
|
|
|
17232
17317
|
...data2.default && { default: data2.default }
|
|
17233
17318
|
});
|
|
17234
17319
|
var ENV_CONFIG_PATH = "AWS_CONFIG_FILE";
|
|
17235
|
-
var getConfigFilepath = () => process.env[ENV_CONFIG_PATH] ||
|
|
17320
|
+
var getConfigFilepath = () => process.env[ENV_CONFIG_PATH] || path9.join(getHomeDir.getHomeDir(), ".aws", "config");
|
|
17236
17321
|
var ENV_CREDENTIALS_PATH = "AWS_SHARED_CREDENTIALS_FILE";
|
|
17237
|
-
var getCredentialsFilepath = () => process.env[ENV_CREDENTIALS_PATH] ||
|
|
17322
|
+
var getCredentialsFilepath = () => process.env[ENV_CREDENTIALS_PATH] || path9.join(getHomeDir.getHomeDir(), ".aws", "credentials");
|
|
17238
17323
|
var prefixKeyRegex = /^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/;
|
|
17239
17324
|
var profileNameBlockList = ["__proto__", "profile __proto__"];
|
|
17240
17325
|
var parseIni = (iniData) => {
|
|
@@ -17289,11 +17374,11 @@ var require_dist_cjs42 = __commonJS({
|
|
|
17289
17374
|
const relativeHomeDirPrefix = "~/";
|
|
17290
17375
|
let resolvedFilepath = filepath;
|
|
17291
17376
|
if (filepath.startsWith(relativeHomeDirPrefix)) {
|
|
17292
|
-
resolvedFilepath =
|
|
17377
|
+
resolvedFilepath = path9.join(homeDir, filepath.slice(2));
|
|
17293
17378
|
}
|
|
17294
17379
|
let resolvedConfigFilepath = configFilepath;
|
|
17295
17380
|
if (configFilepath.startsWith(relativeHomeDirPrefix)) {
|
|
17296
|
-
resolvedConfigFilepath =
|
|
17381
|
+
resolvedConfigFilepath = path9.join(homeDir, configFilepath.slice(2));
|
|
17297
17382
|
}
|
|
17298
17383
|
const parsedFiles = await Promise.all([
|
|
17299
17384
|
readFile2.readFile(resolvedConfigFilepath, {
|
|
@@ -17332,8 +17417,8 @@ var require_dist_cjs42 = __commonJS({
|
|
|
17332
17417
|
getFileRecord() {
|
|
17333
17418
|
return readFile2.fileIntercept;
|
|
17334
17419
|
},
|
|
17335
|
-
interceptFile(
|
|
17336
|
-
readFile2.fileIntercept[
|
|
17420
|
+
interceptFile(path10, contents) {
|
|
17421
|
+
readFile2.fileIntercept[path10] = Promise.resolve(contents);
|
|
17337
17422
|
},
|
|
17338
17423
|
getTokenRecord() {
|
|
17339
17424
|
return getSSOTokenFromFile.tokenIntercept;
|
|
@@ -17564,8 +17649,8 @@ var require_dist_cjs44 = __commonJS({
|
|
|
17564
17649
|
return endpoint.url.href;
|
|
17565
17650
|
}
|
|
17566
17651
|
if ("hostname" in endpoint) {
|
|
17567
|
-
const { protocol, hostname, port, path:
|
|
17568
|
-
return `${protocol}//${hostname}${port ? ":" + port : ""}${
|
|
17652
|
+
const { protocol, hostname, port, path: path9 } = endpoint;
|
|
17653
|
+
return `${protocol}//${hostname}${port ? ":" + port : ""}${path9}`;
|
|
17569
17654
|
}
|
|
17570
17655
|
}
|
|
17571
17656
|
return endpoint;
|
|
@@ -20478,7 +20563,7 @@ var require_dist_cjs56 = __commonJS({
|
|
|
20478
20563
|
var httpAuthSchemes = (init_httpAuthSchemes2(), __toCommonJS(httpAuthSchemes_exports));
|
|
20479
20564
|
var propertyProvider = require_dist_cjs24();
|
|
20480
20565
|
var sharedIniFileLoader = require_dist_cjs42();
|
|
20481
|
-
var
|
|
20566
|
+
var fs10 = require("fs");
|
|
20482
20567
|
var fromEnvSigningName = ({ logger: logger2, signingName } = {}) => async () => {
|
|
20483
20568
|
logger2?.debug?.("@aws-sdk/token-providers - fromEnvSigningName");
|
|
20484
20569
|
if (!signingName) {
|
|
@@ -20524,7 +20609,7 @@ var require_dist_cjs56 = __commonJS({
|
|
|
20524
20609
|
throw new propertyProvider.TokenProviderError(`Value not present for '${key}' in SSO Token${forRefresh ? ". Cannot refresh" : ""}. ${REFRESH_MESSAGE}`, false);
|
|
20525
20610
|
}
|
|
20526
20611
|
};
|
|
20527
|
-
var { writeFile } =
|
|
20612
|
+
var { writeFile } = fs10.promises;
|
|
20528
20613
|
var writeSSOTokenToFile = (id, ssoToken) => {
|
|
20529
20614
|
const tokenFilepath = sharedIniFileLoader.getSSOTokenFilepath(id);
|
|
20530
20615
|
const tokenString = JSON.stringify(ssoToken, null, 2);
|
|
@@ -30249,8 +30334,8 @@ var init_parseUtil = __esm({
|
|
|
30249
30334
|
init_errors4();
|
|
30250
30335
|
init_en();
|
|
30251
30336
|
makeIssue = (params) => {
|
|
30252
|
-
const { data: data2, path:
|
|
30253
|
-
const fullPath = [...
|
|
30337
|
+
const { data: data2, path: path9, errorMaps, issueData } = params;
|
|
30338
|
+
const fullPath = [...path9, ...issueData.path || []];
|
|
30254
30339
|
const fullIssue = {
|
|
30255
30340
|
...issueData,
|
|
30256
30341
|
path: fullPath
|
|
@@ -30558,11 +30643,11 @@ var init_types = __esm({
|
|
|
30558
30643
|
init_parseUtil();
|
|
30559
30644
|
init_util2();
|
|
30560
30645
|
ParseInputLazyPath = class {
|
|
30561
|
-
constructor(parent, value,
|
|
30646
|
+
constructor(parent, value, path9, key) {
|
|
30562
30647
|
this._cachedPath = [];
|
|
30563
30648
|
this.parent = parent;
|
|
30564
30649
|
this.data = value;
|
|
30565
|
-
this._path =
|
|
30650
|
+
this._path = path9;
|
|
30566
30651
|
this._key = key;
|
|
30567
30652
|
}
|
|
30568
30653
|
get path() {
|
|
@@ -35214,7 +35299,7 @@ var init_escape = __esm({
|
|
|
35214
35299
|
});
|
|
35215
35300
|
|
|
35216
35301
|
// node_modules/minimatch/dist/esm/index.js
|
|
35217
|
-
var import_brace_expansion, minimatch, starDotExtRE, starDotExtTest, starDotExtTestDot, starDotExtTestNocase, starDotExtTestNocaseDot, starDotStarRE, starDotStarTest, starDotStarTestDot, dotStarRE, dotStarTest, starRE, starTest, starTestDot, qmarksRE, qmarksTestNocase, qmarksTestNocaseDot, qmarksTestDot, qmarksTest, qmarksTestNoExt, qmarksTestNoExtDot, defaultPlatform,
|
|
35302
|
+
var import_brace_expansion, minimatch, starDotExtRE, starDotExtTest, starDotExtTestDot, starDotExtTestNocase, starDotExtTestNocaseDot, starDotStarRE, starDotStarTest, starDotStarTestDot, dotStarRE, dotStarTest, starRE, starTest, starTestDot, qmarksRE, qmarksTestNocase, qmarksTestNocaseDot, qmarksTestDot, qmarksTest, qmarksTestNoExt, qmarksTestNoExtDot, defaultPlatform, path5, sep, GLOBSTAR, qmark2, star2, twoStarDot, twoStarNoDot, filter, ext, defaults, braceExpand, makeRe, match, globMagic, regExpEscape2, Minimatch;
|
|
35218
35303
|
var init_esm = __esm({
|
|
35219
35304
|
"node_modules/minimatch/dist/esm/index.js"() {
|
|
35220
35305
|
import_brace_expansion = __toESM(require_brace_expansion(), 1);
|
|
@@ -35283,11 +35368,11 @@ var init_esm = __esm({
|
|
|
35283
35368
|
return (f4) => f4.length === len && f4 !== "." && f4 !== "..";
|
|
35284
35369
|
};
|
|
35285
35370
|
defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
|
|
35286
|
-
|
|
35371
|
+
path5 = {
|
|
35287
35372
|
win32: { sep: "\\" },
|
|
35288
35373
|
posix: { sep: "/" }
|
|
35289
35374
|
};
|
|
35290
|
-
sep = defaultPlatform === "win32" ?
|
|
35375
|
+
sep = defaultPlatform === "win32" ? path5.win32.sep : path5.posix.sep;
|
|
35291
35376
|
minimatch.sep = sep;
|
|
35292
35377
|
GLOBSTAR = Symbol("globstar **");
|
|
35293
35378
|
minimatch.GLOBSTAR = GLOBSTAR;
|
|
@@ -38202,22 +38287,22 @@ var init_esm3 = __esm({
|
|
|
38202
38287
|
});
|
|
38203
38288
|
|
|
38204
38289
|
// node_modules/path-scurry/dist/esm/index.js
|
|
38205
|
-
var import_node_path, import_node_url,
|
|
38290
|
+
var import_node_path, import_node_url, import_fs4, actualFS, import_promises, realpathSync, defaultFS, fsFromOption, uncDriveRegexp, uncToDrive, eitherSep, UNKNOWN, IFIFO, IFCHR, IFDIR, IFBLK, IFREG, IFLNK, IFSOCK, IFMT, IFMT_UNKNOWN, READDIR_CALLED, LSTAT_CALLED, ENOTDIR, ENOENT, ENOREADLINK, ENOREALPATH, ENOCHILD, TYPEMASK, entToType, normalizeCache, normalize, normalizeNocaseCache, normalizeNocase, ResolveCache, ChildrenCache, setAsCwd, PathBase, PathWin32, PathPosix, PathScurryBase, PathScurryWin32, PathScurryPosix, PathScurryDarwin, Path, PathScurry;
|
|
38206
38291
|
var init_esm4 = __esm({
|
|
38207
38292
|
"node_modules/path-scurry/dist/esm/index.js"() {
|
|
38208
38293
|
init_esm2();
|
|
38209
38294
|
import_node_path = require("node:path");
|
|
38210
38295
|
import_node_url = require("node:url");
|
|
38211
|
-
|
|
38296
|
+
import_fs4 = require("fs");
|
|
38212
38297
|
actualFS = __toESM(require("node:fs"), 1);
|
|
38213
38298
|
import_promises = require("node:fs/promises");
|
|
38214
38299
|
init_esm3();
|
|
38215
|
-
realpathSync =
|
|
38300
|
+
realpathSync = import_fs4.realpathSync.native;
|
|
38216
38301
|
defaultFS = {
|
|
38217
|
-
lstatSync:
|
|
38218
|
-
readdir:
|
|
38219
|
-
readdirSync:
|
|
38220
|
-
readlinkSync:
|
|
38302
|
+
lstatSync: import_fs4.lstatSync,
|
|
38303
|
+
readdir: import_fs4.readdir,
|
|
38304
|
+
readdirSync: import_fs4.readdirSync,
|
|
38305
|
+
readlinkSync: import_fs4.readlinkSync,
|
|
38221
38306
|
realpathSync,
|
|
38222
38307
|
promises: {
|
|
38223
38308
|
lstat: import_promises.lstat,
|
|
@@ -38474,12 +38559,12 @@ var init_esm4 = __esm({
|
|
|
38474
38559
|
/**
|
|
38475
38560
|
* Get the Path object referenced by the string path, resolved from this Path
|
|
38476
38561
|
*/
|
|
38477
|
-
resolve(
|
|
38478
|
-
if (!
|
|
38562
|
+
resolve(path9) {
|
|
38563
|
+
if (!path9) {
|
|
38479
38564
|
return this;
|
|
38480
38565
|
}
|
|
38481
|
-
const rootPath = this.getRootString(
|
|
38482
|
-
const dir =
|
|
38566
|
+
const rootPath = this.getRootString(path9);
|
|
38567
|
+
const dir = path9.substring(rootPath.length);
|
|
38483
38568
|
const dirParts = dir.split(this.splitSep);
|
|
38484
38569
|
const result = rootPath ? this.getRoot(rootPath).#resolveParts(dirParts) : this.#resolveParts(dirParts);
|
|
38485
38570
|
return result;
|
|
@@ -39231,8 +39316,8 @@ var init_esm4 = __esm({
|
|
|
39231
39316
|
/**
|
|
39232
39317
|
* @internal
|
|
39233
39318
|
*/
|
|
39234
|
-
getRootString(
|
|
39235
|
-
return import_node_path.win32.parse(
|
|
39319
|
+
getRootString(path9) {
|
|
39320
|
+
return import_node_path.win32.parse(path9).root;
|
|
39236
39321
|
}
|
|
39237
39322
|
/**
|
|
39238
39323
|
* @internal
|
|
@@ -39278,8 +39363,8 @@ var init_esm4 = __esm({
|
|
|
39278
39363
|
/**
|
|
39279
39364
|
* @internal
|
|
39280
39365
|
*/
|
|
39281
|
-
getRootString(
|
|
39282
|
-
return
|
|
39366
|
+
getRootString(path9) {
|
|
39367
|
+
return path9.startsWith("/") ? "/" : "";
|
|
39283
39368
|
}
|
|
39284
39369
|
/**
|
|
39285
39370
|
* @internal
|
|
@@ -39328,8 +39413,8 @@ var init_esm4 = __esm({
|
|
|
39328
39413
|
*
|
|
39329
39414
|
* @internal
|
|
39330
39415
|
*/
|
|
39331
|
-
constructor(cwd = process.cwd(), pathImpl, sep4, { nocase, childrenCacheSize = 16 * 1024, fs:
|
|
39332
|
-
this.#fs = fsFromOption(
|
|
39416
|
+
constructor(cwd = process.cwd(), pathImpl, sep4, { nocase, childrenCacheSize = 16 * 1024, fs: fs10 = defaultFS } = {}) {
|
|
39417
|
+
this.#fs = fsFromOption(fs10);
|
|
39333
39418
|
if (cwd instanceof URL || cwd.startsWith("file://")) {
|
|
39334
39419
|
cwd = (0, import_node_url.fileURLToPath)(cwd);
|
|
39335
39420
|
}
|
|
@@ -39368,11 +39453,11 @@ var init_esm4 = __esm({
|
|
|
39368
39453
|
/**
|
|
39369
39454
|
* Get the depth of a provided path, string, or the cwd
|
|
39370
39455
|
*/
|
|
39371
|
-
depth(
|
|
39372
|
-
if (typeof
|
|
39373
|
-
|
|
39456
|
+
depth(path9 = this.cwd) {
|
|
39457
|
+
if (typeof path9 === "string") {
|
|
39458
|
+
path9 = this.cwd.resolve(path9);
|
|
39374
39459
|
}
|
|
39375
|
-
return
|
|
39460
|
+
return path9.depth();
|
|
39376
39461
|
}
|
|
39377
39462
|
/**
|
|
39378
39463
|
* Return the cache of child entries. Exposed so subclasses can create
|
|
@@ -39859,9 +39944,9 @@ var init_esm4 = __esm({
|
|
|
39859
39944
|
process2();
|
|
39860
39945
|
return results;
|
|
39861
39946
|
}
|
|
39862
|
-
chdir(
|
|
39947
|
+
chdir(path9 = this.cwd) {
|
|
39863
39948
|
const oldCwd = this.cwd;
|
|
39864
|
-
this.cwd = typeof
|
|
39949
|
+
this.cwd = typeof path9 === "string" ? this.cwd.resolve(path9) : path9;
|
|
39865
39950
|
this.cwd[setAsCwd](oldCwd);
|
|
39866
39951
|
}
|
|
39867
39952
|
};
|
|
@@ -39887,8 +39972,8 @@ var init_esm4 = __esm({
|
|
|
39887
39972
|
/**
|
|
39888
39973
|
* @internal
|
|
39889
39974
|
*/
|
|
39890
|
-
newRoot(
|
|
39891
|
-
return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs:
|
|
39975
|
+
newRoot(fs10) {
|
|
39976
|
+
return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs10 });
|
|
39892
39977
|
}
|
|
39893
39978
|
/**
|
|
39894
39979
|
* Return true if the provided path string is an absolute path
|
|
@@ -39916,8 +40001,8 @@ var init_esm4 = __esm({
|
|
|
39916
40001
|
/**
|
|
39917
40002
|
* @internal
|
|
39918
40003
|
*/
|
|
39919
|
-
newRoot(
|
|
39920
|
-
return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs:
|
|
40004
|
+
newRoot(fs10) {
|
|
40005
|
+
return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs10 });
|
|
39921
40006
|
}
|
|
39922
40007
|
/**
|
|
39923
40008
|
* Return true if the provided path string is an absolute path
|
|
@@ -40236,8 +40321,8 @@ var init_processor = __esm({
|
|
|
40236
40321
|
}
|
|
40237
40322
|
// match, absolute, ifdir
|
|
40238
40323
|
entries() {
|
|
40239
|
-
return [...this.store.entries()].map(([
|
|
40240
|
-
|
|
40324
|
+
return [...this.store.entries()].map(([path9, n4]) => [
|
|
40325
|
+
path9,
|
|
40241
40326
|
!!(n4 & 2),
|
|
40242
40327
|
!!(n4 & 1)
|
|
40243
40328
|
]);
|
|
@@ -40450,9 +40535,9 @@ var init_walker = __esm({
|
|
|
40450
40535
|
signal;
|
|
40451
40536
|
maxDepth;
|
|
40452
40537
|
includeChildMatches;
|
|
40453
|
-
constructor(patterns,
|
|
40538
|
+
constructor(patterns, path9, opts) {
|
|
40454
40539
|
this.patterns = patterns;
|
|
40455
|
-
this.path =
|
|
40540
|
+
this.path = path9;
|
|
40456
40541
|
this.opts = opts;
|
|
40457
40542
|
this.#sep = !opts.posix && opts.platform === "win32" ? "\\" : "/";
|
|
40458
40543
|
this.includeChildMatches = opts.includeChildMatches !== false;
|
|
@@ -40471,11 +40556,11 @@ var init_walker = __esm({
|
|
|
40471
40556
|
});
|
|
40472
40557
|
}
|
|
40473
40558
|
}
|
|
40474
|
-
#ignored(
|
|
40475
|
-
return this.seen.has(
|
|
40559
|
+
#ignored(path9) {
|
|
40560
|
+
return this.seen.has(path9) || !!this.#ignore?.ignored?.(path9);
|
|
40476
40561
|
}
|
|
40477
|
-
#childrenIgnored(
|
|
40478
|
-
return !!this.#ignore?.childrenIgnored?.(
|
|
40562
|
+
#childrenIgnored(path9) {
|
|
40563
|
+
return !!this.#ignore?.childrenIgnored?.(path9);
|
|
40479
40564
|
}
|
|
40480
40565
|
// backpressure mechanism
|
|
40481
40566
|
pause() {
|
|
@@ -40690,8 +40775,8 @@ var init_walker = __esm({
|
|
|
40690
40775
|
};
|
|
40691
40776
|
GlobWalker = class extends GlobUtil {
|
|
40692
40777
|
matches = /* @__PURE__ */ new Set();
|
|
40693
|
-
constructor(patterns,
|
|
40694
|
-
super(patterns,
|
|
40778
|
+
constructor(patterns, path9, opts) {
|
|
40779
|
+
super(patterns, path9, opts);
|
|
40695
40780
|
}
|
|
40696
40781
|
matchEmit(e4) {
|
|
40697
40782
|
this.matches.add(e4);
|
|
@@ -40728,8 +40813,8 @@ var init_walker = __esm({
|
|
|
40728
40813
|
};
|
|
40729
40814
|
GlobStream = class extends GlobUtil {
|
|
40730
40815
|
results;
|
|
40731
|
-
constructor(patterns,
|
|
40732
|
-
super(patterns,
|
|
40816
|
+
constructor(patterns, path9, opts) {
|
|
40817
|
+
super(patterns, path9, opts);
|
|
40733
40818
|
this.results = new Minipass({
|
|
40734
40819
|
signal: this.signal,
|
|
40735
40820
|
objectMode: true
|
|
@@ -41126,7 +41211,7 @@ function createWrappedTools(baseTools) {
|
|
|
41126
41211
|
}
|
|
41127
41212
|
return wrappedTools;
|
|
41128
41213
|
}
|
|
41129
|
-
var import_child_process6, import_util11, import_crypto3, import_events,
|
|
41214
|
+
var import_child_process6, import_util11, import_crypto3, import_events, import_fs5, import_fs6, import_path5, toolCallEmitter, activeToolExecutions, wrapToolWithEmitter, listFilesTool, searchFilesTool, listFilesToolInstance, searchFilesToolInstance;
|
|
41130
41215
|
var init_probeTool = __esm({
|
|
41131
41216
|
"src/agent/probeTool.js"() {
|
|
41132
41217
|
"use strict";
|
|
@@ -41135,10 +41220,11 @@ var init_probeTool = __esm({
|
|
|
41135
41220
|
import_util11 = require("util");
|
|
41136
41221
|
import_crypto3 = require("crypto");
|
|
41137
41222
|
import_events = require("events");
|
|
41138
|
-
|
|
41139
|
-
|
|
41140
|
-
|
|
41223
|
+
import_fs5 = __toESM(require("fs"), 1);
|
|
41224
|
+
import_fs6 = require("fs");
|
|
41225
|
+
import_path5 = __toESM(require("path"), 1);
|
|
41141
41226
|
init_esm5();
|
|
41227
|
+
init_symlink_utils();
|
|
41142
41228
|
toolCallEmitter = new import_events.EventEmitter();
|
|
41143
41229
|
activeToolExecutions = /* @__PURE__ */ new Map();
|
|
41144
41230
|
wrapToolWithEmitter = (tool4, toolName, baseExecute) => {
|
|
@@ -41225,17 +41311,17 @@ var init_probeTool = __esm({
|
|
|
41225
41311
|
execute: async (params) => {
|
|
41226
41312
|
const { directory = ".", workingDirectory } = params;
|
|
41227
41313
|
const baseCwd = workingDirectory || process.cwd();
|
|
41228
|
-
const secureBaseDir =
|
|
41314
|
+
const secureBaseDir = import_path5.default.resolve(baseCwd);
|
|
41229
41315
|
const isDependencyPath = directory.startsWith("/dep/") || directory.startsWith("go:") || directory.startsWith("js:") || directory.startsWith("rust:");
|
|
41230
41316
|
let targetDir;
|
|
41231
|
-
if (
|
|
41232
|
-
targetDir =
|
|
41233
|
-
if (!isDependencyPath && !targetDir.startsWith(secureBaseDir +
|
|
41317
|
+
if (import_path5.default.isAbsolute(directory)) {
|
|
41318
|
+
targetDir = import_path5.default.resolve(directory);
|
|
41319
|
+
if (!isDependencyPath && !targetDir.startsWith(secureBaseDir + import_path5.default.sep) && targetDir !== secureBaseDir) {
|
|
41234
41320
|
throw new Error(`Path traversal attempt detected. Cannot access directory outside workspace: ${directory}`);
|
|
41235
41321
|
}
|
|
41236
41322
|
} else {
|
|
41237
|
-
targetDir =
|
|
41238
|
-
if (!isDependencyPath && !targetDir.startsWith(secureBaseDir +
|
|
41323
|
+
targetDir = import_path5.default.resolve(secureBaseDir, directory);
|
|
41324
|
+
if (!isDependencyPath && !targetDir.startsWith(secureBaseDir + import_path5.default.sep) && targetDir !== secureBaseDir) {
|
|
41239
41325
|
throw new Error(`Path traversal attempt detected. Access denied: ${directory}`);
|
|
41240
41326
|
}
|
|
41241
41327
|
}
|
|
@@ -41244,7 +41330,7 @@ var init_probeTool = __esm({
|
|
|
41244
41330
|
console.log(`[DEBUG] Listing files in directory: ${targetDir}`);
|
|
41245
41331
|
}
|
|
41246
41332
|
try {
|
|
41247
|
-
const files = await
|
|
41333
|
+
const files = await import_fs6.promises.readdir(targetDir, { withFileTypes: true });
|
|
41248
41334
|
const formatSize = (size) => {
|
|
41249
41335
|
if (size < 1024) return `${size}B`;
|
|
41250
41336
|
if (size < 1024 * 1024) return `${(size / 1024).toFixed(1)}K`;
|
|
@@ -41252,21 +41338,12 @@ var init_probeTool = __esm({
|
|
|
41252
41338
|
return `${(size / (1024 * 1024 * 1024)).toFixed(1)}G`;
|
|
41253
41339
|
};
|
|
41254
41340
|
const entries = await Promise.all(files.map(async (file) => {
|
|
41255
|
-
const
|
|
41256
|
-
const
|
|
41257
|
-
let size = 0;
|
|
41258
|
-
try {
|
|
41259
|
-
const stats = await import_fs3.promises.stat(fullPath);
|
|
41260
|
-
size = stats.size;
|
|
41261
|
-
} catch (statError) {
|
|
41262
|
-
if (debug) {
|
|
41263
|
-
console.log(`[DEBUG] Could not stat file ${file.name}:`, statError.message);
|
|
41264
|
-
}
|
|
41265
|
-
}
|
|
41341
|
+
const fullPath = import_path5.default.join(targetDir, file.name);
|
|
41342
|
+
const entryType = await getEntryType(file, fullPath);
|
|
41266
41343
|
return {
|
|
41267
41344
|
name: file.name,
|
|
41268
|
-
isDirectory,
|
|
41269
|
-
size
|
|
41345
|
+
isDirectory: entryType.isDirectory,
|
|
41346
|
+
size: entryType.size
|
|
41270
41347
|
};
|
|
41271
41348
|
}));
|
|
41272
41349
|
entries.sort((a4, b4) => {
|
|
@@ -41298,17 +41375,17 @@ var init_probeTool = __esm({
|
|
|
41298
41375
|
throw new Error("Pattern is required for file search");
|
|
41299
41376
|
}
|
|
41300
41377
|
const baseCwd = workingDirectory || process.cwd();
|
|
41301
|
-
const secureBaseDir =
|
|
41378
|
+
const secureBaseDir = import_path5.default.resolve(baseCwd);
|
|
41302
41379
|
const isDependencyPath = directory.startsWith("/dep/") || directory.startsWith("go:") || directory.startsWith("js:") || directory.startsWith("rust:");
|
|
41303
41380
|
let targetDir;
|
|
41304
|
-
if (
|
|
41305
|
-
targetDir =
|
|
41306
|
-
if (!isDependencyPath && !targetDir.startsWith(secureBaseDir +
|
|
41381
|
+
if (import_path5.default.isAbsolute(directory)) {
|
|
41382
|
+
targetDir = import_path5.default.resolve(directory);
|
|
41383
|
+
if (!isDependencyPath && !targetDir.startsWith(secureBaseDir + import_path5.default.sep) && targetDir !== secureBaseDir) {
|
|
41307
41384
|
throw new Error(`Path traversal attempt detected. Cannot access directory outside workspace: ${directory}`);
|
|
41308
41385
|
}
|
|
41309
41386
|
} else {
|
|
41310
|
-
targetDir =
|
|
41311
|
-
if (!isDependencyPath && !targetDir.startsWith(secureBaseDir +
|
|
41387
|
+
targetDir = import_path5.default.resolve(secureBaseDir, directory);
|
|
41388
|
+
if (!isDependencyPath && !targetDir.startsWith(secureBaseDir + import_path5.default.sep) && targetDir !== secureBaseDir) {
|
|
41312
41389
|
throw new Error(`Path traversal attempt detected. Access denied: ${directory}`);
|
|
41313
41390
|
}
|
|
41314
41391
|
}
|
|
@@ -43135,11 +43212,11 @@ var init_toKey = __esm({
|
|
|
43135
43212
|
});
|
|
43136
43213
|
|
|
43137
43214
|
// node_modules/lodash-es/_baseGet.js
|
|
43138
|
-
function baseGet(object,
|
|
43139
|
-
|
|
43140
|
-
var index = 0, length =
|
|
43215
|
+
function baseGet(object, path9) {
|
|
43216
|
+
path9 = castPath_default(path9, object);
|
|
43217
|
+
var index = 0, length = path9.length;
|
|
43141
43218
|
while (object != null && index < length) {
|
|
43142
|
-
object = object[toKey_default(
|
|
43219
|
+
object = object[toKey_default(path9[index++])];
|
|
43143
43220
|
}
|
|
43144
43221
|
return index && index == length ? object : void 0;
|
|
43145
43222
|
}
|
|
@@ -43153,8 +43230,8 @@ var init_baseGet = __esm({
|
|
|
43153
43230
|
});
|
|
43154
43231
|
|
|
43155
43232
|
// node_modules/lodash-es/get.js
|
|
43156
|
-
function get2(object,
|
|
43157
|
-
var result = object == null ? void 0 : baseGet_default(object,
|
|
43233
|
+
function get2(object, path9, defaultValue) {
|
|
43234
|
+
var result = object == null ? void 0 : baseGet_default(object, path9);
|
|
43158
43235
|
return result === void 0 ? defaultValue : result;
|
|
43159
43236
|
}
|
|
43160
43237
|
var get_default;
|
|
@@ -44517,11 +44594,11 @@ var init_baseHasIn = __esm({
|
|
|
44517
44594
|
});
|
|
44518
44595
|
|
|
44519
44596
|
// node_modules/lodash-es/_hasPath.js
|
|
44520
|
-
function hasPath(object,
|
|
44521
|
-
|
|
44522
|
-
var index = -1, length =
|
|
44597
|
+
function hasPath(object, path9, hasFunc) {
|
|
44598
|
+
path9 = castPath_default(path9, object);
|
|
44599
|
+
var index = -1, length = path9.length, result = false;
|
|
44523
44600
|
while (++index < length) {
|
|
44524
|
-
var key = toKey_default(
|
|
44601
|
+
var key = toKey_default(path9[index]);
|
|
44525
44602
|
if (!(result = object != null && hasFunc(object, key))) {
|
|
44526
44603
|
break;
|
|
44527
44604
|
}
|
|
@@ -44547,8 +44624,8 @@ var init_hasPath = __esm({
|
|
|
44547
44624
|
});
|
|
44548
44625
|
|
|
44549
44626
|
// node_modules/lodash-es/hasIn.js
|
|
44550
|
-
function hasIn(object,
|
|
44551
|
-
return object != null && hasPath_default(object,
|
|
44627
|
+
function hasIn(object, path9) {
|
|
44628
|
+
return object != null && hasPath_default(object, path9, baseHasIn_default);
|
|
44552
44629
|
}
|
|
44553
44630
|
var hasIn_default;
|
|
44554
44631
|
var init_hasIn = __esm({
|
|
@@ -44560,13 +44637,13 @@ var init_hasIn = __esm({
|
|
|
44560
44637
|
});
|
|
44561
44638
|
|
|
44562
44639
|
// node_modules/lodash-es/_baseMatchesProperty.js
|
|
44563
|
-
function baseMatchesProperty(
|
|
44564
|
-
if (isKey_default(
|
|
44565
|
-
return matchesStrictComparable_default(toKey_default(
|
|
44640
|
+
function baseMatchesProperty(path9, srcValue) {
|
|
44641
|
+
if (isKey_default(path9) && isStrictComparable_default(srcValue)) {
|
|
44642
|
+
return matchesStrictComparable_default(toKey_default(path9), srcValue);
|
|
44566
44643
|
}
|
|
44567
44644
|
return function(object) {
|
|
44568
|
-
var objValue = get_default(object,
|
|
44569
|
-
return objValue === void 0 && objValue === srcValue ? hasIn_default(object,
|
|
44645
|
+
var objValue = get_default(object, path9);
|
|
44646
|
+
return objValue === void 0 && objValue === srcValue ? hasIn_default(object, path9) : baseIsEqual_default(srcValue, objValue, COMPARE_PARTIAL_FLAG6 | COMPARE_UNORDERED_FLAG4);
|
|
44570
44647
|
};
|
|
44571
44648
|
}
|
|
44572
44649
|
var COMPARE_PARTIAL_FLAG6, COMPARE_UNORDERED_FLAG4, baseMatchesProperty_default;
|
|
@@ -44599,9 +44676,9 @@ var init_baseProperty = __esm({
|
|
|
44599
44676
|
});
|
|
44600
44677
|
|
|
44601
44678
|
// node_modules/lodash-es/_basePropertyDeep.js
|
|
44602
|
-
function basePropertyDeep(
|
|
44679
|
+
function basePropertyDeep(path9) {
|
|
44603
44680
|
return function(object) {
|
|
44604
|
-
return baseGet_default(object,
|
|
44681
|
+
return baseGet_default(object, path9);
|
|
44605
44682
|
};
|
|
44606
44683
|
}
|
|
44607
44684
|
var basePropertyDeep_default;
|
|
@@ -44613,8 +44690,8 @@ var init_basePropertyDeep = __esm({
|
|
|
44613
44690
|
});
|
|
44614
44691
|
|
|
44615
44692
|
// node_modules/lodash-es/property.js
|
|
44616
|
-
function property(
|
|
44617
|
-
return isKey_default(
|
|
44693
|
+
function property(path9) {
|
|
44694
|
+
return isKey_default(path9) ? baseProperty_default(toKey_default(path9)) : basePropertyDeep_default(path9);
|
|
44618
44695
|
}
|
|
44619
44696
|
var property_default;
|
|
44620
44697
|
var init_property = __esm({
|
|
@@ -45233,8 +45310,8 @@ var init_baseHas = __esm({
|
|
|
45233
45310
|
});
|
|
45234
45311
|
|
|
45235
45312
|
// node_modules/lodash-es/has.js
|
|
45236
|
-
function has(object,
|
|
45237
|
-
return object != null && hasPath_default(object,
|
|
45313
|
+
function has(object, path9) {
|
|
45314
|
+
return object != null && hasPath_default(object, path9, baseHas_default);
|
|
45238
45315
|
}
|
|
45239
45316
|
var has_default;
|
|
45240
45317
|
var init_has = __esm({
|
|
@@ -45440,14 +45517,14 @@ var init_negate = __esm({
|
|
|
45440
45517
|
});
|
|
45441
45518
|
|
|
45442
45519
|
// node_modules/lodash-es/_baseSet.js
|
|
45443
|
-
function baseSet(object,
|
|
45520
|
+
function baseSet(object, path9, value, customizer) {
|
|
45444
45521
|
if (!isObject_default(object)) {
|
|
45445
45522
|
return object;
|
|
45446
45523
|
}
|
|
45447
|
-
|
|
45448
|
-
var index = -1, length =
|
|
45524
|
+
path9 = castPath_default(path9, object);
|
|
45525
|
+
var index = -1, length = path9.length, lastIndex = length - 1, nested = object;
|
|
45449
45526
|
while (nested != null && ++index < length) {
|
|
45450
|
-
var key = toKey_default(
|
|
45527
|
+
var key = toKey_default(path9[index]), newValue = value;
|
|
45451
45528
|
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
|
45452
45529
|
return object;
|
|
45453
45530
|
}
|
|
@@ -45455,7 +45532,7 @@ function baseSet(object, path8, value, customizer) {
|
|
|
45455
45532
|
var objValue = nested[key];
|
|
45456
45533
|
newValue = customizer ? customizer(objValue, key, nested) : void 0;
|
|
45457
45534
|
if (newValue === void 0) {
|
|
45458
|
-
newValue = isObject_default(objValue) ? objValue : isIndex_default(
|
|
45535
|
+
newValue = isObject_default(objValue) ? objValue : isIndex_default(path9[index + 1]) ? [] : {};
|
|
45459
45536
|
}
|
|
45460
45537
|
}
|
|
45461
45538
|
assignValue_default(nested, key, newValue);
|
|
@@ -45479,9 +45556,9 @@ var init_baseSet = __esm({
|
|
|
45479
45556
|
function basePickBy(object, paths, predicate) {
|
|
45480
45557
|
var index = -1, length = paths.length, result = {};
|
|
45481
45558
|
while (++index < length) {
|
|
45482
|
-
var
|
|
45483
|
-
if (predicate(value,
|
|
45484
|
-
baseSet_default(result, castPath_default(
|
|
45559
|
+
var path9 = paths[index], value = baseGet_default(object, path9);
|
|
45560
|
+
if (predicate(value, path9)) {
|
|
45561
|
+
baseSet_default(result, castPath_default(path9, object), value);
|
|
45485
45562
|
}
|
|
45486
45563
|
}
|
|
45487
45564
|
return result;
|
|
@@ -45505,8 +45582,8 @@ function pickBy(object, predicate) {
|
|
|
45505
45582
|
return [prop];
|
|
45506
45583
|
});
|
|
45507
45584
|
predicate = baseIteratee_default(predicate);
|
|
45508
|
-
return basePickBy_default(object, props, function(value,
|
|
45509
|
-
return predicate(value,
|
|
45585
|
+
return basePickBy_default(object, props, function(value, path9) {
|
|
45586
|
+
return predicate(value, path9[0]);
|
|
45510
45587
|
});
|
|
45511
45588
|
}
|
|
45512
45589
|
var pickBy_default;
|
|
@@ -48219,12 +48296,12 @@ function assignCategoriesMapProp(tokenTypes) {
|
|
|
48219
48296
|
singleAssignCategoriesToksMap([], currTokType);
|
|
48220
48297
|
});
|
|
48221
48298
|
}
|
|
48222
|
-
function singleAssignCategoriesToksMap(
|
|
48223
|
-
forEach_default(
|
|
48299
|
+
function singleAssignCategoriesToksMap(path9, nextNode) {
|
|
48300
|
+
forEach_default(path9, (pathNode) => {
|
|
48224
48301
|
nextNode.categoryMatchesMap[pathNode.tokenTypeIdx] = true;
|
|
48225
48302
|
});
|
|
48226
48303
|
forEach_default(nextNode.CATEGORIES, (nextCategory) => {
|
|
48227
|
-
const newPath =
|
|
48304
|
+
const newPath = path9.concat(nextNode);
|
|
48228
48305
|
if (!includes_default(newPath, nextCategory)) {
|
|
48229
48306
|
singleAssignCategoriesToksMap(newPath, nextCategory);
|
|
48230
48307
|
}
|
|
@@ -49394,10 +49471,10 @@ var init_interpreter = __esm({
|
|
|
49394
49471
|
init_rest();
|
|
49395
49472
|
init_api2();
|
|
49396
49473
|
AbstractNextPossibleTokensWalker = class extends RestWalker {
|
|
49397
|
-
constructor(topProd,
|
|
49474
|
+
constructor(topProd, path9) {
|
|
49398
49475
|
super();
|
|
49399
49476
|
this.topProd = topProd;
|
|
49400
|
-
this.path =
|
|
49477
|
+
this.path = path9;
|
|
49401
49478
|
this.possibleTokTypes = [];
|
|
49402
49479
|
this.nextProductionName = "";
|
|
49403
49480
|
this.nextProductionOccurrence = 0;
|
|
@@ -49441,9 +49518,9 @@ var init_interpreter = __esm({
|
|
|
49441
49518
|
}
|
|
49442
49519
|
};
|
|
49443
49520
|
NextAfterTokenWalker = class extends AbstractNextPossibleTokensWalker {
|
|
49444
|
-
constructor(topProd,
|
|
49445
|
-
super(topProd,
|
|
49446
|
-
this.path =
|
|
49521
|
+
constructor(topProd, path9) {
|
|
49522
|
+
super(topProd, path9);
|
|
49523
|
+
this.path = path9;
|
|
49447
49524
|
this.nextTerminalName = "";
|
|
49448
49525
|
this.nextTerminalOccurrence = 0;
|
|
49449
49526
|
this.nextTerminalName = this.path.lastTok.name;
|
|
@@ -49684,10 +49761,10 @@ function initializeArrayOfArrays(size) {
|
|
|
49684
49761
|
}
|
|
49685
49762
|
return result;
|
|
49686
49763
|
}
|
|
49687
|
-
function pathToHashKeys(
|
|
49764
|
+
function pathToHashKeys(path9) {
|
|
49688
49765
|
let keys2 = [""];
|
|
49689
|
-
for (let i4 = 0; i4 <
|
|
49690
|
-
const tokType =
|
|
49766
|
+
for (let i4 = 0; i4 < path9.length; i4++) {
|
|
49767
|
+
const tokType = path9[i4];
|
|
49691
49768
|
const longerKeys = [];
|
|
49692
49769
|
for (let j4 = 0; j4 < keys2.length; j4++) {
|
|
49693
49770
|
const currShorterKey = keys2[j4];
|
|
@@ -49990,7 +50067,7 @@ function validateRuleIsOverridden(ruleName, definedRulesNames, className) {
|
|
|
49990
50067
|
}
|
|
49991
50068
|
return errors;
|
|
49992
50069
|
}
|
|
49993
|
-
function validateNoLeftRecursion(topRule, currRule, errMsgProvider,
|
|
50070
|
+
function validateNoLeftRecursion(topRule, currRule, errMsgProvider, path9 = []) {
|
|
49994
50071
|
const errors = [];
|
|
49995
50072
|
const nextNonTerminals = getFirstNoneTerminal(currRule.definition);
|
|
49996
50073
|
if (isEmpty_default(nextNonTerminals)) {
|
|
@@ -50002,15 +50079,15 @@ function validateNoLeftRecursion(topRule, currRule, errMsgProvider, path8 = [])
|
|
|
50002
50079
|
errors.push({
|
|
50003
50080
|
message: errMsgProvider.buildLeftRecursionError({
|
|
50004
50081
|
topLevelRule: topRule,
|
|
50005
|
-
leftRecursionPath:
|
|
50082
|
+
leftRecursionPath: path9
|
|
50006
50083
|
}),
|
|
50007
50084
|
type: ParserDefinitionErrorType.LEFT_RECURSION,
|
|
50008
50085
|
ruleName
|
|
50009
50086
|
});
|
|
50010
50087
|
}
|
|
50011
|
-
const validNextSteps = difference_default(nextNonTerminals,
|
|
50088
|
+
const validNextSteps = difference_default(nextNonTerminals, path9.concat([topRule]));
|
|
50012
50089
|
const errorsFromNextSteps = flatMap_default(validNextSteps, (currRefRule) => {
|
|
50013
|
-
const newPath = clone_default(
|
|
50090
|
+
const newPath = clone_default(path9);
|
|
50014
50091
|
newPath.push(currRefRule);
|
|
50015
50092
|
return validateNoLeftRecursion(topRule, currRefRule, errMsgProvider, newPath);
|
|
50016
50093
|
});
|
|
@@ -55485,7 +55562,7 @@ function validateFlowchart(text, options = {}) {
|
|
|
55485
55562
|
const byLine = /* @__PURE__ */ new Map();
|
|
55486
55563
|
const collect = (arr) => {
|
|
55487
55564
|
for (const e4 of arr || []) {
|
|
55488
|
-
if (e4 && (e4.code === "FL-LABEL-PARENS-UNQUOTED" || e4.code === "FL-LABEL-AT-IN-UNQUOTED")) {
|
|
55565
|
+
if (e4 && (e4.code === "FL-LABEL-PARENS-UNQUOTED" || e4.code === "FL-LABEL-AT-IN-UNQUOTED" || e4.code === "FL-LABEL-QUOTE-IN-UNQUOTED")) {
|
|
55489
55566
|
const ln = e4.line ?? 0;
|
|
55490
55567
|
const col = e4.column ?? 1;
|
|
55491
55568
|
const list2 = byLine.get(ln) || [];
|
|
@@ -55566,6 +55643,8 @@ function validateFlowchart(text, options = {}) {
|
|
|
55566
55643
|
const covered = existing.some((r4) => !(endCol < r4.start || startCol > r4.end));
|
|
55567
55644
|
const hasParens = seg.includes("(") || seg.includes(")");
|
|
55568
55645
|
const hasAt = seg.includes("@");
|
|
55646
|
+
const hasQuote = seg.includes('"');
|
|
55647
|
+
const isSingleQuoted = /^'[^]*'$/.test(trimmed);
|
|
55569
55648
|
if (!covered && !isQuoted && !isParenWrapped && hasParens) {
|
|
55570
55649
|
errs.push({ line: ln, column: startCol, severity: "error", code: "FL-LABEL-PARENS-UNQUOTED", message: "Parentheses inside an unquoted label are not supported by Mermaid.", hint: 'Wrap the label in quotes, e.g., A["Mark (X)"] \u2014 or replace ( and ) with HTML entities: ( and ).' });
|
|
55571
55650
|
existing.push({ start: startCol, end: endCol });
|
|
@@ -55576,6 +55655,11 @@ function validateFlowchart(text, options = {}) {
|
|
|
55576
55655
|
existing.push({ start: startCol, end: endCol });
|
|
55577
55656
|
byLine.set(ln, existing);
|
|
55578
55657
|
}
|
|
55658
|
+
if (!covered && !isQuoted && !isSlashPair && hasQuote && !isSingleQuoted) {
|
|
55659
|
+
errs.push({ line: ln, column: startCol, severity: "error", code: "FL-LABEL-QUOTE-IN-UNQUOTED", message: "Quotes are not allowed inside unquoted node labels. Use " for quotes or wrap the entire label in quotes.", hint: 'Example: C["HTML Output: data-trigger-visibility="true""]' });
|
|
55660
|
+
existing.push({ start: startCol, end: endCol });
|
|
55661
|
+
byLine.set(ln, existing);
|
|
55662
|
+
}
|
|
55579
55663
|
i4 = j4;
|
|
55580
55664
|
continue;
|
|
55581
55665
|
} else {
|
|
@@ -62607,11 +62691,11 @@ var require_baseGet = __commonJS({
|
|
|
62607
62691
|
"node_modules/lodash/_baseGet.js"(exports2, module2) {
|
|
62608
62692
|
var castPath2 = require_castPath();
|
|
62609
62693
|
var toKey2 = require_toKey();
|
|
62610
|
-
function baseGet2(object,
|
|
62611
|
-
|
|
62612
|
-
var index = 0, length =
|
|
62694
|
+
function baseGet2(object, path9) {
|
|
62695
|
+
path9 = castPath2(path9, object);
|
|
62696
|
+
var index = 0, length = path9.length;
|
|
62613
62697
|
while (object != null && index < length) {
|
|
62614
|
-
object = object[toKey2(
|
|
62698
|
+
object = object[toKey2(path9[index++])];
|
|
62615
62699
|
}
|
|
62616
62700
|
return index && index == length ? object : void 0;
|
|
62617
62701
|
}
|
|
@@ -62623,8 +62707,8 @@ var require_baseGet = __commonJS({
|
|
|
62623
62707
|
var require_get = __commonJS({
|
|
62624
62708
|
"node_modules/lodash/get.js"(exports2, module2) {
|
|
62625
62709
|
var baseGet2 = require_baseGet();
|
|
62626
|
-
function get3(object,
|
|
62627
|
-
var result = object == null ? void 0 : baseGet2(object,
|
|
62710
|
+
function get3(object, path9, defaultValue) {
|
|
62711
|
+
var result = object == null ? void 0 : baseGet2(object, path9);
|
|
62628
62712
|
return result === void 0 ? defaultValue : result;
|
|
62629
62713
|
}
|
|
62630
62714
|
module2.exports = get3;
|
|
@@ -62650,11 +62734,11 @@ var require_hasPath = __commonJS({
|
|
|
62650
62734
|
var isIndex2 = require_isIndex();
|
|
62651
62735
|
var isLength2 = require_isLength();
|
|
62652
62736
|
var toKey2 = require_toKey();
|
|
62653
|
-
function hasPath2(object,
|
|
62654
|
-
|
|
62655
|
-
var index = -1, length =
|
|
62737
|
+
function hasPath2(object, path9, hasFunc) {
|
|
62738
|
+
path9 = castPath2(path9, object);
|
|
62739
|
+
var index = -1, length = path9.length, result = false;
|
|
62656
62740
|
while (++index < length) {
|
|
62657
|
-
var key = toKey2(
|
|
62741
|
+
var key = toKey2(path9[index]);
|
|
62658
62742
|
if (!(result = object != null && hasFunc(object, key))) {
|
|
62659
62743
|
break;
|
|
62660
62744
|
}
|
|
@@ -62675,8 +62759,8 @@ var require_hasIn = __commonJS({
|
|
|
62675
62759
|
"node_modules/lodash/hasIn.js"(exports2, module2) {
|
|
62676
62760
|
var baseHasIn2 = require_baseHasIn();
|
|
62677
62761
|
var hasPath2 = require_hasPath();
|
|
62678
|
-
function hasIn2(object,
|
|
62679
|
-
return object != null && hasPath2(object,
|
|
62762
|
+
function hasIn2(object, path9) {
|
|
62763
|
+
return object != null && hasPath2(object, path9, baseHasIn2);
|
|
62680
62764
|
}
|
|
62681
62765
|
module2.exports = hasIn2;
|
|
62682
62766
|
}
|
|
@@ -62694,13 +62778,13 @@ var require_baseMatchesProperty = __commonJS({
|
|
|
62694
62778
|
var toKey2 = require_toKey();
|
|
62695
62779
|
var COMPARE_PARTIAL_FLAG7 = 1;
|
|
62696
62780
|
var COMPARE_UNORDERED_FLAG5 = 2;
|
|
62697
|
-
function baseMatchesProperty2(
|
|
62698
|
-
if (isKey2(
|
|
62699
|
-
return matchesStrictComparable2(toKey2(
|
|
62781
|
+
function baseMatchesProperty2(path9, srcValue) {
|
|
62782
|
+
if (isKey2(path9) && isStrictComparable2(srcValue)) {
|
|
62783
|
+
return matchesStrictComparable2(toKey2(path9), srcValue);
|
|
62700
62784
|
}
|
|
62701
62785
|
return function(object) {
|
|
62702
|
-
var objValue = get3(object,
|
|
62703
|
-
return objValue === void 0 && objValue === srcValue ? hasIn2(object,
|
|
62786
|
+
var objValue = get3(object, path9);
|
|
62787
|
+
return objValue === void 0 && objValue === srcValue ? hasIn2(object, path9) : baseIsEqual2(srcValue, objValue, COMPARE_PARTIAL_FLAG7 | COMPARE_UNORDERED_FLAG5);
|
|
62704
62788
|
};
|
|
62705
62789
|
}
|
|
62706
62790
|
module2.exports = baseMatchesProperty2;
|
|
@@ -62723,9 +62807,9 @@ var require_baseProperty = __commonJS({
|
|
|
62723
62807
|
var require_basePropertyDeep = __commonJS({
|
|
62724
62808
|
"node_modules/lodash/_basePropertyDeep.js"(exports2, module2) {
|
|
62725
62809
|
var baseGet2 = require_baseGet();
|
|
62726
|
-
function basePropertyDeep2(
|
|
62810
|
+
function basePropertyDeep2(path9) {
|
|
62727
62811
|
return function(object) {
|
|
62728
|
-
return baseGet2(object,
|
|
62812
|
+
return baseGet2(object, path9);
|
|
62729
62813
|
};
|
|
62730
62814
|
}
|
|
62731
62815
|
module2.exports = basePropertyDeep2;
|
|
@@ -62739,8 +62823,8 @@ var require_property = __commonJS({
|
|
|
62739
62823
|
var basePropertyDeep2 = require_basePropertyDeep();
|
|
62740
62824
|
var isKey2 = require_isKey();
|
|
62741
62825
|
var toKey2 = require_toKey();
|
|
62742
|
-
function property2(
|
|
62743
|
-
return isKey2(
|
|
62826
|
+
function property2(path9) {
|
|
62827
|
+
return isKey2(path9) ? baseProperty2(toKey2(path9)) : basePropertyDeep2(path9);
|
|
62744
62828
|
}
|
|
62745
62829
|
module2.exports = property2;
|
|
62746
62830
|
}
|
|
@@ -62802,8 +62886,8 @@ var require_has = __commonJS({
|
|
|
62802
62886
|
"node_modules/lodash/has.js"(exports2, module2) {
|
|
62803
62887
|
var baseHas2 = require_baseHas();
|
|
62804
62888
|
var hasPath2 = require_hasPath();
|
|
62805
|
-
function has2(object,
|
|
62806
|
-
return object != null && hasPath2(object,
|
|
62889
|
+
function has2(object, path9) {
|
|
62890
|
+
return object != null && hasPath2(object, path9, baseHas2);
|
|
62807
62891
|
}
|
|
62808
62892
|
module2.exports = has2;
|
|
62809
62893
|
}
|
|
@@ -65077,14 +65161,14 @@ var require_baseSet = __commonJS({
|
|
|
65077
65161
|
var isIndex2 = require_isIndex();
|
|
65078
65162
|
var isObject2 = require_isObject();
|
|
65079
65163
|
var toKey2 = require_toKey();
|
|
65080
|
-
function baseSet2(object,
|
|
65164
|
+
function baseSet2(object, path9, value, customizer) {
|
|
65081
65165
|
if (!isObject2(object)) {
|
|
65082
65166
|
return object;
|
|
65083
65167
|
}
|
|
65084
|
-
|
|
65085
|
-
var index = -1, length =
|
|
65168
|
+
path9 = castPath2(path9, object);
|
|
65169
|
+
var index = -1, length = path9.length, lastIndex = length - 1, nested = object;
|
|
65086
65170
|
while (nested != null && ++index < length) {
|
|
65087
|
-
var key = toKey2(
|
|
65171
|
+
var key = toKey2(path9[index]), newValue = value;
|
|
65088
65172
|
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
|
65089
65173
|
return object;
|
|
65090
65174
|
}
|
|
@@ -65092,7 +65176,7 @@ var require_baseSet = __commonJS({
|
|
|
65092
65176
|
var objValue = nested[key];
|
|
65093
65177
|
newValue = customizer ? customizer(objValue, key, nested) : void 0;
|
|
65094
65178
|
if (newValue === void 0) {
|
|
65095
|
-
newValue = isObject2(objValue) ? objValue : isIndex2(
|
|
65179
|
+
newValue = isObject2(objValue) ? objValue : isIndex2(path9[index + 1]) ? [] : {};
|
|
65096
65180
|
}
|
|
65097
65181
|
}
|
|
65098
65182
|
assignValue2(nested, key, newValue);
|
|
@@ -65113,9 +65197,9 @@ var require_basePickBy = __commonJS({
|
|
|
65113
65197
|
function basePickBy2(object, paths, predicate) {
|
|
65114
65198
|
var index = -1, length = paths.length, result = {};
|
|
65115
65199
|
while (++index < length) {
|
|
65116
|
-
var
|
|
65117
|
-
if (predicate(value,
|
|
65118
|
-
baseSet2(result, castPath2(
|
|
65200
|
+
var path9 = paths[index], value = baseGet2(object, path9);
|
|
65201
|
+
if (predicate(value, path9)) {
|
|
65202
|
+
baseSet2(result, castPath2(path9, object), value);
|
|
65119
65203
|
}
|
|
65120
65204
|
}
|
|
65121
65205
|
return result;
|
|
@@ -65130,8 +65214,8 @@ var require_basePick = __commonJS({
|
|
|
65130
65214
|
var basePickBy2 = require_basePickBy();
|
|
65131
65215
|
var hasIn2 = require_hasIn();
|
|
65132
65216
|
function basePick(object, paths) {
|
|
65133
|
-
return basePickBy2(object, paths, function(value,
|
|
65134
|
-
return hasIn2(object,
|
|
65217
|
+
return basePickBy2(object, paths, function(value, path9) {
|
|
65218
|
+
return hasIn2(object, path9);
|
|
65135
65219
|
});
|
|
65136
65220
|
}
|
|
65137
65221
|
module2.exports = basePick;
|
|
@@ -66185,15 +66269,15 @@ var require_parent_dummy_chains = __commonJS({
|
|
|
66185
66269
|
var node = g4.node(v4);
|
|
66186
66270
|
var edgeObj = node.edgeObj;
|
|
66187
66271
|
var pathData = findPath(g4, postorderNums, edgeObj.v, edgeObj.w);
|
|
66188
|
-
var
|
|
66272
|
+
var path9 = pathData.path;
|
|
66189
66273
|
var lca = pathData.lca;
|
|
66190
66274
|
var pathIdx = 0;
|
|
66191
|
-
var pathV =
|
|
66275
|
+
var pathV = path9[pathIdx];
|
|
66192
66276
|
var ascending = true;
|
|
66193
66277
|
while (v4 !== edgeObj.w) {
|
|
66194
66278
|
node = g4.node(v4);
|
|
66195
66279
|
if (ascending) {
|
|
66196
|
-
while ((pathV =
|
|
66280
|
+
while ((pathV = path9[pathIdx]) !== lca && g4.node(pathV).maxRank < node.rank) {
|
|
66197
66281
|
pathIdx++;
|
|
66198
66282
|
}
|
|
66199
66283
|
if (pathV === lca) {
|
|
@@ -66201,10 +66285,10 @@ var require_parent_dummy_chains = __commonJS({
|
|
|
66201
66285
|
}
|
|
66202
66286
|
}
|
|
66203
66287
|
if (!ascending) {
|
|
66204
|
-
while (pathIdx <
|
|
66288
|
+
while (pathIdx < path9.length - 1 && g4.node(pathV = path9[pathIdx + 1]).minRank <= node.rank) {
|
|
66205
66289
|
pathIdx++;
|
|
66206
66290
|
}
|
|
66207
|
-
pathV =
|
|
66291
|
+
pathV = path9[pathIdx];
|
|
66208
66292
|
}
|
|
66209
66293
|
g4.setParent(v4, pathV);
|
|
66210
66294
|
v4 = g4.successors(v4)[0];
|
|
@@ -68377,8 +68461,8 @@ var init_svg_generator = __esm({
|
|
|
68377
68461
|
elements.push(this.generateNodeWithPad(node, padX, padY));
|
|
68378
68462
|
}
|
|
68379
68463
|
for (const edge of layout.edges) {
|
|
68380
|
-
const { path:
|
|
68381
|
-
elements.push(
|
|
68464
|
+
const { path: path9, overlay } = this.generateEdge(edge, padX, padY, nodeMap);
|
|
68465
|
+
elements.push(path9);
|
|
68382
68466
|
if (overlay)
|
|
68383
68467
|
overlays.push(overlay);
|
|
68384
68468
|
}
|
|
@@ -74694,8 +74778,8 @@ var require_utils = __commonJS({
|
|
|
74694
74778
|
}
|
|
74695
74779
|
return ind;
|
|
74696
74780
|
}
|
|
74697
|
-
function removeDotSegments(
|
|
74698
|
-
let input =
|
|
74781
|
+
function removeDotSegments(path9) {
|
|
74782
|
+
let input = path9;
|
|
74699
74783
|
const output = [];
|
|
74700
74784
|
let nextSlash = -1;
|
|
74701
74785
|
let len = 0;
|
|
@@ -74894,8 +74978,8 @@ var require_schemes = __commonJS({
|
|
|
74894
74978
|
wsComponent.secure = void 0;
|
|
74895
74979
|
}
|
|
74896
74980
|
if (wsComponent.resourceName) {
|
|
74897
|
-
const [
|
|
74898
|
-
wsComponent.path =
|
|
74981
|
+
const [path9, query2] = wsComponent.resourceName.split("?");
|
|
74982
|
+
wsComponent.path = path9 && path9 !== "/" ? path9 : void 0;
|
|
74899
74983
|
wsComponent.query = query2;
|
|
74900
74984
|
wsComponent.resourceName = void 0;
|
|
74901
74985
|
}
|
|
@@ -78238,7 +78322,7 @@ function validateJsonResponse(response, options = {}) {
|
|
|
78238
78322
|
}
|
|
78239
78323
|
if (!valid) {
|
|
78240
78324
|
const formattedErrors = validate2.errors.map((err) => {
|
|
78241
|
-
const
|
|
78325
|
+
const path9 = err.instancePath ? err.instancePath.substring(1).replace(/\//g, ".") : "<root>";
|
|
78242
78326
|
let message = "";
|
|
78243
78327
|
let suggestion = "";
|
|
78244
78328
|
if (err.keyword === "additionalProperties") {
|
|
@@ -78276,7 +78360,7 @@ function validateJsonResponse(response, options = {}) {
|
|
|
78276
78360
|
message = err.message;
|
|
78277
78361
|
suggestion = "";
|
|
78278
78362
|
}
|
|
78279
|
-
const location =
|
|
78363
|
+
const location = path9 ? `at '${path9}'` : "at root";
|
|
78280
78364
|
return suggestion ? `${location}: ${message} \u2192 ${suggestion}` : `${location}: ${message}`;
|
|
78281
78365
|
});
|
|
78282
78366
|
const errorSummary = formattedErrors.join("\n ");
|
|
@@ -78599,7 +78683,7 @@ function extractMermaidFromJson(response) {
|
|
|
78599
78683
|
}
|
|
78600
78684
|
const diagrams = [];
|
|
78601
78685
|
const jsonPaths = [];
|
|
78602
|
-
function searchObject(obj,
|
|
78686
|
+
function searchObject(obj, path9 = []) {
|
|
78603
78687
|
if (typeof obj === "string") {
|
|
78604
78688
|
const mermaidPattern = /```mermaid([^\n`]*?)(?:\n|\\n)([\s\S]*?)```/gi;
|
|
78605
78689
|
let match2;
|
|
@@ -78613,14 +78697,14 @@ function extractMermaidFromJson(response) {
|
|
|
78613
78697
|
endIndex: match2.index + match2[0].length,
|
|
78614
78698
|
attributes,
|
|
78615
78699
|
isInJson: true,
|
|
78616
|
-
jsonPath:
|
|
78700
|
+
jsonPath: path9.join(".")
|
|
78617
78701
|
});
|
|
78618
|
-
jsonPaths.push(
|
|
78702
|
+
jsonPaths.push(path9.join("."));
|
|
78619
78703
|
}
|
|
78620
78704
|
} else if (Array.isArray(obj)) {
|
|
78621
|
-
obj.forEach((item, index) => searchObject(item, [...
|
|
78705
|
+
obj.forEach((item, index) => searchObject(item, [...path9, `[${index}]`]));
|
|
78622
78706
|
} else if (obj && typeof obj === "object") {
|
|
78623
|
-
Object.entries(obj).forEach(([key, value]) => searchObject(value, [...
|
|
78707
|
+
Object.entries(obj).forEach(([key, value]) => searchObject(value, [...path9, key]));
|
|
78624
78708
|
}
|
|
78625
78709
|
}
|
|
78626
78710
|
searchObject(parsedJson);
|
|
@@ -78877,7 +78961,7 @@ async function tryMaidAutoFix(diagramContent, options = {}) {
|
|
|
78877
78961
|
}
|
|
78878
78962
|
}
|
|
78879
78963
|
async function validateAndFixMermaidResponse(response, options = {}) {
|
|
78880
|
-
const { schema, debug, path:
|
|
78964
|
+
const { schema, debug, path: path9, provider, model, tracer } = options;
|
|
78881
78965
|
const startTime = Date.now();
|
|
78882
78966
|
if (debug) {
|
|
78883
78967
|
console.log(`[DEBUG] Mermaid validation: Starting maid-based validation for response (${response.length} chars)`);
|
|
@@ -79034,7 +79118,7 @@ ${maidResult.fixed}
|
|
|
79034
79118
|
}
|
|
79035
79119
|
const aiFixingStart = Date.now();
|
|
79036
79120
|
const mermaidFixer = new MermaidFixingAgent({
|
|
79037
|
-
path:
|
|
79121
|
+
path: path9,
|
|
79038
79122
|
provider,
|
|
79039
79123
|
model,
|
|
79040
79124
|
debug,
|
|
@@ -79276,8 +79360,8 @@ Schema Validation Errors:
|
|
|
79276
79360
|
${validationResult.errorSummary}`;
|
|
79277
79361
|
} else if (validationResult.schemaErrors && validationResult.schemaErrors.length > 0) {
|
|
79278
79362
|
const errors = validationResult.schemaErrors.map((err) => {
|
|
79279
|
-
const
|
|
79280
|
-
return ` ${
|
|
79363
|
+
const path9 = err.instancePath || "(root)";
|
|
79364
|
+
return ` ${path9}: ${err.message}`;
|
|
79281
79365
|
}).join("\n");
|
|
79282
79366
|
schemaErrorDetails = `
|
|
79283
79367
|
|
|
@@ -79637,11 +79721,11 @@ function loadMCPConfigurationFromPath(configPath) {
|
|
|
79637
79721
|
if (!configPath) {
|
|
79638
79722
|
throw new Error("Config path is required");
|
|
79639
79723
|
}
|
|
79640
|
-
if (!(0,
|
|
79724
|
+
if (!(0, import_fs7.existsSync)(configPath)) {
|
|
79641
79725
|
throw new Error(`MCP configuration file not found: ${configPath}`);
|
|
79642
79726
|
}
|
|
79643
79727
|
try {
|
|
79644
|
-
const content = (0,
|
|
79728
|
+
const content = (0, import_fs7.readFileSync)(configPath, "utf8");
|
|
79645
79729
|
const config = JSON.parse(content);
|
|
79646
79730
|
if (process.env.DEBUG === "1" || process.env.DEBUG_MCP === "1") {
|
|
79647
79731
|
console.error(`[MCP DEBUG] Loaded configuration from: ${configPath}`);
|
|
@@ -79656,19 +79740,19 @@ function loadMCPConfiguration() {
|
|
|
79656
79740
|
// Environment variable path
|
|
79657
79741
|
process.env.MCP_CONFIG_PATH,
|
|
79658
79742
|
// Local project paths
|
|
79659
|
-
(0,
|
|
79660
|
-
(0,
|
|
79743
|
+
(0, import_path6.join)(process.cwd(), ".mcp", "config.json"),
|
|
79744
|
+
(0, import_path6.join)(process.cwd(), "mcp.config.json"),
|
|
79661
79745
|
// Home directory paths
|
|
79662
|
-
(0,
|
|
79663
|
-
(0,
|
|
79746
|
+
(0, import_path6.join)((0, import_os3.homedir)(), ".config", "probe", "mcp.json"),
|
|
79747
|
+
(0, import_path6.join)((0, import_os3.homedir)(), ".mcp", "config.json"),
|
|
79664
79748
|
// Claude-style config location
|
|
79665
|
-
(0,
|
|
79749
|
+
(0, import_path6.join)((0, import_os3.homedir)(), "Library", "Application Support", "Claude", "mcp_config.json")
|
|
79666
79750
|
].filter(Boolean);
|
|
79667
79751
|
let config = null;
|
|
79668
79752
|
for (const configPath of configPaths) {
|
|
79669
|
-
if ((0,
|
|
79753
|
+
if ((0, import_fs7.existsSync)(configPath)) {
|
|
79670
79754
|
try {
|
|
79671
|
-
const content = (0,
|
|
79755
|
+
const content = (0, import_fs7.readFileSync)(configPath, "utf8");
|
|
79672
79756
|
config = JSON.parse(content);
|
|
79673
79757
|
if (process.env.DEBUG === "1" || process.env.DEBUG_MCP === "1") {
|
|
79674
79758
|
console.error(`[MCP DEBUG] Loaded configuration from: ${configPath}`);
|
|
@@ -79764,22 +79848,22 @@ function parseEnabledServers(config) {
|
|
|
79764
79848
|
}
|
|
79765
79849
|
return servers;
|
|
79766
79850
|
}
|
|
79767
|
-
var
|
|
79851
|
+
var import_fs7, import_path6, import_os3, import_url4, __filename4, __dirname4, DEFAULT_CONFIG;
|
|
79768
79852
|
var init_config = __esm({
|
|
79769
79853
|
"src/agent/mcp/config.js"() {
|
|
79770
79854
|
"use strict";
|
|
79771
|
-
|
|
79772
|
-
|
|
79855
|
+
import_fs7 = require("fs");
|
|
79856
|
+
import_path6 = require("path");
|
|
79773
79857
|
import_os3 = require("os");
|
|
79774
79858
|
import_url4 = require("url");
|
|
79775
79859
|
__filename4 = (0, import_url4.fileURLToPath)("file:///");
|
|
79776
|
-
__dirname4 = (0,
|
|
79860
|
+
__dirname4 = (0, import_path6.dirname)(__filename4);
|
|
79777
79861
|
DEFAULT_CONFIG = {
|
|
79778
79862
|
mcpServers: {
|
|
79779
79863
|
// Example probe server configuration
|
|
79780
79864
|
"probe-local": {
|
|
79781
79865
|
command: "node",
|
|
79782
|
-
args: [(0,
|
|
79866
|
+
args: [(0, import_path6.join)(__dirname4, "../../../examples/chat/mcpServer.js")],
|
|
79783
79867
|
transport: "stdio",
|
|
79784
79868
|
enabled: false
|
|
79785
79869
|
},
|
|
@@ -81899,12 +81983,12 @@ async function createEnhancedClaudeCLIEngine(options = {}) {
|
|
|
81899
81983
|
console.log("[DEBUG] Built-in MCP server started");
|
|
81900
81984
|
console.log("[DEBUG] MCP URL:", `http://${host}:${port}/mcp`);
|
|
81901
81985
|
}
|
|
81902
|
-
mcpConfigPath =
|
|
81986
|
+
mcpConfigPath = import_path7.default.join(import_os4.default.tmpdir(), `probe-mcp-${session.id}.json`);
|
|
81903
81987
|
const mcpConfig = {
|
|
81904
81988
|
mcpServers: {
|
|
81905
81989
|
probe: {
|
|
81906
81990
|
command: "node",
|
|
81907
|
-
args: [
|
|
81991
|
+
args: [import_path7.default.join(process.cwd(), "mcp-probe-server.js")],
|
|
81908
81992
|
env: {
|
|
81909
81993
|
PROBE_WORKSPACE: process.cwd(),
|
|
81910
81994
|
DEBUG: debug ? "true" : "false"
|
|
@@ -82273,14 +82357,14 @@ function combinePrompts(systemPrompt, customPrompt, agent) {
|
|
|
82273
82357
|
}
|
|
82274
82358
|
return systemPrompt || "";
|
|
82275
82359
|
}
|
|
82276
|
-
var import_child_process7, import_crypto5, import_promises2,
|
|
82360
|
+
var import_child_process7, import_crypto5, import_promises2, import_path7, import_os4, import_events3;
|
|
82277
82361
|
var init_enhanced_claude_code = __esm({
|
|
82278
82362
|
"src/agent/engines/enhanced-claude-code.js"() {
|
|
82279
82363
|
"use strict";
|
|
82280
82364
|
import_child_process7 = require("child_process");
|
|
82281
82365
|
import_crypto5 = require("crypto");
|
|
82282
82366
|
import_promises2 = __toESM(require("fs/promises"), 1);
|
|
82283
|
-
|
|
82367
|
+
import_path7 = __toESM(require("path"), 1);
|
|
82284
82368
|
import_os4 = __toESM(require("os"), 1);
|
|
82285
82369
|
import_events3 = require("events");
|
|
82286
82370
|
init_built_in_server();
|
|
@@ -82637,7 +82721,7 @@ var ProbeAgent_exports = {};
|
|
|
82637
82721
|
__export(ProbeAgent_exports, {
|
|
82638
82722
|
ProbeAgent: () => ProbeAgent
|
|
82639
82723
|
});
|
|
82640
|
-
var import_dotenv, import_anthropic2, import_openai2, import_google2, import_ai2, import_crypto7, import_events4,
|
|
82724
|
+
var import_dotenv, import_anthropic2, import_openai2, import_google2, import_ai2, import_crypto7, import_events4, import_fs8, import_promises3, import_path8, MAX_TOOL_ITERATIONS, MAX_HISTORY_MESSAGES, MAX_IMAGE_FILE_SIZE, ProbeAgent;
|
|
82641
82725
|
var init_ProbeAgent = __esm({
|
|
82642
82726
|
"src/agent/ProbeAgent.js"() {
|
|
82643
82727
|
"use strict";
|
|
@@ -82649,9 +82733,9 @@ var init_ProbeAgent = __esm({
|
|
|
82649
82733
|
import_ai2 = require("ai");
|
|
82650
82734
|
import_crypto7 = require("crypto");
|
|
82651
82735
|
import_events4 = require("events");
|
|
82652
|
-
|
|
82736
|
+
import_fs8 = require("fs");
|
|
82653
82737
|
import_promises3 = require("fs/promises");
|
|
82654
|
-
|
|
82738
|
+
import_path8 = require("path");
|
|
82655
82739
|
init_tokenCounter();
|
|
82656
82740
|
init_InMemoryStorageAdapter();
|
|
82657
82741
|
init_HookManager();
|
|
@@ -82690,6 +82774,7 @@ var init_ProbeAgent = __esm({
|
|
|
82690
82774
|
* @param {boolean} [options.allowEdit=false] - Allow the use of the 'implement' tool
|
|
82691
82775
|
* @param {boolean} [options.enableDelegate=false] - Enable the delegate tool for task distribution to subagents
|
|
82692
82776
|
* @param {string} [options.path] - Search directory path
|
|
82777
|
+
* @param {string} [options.cwd] - Working directory for resolving relative paths (independent of allowedFolders)
|
|
82693
82778
|
* @param {string} [options.provider] - Force specific AI provider
|
|
82694
82779
|
* @param {string} [options.model] - Override model name
|
|
82695
82780
|
* @param {boolean} [options.debug] - Enable debug mode
|
|
@@ -82718,6 +82803,7 @@ var init_ProbeAgent = __esm({
|
|
|
82718
82803
|
* @param {Array<Object>} [options.fallback.providers] - List of provider configurations for custom fallback
|
|
82719
82804
|
* @param {boolean} [options.fallback.stopOnSuccess=true] - Stop on first success
|
|
82720
82805
|
* @param {number} [options.fallback.maxTotalAttempts=10] - Maximum total attempts across all providers
|
|
82806
|
+
* @param {string} [options.completionPrompt] - Custom prompt to run after attempt_completion for validation/review (runs before mermaid/JSON validation)
|
|
82721
82807
|
*/
|
|
82722
82808
|
constructor(options = {}) {
|
|
82723
82809
|
this.sessionId = options.sessionId || (0, import_crypto7.randomUUID)();
|
|
@@ -82739,6 +82825,7 @@ var init_ProbeAgent = __esm({
|
|
|
82739
82825
|
this.maxIterations = options.maxIterations || null;
|
|
82740
82826
|
this.disableMermaidValidation = !!options.disableMermaidValidation;
|
|
82741
82827
|
this.disableJsonValidation = !!options.disableJsonValidation;
|
|
82828
|
+
this.completionPrompt = options.completionPrompt || null;
|
|
82742
82829
|
const effectiveAllowedTools = options.disableTools ? [] : options.allowedTools;
|
|
82743
82830
|
this.allowedTools = this._parseAllowedTools(effectiveAllowedTools);
|
|
82744
82831
|
this.storageAdapter = options.storageAdapter || new InMemoryStorageAdapter();
|
|
@@ -82757,6 +82844,7 @@ var init_ProbeAgent = __esm({
|
|
|
82757
82844
|
} else {
|
|
82758
82845
|
this.allowedFolders = [process.cwd()];
|
|
82759
82846
|
}
|
|
82847
|
+
this.cwd = options.cwd || null;
|
|
82760
82848
|
this.clientApiProvider = options.provider || null;
|
|
82761
82849
|
this.clientApiModel = options.model || null;
|
|
82762
82850
|
this.clientApiKey = null;
|
|
@@ -82935,7 +83023,8 @@ var init_ProbeAgent = __esm({
|
|
|
82935
83023
|
const configOptions = {
|
|
82936
83024
|
sessionId: this.sessionId,
|
|
82937
83025
|
debug: this.debug,
|
|
82938
|
-
|
|
83026
|
+
// Use explicit cwd if set, otherwise fall back to first allowed folder
|
|
83027
|
+
cwd: this.cwd || (this.allowedFolders.length > 0 ? this.allowedFolders[0] : process.cwd()),
|
|
82939
83028
|
allowedFolders: this.allowedFolders,
|
|
82940
83029
|
outline: this.outline,
|
|
82941
83030
|
allowEdit: this.allowEdit,
|
|
@@ -82973,7 +83062,7 @@ var init_ProbeAgent = __esm({
|
|
|
82973
83062
|
if (!imagePath) {
|
|
82974
83063
|
throw new Error("Image path is required");
|
|
82975
83064
|
}
|
|
82976
|
-
const filename = (0,
|
|
83065
|
+
const filename = (0, import_path8.basename)(imagePath);
|
|
82977
83066
|
const extension = filename.toLowerCase().split(".").pop();
|
|
82978
83067
|
if (!extension || !SUPPORTED_IMAGE_EXTENSIONS.includes(extension)) {
|
|
82979
83068
|
throw new Error(`Invalid or unsupported image extension: ${extension}. Supported formats: ${SUPPORTED_IMAGE_EXTENSIONS.join(", ")}`);
|
|
@@ -83528,7 +83617,7 @@ var init_ProbeAgent = __esm({
|
|
|
83528
83617
|
let resolvedPath2 = imagePath;
|
|
83529
83618
|
if (!imagePath.includes("/") && !imagePath.includes("\\")) {
|
|
83530
83619
|
for (const dir of listFilesDirectories) {
|
|
83531
|
-
const potentialPath = (0,
|
|
83620
|
+
const potentialPath = (0, import_path8.resolve)(dir, imagePath);
|
|
83532
83621
|
const loaded = await this.loadImageIfValid(potentialPath);
|
|
83533
83622
|
if (loaded) {
|
|
83534
83623
|
if (this.debug) {
|
|
@@ -83553,7 +83642,7 @@ var init_ProbeAgent = __esm({
|
|
|
83553
83642
|
let match2;
|
|
83554
83643
|
while ((match2 = fileHeaderPattern.exec(content)) !== null) {
|
|
83555
83644
|
const filePath = match2[1].trim();
|
|
83556
|
-
const dir = (0,
|
|
83645
|
+
const dir = (0, import_path8.dirname)(filePath);
|
|
83557
83646
|
if (dir && dir !== ".") {
|
|
83558
83647
|
directories.push(dir);
|
|
83559
83648
|
if (this.debug) {
|
|
@@ -83598,17 +83687,17 @@ var init_ProbeAgent = __esm({
|
|
|
83598
83687
|
const allowedDirs = this.allowedFolders && this.allowedFolders.length > 0 ? this.allowedFolders : [process.cwd()];
|
|
83599
83688
|
let absolutePath;
|
|
83600
83689
|
let isPathAllowed2 = false;
|
|
83601
|
-
if ((0,
|
|
83602
|
-
absolutePath = (0,
|
|
83690
|
+
if ((0, import_path8.isAbsolute)(imagePath)) {
|
|
83691
|
+
absolutePath = (0, import_path8.normalize)((0, import_path8.resolve)(imagePath));
|
|
83603
83692
|
isPathAllowed2 = allowedDirs.some((dir) => {
|
|
83604
|
-
const normalizedDir = (0,
|
|
83605
|
-
return absolutePath === normalizedDir || absolutePath.startsWith(normalizedDir +
|
|
83693
|
+
const normalizedDir = (0, import_path8.normalize)((0, import_path8.resolve)(dir));
|
|
83694
|
+
return absolutePath === normalizedDir || absolutePath.startsWith(normalizedDir + import_path8.sep);
|
|
83606
83695
|
});
|
|
83607
83696
|
} else {
|
|
83608
83697
|
for (const dir of allowedDirs) {
|
|
83609
|
-
const normalizedDir = (0,
|
|
83610
|
-
const resolvedPath2 = (0,
|
|
83611
|
-
if (resolvedPath2 === normalizedDir || resolvedPath2.startsWith(normalizedDir +
|
|
83698
|
+
const normalizedDir = (0, import_path8.normalize)((0, import_path8.resolve)(dir));
|
|
83699
|
+
const resolvedPath2 = (0, import_path8.normalize)((0, import_path8.resolve)(dir, imagePath));
|
|
83700
|
+
if (resolvedPath2 === normalizedDir || resolvedPath2.startsWith(normalizedDir + import_path8.sep)) {
|
|
83612
83701
|
absolutePath = resolvedPath2;
|
|
83613
83702
|
isPathAllowed2 = true;
|
|
83614
83703
|
break;
|
|
@@ -84786,6 +84875,46 @@ IMPORTANT: When using <attempt_complete>, this must be the ONLY content in your
|
|
|
84786
84875
|
} catch (error2) {
|
|
84787
84876
|
console.error(`[ERROR] Failed to save messages to storage:`, error2);
|
|
84788
84877
|
}
|
|
84878
|
+
if (completionAttempted && this.completionPrompt && !options._completionPromptProcessed) {
|
|
84879
|
+
if (this.debug) {
|
|
84880
|
+
console.log("[DEBUG] Running completion prompt for post-completion validation/review...");
|
|
84881
|
+
}
|
|
84882
|
+
try {
|
|
84883
|
+
if (this.tracer) {
|
|
84884
|
+
this.tracer.recordEvent("completion_prompt.started", {
|
|
84885
|
+
"completion_prompt.original_result_length": finalResult?.length || 0
|
|
84886
|
+
});
|
|
84887
|
+
}
|
|
84888
|
+
const completionPromptMessage = `${this.completionPrompt}
|
|
84889
|
+
|
|
84890
|
+
Here is the result to review:
|
|
84891
|
+
<result>
|
|
84892
|
+
${finalResult}
|
|
84893
|
+
</result>
|
|
84894
|
+
|
|
84895
|
+
After reviewing, provide your final answer using attempt_completion.`;
|
|
84896
|
+
const completionResult = await this.answer(completionPromptMessage, [], {
|
|
84897
|
+
...options,
|
|
84898
|
+
_completionPromptProcessed: true
|
|
84899
|
+
});
|
|
84900
|
+
finalResult = completionResult;
|
|
84901
|
+
if (this.debug) {
|
|
84902
|
+
console.log(`[DEBUG] Completion prompt finished. New result length: ${finalResult?.length || 0}`);
|
|
84903
|
+
}
|
|
84904
|
+
if (this.tracer) {
|
|
84905
|
+
this.tracer.recordEvent("completion_prompt.completed", {
|
|
84906
|
+
"completion_prompt.final_result_length": finalResult?.length || 0
|
|
84907
|
+
});
|
|
84908
|
+
}
|
|
84909
|
+
} catch (error2) {
|
|
84910
|
+
console.error("[ERROR] Completion prompt failed:", error2);
|
|
84911
|
+
if (this.tracer) {
|
|
84912
|
+
this.tracer.recordEvent("completion_prompt.error", {
|
|
84913
|
+
"completion_prompt.error": error2.message
|
|
84914
|
+
});
|
|
84915
|
+
}
|
|
84916
|
+
}
|
|
84917
|
+
}
|
|
84789
84918
|
const reachedMaxIterations = currentIteration >= maxIterations && !completionAttempted;
|
|
84790
84919
|
if (options.schema && !options._schemaFormatted && !completionAttempted && !reachedMaxIterations) {
|
|
84791
84920
|
if (this.debug) {
|
|
@@ -85252,6 +85381,8 @@ Convert your previous response content into actual JSON data that follows this s
|
|
|
85252
85381
|
path: this.allowedFolders[0],
|
|
85253
85382
|
// Use first allowed folder as primary path
|
|
85254
85383
|
allowedFolders: [...this.allowedFolders],
|
|
85384
|
+
cwd: this.cwd,
|
|
85385
|
+
// Preserve explicit working directory
|
|
85255
85386
|
provider: this.clientApiProvider,
|
|
85256
85387
|
model: this.clientApiModel,
|
|
85257
85388
|
debug: this.debug,
|
|
@@ -85260,6 +85391,7 @@ Convert your previous response content into actual JSON data that follows this s
|
|
|
85260
85391
|
maxIterations: this.maxIterations,
|
|
85261
85392
|
disableMermaidValidation: this.disableMermaidValidation,
|
|
85262
85393
|
disableJsonValidation: this.disableJsonValidation,
|
|
85394
|
+
completionPrompt: this.completionPrompt,
|
|
85263
85395
|
allowedTools: allowedToolsArray,
|
|
85264
85396
|
enableMcp: !!this.mcpBridge,
|
|
85265
85397
|
mcpConfig: this.mcpConfig,
|
|
@@ -85435,7 +85567,7 @@ async function delegate({
|
|
|
85435
85567
|
maxIterations = 30,
|
|
85436
85568
|
tracer = null,
|
|
85437
85569
|
parentSessionId = null,
|
|
85438
|
-
path:
|
|
85570
|
+
path: path9 = null,
|
|
85439
85571
|
provider = null,
|
|
85440
85572
|
model = null
|
|
85441
85573
|
}) {
|
|
@@ -85475,7 +85607,7 @@ async function delegate({
|
|
|
85475
85607
|
maxIterations: remainingIterations,
|
|
85476
85608
|
debug,
|
|
85477
85609
|
tracer,
|
|
85478
|
-
path:
|
|
85610
|
+
path: path9,
|
|
85479
85611
|
// Inherit from parent
|
|
85480
85612
|
provider,
|
|
85481
85613
|
// Inherit from parent
|
|
@@ -85699,15 +85831,15 @@ var init_vercel = __esm({
|
|
|
85699
85831
|
name: "search",
|
|
85700
85832
|
description: searchDescription,
|
|
85701
85833
|
inputSchema: searchSchema,
|
|
85702
|
-
execute: async ({ query: searchQuery, path:
|
|
85834
|
+
execute: async ({ query: searchQuery, path: path9, allow_tests, exact, maxTokens: paramMaxTokens, language }) => {
|
|
85703
85835
|
try {
|
|
85704
85836
|
const effectiveMaxTokens = paramMaxTokens || maxTokens;
|
|
85705
|
-
let searchPath =
|
|
85706
|
-
if ((searchPath === "." || searchPath === "./") && options.
|
|
85837
|
+
let searchPath = path9 || options.cwd || ".";
|
|
85838
|
+
if ((searchPath === "." || searchPath === "./") && options.cwd) {
|
|
85707
85839
|
if (debug) {
|
|
85708
|
-
console.error(`Using
|
|
85840
|
+
console.error(`Using cwd "${options.cwd}" instead of "${searchPath}"`);
|
|
85709
85841
|
}
|
|
85710
|
-
searchPath = options.
|
|
85842
|
+
searchPath = options.cwd;
|
|
85711
85843
|
}
|
|
85712
85844
|
if (debug) {
|
|
85713
85845
|
console.error(`Executing search with query: "${searchQuery}", path: "${searchPath}", exact: ${exact ? "true" : "false"}, language: ${language || "all"}, session: ${sessionId || "none"}`);
|
|
@@ -85715,6 +85847,8 @@ var init_vercel = __esm({
|
|
|
85715
85847
|
const searchOptions = {
|
|
85716
85848
|
query: searchQuery,
|
|
85717
85849
|
path: searchPath,
|
|
85850
|
+
cwd: options.cwd,
|
|
85851
|
+
// Working directory for resolving relative paths
|
|
85718
85852
|
allowTests: allow_tests,
|
|
85719
85853
|
exact,
|
|
85720
85854
|
json: false,
|
|
@@ -85742,14 +85876,14 @@ var init_vercel = __esm({
|
|
|
85742
85876
|
name: "query",
|
|
85743
85877
|
description: queryDescription,
|
|
85744
85878
|
inputSchema: querySchema,
|
|
85745
|
-
execute: async ({ pattern, path:
|
|
85879
|
+
execute: async ({ pattern, path: path9, language, allow_tests }) => {
|
|
85746
85880
|
try {
|
|
85747
|
-
let queryPath =
|
|
85748
|
-
if ((queryPath === "." || queryPath === "./") && options.
|
|
85881
|
+
let queryPath = path9 || options.cwd || ".";
|
|
85882
|
+
if ((queryPath === "." || queryPath === "./") && options.cwd) {
|
|
85749
85883
|
if (debug) {
|
|
85750
|
-
console.error(`Using
|
|
85884
|
+
console.error(`Using cwd "${options.cwd}" instead of "${queryPath}"`);
|
|
85751
85885
|
}
|
|
85752
|
-
queryPath = options.
|
|
85886
|
+
queryPath = options.cwd;
|
|
85753
85887
|
}
|
|
85754
85888
|
if (debug) {
|
|
85755
85889
|
console.error(`Executing query with pattern: "${pattern}", path: "${queryPath}", language: ${language || "auto"}`);
|
|
@@ -85757,6 +85891,8 @@ var init_vercel = __esm({
|
|
|
85757
85891
|
const results = await query({
|
|
85758
85892
|
pattern,
|
|
85759
85893
|
path: queryPath,
|
|
85894
|
+
cwd: options.cwd,
|
|
85895
|
+
// Working directory for resolving relative paths
|
|
85760
85896
|
language,
|
|
85761
85897
|
allow_tests,
|
|
85762
85898
|
json: false
|
|
@@ -85777,22 +85913,16 @@ var init_vercel = __esm({
|
|
|
85777
85913
|
inputSchema: extractSchema,
|
|
85778
85914
|
execute: async ({ targets, input_content, line, end_line, allow_tests, context_lines, format: format2 }) => {
|
|
85779
85915
|
try {
|
|
85780
|
-
|
|
85781
|
-
if ((extractPath === "." || extractPath === "./") && options.defaultPath) {
|
|
85782
|
-
if (debug) {
|
|
85783
|
-
console.error(`Using default path "${options.defaultPath}" instead of "${extractPath}"`);
|
|
85784
|
-
}
|
|
85785
|
-
extractPath = options.defaultPath;
|
|
85786
|
-
}
|
|
85916
|
+
const effectiveCwd = options.cwd || ".";
|
|
85787
85917
|
if (debug) {
|
|
85788
85918
|
if (targets) {
|
|
85789
|
-
console.error(`Executing extract with targets: "${targets}",
|
|
85919
|
+
console.error(`Executing extract with targets: "${targets}", cwd: "${effectiveCwd}", context lines: ${context_lines || 10}`);
|
|
85790
85920
|
} else if (input_content) {
|
|
85791
|
-
console.error(`Executing extract with input content,
|
|
85921
|
+
console.error(`Executing extract with input content, cwd: "${effectiveCwd}", context lines: ${context_lines || 10}`);
|
|
85792
85922
|
}
|
|
85793
85923
|
}
|
|
85794
85924
|
let tempFilePath = null;
|
|
85795
|
-
let extractOptions = {
|
|
85925
|
+
let extractOptions = { cwd: effectiveCwd };
|
|
85796
85926
|
if (input_content) {
|
|
85797
85927
|
const { writeFileSync: writeFileSync2, unlinkSync } = await import("fs");
|
|
85798
85928
|
const { join: join3 } = await import("path");
|
|
@@ -85809,6 +85939,7 @@ var init_vercel = __esm({
|
|
|
85809
85939
|
}
|
|
85810
85940
|
extractOptions = {
|
|
85811
85941
|
inputFile: tempFilePath,
|
|
85942
|
+
cwd: effectiveCwd,
|
|
85812
85943
|
allowTests: allow_tests,
|
|
85813
85944
|
contextLines: context_lines,
|
|
85814
85945
|
format: effectiveFormat
|
|
@@ -85821,6 +85952,7 @@ var init_vercel = __esm({
|
|
|
85821
85952
|
}
|
|
85822
85953
|
extractOptions = {
|
|
85823
85954
|
files,
|
|
85955
|
+
cwd: effectiveCwd,
|
|
85824
85956
|
allowTests: allow_tests,
|
|
85825
85957
|
contextLines: context_lines,
|
|
85826
85958
|
format: effectiveFormat
|
|
@@ -85849,12 +85981,12 @@ var init_vercel = __esm({
|
|
|
85849
85981
|
});
|
|
85850
85982
|
};
|
|
85851
85983
|
delegateTool = (options = {}) => {
|
|
85852
|
-
const { debug = false, timeout = 300,
|
|
85984
|
+
const { debug = false, timeout = 300, cwd, allowedFolders } = options;
|
|
85853
85985
|
return (0, import_ai3.tool)({
|
|
85854
85986
|
name: "delegate",
|
|
85855
85987
|
description: delegateDescription,
|
|
85856
85988
|
inputSchema: delegateSchema,
|
|
85857
|
-
execute: async ({ task, currentIteration, maxIterations, parentSessionId, path:
|
|
85989
|
+
execute: async ({ task, currentIteration, maxIterations, parentSessionId, path: path9, provider, model, tracer }) => {
|
|
85858
85990
|
if (!task || typeof task !== "string") {
|
|
85859
85991
|
throw new Error("Task parameter is required and must be a non-empty string");
|
|
85860
85992
|
}
|
|
@@ -85870,7 +86002,7 @@ var init_vercel = __esm({
|
|
|
85870
86002
|
if (parentSessionId !== void 0 && parentSessionId !== null && typeof parentSessionId !== "string") {
|
|
85871
86003
|
throw new TypeError("parentSessionId must be a string, null, or undefined");
|
|
85872
86004
|
}
|
|
85873
|
-
if (
|
|
86005
|
+
if (path9 !== void 0 && path9 !== null && typeof path9 !== "string") {
|
|
85874
86006
|
throw new TypeError("path must be a string, null, or undefined");
|
|
85875
86007
|
}
|
|
85876
86008
|
if (provider !== void 0 && provider !== null && typeof provider !== "string") {
|
|
@@ -85879,13 +86011,13 @@ var init_vercel = __esm({
|
|
|
85879
86011
|
if (model !== void 0 && model !== null && typeof model !== "string") {
|
|
85880
86012
|
throw new TypeError("model must be a string, null, or undefined");
|
|
85881
86013
|
}
|
|
85882
|
-
const effectivePath =
|
|
86014
|
+
const effectivePath = path9 || cwd || allowedFolders && allowedFolders[0];
|
|
85883
86015
|
if (debug) {
|
|
85884
86016
|
console.error(`Executing delegate with task: "${task.substring(0, 100)}${task.length > 100 ? "..." : ""}"`);
|
|
85885
86017
|
if (parentSessionId) {
|
|
85886
86018
|
console.error(`Parent session: ${parentSessionId}`);
|
|
85887
86019
|
}
|
|
85888
|
-
if (effectivePath && effectivePath !==
|
|
86020
|
+
if (effectivePath && effectivePath !== path9) {
|
|
85889
86021
|
console.error(`Using inherited path: ${effectivePath}`);
|
|
85890
86022
|
}
|
|
85891
86023
|
}
|
|
@@ -86742,8 +86874,8 @@ async function executeBashCommand(command, options = {}) {
|
|
|
86742
86874
|
} = options;
|
|
86743
86875
|
let cwd = workingDirectory;
|
|
86744
86876
|
try {
|
|
86745
|
-
cwd = (0,
|
|
86746
|
-
if (!(0,
|
|
86877
|
+
cwd = (0, import_path9.resolve)(cwd);
|
|
86878
|
+
if (!(0, import_fs9.existsSync)(cwd)) {
|
|
86747
86879
|
throw new Error(`Working directory does not exist: ${cwd}`);
|
|
86748
86880
|
}
|
|
86749
86881
|
} catch (error2) {
|
|
@@ -86955,7 +87087,7 @@ function validateExecutionOptions(options = {}) {
|
|
|
86955
87087
|
if (options.workingDirectory) {
|
|
86956
87088
|
if (typeof options.workingDirectory !== "string") {
|
|
86957
87089
|
errors.push("workingDirectory must be a string");
|
|
86958
|
-
} else if (!(0,
|
|
87090
|
+
} else if (!(0, import_fs9.existsSync)(options.workingDirectory)) {
|
|
86959
87091
|
errors.push(`workingDirectory does not exist: ${options.workingDirectory}`);
|
|
86960
87092
|
}
|
|
86961
87093
|
}
|
|
@@ -86968,31 +87100,31 @@ function validateExecutionOptions(options = {}) {
|
|
|
86968
87100
|
warnings
|
|
86969
87101
|
};
|
|
86970
87102
|
}
|
|
86971
|
-
var import_child_process9,
|
|
87103
|
+
var import_child_process9, import_path9, import_fs9;
|
|
86972
87104
|
var init_bashExecutor = __esm({
|
|
86973
87105
|
"src/agent/bashExecutor.js"() {
|
|
86974
87106
|
"use strict";
|
|
86975
87107
|
import_child_process9 = require("child_process");
|
|
86976
|
-
|
|
86977
|
-
|
|
87108
|
+
import_path9 = require("path");
|
|
87109
|
+
import_fs9 = require("fs");
|
|
86978
87110
|
init_bashCommandUtils();
|
|
86979
87111
|
}
|
|
86980
87112
|
});
|
|
86981
87113
|
|
|
86982
87114
|
// src/tools/bash.js
|
|
86983
|
-
var import_ai4,
|
|
87115
|
+
var import_ai4, import_path10, bashTool;
|
|
86984
87116
|
var init_bash = __esm({
|
|
86985
87117
|
"src/tools/bash.js"() {
|
|
86986
87118
|
"use strict";
|
|
86987
87119
|
import_ai4 = require("ai");
|
|
86988
|
-
|
|
87120
|
+
import_path10 = require("path");
|
|
86989
87121
|
init_bashPermissions();
|
|
86990
87122
|
init_bashExecutor();
|
|
86991
87123
|
bashTool = (options = {}) => {
|
|
86992
87124
|
const {
|
|
86993
87125
|
bashConfig = {},
|
|
86994
87126
|
debug = false,
|
|
86995
|
-
|
|
87127
|
+
cwd,
|
|
86996
87128
|
allowedFolders = []
|
|
86997
87129
|
} = options;
|
|
86998
87130
|
const permissionChecker = new BashPermissionChecker({
|
|
@@ -87006,8 +87138,8 @@ var init_bash = __esm({
|
|
|
87006
87138
|
if (bashConfig.workingDirectory) {
|
|
87007
87139
|
return bashConfig.workingDirectory;
|
|
87008
87140
|
}
|
|
87009
|
-
if (
|
|
87010
|
-
return
|
|
87141
|
+
if (cwd) {
|
|
87142
|
+
return cwd;
|
|
87011
87143
|
}
|
|
87012
87144
|
if (allowedFolders && allowedFolders.length > 0) {
|
|
87013
87145
|
return allowedFolders[0];
|
|
@@ -87095,9 +87227,9 @@ For code exploration, try these safe alternatives:
|
|
|
87095
87227
|
}
|
|
87096
87228
|
const workingDir = workingDirectory || getDefaultWorkingDirectory();
|
|
87097
87229
|
if (allowedFolders && allowedFolders.length > 0) {
|
|
87098
|
-
const resolvedWorkingDir = (0,
|
|
87230
|
+
const resolvedWorkingDir = (0, import_path10.resolve)(workingDir);
|
|
87099
87231
|
const isAllowed = allowedFolders.some((folder) => {
|
|
87100
|
-
const resolvedFolder = (0,
|
|
87232
|
+
const resolvedFolder = (0, import_path10.resolve)(folder);
|
|
87101
87233
|
return resolvedWorkingDir.startsWith(resolvedFolder);
|
|
87102
87234
|
});
|
|
87103
87235
|
if (!isAllowed) {
|
|
@@ -87153,33 +87285,33 @@ Command failed with exit code ${result.exitCode}`;
|
|
|
87153
87285
|
// src/tools/edit.js
|
|
87154
87286
|
function isPathAllowed(filePath, allowedFolders) {
|
|
87155
87287
|
if (!allowedFolders || allowedFolders.length === 0) {
|
|
87156
|
-
const resolvedPath3 = (0,
|
|
87157
|
-
const cwd = (0,
|
|
87158
|
-
return resolvedPath3 === cwd || resolvedPath3.startsWith(cwd +
|
|
87288
|
+
const resolvedPath3 = (0, import_path11.resolve)(filePath);
|
|
87289
|
+
const cwd = (0, import_path11.resolve)(process.cwd());
|
|
87290
|
+
return resolvedPath3 === cwd || resolvedPath3.startsWith(cwd + import_path11.sep);
|
|
87159
87291
|
}
|
|
87160
|
-
const resolvedPath2 = (0,
|
|
87292
|
+
const resolvedPath2 = (0, import_path11.resolve)(filePath);
|
|
87161
87293
|
return allowedFolders.some((folder) => {
|
|
87162
|
-
const allowedPath = (0,
|
|
87163
|
-
return resolvedPath2 === allowedPath || resolvedPath2.startsWith(allowedPath +
|
|
87294
|
+
const allowedPath = (0, import_path11.resolve)(folder);
|
|
87295
|
+
return resolvedPath2 === allowedPath || resolvedPath2.startsWith(allowedPath + import_path11.sep);
|
|
87164
87296
|
});
|
|
87165
87297
|
}
|
|
87166
87298
|
function parseFileToolOptions(options = {}) {
|
|
87167
87299
|
return {
|
|
87168
87300
|
debug: options.debug || false,
|
|
87169
87301
|
allowedFolders: options.allowedFolders || [],
|
|
87170
|
-
|
|
87302
|
+
cwd: options.cwd
|
|
87171
87303
|
};
|
|
87172
87304
|
}
|
|
87173
|
-
var import_ai5,
|
|
87305
|
+
var import_ai5, import_fs10, import_path11, import_fs11, editTool, createTool, editSchema, createSchema, editDescription, createDescription, editToolDefinition, createToolDefinition;
|
|
87174
87306
|
var init_edit = __esm({
|
|
87175
87307
|
"src/tools/edit.js"() {
|
|
87176
87308
|
"use strict";
|
|
87177
87309
|
import_ai5 = require("ai");
|
|
87178
|
-
|
|
87179
|
-
|
|
87180
|
-
|
|
87310
|
+
import_fs10 = require("fs");
|
|
87311
|
+
import_path11 = require("path");
|
|
87312
|
+
import_fs11 = require("fs");
|
|
87181
87313
|
editTool = (options = {}) => {
|
|
87182
|
-
const { debug, allowedFolders,
|
|
87314
|
+
const { debug, allowedFolders, cwd } = parseFileToolOptions(options);
|
|
87183
87315
|
return (0, import_ai5.tool)({
|
|
87184
87316
|
name: "edit",
|
|
87185
87317
|
description: `Edit files using exact string replacement (Claude Code style).
|
|
@@ -87230,17 +87362,17 @@ Important:
|
|
|
87230
87362
|
if (new_string === void 0 || new_string === null || typeof new_string !== "string") {
|
|
87231
87363
|
return `Error editing file: Invalid new_string - must be a string`;
|
|
87232
87364
|
}
|
|
87233
|
-
const resolvedPath2 = (0,
|
|
87365
|
+
const resolvedPath2 = (0, import_path11.isAbsolute)(file_path) ? file_path : (0, import_path11.resolve)(cwd || process.cwd(), file_path);
|
|
87234
87366
|
if (debug) {
|
|
87235
87367
|
console.error(`[Edit] Attempting to edit file: ${resolvedPath2}`);
|
|
87236
87368
|
}
|
|
87237
87369
|
if (!isPathAllowed(resolvedPath2, allowedFolders)) {
|
|
87238
87370
|
return `Error editing file: Permission denied - ${file_path} is outside allowed directories`;
|
|
87239
87371
|
}
|
|
87240
|
-
if (!(0,
|
|
87372
|
+
if (!(0, import_fs11.existsSync)(resolvedPath2)) {
|
|
87241
87373
|
return `Error editing file: File not found - ${file_path}`;
|
|
87242
87374
|
}
|
|
87243
|
-
const content = await
|
|
87375
|
+
const content = await import_fs10.promises.readFile(resolvedPath2, "utf-8");
|
|
87244
87376
|
if (!content.includes(old_string)) {
|
|
87245
87377
|
return `Error editing file: String not found - the specified old_string was not found in ${file_path}`;
|
|
87246
87378
|
}
|
|
@@ -87257,7 +87389,7 @@ Important:
|
|
|
87257
87389
|
if (newContent === content) {
|
|
87258
87390
|
return `Error editing file: No changes made - old_string and new_string might be the same`;
|
|
87259
87391
|
}
|
|
87260
|
-
await
|
|
87392
|
+
await import_fs10.promises.writeFile(resolvedPath2, newContent, "utf-8");
|
|
87261
87393
|
const replacedCount = replace_all ? occurrences : 1;
|
|
87262
87394
|
if (debug) {
|
|
87263
87395
|
console.error(`[Edit] Successfully edited ${resolvedPath2}, replaced ${replacedCount} occurrence(s)`);
|
|
@@ -87271,7 +87403,7 @@ Important:
|
|
|
87271
87403
|
});
|
|
87272
87404
|
};
|
|
87273
87405
|
createTool = (options = {}) => {
|
|
87274
|
-
const { debug, allowedFolders,
|
|
87406
|
+
const { debug, allowedFolders, cwd } = parseFileToolOptions(options);
|
|
87275
87407
|
return (0, import_ai5.tool)({
|
|
87276
87408
|
name: "create",
|
|
87277
87409
|
description: `Create new files with specified content.
|
|
@@ -87314,20 +87446,20 @@ Important:
|
|
|
87314
87446
|
if (content === void 0 || content === null || typeof content !== "string") {
|
|
87315
87447
|
return `Error creating file: Invalid content - must be a string`;
|
|
87316
87448
|
}
|
|
87317
|
-
const resolvedPath2 = (0,
|
|
87449
|
+
const resolvedPath2 = (0, import_path11.isAbsolute)(file_path) ? file_path : (0, import_path11.resolve)(cwd || process.cwd(), file_path);
|
|
87318
87450
|
if (debug) {
|
|
87319
87451
|
console.error(`[Create] Attempting to create file: ${resolvedPath2}`);
|
|
87320
87452
|
}
|
|
87321
87453
|
if (!isPathAllowed(resolvedPath2, allowedFolders)) {
|
|
87322
87454
|
return `Error creating file: Permission denied - ${file_path} is outside allowed directories`;
|
|
87323
87455
|
}
|
|
87324
|
-
if ((0,
|
|
87456
|
+
if ((0, import_fs11.existsSync)(resolvedPath2) && !overwrite) {
|
|
87325
87457
|
return `Error creating file: File already exists - ${file_path}. Use overwrite: true to replace it.`;
|
|
87326
87458
|
}
|
|
87327
|
-
const dir = (0,
|
|
87328
|
-
await
|
|
87329
|
-
await
|
|
87330
|
-
const action = (0,
|
|
87459
|
+
const dir = (0, import_path11.dirname)(resolvedPath2);
|
|
87460
|
+
await import_fs10.promises.mkdir(dir, { recursive: true });
|
|
87461
|
+
await import_fs10.promises.writeFile(resolvedPath2, content, "utf-8");
|
|
87462
|
+
const action = (0, import_fs11.existsSync)(resolvedPath2) && overwrite ? "overwrote" : "created";
|
|
87331
87463
|
const bytes = Buffer.byteLength(content, "utf-8");
|
|
87332
87464
|
if (debug) {
|
|
87333
87465
|
console.error(`[Create] Successfully ${action} ${resolvedPath2}`);
|
|
@@ -87468,16 +87600,19 @@ This is a new project.</content>
|
|
|
87468
87600
|
});
|
|
87469
87601
|
|
|
87470
87602
|
// src/tools/langchain.js
|
|
87471
|
-
function createSearchTool() {
|
|
87603
|
+
function createSearchTool(options = {}) {
|
|
87604
|
+
const { cwd } = options;
|
|
87472
87605
|
return {
|
|
87473
87606
|
name: "search",
|
|
87474
87607
|
description: searchDescription,
|
|
87475
87608
|
schema: searchSchema,
|
|
87476
|
-
func: async ({ query: searchQuery, path:
|
|
87609
|
+
func: async ({ query: searchQuery, path: path9, allow_tests, exact, maxResults, maxTokens = 1e4, language }) => {
|
|
87477
87610
|
try {
|
|
87478
87611
|
const results = await search({
|
|
87479
87612
|
query: searchQuery,
|
|
87480
|
-
path:
|
|
87613
|
+
path: path9,
|
|
87614
|
+
cwd,
|
|
87615
|
+
// Working directory for resolving relative paths
|
|
87481
87616
|
allow_tests,
|
|
87482
87617
|
exact,
|
|
87483
87618
|
json: false,
|
|
@@ -87493,16 +87628,19 @@ function createSearchTool() {
|
|
|
87493
87628
|
}
|
|
87494
87629
|
};
|
|
87495
87630
|
}
|
|
87496
|
-
function createQueryTool() {
|
|
87631
|
+
function createQueryTool(options = {}) {
|
|
87632
|
+
const { cwd } = options;
|
|
87497
87633
|
return {
|
|
87498
87634
|
name: "query",
|
|
87499
87635
|
description: queryDescription,
|
|
87500
87636
|
schema: querySchema,
|
|
87501
|
-
func: async ({ pattern, path:
|
|
87637
|
+
func: async ({ pattern, path: path9, language, allow_tests }) => {
|
|
87502
87638
|
try {
|
|
87503
87639
|
const results = await query({
|
|
87504
87640
|
pattern,
|
|
87505
|
-
path:
|
|
87641
|
+
path: path9,
|
|
87642
|
+
cwd,
|
|
87643
|
+
// Working directory for resolving relative paths
|
|
87506
87644
|
language,
|
|
87507
87645
|
allow_tests,
|
|
87508
87646
|
json: false
|
|
@@ -87515,7 +87653,8 @@ function createQueryTool() {
|
|
|
87515
87653
|
}
|
|
87516
87654
|
};
|
|
87517
87655
|
}
|
|
87518
|
-
function createExtractTool() {
|
|
87656
|
+
function createExtractTool(options = {}) {
|
|
87657
|
+
const { cwd } = options;
|
|
87519
87658
|
return {
|
|
87520
87659
|
name: "extract",
|
|
87521
87660
|
description: extractDescription,
|
|
@@ -87525,6 +87664,8 @@ function createExtractTool() {
|
|
|
87525
87664
|
const files = parseTargets(targets);
|
|
87526
87665
|
const results = await extract({
|
|
87527
87666
|
files,
|
|
87667
|
+
cwd,
|
|
87668
|
+
// Working directory for resolving relative paths
|
|
87528
87669
|
allowTests: allow_tests,
|
|
87529
87670
|
contextLines: context_lines,
|
|
87530
87671
|
format: format2
|
|
@@ -87743,10 +87884,10 @@ async function listFilesByLevel(options) {
|
|
|
87743
87884
|
maxFiles = 100,
|
|
87744
87885
|
respectGitignore = true
|
|
87745
87886
|
} = options;
|
|
87746
|
-
if (!
|
|
87887
|
+
if (!import_fs12.default.existsSync(directory)) {
|
|
87747
87888
|
throw new Error(`Directory does not exist: ${directory}`);
|
|
87748
87889
|
}
|
|
87749
|
-
const gitDirExists =
|
|
87890
|
+
const gitDirExists = import_fs12.default.existsSync(import_path12.default.join(directory, ".git"));
|
|
87750
87891
|
if (gitDirExists && respectGitignore) {
|
|
87751
87892
|
try {
|
|
87752
87893
|
return await listFilesUsingGit(directory, maxFiles);
|
|
@@ -87761,8 +87902,8 @@ async function listFilesUsingGit(directory, maxFiles) {
|
|
|
87761
87902
|
const { stdout } = await execAsync3("git ls-files", { cwd: directory });
|
|
87762
87903
|
const files = stdout.split("\n").filter(Boolean);
|
|
87763
87904
|
const sortedFiles = files.sort((a4, b4) => {
|
|
87764
|
-
const depthA = a4.split(
|
|
87765
|
-
const depthB = b4.split(
|
|
87905
|
+
const depthA = a4.split(import_path12.default.sep).length;
|
|
87906
|
+
const depthB = b4.split(import_path12.default.sep).length;
|
|
87766
87907
|
return depthA - depthB;
|
|
87767
87908
|
});
|
|
87768
87909
|
return sortedFiles.slice(0, maxFiles);
|
|
@@ -87777,19 +87918,25 @@ async function listFilesByLevelManually(directory, maxFiles, respectGitignore) {
|
|
|
87777
87918
|
while (queue.length > 0 && result.length < maxFiles) {
|
|
87778
87919
|
const { dir, level } = queue.shift();
|
|
87779
87920
|
try {
|
|
87780
|
-
const entries =
|
|
87781
|
-
const files = entries.filter((entry) =>
|
|
87921
|
+
const entries = import_fs12.default.readdirSync(dir, { withFileTypes: true });
|
|
87922
|
+
const files = entries.filter((entry) => {
|
|
87923
|
+
const fullPath = import_path12.default.join(dir, entry.name);
|
|
87924
|
+
return getEntryTypeSync(entry, fullPath).isFile;
|
|
87925
|
+
});
|
|
87782
87926
|
for (const file of files) {
|
|
87783
87927
|
if (result.length >= maxFiles) break;
|
|
87784
|
-
const filePath =
|
|
87785
|
-
const relativePath =
|
|
87928
|
+
const filePath = import_path12.default.join(dir, file.name);
|
|
87929
|
+
const relativePath = import_path12.default.relative(directory, filePath);
|
|
87786
87930
|
if (shouldIgnore(relativePath, ignorePatterns)) continue;
|
|
87787
87931
|
result.push(relativePath);
|
|
87788
87932
|
}
|
|
87789
|
-
const dirs = entries.filter((entry) =>
|
|
87933
|
+
const dirs = entries.filter((entry) => {
|
|
87934
|
+
const fullPath = import_path12.default.join(dir, entry.name);
|
|
87935
|
+
return getEntryTypeSync(entry, fullPath).isDirectory;
|
|
87936
|
+
});
|
|
87790
87937
|
for (const subdir of dirs) {
|
|
87791
|
-
const subdirPath =
|
|
87792
|
-
const relativeSubdirPath =
|
|
87938
|
+
const subdirPath = import_path12.default.join(dir, subdir.name);
|
|
87939
|
+
const relativeSubdirPath = import_path12.default.relative(directory, subdirPath);
|
|
87793
87940
|
if (shouldIgnore(relativeSubdirPath, ignorePatterns)) continue;
|
|
87794
87941
|
if (subdir.name === "node_modules" || subdir.name === ".git") continue;
|
|
87795
87942
|
queue.push({ dir: subdirPath, level: level + 1 });
|
|
@@ -87801,12 +87948,12 @@ async function listFilesByLevelManually(directory, maxFiles, respectGitignore) {
|
|
|
87801
87948
|
return result;
|
|
87802
87949
|
}
|
|
87803
87950
|
function loadGitignorePatterns(directory) {
|
|
87804
|
-
const gitignorePath =
|
|
87805
|
-
if (!
|
|
87951
|
+
const gitignorePath = import_path12.default.join(directory, ".gitignore");
|
|
87952
|
+
if (!import_fs12.default.existsSync(gitignorePath)) {
|
|
87806
87953
|
return [];
|
|
87807
87954
|
}
|
|
87808
87955
|
try {
|
|
87809
|
-
const content =
|
|
87956
|
+
const content = import_fs12.default.readFileSync(gitignorePath, "utf8");
|
|
87810
87957
|
return content.split("\n").map((line) => line.trim()).filter((line) => line && !line.startsWith("#"));
|
|
87811
87958
|
} catch (error2) {
|
|
87812
87959
|
console.error(`Warning: Could not read .gitignore: ${error2.message}`);
|
|
@@ -87824,14 +87971,15 @@ function shouldIgnore(filePath, ignorePatterns) {
|
|
|
87824
87971
|
}
|
|
87825
87972
|
return false;
|
|
87826
87973
|
}
|
|
87827
|
-
var
|
|
87974
|
+
var import_fs12, import_path12, import_util12, import_child_process10, execAsync3;
|
|
87828
87975
|
var init_file_lister = __esm({
|
|
87829
87976
|
"src/utils/file-lister.js"() {
|
|
87830
87977
|
"use strict";
|
|
87831
|
-
|
|
87832
|
-
|
|
87978
|
+
import_fs12 = __toESM(require("fs"), 1);
|
|
87979
|
+
import_path12 = __toESM(require("path"), 1);
|
|
87833
87980
|
import_util12 = require("util");
|
|
87834
87981
|
import_child_process10 = require("child_process");
|
|
87982
|
+
init_symlink_utils();
|
|
87835
87983
|
execAsync3 = (0, import_util12.promisify)(import_child_process10.exec);
|
|
87836
87984
|
}
|
|
87837
87985
|
});
|
|
@@ -87846,12 +87994,12 @@ function initializeSimpleTelemetryFromOptions(options) {
|
|
|
87846
87994
|
});
|
|
87847
87995
|
return telemetry;
|
|
87848
87996
|
}
|
|
87849
|
-
var
|
|
87997
|
+
var import_fs13, import_path13, SimpleTelemetry, SimpleAppTracer;
|
|
87850
87998
|
var init_simpleTelemetry = __esm({
|
|
87851
87999
|
"src/agent/simpleTelemetry.js"() {
|
|
87852
88000
|
"use strict";
|
|
87853
|
-
|
|
87854
|
-
|
|
88001
|
+
import_fs13 = require("fs");
|
|
88002
|
+
import_path13 = require("path");
|
|
87855
88003
|
SimpleTelemetry = class {
|
|
87856
88004
|
constructor(options = {}) {
|
|
87857
88005
|
this.serviceName = options.serviceName || "probe-agent";
|
|
@@ -87865,11 +88013,11 @@ var init_simpleTelemetry = __esm({
|
|
|
87865
88013
|
}
|
|
87866
88014
|
initializeFileExporter() {
|
|
87867
88015
|
try {
|
|
87868
|
-
const dir = (0,
|
|
87869
|
-
if (!(0,
|
|
87870
|
-
(0,
|
|
88016
|
+
const dir = (0, import_path13.dirname)(this.filePath);
|
|
88017
|
+
if (!(0, import_fs13.existsSync)(dir)) {
|
|
88018
|
+
(0, import_fs13.mkdirSync)(dir, { recursive: true });
|
|
87871
88019
|
}
|
|
87872
|
-
this.stream = (0,
|
|
88020
|
+
this.stream = (0, import_fs13.createWriteStream)(this.filePath, { flags: "a" });
|
|
87873
88021
|
this.stream.on("error", (error2) => {
|
|
87874
88022
|
console.error(`[SimpleTelemetry] Stream error: ${error2.message}`);
|
|
87875
88023
|
});
|