@probelabs/probe 0.6.0-rc172 → 0.6.0-rc174

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.
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Symlink resolution utilities for the probe package
3
+ * @module utils/symlink-utils
4
+ */
5
+
6
+ import fs from 'fs';
7
+ import { promises as fsPromises } from 'fs';
8
+
9
+ /**
10
+ * Get entry type following symlinks (async version)
11
+ *
12
+ * Uses fs.stat() which follows symlinks to get the actual target type.
13
+ * Falls back to dirent type if stat fails (e.g., broken symlink).
14
+ *
15
+ * @param {fs.Dirent} entry - Directory entry from readdir
16
+ * @param {string} fullPath - Full path to the entry
17
+ * @returns {Promise<{isFile: boolean, isDirectory: boolean, size: number}>}
18
+ */
19
+ export async function getEntryType(entry, fullPath) {
20
+ try {
21
+ const stats = await fsPromises.stat(fullPath);
22
+ return {
23
+ isFile: stats.isFile(),
24
+ isDirectory: stats.isDirectory(),
25
+ size: stats.size
26
+ };
27
+ } catch {
28
+ // Fall back to dirent type if stat fails (e.g., broken symlink)
29
+ return {
30
+ isFile: entry.isFile(),
31
+ isDirectory: entry.isDirectory(),
32
+ size: 0
33
+ };
34
+ }
35
+ }
36
+
37
+ /**
38
+ * Get entry type following symlinks (sync version)
39
+ *
40
+ * Uses fs.statSync() which follows symlinks to get the actual target type.
41
+ * Falls back to dirent type if stat fails (e.g., broken symlink).
42
+ *
43
+ * @param {fs.Dirent} entry - Directory entry from readdir
44
+ * @param {string} fullPath - Full path to the entry
45
+ * @returns {{isFile: boolean, isDirectory: boolean, size: number}}
46
+ */
47
+ export function getEntryTypeSync(entry, fullPath) {
48
+ try {
49
+ const stats = fs.statSync(fullPath);
50
+ return {
51
+ isFile: stats.isFile(),
52
+ isDirectory: stats.isDirectory(),
53
+ size: stats.size
54
+ };
55
+ } catch {
56
+ // Fall back to dirent type if stat fails (e.g., broken symlink)
57
+ return {
58
+ isFile: entry.isFile(),
59
+ isDirectory: entry.isDirectory(),
60
+ size: 0
61
+ };
62
+ }
63
+ }
@@ -104,7 +104,7 @@ var require_package = __commonJS({
104
104
  // node_modules/dotenv/lib/main.js
105
105
  var require_main = __commonJS({
106
106
  "node_modules/dotenv/lib/main.js"(exports2, module2) {
107
- var fs8 = require("fs");
107
+ var fs9 = require("fs");
108
108
  var path8 = require("path");
109
109
  var os4 = require("os");
110
110
  var crypto2 = require("crypto");
@@ -213,7 +213,7 @@ var require_main = __commonJS({
213
213
  if (options && options.path && options.path.length > 0) {
214
214
  if (Array.isArray(options.path)) {
215
215
  for (const filepath of options.path) {
216
- if (fs8.existsSync(filepath)) {
216
+ if (fs9.existsSync(filepath)) {
217
217
  possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
218
218
  }
219
219
  }
@@ -223,7 +223,7 @@ var require_main = __commonJS({
223
223
  } else {
224
224
  possibleVaultPath = path8.resolve(process.cwd(), ".env.vault");
225
225
  }
226
- if (fs8.existsSync(possibleVaultPath)) {
226
+ if (fs9.existsSync(possibleVaultPath)) {
227
227
  return possibleVaultPath;
228
228
  }
229
229
  return null;
@@ -272,7 +272,7 @@ var require_main = __commonJS({
272
272
  const parsedAll = {};
273
273
  for (const path9 of optionPaths) {
274
274
  try {
275
- const parsed = DotenvModule.parse(fs8.readFileSync(path9, { encoding }));
275
+ const parsed = DotenvModule.parse(fs9.readFileSync(path9, { encoding }));
276
276
  DotenvModule.populate(parsedAll, parsed, options);
277
277
  } catch (e4) {
278
278
  if (debug) {
@@ -19036,7 +19036,7 @@ var require_dist_cjs56 = __commonJS({
19036
19036
  var httpAuthSchemes = (init_httpAuthSchemes2(), __toCommonJS(httpAuthSchemes_exports));
19037
19037
  var propertyProvider = require_dist_cjs24();
19038
19038
  var sharedIniFileLoader = require_dist_cjs42();
19039
- var fs8 = require("fs");
19039
+ var fs9 = require("fs");
19040
19040
  var fromEnvSigningName = ({ logger: logger2, signingName } = {}) => async () => {
19041
19041
  logger2?.debug?.("@aws-sdk/token-providers - fromEnvSigningName");
19042
19042
  if (!signingName) {
@@ -19082,7 +19082,7 @@ var require_dist_cjs56 = __commonJS({
19082
19082
  throw new propertyProvider.TokenProviderError(`Value not present for '${key}' in SSO Token${forRefresh ? ". Cannot refresh" : ""}. ${REFRESH_MESSAGE}`, false);
19083
19083
  }
19084
19084
  };
19085
- var { writeFile } = fs8.promises;
19085
+ var { writeFile } = fs9.promises;
19086
19086
  var writeSSOTokenToFile = (id, ssoToken) => {
19087
19087
  const tokenFilepath = sharedIniFileLoader.getSSOTokenFilepath(id);
19088
19088
  const tokenString = JSON.stringify(ssoToken, null, 2);
@@ -28312,6 +28312,48 @@ var init_directory_resolver = __esm({
28312
28312
  }
28313
28313
  });
28314
28314
 
28315
+ // src/utils/symlink-utils.js
28316
+ async function getEntryType(entry, fullPath) {
28317
+ try {
28318
+ const stats = await import_fs2.promises.stat(fullPath);
28319
+ return {
28320
+ isFile: stats.isFile(),
28321
+ isDirectory: stats.isDirectory(),
28322
+ size: stats.size
28323
+ };
28324
+ } catch {
28325
+ return {
28326
+ isFile: entry.isFile(),
28327
+ isDirectory: entry.isDirectory(),
28328
+ size: 0
28329
+ };
28330
+ }
28331
+ }
28332
+ function getEntryTypeSync(entry, fullPath) {
28333
+ try {
28334
+ const stats = import_fs.default.statSync(fullPath);
28335
+ return {
28336
+ isFile: stats.isFile(),
28337
+ isDirectory: stats.isDirectory(),
28338
+ size: stats.size
28339
+ };
28340
+ } catch {
28341
+ return {
28342
+ isFile: entry.isFile(),
28343
+ isDirectory: entry.isDirectory(),
28344
+ size: 0
28345
+ };
28346
+ }
28347
+ }
28348
+ var import_fs, import_fs2;
28349
+ var init_symlink_utils = __esm({
28350
+ "src/utils/symlink-utils.js"() {
28351
+ "use strict";
28352
+ import_fs = __toESM(require("fs"), 1);
28353
+ import_fs2 = require("fs");
28354
+ }
28355
+ });
28356
+
28315
28357
  // src/downloader.js
28316
28358
  function sanitizeError(err) {
28317
28359
  try {
@@ -28826,10 +28868,11 @@ async function extractBinary(assetPath, outputDir) {
28826
28868
  const entries = await import_fs_extra2.default.readdir(dir, { withFileTypes: true });
28827
28869
  for (const entry of entries) {
28828
28870
  const fullPath = import_path2.default.join(dir, entry.name);
28829
- if (entry.isDirectory()) {
28871
+ const entryType = await getEntryType(entry, fullPath);
28872
+ if (entryType.isDirectory) {
28830
28873
  const result = await findBinary(fullPath);
28831
28874
  if (result) return result;
28832
- } else if (entry.isFile()) {
28875
+ } else if (entryType.isFile) {
28833
28876
  if (entry.name === binaryName || entry.name === BINARY_NAME || isWindows && entry.name.endsWith(".exe")) {
28834
28877
  return fullPath;
28835
28878
  }
@@ -29042,6 +29085,7 @@ var init_downloader = __esm({
29042
29085
  import_url2 = require("url");
29043
29086
  init_utils2();
29044
29087
  init_directory_resolver();
29088
+ init_symlink_utils();
29045
29089
  exec = (0, import_util3.promisify)(import_child_process.exec);
29046
29090
  REPO_OWNER = "probelabs";
29047
29091
  REPO_NAME = "probe";
@@ -35368,7 +35412,7 @@ async function executeBashCommand(command, options = {}) {
35368
35412
  let cwd = workingDirectory;
35369
35413
  try {
35370
35414
  cwd = (0, import_path4.resolve)(cwd);
35371
- if (!(0, import_fs.existsSync)(cwd)) {
35415
+ if (!(0, import_fs3.existsSync)(cwd)) {
35372
35416
  throw new Error(`Working directory does not exist: ${cwd}`);
35373
35417
  }
35374
35418
  } catch (error2) {
@@ -35580,7 +35624,7 @@ function validateExecutionOptions(options = {}) {
35580
35624
  if (options.workingDirectory) {
35581
35625
  if (typeof options.workingDirectory !== "string") {
35582
35626
  errors.push("workingDirectory must be a string");
35583
- } else if (!(0, import_fs.existsSync)(options.workingDirectory)) {
35627
+ } else if (!(0, import_fs3.existsSync)(options.workingDirectory)) {
35584
35628
  errors.push(`workingDirectory does not exist: ${options.workingDirectory}`);
35585
35629
  }
35586
35630
  }
@@ -35593,13 +35637,13 @@ function validateExecutionOptions(options = {}) {
35593
35637
  warnings
35594
35638
  };
35595
35639
  }
35596
- var import_child_process6, import_path4, import_fs;
35640
+ var import_child_process6, import_path4, import_fs3;
35597
35641
  var init_bashExecutor = __esm({
35598
35642
  "src/agent/bashExecutor.js"() {
35599
35643
  "use strict";
35600
35644
  import_child_process6 = require("child_process");
35601
35645
  import_path4 = require("path");
35602
- import_fs = require("fs");
35646
+ import_fs3 = require("fs");
35603
35647
  init_bashCommandUtils();
35604
35648
  }
35605
35649
  });
@@ -35795,14 +35839,14 @@ function parseFileToolOptions(options = {}) {
35795
35839
  defaultPath: options.defaultPath
35796
35840
  };
35797
35841
  }
35798
- var import_ai3, import_fs2, import_path6, import_fs3, editTool, createTool, editDescription, createDescription, editToolDefinition, createToolDefinition;
35842
+ var import_ai3, import_fs4, import_path6, import_fs5, editTool, createTool, editDescription, createDescription, editToolDefinition, createToolDefinition;
35799
35843
  var init_edit = __esm({
35800
35844
  "src/tools/edit.js"() {
35801
35845
  "use strict";
35802
35846
  import_ai3 = require("ai");
35803
- import_fs2 = require("fs");
35847
+ import_fs4 = require("fs");
35804
35848
  import_path6 = require("path");
35805
- import_fs3 = require("fs");
35849
+ import_fs5 = require("fs");
35806
35850
  editTool = (options = {}) => {
35807
35851
  const { debug, allowedFolders, defaultPath } = parseFileToolOptions(options);
35808
35852
  return (0, import_ai3.tool)({
@@ -35862,10 +35906,10 @@ Important:
35862
35906
  if (!isPathAllowed(resolvedPath2, allowedFolders)) {
35863
35907
  return `Error editing file: Permission denied - ${file_path} is outside allowed directories`;
35864
35908
  }
35865
- if (!(0, import_fs3.existsSync)(resolvedPath2)) {
35909
+ if (!(0, import_fs5.existsSync)(resolvedPath2)) {
35866
35910
  return `Error editing file: File not found - ${file_path}`;
35867
35911
  }
35868
- const content = await import_fs2.promises.readFile(resolvedPath2, "utf-8");
35912
+ const content = await import_fs4.promises.readFile(resolvedPath2, "utf-8");
35869
35913
  if (!content.includes(old_string)) {
35870
35914
  return `Error editing file: String not found - the specified old_string was not found in ${file_path}`;
35871
35915
  }
@@ -35882,7 +35926,7 @@ Important:
35882
35926
  if (newContent === content) {
35883
35927
  return `Error editing file: No changes made - old_string and new_string might be the same`;
35884
35928
  }
35885
- await import_fs2.promises.writeFile(resolvedPath2, newContent, "utf-8");
35929
+ await import_fs4.promises.writeFile(resolvedPath2, newContent, "utf-8");
35886
35930
  const replacedCount = replace_all ? occurrences : 1;
35887
35931
  if (debug) {
35888
35932
  console.error(`[Edit] Successfully edited ${resolvedPath2}, replaced ${replacedCount} occurrence(s)`);
@@ -35946,13 +35990,13 @@ Important:
35946
35990
  if (!isPathAllowed(resolvedPath2, allowedFolders)) {
35947
35991
  return `Error creating file: Permission denied - ${file_path} is outside allowed directories`;
35948
35992
  }
35949
- if ((0, import_fs3.existsSync)(resolvedPath2) && !overwrite) {
35993
+ if ((0, import_fs5.existsSync)(resolvedPath2) && !overwrite) {
35950
35994
  return `Error creating file: File already exists - ${file_path}. Use overwrite: true to replace it.`;
35951
35995
  }
35952
35996
  const dir = (0, import_path6.dirname)(resolvedPath2);
35953
- await import_fs2.promises.mkdir(dir, { recursive: true });
35954
- await import_fs2.promises.writeFile(resolvedPath2, content, "utf-8");
35955
- const action = (0, import_fs3.existsSync)(resolvedPath2) && overwrite ? "overwrote" : "created";
35997
+ await import_fs4.promises.mkdir(dir, { recursive: true });
35998
+ await import_fs4.promises.writeFile(resolvedPath2, content, "utf-8");
35999
+ const action = (0, import_fs5.existsSync)(resolvedPath2) && overwrite ? "overwrote" : "created";
35956
36000
  const bytes = Buffer.byteLength(content, "utf-8");
35957
36001
  if (debug) {
35958
36002
  console.error(`[Create] Successfully ${action} ${resolvedPath2}`);
@@ -36227,10 +36271,10 @@ async function listFilesByLevel(options) {
36227
36271
  maxFiles = 100,
36228
36272
  respectGitignore = true
36229
36273
  } = options;
36230
- if (!import_fs4.default.existsSync(directory)) {
36274
+ if (!import_fs6.default.existsSync(directory)) {
36231
36275
  throw new Error(`Directory does not exist: ${directory}`);
36232
36276
  }
36233
- const gitDirExists = import_fs4.default.existsSync(import_path7.default.join(directory, ".git"));
36277
+ const gitDirExists = import_fs6.default.existsSync(import_path7.default.join(directory, ".git"));
36234
36278
  if (gitDirExists && respectGitignore) {
36235
36279
  try {
36236
36280
  return await listFilesUsingGit(directory, maxFiles);
@@ -36261,8 +36305,11 @@ async function listFilesByLevelManually(directory, maxFiles, respectGitignore) {
36261
36305
  while (queue.length > 0 && result.length < maxFiles) {
36262
36306
  const { dir, level } = queue.shift();
36263
36307
  try {
36264
- const entries = import_fs4.default.readdirSync(dir, { withFileTypes: true });
36265
- const files = entries.filter((entry) => entry.isFile());
36308
+ const entries = import_fs6.default.readdirSync(dir, { withFileTypes: true });
36309
+ const files = entries.filter((entry) => {
36310
+ const fullPath = import_path7.default.join(dir, entry.name);
36311
+ return getEntryTypeSync(entry, fullPath).isFile;
36312
+ });
36266
36313
  for (const file of files) {
36267
36314
  if (result.length >= maxFiles) break;
36268
36315
  const filePath = import_path7.default.join(dir, file.name);
@@ -36270,7 +36317,10 @@ async function listFilesByLevelManually(directory, maxFiles, respectGitignore) {
36270
36317
  if (shouldIgnore(relativePath, ignorePatterns)) continue;
36271
36318
  result.push(relativePath);
36272
36319
  }
36273
- const dirs = entries.filter((entry) => entry.isDirectory());
36320
+ const dirs = entries.filter((entry) => {
36321
+ const fullPath = import_path7.default.join(dir, entry.name);
36322
+ return getEntryTypeSync(entry, fullPath).isDirectory;
36323
+ });
36274
36324
  for (const subdir of dirs) {
36275
36325
  const subdirPath = import_path7.default.join(dir, subdir.name);
36276
36326
  const relativeSubdirPath = import_path7.default.relative(directory, subdirPath);
@@ -36286,11 +36336,11 @@ async function listFilesByLevelManually(directory, maxFiles, respectGitignore) {
36286
36336
  }
36287
36337
  function loadGitignorePatterns(directory) {
36288
36338
  const gitignorePath = import_path7.default.join(directory, ".gitignore");
36289
- if (!import_fs4.default.existsSync(gitignorePath)) {
36339
+ if (!import_fs6.default.existsSync(gitignorePath)) {
36290
36340
  return [];
36291
36341
  }
36292
36342
  try {
36293
- const content = import_fs4.default.readFileSync(gitignorePath, "utf8");
36343
+ const content = import_fs6.default.readFileSync(gitignorePath, "utf8");
36294
36344
  return content.split("\n").map((line) => line.trim()).filter((line) => line && !line.startsWith("#"));
36295
36345
  } catch (error2) {
36296
36346
  console.error(`Warning: Could not read .gitignore: ${error2.message}`);
@@ -36308,24 +36358,25 @@ function shouldIgnore(filePath, ignorePatterns) {
36308
36358
  }
36309
36359
  return false;
36310
36360
  }
36311
- var import_fs4, import_path7, import_util11, import_child_process7, execAsync3;
36361
+ var import_fs6, import_path7, import_util11, import_child_process7, execAsync3;
36312
36362
  var init_file_lister = __esm({
36313
36363
  "src/utils/file-lister.js"() {
36314
36364
  "use strict";
36315
- import_fs4 = __toESM(require("fs"), 1);
36365
+ import_fs6 = __toESM(require("fs"), 1);
36316
36366
  import_path7 = __toESM(require("path"), 1);
36317
36367
  import_util11 = require("util");
36318
36368
  import_child_process7 = require("child_process");
36369
+ init_symlink_utils();
36319
36370
  execAsync3 = (0, import_util11.promisify)(import_child_process7.exec);
36320
36371
  }
36321
36372
  });
36322
36373
 
36323
36374
  // src/agent/simpleTelemetry.js
36324
- var import_fs5, import_path8;
36375
+ var import_fs7, import_path8;
36325
36376
  var init_simpleTelemetry = __esm({
36326
36377
  "src/agent/simpleTelemetry.js"() {
36327
36378
  "use strict";
36328
- import_fs5 = require("fs");
36379
+ import_fs7 = require("fs");
36329
36380
  import_path8 = require("path");
36330
36381
  }
36331
36382
  });
@@ -40163,22 +40214,22 @@ var init_esm3 = __esm({
40163
40214
  });
40164
40215
 
40165
40216
  // node_modules/path-scurry/dist/esm/index.js
40166
- var import_node_path, import_node_url, import_fs6, actualFS, import_promises, realpathSync, defaultFS, fsFromOption, uncDriveRegexp, uncToDrive, eitherSep, UNKNOWN, IFIFO, IFCHR, IFDIR, IFBLK, IFREG, IFLNK, IFSOCK, IFMT, IFMT_UNKNOWN, READDIR_CALLED, LSTAT_CALLED, ENOTDIR, ENOENT, ENOREADLINK, ENOREALPATH, ENOCHILD, TYPEMASK, entToType, normalizeCache, normalize, normalizeNocaseCache, normalizeNocase, ResolveCache, ChildrenCache, setAsCwd, PathBase, PathWin32, PathPosix, PathScurryBase, PathScurryWin32, PathScurryPosix, PathScurryDarwin, Path, PathScurry;
40217
+ var import_node_path, import_node_url, import_fs8, actualFS, import_promises, realpathSync, defaultFS, fsFromOption, uncDriveRegexp, uncToDrive, eitherSep, UNKNOWN, IFIFO, IFCHR, IFDIR, IFBLK, IFREG, IFLNK, IFSOCK, IFMT, IFMT_UNKNOWN, READDIR_CALLED, LSTAT_CALLED, ENOTDIR, ENOENT, ENOREADLINK, ENOREALPATH, ENOCHILD, TYPEMASK, entToType, normalizeCache, normalize, normalizeNocaseCache, normalizeNocase, ResolveCache, ChildrenCache, setAsCwd, PathBase, PathWin32, PathPosix, PathScurryBase, PathScurryWin32, PathScurryPosix, PathScurryDarwin, Path, PathScurry;
40167
40218
  var init_esm4 = __esm({
40168
40219
  "node_modules/path-scurry/dist/esm/index.js"() {
40169
40220
  init_esm2();
40170
40221
  import_node_path = require("node:path");
40171
40222
  import_node_url = require("node:url");
40172
- import_fs6 = require("fs");
40223
+ import_fs8 = require("fs");
40173
40224
  actualFS = __toESM(require("node:fs"), 1);
40174
40225
  import_promises = require("node:fs/promises");
40175
40226
  init_esm3();
40176
- realpathSync = import_fs6.realpathSync.native;
40227
+ realpathSync = import_fs8.realpathSync.native;
40177
40228
  defaultFS = {
40178
- lstatSync: import_fs6.lstatSync,
40179
- readdir: import_fs6.readdir,
40180
- readdirSync: import_fs6.readdirSync,
40181
- readlinkSync: import_fs6.readlinkSync,
40229
+ lstatSync: import_fs8.lstatSync,
40230
+ readdir: import_fs8.readdir,
40231
+ readdirSync: import_fs8.readdirSync,
40232
+ readlinkSync: import_fs8.readlinkSync,
40182
40233
  realpathSync,
40183
40234
  promises: {
40184
40235
  lstat: import_promises.lstat,
@@ -41289,8 +41340,8 @@ var init_esm4 = __esm({
41289
41340
  *
41290
41341
  * @internal
41291
41342
  */
41292
- constructor(cwd = process.cwd(), pathImpl, sep4, { nocase, childrenCacheSize = 16 * 1024, fs: fs8 = defaultFS } = {}) {
41293
- this.#fs = fsFromOption(fs8);
41343
+ constructor(cwd = process.cwd(), pathImpl, sep4, { nocase, childrenCacheSize = 16 * 1024, fs: fs9 = defaultFS } = {}) {
41344
+ this.#fs = fsFromOption(fs9);
41294
41345
  if (cwd instanceof URL || cwd.startsWith("file://")) {
41295
41346
  cwd = (0, import_node_url.fileURLToPath)(cwd);
41296
41347
  }
@@ -41848,8 +41899,8 @@ var init_esm4 = __esm({
41848
41899
  /**
41849
41900
  * @internal
41850
41901
  */
41851
- newRoot(fs8) {
41852
- return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs8 });
41902
+ newRoot(fs9) {
41903
+ return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs9 });
41853
41904
  }
41854
41905
  /**
41855
41906
  * Return true if the provided path string is an absolute path
@@ -41877,8 +41928,8 @@ var init_esm4 = __esm({
41877
41928
  /**
41878
41929
  * @internal
41879
41930
  */
41880
- newRoot(fs8) {
41881
- return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs8 });
41931
+ newRoot(fs9) {
41932
+ return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs9 });
41882
41933
  }
41883
41934
  /**
41884
41935
  * Return true if the provided path string is an absolute path
@@ -43087,7 +43138,7 @@ function createWrappedTools(baseTools) {
43087
43138
  }
43088
43139
  return wrappedTools;
43089
43140
  }
43090
- var import_child_process8, import_util12, import_crypto3, import_events, import_fs7, import_fs8, import_path9, toolCallEmitter, activeToolExecutions, wrapToolWithEmitter, listFilesTool, searchFilesTool, listFilesToolInstance, searchFilesToolInstance;
43141
+ var import_child_process8, import_util12, import_crypto3, import_events, import_fs9, import_fs10, import_path9, toolCallEmitter, activeToolExecutions, wrapToolWithEmitter, listFilesTool, searchFilesTool, listFilesToolInstance, searchFilesToolInstance;
43091
43142
  var init_probeTool = __esm({
43092
43143
  "src/agent/probeTool.js"() {
43093
43144
  "use strict";
@@ -43096,10 +43147,11 @@ var init_probeTool = __esm({
43096
43147
  import_util12 = require("util");
43097
43148
  import_crypto3 = require("crypto");
43098
43149
  import_events = require("events");
43099
- import_fs7 = __toESM(require("fs"), 1);
43100
- import_fs8 = require("fs");
43150
+ import_fs9 = __toESM(require("fs"), 1);
43151
+ import_fs10 = require("fs");
43101
43152
  import_path9 = __toESM(require("path"), 1);
43102
43153
  init_esm5();
43154
+ init_symlink_utils();
43103
43155
  toolCallEmitter = new import_events.EventEmitter();
43104
43156
  activeToolExecutions = /* @__PURE__ */ new Map();
43105
43157
  wrapToolWithEmitter = (tool4, toolName, baseExecute) => {
@@ -43205,7 +43257,7 @@ var init_probeTool = __esm({
43205
43257
  console.log(`[DEBUG] Listing files in directory: ${targetDir}`);
43206
43258
  }
43207
43259
  try {
43208
- const files = await import_fs8.promises.readdir(targetDir, { withFileTypes: true });
43260
+ const files = await import_fs10.promises.readdir(targetDir, { withFileTypes: true });
43209
43261
  const formatSize = (size) => {
43210
43262
  if (size < 1024) return `${size}B`;
43211
43263
  if (size < 1024 * 1024) return `${(size / 1024).toFixed(1)}K`;
@@ -43213,21 +43265,12 @@ var init_probeTool = __esm({
43213
43265
  return `${(size / (1024 * 1024 * 1024)).toFixed(1)}G`;
43214
43266
  };
43215
43267
  const entries = await Promise.all(files.map(async (file) => {
43216
- const isDirectory = file.isDirectory();
43217
43268
  const fullPath = import_path9.default.join(targetDir, file.name);
43218
- let size = 0;
43219
- try {
43220
- const stats = await import_fs8.promises.stat(fullPath);
43221
- size = stats.size;
43222
- } catch (statError) {
43223
- if (debug) {
43224
- console.log(`[DEBUG] Could not stat file ${file.name}:`, statError.message);
43225
- }
43226
- }
43269
+ const entryType = await getEntryType(file, fullPath);
43227
43270
  return {
43228
43271
  name: file.name,
43229
- isDirectory,
43230
- size
43272
+ isDirectory: entryType.isDirectory,
43273
+ size: entryType.size
43231
43274
  };
43232
43275
  }));
43233
43276
  entries.sort((a4, b4) => {
@@ -57747,7 +57790,7 @@ function validateFlowchart(text, options = {}) {
57747
57790
  const byLine = /* @__PURE__ */ new Map();
57748
57791
  const collect = (arr) => {
57749
57792
  for (const e4 of arr || []) {
57750
- if (e4 && (e4.code === "FL-LABEL-PARENS-UNQUOTED" || e4.code === "FL-LABEL-AT-IN-UNQUOTED")) {
57793
+ if (e4 && (e4.code === "FL-LABEL-PARENS-UNQUOTED" || e4.code === "FL-LABEL-AT-IN-UNQUOTED" || e4.code === "FL-LABEL-QUOTE-IN-UNQUOTED")) {
57751
57794
  const ln = e4.line ?? 0;
57752
57795
  const col = e4.column ?? 1;
57753
57796
  const list2 = byLine.get(ln) || [];
@@ -57828,6 +57871,8 @@ function validateFlowchart(text, options = {}) {
57828
57871
  const covered = existing.some((r4) => !(endCol < r4.start || startCol > r4.end));
57829
57872
  const hasParens = seg.includes("(") || seg.includes(")");
57830
57873
  const hasAt = seg.includes("@");
57874
+ const hasQuote = seg.includes('"');
57875
+ const isSingleQuoted = /^'[^]*'$/.test(trimmed);
57831
57876
  if (!covered && !isQuoted && !isParenWrapped && hasParens) {
57832
57877
  errs.push({ line: ln, column: startCol, severity: "error", code: "FL-LABEL-PARENS-UNQUOTED", message: "Parentheses inside an unquoted label are not supported by Mermaid.", hint: 'Wrap the label in quotes, e.g., A["Mark (X)"] \u2014 or replace ( and ) with HTML entities: &#40; and &#41;.' });
57833
57878
  existing.push({ start: startCol, end: endCol });
@@ -57838,6 +57883,11 @@ function validateFlowchart(text, options = {}) {
57838
57883
  existing.push({ start: startCol, end: endCol });
57839
57884
  byLine.set(ln, existing);
57840
57885
  }
57886
+ if (!covered && !isQuoted && !isSlashPair && hasQuote && !isSingleQuoted) {
57887
+ errs.push({ line: ln, column: startCol, severity: "error", code: "FL-LABEL-QUOTE-IN-UNQUOTED", message: "Quotes are not allowed inside unquoted node labels. Use &quot; for quotes or wrap the entire label in quotes.", hint: 'Example: C["HTML Output: data-trigger-visibility=&quot;true&quot;"]' });
57888
+ existing.push({ start: startCol, end: endCol });
57889
+ byLine.set(ln, existing);
57890
+ }
57841
57891
  i4 = j4;
57842
57892
  continue;
57843
57893
  } else {
@@ -81899,11 +81949,11 @@ function loadMCPConfigurationFromPath(configPath) {
81899
81949
  if (!configPath) {
81900
81950
  throw new Error("Config path is required");
81901
81951
  }
81902
- if (!(0, import_fs9.existsSync)(configPath)) {
81952
+ if (!(0, import_fs11.existsSync)(configPath)) {
81903
81953
  throw new Error(`MCP configuration file not found: ${configPath}`);
81904
81954
  }
81905
81955
  try {
81906
- const content = (0, import_fs9.readFileSync)(configPath, "utf8");
81956
+ const content = (0, import_fs11.readFileSync)(configPath, "utf8");
81907
81957
  const config = JSON.parse(content);
81908
81958
  if (process.env.DEBUG === "1" || process.env.DEBUG_MCP === "1") {
81909
81959
  console.error(`[MCP DEBUG] Loaded configuration from: ${configPath}`);
@@ -81928,9 +81978,9 @@ function loadMCPConfiguration() {
81928
81978
  ].filter(Boolean);
81929
81979
  let config = null;
81930
81980
  for (const configPath of configPaths) {
81931
- if ((0, import_fs9.existsSync)(configPath)) {
81981
+ if ((0, import_fs11.existsSync)(configPath)) {
81932
81982
  try {
81933
- const content = (0, import_fs9.readFileSync)(configPath, "utf8");
81983
+ const content = (0, import_fs11.readFileSync)(configPath, "utf8");
81934
81984
  config = JSON.parse(content);
81935
81985
  if (process.env.DEBUG === "1" || process.env.DEBUG_MCP === "1") {
81936
81986
  console.error(`[MCP DEBUG] Loaded configuration from: ${configPath}`);
@@ -82026,11 +82076,11 @@ function parseEnabledServers(config) {
82026
82076
  }
82027
82077
  return servers;
82028
82078
  }
82029
- var import_fs9, import_path10, import_os3, import_url4, __filename4, __dirname4, DEFAULT_CONFIG;
82079
+ var import_fs11, import_path10, import_os3, import_url4, __filename4, __dirname4, DEFAULT_CONFIG;
82030
82080
  var init_config = __esm({
82031
82081
  "src/agent/mcp/config.js"() {
82032
82082
  "use strict";
82033
- import_fs9 = require("fs");
82083
+ import_fs11 = require("fs");
82034
82084
  import_path10 = require("path");
82035
82085
  import_os3 = require("os");
82036
82086
  import_url4 = require("url");
@@ -84900,7 +84950,7 @@ __export(ProbeAgent_exports, {
84900
84950
  ProbeAgent: () => ProbeAgent
84901
84951
  });
84902
84952
  module.exports = __toCommonJS(ProbeAgent_exports);
84903
- var import_dotenv2, import_anthropic2, import_openai2, import_google2, import_ai5, import_crypto8, import_events4, import_fs10, import_promises3, import_path12, MAX_TOOL_ITERATIONS, MAX_HISTORY_MESSAGES, MAX_IMAGE_FILE_SIZE, ProbeAgent;
84953
+ var import_dotenv2, import_anthropic2, import_openai2, import_google2, import_ai5, import_crypto8, import_events4, import_fs12, import_promises3, import_path12, MAX_TOOL_ITERATIONS, MAX_HISTORY_MESSAGES, MAX_IMAGE_FILE_SIZE, ProbeAgent;
84904
84954
  var init_ProbeAgent = __esm({
84905
84955
  "src/agent/ProbeAgent.js"() {
84906
84956
  import_dotenv2 = __toESM(require_main(), 1);
@@ -84911,7 +84961,7 @@ var init_ProbeAgent = __esm({
84911
84961
  import_ai5 = require("ai");
84912
84962
  import_crypto8 = require("crypto");
84913
84963
  import_events4 = require("events");
84914
- import_fs10 = require("fs");
84964
+ import_fs12 = require("fs");
84915
84965
  import_promises3 = require("fs/promises");
84916
84966
  import_path12 = require("path");
84917
84967
  init_tokenCounter();