@probelabs/probe 0.6.0-rc299 → 0.6.0-rc301
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-rc299-aarch64-apple-darwin.tar.gz → probe-v0.6.0-rc301-aarch64-apple-darwin.tar.gz} +0 -0
- package/bin/binaries/{probe-v0.6.0-rc299-aarch64-unknown-linux-musl.tar.gz → probe-v0.6.0-rc301-aarch64-unknown-linux-musl.tar.gz} +0 -0
- package/bin/binaries/{probe-v0.6.0-rc299-x86_64-apple-darwin.tar.gz → probe-v0.6.0-rc301-x86_64-apple-darwin.tar.gz} +0 -0
- package/bin/binaries/{probe-v0.6.0-rc299-x86_64-pc-windows-msvc.zip → probe-v0.6.0-rc301-x86_64-pc-windows-msvc.zip} +0 -0
- package/bin/binaries/{probe-v0.6.0-rc299-x86_64-unknown-linux-musl.tar.gz → probe-v0.6.0-rc301-x86_64-unknown-linux-musl.tar.gz} +0 -0
- package/build/agent/ProbeAgent.js +16 -3
- package/build/agent/simpleTelemetry.js +25 -3
- package/build/tools/vercel.js +10 -1
- package/cjs/agent/ProbeAgent.cjs +187 -159
- package/cjs/agent/simpleTelemetry.cjs +19 -3
- package/cjs/index.cjs +932 -898
- package/package.json +1 -1
- package/src/agent/ProbeAgent.js +16 -3
- package/src/agent/simpleTelemetry.js +25 -3
- package/src/tools/vercel.js +10 -1
package/cjs/agent/ProbeAgent.cjs
CHANGED
|
@@ -24013,6 +24013,35 @@ var init_tokenCounter = __esm({
|
|
|
24013
24013
|
}
|
|
24014
24014
|
});
|
|
24015
24015
|
|
|
24016
|
+
// src/agent/otelLogBridge.js
|
|
24017
|
+
var import_module, _require;
|
|
24018
|
+
var init_otelLogBridge = __esm({
|
|
24019
|
+
"src/agent/otelLogBridge.js"() {
|
|
24020
|
+
"use strict";
|
|
24021
|
+
import_module = require("module");
|
|
24022
|
+
_require = (0, import_module.createRequire)("file:///");
|
|
24023
|
+
}
|
|
24024
|
+
});
|
|
24025
|
+
|
|
24026
|
+
// src/agent/simpleTelemetry.js
|
|
24027
|
+
function truncateForSpan(text, maxLen = 4096) {
|
|
24028
|
+
if (!text || text.length <= maxLen) return text || "";
|
|
24029
|
+
const half = Math.floor((maxLen - 40) / 2);
|
|
24030
|
+
const omitted = text.length - half * 2;
|
|
24031
|
+
return text.substring(0, half) + `
|
|
24032
|
+
... [${omitted} chars omitted] ...
|
|
24033
|
+
` + text.substring(text.length - half);
|
|
24034
|
+
}
|
|
24035
|
+
var import_fs, import_path;
|
|
24036
|
+
var init_simpleTelemetry = __esm({
|
|
24037
|
+
"src/agent/simpleTelemetry.js"() {
|
|
24038
|
+
"use strict";
|
|
24039
|
+
import_fs = require("fs");
|
|
24040
|
+
import_path = require("path");
|
|
24041
|
+
init_otelLogBridge();
|
|
24042
|
+
}
|
|
24043
|
+
});
|
|
24044
|
+
|
|
24016
24045
|
// src/agent/storage/StorageAdapter.js
|
|
24017
24046
|
var StorageAdapter;
|
|
24018
24047
|
var init_StorageAdapter = __esm({
|
|
@@ -24286,7 +24315,7 @@ async function getPackageBinDir() {
|
|
|
24286
24315
|
}
|
|
24287
24316
|
const binaryPath = process.env.PROBE_BINARY_PATH;
|
|
24288
24317
|
if (await import_fs_extra.default.pathExists(binaryPath)) {
|
|
24289
|
-
const binDir =
|
|
24318
|
+
const binDir = import_path2.default.dirname(binaryPath);
|
|
24290
24319
|
if (await canWriteToDirectory(binDir)) {
|
|
24291
24320
|
if (debug) {
|
|
24292
24321
|
console.log(`DEBUG: Using PROBE_BINARY_PATH directory: ${binDir}`);
|
|
@@ -24301,7 +24330,7 @@ async function getPackageBinDir() {
|
|
|
24301
24330
|
if (debug) {
|
|
24302
24331
|
console.log(`DEBUG: Checking PROBE_CACHE_DIR: ${process.env.PROBE_CACHE_DIR}`);
|
|
24303
24332
|
}
|
|
24304
|
-
const cacheDir =
|
|
24333
|
+
const cacheDir = import_path2.default.join(process.env.PROBE_CACHE_DIR, "bin");
|
|
24305
24334
|
if (await ensureDirectory(cacheDir)) {
|
|
24306
24335
|
if (debug) {
|
|
24307
24336
|
console.log(`DEBUG: Using PROBE_CACHE_DIR: ${cacheDir}`);
|
|
@@ -24314,7 +24343,7 @@ async function getPackageBinDir() {
|
|
|
24314
24343
|
if (debug) {
|
|
24315
24344
|
console.log(`DEBUG: Found package root: ${packageRoot}`);
|
|
24316
24345
|
}
|
|
24317
|
-
const packageBinDir =
|
|
24346
|
+
const packageBinDir = import_path2.default.join(packageRoot, "bin");
|
|
24318
24347
|
if (await ensureDirectory(packageBinDir) && await canWriteToDirectory(packageBinDir)) {
|
|
24319
24348
|
if (debug) {
|
|
24320
24349
|
console.log(`DEBUG: Using package bin directory: ${packageBinDir}`);
|
|
@@ -24324,7 +24353,7 @@ async function getPackageBinDir() {
|
|
|
24324
24353
|
console.log(`DEBUG: Package bin directory ${packageBinDir} not writable, trying fallbacks`);
|
|
24325
24354
|
}
|
|
24326
24355
|
}
|
|
24327
|
-
const homeCache =
|
|
24356
|
+
const homeCache = import_path2.default.join(import_os.default.homedir(), ".probe", "bin");
|
|
24328
24357
|
if (debug) {
|
|
24329
24358
|
console.log(`DEBUG: Trying home cache directory: ${homeCache}`);
|
|
24330
24359
|
}
|
|
@@ -24334,7 +24363,7 @@ async function getPackageBinDir() {
|
|
|
24334
24363
|
}
|
|
24335
24364
|
return homeCache;
|
|
24336
24365
|
}
|
|
24337
|
-
const tempCache =
|
|
24366
|
+
const tempCache = import_path2.default.join(import_os.default.tmpdir(), "probe-cache", "bin");
|
|
24338
24367
|
if (debug) {
|
|
24339
24368
|
console.log(`DEBUG: Trying temp cache directory: ${tempCache}`);
|
|
24340
24369
|
}
|
|
@@ -24347,7 +24376,7 @@ async function getPackageBinDir() {
|
|
|
24347
24376
|
const errorMessage = [
|
|
24348
24377
|
"Could not find a writable directory for probe binary.",
|
|
24349
24378
|
"Tried the following locations:",
|
|
24350
|
-
packageRoot ? `- Package bin directory: ${
|
|
24379
|
+
packageRoot ? `- Package bin directory: ${import_path2.default.join(packageRoot, "bin")}` : "- Package root not found",
|
|
24351
24380
|
`- Home cache directory: ${homeCache}`,
|
|
24352
24381
|
`- Temp cache directory: ${tempCache}`,
|
|
24353
24382
|
"",
|
|
@@ -24360,12 +24389,12 @@ async function getPackageBinDir() {
|
|
|
24360
24389
|
async function findPackageRoot() {
|
|
24361
24390
|
const debug = process.env.DEBUG === "1" || process.env.VERBOSE === "1";
|
|
24362
24391
|
let currentDir = __dirname;
|
|
24363
|
-
const rootDir =
|
|
24392
|
+
const rootDir = import_path2.default.parse(currentDir).root;
|
|
24364
24393
|
if (debug) {
|
|
24365
24394
|
console.log(`DEBUG: Starting package root search from: ${currentDir}`);
|
|
24366
24395
|
}
|
|
24367
24396
|
while (currentDir !== rootDir) {
|
|
24368
|
-
const packageJsonPath =
|
|
24397
|
+
const packageJsonPath = import_path2.default.join(currentDir, "package.json");
|
|
24369
24398
|
try {
|
|
24370
24399
|
if (await import_fs_extra.default.pathExists(packageJsonPath)) {
|
|
24371
24400
|
const packageJson = await import_fs_extra.default.readJson(packageJsonPath);
|
|
@@ -24384,7 +24413,7 @@ async function findPackageRoot() {
|
|
|
24384
24413
|
console.log(`DEBUG: Error reading package.json at ${packageJsonPath}: ${err.message}`);
|
|
24385
24414
|
}
|
|
24386
24415
|
}
|
|
24387
|
-
currentDir =
|
|
24416
|
+
currentDir = import_path2.default.dirname(currentDir);
|
|
24388
24417
|
}
|
|
24389
24418
|
if (debug) {
|
|
24390
24419
|
console.log("DEBUG: Package root not found, reached filesystem root");
|
|
@@ -24395,7 +24424,7 @@ async function ensureDirectory(dirPath) {
|
|
|
24395
24424
|
const debug = process.env.DEBUG === "1" || process.env.VERBOSE === "1";
|
|
24396
24425
|
try {
|
|
24397
24426
|
await import_fs_extra.default.ensureDir(dirPath);
|
|
24398
|
-
const testFile =
|
|
24427
|
+
const testFile = import_path2.default.join(dirPath, ".probe-write-test");
|
|
24399
24428
|
await import_fs_extra.default.writeFile(testFile, "test");
|
|
24400
24429
|
await import_fs_extra.default.remove(testFile);
|
|
24401
24430
|
if (debug) {
|
|
@@ -24419,7 +24448,7 @@ async function canWriteToDirectory(dirPath) {
|
|
|
24419
24448
|
}
|
|
24420
24449
|
return false;
|
|
24421
24450
|
}
|
|
24422
|
-
const testFile =
|
|
24451
|
+
const testFile = import_path2.default.join(dirPath, ".probe-write-test");
|
|
24423
24452
|
await import_fs_extra.default.writeFile(testFile, "test");
|
|
24424
24453
|
await import_fs_extra.default.remove(testFile);
|
|
24425
24454
|
if (debug) {
|
|
@@ -24433,23 +24462,23 @@ async function canWriteToDirectory(dirPath) {
|
|
|
24433
24462
|
return false;
|
|
24434
24463
|
}
|
|
24435
24464
|
}
|
|
24436
|
-
var
|
|
24465
|
+
var import_path2, import_os, import_fs_extra, import_url, __filename, __dirname;
|
|
24437
24466
|
var init_directory_resolver = __esm({
|
|
24438
24467
|
"src/directory-resolver.js"() {
|
|
24439
24468
|
"use strict";
|
|
24440
|
-
|
|
24469
|
+
import_path2 = __toESM(require("path"), 1);
|
|
24441
24470
|
import_os = __toESM(require("os"), 1);
|
|
24442
24471
|
import_fs_extra = __toESM(require("fs-extra"), 1);
|
|
24443
24472
|
import_url = require("url");
|
|
24444
24473
|
__filename = (0, import_url.fileURLToPath)("file:///");
|
|
24445
|
-
__dirname =
|
|
24474
|
+
__dirname = import_path2.default.dirname(__filename);
|
|
24446
24475
|
}
|
|
24447
24476
|
});
|
|
24448
24477
|
|
|
24449
24478
|
// src/utils/symlink-utils.js
|
|
24450
24479
|
async function getEntryType(entry, fullPath) {
|
|
24451
24480
|
try {
|
|
24452
|
-
const stats = await
|
|
24481
|
+
const stats = await import_fs3.promises.stat(fullPath);
|
|
24453
24482
|
return {
|
|
24454
24483
|
isFile: stats.isFile(),
|
|
24455
24484
|
isDirectory: stats.isDirectory(),
|
|
@@ -24465,7 +24494,7 @@ async function getEntryType(entry, fullPath) {
|
|
|
24465
24494
|
}
|
|
24466
24495
|
function getEntryTypeSync(entry, fullPath) {
|
|
24467
24496
|
try {
|
|
24468
|
-
const stats =
|
|
24497
|
+
const stats = import_fs2.default.statSync(fullPath);
|
|
24469
24498
|
return {
|
|
24470
24499
|
isFile: stats.isFile(),
|
|
24471
24500
|
isDirectory: stats.isDirectory(),
|
|
@@ -24479,12 +24508,12 @@ function getEntryTypeSync(entry, fullPath) {
|
|
|
24479
24508
|
};
|
|
24480
24509
|
}
|
|
24481
24510
|
}
|
|
24482
|
-
var
|
|
24511
|
+
var import_fs2, import_fs3;
|
|
24483
24512
|
var init_symlink_utils = __esm({
|
|
24484
24513
|
"src/utils/symlink-utils.js"() {
|
|
24485
24514
|
"use strict";
|
|
24486
|
-
|
|
24487
|
-
|
|
24515
|
+
import_fs2 = __toESM(require("fs"), 1);
|
|
24516
|
+
import_fs3 = require("fs");
|
|
24488
24517
|
}
|
|
24489
24518
|
});
|
|
24490
24519
|
|
|
@@ -24913,7 +24942,7 @@ function findBestAsset(assets, osInfo, archInfo) {
|
|
|
24913
24942
|
}
|
|
24914
24943
|
async function downloadAsset(asset, outputDir) {
|
|
24915
24944
|
await import_fs_extra2.default.ensureDir(outputDir);
|
|
24916
|
-
const assetPath =
|
|
24945
|
+
const assetPath = import_path3.default.join(outputDir, asset.name);
|
|
24917
24946
|
if (process.env.DEBUG === "1" || process.env.VERBOSE === "1") {
|
|
24918
24947
|
console.log(`Downloading ${asset.name}...`);
|
|
24919
24948
|
}
|
|
@@ -24927,7 +24956,7 @@ async function downloadAsset(asset, outputDir) {
|
|
|
24927
24956
|
console.log(`Downloading checksum...`);
|
|
24928
24957
|
}
|
|
24929
24958
|
const checksumResponse = await import_axios.default.get(checksumUrl);
|
|
24930
|
-
checksumPath =
|
|
24959
|
+
checksumPath = import_path3.default.join(outputDir, checksumFileName);
|
|
24931
24960
|
await import_fs_extra2.default.writeFile(checksumPath, checksumResponse.data);
|
|
24932
24961
|
} catch (error40) {
|
|
24933
24962
|
if (process.env.DEBUG === "1" || process.env.VERBOSE === "1") {
|
|
@@ -24960,14 +24989,14 @@ async function verifyChecksum(assetPath, checksumPath) {
|
|
|
24960
24989
|
}
|
|
24961
24990
|
async function extractBinary(assetPath, outputDir) {
|
|
24962
24991
|
if (process.env.DEBUG === "1" || process.env.VERBOSE === "1") {
|
|
24963
|
-
console.log(`Extracting ${
|
|
24992
|
+
console.log(`Extracting ${import_path3.default.basename(assetPath)}...`);
|
|
24964
24993
|
}
|
|
24965
|
-
const assetName =
|
|
24994
|
+
const assetName = import_path3.default.basename(assetPath);
|
|
24966
24995
|
const isWindows = import_os2.default.platform() === "win32";
|
|
24967
24996
|
const binaryName = isWindows ? `${BINARY_NAME}.exe` : `${BINARY_NAME}-binary`;
|
|
24968
|
-
const binaryPath =
|
|
24997
|
+
const binaryPath = import_path3.default.join(outputDir, binaryName);
|
|
24969
24998
|
try {
|
|
24970
|
-
const extractDir =
|
|
24999
|
+
const extractDir = import_path3.default.join(outputDir, "temp_extract");
|
|
24971
25000
|
await import_fs_extra2.default.ensureDir(extractDir);
|
|
24972
25001
|
if (assetName.endsWith(".tar.gz") || assetName.endsWith(".tgz")) {
|
|
24973
25002
|
if (process.env.DEBUG === "1" || process.env.VERBOSE === "1") {
|
|
@@ -25006,7 +25035,7 @@ async function extractBinary(assetPath, outputDir) {
|
|
|
25006
25035
|
const findBinary = async (dir) => {
|
|
25007
25036
|
const entries = await import_fs_extra2.default.readdir(dir, { withFileTypes: true });
|
|
25008
25037
|
for (const entry of entries) {
|
|
25009
|
-
const fullPath =
|
|
25038
|
+
const fullPath = import_path3.default.join(dir, entry.name);
|
|
25010
25039
|
const entryType = await getEntryType(entry, fullPath);
|
|
25011
25040
|
if (entryType.isDirectory) {
|
|
25012
25041
|
const result = await findBinary(fullPath);
|
|
@@ -25045,7 +25074,7 @@ async function extractBinary(assetPath, outputDir) {
|
|
|
25045
25074
|
}
|
|
25046
25075
|
async function getVersionInfo(binDir) {
|
|
25047
25076
|
try {
|
|
25048
|
-
const versionInfoPath =
|
|
25077
|
+
const versionInfoPath = import_path3.default.join(binDir, "version-info.json");
|
|
25049
25078
|
if (await import_fs_extra2.default.pathExists(versionInfoPath)) {
|
|
25050
25079
|
const content = await import_fs_extra2.default.readFile(versionInfoPath, "utf-8");
|
|
25051
25080
|
return JSON.parse(content);
|
|
@@ -25061,7 +25090,7 @@ async function saveVersionInfo(version3, binDir) {
|
|
|
25061
25090
|
version: version3,
|
|
25062
25091
|
lastUpdated: (/* @__PURE__ */ new Date()).toISOString()
|
|
25063
25092
|
};
|
|
25064
|
-
const versionInfoPath =
|
|
25093
|
+
const versionInfoPath = import_path3.default.join(binDir, "version-info.json");
|
|
25065
25094
|
await import_fs_extra2.default.writeFile(versionInfoPath, JSON.stringify(versionInfo, null, 2));
|
|
25066
25095
|
if (process.env.DEBUG === "1" || process.env.VERBOSE === "1") {
|
|
25067
25096
|
console.log(`Version info saved: ${version3} at ${versionInfoPath}`);
|
|
@@ -25070,9 +25099,9 @@ async function saveVersionInfo(version3, binDir) {
|
|
|
25070
25099
|
async function getPackageVersion() {
|
|
25071
25100
|
try {
|
|
25072
25101
|
const possiblePaths = [
|
|
25073
|
-
|
|
25102
|
+
import_path3.default.resolve(__dirname2, "..", "package.json"),
|
|
25074
25103
|
// When installed from npm: src/../package.json
|
|
25075
|
-
|
|
25104
|
+
import_path3.default.resolve(__dirname2, "..", "..", "package.json")
|
|
25076
25105
|
// In development: src/../../package.json
|
|
25077
25106
|
];
|
|
25078
25107
|
for (const packageJsonPath of possiblePaths) {
|
|
@@ -25107,7 +25136,7 @@ async function doDownload(version3) {
|
|
|
25107
25136
|
}
|
|
25108
25137
|
const isWindows = import_os2.default.platform() === "win32";
|
|
25109
25138
|
const binaryName = isWindows ? `${BINARY_NAME}.exe` : `${BINARY_NAME}-binary`;
|
|
25110
|
-
const binaryPath =
|
|
25139
|
+
const binaryPath = import_path3.default.join(localDir, binaryName);
|
|
25111
25140
|
const { os: osInfo, arch: archInfo } = detectOsArch();
|
|
25112
25141
|
let versionToUse = version3;
|
|
25113
25142
|
let bestAsset;
|
|
@@ -25159,7 +25188,7 @@ async function downloadProbeBinary(version3) {
|
|
|
25159
25188
|
}
|
|
25160
25189
|
const isWindows = import_os2.default.platform() === "win32";
|
|
25161
25190
|
const binaryName = isWindows ? `${BINARY_NAME}.exe` : `${BINARY_NAME}-binary`;
|
|
25162
|
-
const binaryPath =
|
|
25191
|
+
const binaryPath = import_path3.default.join(localDir, binaryName);
|
|
25163
25192
|
if (await import_fs_extra2.default.pathExists(binaryPath)) {
|
|
25164
25193
|
const versionInfo = await getVersionInfo(localDir);
|
|
25165
25194
|
if (versionInfo && versionInfo.version === version3) {
|
|
@@ -25172,7 +25201,7 @@ async function downloadProbeBinary(version3) {
|
|
|
25172
25201
|
console.log(`Existing binary version (${versionInfo?.version || "unknown"}) doesn't match requested version (${version3}). Downloading new version...`);
|
|
25173
25202
|
}
|
|
25174
25203
|
}
|
|
25175
|
-
const lockPath =
|
|
25204
|
+
const lockPath = import_path3.default.join(localDir, `.probe-download-${version3}.lock`);
|
|
25176
25205
|
const maxRetries = 3;
|
|
25177
25206
|
for (let retry = 0; retry < maxRetries; retry++) {
|
|
25178
25207
|
const lockAcquired = await acquireFileLock(lockPath, version3);
|
|
@@ -25209,13 +25238,13 @@ async function downloadProbeBinary(version3) {
|
|
|
25209
25238
|
throw sanitizeError(error40);
|
|
25210
25239
|
}
|
|
25211
25240
|
}
|
|
25212
|
-
var import_axios, import_fs_extra2,
|
|
25241
|
+
var import_axios, import_fs_extra2, import_path3, import_crypto, import_util8, import_child_process, import_tar, import_os2, import_url2, exec, REPO_OWNER, REPO_NAME, BINARY_NAME, __filename2, __dirname2, downloadLocks, LOCK_TIMEOUT_MS, LOCK_POLL_INTERVAL_MS, MAX_LOCK_WAIT_MS;
|
|
25213
25242
|
var init_downloader = __esm({
|
|
25214
25243
|
"src/downloader.js"() {
|
|
25215
25244
|
"use strict";
|
|
25216
25245
|
import_axios = __toESM(require("axios"), 1);
|
|
25217
25246
|
import_fs_extra2 = __toESM(require("fs-extra"), 1);
|
|
25218
|
-
|
|
25247
|
+
import_path3 = __toESM(require("path"), 1);
|
|
25219
25248
|
import_crypto = require("crypto");
|
|
25220
25249
|
import_util8 = require("util");
|
|
25221
25250
|
import_child_process = require("child_process");
|
|
@@ -25230,7 +25259,7 @@ var init_downloader = __esm({
|
|
|
25230
25259
|
REPO_NAME = "probe";
|
|
25231
25260
|
BINARY_NAME = "probe";
|
|
25232
25261
|
__filename2 = (0, import_url2.fileURLToPath)("file:///");
|
|
25233
|
-
__dirname2 =
|
|
25262
|
+
__dirname2 = import_path3.default.dirname(__filename2);
|
|
25234
25263
|
downloadLocks = /* @__PURE__ */ new Map();
|
|
25235
25264
|
LOCK_TIMEOUT_MS = 5 * 60 * 1e3;
|
|
25236
25265
|
LOCK_POLL_INTERVAL_MS = 1e3;
|
|
@@ -25252,14 +25281,14 @@ async function getBinaryPath(options = {}) {
|
|
|
25252
25281
|
}
|
|
25253
25282
|
const isWindows = process.platform === "win32";
|
|
25254
25283
|
const binaryName = isWindows ? "probe.exe" : "probe-binary";
|
|
25255
|
-
const localPackageBin =
|
|
25256
|
-
const localBinaryPath =
|
|
25284
|
+
const localPackageBin = import_path4.default.resolve(__dirname3, "..", "bin");
|
|
25285
|
+
const localBinaryPath = import_path4.default.join(localPackageBin, binaryName);
|
|
25257
25286
|
if (import_fs_extra3.default.existsSync(localBinaryPath) && !forceDownload) {
|
|
25258
25287
|
probeBinaryPath = localBinaryPath;
|
|
25259
25288
|
return probeBinaryPath;
|
|
25260
25289
|
}
|
|
25261
25290
|
const binDir = await getPackageBinDir();
|
|
25262
|
-
const binaryPath =
|
|
25291
|
+
const binaryPath = import_path4.default.join(binDir, binaryName);
|
|
25263
25292
|
if (import_fs_extra3.default.existsSync(binaryPath) && !forceDownload) {
|
|
25264
25293
|
probeBinaryPath = binaryPath;
|
|
25265
25294
|
return probeBinaryPath;
|
|
@@ -25295,17 +25324,17 @@ function escapeString(str) {
|
|
|
25295
25324
|
return `'${str.replace(/'/g, "'\\''")}'`;
|
|
25296
25325
|
}
|
|
25297
25326
|
}
|
|
25298
|
-
var
|
|
25327
|
+
var import_path4, import_fs_extra3, import_url3, __filename3, __dirname3, probeBinaryPath;
|
|
25299
25328
|
var init_utils = __esm({
|
|
25300
25329
|
"src/utils.js"() {
|
|
25301
25330
|
"use strict";
|
|
25302
|
-
|
|
25331
|
+
import_path4 = __toESM(require("path"), 1);
|
|
25303
25332
|
import_fs_extra3 = __toESM(require("fs-extra"), 1);
|
|
25304
25333
|
import_url3 = require("url");
|
|
25305
25334
|
init_downloader();
|
|
25306
25335
|
init_directory_resolver();
|
|
25307
25336
|
__filename3 = (0, import_url3.fileURLToPath)("file:///");
|
|
25308
|
-
__dirname3 =
|
|
25337
|
+
__dirname3 = import_path4.default.dirname(__filename3);
|
|
25309
25338
|
probeBinaryPath = "";
|
|
25310
25339
|
}
|
|
25311
25340
|
});
|
|
@@ -25529,16 +25558,16 @@ var init_error_types = __esm({
|
|
|
25529
25558
|
// src/utils/path-validation.js
|
|
25530
25559
|
function safeRealpath(inputPath) {
|
|
25531
25560
|
try {
|
|
25532
|
-
return (0,
|
|
25561
|
+
return (0, import_fs4.realpathSync)(inputPath);
|
|
25533
25562
|
} catch (error40) {
|
|
25534
|
-
const normalized =
|
|
25535
|
-
const parts = normalized.split(
|
|
25563
|
+
const normalized = import_path5.default.normalize(inputPath);
|
|
25564
|
+
const parts = normalized.split(import_path5.default.sep);
|
|
25536
25565
|
for (let i = parts.length - 1; i >= 0; i--) {
|
|
25537
|
-
const ancestorPath = parts.slice(0, i).join(
|
|
25566
|
+
const ancestorPath = parts.slice(0, i).join(import_path5.default.sep) || import_path5.default.sep;
|
|
25538
25567
|
try {
|
|
25539
|
-
const resolvedAncestor = (0,
|
|
25568
|
+
const resolvedAncestor = (0, import_fs4.realpathSync)(ancestorPath);
|
|
25540
25569
|
const remainingParts = parts.slice(i);
|
|
25541
|
-
return
|
|
25570
|
+
return import_path5.default.join(resolvedAncestor, ...remainingParts);
|
|
25542
25571
|
} catch (ancestorError) {
|
|
25543
25572
|
continue;
|
|
25544
25573
|
}
|
|
@@ -25548,14 +25577,14 @@ function safeRealpath(inputPath) {
|
|
|
25548
25577
|
}
|
|
25549
25578
|
async function validateCwdPath(inputPath, defaultPath = process.cwd()) {
|
|
25550
25579
|
const targetPath = inputPath || defaultPath;
|
|
25551
|
-
const normalizedPath =
|
|
25580
|
+
const normalizedPath = import_path5.default.normalize(import_path5.default.resolve(targetPath));
|
|
25552
25581
|
try {
|
|
25553
|
-
const stats = await
|
|
25582
|
+
const stats = await import_fs4.promises.stat(normalizedPath);
|
|
25554
25583
|
if (!stats.isDirectory()) {
|
|
25555
25584
|
const resolvedPath = safeRealpath(normalizedPath);
|
|
25556
|
-
const dirPath =
|
|
25585
|
+
const dirPath = import_path5.default.dirname(resolvedPath);
|
|
25557
25586
|
try {
|
|
25558
|
-
const dirStats = await
|
|
25587
|
+
const dirStats = await import_fs4.promises.stat(dirPath);
|
|
25559
25588
|
if (dirStats.isDirectory()) {
|
|
25560
25589
|
return safeRealpath(dirPath);
|
|
25561
25590
|
}
|
|
@@ -25609,7 +25638,7 @@ function getCommonPrefix(folders) {
|
|
|
25609
25638
|
return safeRealpath(folders[0]);
|
|
25610
25639
|
}
|
|
25611
25640
|
const normalized = folders.map((f) => safeRealpath(f));
|
|
25612
|
-
const segments = normalized.map((f) => f.split(
|
|
25641
|
+
const segments = normalized.map((f) => f.split(import_path5.default.sep));
|
|
25613
25642
|
const minLen = Math.min(...segments.map((s) => s.length));
|
|
25614
25643
|
const commonSegments = [];
|
|
25615
25644
|
for (let i = 0; i < minLen; i++) {
|
|
@@ -25629,7 +25658,7 @@ function getCommonPrefix(folders) {
|
|
|
25629
25658
|
if (commonSegments.length === 1 && commonSegments[0] === "") {
|
|
25630
25659
|
return normalized[0];
|
|
25631
25660
|
}
|
|
25632
|
-
return commonSegments.join(
|
|
25661
|
+
return commonSegments.join(import_path5.default.sep);
|
|
25633
25662
|
}
|
|
25634
25663
|
function toRelativePath(absolutePath, workspaceRoot) {
|
|
25635
25664
|
if (!absolutePath || !workspaceRoot) {
|
|
@@ -25637,23 +25666,23 @@ function toRelativePath(absolutePath, workspaceRoot) {
|
|
|
25637
25666
|
}
|
|
25638
25667
|
let normalized = safeRealpath(absolutePath);
|
|
25639
25668
|
let normalizedRoot = safeRealpath(workspaceRoot);
|
|
25640
|
-
while (normalizedRoot.length > 1 && normalizedRoot.endsWith(
|
|
25669
|
+
while (normalizedRoot.length > 1 && normalizedRoot.endsWith(import_path5.default.sep)) {
|
|
25641
25670
|
normalizedRoot = normalizedRoot.slice(0, -1);
|
|
25642
25671
|
}
|
|
25643
25672
|
if (normalized === normalizedRoot) {
|
|
25644
25673
|
return ".";
|
|
25645
25674
|
}
|
|
25646
|
-
if (normalized.startsWith(normalizedRoot +
|
|
25647
|
-
return
|
|
25675
|
+
if (normalized.startsWith(normalizedRoot + import_path5.default.sep)) {
|
|
25676
|
+
return import_path5.default.relative(normalizedRoot, normalized);
|
|
25648
25677
|
}
|
|
25649
25678
|
return absolutePath;
|
|
25650
25679
|
}
|
|
25651
|
-
var
|
|
25680
|
+
var import_path5, import_fs4;
|
|
25652
25681
|
var init_path_validation = __esm({
|
|
25653
25682
|
"src/utils/path-validation.js"() {
|
|
25654
25683
|
"use strict";
|
|
25655
|
-
|
|
25656
|
-
|
|
25684
|
+
import_path5 = __toESM(require("path"), 1);
|
|
25685
|
+
import_fs4 = require("fs");
|
|
25657
25686
|
init_error_types();
|
|
25658
25687
|
}
|
|
25659
25688
|
});
|
|
@@ -27182,8 +27211,8 @@ function parseAndResolvePaths(pathStr, cwd) {
|
|
|
27182
27211
|
if (/["']/.test(pathStr)) {
|
|
27183
27212
|
const paths2 = splitQuotedString(pathStr);
|
|
27184
27213
|
return paths2.map((p) => {
|
|
27185
|
-
if ((0,
|
|
27186
|
-
return cwd ? (0,
|
|
27214
|
+
if ((0, import_path6.isAbsolute)(p)) return p;
|
|
27215
|
+
return cwd ? (0, import_path6.resolve)(cwd, p) : p;
|
|
27187
27216
|
});
|
|
27188
27217
|
}
|
|
27189
27218
|
let paths = pathStr.split(",").map((p) => p.trim()).filter((p) => p.length > 0);
|
|
@@ -27195,8 +27224,8 @@ function parseAndResolvePaths(pathStr, cwd) {
|
|
|
27195
27224
|
return allLookLikePaths ? parts : [p];
|
|
27196
27225
|
});
|
|
27197
27226
|
return paths.map((p) => {
|
|
27198
|
-
if ((0,
|
|
27199
|
-
return cwd ? (0,
|
|
27227
|
+
if ((0, import_path6.isAbsolute)(p)) return p;
|
|
27228
|
+
return cwd ? (0, import_path6.resolve)(cwd, p) : p;
|
|
27200
27229
|
});
|
|
27201
27230
|
}
|
|
27202
27231
|
function resolveTargetPath(target, cwd) {
|
|
@@ -27214,17 +27243,17 @@ function resolveTargetPath(target, cwd) {
|
|
|
27214
27243
|
filePart = target;
|
|
27215
27244
|
suffix = "";
|
|
27216
27245
|
}
|
|
27217
|
-
if (!(0,
|
|
27218
|
-
filePart = (0,
|
|
27246
|
+
if (!(0, import_path6.isAbsolute)(filePart) && cwd) {
|
|
27247
|
+
filePart = (0, import_path6.resolve)(cwd, filePart);
|
|
27219
27248
|
}
|
|
27220
27249
|
return filePart + suffix;
|
|
27221
27250
|
}
|
|
27222
|
-
var
|
|
27251
|
+
var import_path6, searchSchema, searchAllSchema, querySchema, extractSchema, delegateSchema, listSkillsSchema, useSkillSchema, listFilesSchema, searchFilesSchema, readImageSchema, bashSchema, analyzeAllSchema, executePlanSchema, cleanupExecutePlanSchema, searchDescription, searchDelegateDescription, queryDescription, extractDescription, delegateDescription, analyzeAllDescription;
|
|
27223
27252
|
var init_common = __esm({
|
|
27224
27253
|
"src/tools/common.js"() {
|
|
27225
27254
|
"use strict";
|
|
27226
27255
|
init_zod();
|
|
27227
|
-
|
|
27256
|
+
import_path6 = require("path");
|
|
27228
27257
|
searchSchema = external_exports2.object({
|
|
27229
27258
|
query: external_exports2.string().describe("Search query \u2014 natural language questions or Elasticsearch-style keywords both work. For keywords: use quotes for exact phrases, AND/OR for boolean logic, - for negation. Probe handles stemming and camelCase/snake_case splitting automatically, so do NOT try case or style variations of the same keyword."),
|
|
27230
27259
|
path: external_exports2.string().optional().default(".").describe('Path to search in. For dependencies use "go:github.com/owner/repo", "js:package_name", or "rust:cargo_name" etc.'),
|
|
@@ -27639,7 +27668,7 @@ function buildSearchDelegateTask({ searchQuery, searchPath, exact, language, all
|
|
|
27639
27668
|
"Remember: if your search returned relevant results, use nextPage=true to check for more before outputting."
|
|
27640
27669
|
].join("\n");
|
|
27641
27670
|
}
|
|
27642
|
-
var import_ai,
|
|
27671
|
+
var import_ai, import_fs5, CODE_SEARCH_SCHEMA, searchTool, queryTool, extractTool, delegateTool, analyzeAllTool;
|
|
27643
27672
|
var init_vercel = __esm({
|
|
27644
27673
|
"src/tools/vercel.js"() {
|
|
27645
27674
|
"use strict";
|
|
@@ -27650,9 +27679,10 @@ var init_vercel = __esm({
|
|
|
27650
27679
|
init_delegate();
|
|
27651
27680
|
init_analyzeAll();
|
|
27652
27681
|
init_common();
|
|
27653
|
-
|
|
27682
|
+
import_fs5 = require("fs");
|
|
27654
27683
|
init_error_types();
|
|
27655
27684
|
init_hashline();
|
|
27685
|
+
init_simpleTelemetry();
|
|
27656
27686
|
CODE_SEARCH_SCHEMA = {
|
|
27657
27687
|
type: "object",
|
|
27658
27688
|
properties: {
|
|
@@ -27808,6 +27838,7 @@ var init_vercel = __esm({
|
|
|
27808
27838
|
tracer: options.tracer || null,
|
|
27809
27839
|
enableBash: false,
|
|
27810
27840
|
bashConfig: null,
|
|
27841
|
+
allowEdit: options.allowEdit || false,
|
|
27811
27842
|
architectureFileName: options.architectureFileName || null,
|
|
27812
27843
|
promptType: "code-searcher",
|
|
27813
27844
|
allowedTools: ["search", "extract", "listFiles"],
|
|
@@ -27818,6 +27849,12 @@ var init_vercel = __esm({
|
|
|
27818
27849
|
const delegateResult = options.tracer?.withSpan ? await options.tracer.withSpan("search.delegate", runDelegation, {
|
|
27819
27850
|
"search.query": searchQuery,
|
|
27820
27851
|
"search.path": searchPath
|
|
27852
|
+
}, (span, result) => {
|
|
27853
|
+
const text = typeof result === "string" ? result : "";
|
|
27854
|
+
span.setAttributes({
|
|
27855
|
+
"search.delegate.output": truncateForSpan(text),
|
|
27856
|
+
"search.delegate.output_length": text.length
|
|
27857
|
+
});
|
|
27821
27858
|
}) : await runDelegation();
|
|
27822
27859
|
const targets = parseDelegatedTargets(delegateResult);
|
|
27823
27860
|
if (!targets.length) {
|
|
@@ -27837,7 +27874,7 @@ var init_vercel = __esm({
|
|
|
27837
27874
|
const validatedTargets = [];
|
|
27838
27875
|
for (const target of resolvedTargets) {
|
|
27839
27876
|
const { filePart, suffix } = splitTargetSuffix(target);
|
|
27840
|
-
if ((0,
|
|
27877
|
+
if ((0, import_fs5.existsSync)(filePart)) {
|
|
27841
27878
|
validatedTargets.push(target);
|
|
27842
27879
|
continue;
|
|
27843
27880
|
}
|
|
@@ -27846,7 +27883,7 @@ var init_vercel = __esm({
|
|
|
27846
27883
|
for (let i = 0; i < parts.length - 1; i++) {
|
|
27847
27884
|
if (parts[i] === parts[i + 1]) {
|
|
27848
27885
|
const candidate = "/" + [...parts.slice(0, i), ...parts.slice(i + 1)].join("/");
|
|
27849
|
-
if ((0,
|
|
27886
|
+
if ((0, import_fs5.existsSync)(candidate)) {
|
|
27850
27887
|
validatedTargets.push(candidate + suffix);
|
|
27851
27888
|
if (debug) console.error(`[search-delegate] Fixed doubled path segment: ${filePart} \u2192 ${candidate}`);
|
|
27852
27889
|
fixed = true;
|
|
@@ -27859,7 +27896,7 @@ var init_vercel = __esm({
|
|
|
27859
27896
|
if (altBase === delegateBase) continue;
|
|
27860
27897
|
const altResolved = resolveTargetPath(target, altBase);
|
|
27861
27898
|
const { filePart: altFile } = splitTargetSuffix(altResolved);
|
|
27862
|
-
if ((0,
|
|
27899
|
+
if ((0, import_fs5.existsSync)(altFile)) {
|
|
27863
27900
|
validatedTargets.push(altResolved);
|
|
27864
27901
|
if (debug) console.error(`[search-delegate] Resolved with alt base: ${filePart} \u2192 ${altFile}`);
|
|
27865
27902
|
fixed = true;
|
|
@@ -27984,13 +28021,13 @@ var init_vercel = __esm({
|
|
|
27984
28021
|
const { join: pathJoin, sep: pathSep } = await import("path");
|
|
27985
28022
|
extractFiles = extractFiles.map((target) => {
|
|
27986
28023
|
const { filePart, suffix } = splitTargetSuffix(target);
|
|
27987
|
-
if ((0,
|
|
28024
|
+
if ((0, import_fs5.existsSync)(filePart)) return target;
|
|
27988
28025
|
const cwdPrefix = effectiveCwd.endsWith(pathSep) ? effectiveCwd : effectiveCwd + pathSep;
|
|
27989
28026
|
const relativePart = filePart.startsWith(cwdPrefix) ? filePart.slice(cwdPrefix.length) : null;
|
|
27990
28027
|
if (relativePart) {
|
|
27991
28028
|
for (const folder of options.allowedFolders) {
|
|
27992
28029
|
const candidate = pathJoin(folder, relativePart);
|
|
27993
|
-
if ((0,
|
|
28030
|
+
if ((0, import_fs5.existsSync)(candidate)) {
|
|
27994
28031
|
if (debug) console.error(`[extract] Auto-fixed path: ${filePart} \u2192 ${candidate}`);
|
|
27995
28032
|
return candidate + suffix;
|
|
27996
28033
|
}
|
|
@@ -28003,7 +28040,7 @@ var init_vercel = __esm({
|
|
|
28003
28040
|
if (filePart.startsWith(wsParent)) {
|
|
28004
28041
|
const tail = filePart.slice(wsParent.length);
|
|
28005
28042
|
const candidate = pathJoin(folderPrefix, tail);
|
|
28006
|
-
if (candidate !== filePart && (0,
|
|
28043
|
+
if (candidate !== filePart && (0, import_fs5.existsSync)(candidate)) {
|
|
28007
28044
|
if (debug) console.error(`[extract] Auto-fixed path via workspace: ${filePart} \u2192 ${candidate}`);
|
|
28008
28045
|
return candidate + suffix;
|
|
28009
28046
|
}
|
|
@@ -28062,6 +28099,7 @@ var init_vercel = __esm({
|
|
|
28062
28099
|
workspaceRoot,
|
|
28063
28100
|
enableBash = false,
|
|
28064
28101
|
bashConfig,
|
|
28102
|
+
allowEdit = false,
|
|
28065
28103
|
architectureFileName,
|
|
28066
28104
|
enableMcp = false,
|
|
28067
28105
|
mcpConfig = null,
|
|
@@ -28156,6 +28194,7 @@ var init_vercel = __esm({
|
|
|
28156
28194
|
model,
|
|
28157
28195
|
tracer,
|
|
28158
28196
|
enableBash,
|
|
28197
|
+
allowEdit,
|
|
28159
28198
|
bashConfig,
|
|
28160
28199
|
architectureFileName,
|
|
28161
28200
|
searchDelegate,
|
|
@@ -29601,8 +29640,8 @@ async function executeBashCommand(command, options = {}) {
|
|
|
29601
29640
|
} = options;
|
|
29602
29641
|
let cwd = workingDirectory;
|
|
29603
29642
|
try {
|
|
29604
|
-
cwd = (0,
|
|
29605
|
-
if (!(0,
|
|
29643
|
+
cwd = (0, import_path7.resolve)(cwd);
|
|
29644
|
+
if (!(0, import_fs6.existsSync)(cwd)) {
|
|
29606
29645
|
throw new Error(`Working directory does not exist: ${cwd}`);
|
|
29607
29646
|
}
|
|
29608
29647
|
} catch (error40) {
|
|
@@ -29858,7 +29897,7 @@ function validateExecutionOptions(options = {}) {
|
|
|
29858
29897
|
if (options.workingDirectory) {
|
|
29859
29898
|
if (typeof options.workingDirectory !== "string") {
|
|
29860
29899
|
errors.push("workingDirectory must be a string");
|
|
29861
|
-
} else if (!(0,
|
|
29900
|
+
} else if (!(0, import_fs6.existsSync)(options.workingDirectory)) {
|
|
29862
29901
|
errors.push(`workingDirectory does not exist: ${options.workingDirectory}`);
|
|
29863
29902
|
}
|
|
29864
29903
|
}
|
|
@@ -29871,24 +29910,24 @@ function validateExecutionOptions(options = {}) {
|
|
|
29871
29910
|
warnings
|
|
29872
29911
|
};
|
|
29873
29912
|
}
|
|
29874
|
-
var import_child_process6,
|
|
29913
|
+
var import_child_process6, import_path7, import_fs6;
|
|
29875
29914
|
var init_bashExecutor = __esm({
|
|
29876
29915
|
"src/agent/bashExecutor.js"() {
|
|
29877
29916
|
"use strict";
|
|
29878
29917
|
import_child_process6 = require("child_process");
|
|
29879
|
-
|
|
29880
|
-
|
|
29918
|
+
import_path7 = require("path");
|
|
29919
|
+
import_fs6 = require("fs");
|
|
29881
29920
|
init_bashCommandUtils();
|
|
29882
29921
|
}
|
|
29883
29922
|
});
|
|
29884
29923
|
|
|
29885
29924
|
// src/tools/bash.js
|
|
29886
|
-
var import_ai2,
|
|
29925
|
+
var import_ai2, import_path8, bashTool;
|
|
29887
29926
|
var init_bash = __esm({
|
|
29888
29927
|
"src/tools/bash.js"() {
|
|
29889
29928
|
"use strict";
|
|
29890
29929
|
import_ai2 = require("ai");
|
|
29891
|
-
|
|
29930
|
+
import_path8 = require("path");
|
|
29892
29931
|
init_bashPermissions();
|
|
29893
29932
|
init_bashExecutor();
|
|
29894
29933
|
init_path_validation();
|
|
@@ -30005,12 +30044,12 @@ For code exploration, try these safe alternatives:
|
|
|
30005
30044
|
- npm list, pip list for package information`;
|
|
30006
30045
|
}
|
|
30007
30046
|
const defaultDir = getDefaultWorkingDirectory();
|
|
30008
|
-
const workingDir = workingDirectory ? (0,
|
|
30047
|
+
const workingDir = workingDirectory ? (0, import_path8.isAbsolute)(workingDirectory) ? (0, import_path8.resolve)(workingDirectory) : (0, import_path8.resolve)(defaultDir, workingDirectory) : defaultDir;
|
|
30009
30048
|
if (allowedFolders && allowedFolders.length > 0) {
|
|
30010
30049
|
const resolvedWorkingDir = safeRealpath(workingDir);
|
|
30011
30050
|
const isAllowed = allowedFolders.some((folder) => {
|
|
30012
30051
|
const resolvedFolder = safeRealpath(folder);
|
|
30013
|
-
return resolvedWorkingDir === resolvedFolder || resolvedWorkingDir.startsWith(resolvedFolder +
|
|
30052
|
+
return resolvedWorkingDir === resolvedFolder || resolvedWorkingDir.startsWith(resolvedFolder + import_path8.sep);
|
|
30014
30053
|
});
|
|
30015
30054
|
if (!isAllowed) {
|
|
30016
30055
|
const relativeDir = toRelativePath(workingDir, workspaceRoot);
|
|
@@ -30422,12 +30461,12 @@ function isPathAllowed(filePath, allowedFolders) {
|
|
|
30422
30461
|
if (!allowedFolders || allowedFolders.length === 0) {
|
|
30423
30462
|
const resolvedPath2 = safeRealpath(filePath);
|
|
30424
30463
|
const cwd = safeRealpath(process.cwd());
|
|
30425
|
-
return resolvedPath2 === cwd || resolvedPath2.startsWith(cwd +
|
|
30464
|
+
return resolvedPath2 === cwd || resolvedPath2.startsWith(cwd + import_path9.sep);
|
|
30426
30465
|
}
|
|
30427
30466
|
const resolvedPath = safeRealpath(filePath);
|
|
30428
30467
|
return allowedFolders.some((folder) => {
|
|
30429
30468
|
const allowedPath = safeRealpath(folder);
|
|
30430
|
-
return resolvedPath === allowedPath || resolvedPath.startsWith(allowedPath +
|
|
30469
|
+
return resolvedPath === allowedPath || resolvedPath.startsWith(allowedPath + import_path9.sep);
|
|
30431
30470
|
});
|
|
30432
30471
|
}
|
|
30433
30472
|
function parseFileToolOptions(options = {}) {
|
|
@@ -30467,7 +30506,7 @@ Example: <edit><file_path>${file_path}</file_path><symbol>${allMatches[0].qualif
|
|
|
30467
30506
|
return `Error editing ${file_path}: Symbol "${symbol17}" has changed since you last read it. Use the extract tool with targets="${file_path}#${symbol17}" to re-read the current content, then retry.`;
|
|
30468
30507
|
}
|
|
30469
30508
|
}
|
|
30470
|
-
const content = await
|
|
30509
|
+
const content = await import_fs7.promises.readFile(resolvedPath, "utf-8");
|
|
30471
30510
|
const lines = content.split("\n");
|
|
30472
30511
|
if (position) {
|
|
30473
30512
|
const refIndent = detectBaseIndent(symbolInfo.code);
|
|
@@ -30478,7 +30517,7 @@ Example: <edit><file_path>${file_path}</file_path><symbol>${allMatches[0].qualif
|
|
|
30478
30517
|
} else {
|
|
30479
30518
|
lines.splice(symbolInfo.startLine - 1, 0, ...newLines, "");
|
|
30480
30519
|
}
|
|
30481
|
-
await
|
|
30520
|
+
await import_fs7.promises.writeFile(resolvedPath, lines.join("\n"), "utf-8");
|
|
30482
30521
|
if (fileTracker) {
|
|
30483
30522
|
const updated = await findSymbol(resolvedPath, symbol17, cwd || process.cwd());
|
|
30484
30523
|
if (updated) {
|
|
@@ -30496,7 +30535,7 @@ Example: <edit><file_path>${file_path}</file_path><symbol>${allMatches[0].qualif
|
|
|
30496
30535
|
const reindented = reindent(new_string, originalIndent);
|
|
30497
30536
|
const newLines = reindented.split("\n");
|
|
30498
30537
|
lines.splice(symbolInfo.startLine - 1, symbolInfo.endLine - symbolInfo.startLine + 1, ...newLines);
|
|
30499
|
-
await
|
|
30538
|
+
await import_fs7.promises.writeFile(resolvedPath, lines.join("\n"), "utf-8");
|
|
30500
30539
|
if (fileTracker) {
|
|
30501
30540
|
const updated = await findSymbol(resolvedPath, symbol17, cwd || process.cwd());
|
|
30502
30541
|
if (updated) {
|
|
@@ -30551,7 +30590,7 @@ async function handleLineEdit({ resolvedPath, file_path, start_line, end_line, n
|
|
|
30551
30590
|
if (position !== void 0 && position !== null && position !== "before" && position !== "after") {
|
|
30552
30591
|
return 'Error editing file: Invalid position - must be "before" or "after". Use position="before" to insert before the line, or position="after" to insert after it.';
|
|
30553
30592
|
}
|
|
30554
|
-
const content = await
|
|
30593
|
+
const content = await import_fs7.promises.readFile(resolvedPath, "utf-8");
|
|
30555
30594
|
const fileLines = content.split("\n");
|
|
30556
30595
|
if (startLine > fileLines.length) {
|
|
30557
30596
|
return `Error editing file: Line ${startLine} is beyond file length (${fileLines.length} lines). Use 'extract' to read the current file content.`;
|
|
@@ -30580,20 +30619,20 @@ async function handleLineEdit({ resolvedPath, file_path, start_line, end_line, n
|
|
|
30580
30619
|
const newLines = cleaned === "" ? [] : cleaned.split("\n");
|
|
30581
30620
|
if (position === "after") {
|
|
30582
30621
|
fileLines.splice(startLine, 0, ...newLines);
|
|
30583
|
-
await
|
|
30622
|
+
await import_fs7.promises.writeFile(resolvedPath, fileLines.join("\n"), "utf-8");
|
|
30584
30623
|
if (fileTracker) await fileTracker.trackFileAfterWrite(resolvedPath);
|
|
30585
30624
|
const action = `${newLines.length} line${newLines.length !== 1 ? "s" : ""} inserted after line ${startLine}`;
|
|
30586
30625
|
return buildLineEditResponse(file_path, startLine, startLine, newLines.length, fileLines, startLine, action, modifications);
|
|
30587
30626
|
} else if (position === "before") {
|
|
30588
30627
|
fileLines.splice(startLine - 1, 0, ...newLines);
|
|
30589
|
-
await
|
|
30628
|
+
await import_fs7.promises.writeFile(resolvedPath, fileLines.join("\n"), "utf-8");
|
|
30590
30629
|
if (fileTracker) await fileTracker.trackFileAfterWrite(resolvedPath);
|
|
30591
30630
|
const action = `${newLines.length} line${newLines.length !== 1 ? "s" : ""} inserted before line ${startLine}`;
|
|
30592
30631
|
return buildLineEditResponse(file_path, startLine, startLine, newLines.length, fileLines, startLine - 1, action, modifications);
|
|
30593
30632
|
} else {
|
|
30594
30633
|
const replacedCount = endLine - startLine + 1;
|
|
30595
30634
|
fileLines.splice(startLine - 1, replacedCount, ...newLines);
|
|
30596
|
-
await
|
|
30635
|
+
await import_fs7.promises.writeFile(resolvedPath, fileLines.join("\n"), "utf-8");
|
|
30597
30636
|
if (fileTracker) await fileTracker.trackFileAfterWrite(resolvedPath);
|
|
30598
30637
|
let action;
|
|
30599
30638
|
if (newLines.length === 0) {
|
|
@@ -30606,14 +30645,14 @@ async function handleLineEdit({ resolvedPath, file_path, start_line, end_line, n
|
|
|
30606
30645
|
return buildLineEditResponse(file_path, startLine, endLine, newLines.length, fileLines, startLine - 1, action, modifications);
|
|
30607
30646
|
}
|
|
30608
30647
|
}
|
|
30609
|
-
var import_ai3,
|
|
30648
|
+
var import_ai3, import_fs7, import_path9, import_fs8, editTool, createTool, multiEditTool, editSchema, createSchema, multiEditSchema, editDescription, createDescription, multiEditDescription, editToolDefinition, createToolDefinition, multiEditToolDefinition;
|
|
30610
30649
|
var init_edit = __esm({
|
|
30611
30650
|
"src/tools/edit.js"() {
|
|
30612
30651
|
"use strict";
|
|
30613
30652
|
import_ai3 = require("ai");
|
|
30614
|
-
import_fs6 = require("fs");
|
|
30615
|
-
import_path8 = require("path");
|
|
30616
30653
|
import_fs7 = require("fs");
|
|
30654
|
+
import_path9 = require("path");
|
|
30655
|
+
import_fs8 = require("fs");
|
|
30617
30656
|
init_path_validation();
|
|
30618
30657
|
init_fuzzyMatch();
|
|
30619
30658
|
init_symbolEdit();
|
|
@@ -30689,7 +30728,7 @@ Parameters:
|
|
|
30689
30728
|
return `Error editing file: Invalid new_string - must be a string. Provide the replacement content as a string value (empty string "" is valid for deletions).`;
|
|
30690
30729
|
}
|
|
30691
30730
|
const effectiveCwd = workingDirectory || cwd || process.cwd();
|
|
30692
|
-
const resolvedPath = (0,
|
|
30731
|
+
const resolvedPath = (0, import_path9.isAbsolute)(file_path) ? file_path : (0, import_path9.resolve)(effectiveCwd, file_path);
|
|
30693
30732
|
if (debug) {
|
|
30694
30733
|
console.error(`[Edit] Attempting to edit file: ${resolvedPath}`);
|
|
30695
30734
|
}
|
|
@@ -30697,7 +30736,7 @@ Parameters:
|
|
|
30697
30736
|
const relativePath = toRelativePath(resolvedPath, workspaceRoot);
|
|
30698
30737
|
return `Error editing file: Permission denied - ${relativePath} is outside allowed directories. Use a file path within the project workspace.`;
|
|
30699
30738
|
}
|
|
30700
|
-
if (!(0,
|
|
30739
|
+
if (!(0, import_fs8.existsSync)(resolvedPath)) {
|
|
30701
30740
|
return `Error editing file: File not found - ${file_path}. Verify the path is correct and the file exists. Use 'search' to find files by name, or 'create' to make a new file.`;
|
|
30702
30741
|
}
|
|
30703
30742
|
if (options.fileTracker && !options.fileTracker.isFileSeen(resolvedPath)) {
|
|
@@ -30725,7 +30764,7 @@ Parameters:
|
|
|
30725
30764
|
Use the extract tool with targets="${displayPath}" to re-read the file, then retry.`;
|
|
30726
30765
|
}
|
|
30727
30766
|
}
|
|
30728
|
-
const content = await
|
|
30767
|
+
const content = await import_fs7.promises.readFile(resolvedPath, "utf-8");
|
|
30729
30768
|
let matchTarget = old_string;
|
|
30730
30769
|
let matchStrategy = "exact";
|
|
30731
30770
|
if (!content.includes(old_string)) {
|
|
@@ -30757,7 +30796,7 @@ Use the extract tool with targets="${displayPath}" to re-read the file, then ret
|
|
|
30757
30796
|
if (newContent === content) {
|
|
30758
30797
|
return `Error editing file: No changes made - the replacement result is identical to the original. Verify that old_string and new_string are actually different. If fuzzy matching was used, the matched text may already equal new_string.`;
|
|
30759
30798
|
}
|
|
30760
|
-
await
|
|
30799
|
+
await import_fs7.promises.writeFile(resolvedPath, newContent, "utf-8");
|
|
30761
30800
|
if (options.fileTracker) {
|
|
30762
30801
|
await options.fileTracker.trackFileAfterWrite(resolvedPath);
|
|
30763
30802
|
options.fileTracker.recordTextEdit(resolvedPath);
|
|
@@ -30820,7 +30859,7 @@ Important:
|
|
|
30820
30859
|
return `Error creating file: Invalid content - must be a string. Provide the file content as a string value (empty string "" is valid for an empty file).`;
|
|
30821
30860
|
}
|
|
30822
30861
|
const effectiveCwd = workingDirectory || cwd || process.cwd();
|
|
30823
|
-
const resolvedPath = (0,
|
|
30862
|
+
const resolvedPath = (0, import_path9.isAbsolute)(file_path) ? file_path : (0, import_path9.resolve)(effectiveCwd, file_path);
|
|
30824
30863
|
if (debug) {
|
|
30825
30864
|
console.error(`[Create] Attempting to create file: ${resolvedPath}`);
|
|
30826
30865
|
}
|
|
@@ -30828,13 +30867,13 @@ Important:
|
|
|
30828
30867
|
const relativePath = toRelativePath(resolvedPath, workspaceRoot);
|
|
30829
30868
|
return `Error creating file: Permission denied - ${relativePath} is outside allowed directories. Use a file path within the project workspace.`;
|
|
30830
30869
|
}
|
|
30831
|
-
if ((0,
|
|
30870
|
+
if ((0, import_fs8.existsSync)(resolvedPath) && !overwrite) {
|
|
30832
30871
|
return `Error creating file: File already exists - ${file_path}. Use overwrite: true to replace it.`;
|
|
30833
30872
|
}
|
|
30834
|
-
const existed = (0,
|
|
30835
|
-
const dir = (0,
|
|
30836
|
-
await
|
|
30837
|
-
await
|
|
30873
|
+
const existed = (0, import_fs8.existsSync)(resolvedPath);
|
|
30874
|
+
const dir = (0, import_path9.dirname)(resolvedPath);
|
|
30875
|
+
await import_fs7.promises.mkdir(dir, { recursive: true });
|
|
30876
|
+
await import_fs7.promises.writeFile(resolvedPath, content, "utf-8");
|
|
30838
30877
|
if (options.fileTracker) await options.fileTracker.trackFileAfterWrite(resolvedPath);
|
|
30839
30878
|
const action = existed && overwrite ? "overwrote" : "created";
|
|
30840
30879
|
const bytes = Buffer.byteLength(content, "utf-8");
|
|
@@ -45181,22 +45220,22 @@ var init_esm3 = __esm({
|
|
|
45181
45220
|
});
|
|
45182
45221
|
|
|
45183
45222
|
// node_modules/path-scurry/dist/esm/index.js
|
|
45184
|
-
var import_node_path, import_node_url,
|
|
45223
|
+
var import_node_path, import_node_url, import_fs9, actualFS, import_promises, realpathSync2, 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;
|
|
45185
45224
|
var init_esm4 = __esm({
|
|
45186
45225
|
"node_modules/path-scurry/dist/esm/index.js"() {
|
|
45187
45226
|
init_esm2();
|
|
45188
45227
|
import_node_path = require("node:path");
|
|
45189
45228
|
import_node_url = require("node:url");
|
|
45190
|
-
|
|
45229
|
+
import_fs9 = require("fs");
|
|
45191
45230
|
actualFS = __toESM(require("node:fs"), 1);
|
|
45192
45231
|
import_promises = require("node:fs/promises");
|
|
45193
45232
|
init_esm3();
|
|
45194
|
-
realpathSync2 =
|
|
45233
|
+
realpathSync2 = import_fs9.realpathSync.native;
|
|
45195
45234
|
defaultFS = {
|
|
45196
|
-
lstatSync:
|
|
45197
|
-
readdir:
|
|
45198
|
-
readdirSync:
|
|
45199
|
-
readlinkSync:
|
|
45235
|
+
lstatSync: import_fs9.lstatSync,
|
|
45236
|
+
readdir: import_fs9.readdir,
|
|
45237
|
+
readdirSync: import_fs9.readdirSync,
|
|
45238
|
+
readlinkSync: import_fs9.readlinkSync,
|
|
45200
45239
|
realpathSync: realpathSync2,
|
|
45201
45240
|
promises: {
|
|
45202
45241
|
lstat: import_promises.lstat,
|
|
@@ -48725,10 +48764,10 @@ async function listFilesByLevel(options) {
|
|
|
48725
48764
|
maxFiles = 100,
|
|
48726
48765
|
respectGitignore = true
|
|
48727
48766
|
} = options;
|
|
48728
|
-
if (!
|
|
48767
|
+
if (!import_fs10.default.existsSync(directory)) {
|
|
48729
48768
|
throw new Error(`Directory does not exist: ${directory}`);
|
|
48730
48769
|
}
|
|
48731
|
-
const gitDirExists =
|
|
48770
|
+
const gitDirExists = import_fs10.default.existsSync(import_path10.default.join(directory, ".git"));
|
|
48732
48771
|
if (gitDirExists && respectGitignore) {
|
|
48733
48772
|
try {
|
|
48734
48773
|
return await listFilesUsingGit(directory, maxFiles);
|
|
@@ -48743,8 +48782,8 @@ async function listFilesUsingGit(directory, maxFiles) {
|
|
|
48743
48782
|
const { stdout } = await execAsync3("git ls-files", { cwd: directory });
|
|
48744
48783
|
const files = stdout.split("\n").filter(Boolean);
|
|
48745
48784
|
const sortedFiles = files.sort((a, b) => {
|
|
48746
|
-
const depthA = a.split(
|
|
48747
|
-
const depthB = b.split(
|
|
48785
|
+
const depthA = a.split(import_path10.default.sep).length;
|
|
48786
|
+
const depthB = b.split(import_path10.default.sep).length;
|
|
48748
48787
|
return depthA - depthB;
|
|
48749
48788
|
});
|
|
48750
48789
|
return sortedFiles.slice(0, maxFiles);
|
|
@@ -48759,25 +48798,25 @@ async function listFilesByLevelManually(directory, maxFiles, respectGitignore) {
|
|
|
48759
48798
|
while (queue.length > 0 && result.length < maxFiles) {
|
|
48760
48799
|
const { dir, level } = queue.shift();
|
|
48761
48800
|
try {
|
|
48762
|
-
const entries =
|
|
48801
|
+
const entries = import_fs10.default.readdirSync(dir, { withFileTypes: true });
|
|
48763
48802
|
const files = entries.filter((entry) => {
|
|
48764
|
-
const fullPath =
|
|
48803
|
+
const fullPath = import_path10.default.join(dir, entry.name);
|
|
48765
48804
|
return getEntryTypeSync(entry, fullPath).isFile;
|
|
48766
48805
|
});
|
|
48767
48806
|
for (const file2 of files) {
|
|
48768
48807
|
if (result.length >= maxFiles) break;
|
|
48769
|
-
const filePath =
|
|
48770
|
-
const relativePath =
|
|
48808
|
+
const filePath = import_path10.default.join(dir, file2.name);
|
|
48809
|
+
const relativePath = import_path10.default.relative(directory, filePath);
|
|
48771
48810
|
if (shouldIgnore(relativePath, ignorePatterns)) continue;
|
|
48772
48811
|
result.push(relativePath);
|
|
48773
48812
|
}
|
|
48774
48813
|
const dirs = entries.filter((entry) => {
|
|
48775
|
-
const fullPath =
|
|
48814
|
+
const fullPath = import_path10.default.join(dir, entry.name);
|
|
48776
48815
|
return getEntryTypeSync(entry, fullPath).isDirectory;
|
|
48777
48816
|
});
|
|
48778
48817
|
for (const subdir of dirs) {
|
|
48779
|
-
const subdirPath =
|
|
48780
|
-
const relativeSubdirPath =
|
|
48818
|
+
const subdirPath = import_path10.default.join(dir, subdir.name);
|
|
48819
|
+
const relativeSubdirPath = import_path10.default.relative(directory, subdirPath);
|
|
48781
48820
|
if (shouldIgnore(relativeSubdirPath, ignorePatterns)) continue;
|
|
48782
48821
|
if (subdir.name === "node_modules" || subdir.name === ".git") continue;
|
|
48783
48822
|
queue.push({ dir: subdirPath, level: level + 1 });
|
|
@@ -48789,12 +48828,12 @@ async function listFilesByLevelManually(directory, maxFiles, respectGitignore) {
|
|
|
48789
48828
|
return result;
|
|
48790
48829
|
}
|
|
48791
48830
|
function loadGitignorePatterns(directory) {
|
|
48792
|
-
const gitignorePath =
|
|
48793
|
-
if (!
|
|
48831
|
+
const gitignorePath = import_path10.default.join(directory, ".gitignore");
|
|
48832
|
+
if (!import_fs10.default.existsSync(gitignorePath)) {
|
|
48794
48833
|
return [];
|
|
48795
48834
|
}
|
|
48796
48835
|
try {
|
|
48797
|
-
const content =
|
|
48836
|
+
const content = import_fs10.default.readFileSync(gitignorePath, "utf8");
|
|
48798
48837
|
return content.split("\n").map((line) => line.trim()).filter((line) => line && !line.startsWith("#"));
|
|
48799
48838
|
} catch (error40) {
|
|
48800
48839
|
console.error(`Warning: Could not read .gitignore: ${error40.message}`);
|
|
@@ -48812,12 +48851,12 @@ function shouldIgnore(filePath, ignorePatterns) {
|
|
|
48812
48851
|
}
|
|
48813
48852
|
return false;
|
|
48814
48853
|
}
|
|
48815
|
-
var
|
|
48854
|
+
var import_fs10, import_path10, import_util13, import_child_process7, execAsync3;
|
|
48816
48855
|
var init_file_lister = __esm({
|
|
48817
48856
|
"src/utils/file-lister.js"() {
|
|
48818
48857
|
"use strict";
|
|
48819
|
-
|
|
48820
|
-
|
|
48858
|
+
import_fs10 = __toESM(require("fs"), 1);
|
|
48859
|
+
import_path10 = __toESM(require("path"), 1);
|
|
48821
48860
|
import_util13 = require("util");
|
|
48822
48861
|
import_child_process7 = require("child_process");
|
|
48823
48862
|
init_symlink_utils();
|
|
@@ -48828,7 +48867,7 @@ var init_file_lister = __esm({
|
|
|
48828
48867
|
// src/tools/fileTracker.js
|
|
48829
48868
|
function normalizePath(filePath) {
|
|
48830
48869
|
if (!filePath) return filePath;
|
|
48831
|
-
return (0,
|
|
48870
|
+
return (0, import_path11.resolve)(filePath);
|
|
48832
48871
|
}
|
|
48833
48872
|
function computeContentHash(content) {
|
|
48834
48873
|
const normalized = (content || "").split("\n").map((l) => l.trimEnd()).join("\n");
|
|
@@ -48868,12 +48907,12 @@ function parseFilePathsFromOutput(output) {
|
|
|
48868
48907
|
}
|
|
48869
48908
|
return paths;
|
|
48870
48909
|
}
|
|
48871
|
-
var import_crypto3,
|
|
48910
|
+
var import_crypto3, import_path11, FileTracker;
|
|
48872
48911
|
var init_fileTracker = __esm({
|
|
48873
48912
|
"src/tools/fileTracker.js"() {
|
|
48874
48913
|
"use strict";
|
|
48875
48914
|
import_crypto3 = require("crypto");
|
|
48876
|
-
|
|
48915
|
+
import_path11 = require("path");
|
|
48877
48916
|
init_symbolEdit();
|
|
48878
48917
|
FileTracker = class {
|
|
48879
48918
|
/**
|
|
@@ -48974,7 +49013,7 @@ var init_fileTracker = __esm({
|
|
|
48974
49013
|
const symbolPromises = [];
|
|
48975
49014
|
for (const target of targets) {
|
|
48976
49015
|
const filePath = extractFilePath(target);
|
|
48977
|
-
const resolved = (0,
|
|
49016
|
+
const resolved = (0, import_path11.isAbsolute)(filePath) ? filePath : (0, import_path11.resolve)(cwd, filePath);
|
|
48978
49017
|
if (!seenPaths.has(resolved)) {
|
|
48979
49018
|
seenPaths.add(resolved);
|
|
48980
49019
|
this.markFileSeen(resolved);
|
|
@@ -49014,7 +49053,7 @@ var init_fileTracker = __esm({
|
|
|
49014
49053
|
async trackFilesFromOutput(output, cwd) {
|
|
49015
49054
|
const paths = parseFilePathsFromOutput(output);
|
|
49016
49055
|
for (const filePath of paths) {
|
|
49017
|
-
const resolved = (0,
|
|
49056
|
+
const resolved = (0, import_path11.isAbsolute)(filePath) ? filePath : (0, import_path11.resolve)(cwd, filePath);
|
|
49018
49057
|
this.markFileSeen(resolved);
|
|
49019
49058
|
}
|
|
49020
49059
|
}
|
|
@@ -49122,27 +49161,6 @@ var init_fileTracker = __esm({
|
|
|
49122
49161
|
}
|
|
49123
49162
|
});
|
|
49124
49163
|
|
|
49125
|
-
// src/agent/otelLogBridge.js
|
|
49126
|
-
var import_module, _require;
|
|
49127
|
-
var init_otelLogBridge = __esm({
|
|
49128
|
-
"src/agent/otelLogBridge.js"() {
|
|
49129
|
-
"use strict";
|
|
49130
|
-
import_module = require("module");
|
|
49131
|
-
_require = (0, import_module.createRequire)("file:///");
|
|
49132
|
-
}
|
|
49133
|
-
});
|
|
49134
|
-
|
|
49135
|
-
// src/agent/simpleTelemetry.js
|
|
49136
|
-
var import_fs10, import_path11;
|
|
49137
|
-
var init_simpleTelemetry = __esm({
|
|
49138
|
-
"src/agent/simpleTelemetry.js"() {
|
|
49139
|
-
"use strict";
|
|
49140
|
-
import_fs10 = require("fs");
|
|
49141
|
-
import_path11 = require("path");
|
|
49142
|
-
init_otelLogBridge();
|
|
49143
|
-
}
|
|
49144
|
-
});
|
|
49145
|
-
|
|
49146
49164
|
// src/agent/probeTool.js
|
|
49147
49165
|
function isSessionCancelled(sessionId) {
|
|
49148
49166
|
return activeToolExecutions.get(sessionId)?.cancelled || false;
|
|
@@ -100006,6 +100024,7 @@ var init_ProbeAgent = __esm({
|
|
|
100006
100024
|
import_promises6 = require("fs/promises");
|
|
100007
100025
|
import_path18 = require("path");
|
|
100008
100026
|
init_tokenCounter();
|
|
100027
|
+
init_simpleTelemetry();
|
|
100009
100028
|
init_InMemoryStorageAdapter();
|
|
100010
100029
|
init_HookManager();
|
|
100011
100030
|
init_imageConfig();
|
|
@@ -103344,7 +103363,7 @@ Double-check your response based on the criteria above. If everything looks good
|
|
|
103344
103363
|
};
|
|
103345
103364
|
let aiResult;
|
|
103346
103365
|
if (this.tracer) {
|
|
103347
|
-
const inputPreview = message
|
|
103366
|
+
const inputPreview = truncateForSpan(message, 4096);
|
|
103348
103367
|
aiResult = await this.tracer.withSpan("ai.request", executeAIRequest, {
|
|
103349
103368
|
"ai.model": this.model,
|
|
103350
103369
|
"ai.provider": this.clientApiProvider || "auto",
|
|
@@ -103354,6 +103373,12 @@ Double-check your response based on the criteria above. If everything looks good
|
|
|
103354
103373
|
"max_tokens": maxResponseTokens,
|
|
103355
103374
|
"temperature": 0.3,
|
|
103356
103375
|
"message_count": currentMessages.length
|
|
103376
|
+
}, (span, result) => {
|
|
103377
|
+
const text = result?.finalText || "";
|
|
103378
|
+
span.setAttributes({
|
|
103379
|
+
"ai.output": truncateForSpan(text),
|
|
103380
|
+
"ai.output_length": text.length
|
|
103381
|
+
});
|
|
103357
103382
|
});
|
|
103358
103383
|
} else {
|
|
103359
103384
|
aiResult = await executeAIRequest();
|
|
@@ -103377,6 +103402,9 @@ Double-check your response based on the criteria above. If everything looks good
|
|
|
103377
103402
|
} else if (aiResult.finalText) {
|
|
103378
103403
|
finalResult = aiResult.finalText;
|
|
103379
103404
|
}
|
|
103405
|
+
if (finalResult === null || finalResult === void 0) {
|
|
103406
|
+
finalResult = "";
|
|
103407
|
+
}
|
|
103380
103408
|
if (gracefulTimeoutState.triggered) {
|
|
103381
103409
|
const timeoutNotice = "**Note: This response was generated under a time constraint. The research may be incomplete, and some planned searches or analysis steps were not completed.**\n\n";
|
|
103382
103410
|
if (!finalResult || finalResult === DEFAULT_MAX_ITER_MSG || finalResult.startsWith("I was unable to complete your request after")) {
|