@probelabs/probe 0.6.0-rc196 → 0.6.0-rc198
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/bin/binaries/{probe-v0.6.0-rc196-aarch64-apple-darwin.tar.gz → probe-v0.6.0-rc198-aarch64-apple-darwin.tar.gz} +0 -0
- package/bin/binaries/probe-v0.6.0-rc198-aarch64-unknown-linux-musl.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc198-x86_64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc198-x86_64-pc-windows-msvc.zip +0 -0
- package/bin/binaries/probe-v0.6.0-rc198-x86_64-unknown-linux-musl.tar.gz +0 -0
- package/build/agent/ProbeAgent.js +6 -2
- package/build/agent/index.js +132 -97
- package/build/tools/bash.js +9 -3
- package/build/tools/common.js +71 -4
- package/build/tools/index.js +4 -2
- package/build/tools/vercel.js +28 -19
- package/cjs/agent/ProbeAgent.cjs +324 -250
- package/cjs/index.cjs +329 -253
- package/package.json +1 -1
- package/src/agent/ProbeAgent.js +6 -2
- package/src/tools/bash.js +9 -3
- package/src/tools/common.js +71 -4
- package/src/tools/index.js +4 -2
- package/src/tools/vercel.js +28 -19
- package/bin/binaries/probe-v0.6.0-rc196-aarch64-unknown-linux-musl.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc196-x86_64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc196-x86_64-pc-windows-msvc.zip +0 -0
- package/bin/binaries/probe-v0.6.0-rc196-x86_64-unknown-linux-musl.tar.gz +0 -0
package/build/agent/index.js
CHANGED
|
@@ -2375,7 +2375,7 @@ async function waitForFileLock(lockPath, binaryPath) {
|
|
|
2375
2375
|
}
|
|
2376
2376
|
} catch {
|
|
2377
2377
|
}
|
|
2378
|
-
await new Promise((
|
|
2378
|
+
await new Promise((resolve7) => setTimeout(resolve7, LOCK_POLL_INTERVAL_MS));
|
|
2379
2379
|
}
|
|
2380
2380
|
if (process.env.DEBUG === "1" || process.env.VERBOSE === "1") {
|
|
2381
2381
|
console.log(`Timeout waiting for file lock`);
|
|
@@ -3386,7 +3386,7 @@ Cwd: ${cwd}`;
|
|
|
3386
3386
|
}
|
|
3387
3387
|
}
|
|
3388
3388
|
function extractWithStdin(binaryPath, cliArgs, content, options, cwd) {
|
|
3389
|
-
return new Promise((
|
|
3389
|
+
return new Promise((resolve7, reject2) => {
|
|
3390
3390
|
const childProcess = spawn(binaryPath, ["extract", ...cliArgs], {
|
|
3391
3391
|
stdio: ["pipe", "pipe", "pipe"],
|
|
3392
3392
|
cwd
|
|
@@ -3409,7 +3409,7 @@ function extractWithStdin(binaryPath, cliArgs, content, options, cwd) {
|
|
|
3409
3409
|
}
|
|
3410
3410
|
try {
|
|
3411
3411
|
const result = processExtractOutput(stdout, options);
|
|
3412
|
-
|
|
3412
|
+
resolve7(result);
|
|
3413
3413
|
} catch (error) {
|
|
3414
3414
|
reject2(error);
|
|
3415
3415
|
}
|
|
@@ -7870,6 +7870,7 @@ var init_zod = __esm({
|
|
|
7870
7870
|
});
|
|
7871
7871
|
|
|
7872
7872
|
// src/tools/common.js
|
|
7873
|
+
import { resolve, isAbsolute } from "path";
|
|
7873
7874
|
function getValidParamsForTool(toolName) {
|
|
7874
7875
|
const schemaMap = {
|
|
7875
7876
|
search: searchSchema,
|
|
@@ -7982,7 +7983,37 @@ function parseTargets(targets) {
|
|
|
7982
7983
|
if (!targets || typeof targets !== "string") {
|
|
7983
7984
|
return [];
|
|
7984
7985
|
}
|
|
7985
|
-
return targets.split(
|
|
7986
|
+
return targets.split(/[\s,]+/).filter((f) => f.length > 0);
|
|
7987
|
+
}
|
|
7988
|
+
function parseAndResolvePaths(pathStr, cwd) {
|
|
7989
|
+
if (!pathStr) return [];
|
|
7990
|
+
const paths = pathStr.split(",").map((p) => p.trim()).filter((p) => p.length > 0);
|
|
7991
|
+
return paths.map((p) => {
|
|
7992
|
+
if (isAbsolute(p)) {
|
|
7993
|
+
return p;
|
|
7994
|
+
}
|
|
7995
|
+
return cwd ? resolve(cwd, p) : p;
|
|
7996
|
+
});
|
|
7997
|
+
}
|
|
7998
|
+
function resolveTargetPath(target, cwd) {
|
|
7999
|
+
const searchStart = target.length > 2 && target[1] === ":" && /[a-zA-Z]/.test(target[0]) ? 2 : 0;
|
|
8000
|
+
const colonIdx = target.indexOf(":", searchStart);
|
|
8001
|
+
const hashIdx = target.indexOf("#");
|
|
8002
|
+
let filePart, suffix;
|
|
8003
|
+
if (colonIdx !== -1 && (hashIdx === -1 || colonIdx < hashIdx)) {
|
|
8004
|
+
filePart = target.substring(0, colonIdx);
|
|
8005
|
+
suffix = target.substring(colonIdx);
|
|
8006
|
+
} else if (hashIdx !== -1) {
|
|
8007
|
+
filePart = target.substring(0, hashIdx);
|
|
8008
|
+
suffix = target.substring(hashIdx);
|
|
8009
|
+
} else {
|
|
8010
|
+
filePart = target;
|
|
8011
|
+
suffix = "";
|
|
8012
|
+
}
|
|
8013
|
+
if (!isAbsolute(filePart) && cwd) {
|
|
8014
|
+
filePart = resolve(cwd, filePart);
|
|
8015
|
+
}
|
|
8016
|
+
return filePart + suffix;
|
|
7986
8017
|
}
|
|
7987
8018
|
var searchSchema, querySchema, extractSchema, delegateSchema, bashSchema, attemptCompletionSchema, searchToolDefinition, queryToolDefinition, extractToolDefinition, delegateToolDefinition, attemptCompletionToolDefinition, bashToolDefinition, searchDescription, queryDescription, extractDescription, delegateDescription, DEFAULT_VALID_TOOLS;
|
|
7988
8019
|
var init_common = __esm({
|
|
@@ -8314,13 +8345,14 @@ var init_vercel = __esm({
|
|
|
8314
8345
|
execute: async ({ query: searchQuery, path: path9, allow_tests, exact, maxTokens: paramMaxTokens, language }) => {
|
|
8315
8346
|
try {
|
|
8316
8347
|
const effectiveMaxTokens = paramMaxTokens || maxTokens;
|
|
8317
|
-
let
|
|
8318
|
-
if (
|
|
8319
|
-
|
|
8320
|
-
|
|
8321
|
-
|
|
8322
|
-
|
|
8348
|
+
let searchPaths;
|
|
8349
|
+
if (path9) {
|
|
8350
|
+
searchPaths = parseAndResolvePaths(path9, options.cwd);
|
|
8351
|
+
}
|
|
8352
|
+
if (!searchPaths || searchPaths.length === 0) {
|
|
8353
|
+
searchPaths = [options.cwd || "."];
|
|
8323
8354
|
}
|
|
8355
|
+
const searchPath = searchPaths.join(" ");
|
|
8324
8356
|
if (debug) {
|
|
8325
8357
|
console.error(`Executing search with query: "${searchQuery}", path: "${searchPath}", exact: ${exact ? "true" : "false"}, language: ${language || "all"}, session: ${sessionId || "none"}`);
|
|
8326
8358
|
}
|
|
@@ -8358,13 +8390,14 @@ var init_vercel = __esm({
|
|
|
8358
8390
|
inputSchema: querySchema,
|
|
8359
8391
|
execute: async ({ pattern, path: path9, language, allow_tests }) => {
|
|
8360
8392
|
try {
|
|
8361
|
-
let
|
|
8362
|
-
if (
|
|
8363
|
-
|
|
8364
|
-
|
|
8365
|
-
|
|
8366
|
-
|
|
8393
|
+
let queryPaths;
|
|
8394
|
+
if (path9) {
|
|
8395
|
+
queryPaths = parseAndResolvePaths(path9, options.cwd);
|
|
8396
|
+
}
|
|
8397
|
+
if (!queryPaths || queryPaths.length === 0) {
|
|
8398
|
+
queryPaths = [options.cwd || "."];
|
|
8367
8399
|
}
|
|
8400
|
+
const queryPath = queryPaths.join(" ");
|
|
8368
8401
|
if (debug) {
|
|
8369
8402
|
console.error(`Executing query with pattern: "${pattern}", path: "${queryPath}", language: ${language || "auto"}`);
|
|
8370
8403
|
}
|
|
@@ -8425,7 +8458,8 @@ var init_vercel = __esm({
|
|
|
8425
8458
|
format: effectiveFormat
|
|
8426
8459
|
};
|
|
8427
8460
|
} else if (targets) {
|
|
8428
|
-
const
|
|
8461
|
+
const parsedTargets = parseTargets(targets);
|
|
8462
|
+
const files = parsedTargets.map((target) => resolveTargetPath(target, effectiveCwd));
|
|
8429
8463
|
let effectiveFormat = format;
|
|
8430
8464
|
if (outline && format === "outline-xml") {
|
|
8431
8465
|
effectiveFormat = "xml";
|
|
@@ -9434,7 +9468,7 @@ var init_bashPermissions = __esm({
|
|
|
9434
9468
|
|
|
9435
9469
|
// src/agent/bashExecutor.js
|
|
9436
9470
|
import { spawn as spawn2 } from "child_process";
|
|
9437
|
-
import { resolve, join } from "path";
|
|
9471
|
+
import { resolve as resolve2, join } from "path";
|
|
9438
9472
|
import { existsSync } from "fs";
|
|
9439
9473
|
async function executeBashCommand(command, options = {}) {
|
|
9440
9474
|
const {
|
|
@@ -9448,7 +9482,7 @@ async function executeBashCommand(command, options = {}) {
|
|
|
9448
9482
|
} = options;
|
|
9449
9483
|
let cwd = workingDirectory;
|
|
9450
9484
|
try {
|
|
9451
|
-
cwd =
|
|
9485
|
+
cwd = resolve2(cwd);
|
|
9452
9486
|
if (!existsSync(cwd)) {
|
|
9453
9487
|
throw new Error(`Working directory does not exist: ${cwd}`);
|
|
9454
9488
|
}
|
|
@@ -9470,7 +9504,7 @@ async function executeBashCommand(command, options = {}) {
|
|
|
9470
9504
|
console.log(`[BashExecutor] Working directory: "${cwd}"`);
|
|
9471
9505
|
console.log(`[BashExecutor] Timeout: ${timeout}ms`);
|
|
9472
9506
|
}
|
|
9473
|
-
return new Promise((
|
|
9507
|
+
return new Promise((resolve7, reject2) => {
|
|
9474
9508
|
const processEnv = {
|
|
9475
9509
|
...process.env,
|
|
9476
9510
|
...env
|
|
@@ -9487,7 +9521,7 @@ async function executeBashCommand(command, options = {}) {
|
|
|
9487
9521
|
} else {
|
|
9488
9522
|
const args = parseCommandForExecution(command);
|
|
9489
9523
|
if (!args || args.length === 0) {
|
|
9490
|
-
|
|
9524
|
+
resolve7({
|
|
9491
9525
|
success: false,
|
|
9492
9526
|
error: "Failed to parse command",
|
|
9493
9527
|
stdout: "",
|
|
@@ -9572,7 +9606,7 @@ async function executeBashCommand(command, options = {}) {
|
|
|
9572
9606
|
success = false;
|
|
9573
9607
|
error = `Command exited with code ${code}`;
|
|
9574
9608
|
}
|
|
9575
|
-
|
|
9609
|
+
resolve7({
|
|
9576
9610
|
success,
|
|
9577
9611
|
error,
|
|
9578
9612
|
stdout: stdout.trim(),
|
|
@@ -9592,7 +9626,7 @@ async function executeBashCommand(command, options = {}) {
|
|
|
9592
9626
|
if (debug) {
|
|
9593
9627
|
console.log(`[BashExecutor] Spawn error:`, error);
|
|
9594
9628
|
}
|
|
9595
|
-
|
|
9629
|
+
resolve7({
|
|
9596
9630
|
success: false,
|
|
9597
9631
|
error: `Failed to execute command: ${error.message}`,
|
|
9598
9632
|
stdout: "",
|
|
@@ -9695,7 +9729,7 @@ var init_bashExecutor = __esm({
|
|
|
9695
9729
|
|
|
9696
9730
|
// src/tools/bash.js
|
|
9697
9731
|
import { tool as tool2 } from "ai";
|
|
9698
|
-
import { resolve as
|
|
9732
|
+
import { resolve as resolve3, isAbsolute as isAbsolute2, sep } from "path";
|
|
9699
9733
|
var bashTool;
|
|
9700
9734
|
var init_bash = __esm({
|
|
9701
9735
|
"src/tools/bash.js"() {
|
|
@@ -9807,12 +9841,13 @@ For code exploration, try these safe alternatives:
|
|
|
9807
9841
|
- git status, git log, git show for git operations
|
|
9808
9842
|
- npm list, pip list for package information`;
|
|
9809
9843
|
}
|
|
9810
|
-
const
|
|
9844
|
+
const defaultDir = getDefaultWorkingDirectory();
|
|
9845
|
+
const workingDir = workingDirectory ? isAbsolute2(workingDirectory) ? resolve3(workingDirectory) : resolve3(defaultDir, workingDirectory) : defaultDir;
|
|
9811
9846
|
if (allowedFolders && allowedFolders.length > 0) {
|
|
9812
|
-
const resolvedWorkingDir =
|
|
9847
|
+
const resolvedWorkingDir = resolve3(workingDir);
|
|
9813
9848
|
const isAllowed = allowedFolders.some((folder) => {
|
|
9814
|
-
const resolvedFolder =
|
|
9815
|
-
return resolvedWorkingDir.startsWith(resolvedFolder);
|
|
9849
|
+
const resolvedFolder = resolve3(folder);
|
|
9850
|
+
return resolvedWorkingDir === resolvedFolder || resolvedWorkingDir.startsWith(resolvedFolder + sep);
|
|
9816
9851
|
});
|
|
9817
9852
|
if (!isAllowed) {
|
|
9818
9853
|
return `Error: Working directory "${workingDir}" is not within allowed folders: ${allowedFolders.join(", ")}`;
|
|
@@ -9867,18 +9902,18 @@ Command failed with exit code ${result.exitCode}`;
|
|
|
9867
9902
|
// src/tools/edit.js
|
|
9868
9903
|
import { tool as tool3 } from "ai";
|
|
9869
9904
|
import { promises as fs6 } from "fs";
|
|
9870
|
-
import { dirname, resolve as
|
|
9905
|
+
import { dirname, resolve as resolve4, isAbsolute as isAbsolute3, sep as sep2 } from "path";
|
|
9871
9906
|
import { existsSync as existsSync2 } from "fs";
|
|
9872
9907
|
function isPathAllowed(filePath, allowedFolders) {
|
|
9873
9908
|
if (!allowedFolders || allowedFolders.length === 0) {
|
|
9874
|
-
const resolvedPath2 =
|
|
9875
|
-
const cwd =
|
|
9876
|
-
return resolvedPath2 === cwd || resolvedPath2.startsWith(cwd +
|
|
9909
|
+
const resolvedPath2 = resolve4(filePath);
|
|
9910
|
+
const cwd = resolve4(process.cwd());
|
|
9911
|
+
return resolvedPath2 === cwd || resolvedPath2.startsWith(cwd + sep2);
|
|
9877
9912
|
}
|
|
9878
|
-
const resolvedPath =
|
|
9913
|
+
const resolvedPath = resolve4(filePath);
|
|
9879
9914
|
return allowedFolders.some((folder) => {
|
|
9880
|
-
const allowedPath =
|
|
9881
|
-
return resolvedPath === allowedPath || resolvedPath.startsWith(allowedPath +
|
|
9915
|
+
const allowedPath = resolve4(folder);
|
|
9916
|
+
return resolvedPath === allowedPath || resolvedPath.startsWith(allowedPath + sep2);
|
|
9882
9917
|
});
|
|
9883
9918
|
}
|
|
9884
9919
|
function parseFileToolOptions(options = {}) {
|
|
@@ -9944,7 +9979,7 @@ Important:
|
|
|
9944
9979
|
if (new_string === void 0 || new_string === null || typeof new_string !== "string") {
|
|
9945
9980
|
return `Error editing file: Invalid new_string - must be a string`;
|
|
9946
9981
|
}
|
|
9947
|
-
const resolvedPath =
|
|
9982
|
+
const resolvedPath = isAbsolute3(file_path) ? file_path : resolve4(cwd || process.cwd(), file_path);
|
|
9948
9983
|
if (debug) {
|
|
9949
9984
|
console.error(`[Edit] Attempting to edit file: ${resolvedPath}`);
|
|
9950
9985
|
}
|
|
@@ -10028,7 +10063,7 @@ Important:
|
|
|
10028
10063
|
if (content === void 0 || content === null || typeof content !== "string") {
|
|
10029
10064
|
return `Error creating file: Invalid content - must be a string`;
|
|
10030
10065
|
}
|
|
10031
|
-
const resolvedPath =
|
|
10066
|
+
const resolvedPath = isAbsolute3(file_path) ? file_path : resolve4(cwd || process.cwd(), file_path);
|
|
10032
10067
|
if (debug) {
|
|
10033
10068
|
console.error(`[Create] Attempting to create file: ${resolvedPath}`);
|
|
10034
10069
|
}
|
|
@@ -10510,20 +10545,20 @@ var init_simpleTelemetry = __esm({
|
|
|
10510
10545
|
}
|
|
10511
10546
|
async flush() {
|
|
10512
10547
|
if (this.stream) {
|
|
10513
|
-
return new Promise((
|
|
10514
|
-
this.stream.once("drain",
|
|
10548
|
+
return new Promise((resolve7) => {
|
|
10549
|
+
this.stream.once("drain", resolve7);
|
|
10515
10550
|
if (!this.stream.writableNeedDrain) {
|
|
10516
|
-
|
|
10551
|
+
resolve7();
|
|
10517
10552
|
}
|
|
10518
10553
|
});
|
|
10519
10554
|
}
|
|
10520
10555
|
}
|
|
10521
10556
|
async shutdown() {
|
|
10522
10557
|
if (this.stream) {
|
|
10523
|
-
return new Promise((
|
|
10558
|
+
return new Promise((resolve7) => {
|
|
10524
10559
|
this.stream.end(() => {
|
|
10525
10560
|
console.log(`[SimpleTelemetry] File stream closed: ${this.filePath}`);
|
|
10526
|
-
|
|
10561
|
+
resolve7();
|
|
10527
10562
|
});
|
|
10528
10563
|
});
|
|
10529
10564
|
}
|
|
@@ -11497,7 +11532,7 @@ var init_escape = __esm({
|
|
|
11497
11532
|
});
|
|
11498
11533
|
|
|
11499
11534
|
// node_modules/minimatch/dist/esm/index.js
|
|
11500
|
-
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, path6,
|
|
11535
|
+
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, path6, sep3, GLOBSTAR, qmark2, star2, twoStarDot, twoStarNoDot, filter, ext, defaults, braceExpand, makeRe, match, globMagic, regExpEscape2, Minimatch;
|
|
11501
11536
|
var init_esm = __esm({
|
|
11502
11537
|
"node_modules/minimatch/dist/esm/index.js"() {
|
|
11503
11538
|
import_brace_expansion = __toESM(require_brace_expansion(), 1);
|
|
@@ -11570,8 +11605,8 @@ var init_esm = __esm({
|
|
|
11570
11605
|
win32: { sep: "\\" },
|
|
11571
11606
|
posix: { sep: "/" }
|
|
11572
11607
|
};
|
|
11573
|
-
|
|
11574
|
-
minimatch.sep =
|
|
11608
|
+
sep3 = defaultPlatform === "win32" ? path6.win32.sep : path6.posix.sep;
|
|
11609
|
+
minimatch.sep = sep3;
|
|
11575
11610
|
GLOBSTAR = Symbol("globstar **");
|
|
11576
11611
|
minimatch.GLOBSTAR = GLOBSTAR;
|
|
11577
11612
|
qmark2 = "[^/]";
|
|
@@ -14333,10 +14368,10 @@ var init_esm3 = __esm({
|
|
|
14333
14368
|
* Return a void Promise that resolves once the stream ends.
|
|
14334
14369
|
*/
|
|
14335
14370
|
async promise() {
|
|
14336
|
-
return new Promise((
|
|
14371
|
+
return new Promise((resolve7, reject2) => {
|
|
14337
14372
|
this.on(DESTROYED, () => reject2(new Error("stream destroyed")));
|
|
14338
14373
|
this.on("error", (er) => reject2(er));
|
|
14339
|
-
this.on("end", () =>
|
|
14374
|
+
this.on("end", () => resolve7());
|
|
14340
14375
|
});
|
|
14341
14376
|
}
|
|
14342
14377
|
/**
|
|
@@ -14360,7 +14395,7 @@ var init_esm3 = __esm({
|
|
|
14360
14395
|
return Promise.resolve({ done: false, value: res });
|
|
14361
14396
|
if (this[EOF])
|
|
14362
14397
|
return stop();
|
|
14363
|
-
let
|
|
14398
|
+
let resolve7;
|
|
14364
14399
|
let reject2;
|
|
14365
14400
|
const onerr = (er) => {
|
|
14366
14401
|
this.off("data", ondata);
|
|
@@ -14374,19 +14409,19 @@ var init_esm3 = __esm({
|
|
|
14374
14409
|
this.off("end", onend);
|
|
14375
14410
|
this.off(DESTROYED, ondestroy);
|
|
14376
14411
|
this.pause();
|
|
14377
|
-
|
|
14412
|
+
resolve7({ value, done: !!this[EOF] });
|
|
14378
14413
|
};
|
|
14379
14414
|
const onend = () => {
|
|
14380
14415
|
this.off("error", onerr);
|
|
14381
14416
|
this.off("data", ondata);
|
|
14382
14417
|
this.off(DESTROYED, ondestroy);
|
|
14383
14418
|
stop();
|
|
14384
|
-
|
|
14419
|
+
resolve7({ done: true, value: void 0 });
|
|
14385
14420
|
};
|
|
14386
14421
|
const ondestroy = () => onerr(new Error("stream destroyed"));
|
|
14387
14422
|
return new Promise((res2, rej) => {
|
|
14388
14423
|
reject2 = rej;
|
|
14389
|
-
|
|
14424
|
+
resolve7 = res2;
|
|
14390
14425
|
this.once(DESTROYED, ondestroy);
|
|
14391
14426
|
this.once("error", onerr);
|
|
14392
14427
|
this.once("end", onend);
|
|
@@ -15366,9 +15401,9 @@ var init_esm4 = __esm({
|
|
|
15366
15401
|
if (this.#asyncReaddirInFlight) {
|
|
15367
15402
|
await this.#asyncReaddirInFlight;
|
|
15368
15403
|
} else {
|
|
15369
|
-
let
|
|
15404
|
+
let resolve7 = () => {
|
|
15370
15405
|
};
|
|
15371
|
-
this.#asyncReaddirInFlight = new Promise((res) =>
|
|
15406
|
+
this.#asyncReaddirInFlight = new Promise((res) => resolve7 = res);
|
|
15372
15407
|
try {
|
|
15373
15408
|
for (const e of await this.#fs.promises.readdir(fullpath, {
|
|
15374
15409
|
withFileTypes: true
|
|
@@ -15381,7 +15416,7 @@ var init_esm4 = __esm({
|
|
|
15381
15416
|
children.provisional = 0;
|
|
15382
15417
|
}
|
|
15383
15418
|
this.#asyncReaddirInFlight = void 0;
|
|
15384
|
-
|
|
15419
|
+
resolve7();
|
|
15385
15420
|
}
|
|
15386
15421
|
return children.slice(0, children.provisional);
|
|
15387
15422
|
}
|
|
@@ -15611,7 +15646,7 @@ var init_esm4 = __esm({
|
|
|
15611
15646
|
*
|
|
15612
15647
|
* @internal
|
|
15613
15648
|
*/
|
|
15614
|
-
constructor(cwd = process.cwd(), pathImpl,
|
|
15649
|
+
constructor(cwd = process.cwd(), pathImpl, sep5, { nocase, childrenCacheSize = 16 * 1024, fs: fs10 = defaultFS } = {}) {
|
|
15615
15650
|
this.#fs = fsFromOption(fs10);
|
|
15616
15651
|
if (cwd instanceof URL || cwd.startsWith("file://")) {
|
|
15617
15652
|
cwd = fileURLToPath4(cwd);
|
|
@@ -15622,7 +15657,7 @@ var init_esm4 = __esm({
|
|
|
15622
15657
|
this.#resolveCache = new ResolveCache();
|
|
15623
15658
|
this.#resolvePosixCache = new ResolveCache();
|
|
15624
15659
|
this.#children = new ChildrenCache(childrenCacheSize);
|
|
15625
|
-
const split = cwdPath.substring(this.rootPath.length).split(
|
|
15660
|
+
const split = cwdPath.substring(this.rootPath.length).split(sep5);
|
|
15626
15661
|
if (split.length === 1 && !split[0]) {
|
|
15627
15662
|
split.pop();
|
|
15628
15663
|
}
|
|
@@ -17929,7 +17964,7 @@ function createMockProvider() {
|
|
|
17929
17964
|
provider: "mock",
|
|
17930
17965
|
// Mock the doGenerate method used by Vercel AI SDK
|
|
17931
17966
|
doGenerate: async ({ messages, tools: tools2 }) => {
|
|
17932
|
-
await new Promise((
|
|
17967
|
+
await new Promise((resolve7) => setTimeout(resolve7, 10));
|
|
17933
17968
|
return {
|
|
17934
17969
|
text: "This is a mock response for testing",
|
|
17935
17970
|
toolCalls: [],
|
|
@@ -43684,7 +43719,7 @@ var require_bk = __commonJS({
|
|
|
43684
43719
|
return xs;
|
|
43685
43720
|
}
|
|
43686
43721
|
function buildBlockGraph(g, layering, root2, reverseSep) {
|
|
43687
|
-
var blockGraph = new Graph(), graphLabel = g.graph(), sepFn =
|
|
43722
|
+
var blockGraph = new Graph(), graphLabel = g.graph(), sepFn = sep5(graphLabel.nodesep, graphLabel.edgesep, reverseSep);
|
|
43688
43723
|
_.forEach(layering, function(layer) {
|
|
43689
43724
|
var u;
|
|
43690
43725
|
_.forEach(layer, function(v) {
|
|
@@ -43774,7 +43809,7 @@ var require_bk = __commonJS({
|
|
|
43774
43809
|
alignCoordinates(xss, smallestWidth);
|
|
43775
43810
|
return balance(xss, g.graph().align);
|
|
43776
43811
|
}
|
|
43777
|
-
function
|
|
43812
|
+
function sep5(nodeSep, edgeSep, reverseSep) {
|
|
43778
43813
|
return function(g, v, w) {
|
|
43779
43814
|
var vLabel = g.node(v);
|
|
43780
43815
|
var wLabel = g.node(w);
|
|
@@ -51068,7 +51103,7 @@ var require_compile = __commonJS({
|
|
|
51068
51103
|
const schOrFunc = root2.refs[ref];
|
|
51069
51104
|
if (schOrFunc)
|
|
51070
51105
|
return schOrFunc;
|
|
51071
|
-
let _sch =
|
|
51106
|
+
let _sch = resolve7.call(this, root2, ref);
|
|
51072
51107
|
if (_sch === void 0) {
|
|
51073
51108
|
const schema = (_a = root2.localRefs) === null || _a === void 0 ? void 0 : _a[ref];
|
|
51074
51109
|
const { schemaId } = this.opts;
|
|
@@ -51095,7 +51130,7 @@ var require_compile = __commonJS({
|
|
|
51095
51130
|
function sameSchemaEnv(s1, s2) {
|
|
51096
51131
|
return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
|
|
51097
51132
|
}
|
|
51098
|
-
function
|
|
51133
|
+
function resolve7(root2, ref) {
|
|
51099
51134
|
let sch;
|
|
51100
51135
|
while (typeof (sch = this.refs[ref]) == "string")
|
|
51101
51136
|
ref = sch;
|
|
@@ -51670,7 +51705,7 @@ var require_fast_uri = __commonJS({
|
|
|
51670
51705
|
}
|
|
51671
51706
|
return uri;
|
|
51672
51707
|
}
|
|
51673
|
-
function
|
|
51708
|
+
function resolve7(baseURI, relativeURI, options) {
|
|
51674
51709
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
51675
51710
|
const resolved = resolveComponent(parse6(baseURI, schemelessOptions), parse6(relativeURI, schemelessOptions), schemelessOptions, true);
|
|
51676
51711
|
schemelessOptions.skipEscape = true;
|
|
@@ -51897,7 +51932,7 @@ var require_fast_uri = __commonJS({
|
|
|
51897
51932
|
var fastUri = {
|
|
51898
51933
|
SCHEMES,
|
|
51899
51934
|
normalize: normalize3,
|
|
51900
|
-
resolve:
|
|
51935
|
+
resolve: resolve7,
|
|
51901
51936
|
resolveComponent,
|
|
51902
51937
|
equal,
|
|
51903
51938
|
serialize,
|
|
@@ -57008,7 +57043,7 @@ function extractErrorInfo(error) {
|
|
|
57008
57043
|
};
|
|
57009
57044
|
}
|
|
57010
57045
|
function sleep(ms) {
|
|
57011
|
-
return new Promise((
|
|
57046
|
+
return new Promise((resolve7) => setTimeout(resolve7, ms));
|
|
57012
57047
|
}
|
|
57013
57048
|
var DEFAULT_RETRYABLE_ERRORS, RetryManager;
|
|
57014
57049
|
var init_RetryManager = __esm({
|
|
@@ -57846,7 +57881,7 @@ var init_built_in_server = __esm({
|
|
|
57846
57881
|
}
|
|
57847
57882
|
});
|
|
57848
57883
|
this.registerHandlers();
|
|
57849
|
-
return new Promise((
|
|
57884
|
+
return new Promise((resolve7, reject2) => {
|
|
57850
57885
|
this.httpServer.listen(this.port, this.host, async () => {
|
|
57851
57886
|
const address = this.httpServer.address();
|
|
57852
57887
|
this.port = address.port;
|
|
@@ -57856,7 +57891,7 @@ var init_built_in_server = __esm({
|
|
|
57856
57891
|
console.log(`[MCP] Messages endpoint: http://${this.host}:${this.port}/messages`);
|
|
57857
57892
|
}
|
|
57858
57893
|
this.emit("ready", { host: this.host, port: this.port });
|
|
57859
|
-
|
|
57894
|
+
resolve7({ host: this.host, port: this.port });
|
|
57860
57895
|
});
|
|
57861
57896
|
this.httpServer.on("error", reject2);
|
|
57862
57897
|
});
|
|
@@ -58075,7 +58110,7 @@ var init_built_in_server = __esm({
|
|
|
58075
58110
|
* Parse request body as JSON
|
|
58076
58111
|
*/
|
|
58077
58112
|
async parseRequestBody(req) {
|
|
58078
|
-
return new Promise((
|
|
58113
|
+
return new Promise((resolve7, reject2) => {
|
|
58079
58114
|
let body = "";
|
|
58080
58115
|
req.on("data", (chunk) => {
|
|
58081
58116
|
body += chunk.toString();
|
|
@@ -58083,7 +58118,7 @@ var init_built_in_server = __esm({
|
|
|
58083
58118
|
req.on("end", () => {
|
|
58084
58119
|
try {
|
|
58085
58120
|
const parsed = body ? JSON.parse(body) : null;
|
|
58086
|
-
|
|
58121
|
+
resolve7(parsed);
|
|
58087
58122
|
} catch (error) {
|
|
58088
58123
|
reject2(error);
|
|
58089
58124
|
}
|
|
@@ -58390,12 +58425,12 @@ data: ${JSON.stringify(data)}
|
|
|
58390
58425
|
}
|
|
58391
58426
|
this.connections.clear();
|
|
58392
58427
|
if (this.httpServer) {
|
|
58393
|
-
return new Promise((
|
|
58428
|
+
return new Promise((resolve7) => {
|
|
58394
58429
|
this.httpServer.close(() => {
|
|
58395
58430
|
if (this.debug) {
|
|
58396
58431
|
console.log("[MCP] Built-in server stopped");
|
|
58397
58432
|
}
|
|
58398
|
-
|
|
58433
|
+
resolve7();
|
|
58399
58434
|
});
|
|
58400
58435
|
});
|
|
58401
58436
|
}
|
|
@@ -58674,8 +58709,8 @@ ${opts.schema}`;
|
|
|
58674
58709
|
break;
|
|
58675
58710
|
}
|
|
58676
58711
|
} else if (!processEnded) {
|
|
58677
|
-
await new Promise((
|
|
58678
|
-
resolver =
|
|
58712
|
+
await new Promise((resolve7) => {
|
|
58713
|
+
resolver = resolve7;
|
|
58679
58714
|
});
|
|
58680
58715
|
}
|
|
58681
58716
|
}
|
|
@@ -58935,12 +58970,12 @@ async function createCodexEngine(options = {}) {
|
|
|
58935
58970
|
}
|
|
58936
58971
|
}
|
|
58937
58972
|
if (message.id !== void 0 && pendingRequests.has(message.id)) {
|
|
58938
|
-
const { resolve:
|
|
58973
|
+
const { resolve: resolve7, reject: reject2 } = pendingRequests.get(message.id);
|
|
58939
58974
|
pendingRequests.delete(message.id);
|
|
58940
58975
|
if (message.error) {
|
|
58941
58976
|
reject2(new Error(message.error.message || JSON.stringify(message.error)));
|
|
58942
58977
|
} else {
|
|
58943
|
-
|
|
58978
|
+
resolve7(message.result);
|
|
58944
58979
|
}
|
|
58945
58980
|
}
|
|
58946
58981
|
if (message.method === "codex/event" && message.params) {
|
|
@@ -58961,7 +58996,7 @@ async function createCodexEngine(options = {}) {
|
|
|
58961
58996
|
});
|
|
58962
58997
|
}
|
|
58963
58998
|
function sendRequest(method, params = {}) {
|
|
58964
|
-
return new Promise((
|
|
58999
|
+
return new Promise((resolve7, reject2) => {
|
|
58965
59000
|
const id = ++requestId;
|
|
58966
59001
|
const request = {
|
|
58967
59002
|
jsonrpc: "2.0",
|
|
@@ -58969,7 +59004,7 @@ async function createCodexEngine(options = {}) {
|
|
|
58969
59004
|
method,
|
|
58970
59005
|
params
|
|
58971
59006
|
};
|
|
58972
|
-
pendingRequests.set(id, { resolve:
|
|
59007
|
+
pendingRequests.set(id, { resolve: resolve7, reject: reject2 });
|
|
58973
59008
|
setTimeout(() => {
|
|
58974
59009
|
if (pendingRequests.has(id)) {
|
|
58975
59010
|
pendingRequests.delete(id);
|
|
@@ -59032,7 +59067,7 @@ ${prompt}`;
|
|
|
59032
59067
|
const reqId = requestId + 1;
|
|
59033
59068
|
let fullResponse = "";
|
|
59034
59069
|
let gotSessionId = false;
|
|
59035
|
-
const eventPromise = new Promise((
|
|
59070
|
+
const eventPromise = new Promise((resolve7) => {
|
|
59036
59071
|
eventHandlers.set(reqId, (eventParams) => {
|
|
59037
59072
|
const msg = eventParams.msg;
|
|
59038
59073
|
if (msg.type === "session_configured" && msg.session_id && !gotSessionId) {
|
|
@@ -59052,7 +59087,7 @@ ${prompt}`;
|
|
|
59052
59087
|
});
|
|
59053
59088
|
setTimeout(() => {
|
|
59054
59089
|
eventHandlers.delete(reqId);
|
|
59055
|
-
|
|
59090
|
+
resolve7();
|
|
59056
59091
|
}, 6e5);
|
|
59057
59092
|
});
|
|
59058
59093
|
const resultPromise = sendRequest("tools/call", {
|
|
@@ -59239,7 +59274,7 @@ import { randomUUID as randomUUID5 } from "crypto";
|
|
|
59239
59274
|
import { EventEmitter as EventEmitter5 } from "events";
|
|
59240
59275
|
import { existsSync as existsSync5 } from "fs";
|
|
59241
59276
|
import { readFile, stat } from "fs/promises";
|
|
59242
|
-
import { resolve as
|
|
59277
|
+
import { resolve as resolve5, isAbsolute as isAbsolute4, dirname as dirname4, basename, normalize as normalize2, sep as sep4 } from "path";
|
|
59243
59278
|
var MAX_TOOL_ITERATIONS, MAX_HISTORY_MESSAGES, MAX_IMAGE_FILE_SIZE, ProbeAgent;
|
|
59244
59279
|
var init_ProbeAgent = __esm({
|
|
59245
59280
|
"src/agent/ProbeAgent.js"() {
|
|
@@ -60125,7 +60160,7 @@ var init_ProbeAgent = __esm({
|
|
|
60125
60160
|
let resolvedPath = imagePath;
|
|
60126
60161
|
if (!imagePath.includes("/") && !imagePath.includes("\\")) {
|
|
60127
60162
|
for (const dir of listFilesDirectories) {
|
|
60128
|
-
const potentialPath =
|
|
60163
|
+
const potentialPath = resolve5(dir, imagePath);
|
|
60129
60164
|
const loaded = await this.loadImageIfValid(potentialPath);
|
|
60130
60165
|
if (loaded) {
|
|
60131
60166
|
if (this.debug) {
|
|
@@ -60195,17 +60230,17 @@ var init_ProbeAgent = __esm({
|
|
|
60195
60230
|
const allowedDirs = this.allowedFolders && this.allowedFolders.length > 0 ? this.allowedFolders : [process.cwd()];
|
|
60196
60231
|
let absolutePath;
|
|
60197
60232
|
let isPathAllowed2 = false;
|
|
60198
|
-
if (
|
|
60199
|
-
absolutePath = normalize2(
|
|
60233
|
+
if (isAbsolute4(imagePath)) {
|
|
60234
|
+
absolutePath = normalize2(resolve5(imagePath));
|
|
60200
60235
|
isPathAllowed2 = allowedDirs.some((dir) => {
|
|
60201
|
-
const normalizedDir = normalize2(
|
|
60202
|
-
return absolutePath === normalizedDir || absolutePath.startsWith(normalizedDir +
|
|
60236
|
+
const normalizedDir = normalize2(resolve5(dir));
|
|
60237
|
+
return absolutePath === normalizedDir || absolutePath.startsWith(normalizedDir + sep4);
|
|
60203
60238
|
});
|
|
60204
60239
|
} else {
|
|
60205
60240
|
for (const dir of allowedDirs) {
|
|
60206
|
-
const normalizedDir = normalize2(
|
|
60207
|
-
const resolvedPath = normalize2(
|
|
60208
|
-
if (resolvedPath === normalizedDir || resolvedPath.startsWith(normalizedDir +
|
|
60241
|
+
const normalizedDir = normalize2(resolve5(dir));
|
|
60242
|
+
const resolvedPath = normalize2(resolve5(dir, imagePath));
|
|
60243
|
+
if (resolvedPath === normalizedDir || resolvedPath.startsWith(normalizedDir + sep4)) {
|
|
60209
60244
|
absolutePath = resolvedPath;
|
|
60210
60245
|
isPathAllowed2 = true;
|
|
60211
60246
|
break;
|
|
@@ -61135,12 +61170,12 @@ ${toolResultContent}
|
|
|
61135
61170
|
}
|
|
61136
61171
|
} else if (this.toolImplementations[toolName]) {
|
|
61137
61172
|
try {
|
|
61138
|
-
let resolvedWorkingDirectory = this.allowedFolders && this.allowedFolders[0] || process.cwd();
|
|
61173
|
+
let resolvedWorkingDirectory = this.cwd || this.allowedFolders && this.allowedFolders[0] || process.cwd();
|
|
61139
61174
|
if (params.workingDirectory) {
|
|
61140
|
-
const requestedDir =
|
|
61175
|
+
const requestedDir = isAbsolute4(params.workingDirectory) ? resolve5(params.workingDirectory) : resolve5(resolvedWorkingDirectory, params.workingDirectory);
|
|
61141
61176
|
const isWithinAllowed = !this.allowedFolders || this.allowedFolders.length === 0 || this.allowedFolders.some((folder) => {
|
|
61142
|
-
const resolvedFolder =
|
|
61143
|
-
return requestedDir === resolvedFolder || requestedDir.startsWith(resolvedFolder +
|
|
61177
|
+
const resolvedFolder = resolve5(folder);
|
|
61178
|
+
return requestedDir === resolvedFolder || requestedDir.startsWith(resolvedFolder + sep4);
|
|
61144
61179
|
});
|
|
61145
61180
|
if (isWithinAllowed) {
|
|
61146
61181
|
resolvedWorkingDirectory = requestedDir;
|
|
@@ -62054,7 +62089,7 @@ import {
|
|
|
62054
62089
|
McpError
|
|
62055
62090
|
} from "@modelcontextprotocol/sdk/types.js";
|
|
62056
62091
|
import { readFileSync as readFileSync2, existsSync as existsSync6 } from "fs";
|
|
62057
|
-
import { resolve as
|
|
62092
|
+
import { resolve as resolve6 } from "path";
|
|
62058
62093
|
|
|
62059
62094
|
// src/agent/acp/server.js
|
|
62060
62095
|
import { randomUUID as randomUUID6 } from "crypto";
|
|
@@ -62313,8 +62348,8 @@ var ACPConnection = class extends EventEmitter6 {
|
|
|
62313
62348
|
if (params !== null) {
|
|
62314
62349
|
message.params = params;
|
|
62315
62350
|
}
|
|
62316
|
-
return new Promise((
|
|
62317
|
-
this.pendingRequests.set(id, { resolve:
|
|
62351
|
+
return new Promise((resolve7, reject2) => {
|
|
62352
|
+
this.pendingRequests.set(id, { resolve: resolve7, reject: reject2 });
|
|
62318
62353
|
this.sendMessage(message);
|
|
62319
62354
|
setTimeout(() => {
|
|
62320
62355
|
if (this.pendingRequests.has(id)) {
|
|
@@ -62728,7 +62763,7 @@ dotenv3.config();
|
|
|
62728
62763
|
function readInputContent(input) {
|
|
62729
62764
|
if (!input) return null;
|
|
62730
62765
|
try {
|
|
62731
|
-
const resolvedPath =
|
|
62766
|
+
const resolvedPath = resolve6(input);
|
|
62732
62767
|
if (existsSync6(resolvedPath)) {
|
|
62733
62768
|
return readFileSync2(resolvedPath, "utf-8").trim();
|
|
62734
62769
|
}
|
|
@@ -62737,7 +62772,7 @@ function readInputContent(input) {
|
|
|
62737
62772
|
return input;
|
|
62738
62773
|
}
|
|
62739
62774
|
function readFromStdin() {
|
|
62740
|
-
return new Promise((
|
|
62775
|
+
return new Promise((resolve7, reject2) => {
|
|
62741
62776
|
let data = "";
|
|
62742
62777
|
let hasReceivedData = false;
|
|
62743
62778
|
let dataChunks = [];
|
|
@@ -62762,7 +62797,7 @@ function readFromStdin() {
|
|
|
62762
62797
|
if (!trimmed && dataChunks.length === 0) {
|
|
62763
62798
|
reject2(new Error("No input received from stdin"));
|
|
62764
62799
|
} else {
|
|
62765
|
-
|
|
62800
|
+
resolve7(trimmed);
|
|
62766
62801
|
}
|
|
62767
62802
|
});
|
|
62768
62803
|
process.stdin.on("error", (error) => {
|