@probelabs/probe 0.6.0-rc269 → 0.6.0-rc271

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.
@@ -36502,6 +36502,17 @@ function parseDelegatedTargets(rawResponse) {
36502
36502
  }
36503
36503
  return normalizeTargets(fallbackTargetsFromText(trimmed));
36504
36504
  }
36505
+ function splitTargetSuffix(target) {
36506
+ const searchStart = target.length > 2 && target[1] === ":" && /[a-zA-Z]/.test(target[0]) ? 2 : 0;
36507
+ const colonIdx = target.indexOf(":", searchStart);
36508
+ const hashIdx = target.indexOf("#");
36509
+ if (colonIdx !== -1 && (hashIdx === -1 || colonIdx < hashIdx)) {
36510
+ return { filePart: target.substring(0, colonIdx), suffix: target.substring(colonIdx) };
36511
+ } else if (hashIdx !== -1) {
36512
+ return { filePart: target.substring(0, hashIdx), suffix: target.substring(hashIdx) };
36513
+ }
36514
+ return { filePart: target, suffix: "" };
36515
+ }
36505
36516
  function buildSearchDelegateTask({ searchQuery, searchPath, exact, language, allowTests }) {
36506
36517
  return [
36507
36518
  "You are a code-search subagent. Your job is to find ALL relevant code locations for the given query.",
@@ -36530,7 +36541,7 @@ function buildSearchDelegateTask({ searchQuery, searchPath, exact, language, all
36530
36541
  "Deduplicate targets. Do NOT explain or answer - ONLY return the JSON targets."
36531
36542
  ].join("\n");
36532
36543
  }
36533
- var import_ai, CODE_SEARCH_SCHEMA, searchTool, queryTool, extractTool, delegateTool, analyzeAllTool;
36544
+ var import_ai, import_fs4, CODE_SEARCH_SCHEMA, searchTool, queryTool, extractTool, delegateTool, analyzeAllTool;
36534
36545
  var init_vercel = __esm({
36535
36546
  "src/tools/vercel.js"() {
36536
36547
  "use strict";
@@ -36541,6 +36552,7 @@ var init_vercel = __esm({
36541
36552
  init_delegate();
36542
36553
  init_analyzeAll();
36543
36554
  init_common2();
36555
+ import_fs4 = require("fs");
36544
36556
  init_error_types();
36545
36557
  init_hashline();
36546
36558
  CODE_SEARCH_SCHEMA = {
@@ -36666,10 +36678,47 @@ var init_vercel = __esm({
36666
36678
  }
36667
36679
  return fallbackResult;
36668
36680
  }
36681
+ const delegateBase = options.allowedFolders?.[0] || options.cwd || ".";
36669
36682
  const resolutionBase = searchPaths[0] || options.cwd || ".";
36670
- const resolvedTargets = targets.map((target) => resolveTargetPath(target, resolutionBase));
36683
+ const resolvedTargets = targets.map((target) => resolveTargetPath(target, delegateBase));
36684
+ const validatedTargets = [];
36685
+ for (const target of resolvedTargets) {
36686
+ const { filePart, suffix } = splitTargetSuffix(target);
36687
+ if ((0, import_fs4.existsSync)(filePart)) {
36688
+ validatedTargets.push(target);
36689
+ continue;
36690
+ }
36691
+ let fixed = false;
36692
+ const parts = filePart.split("/").filter(Boolean);
36693
+ for (let i5 = 0; i5 < parts.length - 1; i5++) {
36694
+ if (parts[i5] === parts[i5 + 1]) {
36695
+ const candidate = "/" + [...parts.slice(0, i5), ...parts.slice(i5 + 1)].join("/");
36696
+ if ((0, import_fs4.existsSync)(candidate)) {
36697
+ validatedTargets.push(candidate + suffix);
36698
+ if (debug) console.error(`[search-delegate] Fixed doubled path segment: ${filePart} \u2192 ${candidate}`);
36699
+ fixed = true;
36700
+ break;
36701
+ }
36702
+ }
36703
+ }
36704
+ if (fixed) continue;
36705
+ for (const altBase of [resolutionBase, options.cwd].filter(Boolean)) {
36706
+ if (altBase === delegateBase) continue;
36707
+ const altResolved = resolveTargetPath(target, altBase);
36708
+ const { filePart: altFile } = splitTargetSuffix(altResolved);
36709
+ if ((0, import_fs4.existsSync)(altFile)) {
36710
+ validatedTargets.push(altResolved);
36711
+ if (debug) console.error(`[search-delegate] Resolved with alt base: ${filePart} \u2192 ${altFile}`);
36712
+ fixed = true;
36713
+ break;
36714
+ }
36715
+ }
36716
+ if (fixed) continue;
36717
+ if (debug) console.error(`[search-delegate] Warning: target may not exist: ${filePart}`);
36718
+ validatedTargets.push(target);
36719
+ }
36671
36720
  const extractOptions = {
36672
- files: resolvedTargets,
36721
+ files: validatedTargets,
36673
36722
  cwd: resolutionBase,
36674
36723
  allowTests: allow_tests ?? true
36675
36724
  };
@@ -38314,7 +38363,7 @@ async function executeBashCommand(command, options = {}) {
38314
38363
  let cwd = workingDirectory;
38315
38364
  try {
38316
38365
  cwd = (0, import_path6.resolve)(cwd);
38317
- if (!(0, import_fs4.existsSync)(cwd)) {
38366
+ if (!(0, import_fs5.existsSync)(cwd)) {
38318
38367
  throw new Error(`Working directory does not exist: ${cwd}`);
38319
38368
  }
38320
38369
  } catch (error2) {
@@ -38570,7 +38619,7 @@ function validateExecutionOptions(options = {}) {
38570
38619
  if (options.workingDirectory) {
38571
38620
  if (typeof options.workingDirectory !== "string") {
38572
38621
  errors.push("workingDirectory must be a string");
38573
- } else if (!(0, import_fs4.existsSync)(options.workingDirectory)) {
38622
+ } else if (!(0, import_fs5.existsSync)(options.workingDirectory)) {
38574
38623
  errors.push(`workingDirectory does not exist: ${options.workingDirectory}`);
38575
38624
  }
38576
38625
  }
@@ -38583,13 +38632,13 @@ function validateExecutionOptions(options = {}) {
38583
38632
  warnings
38584
38633
  };
38585
38634
  }
38586
- var import_child_process6, import_path6, import_fs4;
38635
+ var import_child_process6, import_path6, import_fs5;
38587
38636
  var init_bashExecutor = __esm({
38588
38637
  "src/agent/bashExecutor.js"() {
38589
38638
  "use strict";
38590
38639
  import_child_process6 = require("child_process");
38591
38640
  import_path6 = require("path");
38592
- import_fs4 = require("fs");
38641
+ import_fs5 = require("fs");
38593
38642
  init_bashCommandUtils();
38594
38643
  }
38595
38644
  });
@@ -39147,7 +39196,7 @@ Example: <edit><file_path>${file_path}</file_path><symbol>${allMatches[0].qualif
39147
39196
  Example: <extract><targets>${file_path}#${symbol15}</targets></extract>`;
39148
39197
  }
39149
39198
  }
39150
- const content = await import_fs5.promises.readFile(resolvedPath2, "utf-8");
39199
+ const content = await import_fs6.promises.readFile(resolvedPath2, "utf-8");
39151
39200
  const lines = content.split("\n");
39152
39201
  if (position) {
39153
39202
  const refIndent = detectBaseIndent(symbolInfo.code);
@@ -39158,7 +39207,7 @@ Example: <extract><targets>${file_path}#${symbol15}</targets></extract>`;
39158
39207
  } else {
39159
39208
  lines.splice(symbolInfo.startLine - 1, 0, ...newLines, "");
39160
39209
  }
39161
- await import_fs5.promises.writeFile(resolvedPath2, lines.join("\n"), "utf-8");
39210
+ await import_fs6.promises.writeFile(resolvedPath2, lines.join("\n"), "utf-8");
39162
39211
  if (fileTracker) {
39163
39212
  const updated = await findSymbol(resolvedPath2, symbol15, cwd || process.cwd());
39164
39213
  if (updated) {
@@ -39176,7 +39225,7 @@ Example: <extract><targets>${file_path}#${symbol15}</targets></extract>`;
39176
39225
  const reindented = reindent(new_string, originalIndent);
39177
39226
  const newLines = reindented.split("\n");
39178
39227
  lines.splice(symbolInfo.startLine - 1, symbolInfo.endLine - symbolInfo.startLine + 1, ...newLines);
39179
- await import_fs5.promises.writeFile(resolvedPath2, lines.join("\n"), "utf-8");
39228
+ await import_fs6.promises.writeFile(resolvedPath2, lines.join("\n"), "utf-8");
39180
39229
  if (fileTracker) {
39181
39230
  const updated = await findSymbol(resolvedPath2, symbol15, cwd || process.cwd());
39182
39231
  if (updated) {
@@ -39231,7 +39280,7 @@ async function handleLineEdit({ resolvedPath: resolvedPath2, file_path, start_li
39231
39280
  if (position !== void 0 && position !== null && position !== "before" && position !== "after") {
39232
39281
  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.';
39233
39282
  }
39234
- const content = await import_fs5.promises.readFile(resolvedPath2, "utf-8");
39283
+ const content = await import_fs6.promises.readFile(resolvedPath2, "utf-8");
39235
39284
  const fileLines = content.split("\n");
39236
39285
  if (startLine > fileLines.length) {
39237
39286
  return `Error editing file: Line ${startLine} is beyond file length (${fileLines.length} lines). Use 'extract' to read the current file content.`;
@@ -39260,20 +39309,20 @@ async function handleLineEdit({ resolvedPath: resolvedPath2, file_path, start_li
39260
39309
  const newLines = cleaned === "" ? [] : cleaned.split("\n");
39261
39310
  if (position === "after") {
39262
39311
  fileLines.splice(startLine, 0, ...newLines);
39263
- await import_fs5.promises.writeFile(resolvedPath2, fileLines.join("\n"), "utf-8");
39312
+ await import_fs6.promises.writeFile(resolvedPath2, fileLines.join("\n"), "utf-8");
39264
39313
  if (fileTracker) await fileTracker.trackFileAfterWrite(resolvedPath2);
39265
39314
  const action = `${newLines.length} line${newLines.length !== 1 ? "s" : ""} inserted after line ${startLine}`;
39266
39315
  return buildLineEditResponse(file_path, startLine, startLine, newLines.length, fileLines, startLine, action, modifications);
39267
39316
  } else if (position === "before") {
39268
39317
  fileLines.splice(startLine - 1, 0, ...newLines);
39269
- await import_fs5.promises.writeFile(resolvedPath2, fileLines.join("\n"), "utf-8");
39318
+ await import_fs6.promises.writeFile(resolvedPath2, fileLines.join("\n"), "utf-8");
39270
39319
  if (fileTracker) await fileTracker.trackFileAfterWrite(resolvedPath2);
39271
39320
  const action = `${newLines.length} line${newLines.length !== 1 ? "s" : ""} inserted before line ${startLine}`;
39272
39321
  return buildLineEditResponse(file_path, startLine, startLine, newLines.length, fileLines, startLine - 1, action, modifications);
39273
39322
  } else {
39274
39323
  const replacedCount = endLine - startLine + 1;
39275
39324
  fileLines.splice(startLine - 1, replacedCount, ...newLines);
39276
- await import_fs5.promises.writeFile(resolvedPath2, fileLines.join("\n"), "utf-8");
39325
+ await import_fs6.promises.writeFile(resolvedPath2, fileLines.join("\n"), "utf-8");
39277
39326
  if (fileTracker) await fileTracker.trackFileAfterWrite(resolvedPath2);
39278
39327
  let action;
39279
39328
  if (newLines.length === 0) {
@@ -39286,14 +39335,14 @@ async function handleLineEdit({ resolvedPath: resolvedPath2, file_path, start_li
39286
39335
  return buildLineEditResponse(file_path, startLine, endLine, newLines.length, fileLines, startLine - 1, action, modifications);
39287
39336
  }
39288
39337
  }
39289
- var import_ai3, import_fs5, import_path8, import_fs6, editTool, createTool, multiEditTool, editSchema, createSchema, multiEditSchema, editDescription, createDescription, multiEditDescription, editToolDefinition, createToolDefinition, multiEditToolDefinition;
39338
+ var import_ai3, import_fs6, import_path8, import_fs7, editTool, createTool, multiEditTool, editSchema, createSchema, multiEditSchema, editDescription, createDescription, multiEditDescription, editToolDefinition, createToolDefinition, multiEditToolDefinition;
39290
39339
  var init_edit = __esm({
39291
39340
  "src/tools/edit.js"() {
39292
39341
  "use strict";
39293
39342
  import_ai3 = require("ai");
39294
- import_fs5 = require("fs");
39295
- import_path8 = require("path");
39296
39343
  import_fs6 = require("fs");
39344
+ import_path8 = require("path");
39345
+ import_fs7 = require("fs");
39297
39346
  init_path_validation();
39298
39347
  init_fuzzyMatch();
39299
39348
  init_symbolEdit();
@@ -39377,7 +39426,7 @@ Parameters:
39377
39426
  const relativePath = toRelativePath(resolvedPath2, workspaceRoot);
39378
39427
  return `Error editing file: Permission denied - ${relativePath} is outside allowed directories. Use a file path within the project workspace.`;
39379
39428
  }
39380
- if (!(0, import_fs6.existsSync)(resolvedPath2)) {
39429
+ if (!(0, import_fs7.existsSync)(resolvedPath2)) {
39381
39430
  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.`;
39382
39431
  }
39383
39432
  if (options.fileTracker && !options.fileTracker.isFileSeen(resolvedPath2)) {
@@ -39407,7 +39456,7 @@ Example: <extract><targets>${displayPath}</targets></extract>`;
39407
39456
  Example: <extract><targets>${displayPath}</targets></extract>`;
39408
39457
  }
39409
39458
  }
39410
- const content = await import_fs5.promises.readFile(resolvedPath2, "utf-8");
39459
+ const content = await import_fs6.promises.readFile(resolvedPath2, "utf-8");
39411
39460
  let matchTarget = old_string;
39412
39461
  let matchStrategy = "exact";
39413
39462
  if (!content.includes(old_string)) {
@@ -39439,7 +39488,7 @@ Example: <extract><targets>${displayPath}</targets></extract>`;
39439
39488
  if (newContent === content) {
39440
39489
  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.`;
39441
39490
  }
39442
- await import_fs5.promises.writeFile(resolvedPath2, newContent, "utf-8");
39491
+ await import_fs6.promises.writeFile(resolvedPath2, newContent, "utf-8");
39443
39492
  if (options.fileTracker) {
39444
39493
  await options.fileTracker.trackFileAfterWrite(resolvedPath2);
39445
39494
  options.fileTracker.recordTextEdit(resolvedPath2);
@@ -39510,13 +39559,13 @@ Important:
39510
39559
  const relativePath = toRelativePath(resolvedPath2, workspaceRoot);
39511
39560
  return `Error creating file: Permission denied - ${relativePath} is outside allowed directories. Use a file path within the project workspace.`;
39512
39561
  }
39513
- if ((0, import_fs6.existsSync)(resolvedPath2) && !overwrite) {
39562
+ if ((0, import_fs7.existsSync)(resolvedPath2) && !overwrite) {
39514
39563
  return `Error creating file: File already exists - ${file_path}. Use overwrite: true to replace it.`;
39515
39564
  }
39516
- const existed = (0, import_fs6.existsSync)(resolvedPath2);
39565
+ const existed = (0, import_fs7.existsSync)(resolvedPath2);
39517
39566
  const dir = (0, import_path8.dirname)(resolvedPath2);
39518
- await import_fs5.promises.mkdir(dir, { recursive: true });
39519
- await import_fs5.promises.writeFile(resolvedPath2, content, "utf-8");
39567
+ await import_fs6.promises.mkdir(dir, { recursive: true });
39568
+ await import_fs6.promises.writeFile(resolvedPath2, content, "utf-8");
39520
39569
  if (options.fileTracker) await options.fileTracker.trackFileAfterWrite(resolvedPath2);
39521
39570
  const action = existed && overwrite ? "overwrote" : "created";
39522
39571
  const bytes = Buffer.byteLength(content, "utf-8");
@@ -53822,22 +53871,22 @@ var init_esm3 = __esm({
53822
53871
  });
53823
53872
 
53824
53873
  // node_modules/path-scurry/dist/esm/index.js
53825
- var import_node_path, import_node_url, import_fs7, 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;
53874
+ var import_node_path, import_node_url, import_fs8, 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;
53826
53875
  var init_esm4 = __esm({
53827
53876
  "node_modules/path-scurry/dist/esm/index.js"() {
53828
53877
  init_esm2();
53829
53878
  import_node_path = require("node:path");
53830
53879
  import_node_url = require("node:url");
53831
- import_fs7 = require("fs");
53880
+ import_fs8 = require("fs");
53832
53881
  actualFS = __toESM(require("node:fs"), 1);
53833
53882
  import_promises = require("node:fs/promises");
53834
53883
  init_esm3();
53835
- realpathSync2 = import_fs7.realpathSync.native;
53884
+ realpathSync2 = import_fs8.realpathSync.native;
53836
53885
  defaultFS = {
53837
- lstatSync: import_fs7.lstatSync,
53838
- readdir: import_fs7.readdir,
53839
- readdirSync: import_fs7.readdirSync,
53840
- readlinkSync: import_fs7.readlinkSync,
53886
+ lstatSync: import_fs8.lstatSync,
53887
+ readdir: import_fs8.readdir,
53888
+ readdirSync: import_fs8.readdirSync,
53889
+ readlinkSync: import_fs8.readlinkSync,
53841
53890
  realpathSync: realpathSync2,
53842
53891
  promises: {
53843
53892
  lstat: import_promises.lstat,
@@ -57366,10 +57415,10 @@ async function listFilesByLevel(options) {
57366
57415
  maxFiles = 100,
57367
57416
  respectGitignore = true
57368
57417
  } = options;
57369
- if (!import_fs8.default.existsSync(directory)) {
57418
+ if (!import_fs9.default.existsSync(directory)) {
57370
57419
  throw new Error(`Directory does not exist: ${directory}`);
57371
57420
  }
57372
- const gitDirExists = import_fs8.default.existsSync(import_path9.default.join(directory, ".git"));
57421
+ const gitDirExists = import_fs9.default.existsSync(import_path9.default.join(directory, ".git"));
57373
57422
  if (gitDirExists && respectGitignore) {
57374
57423
  try {
57375
57424
  return await listFilesUsingGit(directory, maxFiles);
@@ -57400,7 +57449,7 @@ async function listFilesByLevelManually(directory, maxFiles, respectGitignore) {
57400
57449
  while (queue.length > 0 && result.length < maxFiles) {
57401
57450
  const { dir, level } = queue.shift();
57402
57451
  try {
57403
- const entries = import_fs8.default.readdirSync(dir, { withFileTypes: true });
57452
+ const entries = import_fs9.default.readdirSync(dir, { withFileTypes: true });
57404
57453
  const files = entries.filter((entry) => {
57405
57454
  const fullPath = import_path9.default.join(dir, entry.name);
57406
57455
  return getEntryTypeSync(entry, fullPath).isFile;
@@ -57431,11 +57480,11 @@ async function listFilesByLevelManually(directory, maxFiles, respectGitignore) {
57431
57480
  }
57432
57481
  function loadGitignorePatterns(directory) {
57433
57482
  const gitignorePath = import_path9.default.join(directory, ".gitignore");
57434
- if (!import_fs8.default.existsSync(gitignorePath)) {
57483
+ if (!import_fs9.default.existsSync(gitignorePath)) {
57435
57484
  return [];
57436
57485
  }
57437
57486
  try {
57438
- const content = import_fs8.default.readFileSync(gitignorePath, "utf8");
57487
+ const content = import_fs9.default.readFileSync(gitignorePath, "utf8");
57439
57488
  return content.split("\n").map((line) => line.trim()).filter((line) => line && !line.startsWith("#"));
57440
57489
  } catch (error2) {
57441
57490
  console.error(`Warning: Could not read .gitignore: ${error2.message}`);
@@ -57453,11 +57502,11 @@ function shouldIgnore(filePath, ignorePatterns) {
57453
57502
  }
57454
57503
  return false;
57455
57504
  }
57456
- var import_fs8, import_path9, import_util11, import_child_process7, execAsync3;
57505
+ var import_fs9, import_path9, import_util11, import_child_process7, execAsync3;
57457
57506
  var init_file_lister = __esm({
57458
57507
  "src/utils/file-lister.js"() {
57459
57508
  "use strict";
57460
- import_fs8 = __toESM(require("fs"), 1);
57509
+ import_fs9 = __toESM(require("fs"), 1);
57461
57510
  import_path9 = __toESM(require("path"), 1);
57462
57511
  import_util11 = require("util");
57463
57512
  import_child_process7 = require("child_process");
@@ -57757,11 +57806,11 @@ var init_fileTracker = __esm({
57757
57806
  });
57758
57807
 
57759
57808
  // src/agent/simpleTelemetry.js
57760
- var import_fs9, import_path11;
57809
+ var import_fs10, import_path11;
57761
57810
  var init_simpleTelemetry = __esm({
57762
57811
  "src/agent/simpleTelemetry.js"() {
57763
57812
  "use strict";
57764
- import_fs9 = require("fs");
57813
+ import_fs10 = require("fs");
57765
57814
  import_path11 = require("path");
57766
57815
  }
57767
57816
  });
@@ -57868,7 +57917,7 @@ function createWrappedTools(baseTools) {
57868
57917
  }
57869
57918
  return wrappedTools;
57870
57919
  }
57871
- var import_child_process8, import_util12, import_crypto4, import_events, import_fs10, import_fs11, import_path12, toolCallEmitter, activeToolExecutions, wrapToolWithEmitter, listFilesTool, searchFilesTool, listFilesToolInstance, searchFilesToolInstance;
57920
+ var import_child_process8, import_util12, import_crypto4, import_events, import_fs11, import_fs12, import_path12, toolCallEmitter, activeToolExecutions, wrapToolWithEmitter, listFilesTool, searchFilesTool, listFilesToolInstance, searchFilesToolInstance;
57872
57921
  var init_probeTool = __esm({
57873
57922
  "src/agent/probeTool.js"() {
57874
57923
  "use strict";
@@ -57877,8 +57926,8 @@ var init_probeTool = __esm({
57877
57926
  import_util12 = require("util");
57878
57927
  import_crypto4 = require("crypto");
57879
57928
  import_events = require("events");
57880
- import_fs10 = __toESM(require("fs"), 1);
57881
- import_fs11 = require("fs");
57929
+ import_fs11 = __toESM(require("fs"), 1);
57930
+ import_fs12 = require("fs");
57882
57931
  import_path12 = __toESM(require("path"), 1);
57883
57932
  init_esm5();
57884
57933
  init_symlink_utils();
@@ -57987,7 +58036,7 @@ var init_probeTool = __esm({
57987
58036
  console.log(`[DEBUG] Listing files in directory: ${targetDir}`);
57988
58037
  }
57989
58038
  try {
57990
- const files = await import_fs11.promises.readdir(targetDir, { withFileTypes: true });
58039
+ const files = await import_fs12.promises.readdir(targetDir, { withFileTypes: true });
57991
58040
  const formatSize = (size) => {
57992
58041
  if (size < 1024) return `${size}B`;
57993
58042
  if (size < 1024 * 1024) return `${(size / 1024).toFixed(1)}K`;
@@ -97834,11 +97883,11 @@ function loadMCPConfigurationFromPath(configPath) {
97834
97883
  if (!configPath) {
97835
97884
  throw new Error("Config path is required");
97836
97885
  }
97837
- if (!(0, import_fs12.existsSync)(configPath)) {
97886
+ if (!(0, import_fs13.existsSync)(configPath)) {
97838
97887
  throw new Error(`MCP configuration file not found: ${configPath}`);
97839
97888
  }
97840
97889
  try {
97841
- const content = (0, import_fs12.readFileSync)(configPath, "utf8");
97890
+ const content = (0, import_fs13.readFileSync)(configPath, "utf8");
97842
97891
  const config = JSON.parse(content);
97843
97892
  if (process.env.DEBUG === "1" || process.env.DEBUG_MCP === "1") {
97844
97893
  console.error(`[MCP DEBUG] Loaded configuration from: ${configPath}`);
@@ -97863,9 +97912,9 @@ function loadMCPConfiguration() {
97863
97912
  ].filter(Boolean);
97864
97913
  let config = null;
97865
97914
  for (const configPath of configPaths) {
97866
- if ((0, import_fs12.existsSync)(configPath)) {
97915
+ if ((0, import_fs13.existsSync)(configPath)) {
97867
97916
  try {
97868
- const content = (0, import_fs12.readFileSync)(configPath, "utf8");
97917
+ const content = (0, import_fs13.readFileSync)(configPath, "utf8");
97869
97918
  config = JSON.parse(content);
97870
97919
  if (process.env.DEBUG === "1" || process.env.DEBUG_MCP === "1") {
97871
97920
  console.error(`[MCP DEBUG] Loaded configuration from: ${configPath}`);
@@ -97986,11 +98035,11 @@ function parseEnabledServers(config) {
97986
98035
  }
97987
98036
  return servers;
97988
98037
  }
97989
- var import_fs12, import_path13, import_os3, import_url4, __filename4, __dirname5, DEFAULT_TIMEOUT, MAX_TIMEOUT, DEFAULT_CONFIG;
98038
+ var import_fs13, import_path13, import_os3, import_url4, __filename4, __dirname5, DEFAULT_TIMEOUT, MAX_TIMEOUT, DEFAULT_CONFIG;
97990
98039
  var init_config = __esm({
97991
98040
  "src/agent/mcp/config.js"() {
97992
98041
  "use strict";
97993
- import_fs12 = require("fs");
98042
+ import_fs13 = require("fs");
97994
98043
  import_path13 = require("path");
97995
98044
  import_os3 = require("os");
97996
98045
  import_url4 = require("url");
@@ -106085,11 +106134,11 @@ function isSafeEntryName(name14) {
106085
106134
  if (name14.includes("\0")) return false;
106086
106135
  return !name14.includes("/") && !name14.includes("\\");
106087
106136
  }
106088
- var import_fs13, import_promises3, import_path15, DEFAULT_SKILL_DIRS, SKILL_FILE_NAME, SkillRegistry;
106137
+ var import_fs14, import_promises3, import_path15, DEFAULT_SKILL_DIRS, SKILL_FILE_NAME, SkillRegistry;
106089
106138
  var init_registry = __esm({
106090
106139
  "src/agent/skills/registry.js"() {
106091
106140
  "use strict";
106092
- import_fs13 = require("fs");
106141
+ import_fs14 = require("fs");
106093
106142
  import_promises3 = require("fs/promises");
106094
106143
  import_path15 = require("path");
106095
106144
  init_parser7();
@@ -106164,7 +106213,7 @@ var init_registry = __esm({
106164
106213
  return resolvedReal;
106165
106214
  }
106166
106215
  async _scanSkillDir(dirPath) {
106167
- if (!(0, import_fs13.existsSync)(dirPath)) return [];
106216
+ if (!(0, import_fs14.existsSync)(dirPath)) return [];
106168
106217
  let entries;
106169
106218
  try {
106170
106219
  entries = await (0, import_promises3.readdir)(dirPath, { withFileTypes: true });
@@ -106204,7 +106253,7 @@ var init_registry = __esm({
106204
106253
  }
106205
106254
  continue;
106206
106255
  }
106207
- if (!(0, import_fs13.existsSync)(skillFilePath)) continue;
106256
+ if (!(0, import_fs14.existsSync)(skillFilePath)) continue;
106208
106257
  const { skill, error: error2 } = await parseSkillFile(skillFilePath, entry.name);
106209
106258
  if (!skill) {
106210
106259
  if (error2) {
@@ -108712,7 +108761,7 @@ __export(ProbeAgent_exports, {
108712
108761
  ProbeAgent: () => ProbeAgent
108713
108762
  });
108714
108763
  module.exports = __toCommonJS(ProbeAgent_exports);
108715
- var import_dotenv2, import_anthropic2, import_openai2, import_google2, import_ai6, import_crypto9, import_events4, import_fs14, import_promises6, import_path18, ENGINE_ACTIVITY_TIMEOUT_DEFAULT, ENGINE_ACTIVITY_TIMEOUT_MIN, ENGINE_ACTIVITY_TIMEOUT_MAX, MAX_TOOL_ITERATIONS, MAX_HISTORY_MESSAGES, MAX_IMAGE_FILE_SIZE, ProbeAgent;
108764
+ var import_dotenv2, import_anthropic2, import_openai2, import_google2, import_ai6, import_crypto9, import_events4, import_fs15, import_promises6, import_path18, ENGINE_ACTIVITY_TIMEOUT_DEFAULT, ENGINE_ACTIVITY_TIMEOUT_MIN, ENGINE_ACTIVITY_TIMEOUT_MAX, MAX_TOOL_ITERATIONS, MAX_HISTORY_MESSAGES, MAX_IMAGE_FILE_SIZE, ProbeAgent;
108716
108765
  var init_ProbeAgent = __esm({
108717
108766
  "src/agent/ProbeAgent.js"() {
108718
108767
  import_dotenv2 = __toESM(require_main(), 1);
@@ -108723,7 +108772,7 @@ var init_ProbeAgent = __esm({
108723
108772
  import_ai6 = require("ai");
108724
108773
  import_crypto9 = require("crypto");
108725
108774
  import_events4 = require("events");
108726
- import_fs14 = require("fs");
108775
+ import_fs15 = require("fs");
108727
108776
  import_promises6 = require("fs/promises");
108728
108777
  import_path18 = require("path");
108729
108778
  init_tokenCounter();
@@ -110730,7 +110779,7 @@ var init_ProbeAgent = __esm({
110730
110779
  } else {
110731
110780
  guidanceCandidates = ["agents.md", "claude.md"];
110732
110781
  }
110733
- if (!(0, import_fs14.existsSync)(rootDirectory)) {
110782
+ if (!(0, import_fs15.existsSync)(rootDirectory)) {
110734
110783
  this._architectureContextLoaded = true;
110735
110784
  return null;
110736
110785
  }
@@ -111502,9 +111551,10 @@ You are working with a workspace. Available paths: ${workspaceDesc}
111502
111551
  }
111503
111552
  if (completionAttempted && this.completionPrompt && !options._completionPromptProcessed) {
111504
111553
  if (this.debug) {
111505
- console.log("[DEBUG] Running completion prompt for post-completion validation/review...");
111554
+ console.log("[DEBUG] Running completion prompt as continuation of current session...");
111506
111555
  }
111507
111556
  try {
111557
+ const originalResult = finalResult;
111508
111558
  if (this.tracer) {
111509
111559
  this.tracer.recordEvent("completion_prompt.started", {
111510
111560
  "completion_prompt.original_result_length": finalResult?.length || 0
@@ -111517,24 +111567,66 @@ Here is the result to review:
111517
111567
  ${finalResult}
111518
111568
  </result>
111519
111569
 
111520
- After reviewing, provide your final answer using attempt_completion.`;
111521
- const savedOutputItems = this._outputBuffer ? [...this._outputBuffer.items] : [];
111522
- const savedExtractedBlocks = this._extractedRawBlocks ? [...this._extractedRawBlocks] : [];
111523
- const completionResult2 = await this.answer(completionPromptMessage, [], {
111524
- ...options,
111525
- _completionPromptProcessed: true
111526
- });
111527
- if (this._outputBuffer) {
111528
- this._outputBuffer.items = savedOutputItems;
111570
+ Double-check your response based on the criteria above. If everything looks good, respond with your previous answer exactly as-is using attempt_completion. If something needs to be fixed or is missing, do it now, then respond with the COMPLETE updated answer (everything you did in total, not just the fix) using attempt_completion.`;
111571
+ currentMessages.push({ role: "user", content: completionPromptMessage });
111572
+ completionResult = null;
111573
+ completionAttempted = false;
111574
+ const completionMaxIterations = 5;
111575
+ const completionStreamOptions = {
111576
+ model: this.provider ? this.provider(this.model) : this.model,
111577
+ messages: this.prepareMessagesWithImages(currentMessages),
111578
+ tools: tools2,
111579
+ stopWhen: (0, import_ai6.stepCountIs)(completionMaxIterations),
111580
+ maxTokens: maxResponseTokens,
111581
+ temperature: 0.3,
111582
+ onStepFinish: ({ toolResults, text, finishReason, usage }) => {
111583
+ if (usage) {
111584
+ this.tokenCounter.recordUsage(usage);
111585
+ }
111586
+ if (options.onStream && text) {
111587
+ options.onStream(text);
111588
+ }
111589
+ if (this.debug) {
111590
+ console.log(`[DEBUG] Completion prompt step finished (reason: ${finishReason}, tools: ${toolResults?.length || 0})`);
111591
+ }
111592
+ }
111593
+ };
111594
+ const providerOpts = this._buildThinkingProviderOptions(maxResponseTokens);
111595
+ if (providerOpts) {
111596
+ completionStreamOptions.providerOptions = providerOpts;
111597
+ }
111598
+ const cpResult = await this.streamTextWithRetryAndFallback(completionStreamOptions);
111599
+ const cpFinalText = await cpResult.text;
111600
+ const cpUsage = await cpResult.usage;
111601
+ if (cpUsage) {
111602
+ this.tokenCounter.recordUsage(cpUsage, cpResult.experimental_providerMetadata);
111603
+ }
111604
+ const cpMessages = await cpResult.response?.messages;
111605
+ if (cpMessages) {
111606
+ for (const msg of cpMessages) {
111607
+ currentMessages.push(msg);
111608
+ }
111609
+ }
111610
+ if (completionResult) {
111611
+ finalResult = completionResult;
111612
+ completionAttempted = true;
111613
+ } else if (cpFinalText && cpFinalText.trim().length > 0) {
111614
+ finalResult = cpFinalText;
111615
+ completionAttempted = true;
111616
+ } else {
111617
+ finalResult = originalResult;
111618
+ completionAttempted = true;
111619
+ if (this.debug) {
111620
+ console.log("[DEBUG] Completion prompt returned empty result, keeping original.");
111621
+ }
111529
111622
  }
111530
- this._extractedRawBlocks = savedExtractedBlocks;
111531
- finalResult = completionResult2;
111532
111623
  if (this.debug) {
111533
- console.log(`[DEBUG] Completion prompt finished. New result length: ${finalResult?.length || 0}`);
111624
+ console.log(`[DEBUG] Completion prompt finished. Final result length: ${finalResult?.length || 0}`);
111534
111625
  }
111535
111626
  if (this.tracer) {
111536
111627
  this.tracer.recordEvent("completion_prompt.completed", {
111537
- "completion_prompt.final_result_length": finalResult?.length || 0
111628
+ "completion_prompt.final_result_length": finalResult?.length || 0,
111629
+ "completion_prompt.used_original": finalResult === originalResult
111538
111630
  });
111539
111631
  }
111540
111632
  } catch (error2) {