@probelabs/probe 0.6.0-rc174 → 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 +317 -229
- package/build/extract.js +13 -5
- 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/path-validation.js +58 -0
- package/cjs/agent/ProbeAgent.cjs +449 -360
- package/cjs/index.cjs +469 -371
- package/index.d.ts +12 -1
- package/package.json +1 -1
- package/src/agent/ProbeAgent.d.ts +6 -0
- package/src/agent/ProbeAgent.js +69 -1
- package/src/extract.js +13 -5
- 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/path-validation.js +58 -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) {
|
|
@@ -1428,6 +1428,32 @@ var init_utils = __esm({
|
|
|
1428
1428
|
}
|
|
1429
1429
|
});
|
|
1430
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
|
+
|
|
1431
1457
|
// src/search.js
|
|
1432
1458
|
async function search(options) {
|
|
1433
1459
|
if (!options || !options.path) {
|
|
@@ -1467,9 +1493,11 @@ async function search(options) {
|
|
|
1467
1493
|
options.session = process.env.PROBE_SESSION_ID;
|
|
1468
1494
|
}
|
|
1469
1495
|
const queries = Array.isArray(options.query) ? options.query : [options.query];
|
|
1496
|
+
const cwd = await validateCwdPath(options.cwd);
|
|
1470
1497
|
if (process.env.DEBUG === "1") {
|
|
1471
1498
|
let logMessage = `
|
|
1472
1499
|
Search: query="${queries[0]}" path="${options.path}"`;
|
|
1500
|
+
if (options.cwd) logMessage += ` cwd="${options.cwd}"`;
|
|
1473
1501
|
if (options.maxResults) logMessage += ` maxResults=${options.maxResults}`;
|
|
1474
1502
|
logMessage += ` maxTokens=${options.maxTokens}`;
|
|
1475
1503
|
logMessage += ` timeout=${options.timeout}`;
|
|
@@ -1489,6 +1517,7 @@ Search: query="${queries[0]}" path="${options.path}"`;
|
|
|
1489
1517
|
}
|
|
1490
1518
|
try {
|
|
1491
1519
|
const { stdout, stderr } = await execFileAsync(binaryPath, args, {
|
|
1520
|
+
cwd,
|
|
1492
1521
|
timeout: options.timeout * 1e3,
|
|
1493
1522
|
// Convert seconds to milliseconds
|
|
1494
1523
|
maxBuffer: 50 * 1024 * 1024
|
|
@@ -1542,13 +1571,15 @@ Search results: ${resultCount} matches, ${tokenCount} tokens`;
|
|
|
1542
1571
|
if (error2.code === "ETIMEDOUT" || error2.killed) {
|
|
1543
1572
|
const timeoutMessage = `Search operation timed out after ${options.timeout} seconds.
|
|
1544
1573
|
Binary: ${binaryPath}
|
|
1545
|
-
Args: ${args.join(" ")}
|
|
1574
|
+
Args: ${args.join(" ")}
|
|
1575
|
+
Cwd: ${cwd}`;
|
|
1546
1576
|
console.error(timeoutMessage);
|
|
1547
1577
|
throw new Error(timeoutMessage);
|
|
1548
1578
|
}
|
|
1549
1579
|
const errorMessage = `Error executing search command: ${error2.message}
|
|
1550
1580
|
Binary: ${binaryPath}
|
|
1551
|
-
Args: ${args.join(" ")}
|
|
1581
|
+
Args: ${args.join(" ")}
|
|
1582
|
+
Cwd: ${cwd}`;
|
|
1552
1583
|
throw new Error(errorMessage);
|
|
1553
1584
|
}
|
|
1554
1585
|
}
|
|
@@ -1559,6 +1590,7 @@ var init_search = __esm({
|
|
|
1559
1590
|
import_child_process2 = require("child_process");
|
|
1560
1591
|
import_util2 = require("util");
|
|
1561
1592
|
init_utils();
|
|
1593
|
+
init_path_validation();
|
|
1562
1594
|
execFileAsync = (0, import_util2.promisify)(import_child_process2.execFile);
|
|
1563
1595
|
SEARCH_FLAG_MAP = {
|
|
1564
1596
|
filesOnly: "--files-only",
|
|
@@ -1596,8 +1628,10 @@ async function query(options) {
|
|
|
1596
1628
|
cliArgs.push("--format", "json");
|
|
1597
1629
|
}
|
|
1598
1630
|
cliArgs.push(escapeString(options.pattern), escapeString(options.path));
|
|
1631
|
+
const cwd = await validateCwdPath(options.cwd);
|
|
1599
1632
|
if (process.env.DEBUG === "1") {
|
|
1600
1633
|
let logMessage = `Query: pattern="${options.pattern}" path="${options.path}"`;
|
|
1634
|
+
if (options.cwd) logMessage += ` cwd="${options.cwd}"`;
|
|
1601
1635
|
if (options.language) logMessage += ` language=${options.language}`;
|
|
1602
1636
|
if (options.maxResults) logMessage += ` maxResults=${options.maxResults}`;
|
|
1603
1637
|
if (options.allowTests) logMessage += " allowTests=true";
|
|
@@ -1605,7 +1639,7 @@ async function query(options) {
|
|
|
1605
1639
|
}
|
|
1606
1640
|
const command = `${binaryPath} query ${cliArgs.join(" ")}`;
|
|
1607
1641
|
try {
|
|
1608
|
-
const { stdout, stderr } = await execAsync(command);
|
|
1642
|
+
const { stdout, stderr } = await execAsync(command, { cwd });
|
|
1609
1643
|
if (stderr) {
|
|
1610
1644
|
console.error(`stderr: ${stderr}`);
|
|
1611
1645
|
}
|
|
@@ -1630,7 +1664,8 @@ async function query(options) {
|
|
|
1630
1664
|
return stdout;
|
|
1631
1665
|
} catch (error2) {
|
|
1632
1666
|
const errorMessage = `Error executing query command: ${error2.message}
|
|
1633
|
-
Command: ${command}
|
|
1667
|
+
Command: ${command}
|
|
1668
|
+
Cwd: ${cwd}`;
|
|
1634
1669
|
throw new Error(errorMessage);
|
|
1635
1670
|
}
|
|
1636
1671
|
}
|
|
@@ -1641,6 +1676,7 @@ var init_query = __esm({
|
|
|
1641
1676
|
import_child_process3 = require("child_process");
|
|
1642
1677
|
import_util3 = require("util");
|
|
1643
1678
|
init_utils();
|
|
1679
|
+
init_path_validation();
|
|
1644
1680
|
execAsync = (0, import_util3.promisify)(import_child_process3.exec);
|
|
1645
1681
|
QUERY_FLAG_MAP = {
|
|
1646
1682
|
language: "--language",
|
|
@@ -1675,6 +1711,7 @@ async function extract(options) {
|
|
|
1675
1711
|
cliArgs.push(escapeString(file));
|
|
1676
1712
|
}
|
|
1677
1713
|
}
|
|
1714
|
+
const cwd = await validateCwdPath(options.cwd);
|
|
1678
1715
|
if (process.env.DEBUG === "1") {
|
|
1679
1716
|
let logMessage = `
|
|
1680
1717
|
Extract:`;
|
|
@@ -1683,6 +1720,7 @@ Extract:`;
|
|
|
1683
1720
|
}
|
|
1684
1721
|
if (options.inputFile) logMessage += ` inputFile="${options.inputFile}"`;
|
|
1685
1722
|
if (options.content) logMessage += ` content=(${typeof options.content === "string" ? options.content.length : options.content.byteLength} bytes)`;
|
|
1723
|
+
if (options.cwd) logMessage += ` cwd="${cwd}"`;
|
|
1686
1724
|
if (options.allowTests) logMessage += " allowTests=true";
|
|
1687
1725
|
if (options.contextLines) logMessage += ` contextLines=${options.contextLines}`;
|
|
1688
1726
|
if (options.format) logMessage += ` format=${options.format}`;
|
|
@@ -1690,25 +1728,27 @@ Extract:`;
|
|
|
1690
1728
|
console.error(logMessage);
|
|
1691
1729
|
}
|
|
1692
1730
|
if (hasContent) {
|
|
1693
|
-
return extractWithStdin(binaryPath, cliArgs, options.content, options);
|
|
1731
|
+
return extractWithStdin(binaryPath, cliArgs, options.content, options, cwd);
|
|
1694
1732
|
}
|
|
1695
1733
|
const command = `${binaryPath} extract ${cliArgs.join(" ")}`;
|
|
1696
1734
|
try {
|
|
1697
|
-
const { stdout, stderr } = await execAsync2(command);
|
|
1735
|
+
const { stdout, stderr } = await execAsync2(command, { cwd });
|
|
1698
1736
|
if (stderr) {
|
|
1699
1737
|
console.error(`stderr: ${stderr}`);
|
|
1700
1738
|
}
|
|
1701
1739
|
return processExtractOutput(stdout, options);
|
|
1702
1740
|
} catch (error2) {
|
|
1703
1741
|
const errorMessage = `Error executing extract command: ${error2.message}
|
|
1704
|
-
Command: ${command}
|
|
1742
|
+
Command: ${command}
|
|
1743
|
+
Cwd: ${cwd}`;
|
|
1705
1744
|
throw new Error(errorMessage);
|
|
1706
1745
|
}
|
|
1707
1746
|
}
|
|
1708
|
-
function extractWithStdin(binaryPath, cliArgs, content, options) {
|
|
1747
|
+
function extractWithStdin(binaryPath, cliArgs, content, options, cwd) {
|
|
1709
1748
|
return new Promise((resolve5, reject2) => {
|
|
1710
1749
|
const childProcess = (0, import_child_process4.spawn)(binaryPath, ["extract", ...cliArgs], {
|
|
1711
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
1750
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
1751
|
+
cwd
|
|
1712
1752
|
});
|
|
1713
1753
|
let stdout = "";
|
|
1714
1754
|
let stderr = "";
|
|
@@ -1799,6 +1839,7 @@ var init_extract = __esm({
|
|
|
1799
1839
|
import_child_process4 = require("child_process");
|
|
1800
1840
|
import_util4 = require("util");
|
|
1801
1841
|
init_utils();
|
|
1842
|
+
init_path_validation();
|
|
1802
1843
|
execAsync2 = (0, import_util4.promisify)(import_child_process4.exec);
|
|
1803
1844
|
EXTRACT_FLAG_MAP = {
|
|
1804
1845
|
allowTests: "--allow-tests",
|
|
@@ -3170,9 +3211,9 @@ var init_createPaginator = __esm({
|
|
|
3170
3211
|
command = withCommand(command) ?? command;
|
|
3171
3212
|
return await client.send(command, ...args);
|
|
3172
3213
|
};
|
|
3173
|
-
get = (fromObject,
|
|
3214
|
+
get = (fromObject, path9) => {
|
|
3174
3215
|
let cursor2 = fromObject;
|
|
3175
|
-
const pathComponents =
|
|
3216
|
+
const pathComponents = path9.split(".");
|
|
3176
3217
|
for (const step of pathComponents) {
|
|
3177
3218
|
if (!cursor2 || typeof cursor2 !== "object") {
|
|
3178
3219
|
return void 0;
|
|
@@ -4135,12 +4176,12 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
4135
4176
|
const password = request.password ?? "";
|
|
4136
4177
|
auth = `${username}:${password}`;
|
|
4137
4178
|
}
|
|
4138
|
-
let
|
|
4179
|
+
let path9 = request.path;
|
|
4139
4180
|
if (queryString) {
|
|
4140
|
-
|
|
4181
|
+
path9 += `?${queryString}`;
|
|
4141
4182
|
}
|
|
4142
4183
|
if (request.fragment) {
|
|
4143
|
-
|
|
4184
|
+
path9 += `#${request.fragment}`;
|
|
4144
4185
|
}
|
|
4145
4186
|
let hostname = request.hostname ?? "";
|
|
4146
4187
|
if (hostname[0] === "[" && hostname.endsWith("]")) {
|
|
@@ -4152,7 +4193,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
4152
4193
|
headers: request.headers,
|
|
4153
4194
|
host: hostname,
|
|
4154
4195
|
method: request.method,
|
|
4155
|
-
path:
|
|
4196
|
+
path: path9,
|
|
4156
4197
|
port: request.port,
|
|
4157
4198
|
agent,
|
|
4158
4199
|
auth
|
|
@@ -4407,16 +4448,16 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
4407
4448
|
reject2(err);
|
|
4408
4449
|
};
|
|
4409
4450
|
const queryString = querystringBuilder.buildQueryString(query2 || {});
|
|
4410
|
-
let
|
|
4451
|
+
let path9 = request.path;
|
|
4411
4452
|
if (queryString) {
|
|
4412
|
-
|
|
4453
|
+
path9 += `?${queryString}`;
|
|
4413
4454
|
}
|
|
4414
4455
|
if (request.fragment) {
|
|
4415
|
-
|
|
4456
|
+
path9 += `#${request.fragment}`;
|
|
4416
4457
|
}
|
|
4417
4458
|
const req = session.request({
|
|
4418
4459
|
...request.headers,
|
|
4419
|
-
[http2.constants.HTTP2_HEADER_PATH]:
|
|
4460
|
+
[http2.constants.HTTP2_HEADER_PATH]: path9,
|
|
4420
4461
|
[http2.constants.HTTP2_HEADER_METHOD]: method
|
|
4421
4462
|
});
|
|
4422
4463
|
session.ref();
|
|
@@ -4605,13 +4646,13 @@ var require_dist_cjs16 = __commonJS({
|
|
|
4605
4646
|
abortError.name = "AbortError";
|
|
4606
4647
|
return Promise.reject(abortError);
|
|
4607
4648
|
}
|
|
4608
|
-
let
|
|
4649
|
+
let path9 = request.path;
|
|
4609
4650
|
const queryString = querystringBuilder.buildQueryString(request.query || {});
|
|
4610
4651
|
if (queryString) {
|
|
4611
|
-
|
|
4652
|
+
path9 += `?${queryString}`;
|
|
4612
4653
|
}
|
|
4613
4654
|
if (request.fragment) {
|
|
4614
|
-
|
|
4655
|
+
path9 += `#${request.fragment}`;
|
|
4615
4656
|
}
|
|
4616
4657
|
let auth = "";
|
|
4617
4658
|
if (request.username != null || request.password != null) {
|
|
@@ -4620,7 +4661,7 @@ var require_dist_cjs16 = __commonJS({
|
|
|
4620
4661
|
auth = `${username}:${password}@`;
|
|
4621
4662
|
}
|
|
4622
4663
|
const { port, method } = request;
|
|
4623
|
-
const url = `${request.protocol}//${auth}${request.hostname}${port ? `:${port}` : ""}${
|
|
4664
|
+
const url = `${request.protocol}//${auth}${request.hostname}${port ? `:${port}` : ""}${path9}`;
|
|
4624
4665
|
const body = method === "GET" || method === "HEAD" ? void 0 : request.body;
|
|
4625
4666
|
const requestOptions = {
|
|
4626
4667
|
body,
|
|
@@ -6682,13 +6723,13 @@ function __disposeResources(env) {
|
|
|
6682
6723
|
}
|
|
6683
6724
|
return next();
|
|
6684
6725
|
}
|
|
6685
|
-
function __rewriteRelativeImportExtension(
|
|
6686
|
-
if (typeof
|
|
6687
|
-
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) {
|
|
6688
6729
|
return tsx ? preserveJsx ? ".jsx" : ".js" : d4 && (!ext2 || !cm) ? m4 : d4 + ext2 + "." + cm.toLowerCase() + "js";
|
|
6689
6730
|
});
|
|
6690
6731
|
}
|
|
6691
|
-
return
|
|
6732
|
+
return path9;
|
|
6692
6733
|
}
|
|
6693
6734
|
var extendStatics, __assign, __createBinding, __setModuleDefault, ownKeys, _SuppressedError, tslib_es6_default;
|
|
6694
6735
|
var init_tslib_es6 = __esm({
|
|
@@ -7561,11 +7602,11 @@ var init_HttpBindingProtocol = __esm({
|
|
|
7561
7602
|
const opTraits = translateTraits(operationSchema.traits);
|
|
7562
7603
|
if (opTraits.http) {
|
|
7563
7604
|
request.method = opTraits.http[0];
|
|
7564
|
-
const [
|
|
7605
|
+
const [path9, search2] = opTraits.http[1].split("?");
|
|
7565
7606
|
if (request.path == "/") {
|
|
7566
|
-
request.path =
|
|
7607
|
+
request.path = path9;
|
|
7567
7608
|
} else {
|
|
7568
|
-
request.path +=
|
|
7609
|
+
request.path += path9;
|
|
7569
7610
|
}
|
|
7570
7611
|
const traitSearchParams = new URLSearchParams(search2 ?? "");
|
|
7571
7612
|
Object.assign(query2, Object.fromEntries(traitSearchParams));
|
|
@@ -7943,8 +7984,8 @@ var init_requestBuilder = __esm({
|
|
|
7943
7984
|
return this;
|
|
7944
7985
|
}
|
|
7945
7986
|
p(memberName, labelValueProvider, uriLabel, isGreedyLabel) {
|
|
7946
|
-
this.resolvePathStack.push((
|
|
7947
|
-
this.path = resolvedPath(
|
|
7987
|
+
this.resolvePathStack.push((path9) => {
|
|
7988
|
+
this.path = resolvedPath(path9, this.input, memberName, labelValueProvider, uriLabel, isGreedyLabel);
|
|
7948
7989
|
});
|
|
7949
7990
|
return this;
|
|
7950
7991
|
}
|
|
@@ -8594,18 +8635,18 @@ var require_dist_cjs20 = __commonJS({
|
|
|
8594
8635
|
}
|
|
8595
8636
|
};
|
|
8596
8637
|
var booleanEquals = (value1, value2) => value1 === value2;
|
|
8597
|
-
var getAttrPathList = (
|
|
8598
|
-
const parts =
|
|
8638
|
+
var getAttrPathList = (path9) => {
|
|
8639
|
+
const parts = path9.split(".");
|
|
8599
8640
|
const pathList = [];
|
|
8600
8641
|
for (const part of parts) {
|
|
8601
8642
|
const squareBracketIndex = part.indexOf("[");
|
|
8602
8643
|
if (squareBracketIndex !== -1) {
|
|
8603
8644
|
if (part.indexOf("]") !== part.length - 1) {
|
|
8604
|
-
throw new EndpointError(`Path: '${
|
|
8645
|
+
throw new EndpointError(`Path: '${path9}' does not end with ']'`);
|
|
8605
8646
|
}
|
|
8606
8647
|
const arrayIndex = part.slice(squareBracketIndex + 1, -1);
|
|
8607
8648
|
if (Number.isNaN(parseInt(arrayIndex))) {
|
|
8608
|
-
throw new EndpointError(`Invalid array index: '${arrayIndex}' in path: '${
|
|
8649
|
+
throw new EndpointError(`Invalid array index: '${arrayIndex}' in path: '${path9}'`);
|
|
8609
8650
|
}
|
|
8610
8651
|
if (squareBracketIndex !== 0) {
|
|
8611
8652
|
pathList.push(part.slice(0, squareBracketIndex));
|
|
@@ -8617,9 +8658,9 @@ var require_dist_cjs20 = __commonJS({
|
|
|
8617
8658
|
}
|
|
8618
8659
|
return pathList;
|
|
8619
8660
|
};
|
|
8620
|
-
var getAttr = (value,
|
|
8661
|
+
var getAttr = (value, path9) => getAttrPathList(path9).reduce((acc, index) => {
|
|
8621
8662
|
if (typeof acc !== "object") {
|
|
8622
|
-
throw new EndpointError(`Index '${index}' in '${
|
|
8663
|
+
throw new EndpointError(`Index '${index}' in '${path9}' not found in '${JSON.stringify(value)}'`);
|
|
8623
8664
|
} else if (Array.isArray(acc)) {
|
|
8624
8665
|
return acc[parseInt(index)];
|
|
8625
8666
|
}
|
|
@@ -8638,8 +8679,8 @@ var require_dist_cjs20 = __commonJS({
|
|
|
8638
8679
|
return value;
|
|
8639
8680
|
}
|
|
8640
8681
|
if (typeof value === "object" && "hostname" in value) {
|
|
8641
|
-
const { hostname: hostname2, port, protocol: protocol2 = "", path:
|
|
8642
|
-
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}`);
|
|
8643
8684
|
url.search = Object.entries(query2).map(([k4, v4]) => `${k4}=${v4}`).join("&");
|
|
8644
8685
|
return url;
|
|
8645
8686
|
}
|
|
@@ -10154,10 +10195,10 @@ ${longDate}
|
|
|
10154
10195
|
${credentialScope}
|
|
10155
10196
|
${utilHexEncoding.toHex(hashedRequest)}`;
|
|
10156
10197
|
}
|
|
10157
|
-
getCanonicalPath({ path:
|
|
10198
|
+
getCanonicalPath({ path: path9 }) {
|
|
10158
10199
|
if (this.uriEscapePath) {
|
|
10159
10200
|
const normalizedPathSegments = [];
|
|
10160
|
-
for (const pathSegment of
|
|
10201
|
+
for (const pathSegment of path9.split("/")) {
|
|
10161
10202
|
if (pathSegment?.length === 0)
|
|
10162
10203
|
continue;
|
|
10163
10204
|
if (pathSegment === ".")
|
|
@@ -10168,11 +10209,11 @@ ${utilHexEncoding.toHex(hashedRequest)}`;
|
|
|
10168
10209
|
normalizedPathSegments.push(pathSegment);
|
|
10169
10210
|
}
|
|
10170
10211
|
}
|
|
10171
|
-
const normalizedPath = `${
|
|
10212
|
+
const normalizedPath = `${path9?.startsWith("/") ? "/" : ""}${normalizedPathSegments.join("/")}${normalizedPathSegments.length > 0 && path9?.endsWith("/") ? "/" : ""}`;
|
|
10172
10213
|
const doubleEncoded = utilUriEscape.escapeUri(normalizedPath);
|
|
10173
10214
|
return doubleEncoded.replace(/%2F/g, "/");
|
|
10174
10215
|
}
|
|
10175
|
-
return
|
|
10216
|
+
return path9;
|
|
10176
10217
|
}
|
|
10177
10218
|
validateResolvedCredentials(credentials) {
|
|
10178
10219
|
if (typeof credentials !== "object" || typeof credentials.accessKeyId !== "string" || typeof credentials.secretAccessKey !== "string") {
|
|
@@ -11433,11 +11474,11 @@ var init_SmithyRpcV2CborProtocol = __esm({
|
|
|
11433
11474
|
}
|
|
11434
11475
|
}
|
|
11435
11476
|
const { service, operation: operation2 } = (0, import_util_middleware5.getSmithyContext)(context);
|
|
11436
|
-
const
|
|
11477
|
+
const path9 = `/service/${service}/operation/${operation2}`;
|
|
11437
11478
|
if (request.path.endsWith("/")) {
|
|
11438
|
-
request.path +=
|
|
11479
|
+
request.path += path9.slice(1);
|
|
11439
11480
|
} else {
|
|
11440
|
-
request.path +=
|
|
11481
|
+
request.path += path9;
|
|
11441
11482
|
}
|
|
11442
11483
|
return request;
|
|
11443
11484
|
}
|
|
@@ -16353,15 +16394,15 @@ var require_dist_cjs34 = __commonJS({
|
|
|
16353
16394
|
var querystringBuilder = require_dist_cjs14();
|
|
16354
16395
|
function formatUrl(request) {
|
|
16355
16396
|
const { port, query: query2 } = request;
|
|
16356
|
-
let { protocol, path:
|
|
16397
|
+
let { protocol, path: path9, hostname } = request;
|
|
16357
16398
|
if (protocol && protocol.slice(-1) !== ":") {
|
|
16358
16399
|
protocol += ":";
|
|
16359
16400
|
}
|
|
16360
16401
|
if (port) {
|
|
16361
16402
|
hostname += `:${port}`;
|
|
16362
16403
|
}
|
|
16363
|
-
if (
|
|
16364
|
-
|
|
16404
|
+
if (path9 && path9.charAt(0) !== "/") {
|
|
16405
|
+
path9 = `/${path9}`;
|
|
16365
16406
|
}
|
|
16366
16407
|
let queryString = query2 ? querystringBuilder.buildQueryString(query2) : "";
|
|
16367
16408
|
if (queryString && queryString[0] !== "?") {
|
|
@@ -16377,7 +16418,7 @@ var require_dist_cjs34 = __commonJS({
|
|
|
16377
16418
|
if (request.fragment) {
|
|
16378
16419
|
fragment = `#${request.fragment}`;
|
|
16379
16420
|
}
|
|
16380
|
-
return `${protocol}//${auth}${hostname}${
|
|
16421
|
+
return `${protocol}//${auth}${hostname}${path9}${queryString}${fragment}`;
|
|
16381
16422
|
}
|
|
16382
16423
|
exports2.formatUrl = formatUrl;
|
|
16383
16424
|
}
|
|
@@ -17234,14 +17275,14 @@ var require_readFile = __commonJS({
|
|
|
17234
17275
|
var promises_1 = require("node:fs/promises");
|
|
17235
17276
|
exports2.filePromises = {};
|
|
17236
17277
|
exports2.fileIntercept = {};
|
|
17237
|
-
var readFile2 = (
|
|
17238
|
-
if (exports2.fileIntercept[
|
|
17239
|
-
return exports2.fileIntercept[
|
|
17278
|
+
var readFile2 = (path9, options) => {
|
|
17279
|
+
if (exports2.fileIntercept[path9] !== void 0) {
|
|
17280
|
+
return exports2.fileIntercept[path9];
|
|
17240
17281
|
}
|
|
17241
|
-
if (!exports2.filePromises[
|
|
17242
|
-
exports2.filePromises[
|
|
17282
|
+
if (!exports2.filePromises[path9] || options?.ignoreCache) {
|
|
17283
|
+
exports2.filePromises[path9] = (0, promises_1.readFile)(path9, "utf8");
|
|
17243
17284
|
}
|
|
17244
|
-
return exports2.filePromises[
|
|
17285
|
+
return exports2.filePromises[path9];
|
|
17245
17286
|
};
|
|
17246
17287
|
exports2.readFile = readFile2;
|
|
17247
17288
|
}
|
|
@@ -17254,7 +17295,7 @@ var require_dist_cjs42 = __commonJS({
|
|
|
17254
17295
|
var getHomeDir = require_getHomeDir();
|
|
17255
17296
|
var getSSOTokenFilepath = require_getSSOTokenFilepath();
|
|
17256
17297
|
var getSSOTokenFromFile = require_getSSOTokenFromFile();
|
|
17257
|
-
var
|
|
17298
|
+
var path9 = require("path");
|
|
17258
17299
|
var types2 = require_dist_cjs();
|
|
17259
17300
|
var readFile2 = require_readFile();
|
|
17260
17301
|
var ENV_PROFILE = "AWS_PROFILE";
|
|
@@ -17276,9 +17317,9 @@ var require_dist_cjs42 = __commonJS({
|
|
|
17276
17317
|
...data2.default && { default: data2.default }
|
|
17277
17318
|
});
|
|
17278
17319
|
var ENV_CONFIG_PATH = "AWS_CONFIG_FILE";
|
|
17279
|
-
var getConfigFilepath = () => process.env[ENV_CONFIG_PATH] ||
|
|
17320
|
+
var getConfigFilepath = () => process.env[ENV_CONFIG_PATH] || path9.join(getHomeDir.getHomeDir(), ".aws", "config");
|
|
17280
17321
|
var ENV_CREDENTIALS_PATH = "AWS_SHARED_CREDENTIALS_FILE";
|
|
17281
|
-
var getCredentialsFilepath = () => process.env[ENV_CREDENTIALS_PATH] ||
|
|
17322
|
+
var getCredentialsFilepath = () => process.env[ENV_CREDENTIALS_PATH] || path9.join(getHomeDir.getHomeDir(), ".aws", "credentials");
|
|
17282
17323
|
var prefixKeyRegex = /^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/;
|
|
17283
17324
|
var profileNameBlockList = ["__proto__", "profile __proto__"];
|
|
17284
17325
|
var parseIni = (iniData) => {
|
|
@@ -17333,11 +17374,11 @@ var require_dist_cjs42 = __commonJS({
|
|
|
17333
17374
|
const relativeHomeDirPrefix = "~/";
|
|
17334
17375
|
let resolvedFilepath = filepath;
|
|
17335
17376
|
if (filepath.startsWith(relativeHomeDirPrefix)) {
|
|
17336
|
-
resolvedFilepath =
|
|
17377
|
+
resolvedFilepath = path9.join(homeDir, filepath.slice(2));
|
|
17337
17378
|
}
|
|
17338
17379
|
let resolvedConfigFilepath = configFilepath;
|
|
17339
17380
|
if (configFilepath.startsWith(relativeHomeDirPrefix)) {
|
|
17340
|
-
resolvedConfigFilepath =
|
|
17381
|
+
resolvedConfigFilepath = path9.join(homeDir, configFilepath.slice(2));
|
|
17341
17382
|
}
|
|
17342
17383
|
const parsedFiles = await Promise.all([
|
|
17343
17384
|
readFile2.readFile(resolvedConfigFilepath, {
|
|
@@ -17376,8 +17417,8 @@ var require_dist_cjs42 = __commonJS({
|
|
|
17376
17417
|
getFileRecord() {
|
|
17377
17418
|
return readFile2.fileIntercept;
|
|
17378
17419
|
},
|
|
17379
|
-
interceptFile(
|
|
17380
|
-
readFile2.fileIntercept[
|
|
17420
|
+
interceptFile(path10, contents) {
|
|
17421
|
+
readFile2.fileIntercept[path10] = Promise.resolve(contents);
|
|
17381
17422
|
},
|
|
17382
17423
|
getTokenRecord() {
|
|
17383
17424
|
return getSSOTokenFromFile.tokenIntercept;
|
|
@@ -17608,8 +17649,8 @@ var require_dist_cjs44 = __commonJS({
|
|
|
17608
17649
|
return endpoint.url.href;
|
|
17609
17650
|
}
|
|
17610
17651
|
if ("hostname" in endpoint) {
|
|
17611
|
-
const { protocol, hostname, port, path:
|
|
17612
|
-
return `${protocol}//${hostname}${port ? ":" + port : ""}${
|
|
17652
|
+
const { protocol, hostname, port, path: path9 } = endpoint;
|
|
17653
|
+
return `${protocol}//${hostname}${port ? ":" + port : ""}${path9}`;
|
|
17613
17654
|
}
|
|
17614
17655
|
}
|
|
17615
17656
|
return endpoint;
|
|
@@ -20522,7 +20563,7 @@ var require_dist_cjs56 = __commonJS({
|
|
|
20522
20563
|
var httpAuthSchemes = (init_httpAuthSchemes2(), __toCommonJS(httpAuthSchemes_exports));
|
|
20523
20564
|
var propertyProvider = require_dist_cjs24();
|
|
20524
20565
|
var sharedIniFileLoader = require_dist_cjs42();
|
|
20525
|
-
var
|
|
20566
|
+
var fs10 = require("fs");
|
|
20526
20567
|
var fromEnvSigningName = ({ logger: logger2, signingName } = {}) => async () => {
|
|
20527
20568
|
logger2?.debug?.("@aws-sdk/token-providers - fromEnvSigningName");
|
|
20528
20569
|
if (!signingName) {
|
|
@@ -20568,7 +20609,7 @@ var require_dist_cjs56 = __commonJS({
|
|
|
20568
20609
|
throw new propertyProvider.TokenProviderError(`Value not present for '${key}' in SSO Token${forRefresh ? ". Cannot refresh" : ""}. ${REFRESH_MESSAGE}`, false);
|
|
20569
20610
|
}
|
|
20570
20611
|
};
|
|
20571
|
-
var { writeFile } =
|
|
20612
|
+
var { writeFile } = fs10.promises;
|
|
20572
20613
|
var writeSSOTokenToFile = (id, ssoToken) => {
|
|
20573
20614
|
const tokenFilepath = sharedIniFileLoader.getSSOTokenFilepath(id);
|
|
20574
20615
|
const tokenString = JSON.stringify(ssoToken, null, 2);
|
|
@@ -30293,8 +30334,8 @@ var init_parseUtil = __esm({
|
|
|
30293
30334
|
init_errors4();
|
|
30294
30335
|
init_en();
|
|
30295
30336
|
makeIssue = (params) => {
|
|
30296
|
-
const { data: data2, path:
|
|
30297
|
-
const fullPath = [...
|
|
30337
|
+
const { data: data2, path: path9, errorMaps, issueData } = params;
|
|
30338
|
+
const fullPath = [...path9, ...issueData.path || []];
|
|
30298
30339
|
const fullIssue = {
|
|
30299
30340
|
...issueData,
|
|
30300
30341
|
path: fullPath
|
|
@@ -30602,11 +30643,11 @@ var init_types = __esm({
|
|
|
30602
30643
|
init_parseUtil();
|
|
30603
30644
|
init_util2();
|
|
30604
30645
|
ParseInputLazyPath = class {
|
|
30605
|
-
constructor(parent, value,
|
|
30646
|
+
constructor(parent, value, path9, key) {
|
|
30606
30647
|
this._cachedPath = [];
|
|
30607
30648
|
this.parent = parent;
|
|
30608
30649
|
this.data = value;
|
|
30609
|
-
this._path =
|
|
30650
|
+
this._path = path9;
|
|
30610
30651
|
this._key = key;
|
|
30611
30652
|
}
|
|
30612
30653
|
get path() {
|
|
@@ -35258,7 +35299,7 @@ var init_escape = __esm({
|
|
|
35258
35299
|
});
|
|
35259
35300
|
|
|
35260
35301
|
// node_modules/minimatch/dist/esm/index.js
|
|
35261
|
-
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;
|
|
35262
35303
|
var init_esm = __esm({
|
|
35263
35304
|
"node_modules/minimatch/dist/esm/index.js"() {
|
|
35264
35305
|
import_brace_expansion = __toESM(require_brace_expansion(), 1);
|
|
@@ -35327,11 +35368,11 @@ var init_esm = __esm({
|
|
|
35327
35368
|
return (f4) => f4.length === len && f4 !== "." && f4 !== "..";
|
|
35328
35369
|
};
|
|
35329
35370
|
defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
|
|
35330
|
-
|
|
35371
|
+
path5 = {
|
|
35331
35372
|
win32: { sep: "\\" },
|
|
35332
35373
|
posix: { sep: "/" }
|
|
35333
35374
|
};
|
|
35334
|
-
sep = defaultPlatform === "win32" ?
|
|
35375
|
+
sep = defaultPlatform === "win32" ? path5.win32.sep : path5.posix.sep;
|
|
35335
35376
|
minimatch.sep = sep;
|
|
35336
35377
|
GLOBSTAR = Symbol("globstar **");
|
|
35337
35378
|
minimatch.GLOBSTAR = GLOBSTAR;
|
|
@@ -38246,22 +38287,22 @@ var init_esm3 = __esm({
|
|
|
38246
38287
|
});
|
|
38247
38288
|
|
|
38248
38289
|
// node_modules/path-scurry/dist/esm/index.js
|
|
38249
|
-
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;
|
|
38250
38291
|
var init_esm4 = __esm({
|
|
38251
38292
|
"node_modules/path-scurry/dist/esm/index.js"() {
|
|
38252
38293
|
init_esm2();
|
|
38253
38294
|
import_node_path = require("node:path");
|
|
38254
38295
|
import_node_url = require("node:url");
|
|
38255
|
-
|
|
38296
|
+
import_fs4 = require("fs");
|
|
38256
38297
|
actualFS = __toESM(require("node:fs"), 1);
|
|
38257
38298
|
import_promises = require("node:fs/promises");
|
|
38258
38299
|
init_esm3();
|
|
38259
|
-
realpathSync =
|
|
38300
|
+
realpathSync = import_fs4.realpathSync.native;
|
|
38260
38301
|
defaultFS = {
|
|
38261
|
-
lstatSync:
|
|
38262
|
-
readdir:
|
|
38263
|
-
readdirSync:
|
|
38264
|
-
readlinkSync:
|
|
38302
|
+
lstatSync: import_fs4.lstatSync,
|
|
38303
|
+
readdir: import_fs4.readdir,
|
|
38304
|
+
readdirSync: import_fs4.readdirSync,
|
|
38305
|
+
readlinkSync: import_fs4.readlinkSync,
|
|
38265
38306
|
realpathSync,
|
|
38266
38307
|
promises: {
|
|
38267
38308
|
lstat: import_promises.lstat,
|
|
@@ -38518,12 +38559,12 @@ var init_esm4 = __esm({
|
|
|
38518
38559
|
/**
|
|
38519
38560
|
* Get the Path object referenced by the string path, resolved from this Path
|
|
38520
38561
|
*/
|
|
38521
|
-
resolve(
|
|
38522
|
-
if (!
|
|
38562
|
+
resolve(path9) {
|
|
38563
|
+
if (!path9) {
|
|
38523
38564
|
return this;
|
|
38524
38565
|
}
|
|
38525
|
-
const rootPath = this.getRootString(
|
|
38526
|
-
const dir =
|
|
38566
|
+
const rootPath = this.getRootString(path9);
|
|
38567
|
+
const dir = path9.substring(rootPath.length);
|
|
38527
38568
|
const dirParts = dir.split(this.splitSep);
|
|
38528
38569
|
const result = rootPath ? this.getRoot(rootPath).#resolveParts(dirParts) : this.#resolveParts(dirParts);
|
|
38529
38570
|
return result;
|
|
@@ -39275,8 +39316,8 @@ var init_esm4 = __esm({
|
|
|
39275
39316
|
/**
|
|
39276
39317
|
* @internal
|
|
39277
39318
|
*/
|
|
39278
|
-
getRootString(
|
|
39279
|
-
return import_node_path.win32.parse(
|
|
39319
|
+
getRootString(path9) {
|
|
39320
|
+
return import_node_path.win32.parse(path9).root;
|
|
39280
39321
|
}
|
|
39281
39322
|
/**
|
|
39282
39323
|
* @internal
|
|
@@ -39322,8 +39363,8 @@ var init_esm4 = __esm({
|
|
|
39322
39363
|
/**
|
|
39323
39364
|
* @internal
|
|
39324
39365
|
*/
|
|
39325
|
-
getRootString(
|
|
39326
|
-
return
|
|
39366
|
+
getRootString(path9) {
|
|
39367
|
+
return path9.startsWith("/") ? "/" : "";
|
|
39327
39368
|
}
|
|
39328
39369
|
/**
|
|
39329
39370
|
* @internal
|
|
@@ -39372,8 +39413,8 @@ var init_esm4 = __esm({
|
|
|
39372
39413
|
*
|
|
39373
39414
|
* @internal
|
|
39374
39415
|
*/
|
|
39375
|
-
constructor(cwd = process.cwd(), pathImpl, sep4, { nocase, childrenCacheSize = 16 * 1024, fs:
|
|
39376
|
-
this.#fs = fsFromOption(
|
|
39416
|
+
constructor(cwd = process.cwd(), pathImpl, sep4, { nocase, childrenCacheSize = 16 * 1024, fs: fs10 = defaultFS } = {}) {
|
|
39417
|
+
this.#fs = fsFromOption(fs10);
|
|
39377
39418
|
if (cwd instanceof URL || cwd.startsWith("file://")) {
|
|
39378
39419
|
cwd = (0, import_node_url.fileURLToPath)(cwd);
|
|
39379
39420
|
}
|
|
@@ -39412,11 +39453,11 @@ var init_esm4 = __esm({
|
|
|
39412
39453
|
/**
|
|
39413
39454
|
* Get the depth of a provided path, string, or the cwd
|
|
39414
39455
|
*/
|
|
39415
|
-
depth(
|
|
39416
|
-
if (typeof
|
|
39417
|
-
|
|
39456
|
+
depth(path9 = this.cwd) {
|
|
39457
|
+
if (typeof path9 === "string") {
|
|
39458
|
+
path9 = this.cwd.resolve(path9);
|
|
39418
39459
|
}
|
|
39419
|
-
return
|
|
39460
|
+
return path9.depth();
|
|
39420
39461
|
}
|
|
39421
39462
|
/**
|
|
39422
39463
|
* Return the cache of child entries. Exposed so subclasses can create
|
|
@@ -39903,9 +39944,9 @@ var init_esm4 = __esm({
|
|
|
39903
39944
|
process2();
|
|
39904
39945
|
return results;
|
|
39905
39946
|
}
|
|
39906
|
-
chdir(
|
|
39947
|
+
chdir(path9 = this.cwd) {
|
|
39907
39948
|
const oldCwd = this.cwd;
|
|
39908
|
-
this.cwd = typeof
|
|
39949
|
+
this.cwd = typeof path9 === "string" ? this.cwd.resolve(path9) : path9;
|
|
39909
39950
|
this.cwd[setAsCwd](oldCwd);
|
|
39910
39951
|
}
|
|
39911
39952
|
};
|
|
@@ -39931,8 +39972,8 @@ var init_esm4 = __esm({
|
|
|
39931
39972
|
/**
|
|
39932
39973
|
* @internal
|
|
39933
39974
|
*/
|
|
39934
|
-
newRoot(
|
|
39935
|
-
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 });
|
|
39936
39977
|
}
|
|
39937
39978
|
/**
|
|
39938
39979
|
* Return true if the provided path string is an absolute path
|
|
@@ -39960,8 +40001,8 @@ var init_esm4 = __esm({
|
|
|
39960
40001
|
/**
|
|
39961
40002
|
* @internal
|
|
39962
40003
|
*/
|
|
39963
|
-
newRoot(
|
|
39964
|
-
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 });
|
|
39965
40006
|
}
|
|
39966
40007
|
/**
|
|
39967
40008
|
* Return true if the provided path string is an absolute path
|
|
@@ -40280,8 +40321,8 @@ var init_processor = __esm({
|
|
|
40280
40321
|
}
|
|
40281
40322
|
// match, absolute, ifdir
|
|
40282
40323
|
entries() {
|
|
40283
|
-
return [...this.store.entries()].map(([
|
|
40284
|
-
|
|
40324
|
+
return [...this.store.entries()].map(([path9, n4]) => [
|
|
40325
|
+
path9,
|
|
40285
40326
|
!!(n4 & 2),
|
|
40286
40327
|
!!(n4 & 1)
|
|
40287
40328
|
]);
|
|
@@ -40494,9 +40535,9 @@ var init_walker = __esm({
|
|
|
40494
40535
|
signal;
|
|
40495
40536
|
maxDepth;
|
|
40496
40537
|
includeChildMatches;
|
|
40497
|
-
constructor(patterns,
|
|
40538
|
+
constructor(patterns, path9, opts) {
|
|
40498
40539
|
this.patterns = patterns;
|
|
40499
|
-
this.path =
|
|
40540
|
+
this.path = path9;
|
|
40500
40541
|
this.opts = opts;
|
|
40501
40542
|
this.#sep = !opts.posix && opts.platform === "win32" ? "\\" : "/";
|
|
40502
40543
|
this.includeChildMatches = opts.includeChildMatches !== false;
|
|
@@ -40515,11 +40556,11 @@ var init_walker = __esm({
|
|
|
40515
40556
|
});
|
|
40516
40557
|
}
|
|
40517
40558
|
}
|
|
40518
|
-
#ignored(
|
|
40519
|
-
return this.seen.has(
|
|
40559
|
+
#ignored(path9) {
|
|
40560
|
+
return this.seen.has(path9) || !!this.#ignore?.ignored?.(path9);
|
|
40520
40561
|
}
|
|
40521
|
-
#childrenIgnored(
|
|
40522
|
-
return !!this.#ignore?.childrenIgnored?.(
|
|
40562
|
+
#childrenIgnored(path9) {
|
|
40563
|
+
return !!this.#ignore?.childrenIgnored?.(path9);
|
|
40523
40564
|
}
|
|
40524
40565
|
// backpressure mechanism
|
|
40525
40566
|
pause() {
|
|
@@ -40734,8 +40775,8 @@ var init_walker = __esm({
|
|
|
40734
40775
|
};
|
|
40735
40776
|
GlobWalker = class extends GlobUtil {
|
|
40736
40777
|
matches = /* @__PURE__ */ new Set();
|
|
40737
|
-
constructor(patterns,
|
|
40738
|
-
super(patterns,
|
|
40778
|
+
constructor(patterns, path9, opts) {
|
|
40779
|
+
super(patterns, path9, opts);
|
|
40739
40780
|
}
|
|
40740
40781
|
matchEmit(e4) {
|
|
40741
40782
|
this.matches.add(e4);
|
|
@@ -40772,8 +40813,8 @@ var init_walker = __esm({
|
|
|
40772
40813
|
};
|
|
40773
40814
|
GlobStream = class extends GlobUtil {
|
|
40774
40815
|
results;
|
|
40775
|
-
constructor(patterns,
|
|
40776
|
-
super(patterns,
|
|
40816
|
+
constructor(patterns, path9, opts) {
|
|
40817
|
+
super(patterns, path9, opts);
|
|
40777
40818
|
this.results = new Minipass({
|
|
40778
40819
|
signal: this.signal,
|
|
40779
40820
|
objectMode: true
|
|
@@ -41170,7 +41211,7 @@ function createWrappedTools(baseTools) {
|
|
|
41170
41211
|
}
|
|
41171
41212
|
return wrappedTools;
|
|
41172
41213
|
}
|
|
41173
|
-
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;
|
|
41174
41215
|
var init_probeTool = __esm({
|
|
41175
41216
|
"src/agent/probeTool.js"() {
|
|
41176
41217
|
"use strict";
|
|
@@ -41179,9 +41220,9 @@ var init_probeTool = __esm({
|
|
|
41179
41220
|
import_util11 = require("util");
|
|
41180
41221
|
import_crypto3 = require("crypto");
|
|
41181
41222
|
import_events = require("events");
|
|
41182
|
-
|
|
41183
|
-
|
|
41184
|
-
|
|
41223
|
+
import_fs5 = __toESM(require("fs"), 1);
|
|
41224
|
+
import_fs6 = require("fs");
|
|
41225
|
+
import_path5 = __toESM(require("path"), 1);
|
|
41185
41226
|
init_esm5();
|
|
41186
41227
|
init_symlink_utils();
|
|
41187
41228
|
toolCallEmitter = new import_events.EventEmitter();
|
|
@@ -41270,17 +41311,17 @@ var init_probeTool = __esm({
|
|
|
41270
41311
|
execute: async (params) => {
|
|
41271
41312
|
const { directory = ".", workingDirectory } = params;
|
|
41272
41313
|
const baseCwd = workingDirectory || process.cwd();
|
|
41273
|
-
const secureBaseDir =
|
|
41314
|
+
const secureBaseDir = import_path5.default.resolve(baseCwd);
|
|
41274
41315
|
const isDependencyPath = directory.startsWith("/dep/") || directory.startsWith("go:") || directory.startsWith("js:") || directory.startsWith("rust:");
|
|
41275
41316
|
let targetDir;
|
|
41276
|
-
if (
|
|
41277
|
-
targetDir =
|
|
41278
|
-
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) {
|
|
41279
41320
|
throw new Error(`Path traversal attempt detected. Cannot access directory outside workspace: ${directory}`);
|
|
41280
41321
|
}
|
|
41281
41322
|
} else {
|
|
41282
|
-
targetDir =
|
|
41283
|
-
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) {
|
|
41284
41325
|
throw new Error(`Path traversal attempt detected. Access denied: ${directory}`);
|
|
41285
41326
|
}
|
|
41286
41327
|
}
|
|
@@ -41289,7 +41330,7 @@ var init_probeTool = __esm({
|
|
|
41289
41330
|
console.log(`[DEBUG] Listing files in directory: ${targetDir}`);
|
|
41290
41331
|
}
|
|
41291
41332
|
try {
|
|
41292
|
-
const files = await
|
|
41333
|
+
const files = await import_fs6.promises.readdir(targetDir, { withFileTypes: true });
|
|
41293
41334
|
const formatSize = (size) => {
|
|
41294
41335
|
if (size < 1024) return `${size}B`;
|
|
41295
41336
|
if (size < 1024 * 1024) return `${(size / 1024).toFixed(1)}K`;
|
|
@@ -41297,7 +41338,7 @@ var init_probeTool = __esm({
|
|
|
41297
41338
|
return `${(size / (1024 * 1024 * 1024)).toFixed(1)}G`;
|
|
41298
41339
|
};
|
|
41299
41340
|
const entries = await Promise.all(files.map(async (file) => {
|
|
41300
|
-
const fullPath =
|
|
41341
|
+
const fullPath = import_path5.default.join(targetDir, file.name);
|
|
41301
41342
|
const entryType = await getEntryType(file, fullPath);
|
|
41302
41343
|
return {
|
|
41303
41344
|
name: file.name,
|
|
@@ -41334,17 +41375,17 @@ var init_probeTool = __esm({
|
|
|
41334
41375
|
throw new Error("Pattern is required for file search");
|
|
41335
41376
|
}
|
|
41336
41377
|
const baseCwd = workingDirectory || process.cwd();
|
|
41337
|
-
const secureBaseDir =
|
|
41378
|
+
const secureBaseDir = import_path5.default.resolve(baseCwd);
|
|
41338
41379
|
const isDependencyPath = directory.startsWith("/dep/") || directory.startsWith("go:") || directory.startsWith("js:") || directory.startsWith("rust:");
|
|
41339
41380
|
let targetDir;
|
|
41340
|
-
if (
|
|
41341
|
-
targetDir =
|
|
41342
|
-
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) {
|
|
41343
41384
|
throw new Error(`Path traversal attempt detected. Cannot access directory outside workspace: ${directory}`);
|
|
41344
41385
|
}
|
|
41345
41386
|
} else {
|
|
41346
|
-
targetDir =
|
|
41347
|
-
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) {
|
|
41348
41389
|
throw new Error(`Path traversal attempt detected. Access denied: ${directory}`);
|
|
41349
41390
|
}
|
|
41350
41391
|
}
|
|
@@ -43171,11 +43212,11 @@ var init_toKey = __esm({
|
|
|
43171
43212
|
});
|
|
43172
43213
|
|
|
43173
43214
|
// node_modules/lodash-es/_baseGet.js
|
|
43174
|
-
function baseGet(object,
|
|
43175
|
-
|
|
43176
|
-
var index = 0, length =
|
|
43215
|
+
function baseGet(object, path9) {
|
|
43216
|
+
path9 = castPath_default(path9, object);
|
|
43217
|
+
var index = 0, length = path9.length;
|
|
43177
43218
|
while (object != null && index < length) {
|
|
43178
|
-
object = object[toKey_default(
|
|
43219
|
+
object = object[toKey_default(path9[index++])];
|
|
43179
43220
|
}
|
|
43180
43221
|
return index && index == length ? object : void 0;
|
|
43181
43222
|
}
|
|
@@ -43189,8 +43230,8 @@ var init_baseGet = __esm({
|
|
|
43189
43230
|
});
|
|
43190
43231
|
|
|
43191
43232
|
// node_modules/lodash-es/get.js
|
|
43192
|
-
function get2(object,
|
|
43193
|
-
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);
|
|
43194
43235
|
return result === void 0 ? defaultValue : result;
|
|
43195
43236
|
}
|
|
43196
43237
|
var get_default;
|
|
@@ -44553,11 +44594,11 @@ var init_baseHasIn = __esm({
|
|
|
44553
44594
|
});
|
|
44554
44595
|
|
|
44555
44596
|
// node_modules/lodash-es/_hasPath.js
|
|
44556
|
-
function hasPath(object,
|
|
44557
|
-
|
|
44558
|
-
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;
|
|
44559
44600
|
while (++index < length) {
|
|
44560
|
-
var key = toKey_default(
|
|
44601
|
+
var key = toKey_default(path9[index]);
|
|
44561
44602
|
if (!(result = object != null && hasFunc(object, key))) {
|
|
44562
44603
|
break;
|
|
44563
44604
|
}
|
|
@@ -44583,8 +44624,8 @@ var init_hasPath = __esm({
|
|
|
44583
44624
|
});
|
|
44584
44625
|
|
|
44585
44626
|
// node_modules/lodash-es/hasIn.js
|
|
44586
|
-
function hasIn(object,
|
|
44587
|
-
return object != null && hasPath_default(object,
|
|
44627
|
+
function hasIn(object, path9) {
|
|
44628
|
+
return object != null && hasPath_default(object, path9, baseHasIn_default);
|
|
44588
44629
|
}
|
|
44589
44630
|
var hasIn_default;
|
|
44590
44631
|
var init_hasIn = __esm({
|
|
@@ -44596,13 +44637,13 @@ var init_hasIn = __esm({
|
|
|
44596
44637
|
});
|
|
44597
44638
|
|
|
44598
44639
|
// node_modules/lodash-es/_baseMatchesProperty.js
|
|
44599
|
-
function baseMatchesProperty(
|
|
44600
|
-
if (isKey_default(
|
|
44601
|
-
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);
|
|
44602
44643
|
}
|
|
44603
44644
|
return function(object) {
|
|
44604
|
-
var objValue = get_default(object,
|
|
44605
|
-
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);
|
|
44606
44647
|
};
|
|
44607
44648
|
}
|
|
44608
44649
|
var COMPARE_PARTIAL_FLAG6, COMPARE_UNORDERED_FLAG4, baseMatchesProperty_default;
|
|
@@ -44635,9 +44676,9 @@ var init_baseProperty = __esm({
|
|
|
44635
44676
|
});
|
|
44636
44677
|
|
|
44637
44678
|
// node_modules/lodash-es/_basePropertyDeep.js
|
|
44638
|
-
function basePropertyDeep(
|
|
44679
|
+
function basePropertyDeep(path9) {
|
|
44639
44680
|
return function(object) {
|
|
44640
|
-
return baseGet_default(object,
|
|
44681
|
+
return baseGet_default(object, path9);
|
|
44641
44682
|
};
|
|
44642
44683
|
}
|
|
44643
44684
|
var basePropertyDeep_default;
|
|
@@ -44649,8 +44690,8 @@ var init_basePropertyDeep = __esm({
|
|
|
44649
44690
|
});
|
|
44650
44691
|
|
|
44651
44692
|
// node_modules/lodash-es/property.js
|
|
44652
|
-
function property(
|
|
44653
|
-
return isKey_default(
|
|
44693
|
+
function property(path9) {
|
|
44694
|
+
return isKey_default(path9) ? baseProperty_default(toKey_default(path9)) : basePropertyDeep_default(path9);
|
|
44654
44695
|
}
|
|
44655
44696
|
var property_default;
|
|
44656
44697
|
var init_property = __esm({
|
|
@@ -45269,8 +45310,8 @@ var init_baseHas = __esm({
|
|
|
45269
45310
|
});
|
|
45270
45311
|
|
|
45271
45312
|
// node_modules/lodash-es/has.js
|
|
45272
|
-
function has(object,
|
|
45273
|
-
return object != null && hasPath_default(object,
|
|
45313
|
+
function has(object, path9) {
|
|
45314
|
+
return object != null && hasPath_default(object, path9, baseHas_default);
|
|
45274
45315
|
}
|
|
45275
45316
|
var has_default;
|
|
45276
45317
|
var init_has = __esm({
|
|
@@ -45476,14 +45517,14 @@ var init_negate = __esm({
|
|
|
45476
45517
|
});
|
|
45477
45518
|
|
|
45478
45519
|
// node_modules/lodash-es/_baseSet.js
|
|
45479
|
-
function baseSet(object,
|
|
45520
|
+
function baseSet(object, path9, value, customizer) {
|
|
45480
45521
|
if (!isObject_default(object)) {
|
|
45481
45522
|
return object;
|
|
45482
45523
|
}
|
|
45483
|
-
|
|
45484
|
-
var index = -1, length =
|
|
45524
|
+
path9 = castPath_default(path9, object);
|
|
45525
|
+
var index = -1, length = path9.length, lastIndex = length - 1, nested = object;
|
|
45485
45526
|
while (nested != null && ++index < length) {
|
|
45486
|
-
var key = toKey_default(
|
|
45527
|
+
var key = toKey_default(path9[index]), newValue = value;
|
|
45487
45528
|
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
|
45488
45529
|
return object;
|
|
45489
45530
|
}
|
|
@@ -45491,7 +45532,7 @@ function baseSet(object, path8, value, customizer) {
|
|
|
45491
45532
|
var objValue = nested[key];
|
|
45492
45533
|
newValue = customizer ? customizer(objValue, key, nested) : void 0;
|
|
45493
45534
|
if (newValue === void 0) {
|
|
45494
|
-
newValue = isObject_default(objValue) ? objValue : isIndex_default(
|
|
45535
|
+
newValue = isObject_default(objValue) ? objValue : isIndex_default(path9[index + 1]) ? [] : {};
|
|
45495
45536
|
}
|
|
45496
45537
|
}
|
|
45497
45538
|
assignValue_default(nested, key, newValue);
|
|
@@ -45515,9 +45556,9 @@ var init_baseSet = __esm({
|
|
|
45515
45556
|
function basePickBy(object, paths, predicate) {
|
|
45516
45557
|
var index = -1, length = paths.length, result = {};
|
|
45517
45558
|
while (++index < length) {
|
|
45518
|
-
var
|
|
45519
|
-
if (predicate(value,
|
|
45520
|
-
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);
|
|
45521
45562
|
}
|
|
45522
45563
|
}
|
|
45523
45564
|
return result;
|
|
@@ -45541,8 +45582,8 @@ function pickBy(object, predicate) {
|
|
|
45541
45582
|
return [prop];
|
|
45542
45583
|
});
|
|
45543
45584
|
predicate = baseIteratee_default(predicate);
|
|
45544
|
-
return basePickBy_default(object, props, function(value,
|
|
45545
|
-
return predicate(value,
|
|
45585
|
+
return basePickBy_default(object, props, function(value, path9) {
|
|
45586
|
+
return predicate(value, path9[0]);
|
|
45546
45587
|
});
|
|
45547
45588
|
}
|
|
45548
45589
|
var pickBy_default;
|
|
@@ -48255,12 +48296,12 @@ function assignCategoriesMapProp(tokenTypes) {
|
|
|
48255
48296
|
singleAssignCategoriesToksMap([], currTokType);
|
|
48256
48297
|
});
|
|
48257
48298
|
}
|
|
48258
|
-
function singleAssignCategoriesToksMap(
|
|
48259
|
-
forEach_default(
|
|
48299
|
+
function singleAssignCategoriesToksMap(path9, nextNode) {
|
|
48300
|
+
forEach_default(path9, (pathNode) => {
|
|
48260
48301
|
nextNode.categoryMatchesMap[pathNode.tokenTypeIdx] = true;
|
|
48261
48302
|
});
|
|
48262
48303
|
forEach_default(nextNode.CATEGORIES, (nextCategory) => {
|
|
48263
|
-
const newPath =
|
|
48304
|
+
const newPath = path9.concat(nextNode);
|
|
48264
48305
|
if (!includes_default(newPath, nextCategory)) {
|
|
48265
48306
|
singleAssignCategoriesToksMap(newPath, nextCategory);
|
|
48266
48307
|
}
|
|
@@ -49430,10 +49471,10 @@ var init_interpreter = __esm({
|
|
|
49430
49471
|
init_rest();
|
|
49431
49472
|
init_api2();
|
|
49432
49473
|
AbstractNextPossibleTokensWalker = class extends RestWalker {
|
|
49433
|
-
constructor(topProd,
|
|
49474
|
+
constructor(topProd, path9) {
|
|
49434
49475
|
super();
|
|
49435
49476
|
this.topProd = topProd;
|
|
49436
|
-
this.path =
|
|
49477
|
+
this.path = path9;
|
|
49437
49478
|
this.possibleTokTypes = [];
|
|
49438
49479
|
this.nextProductionName = "";
|
|
49439
49480
|
this.nextProductionOccurrence = 0;
|
|
@@ -49477,9 +49518,9 @@ var init_interpreter = __esm({
|
|
|
49477
49518
|
}
|
|
49478
49519
|
};
|
|
49479
49520
|
NextAfterTokenWalker = class extends AbstractNextPossibleTokensWalker {
|
|
49480
|
-
constructor(topProd,
|
|
49481
|
-
super(topProd,
|
|
49482
|
-
this.path =
|
|
49521
|
+
constructor(topProd, path9) {
|
|
49522
|
+
super(topProd, path9);
|
|
49523
|
+
this.path = path9;
|
|
49483
49524
|
this.nextTerminalName = "";
|
|
49484
49525
|
this.nextTerminalOccurrence = 0;
|
|
49485
49526
|
this.nextTerminalName = this.path.lastTok.name;
|
|
@@ -49720,10 +49761,10 @@ function initializeArrayOfArrays(size) {
|
|
|
49720
49761
|
}
|
|
49721
49762
|
return result;
|
|
49722
49763
|
}
|
|
49723
|
-
function pathToHashKeys(
|
|
49764
|
+
function pathToHashKeys(path9) {
|
|
49724
49765
|
let keys2 = [""];
|
|
49725
|
-
for (let i4 = 0; i4 <
|
|
49726
|
-
const tokType =
|
|
49766
|
+
for (let i4 = 0; i4 < path9.length; i4++) {
|
|
49767
|
+
const tokType = path9[i4];
|
|
49727
49768
|
const longerKeys = [];
|
|
49728
49769
|
for (let j4 = 0; j4 < keys2.length; j4++) {
|
|
49729
49770
|
const currShorterKey = keys2[j4];
|
|
@@ -50026,7 +50067,7 @@ function validateRuleIsOverridden(ruleName, definedRulesNames, className) {
|
|
|
50026
50067
|
}
|
|
50027
50068
|
return errors;
|
|
50028
50069
|
}
|
|
50029
|
-
function validateNoLeftRecursion(topRule, currRule, errMsgProvider,
|
|
50070
|
+
function validateNoLeftRecursion(topRule, currRule, errMsgProvider, path9 = []) {
|
|
50030
50071
|
const errors = [];
|
|
50031
50072
|
const nextNonTerminals = getFirstNoneTerminal(currRule.definition);
|
|
50032
50073
|
if (isEmpty_default(nextNonTerminals)) {
|
|
@@ -50038,15 +50079,15 @@ function validateNoLeftRecursion(topRule, currRule, errMsgProvider, path8 = [])
|
|
|
50038
50079
|
errors.push({
|
|
50039
50080
|
message: errMsgProvider.buildLeftRecursionError({
|
|
50040
50081
|
topLevelRule: topRule,
|
|
50041
|
-
leftRecursionPath:
|
|
50082
|
+
leftRecursionPath: path9
|
|
50042
50083
|
}),
|
|
50043
50084
|
type: ParserDefinitionErrorType.LEFT_RECURSION,
|
|
50044
50085
|
ruleName
|
|
50045
50086
|
});
|
|
50046
50087
|
}
|
|
50047
|
-
const validNextSteps = difference_default(nextNonTerminals,
|
|
50088
|
+
const validNextSteps = difference_default(nextNonTerminals, path9.concat([topRule]));
|
|
50048
50089
|
const errorsFromNextSteps = flatMap_default(validNextSteps, (currRefRule) => {
|
|
50049
|
-
const newPath = clone_default(
|
|
50090
|
+
const newPath = clone_default(path9);
|
|
50050
50091
|
newPath.push(currRefRule);
|
|
50051
50092
|
return validateNoLeftRecursion(topRule, currRefRule, errMsgProvider, newPath);
|
|
50052
50093
|
});
|
|
@@ -62650,11 +62691,11 @@ var require_baseGet = __commonJS({
|
|
|
62650
62691
|
"node_modules/lodash/_baseGet.js"(exports2, module2) {
|
|
62651
62692
|
var castPath2 = require_castPath();
|
|
62652
62693
|
var toKey2 = require_toKey();
|
|
62653
|
-
function baseGet2(object,
|
|
62654
|
-
|
|
62655
|
-
var index = 0, length =
|
|
62694
|
+
function baseGet2(object, path9) {
|
|
62695
|
+
path9 = castPath2(path9, object);
|
|
62696
|
+
var index = 0, length = path9.length;
|
|
62656
62697
|
while (object != null && index < length) {
|
|
62657
|
-
object = object[toKey2(
|
|
62698
|
+
object = object[toKey2(path9[index++])];
|
|
62658
62699
|
}
|
|
62659
62700
|
return index && index == length ? object : void 0;
|
|
62660
62701
|
}
|
|
@@ -62666,8 +62707,8 @@ var require_baseGet = __commonJS({
|
|
|
62666
62707
|
var require_get = __commonJS({
|
|
62667
62708
|
"node_modules/lodash/get.js"(exports2, module2) {
|
|
62668
62709
|
var baseGet2 = require_baseGet();
|
|
62669
|
-
function get3(object,
|
|
62670
|
-
var result = object == null ? void 0 : baseGet2(object,
|
|
62710
|
+
function get3(object, path9, defaultValue) {
|
|
62711
|
+
var result = object == null ? void 0 : baseGet2(object, path9);
|
|
62671
62712
|
return result === void 0 ? defaultValue : result;
|
|
62672
62713
|
}
|
|
62673
62714
|
module2.exports = get3;
|
|
@@ -62693,11 +62734,11 @@ var require_hasPath = __commonJS({
|
|
|
62693
62734
|
var isIndex2 = require_isIndex();
|
|
62694
62735
|
var isLength2 = require_isLength();
|
|
62695
62736
|
var toKey2 = require_toKey();
|
|
62696
|
-
function hasPath2(object,
|
|
62697
|
-
|
|
62698
|
-
var index = -1, length =
|
|
62737
|
+
function hasPath2(object, path9, hasFunc) {
|
|
62738
|
+
path9 = castPath2(path9, object);
|
|
62739
|
+
var index = -1, length = path9.length, result = false;
|
|
62699
62740
|
while (++index < length) {
|
|
62700
|
-
var key = toKey2(
|
|
62741
|
+
var key = toKey2(path9[index]);
|
|
62701
62742
|
if (!(result = object != null && hasFunc(object, key))) {
|
|
62702
62743
|
break;
|
|
62703
62744
|
}
|
|
@@ -62718,8 +62759,8 @@ var require_hasIn = __commonJS({
|
|
|
62718
62759
|
"node_modules/lodash/hasIn.js"(exports2, module2) {
|
|
62719
62760
|
var baseHasIn2 = require_baseHasIn();
|
|
62720
62761
|
var hasPath2 = require_hasPath();
|
|
62721
|
-
function hasIn2(object,
|
|
62722
|
-
return object != null && hasPath2(object,
|
|
62762
|
+
function hasIn2(object, path9) {
|
|
62763
|
+
return object != null && hasPath2(object, path9, baseHasIn2);
|
|
62723
62764
|
}
|
|
62724
62765
|
module2.exports = hasIn2;
|
|
62725
62766
|
}
|
|
@@ -62737,13 +62778,13 @@ var require_baseMatchesProperty = __commonJS({
|
|
|
62737
62778
|
var toKey2 = require_toKey();
|
|
62738
62779
|
var COMPARE_PARTIAL_FLAG7 = 1;
|
|
62739
62780
|
var COMPARE_UNORDERED_FLAG5 = 2;
|
|
62740
|
-
function baseMatchesProperty2(
|
|
62741
|
-
if (isKey2(
|
|
62742
|
-
return matchesStrictComparable2(toKey2(
|
|
62781
|
+
function baseMatchesProperty2(path9, srcValue) {
|
|
62782
|
+
if (isKey2(path9) && isStrictComparable2(srcValue)) {
|
|
62783
|
+
return matchesStrictComparable2(toKey2(path9), srcValue);
|
|
62743
62784
|
}
|
|
62744
62785
|
return function(object) {
|
|
62745
|
-
var objValue = get3(object,
|
|
62746
|
-
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);
|
|
62747
62788
|
};
|
|
62748
62789
|
}
|
|
62749
62790
|
module2.exports = baseMatchesProperty2;
|
|
@@ -62766,9 +62807,9 @@ var require_baseProperty = __commonJS({
|
|
|
62766
62807
|
var require_basePropertyDeep = __commonJS({
|
|
62767
62808
|
"node_modules/lodash/_basePropertyDeep.js"(exports2, module2) {
|
|
62768
62809
|
var baseGet2 = require_baseGet();
|
|
62769
|
-
function basePropertyDeep2(
|
|
62810
|
+
function basePropertyDeep2(path9) {
|
|
62770
62811
|
return function(object) {
|
|
62771
|
-
return baseGet2(object,
|
|
62812
|
+
return baseGet2(object, path9);
|
|
62772
62813
|
};
|
|
62773
62814
|
}
|
|
62774
62815
|
module2.exports = basePropertyDeep2;
|
|
@@ -62782,8 +62823,8 @@ var require_property = __commonJS({
|
|
|
62782
62823
|
var basePropertyDeep2 = require_basePropertyDeep();
|
|
62783
62824
|
var isKey2 = require_isKey();
|
|
62784
62825
|
var toKey2 = require_toKey();
|
|
62785
|
-
function property2(
|
|
62786
|
-
return isKey2(
|
|
62826
|
+
function property2(path9) {
|
|
62827
|
+
return isKey2(path9) ? baseProperty2(toKey2(path9)) : basePropertyDeep2(path9);
|
|
62787
62828
|
}
|
|
62788
62829
|
module2.exports = property2;
|
|
62789
62830
|
}
|
|
@@ -62845,8 +62886,8 @@ var require_has = __commonJS({
|
|
|
62845
62886
|
"node_modules/lodash/has.js"(exports2, module2) {
|
|
62846
62887
|
var baseHas2 = require_baseHas();
|
|
62847
62888
|
var hasPath2 = require_hasPath();
|
|
62848
|
-
function has2(object,
|
|
62849
|
-
return object != null && hasPath2(object,
|
|
62889
|
+
function has2(object, path9) {
|
|
62890
|
+
return object != null && hasPath2(object, path9, baseHas2);
|
|
62850
62891
|
}
|
|
62851
62892
|
module2.exports = has2;
|
|
62852
62893
|
}
|
|
@@ -65120,14 +65161,14 @@ var require_baseSet = __commonJS({
|
|
|
65120
65161
|
var isIndex2 = require_isIndex();
|
|
65121
65162
|
var isObject2 = require_isObject();
|
|
65122
65163
|
var toKey2 = require_toKey();
|
|
65123
|
-
function baseSet2(object,
|
|
65164
|
+
function baseSet2(object, path9, value, customizer) {
|
|
65124
65165
|
if (!isObject2(object)) {
|
|
65125
65166
|
return object;
|
|
65126
65167
|
}
|
|
65127
|
-
|
|
65128
|
-
var index = -1, length =
|
|
65168
|
+
path9 = castPath2(path9, object);
|
|
65169
|
+
var index = -1, length = path9.length, lastIndex = length - 1, nested = object;
|
|
65129
65170
|
while (nested != null && ++index < length) {
|
|
65130
|
-
var key = toKey2(
|
|
65171
|
+
var key = toKey2(path9[index]), newValue = value;
|
|
65131
65172
|
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
|
65132
65173
|
return object;
|
|
65133
65174
|
}
|
|
@@ -65135,7 +65176,7 @@ var require_baseSet = __commonJS({
|
|
|
65135
65176
|
var objValue = nested[key];
|
|
65136
65177
|
newValue = customizer ? customizer(objValue, key, nested) : void 0;
|
|
65137
65178
|
if (newValue === void 0) {
|
|
65138
|
-
newValue = isObject2(objValue) ? objValue : isIndex2(
|
|
65179
|
+
newValue = isObject2(objValue) ? objValue : isIndex2(path9[index + 1]) ? [] : {};
|
|
65139
65180
|
}
|
|
65140
65181
|
}
|
|
65141
65182
|
assignValue2(nested, key, newValue);
|
|
@@ -65156,9 +65197,9 @@ var require_basePickBy = __commonJS({
|
|
|
65156
65197
|
function basePickBy2(object, paths, predicate) {
|
|
65157
65198
|
var index = -1, length = paths.length, result = {};
|
|
65158
65199
|
while (++index < length) {
|
|
65159
|
-
var
|
|
65160
|
-
if (predicate(value,
|
|
65161
|
-
baseSet2(result, castPath2(
|
|
65200
|
+
var path9 = paths[index], value = baseGet2(object, path9);
|
|
65201
|
+
if (predicate(value, path9)) {
|
|
65202
|
+
baseSet2(result, castPath2(path9, object), value);
|
|
65162
65203
|
}
|
|
65163
65204
|
}
|
|
65164
65205
|
return result;
|
|
@@ -65173,8 +65214,8 @@ var require_basePick = __commonJS({
|
|
|
65173
65214
|
var basePickBy2 = require_basePickBy();
|
|
65174
65215
|
var hasIn2 = require_hasIn();
|
|
65175
65216
|
function basePick(object, paths) {
|
|
65176
|
-
return basePickBy2(object, paths, function(value,
|
|
65177
|
-
return hasIn2(object,
|
|
65217
|
+
return basePickBy2(object, paths, function(value, path9) {
|
|
65218
|
+
return hasIn2(object, path9);
|
|
65178
65219
|
});
|
|
65179
65220
|
}
|
|
65180
65221
|
module2.exports = basePick;
|
|
@@ -66228,15 +66269,15 @@ var require_parent_dummy_chains = __commonJS({
|
|
|
66228
66269
|
var node = g4.node(v4);
|
|
66229
66270
|
var edgeObj = node.edgeObj;
|
|
66230
66271
|
var pathData = findPath(g4, postorderNums, edgeObj.v, edgeObj.w);
|
|
66231
|
-
var
|
|
66272
|
+
var path9 = pathData.path;
|
|
66232
66273
|
var lca = pathData.lca;
|
|
66233
66274
|
var pathIdx = 0;
|
|
66234
|
-
var pathV =
|
|
66275
|
+
var pathV = path9[pathIdx];
|
|
66235
66276
|
var ascending = true;
|
|
66236
66277
|
while (v4 !== edgeObj.w) {
|
|
66237
66278
|
node = g4.node(v4);
|
|
66238
66279
|
if (ascending) {
|
|
66239
|
-
while ((pathV =
|
|
66280
|
+
while ((pathV = path9[pathIdx]) !== lca && g4.node(pathV).maxRank < node.rank) {
|
|
66240
66281
|
pathIdx++;
|
|
66241
66282
|
}
|
|
66242
66283
|
if (pathV === lca) {
|
|
@@ -66244,10 +66285,10 @@ var require_parent_dummy_chains = __commonJS({
|
|
|
66244
66285
|
}
|
|
66245
66286
|
}
|
|
66246
66287
|
if (!ascending) {
|
|
66247
|
-
while (pathIdx <
|
|
66288
|
+
while (pathIdx < path9.length - 1 && g4.node(pathV = path9[pathIdx + 1]).minRank <= node.rank) {
|
|
66248
66289
|
pathIdx++;
|
|
66249
66290
|
}
|
|
66250
|
-
pathV =
|
|
66291
|
+
pathV = path9[pathIdx];
|
|
66251
66292
|
}
|
|
66252
66293
|
g4.setParent(v4, pathV);
|
|
66253
66294
|
v4 = g4.successors(v4)[0];
|
|
@@ -68420,8 +68461,8 @@ var init_svg_generator = __esm({
|
|
|
68420
68461
|
elements.push(this.generateNodeWithPad(node, padX, padY));
|
|
68421
68462
|
}
|
|
68422
68463
|
for (const edge of layout.edges) {
|
|
68423
|
-
const { path:
|
|
68424
|
-
elements.push(
|
|
68464
|
+
const { path: path9, overlay } = this.generateEdge(edge, padX, padY, nodeMap);
|
|
68465
|
+
elements.push(path9);
|
|
68425
68466
|
if (overlay)
|
|
68426
68467
|
overlays.push(overlay);
|
|
68427
68468
|
}
|
|
@@ -74737,8 +74778,8 @@ var require_utils = __commonJS({
|
|
|
74737
74778
|
}
|
|
74738
74779
|
return ind;
|
|
74739
74780
|
}
|
|
74740
|
-
function removeDotSegments(
|
|
74741
|
-
let input =
|
|
74781
|
+
function removeDotSegments(path9) {
|
|
74782
|
+
let input = path9;
|
|
74742
74783
|
const output = [];
|
|
74743
74784
|
let nextSlash = -1;
|
|
74744
74785
|
let len = 0;
|
|
@@ -74937,8 +74978,8 @@ var require_schemes = __commonJS({
|
|
|
74937
74978
|
wsComponent.secure = void 0;
|
|
74938
74979
|
}
|
|
74939
74980
|
if (wsComponent.resourceName) {
|
|
74940
|
-
const [
|
|
74941
|
-
wsComponent.path =
|
|
74981
|
+
const [path9, query2] = wsComponent.resourceName.split("?");
|
|
74982
|
+
wsComponent.path = path9 && path9 !== "/" ? path9 : void 0;
|
|
74942
74983
|
wsComponent.query = query2;
|
|
74943
74984
|
wsComponent.resourceName = void 0;
|
|
74944
74985
|
}
|
|
@@ -78281,7 +78322,7 @@ function validateJsonResponse(response, options = {}) {
|
|
|
78281
78322
|
}
|
|
78282
78323
|
if (!valid) {
|
|
78283
78324
|
const formattedErrors = validate2.errors.map((err) => {
|
|
78284
|
-
const
|
|
78325
|
+
const path9 = err.instancePath ? err.instancePath.substring(1).replace(/\//g, ".") : "<root>";
|
|
78285
78326
|
let message = "";
|
|
78286
78327
|
let suggestion = "";
|
|
78287
78328
|
if (err.keyword === "additionalProperties") {
|
|
@@ -78319,7 +78360,7 @@ function validateJsonResponse(response, options = {}) {
|
|
|
78319
78360
|
message = err.message;
|
|
78320
78361
|
suggestion = "";
|
|
78321
78362
|
}
|
|
78322
|
-
const location =
|
|
78363
|
+
const location = path9 ? `at '${path9}'` : "at root";
|
|
78323
78364
|
return suggestion ? `${location}: ${message} \u2192 ${suggestion}` : `${location}: ${message}`;
|
|
78324
78365
|
});
|
|
78325
78366
|
const errorSummary = formattedErrors.join("\n ");
|
|
@@ -78642,7 +78683,7 @@ function extractMermaidFromJson(response) {
|
|
|
78642
78683
|
}
|
|
78643
78684
|
const diagrams = [];
|
|
78644
78685
|
const jsonPaths = [];
|
|
78645
|
-
function searchObject(obj,
|
|
78686
|
+
function searchObject(obj, path9 = []) {
|
|
78646
78687
|
if (typeof obj === "string") {
|
|
78647
78688
|
const mermaidPattern = /```mermaid([^\n`]*?)(?:\n|\\n)([\s\S]*?)```/gi;
|
|
78648
78689
|
let match2;
|
|
@@ -78656,14 +78697,14 @@ function extractMermaidFromJson(response) {
|
|
|
78656
78697
|
endIndex: match2.index + match2[0].length,
|
|
78657
78698
|
attributes,
|
|
78658
78699
|
isInJson: true,
|
|
78659
|
-
jsonPath:
|
|
78700
|
+
jsonPath: path9.join(".")
|
|
78660
78701
|
});
|
|
78661
|
-
jsonPaths.push(
|
|
78702
|
+
jsonPaths.push(path9.join("."));
|
|
78662
78703
|
}
|
|
78663
78704
|
} else if (Array.isArray(obj)) {
|
|
78664
|
-
obj.forEach((item, index) => searchObject(item, [...
|
|
78705
|
+
obj.forEach((item, index) => searchObject(item, [...path9, `[${index}]`]));
|
|
78665
78706
|
} else if (obj && typeof obj === "object") {
|
|
78666
|
-
Object.entries(obj).forEach(([key, value]) => searchObject(value, [...
|
|
78707
|
+
Object.entries(obj).forEach(([key, value]) => searchObject(value, [...path9, key]));
|
|
78667
78708
|
}
|
|
78668
78709
|
}
|
|
78669
78710
|
searchObject(parsedJson);
|
|
@@ -78920,7 +78961,7 @@ async function tryMaidAutoFix(diagramContent, options = {}) {
|
|
|
78920
78961
|
}
|
|
78921
78962
|
}
|
|
78922
78963
|
async function validateAndFixMermaidResponse(response, options = {}) {
|
|
78923
|
-
const { schema, debug, path:
|
|
78964
|
+
const { schema, debug, path: path9, provider, model, tracer } = options;
|
|
78924
78965
|
const startTime = Date.now();
|
|
78925
78966
|
if (debug) {
|
|
78926
78967
|
console.log(`[DEBUG] Mermaid validation: Starting maid-based validation for response (${response.length} chars)`);
|
|
@@ -79077,7 +79118,7 @@ ${maidResult.fixed}
|
|
|
79077
79118
|
}
|
|
79078
79119
|
const aiFixingStart = Date.now();
|
|
79079
79120
|
const mermaidFixer = new MermaidFixingAgent({
|
|
79080
|
-
path:
|
|
79121
|
+
path: path9,
|
|
79081
79122
|
provider,
|
|
79082
79123
|
model,
|
|
79083
79124
|
debug,
|
|
@@ -79319,8 +79360,8 @@ Schema Validation Errors:
|
|
|
79319
79360
|
${validationResult.errorSummary}`;
|
|
79320
79361
|
} else if (validationResult.schemaErrors && validationResult.schemaErrors.length > 0) {
|
|
79321
79362
|
const errors = validationResult.schemaErrors.map((err) => {
|
|
79322
|
-
const
|
|
79323
|
-
return ` ${
|
|
79363
|
+
const path9 = err.instancePath || "(root)";
|
|
79364
|
+
return ` ${path9}: ${err.message}`;
|
|
79324
79365
|
}).join("\n");
|
|
79325
79366
|
schemaErrorDetails = `
|
|
79326
79367
|
|
|
@@ -79680,11 +79721,11 @@ function loadMCPConfigurationFromPath(configPath) {
|
|
|
79680
79721
|
if (!configPath) {
|
|
79681
79722
|
throw new Error("Config path is required");
|
|
79682
79723
|
}
|
|
79683
|
-
if (!(0,
|
|
79724
|
+
if (!(0, import_fs7.existsSync)(configPath)) {
|
|
79684
79725
|
throw new Error(`MCP configuration file not found: ${configPath}`);
|
|
79685
79726
|
}
|
|
79686
79727
|
try {
|
|
79687
|
-
const content = (0,
|
|
79728
|
+
const content = (0, import_fs7.readFileSync)(configPath, "utf8");
|
|
79688
79729
|
const config = JSON.parse(content);
|
|
79689
79730
|
if (process.env.DEBUG === "1" || process.env.DEBUG_MCP === "1") {
|
|
79690
79731
|
console.error(`[MCP DEBUG] Loaded configuration from: ${configPath}`);
|
|
@@ -79699,19 +79740,19 @@ function loadMCPConfiguration() {
|
|
|
79699
79740
|
// Environment variable path
|
|
79700
79741
|
process.env.MCP_CONFIG_PATH,
|
|
79701
79742
|
// Local project paths
|
|
79702
|
-
(0,
|
|
79703
|
-
(0,
|
|
79743
|
+
(0, import_path6.join)(process.cwd(), ".mcp", "config.json"),
|
|
79744
|
+
(0, import_path6.join)(process.cwd(), "mcp.config.json"),
|
|
79704
79745
|
// Home directory paths
|
|
79705
|
-
(0,
|
|
79706
|
-
(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"),
|
|
79707
79748
|
// Claude-style config location
|
|
79708
|
-
(0,
|
|
79749
|
+
(0, import_path6.join)((0, import_os3.homedir)(), "Library", "Application Support", "Claude", "mcp_config.json")
|
|
79709
79750
|
].filter(Boolean);
|
|
79710
79751
|
let config = null;
|
|
79711
79752
|
for (const configPath of configPaths) {
|
|
79712
|
-
if ((0,
|
|
79753
|
+
if ((0, import_fs7.existsSync)(configPath)) {
|
|
79713
79754
|
try {
|
|
79714
|
-
const content = (0,
|
|
79755
|
+
const content = (0, import_fs7.readFileSync)(configPath, "utf8");
|
|
79715
79756
|
config = JSON.parse(content);
|
|
79716
79757
|
if (process.env.DEBUG === "1" || process.env.DEBUG_MCP === "1") {
|
|
79717
79758
|
console.error(`[MCP DEBUG] Loaded configuration from: ${configPath}`);
|
|
@@ -79807,22 +79848,22 @@ function parseEnabledServers(config) {
|
|
|
79807
79848
|
}
|
|
79808
79849
|
return servers;
|
|
79809
79850
|
}
|
|
79810
|
-
var
|
|
79851
|
+
var import_fs7, import_path6, import_os3, import_url4, __filename4, __dirname4, DEFAULT_CONFIG;
|
|
79811
79852
|
var init_config = __esm({
|
|
79812
79853
|
"src/agent/mcp/config.js"() {
|
|
79813
79854
|
"use strict";
|
|
79814
|
-
|
|
79815
|
-
|
|
79855
|
+
import_fs7 = require("fs");
|
|
79856
|
+
import_path6 = require("path");
|
|
79816
79857
|
import_os3 = require("os");
|
|
79817
79858
|
import_url4 = require("url");
|
|
79818
79859
|
__filename4 = (0, import_url4.fileURLToPath)("file:///");
|
|
79819
|
-
__dirname4 = (0,
|
|
79860
|
+
__dirname4 = (0, import_path6.dirname)(__filename4);
|
|
79820
79861
|
DEFAULT_CONFIG = {
|
|
79821
79862
|
mcpServers: {
|
|
79822
79863
|
// Example probe server configuration
|
|
79823
79864
|
"probe-local": {
|
|
79824
79865
|
command: "node",
|
|
79825
|
-
args: [(0,
|
|
79866
|
+
args: [(0, import_path6.join)(__dirname4, "../../../examples/chat/mcpServer.js")],
|
|
79826
79867
|
transport: "stdio",
|
|
79827
79868
|
enabled: false
|
|
79828
79869
|
},
|
|
@@ -81942,12 +81983,12 @@ async function createEnhancedClaudeCLIEngine(options = {}) {
|
|
|
81942
81983
|
console.log("[DEBUG] Built-in MCP server started");
|
|
81943
81984
|
console.log("[DEBUG] MCP URL:", `http://${host}:${port}/mcp`);
|
|
81944
81985
|
}
|
|
81945
|
-
mcpConfigPath =
|
|
81986
|
+
mcpConfigPath = import_path7.default.join(import_os4.default.tmpdir(), `probe-mcp-${session.id}.json`);
|
|
81946
81987
|
const mcpConfig = {
|
|
81947
81988
|
mcpServers: {
|
|
81948
81989
|
probe: {
|
|
81949
81990
|
command: "node",
|
|
81950
|
-
args: [
|
|
81991
|
+
args: [import_path7.default.join(process.cwd(), "mcp-probe-server.js")],
|
|
81951
81992
|
env: {
|
|
81952
81993
|
PROBE_WORKSPACE: process.cwd(),
|
|
81953
81994
|
DEBUG: debug ? "true" : "false"
|
|
@@ -82316,14 +82357,14 @@ function combinePrompts(systemPrompt, customPrompt, agent) {
|
|
|
82316
82357
|
}
|
|
82317
82358
|
return systemPrompt || "";
|
|
82318
82359
|
}
|
|
82319
|
-
var import_child_process7, import_crypto5, import_promises2,
|
|
82360
|
+
var import_child_process7, import_crypto5, import_promises2, import_path7, import_os4, import_events3;
|
|
82320
82361
|
var init_enhanced_claude_code = __esm({
|
|
82321
82362
|
"src/agent/engines/enhanced-claude-code.js"() {
|
|
82322
82363
|
"use strict";
|
|
82323
82364
|
import_child_process7 = require("child_process");
|
|
82324
82365
|
import_crypto5 = require("crypto");
|
|
82325
82366
|
import_promises2 = __toESM(require("fs/promises"), 1);
|
|
82326
|
-
|
|
82367
|
+
import_path7 = __toESM(require("path"), 1);
|
|
82327
82368
|
import_os4 = __toESM(require("os"), 1);
|
|
82328
82369
|
import_events3 = require("events");
|
|
82329
82370
|
init_built_in_server();
|
|
@@ -82680,7 +82721,7 @@ var ProbeAgent_exports = {};
|
|
|
82680
82721
|
__export(ProbeAgent_exports, {
|
|
82681
82722
|
ProbeAgent: () => ProbeAgent
|
|
82682
82723
|
});
|
|
82683
|
-
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;
|
|
82684
82725
|
var init_ProbeAgent = __esm({
|
|
82685
82726
|
"src/agent/ProbeAgent.js"() {
|
|
82686
82727
|
"use strict";
|
|
@@ -82692,9 +82733,9 @@ var init_ProbeAgent = __esm({
|
|
|
82692
82733
|
import_ai2 = require("ai");
|
|
82693
82734
|
import_crypto7 = require("crypto");
|
|
82694
82735
|
import_events4 = require("events");
|
|
82695
|
-
|
|
82736
|
+
import_fs8 = require("fs");
|
|
82696
82737
|
import_promises3 = require("fs/promises");
|
|
82697
|
-
|
|
82738
|
+
import_path8 = require("path");
|
|
82698
82739
|
init_tokenCounter();
|
|
82699
82740
|
init_InMemoryStorageAdapter();
|
|
82700
82741
|
init_HookManager();
|
|
@@ -82733,6 +82774,7 @@ var init_ProbeAgent = __esm({
|
|
|
82733
82774
|
* @param {boolean} [options.allowEdit=false] - Allow the use of the 'implement' tool
|
|
82734
82775
|
* @param {boolean} [options.enableDelegate=false] - Enable the delegate tool for task distribution to subagents
|
|
82735
82776
|
* @param {string} [options.path] - Search directory path
|
|
82777
|
+
* @param {string} [options.cwd] - Working directory for resolving relative paths (independent of allowedFolders)
|
|
82736
82778
|
* @param {string} [options.provider] - Force specific AI provider
|
|
82737
82779
|
* @param {string} [options.model] - Override model name
|
|
82738
82780
|
* @param {boolean} [options.debug] - Enable debug mode
|
|
@@ -82761,6 +82803,7 @@ var init_ProbeAgent = __esm({
|
|
|
82761
82803
|
* @param {Array<Object>} [options.fallback.providers] - List of provider configurations for custom fallback
|
|
82762
82804
|
* @param {boolean} [options.fallback.stopOnSuccess=true] - Stop on first success
|
|
82763
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)
|
|
82764
82807
|
*/
|
|
82765
82808
|
constructor(options = {}) {
|
|
82766
82809
|
this.sessionId = options.sessionId || (0, import_crypto7.randomUUID)();
|
|
@@ -82782,6 +82825,7 @@ var init_ProbeAgent = __esm({
|
|
|
82782
82825
|
this.maxIterations = options.maxIterations || null;
|
|
82783
82826
|
this.disableMermaidValidation = !!options.disableMermaidValidation;
|
|
82784
82827
|
this.disableJsonValidation = !!options.disableJsonValidation;
|
|
82828
|
+
this.completionPrompt = options.completionPrompt || null;
|
|
82785
82829
|
const effectiveAllowedTools = options.disableTools ? [] : options.allowedTools;
|
|
82786
82830
|
this.allowedTools = this._parseAllowedTools(effectiveAllowedTools);
|
|
82787
82831
|
this.storageAdapter = options.storageAdapter || new InMemoryStorageAdapter();
|
|
@@ -82800,6 +82844,7 @@ var init_ProbeAgent = __esm({
|
|
|
82800
82844
|
} else {
|
|
82801
82845
|
this.allowedFolders = [process.cwd()];
|
|
82802
82846
|
}
|
|
82847
|
+
this.cwd = options.cwd || null;
|
|
82803
82848
|
this.clientApiProvider = options.provider || null;
|
|
82804
82849
|
this.clientApiModel = options.model || null;
|
|
82805
82850
|
this.clientApiKey = null;
|
|
@@ -82978,7 +83023,8 @@ var init_ProbeAgent = __esm({
|
|
|
82978
83023
|
const configOptions = {
|
|
82979
83024
|
sessionId: this.sessionId,
|
|
82980
83025
|
debug: this.debug,
|
|
82981
|
-
|
|
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()),
|
|
82982
83028
|
allowedFolders: this.allowedFolders,
|
|
82983
83029
|
outline: this.outline,
|
|
82984
83030
|
allowEdit: this.allowEdit,
|
|
@@ -83016,7 +83062,7 @@ var init_ProbeAgent = __esm({
|
|
|
83016
83062
|
if (!imagePath) {
|
|
83017
83063
|
throw new Error("Image path is required");
|
|
83018
83064
|
}
|
|
83019
|
-
const filename = (0,
|
|
83065
|
+
const filename = (0, import_path8.basename)(imagePath);
|
|
83020
83066
|
const extension = filename.toLowerCase().split(".").pop();
|
|
83021
83067
|
if (!extension || !SUPPORTED_IMAGE_EXTENSIONS.includes(extension)) {
|
|
83022
83068
|
throw new Error(`Invalid or unsupported image extension: ${extension}. Supported formats: ${SUPPORTED_IMAGE_EXTENSIONS.join(", ")}`);
|
|
@@ -83571,7 +83617,7 @@ var init_ProbeAgent = __esm({
|
|
|
83571
83617
|
let resolvedPath2 = imagePath;
|
|
83572
83618
|
if (!imagePath.includes("/") && !imagePath.includes("\\")) {
|
|
83573
83619
|
for (const dir of listFilesDirectories) {
|
|
83574
|
-
const potentialPath = (0,
|
|
83620
|
+
const potentialPath = (0, import_path8.resolve)(dir, imagePath);
|
|
83575
83621
|
const loaded = await this.loadImageIfValid(potentialPath);
|
|
83576
83622
|
if (loaded) {
|
|
83577
83623
|
if (this.debug) {
|
|
@@ -83596,7 +83642,7 @@ var init_ProbeAgent = __esm({
|
|
|
83596
83642
|
let match2;
|
|
83597
83643
|
while ((match2 = fileHeaderPattern.exec(content)) !== null) {
|
|
83598
83644
|
const filePath = match2[1].trim();
|
|
83599
|
-
const dir = (0,
|
|
83645
|
+
const dir = (0, import_path8.dirname)(filePath);
|
|
83600
83646
|
if (dir && dir !== ".") {
|
|
83601
83647
|
directories.push(dir);
|
|
83602
83648
|
if (this.debug) {
|
|
@@ -83641,17 +83687,17 @@ var init_ProbeAgent = __esm({
|
|
|
83641
83687
|
const allowedDirs = this.allowedFolders && this.allowedFolders.length > 0 ? this.allowedFolders : [process.cwd()];
|
|
83642
83688
|
let absolutePath;
|
|
83643
83689
|
let isPathAllowed2 = false;
|
|
83644
|
-
if ((0,
|
|
83645
|
-
absolutePath = (0,
|
|
83690
|
+
if ((0, import_path8.isAbsolute)(imagePath)) {
|
|
83691
|
+
absolutePath = (0, import_path8.normalize)((0, import_path8.resolve)(imagePath));
|
|
83646
83692
|
isPathAllowed2 = allowedDirs.some((dir) => {
|
|
83647
|
-
const normalizedDir = (0,
|
|
83648
|
-
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);
|
|
83649
83695
|
});
|
|
83650
83696
|
} else {
|
|
83651
83697
|
for (const dir of allowedDirs) {
|
|
83652
|
-
const normalizedDir = (0,
|
|
83653
|
-
const resolvedPath2 = (0,
|
|
83654
|
-
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)) {
|
|
83655
83701
|
absolutePath = resolvedPath2;
|
|
83656
83702
|
isPathAllowed2 = true;
|
|
83657
83703
|
break;
|
|
@@ -84829,6 +84875,46 @@ IMPORTANT: When using <attempt_complete>, this must be the ONLY content in your
|
|
|
84829
84875
|
} catch (error2) {
|
|
84830
84876
|
console.error(`[ERROR] Failed to save messages to storage:`, error2);
|
|
84831
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
|
+
}
|
|
84832
84918
|
const reachedMaxIterations = currentIteration >= maxIterations && !completionAttempted;
|
|
84833
84919
|
if (options.schema && !options._schemaFormatted && !completionAttempted && !reachedMaxIterations) {
|
|
84834
84920
|
if (this.debug) {
|
|
@@ -85295,6 +85381,8 @@ Convert your previous response content into actual JSON data that follows this s
|
|
|
85295
85381
|
path: this.allowedFolders[0],
|
|
85296
85382
|
// Use first allowed folder as primary path
|
|
85297
85383
|
allowedFolders: [...this.allowedFolders],
|
|
85384
|
+
cwd: this.cwd,
|
|
85385
|
+
// Preserve explicit working directory
|
|
85298
85386
|
provider: this.clientApiProvider,
|
|
85299
85387
|
model: this.clientApiModel,
|
|
85300
85388
|
debug: this.debug,
|
|
@@ -85303,6 +85391,7 @@ Convert your previous response content into actual JSON data that follows this s
|
|
|
85303
85391
|
maxIterations: this.maxIterations,
|
|
85304
85392
|
disableMermaidValidation: this.disableMermaidValidation,
|
|
85305
85393
|
disableJsonValidation: this.disableJsonValidation,
|
|
85394
|
+
completionPrompt: this.completionPrompt,
|
|
85306
85395
|
allowedTools: allowedToolsArray,
|
|
85307
85396
|
enableMcp: !!this.mcpBridge,
|
|
85308
85397
|
mcpConfig: this.mcpConfig,
|
|
@@ -85478,7 +85567,7 @@ async function delegate({
|
|
|
85478
85567
|
maxIterations = 30,
|
|
85479
85568
|
tracer = null,
|
|
85480
85569
|
parentSessionId = null,
|
|
85481
|
-
path:
|
|
85570
|
+
path: path9 = null,
|
|
85482
85571
|
provider = null,
|
|
85483
85572
|
model = null
|
|
85484
85573
|
}) {
|
|
@@ -85518,7 +85607,7 @@ async function delegate({
|
|
|
85518
85607
|
maxIterations: remainingIterations,
|
|
85519
85608
|
debug,
|
|
85520
85609
|
tracer,
|
|
85521
|
-
path:
|
|
85610
|
+
path: path9,
|
|
85522
85611
|
// Inherit from parent
|
|
85523
85612
|
provider,
|
|
85524
85613
|
// Inherit from parent
|
|
@@ -85742,15 +85831,15 @@ var init_vercel = __esm({
|
|
|
85742
85831
|
name: "search",
|
|
85743
85832
|
description: searchDescription,
|
|
85744
85833
|
inputSchema: searchSchema,
|
|
85745
|
-
execute: async ({ query: searchQuery, path:
|
|
85834
|
+
execute: async ({ query: searchQuery, path: path9, allow_tests, exact, maxTokens: paramMaxTokens, language }) => {
|
|
85746
85835
|
try {
|
|
85747
85836
|
const effectiveMaxTokens = paramMaxTokens || maxTokens;
|
|
85748
|
-
let searchPath =
|
|
85749
|
-
if ((searchPath === "." || searchPath === "./") && options.
|
|
85837
|
+
let searchPath = path9 || options.cwd || ".";
|
|
85838
|
+
if ((searchPath === "." || searchPath === "./") && options.cwd) {
|
|
85750
85839
|
if (debug) {
|
|
85751
|
-
console.error(`Using
|
|
85840
|
+
console.error(`Using cwd "${options.cwd}" instead of "${searchPath}"`);
|
|
85752
85841
|
}
|
|
85753
|
-
searchPath = options.
|
|
85842
|
+
searchPath = options.cwd;
|
|
85754
85843
|
}
|
|
85755
85844
|
if (debug) {
|
|
85756
85845
|
console.error(`Executing search with query: "${searchQuery}", path: "${searchPath}", exact: ${exact ? "true" : "false"}, language: ${language || "all"}, session: ${sessionId || "none"}`);
|
|
@@ -85758,6 +85847,8 @@ var init_vercel = __esm({
|
|
|
85758
85847
|
const searchOptions = {
|
|
85759
85848
|
query: searchQuery,
|
|
85760
85849
|
path: searchPath,
|
|
85850
|
+
cwd: options.cwd,
|
|
85851
|
+
// Working directory for resolving relative paths
|
|
85761
85852
|
allowTests: allow_tests,
|
|
85762
85853
|
exact,
|
|
85763
85854
|
json: false,
|
|
@@ -85785,14 +85876,14 @@ var init_vercel = __esm({
|
|
|
85785
85876
|
name: "query",
|
|
85786
85877
|
description: queryDescription,
|
|
85787
85878
|
inputSchema: querySchema,
|
|
85788
|
-
execute: async ({ pattern, path:
|
|
85879
|
+
execute: async ({ pattern, path: path9, language, allow_tests }) => {
|
|
85789
85880
|
try {
|
|
85790
|
-
let queryPath =
|
|
85791
|
-
if ((queryPath === "." || queryPath === "./") && options.
|
|
85881
|
+
let queryPath = path9 || options.cwd || ".";
|
|
85882
|
+
if ((queryPath === "." || queryPath === "./") && options.cwd) {
|
|
85792
85883
|
if (debug) {
|
|
85793
|
-
console.error(`Using
|
|
85884
|
+
console.error(`Using cwd "${options.cwd}" instead of "${queryPath}"`);
|
|
85794
85885
|
}
|
|
85795
|
-
queryPath = options.
|
|
85886
|
+
queryPath = options.cwd;
|
|
85796
85887
|
}
|
|
85797
85888
|
if (debug) {
|
|
85798
85889
|
console.error(`Executing query with pattern: "${pattern}", path: "${queryPath}", language: ${language || "auto"}`);
|
|
@@ -85800,6 +85891,8 @@ var init_vercel = __esm({
|
|
|
85800
85891
|
const results = await query({
|
|
85801
85892
|
pattern,
|
|
85802
85893
|
path: queryPath,
|
|
85894
|
+
cwd: options.cwd,
|
|
85895
|
+
// Working directory for resolving relative paths
|
|
85803
85896
|
language,
|
|
85804
85897
|
allow_tests,
|
|
85805
85898
|
json: false
|
|
@@ -85820,22 +85913,16 @@ var init_vercel = __esm({
|
|
|
85820
85913
|
inputSchema: extractSchema,
|
|
85821
85914
|
execute: async ({ targets, input_content, line, end_line, allow_tests, context_lines, format: format2 }) => {
|
|
85822
85915
|
try {
|
|
85823
|
-
|
|
85824
|
-
if ((extractPath === "." || extractPath === "./") && options.defaultPath) {
|
|
85825
|
-
if (debug) {
|
|
85826
|
-
console.error(`Using default path "${options.defaultPath}" instead of "${extractPath}"`);
|
|
85827
|
-
}
|
|
85828
|
-
extractPath = options.defaultPath;
|
|
85829
|
-
}
|
|
85916
|
+
const effectiveCwd = options.cwd || ".";
|
|
85830
85917
|
if (debug) {
|
|
85831
85918
|
if (targets) {
|
|
85832
|
-
console.error(`Executing extract with targets: "${targets}",
|
|
85919
|
+
console.error(`Executing extract with targets: "${targets}", cwd: "${effectiveCwd}", context lines: ${context_lines || 10}`);
|
|
85833
85920
|
} else if (input_content) {
|
|
85834
|
-
console.error(`Executing extract with input content,
|
|
85921
|
+
console.error(`Executing extract with input content, cwd: "${effectiveCwd}", context lines: ${context_lines || 10}`);
|
|
85835
85922
|
}
|
|
85836
85923
|
}
|
|
85837
85924
|
let tempFilePath = null;
|
|
85838
|
-
let extractOptions = {
|
|
85925
|
+
let extractOptions = { cwd: effectiveCwd };
|
|
85839
85926
|
if (input_content) {
|
|
85840
85927
|
const { writeFileSync: writeFileSync2, unlinkSync } = await import("fs");
|
|
85841
85928
|
const { join: join3 } = await import("path");
|
|
@@ -85852,6 +85939,7 @@ var init_vercel = __esm({
|
|
|
85852
85939
|
}
|
|
85853
85940
|
extractOptions = {
|
|
85854
85941
|
inputFile: tempFilePath,
|
|
85942
|
+
cwd: effectiveCwd,
|
|
85855
85943
|
allowTests: allow_tests,
|
|
85856
85944
|
contextLines: context_lines,
|
|
85857
85945
|
format: effectiveFormat
|
|
@@ -85864,6 +85952,7 @@ var init_vercel = __esm({
|
|
|
85864
85952
|
}
|
|
85865
85953
|
extractOptions = {
|
|
85866
85954
|
files,
|
|
85955
|
+
cwd: effectiveCwd,
|
|
85867
85956
|
allowTests: allow_tests,
|
|
85868
85957
|
contextLines: context_lines,
|
|
85869
85958
|
format: effectiveFormat
|
|
@@ -85892,12 +85981,12 @@ var init_vercel = __esm({
|
|
|
85892
85981
|
});
|
|
85893
85982
|
};
|
|
85894
85983
|
delegateTool = (options = {}) => {
|
|
85895
|
-
const { debug = false, timeout = 300,
|
|
85984
|
+
const { debug = false, timeout = 300, cwd, allowedFolders } = options;
|
|
85896
85985
|
return (0, import_ai3.tool)({
|
|
85897
85986
|
name: "delegate",
|
|
85898
85987
|
description: delegateDescription,
|
|
85899
85988
|
inputSchema: delegateSchema,
|
|
85900
|
-
execute: async ({ task, currentIteration, maxIterations, parentSessionId, path:
|
|
85989
|
+
execute: async ({ task, currentIteration, maxIterations, parentSessionId, path: path9, provider, model, tracer }) => {
|
|
85901
85990
|
if (!task || typeof task !== "string") {
|
|
85902
85991
|
throw new Error("Task parameter is required and must be a non-empty string");
|
|
85903
85992
|
}
|
|
@@ -85913,7 +86002,7 @@ var init_vercel = __esm({
|
|
|
85913
86002
|
if (parentSessionId !== void 0 && parentSessionId !== null && typeof parentSessionId !== "string") {
|
|
85914
86003
|
throw new TypeError("parentSessionId must be a string, null, or undefined");
|
|
85915
86004
|
}
|
|
85916
|
-
if (
|
|
86005
|
+
if (path9 !== void 0 && path9 !== null && typeof path9 !== "string") {
|
|
85917
86006
|
throw new TypeError("path must be a string, null, or undefined");
|
|
85918
86007
|
}
|
|
85919
86008
|
if (provider !== void 0 && provider !== null && typeof provider !== "string") {
|
|
@@ -85922,13 +86011,13 @@ var init_vercel = __esm({
|
|
|
85922
86011
|
if (model !== void 0 && model !== null && typeof model !== "string") {
|
|
85923
86012
|
throw new TypeError("model must be a string, null, or undefined");
|
|
85924
86013
|
}
|
|
85925
|
-
const effectivePath =
|
|
86014
|
+
const effectivePath = path9 || cwd || allowedFolders && allowedFolders[0];
|
|
85926
86015
|
if (debug) {
|
|
85927
86016
|
console.error(`Executing delegate with task: "${task.substring(0, 100)}${task.length > 100 ? "..." : ""}"`);
|
|
85928
86017
|
if (parentSessionId) {
|
|
85929
86018
|
console.error(`Parent session: ${parentSessionId}`);
|
|
85930
86019
|
}
|
|
85931
|
-
if (effectivePath && effectivePath !==
|
|
86020
|
+
if (effectivePath && effectivePath !== path9) {
|
|
85932
86021
|
console.error(`Using inherited path: ${effectivePath}`);
|
|
85933
86022
|
}
|
|
85934
86023
|
}
|
|
@@ -86785,8 +86874,8 @@ async function executeBashCommand(command, options = {}) {
|
|
|
86785
86874
|
} = options;
|
|
86786
86875
|
let cwd = workingDirectory;
|
|
86787
86876
|
try {
|
|
86788
|
-
cwd = (0,
|
|
86789
|
-
if (!(0,
|
|
86877
|
+
cwd = (0, import_path9.resolve)(cwd);
|
|
86878
|
+
if (!(0, import_fs9.existsSync)(cwd)) {
|
|
86790
86879
|
throw new Error(`Working directory does not exist: ${cwd}`);
|
|
86791
86880
|
}
|
|
86792
86881
|
} catch (error2) {
|
|
@@ -86998,7 +87087,7 @@ function validateExecutionOptions(options = {}) {
|
|
|
86998
87087
|
if (options.workingDirectory) {
|
|
86999
87088
|
if (typeof options.workingDirectory !== "string") {
|
|
87000
87089
|
errors.push("workingDirectory must be a string");
|
|
87001
|
-
} else if (!(0,
|
|
87090
|
+
} else if (!(0, import_fs9.existsSync)(options.workingDirectory)) {
|
|
87002
87091
|
errors.push(`workingDirectory does not exist: ${options.workingDirectory}`);
|
|
87003
87092
|
}
|
|
87004
87093
|
}
|
|
@@ -87011,31 +87100,31 @@ function validateExecutionOptions(options = {}) {
|
|
|
87011
87100
|
warnings
|
|
87012
87101
|
};
|
|
87013
87102
|
}
|
|
87014
|
-
var import_child_process9,
|
|
87103
|
+
var import_child_process9, import_path9, import_fs9;
|
|
87015
87104
|
var init_bashExecutor = __esm({
|
|
87016
87105
|
"src/agent/bashExecutor.js"() {
|
|
87017
87106
|
"use strict";
|
|
87018
87107
|
import_child_process9 = require("child_process");
|
|
87019
|
-
|
|
87020
|
-
|
|
87108
|
+
import_path9 = require("path");
|
|
87109
|
+
import_fs9 = require("fs");
|
|
87021
87110
|
init_bashCommandUtils();
|
|
87022
87111
|
}
|
|
87023
87112
|
});
|
|
87024
87113
|
|
|
87025
87114
|
// src/tools/bash.js
|
|
87026
|
-
var import_ai4,
|
|
87115
|
+
var import_ai4, import_path10, bashTool;
|
|
87027
87116
|
var init_bash = __esm({
|
|
87028
87117
|
"src/tools/bash.js"() {
|
|
87029
87118
|
"use strict";
|
|
87030
87119
|
import_ai4 = require("ai");
|
|
87031
|
-
|
|
87120
|
+
import_path10 = require("path");
|
|
87032
87121
|
init_bashPermissions();
|
|
87033
87122
|
init_bashExecutor();
|
|
87034
87123
|
bashTool = (options = {}) => {
|
|
87035
87124
|
const {
|
|
87036
87125
|
bashConfig = {},
|
|
87037
87126
|
debug = false,
|
|
87038
|
-
|
|
87127
|
+
cwd,
|
|
87039
87128
|
allowedFolders = []
|
|
87040
87129
|
} = options;
|
|
87041
87130
|
const permissionChecker = new BashPermissionChecker({
|
|
@@ -87049,8 +87138,8 @@ var init_bash = __esm({
|
|
|
87049
87138
|
if (bashConfig.workingDirectory) {
|
|
87050
87139
|
return bashConfig.workingDirectory;
|
|
87051
87140
|
}
|
|
87052
|
-
if (
|
|
87053
|
-
return
|
|
87141
|
+
if (cwd) {
|
|
87142
|
+
return cwd;
|
|
87054
87143
|
}
|
|
87055
87144
|
if (allowedFolders && allowedFolders.length > 0) {
|
|
87056
87145
|
return allowedFolders[0];
|
|
@@ -87138,9 +87227,9 @@ For code exploration, try these safe alternatives:
|
|
|
87138
87227
|
}
|
|
87139
87228
|
const workingDir = workingDirectory || getDefaultWorkingDirectory();
|
|
87140
87229
|
if (allowedFolders && allowedFolders.length > 0) {
|
|
87141
|
-
const resolvedWorkingDir = (0,
|
|
87230
|
+
const resolvedWorkingDir = (0, import_path10.resolve)(workingDir);
|
|
87142
87231
|
const isAllowed = allowedFolders.some((folder) => {
|
|
87143
|
-
const resolvedFolder = (0,
|
|
87232
|
+
const resolvedFolder = (0, import_path10.resolve)(folder);
|
|
87144
87233
|
return resolvedWorkingDir.startsWith(resolvedFolder);
|
|
87145
87234
|
});
|
|
87146
87235
|
if (!isAllowed) {
|
|
@@ -87196,33 +87285,33 @@ Command failed with exit code ${result.exitCode}`;
|
|
|
87196
87285
|
// src/tools/edit.js
|
|
87197
87286
|
function isPathAllowed(filePath, allowedFolders) {
|
|
87198
87287
|
if (!allowedFolders || allowedFolders.length === 0) {
|
|
87199
|
-
const resolvedPath3 = (0,
|
|
87200
|
-
const cwd = (0,
|
|
87201
|
-
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);
|
|
87202
87291
|
}
|
|
87203
|
-
const resolvedPath2 = (0,
|
|
87292
|
+
const resolvedPath2 = (0, import_path11.resolve)(filePath);
|
|
87204
87293
|
return allowedFolders.some((folder) => {
|
|
87205
|
-
const allowedPath = (0,
|
|
87206
|
-
return resolvedPath2 === allowedPath || resolvedPath2.startsWith(allowedPath +
|
|
87294
|
+
const allowedPath = (0, import_path11.resolve)(folder);
|
|
87295
|
+
return resolvedPath2 === allowedPath || resolvedPath2.startsWith(allowedPath + import_path11.sep);
|
|
87207
87296
|
});
|
|
87208
87297
|
}
|
|
87209
87298
|
function parseFileToolOptions(options = {}) {
|
|
87210
87299
|
return {
|
|
87211
87300
|
debug: options.debug || false,
|
|
87212
87301
|
allowedFolders: options.allowedFolders || [],
|
|
87213
|
-
|
|
87302
|
+
cwd: options.cwd
|
|
87214
87303
|
};
|
|
87215
87304
|
}
|
|
87216
|
-
var import_ai5,
|
|
87305
|
+
var import_ai5, import_fs10, import_path11, import_fs11, editTool, createTool, editSchema, createSchema, editDescription, createDescription, editToolDefinition, createToolDefinition;
|
|
87217
87306
|
var init_edit = __esm({
|
|
87218
87307
|
"src/tools/edit.js"() {
|
|
87219
87308
|
"use strict";
|
|
87220
87309
|
import_ai5 = require("ai");
|
|
87221
|
-
import_fs9 = require("fs");
|
|
87222
|
-
import_path10 = require("path");
|
|
87223
87310
|
import_fs10 = require("fs");
|
|
87311
|
+
import_path11 = require("path");
|
|
87312
|
+
import_fs11 = require("fs");
|
|
87224
87313
|
editTool = (options = {}) => {
|
|
87225
|
-
const { debug, allowedFolders,
|
|
87314
|
+
const { debug, allowedFolders, cwd } = parseFileToolOptions(options);
|
|
87226
87315
|
return (0, import_ai5.tool)({
|
|
87227
87316
|
name: "edit",
|
|
87228
87317
|
description: `Edit files using exact string replacement (Claude Code style).
|
|
@@ -87273,17 +87362,17 @@ Important:
|
|
|
87273
87362
|
if (new_string === void 0 || new_string === null || typeof new_string !== "string") {
|
|
87274
87363
|
return `Error editing file: Invalid new_string - must be a string`;
|
|
87275
87364
|
}
|
|
87276
|
-
const resolvedPath2 = (0,
|
|
87365
|
+
const resolvedPath2 = (0, import_path11.isAbsolute)(file_path) ? file_path : (0, import_path11.resolve)(cwd || process.cwd(), file_path);
|
|
87277
87366
|
if (debug) {
|
|
87278
87367
|
console.error(`[Edit] Attempting to edit file: ${resolvedPath2}`);
|
|
87279
87368
|
}
|
|
87280
87369
|
if (!isPathAllowed(resolvedPath2, allowedFolders)) {
|
|
87281
87370
|
return `Error editing file: Permission denied - ${file_path} is outside allowed directories`;
|
|
87282
87371
|
}
|
|
87283
|
-
if (!(0,
|
|
87372
|
+
if (!(0, import_fs11.existsSync)(resolvedPath2)) {
|
|
87284
87373
|
return `Error editing file: File not found - ${file_path}`;
|
|
87285
87374
|
}
|
|
87286
|
-
const content = await
|
|
87375
|
+
const content = await import_fs10.promises.readFile(resolvedPath2, "utf-8");
|
|
87287
87376
|
if (!content.includes(old_string)) {
|
|
87288
87377
|
return `Error editing file: String not found - the specified old_string was not found in ${file_path}`;
|
|
87289
87378
|
}
|
|
@@ -87300,7 +87389,7 @@ Important:
|
|
|
87300
87389
|
if (newContent === content) {
|
|
87301
87390
|
return `Error editing file: No changes made - old_string and new_string might be the same`;
|
|
87302
87391
|
}
|
|
87303
|
-
await
|
|
87392
|
+
await import_fs10.promises.writeFile(resolvedPath2, newContent, "utf-8");
|
|
87304
87393
|
const replacedCount = replace_all ? occurrences : 1;
|
|
87305
87394
|
if (debug) {
|
|
87306
87395
|
console.error(`[Edit] Successfully edited ${resolvedPath2}, replaced ${replacedCount} occurrence(s)`);
|
|
@@ -87314,7 +87403,7 @@ Important:
|
|
|
87314
87403
|
});
|
|
87315
87404
|
};
|
|
87316
87405
|
createTool = (options = {}) => {
|
|
87317
|
-
const { debug, allowedFolders,
|
|
87406
|
+
const { debug, allowedFolders, cwd } = parseFileToolOptions(options);
|
|
87318
87407
|
return (0, import_ai5.tool)({
|
|
87319
87408
|
name: "create",
|
|
87320
87409
|
description: `Create new files with specified content.
|
|
@@ -87357,20 +87446,20 @@ Important:
|
|
|
87357
87446
|
if (content === void 0 || content === null || typeof content !== "string") {
|
|
87358
87447
|
return `Error creating file: Invalid content - must be a string`;
|
|
87359
87448
|
}
|
|
87360
|
-
const resolvedPath2 = (0,
|
|
87449
|
+
const resolvedPath2 = (0, import_path11.isAbsolute)(file_path) ? file_path : (0, import_path11.resolve)(cwd || process.cwd(), file_path);
|
|
87361
87450
|
if (debug) {
|
|
87362
87451
|
console.error(`[Create] Attempting to create file: ${resolvedPath2}`);
|
|
87363
87452
|
}
|
|
87364
87453
|
if (!isPathAllowed(resolvedPath2, allowedFolders)) {
|
|
87365
87454
|
return `Error creating file: Permission denied - ${file_path} is outside allowed directories`;
|
|
87366
87455
|
}
|
|
87367
|
-
if ((0,
|
|
87456
|
+
if ((0, import_fs11.existsSync)(resolvedPath2) && !overwrite) {
|
|
87368
87457
|
return `Error creating file: File already exists - ${file_path}. Use overwrite: true to replace it.`;
|
|
87369
87458
|
}
|
|
87370
|
-
const dir = (0,
|
|
87371
|
-
await
|
|
87372
|
-
await
|
|
87373
|
-
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";
|
|
87374
87463
|
const bytes = Buffer.byteLength(content, "utf-8");
|
|
87375
87464
|
if (debug) {
|
|
87376
87465
|
console.error(`[Create] Successfully ${action} ${resolvedPath2}`);
|
|
@@ -87511,16 +87600,19 @@ This is a new project.</content>
|
|
|
87511
87600
|
});
|
|
87512
87601
|
|
|
87513
87602
|
// src/tools/langchain.js
|
|
87514
|
-
function createSearchTool() {
|
|
87603
|
+
function createSearchTool(options = {}) {
|
|
87604
|
+
const { cwd } = options;
|
|
87515
87605
|
return {
|
|
87516
87606
|
name: "search",
|
|
87517
87607
|
description: searchDescription,
|
|
87518
87608
|
schema: searchSchema,
|
|
87519
|
-
func: async ({ query: searchQuery, path:
|
|
87609
|
+
func: async ({ query: searchQuery, path: path9, allow_tests, exact, maxResults, maxTokens = 1e4, language }) => {
|
|
87520
87610
|
try {
|
|
87521
87611
|
const results = await search({
|
|
87522
87612
|
query: searchQuery,
|
|
87523
|
-
path:
|
|
87613
|
+
path: path9,
|
|
87614
|
+
cwd,
|
|
87615
|
+
// Working directory for resolving relative paths
|
|
87524
87616
|
allow_tests,
|
|
87525
87617
|
exact,
|
|
87526
87618
|
json: false,
|
|
@@ -87536,16 +87628,19 @@ function createSearchTool() {
|
|
|
87536
87628
|
}
|
|
87537
87629
|
};
|
|
87538
87630
|
}
|
|
87539
|
-
function createQueryTool() {
|
|
87631
|
+
function createQueryTool(options = {}) {
|
|
87632
|
+
const { cwd } = options;
|
|
87540
87633
|
return {
|
|
87541
87634
|
name: "query",
|
|
87542
87635
|
description: queryDescription,
|
|
87543
87636
|
schema: querySchema,
|
|
87544
|
-
func: async ({ pattern, path:
|
|
87637
|
+
func: async ({ pattern, path: path9, language, allow_tests }) => {
|
|
87545
87638
|
try {
|
|
87546
87639
|
const results = await query({
|
|
87547
87640
|
pattern,
|
|
87548
|
-
path:
|
|
87641
|
+
path: path9,
|
|
87642
|
+
cwd,
|
|
87643
|
+
// Working directory for resolving relative paths
|
|
87549
87644
|
language,
|
|
87550
87645
|
allow_tests,
|
|
87551
87646
|
json: false
|
|
@@ -87558,7 +87653,8 @@ function createQueryTool() {
|
|
|
87558
87653
|
}
|
|
87559
87654
|
};
|
|
87560
87655
|
}
|
|
87561
|
-
function createExtractTool() {
|
|
87656
|
+
function createExtractTool(options = {}) {
|
|
87657
|
+
const { cwd } = options;
|
|
87562
87658
|
return {
|
|
87563
87659
|
name: "extract",
|
|
87564
87660
|
description: extractDescription,
|
|
@@ -87568,6 +87664,8 @@ function createExtractTool() {
|
|
|
87568
87664
|
const files = parseTargets(targets);
|
|
87569
87665
|
const results = await extract({
|
|
87570
87666
|
files,
|
|
87667
|
+
cwd,
|
|
87668
|
+
// Working directory for resolving relative paths
|
|
87571
87669
|
allowTests: allow_tests,
|
|
87572
87670
|
contextLines: context_lines,
|
|
87573
87671
|
format: format2
|
|
@@ -87786,10 +87884,10 @@ async function listFilesByLevel(options) {
|
|
|
87786
87884
|
maxFiles = 100,
|
|
87787
87885
|
respectGitignore = true
|
|
87788
87886
|
} = options;
|
|
87789
|
-
if (!
|
|
87887
|
+
if (!import_fs12.default.existsSync(directory)) {
|
|
87790
87888
|
throw new Error(`Directory does not exist: ${directory}`);
|
|
87791
87889
|
}
|
|
87792
|
-
const gitDirExists =
|
|
87890
|
+
const gitDirExists = import_fs12.default.existsSync(import_path12.default.join(directory, ".git"));
|
|
87793
87891
|
if (gitDirExists && respectGitignore) {
|
|
87794
87892
|
try {
|
|
87795
87893
|
return await listFilesUsingGit(directory, maxFiles);
|
|
@@ -87804,8 +87902,8 @@ async function listFilesUsingGit(directory, maxFiles) {
|
|
|
87804
87902
|
const { stdout } = await execAsync3("git ls-files", { cwd: directory });
|
|
87805
87903
|
const files = stdout.split("\n").filter(Boolean);
|
|
87806
87904
|
const sortedFiles = files.sort((a4, b4) => {
|
|
87807
|
-
const depthA = a4.split(
|
|
87808
|
-
const depthB = b4.split(
|
|
87905
|
+
const depthA = a4.split(import_path12.default.sep).length;
|
|
87906
|
+
const depthB = b4.split(import_path12.default.sep).length;
|
|
87809
87907
|
return depthA - depthB;
|
|
87810
87908
|
});
|
|
87811
87909
|
return sortedFiles.slice(0, maxFiles);
|
|
@@ -87820,25 +87918,25 @@ async function listFilesByLevelManually(directory, maxFiles, respectGitignore) {
|
|
|
87820
87918
|
while (queue.length > 0 && result.length < maxFiles) {
|
|
87821
87919
|
const { dir, level } = queue.shift();
|
|
87822
87920
|
try {
|
|
87823
|
-
const entries =
|
|
87921
|
+
const entries = import_fs12.default.readdirSync(dir, { withFileTypes: true });
|
|
87824
87922
|
const files = entries.filter((entry) => {
|
|
87825
|
-
const fullPath =
|
|
87923
|
+
const fullPath = import_path12.default.join(dir, entry.name);
|
|
87826
87924
|
return getEntryTypeSync(entry, fullPath).isFile;
|
|
87827
87925
|
});
|
|
87828
87926
|
for (const file of files) {
|
|
87829
87927
|
if (result.length >= maxFiles) break;
|
|
87830
|
-
const filePath =
|
|
87831
|
-
const relativePath =
|
|
87928
|
+
const filePath = import_path12.default.join(dir, file.name);
|
|
87929
|
+
const relativePath = import_path12.default.relative(directory, filePath);
|
|
87832
87930
|
if (shouldIgnore(relativePath, ignorePatterns)) continue;
|
|
87833
87931
|
result.push(relativePath);
|
|
87834
87932
|
}
|
|
87835
87933
|
const dirs = entries.filter((entry) => {
|
|
87836
|
-
const fullPath =
|
|
87934
|
+
const fullPath = import_path12.default.join(dir, entry.name);
|
|
87837
87935
|
return getEntryTypeSync(entry, fullPath).isDirectory;
|
|
87838
87936
|
});
|
|
87839
87937
|
for (const subdir of dirs) {
|
|
87840
|
-
const subdirPath =
|
|
87841
|
-
const relativeSubdirPath =
|
|
87938
|
+
const subdirPath = import_path12.default.join(dir, subdir.name);
|
|
87939
|
+
const relativeSubdirPath = import_path12.default.relative(directory, subdirPath);
|
|
87842
87940
|
if (shouldIgnore(relativeSubdirPath, ignorePatterns)) continue;
|
|
87843
87941
|
if (subdir.name === "node_modules" || subdir.name === ".git") continue;
|
|
87844
87942
|
queue.push({ dir: subdirPath, level: level + 1 });
|
|
@@ -87850,12 +87948,12 @@ async function listFilesByLevelManually(directory, maxFiles, respectGitignore) {
|
|
|
87850
87948
|
return result;
|
|
87851
87949
|
}
|
|
87852
87950
|
function loadGitignorePatterns(directory) {
|
|
87853
|
-
const gitignorePath =
|
|
87854
|
-
if (!
|
|
87951
|
+
const gitignorePath = import_path12.default.join(directory, ".gitignore");
|
|
87952
|
+
if (!import_fs12.default.existsSync(gitignorePath)) {
|
|
87855
87953
|
return [];
|
|
87856
87954
|
}
|
|
87857
87955
|
try {
|
|
87858
|
-
const content =
|
|
87956
|
+
const content = import_fs12.default.readFileSync(gitignorePath, "utf8");
|
|
87859
87957
|
return content.split("\n").map((line) => line.trim()).filter((line) => line && !line.startsWith("#"));
|
|
87860
87958
|
} catch (error2) {
|
|
87861
87959
|
console.error(`Warning: Could not read .gitignore: ${error2.message}`);
|
|
@@ -87873,12 +87971,12 @@ function shouldIgnore(filePath, ignorePatterns) {
|
|
|
87873
87971
|
}
|
|
87874
87972
|
return false;
|
|
87875
87973
|
}
|
|
87876
|
-
var
|
|
87974
|
+
var import_fs12, import_path12, import_util12, import_child_process10, execAsync3;
|
|
87877
87975
|
var init_file_lister = __esm({
|
|
87878
87976
|
"src/utils/file-lister.js"() {
|
|
87879
87977
|
"use strict";
|
|
87880
|
-
|
|
87881
|
-
|
|
87978
|
+
import_fs12 = __toESM(require("fs"), 1);
|
|
87979
|
+
import_path12 = __toESM(require("path"), 1);
|
|
87882
87980
|
import_util12 = require("util");
|
|
87883
87981
|
import_child_process10 = require("child_process");
|
|
87884
87982
|
init_symlink_utils();
|
|
@@ -87896,12 +87994,12 @@ function initializeSimpleTelemetryFromOptions(options) {
|
|
|
87896
87994
|
});
|
|
87897
87995
|
return telemetry;
|
|
87898
87996
|
}
|
|
87899
|
-
var
|
|
87997
|
+
var import_fs13, import_path13, SimpleTelemetry, SimpleAppTracer;
|
|
87900
87998
|
var init_simpleTelemetry = __esm({
|
|
87901
87999
|
"src/agent/simpleTelemetry.js"() {
|
|
87902
88000
|
"use strict";
|
|
87903
|
-
|
|
87904
|
-
|
|
88001
|
+
import_fs13 = require("fs");
|
|
88002
|
+
import_path13 = require("path");
|
|
87905
88003
|
SimpleTelemetry = class {
|
|
87906
88004
|
constructor(options = {}) {
|
|
87907
88005
|
this.serviceName = options.serviceName || "probe-agent";
|
|
@@ -87915,11 +88013,11 @@ var init_simpleTelemetry = __esm({
|
|
|
87915
88013
|
}
|
|
87916
88014
|
initializeFileExporter() {
|
|
87917
88015
|
try {
|
|
87918
|
-
const dir = (0,
|
|
87919
|
-
if (!(0,
|
|
87920
|
-
(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 });
|
|
87921
88019
|
}
|
|
87922
|
-
this.stream = (0,
|
|
88020
|
+
this.stream = (0, import_fs13.createWriteStream)(this.filePath, { flags: "a" });
|
|
87923
88021
|
this.stream.on("error", (error2) => {
|
|
87924
88022
|
console.error(`[SimpleTelemetry] Stream error: ${error2.message}`);
|
|
87925
88023
|
});
|