@probelabs/probe 0.6.0-rc173 → 0.6.0-rc175

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -104,8 +104,8 @@ var require_package = __commonJS({
104
104
  // node_modules/dotenv/lib/main.js
105
105
  var require_main = __commonJS({
106
106
  "node_modules/dotenv/lib/main.js"(exports2, module2) {
107
- var fs8 = require("fs");
108
- var path8 = require("path");
107
+ var fs10 = require("fs");
108
+ var path9 = require("path");
109
109
  var os4 = require("os");
110
110
  var crypto2 = require("crypto");
111
111
  var packageJson = require_package();
@@ -213,7 +213,7 @@ var require_main = __commonJS({
213
213
  if (options && options.path && options.path.length > 0) {
214
214
  if (Array.isArray(options.path)) {
215
215
  for (const filepath of options.path) {
216
- if (fs8.existsSync(filepath)) {
216
+ if (fs10.existsSync(filepath)) {
217
217
  possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
218
218
  }
219
219
  }
@@ -221,15 +221,15 @@ var require_main = __commonJS({
221
221
  possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
222
222
  }
223
223
  } else {
224
- possibleVaultPath = path8.resolve(process.cwd(), ".env.vault");
224
+ possibleVaultPath = path9.resolve(process.cwd(), ".env.vault");
225
225
  }
226
- if (fs8.existsSync(possibleVaultPath)) {
226
+ if (fs10.existsSync(possibleVaultPath)) {
227
227
  return possibleVaultPath;
228
228
  }
229
229
  return null;
230
230
  }
231
231
  function _resolveHome(envPath) {
232
- return envPath[0] === "~" ? path8.join(os4.homedir(), envPath.slice(1)) : envPath;
232
+ return envPath[0] === "~" ? path9.join(os4.homedir(), envPath.slice(1)) : envPath;
233
233
  }
234
234
  function _configVault(options) {
235
235
  const debug = Boolean(options && options.debug);
@@ -246,7 +246,7 @@ var require_main = __commonJS({
246
246
  return { parsed };
247
247
  }
248
248
  function configDotenv(options) {
249
- const dotenvPath = path8.resolve(process.cwd(), ".env");
249
+ const dotenvPath = path9.resolve(process.cwd(), ".env");
250
250
  let encoding = "utf8";
251
251
  const debug = Boolean(options && options.debug);
252
252
  const quiet = options && "quiet" in options ? options.quiet : true;
@@ -270,13 +270,13 @@ var require_main = __commonJS({
270
270
  }
271
271
  let lastError;
272
272
  const parsedAll = {};
273
- for (const path9 of optionPaths) {
273
+ for (const path10 of optionPaths) {
274
274
  try {
275
- const parsed = DotenvModule.parse(fs8.readFileSync(path9, { encoding }));
275
+ const parsed = DotenvModule.parse(fs10.readFileSync(path10, { encoding }));
276
276
  DotenvModule.populate(parsedAll, parsed, options);
277
277
  } catch (e4) {
278
278
  if (debug) {
279
- _debug(`Failed to load ${path9} ${e4.message}`);
279
+ _debug(`Failed to load ${path10} ${e4.message}`);
280
280
  }
281
281
  lastError = e4;
282
282
  }
@@ -291,7 +291,7 @@ var require_main = __commonJS({
291
291
  const shortPaths = [];
292
292
  for (const filePath of optionPaths) {
293
293
  try {
294
- const relative = path8.relative(process.cwd(), filePath);
294
+ const relative = path9.relative(process.cwd(), filePath);
295
295
  shortPaths.push(relative);
296
296
  } catch (e4) {
297
297
  if (debug) {
@@ -1684,9 +1684,9 @@ var init_createPaginator = __esm({
1684
1684
  command = withCommand(command) ?? command;
1685
1685
  return await client.send(command, ...args);
1686
1686
  };
1687
- get = (fromObject, path8) => {
1687
+ get = (fromObject, path9) => {
1688
1688
  let cursor2 = fromObject;
1689
- const pathComponents = path8.split(".");
1689
+ const pathComponents = path9.split(".");
1690
1690
  for (const step of pathComponents) {
1691
1691
  if (!cursor2 || typeof cursor2 !== "object") {
1692
1692
  return void 0;
@@ -2649,12 +2649,12 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
2649
2649
  const password = request.password ?? "";
2650
2650
  auth = `${username}:${password}`;
2651
2651
  }
2652
- let path8 = request.path;
2652
+ let path9 = request.path;
2653
2653
  if (queryString) {
2654
- path8 += `?${queryString}`;
2654
+ path9 += `?${queryString}`;
2655
2655
  }
2656
2656
  if (request.fragment) {
2657
- path8 += `#${request.fragment}`;
2657
+ path9 += `#${request.fragment}`;
2658
2658
  }
2659
2659
  let hostname = request.hostname ?? "";
2660
2660
  if (hostname[0] === "[" && hostname.endsWith("]")) {
@@ -2666,7 +2666,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
2666
2666
  headers: request.headers,
2667
2667
  host: hostname,
2668
2668
  method: request.method,
2669
- path: path8,
2669
+ path: path9,
2670
2670
  port: request.port,
2671
2671
  agent,
2672
2672
  auth
@@ -2921,16 +2921,16 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
2921
2921
  reject2(err);
2922
2922
  };
2923
2923
  const queryString = querystringBuilder.buildQueryString(query2 || {});
2924
- let path8 = request.path;
2924
+ let path9 = request.path;
2925
2925
  if (queryString) {
2926
- path8 += `?${queryString}`;
2926
+ path9 += `?${queryString}`;
2927
2927
  }
2928
2928
  if (request.fragment) {
2929
- path8 += `#${request.fragment}`;
2929
+ path9 += `#${request.fragment}`;
2930
2930
  }
2931
2931
  const req = session.request({
2932
2932
  ...request.headers,
2933
- [http2.constants.HTTP2_HEADER_PATH]: path8,
2933
+ [http2.constants.HTTP2_HEADER_PATH]: path9,
2934
2934
  [http2.constants.HTTP2_HEADER_METHOD]: method
2935
2935
  });
2936
2936
  session.ref();
@@ -3119,13 +3119,13 @@ var require_dist_cjs16 = __commonJS({
3119
3119
  abortError.name = "AbortError";
3120
3120
  return Promise.reject(abortError);
3121
3121
  }
3122
- let path8 = request.path;
3122
+ let path9 = request.path;
3123
3123
  const queryString = querystringBuilder.buildQueryString(request.query || {});
3124
3124
  if (queryString) {
3125
- path8 += `?${queryString}`;
3125
+ path9 += `?${queryString}`;
3126
3126
  }
3127
3127
  if (request.fragment) {
3128
- path8 += `#${request.fragment}`;
3128
+ path9 += `#${request.fragment}`;
3129
3129
  }
3130
3130
  let auth = "";
3131
3131
  if (request.username != null || request.password != null) {
@@ -3134,7 +3134,7 @@ var require_dist_cjs16 = __commonJS({
3134
3134
  auth = `${username}:${password}@`;
3135
3135
  }
3136
3136
  const { port, method } = request;
3137
- const url = `${request.protocol}//${auth}${request.hostname}${port ? `:${port}` : ""}${path8}`;
3137
+ const url = `${request.protocol}//${auth}${request.hostname}${port ? `:${port}` : ""}${path9}`;
3138
3138
  const body = method === "GET" || method === "HEAD" ? void 0 : request.body;
3139
3139
  const requestOptions = {
3140
3140
  body,
@@ -5196,13 +5196,13 @@ function __disposeResources(env) {
5196
5196
  }
5197
5197
  return next();
5198
5198
  }
5199
- function __rewriteRelativeImportExtension(path8, preserveJsx) {
5200
- if (typeof path8 === "string" && /^\.\.?\//.test(path8)) {
5201
- return path8.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(m4, tsx, d4, ext2, cm) {
5199
+ function __rewriteRelativeImportExtension(path9, preserveJsx) {
5200
+ if (typeof path9 === "string" && /^\.\.?\//.test(path9)) {
5201
+ return path9.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(m4, tsx, d4, ext2, cm) {
5202
5202
  return tsx ? preserveJsx ? ".jsx" : ".js" : d4 && (!ext2 || !cm) ? m4 : d4 + ext2 + "." + cm.toLowerCase() + "js";
5203
5203
  });
5204
5204
  }
5205
- return path8;
5205
+ return path9;
5206
5206
  }
5207
5207
  var extendStatics, __assign, __createBinding, __setModuleDefault, ownKeys, _SuppressedError, tslib_es6_default;
5208
5208
  var init_tslib_es6 = __esm({
@@ -6075,11 +6075,11 @@ var init_HttpBindingProtocol = __esm({
6075
6075
  const opTraits = translateTraits(operationSchema.traits);
6076
6076
  if (opTraits.http) {
6077
6077
  request.method = opTraits.http[0];
6078
- const [path8, search2] = opTraits.http[1].split("?");
6078
+ const [path9, search2] = opTraits.http[1].split("?");
6079
6079
  if (request.path == "/") {
6080
- request.path = path8;
6080
+ request.path = path9;
6081
6081
  } else {
6082
- request.path += path8;
6082
+ request.path += path9;
6083
6083
  }
6084
6084
  const traitSearchParams = new URLSearchParams(search2 ?? "");
6085
6085
  Object.assign(query2, Object.fromEntries(traitSearchParams));
@@ -6457,8 +6457,8 @@ var init_requestBuilder = __esm({
6457
6457
  return this;
6458
6458
  }
6459
6459
  p(memberName, labelValueProvider, uriLabel, isGreedyLabel) {
6460
- this.resolvePathStack.push((path8) => {
6461
- this.path = resolvedPath(path8, this.input, memberName, labelValueProvider, uriLabel, isGreedyLabel);
6460
+ this.resolvePathStack.push((path9) => {
6461
+ this.path = resolvedPath(path9, this.input, memberName, labelValueProvider, uriLabel, isGreedyLabel);
6462
6462
  });
6463
6463
  return this;
6464
6464
  }
@@ -7108,18 +7108,18 @@ var require_dist_cjs20 = __commonJS({
7108
7108
  }
7109
7109
  };
7110
7110
  var booleanEquals = (value1, value2) => value1 === value2;
7111
- var getAttrPathList = (path8) => {
7112
- const parts = path8.split(".");
7111
+ var getAttrPathList = (path9) => {
7112
+ const parts = path9.split(".");
7113
7113
  const pathList = [];
7114
7114
  for (const part of parts) {
7115
7115
  const squareBracketIndex = part.indexOf("[");
7116
7116
  if (squareBracketIndex !== -1) {
7117
7117
  if (part.indexOf("]") !== part.length - 1) {
7118
- throw new EndpointError(`Path: '${path8}' does not end with ']'`);
7118
+ throw new EndpointError(`Path: '${path9}' does not end with ']'`);
7119
7119
  }
7120
7120
  const arrayIndex = part.slice(squareBracketIndex + 1, -1);
7121
7121
  if (Number.isNaN(parseInt(arrayIndex))) {
7122
- throw new EndpointError(`Invalid array index: '${arrayIndex}' in path: '${path8}'`);
7122
+ throw new EndpointError(`Invalid array index: '${arrayIndex}' in path: '${path9}'`);
7123
7123
  }
7124
7124
  if (squareBracketIndex !== 0) {
7125
7125
  pathList.push(part.slice(0, squareBracketIndex));
@@ -7131,9 +7131,9 @@ var require_dist_cjs20 = __commonJS({
7131
7131
  }
7132
7132
  return pathList;
7133
7133
  };
7134
- var getAttr = (value, path8) => getAttrPathList(path8).reduce((acc, index) => {
7134
+ var getAttr = (value, path9) => getAttrPathList(path9).reduce((acc, index) => {
7135
7135
  if (typeof acc !== "object") {
7136
- throw new EndpointError(`Index '${index}' in '${path8}' not found in '${JSON.stringify(value)}'`);
7136
+ throw new EndpointError(`Index '${index}' in '${path9}' not found in '${JSON.stringify(value)}'`);
7137
7137
  } else if (Array.isArray(acc)) {
7138
7138
  return acc[parseInt(index)];
7139
7139
  }
@@ -7152,8 +7152,8 @@ var require_dist_cjs20 = __commonJS({
7152
7152
  return value;
7153
7153
  }
7154
7154
  if (typeof value === "object" && "hostname" in value) {
7155
- const { hostname: hostname2, port, protocol: protocol2 = "", path: path8 = "", query: query2 = {} } = value;
7156
- const url = new URL(`${protocol2}//${hostname2}${port ? `:${port}` : ""}${path8}`);
7155
+ const { hostname: hostname2, port, protocol: protocol2 = "", path: path9 = "", query: query2 = {} } = value;
7156
+ const url = new URL(`${protocol2}//${hostname2}${port ? `:${port}` : ""}${path9}`);
7157
7157
  url.search = Object.entries(query2).map(([k4, v4]) => `${k4}=${v4}`).join("&");
7158
7158
  return url;
7159
7159
  }
@@ -8668,10 +8668,10 @@ ${longDate}
8668
8668
  ${credentialScope}
8669
8669
  ${utilHexEncoding.toHex(hashedRequest)}`;
8670
8670
  }
8671
- getCanonicalPath({ path: path8 }) {
8671
+ getCanonicalPath({ path: path9 }) {
8672
8672
  if (this.uriEscapePath) {
8673
8673
  const normalizedPathSegments = [];
8674
- for (const pathSegment of path8.split("/")) {
8674
+ for (const pathSegment of path9.split("/")) {
8675
8675
  if (pathSegment?.length === 0)
8676
8676
  continue;
8677
8677
  if (pathSegment === ".")
@@ -8682,11 +8682,11 @@ ${utilHexEncoding.toHex(hashedRequest)}`;
8682
8682
  normalizedPathSegments.push(pathSegment);
8683
8683
  }
8684
8684
  }
8685
- const normalizedPath = `${path8?.startsWith("/") ? "/" : ""}${normalizedPathSegments.join("/")}${normalizedPathSegments.length > 0 && path8?.endsWith("/") ? "/" : ""}`;
8685
+ const normalizedPath = `${path9?.startsWith("/") ? "/" : ""}${normalizedPathSegments.join("/")}${normalizedPathSegments.length > 0 && path9?.endsWith("/") ? "/" : ""}`;
8686
8686
  const doubleEncoded = utilUriEscape.escapeUri(normalizedPath);
8687
8687
  return doubleEncoded.replace(/%2F/g, "/");
8688
8688
  }
8689
- return path8;
8689
+ return path9;
8690
8690
  }
8691
8691
  validateResolvedCredentials(credentials) {
8692
8692
  if (typeof credentials !== "object" || typeof credentials.accessKeyId !== "string" || typeof credentials.secretAccessKey !== "string") {
@@ -9947,11 +9947,11 @@ var init_SmithyRpcV2CborProtocol = __esm({
9947
9947
  }
9948
9948
  }
9949
9949
  const { service, operation: operation2 } = (0, import_util_middleware5.getSmithyContext)(context);
9950
- const path8 = `/service/${service}/operation/${operation2}`;
9950
+ const path9 = `/service/${service}/operation/${operation2}`;
9951
9951
  if (request.path.endsWith("/")) {
9952
- request.path += path8.slice(1);
9952
+ request.path += path9.slice(1);
9953
9953
  } else {
9954
- request.path += path8;
9954
+ request.path += path9;
9955
9955
  }
9956
9956
  return request;
9957
9957
  }
@@ -14867,15 +14867,15 @@ var require_dist_cjs34 = __commonJS({
14867
14867
  var querystringBuilder = require_dist_cjs14();
14868
14868
  function formatUrl(request) {
14869
14869
  const { port, query: query2 } = request;
14870
- let { protocol, path: path8, hostname } = request;
14870
+ let { protocol, path: path9, hostname } = request;
14871
14871
  if (protocol && protocol.slice(-1) !== ":") {
14872
14872
  protocol += ":";
14873
14873
  }
14874
14874
  if (port) {
14875
14875
  hostname += `:${port}`;
14876
14876
  }
14877
- if (path8 && path8.charAt(0) !== "/") {
14878
- path8 = `/${path8}`;
14877
+ if (path9 && path9.charAt(0) !== "/") {
14878
+ path9 = `/${path9}`;
14879
14879
  }
14880
14880
  let queryString = query2 ? querystringBuilder.buildQueryString(query2) : "";
14881
14881
  if (queryString && queryString[0] !== "?") {
@@ -14891,7 +14891,7 @@ var require_dist_cjs34 = __commonJS({
14891
14891
  if (request.fragment) {
14892
14892
  fragment = `#${request.fragment}`;
14893
14893
  }
14894
- return `${protocol}//${auth}${hostname}${path8}${queryString}${fragment}`;
14894
+ return `${protocol}//${auth}${hostname}${path9}${queryString}${fragment}`;
14895
14895
  }
14896
14896
  exports2.formatUrl = formatUrl;
14897
14897
  }
@@ -15748,14 +15748,14 @@ var require_readFile = __commonJS({
15748
15748
  var promises_1 = require("node:fs/promises");
15749
15749
  exports2.filePromises = {};
15750
15750
  exports2.fileIntercept = {};
15751
- var readFile2 = (path8, options) => {
15752
- if (exports2.fileIntercept[path8] !== void 0) {
15753
- return exports2.fileIntercept[path8];
15751
+ var readFile2 = (path9, options) => {
15752
+ if (exports2.fileIntercept[path9] !== void 0) {
15753
+ return exports2.fileIntercept[path9];
15754
15754
  }
15755
- if (!exports2.filePromises[path8] || options?.ignoreCache) {
15756
- exports2.filePromises[path8] = (0, promises_1.readFile)(path8, "utf8");
15755
+ if (!exports2.filePromises[path9] || options?.ignoreCache) {
15756
+ exports2.filePromises[path9] = (0, promises_1.readFile)(path9, "utf8");
15757
15757
  }
15758
- return exports2.filePromises[path8];
15758
+ return exports2.filePromises[path9];
15759
15759
  };
15760
15760
  exports2.readFile = readFile2;
15761
15761
  }
@@ -15768,7 +15768,7 @@ var require_dist_cjs42 = __commonJS({
15768
15768
  var getHomeDir = require_getHomeDir();
15769
15769
  var getSSOTokenFilepath = require_getSSOTokenFilepath();
15770
15770
  var getSSOTokenFromFile = require_getSSOTokenFromFile();
15771
- var path8 = require("path");
15771
+ var path9 = require("path");
15772
15772
  var types2 = require_dist_cjs();
15773
15773
  var readFile2 = require_readFile();
15774
15774
  var ENV_PROFILE = "AWS_PROFILE";
@@ -15790,9 +15790,9 @@ var require_dist_cjs42 = __commonJS({
15790
15790
  ...data2.default && { default: data2.default }
15791
15791
  });
15792
15792
  var ENV_CONFIG_PATH = "AWS_CONFIG_FILE";
15793
- var getConfigFilepath = () => process.env[ENV_CONFIG_PATH] || path8.join(getHomeDir.getHomeDir(), ".aws", "config");
15793
+ var getConfigFilepath = () => process.env[ENV_CONFIG_PATH] || path9.join(getHomeDir.getHomeDir(), ".aws", "config");
15794
15794
  var ENV_CREDENTIALS_PATH = "AWS_SHARED_CREDENTIALS_FILE";
15795
- var getCredentialsFilepath = () => process.env[ENV_CREDENTIALS_PATH] || path8.join(getHomeDir.getHomeDir(), ".aws", "credentials");
15795
+ var getCredentialsFilepath = () => process.env[ENV_CREDENTIALS_PATH] || path9.join(getHomeDir.getHomeDir(), ".aws", "credentials");
15796
15796
  var prefixKeyRegex = /^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/;
15797
15797
  var profileNameBlockList = ["__proto__", "profile __proto__"];
15798
15798
  var parseIni = (iniData) => {
@@ -15847,11 +15847,11 @@ var require_dist_cjs42 = __commonJS({
15847
15847
  const relativeHomeDirPrefix = "~/";
15848
15848
  let resolvedFilepath = filepath;
15849
15849
  if (filepath.startsWith(relativeHomeDirPrefix)) {
15850
- resolvedFilepath = path8.join(homeDir, filepath.slice(2));
15850
+ resolvedFilepath = path9.join(homeDir, filepath.slice(2));
15851
15851
  }
15852
15852
  let resolvedConfigFilepath = configFilepath;
15853
15853
  if (configFilepath.startsWith(relativeHomeDirPrefix)) {
15854
- resolvedConfigFilepath = path8.join(homeDir, configFilepath.slice(2));
15854
+ resolvedConfigFilepath = path9.join(homeDir, configFilepath.slice(2));
15855
15855
  }
15856
15856
  const parsedFiles = await Promise.all([
15857
15857
  readFile2.readFile(resolvedConfigFilepath, {
@@ -15890,8 +15890,8 @@ var require_dist_cjs42 = __commonJS({
15890
15890
  getFileRecord() {
15891
15891
  return readFile2.fileIntercept;
15892
15892
  },
15893
- interceptFile(path9, contents) {
15894
- readFile2.fileIntercept[path9] = Promise.resolve(contents);
15893
+ interceptFile(path10, contents) {
15894
+ readFile2.fileIntercept[path10] = Promise.resolve(contents);
15895
15895
  },
15896
15896
  getTokenRecord() {
15897
15897
  return getSSOTokenFromFile.tokenIntercept;
@@ -16122,8 +16122,8 @@ var require_dist_cjs44 = __commonJS({
16122
16122
  return endpoint.url.href;
16123
16123
  }
16124
16124
  if ("hostname" in endpoint) {
16125
- const { protocol, hostname, port, path: path8 } = endpoint;
16126
- return `${protocol}//${hostname}${port ? ":" + port : ""}${path8}`;
16125
+ const { protocol, hostname, port, path: path9 } = endpoint;
16126
+ return `${protocol}//${hostname}${port ? ":" + port : ""}${path9}`;
16127
16127
  }
16128
16128
  }
16129
16129
  return endpoint;
@@ -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 fs10 = 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 } = fs10.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";
@@ -29127,6 +29171,32 @@ var init_utils2 = __esm({
29127
29171
  }
29128
29172
  });
29129
29173
 
29174
+ // src/utils/path-validation.js
29175
+ async function validateCwdPath(inputPath, defaultPath = process.cwd()) {
29176
+ const targetPath = inputPath || defaultPath;
29177
+ const normalizedPath = import_path4.default.normalize(import_path4.default.resolve(targetPath));
29178
+ try {
29179
+ const stats = await import_fs3.promises.stat(normalizedPath);
29180
+ if (!stats.isDirectory()) {
29181
+ throw new Error(`Path is not a directory: ${normalizedPath}`);
29182
+ }
29183
+ } catch (error2) {
29184
+ if (error2.code === "ENOENT") {
29185
+ throw new Error(`Path does not exist: ${normalizedPath}`);
29186
+ }
29187
+ throw error2;
29188
+ }
29189
+ return normalizedPath;
29190
+ }
29191
+ var import_path4, import_fs3;
29192
+ var init_path_validation = __esm({
29193
+ "src/utils/path-validation.js"() {
29194
+ "use strict";
29195
+ import_path4 = __toESM(require("path"), 1);
29196
+ import_fs3 = require("fs");
29197
+ }
29198
+ });
29199
+
29130
29200
  // src/search.js
29131
29201
  async function search(options) {
29132
29202
  if (!options || !options.path) {
@@ -29166,9 +29236,11 @@ async function search(options) {
29166
29236
  options.session = process.env.PROBE_SESSION_ID;
29167
29237
  }
29168
29238
  const queries = Array.isArray(options.query) ? options.query : [options.query];
29239
+ const cwd = await validateCwdPath(options.cwd);
29169
29240
  if (process.env.DEBUG === "1") {
29170
29241
  let logMessage = `
29171
29242
  Search: query="${queries[0]}" path="${options.path}"`;
29243
+ if (options.cwd) logMessage += ` cwd="${options.cwd}"`;
29172
29244
  if (options.maxResults) logMessage += ` maxResults=${options.maxResults}`;
29173
29245
  logMessage += ` maxTokens=${options.maxTokens}`;
29174
29246
  logMessage += ` timeout=${options.timeout}`;
@@ -29188,6 +29260,7 @@ Search: query="${queries[0]}" path="${options.path}"`;
29188
29260
  }
29189
29261
  try {
29190
29262
  const { stdout, stderr } = await execFileAsync(binaryPath, args, {
29263
+ cwd,
29191
29264
  timeout: options.timeout * 1e3,
29192
29265
  // Convert seconds to milliseconds
29193
29266
  maxBuffer: 50 * 1024 * 1024
@@ -29241,13 +29314,15 @@ Search results: ${resultCount} matches, ${tokenCount} tokens`;
29241
29314
  if (error2.code === "ETIMEDOUT" || error2.killed) {
29242
29315
  const timeoutMessage = `Search operation timed out after ${options.timeout} seconds.
29243
29316
  Binary: ${binaryPath}
29244
- Args: ${args.join(" ")}`;
29317
+ Args: ${args.join(" ")}
29318
+ Cwd: ${cwd}`;
29245
29319
  console.error(timeoutMessage);
29246
29320
  throw new Error(timeoutMessage);
29247
29321
  }
29248
29322
  const errorMessage = `Error executing search command: ${error2.message}
29249
29323
  Binary: ${binaryPath}
29250
- Args: ${args.join(" ")}`;
29324
+ Args: ${args.join(" ")}
29325
+ Cwd: ${cwd}`;
29251
29326
  throw new Error(errorMessage);
29252
29327
  }
29253
29328
  }
@@ -29258,6 +29333,7 @@ var init_search = __esm({
29258
29333
  import_child_process2 = require("child_process");
29259
29334
  import_util4 = require("util");
29260
29335
  init_utils2();
29336
+ init_path_validation();
29261
29337
  execFileAsync = (0, import_util4.promisify)(import_child_process2.execFile);
29262
29338
  SEARCH_FLAG_MAP = {
29263
29339
  filesOnly: "--files-only",
@@ -29295,8 +29371,10 @@ async function query(options) {
29295
29371
  cliArgs.push("--format", "json");
29296
29372
  }
29297
29373
  cliArgs.push(escapeString(options.pattern), escapeString(options.path));
29374
+ const cwd = await validateCwdPath(options.cwd);
29298
29375
  if (process.env.DEBUG === "1") {
29299
29376
  let logMessage = `Query: pattern="${options.pattern}" path="${options.path}"`;
29377
+ if (options.cwd) logMessage += ` cwd="${options.cwd}"`;
29300
29378
  if (options.language) logMessage += ` language=${options.language}`;
29301
29379
  if (options.maxResults) logMessage += ` maxResults=${options.maxResults}`;
29302
29380
  if (options.allowTests) logMessage += " allowTests=true";
@@ -29304,7 +29382,7 @@ async function query(options) {
29304
29382
  }
29305
29383
  const command = `${binaryPath} query ${cliArgs.join(" ")}`;
29306
29384
  try {
29307
- const { stdout, stderr } = await execAsync(command);
29385
+ const { stdout, stderr } = await execAsync(command, { cwd });
29308
29386
  if (stderr) {
29309
29387
  console.error(`stderr: ${stderr}`);
29310
29388
  }
@@ -29329,7 +29407,8 @@ async function query(options) {
29329
29407
  return stdout;
29330
29408
  } catch (error2) {
29331
29409
  const errorMessage = `Error executing query command: ${error2.message}
29332
- Command: ${command}`;
29410
+ Command: ${command}
29411
+ Cwd: ${cwd}`;
29333
29412
  throw new Error(errorMessage);
29334
29413
  }
29335
29414
  }
@@ -29340,6 +29419,7 @@ var init_query = __esm({
29340
29419
  import_child_process3 = require("child_process");
29341
29420
  import_util5 = require("util");
29342
29421
  init_utils2();
29422
+ init_path_validation();
29343
29423
  execAsync = (0, import_util5.promisify)(import_child_process3.exec);
29344
29424
  QUERY_FLAG_MAP = {
29345
29425
  language: "--language",
@@ -29374,6 +29454,7 @@ async function extract(options) {
29374
29454
  cliArgs.push(escapeString(file));
29375
29455
  }
29376
29456
  }
29457
+ const cwd = await validateCwdPath(options.cwd);
29377
29458
  if (process.env.DEBUG === "1") {
29378
29459
  let logMessage = `
29379
29460
  Extract:`;
@@ -29382,6 +29463,7 @@ Extract:`;
29382
29463
  }
29383
29464
  if (options.inputFile) logMessage += ` inputFile="${options.inputFile}"`;
29384
29465
  if (options.content) logMessage += ` content=(${typeof options.content === "string" ? options.content.length : options.content.byteLength} bytes)`;
29466
+ if (options.cwd) logMessage += ` cwd="${cwd}"`;
29385
29467
  if (options.allowTests) logMessage += " allowTests=true";
29386
29468
  if (options.contextLines) logMessage += ` contextLines=${options.contextLines}`;
29387
29469
  if (options.format) logMessage += ` format=${options.format}`;
@@ -29389,25 +29471,27 @@ Extract:`;
29389
29471
  console.error(logMessage);
29390
29472
  }
29391
29473
  if (hasContent) {
29392
- return extractWithStdin(binaryPath, cliArgs, options.content, options);
29474
+ return extractWithStdin(binaryPath, cliArgs, options.content, options, cwd);
29393
29475
  }
29394
29476
  const command = `${binaryPath} extract ${cliArgs.join(" ")}`;
29395
29477
  try {
29396
- const { stdout, stderr } = await execAsync2(command);
29478
+ const { stdout, stderr } = await execAsync2(command, { cwd });
29397
29479
  if (stderr) {
29398
29480
  console.error(`stderr: ${stderr}`);
29399
29481
  }
29400
29482
  return processExtractOutput(stdout, options);
29401
29483
  } catch (error2) {
29402
29484
  const errorMessage = `Error executing extract command: ${error2.message}
29403
- Command: ${command}`;
29485
+ Command: ${command}
29486
+ Cwd: ${cwd}`;
29404
29487
  throw new Error(errorMessage);
29405
29488
  }
29406
29489
  }
29407
- function extractWithStdin(binaryPath, cliArgs, content, options) {
29490
+ function extractWithStdin(binaryPath, cliArgs, content, options, cwd) {
29408
29491
  return new Promise((resolve5, reject2) => {
29409
29492
  const childProcess = (0, import_child_process4.spawn)(binaryPath, ["extract", ...cliArgs], {
29410
- stdio: ["pipe", "pipe", "pipe"]
29493
+ stdio: ["pipe", "pipe", "pipe"],
29494
+ cwd
29411
29495
  });
29412
29496
  let stdout = "";
29413
29497
  let stderr = "";
@@ -29498,6 +29582,7 @@ var init_extract = __esm({
29498
29582
  import_child_process4 = require("child_process");
29499
29583
  import_util6 = require("util");
29500
29584
  init_utils2();
29585
+ init_path_validation();
29501
29586
  execAsync2 = (0, import_util6.promisify)(import_child_process4.exec);
29502
29587
  EXTRACT_FLAG_MAP = {
29503
29588
  allowTests: "--allow-tests",
@@ -29529,7 +29614,7 @@ async function delegate({
29529
29614
  maxIterations = 30,
29530
29615
  tracer = null,
29531
29616
  parentSessionId = null,
29532
- path: path8 = null,
29617
+ path: path9 = null,
29533
29618
  provider = null,
29534
29619
  model = null
29535
29620
  }) {
@@ -29569,7 +29654,7 @@ async function delegate({
29569
29654
  maxIterations: remainingIterations,
29570
29655
  debug,
29571
29656
  tracer,
29572
- path: path8,
29657
+ path: path9,
29573
29658
  // Inherit from parent
29574
29659
  provider,
29575
29660
  // Inherit from parent
@@ -30188,8 +30273,8 @@ var init_parseUtil = __esm({
30188
30273
  init_errors4();
30189
30274
  init_en();
30190
30275
  makeIssue = (params) => {
30191
- const { data: data2, path: path8, errorMaps, issueData } = params;
30192
- const fullPath = [...path8, ...issueData.path || []];
30276
+ const { data: data2, path: path9, errorMaps, issueData } = params;
30277
+ const fullPath = [...path9, ...issueData.path || []];
30193
30278
  const fullIssue = {
30194
30279
  ...issueData,
30195
30280
  path: fullPath
@@ -30497,11 +30582,11 @@ var init_types = __esm({
30497
30582
  init_parseUtil();
30498
30583
  init_util2();
30499
30584
  ParseInputLazyPath = class {
30500
- constructor(parent, value, path8, key) {
30585
+ constructor(parent, value, path9, key) {
30501
30586
  this._cachedPath = [];
30502
30587
  this.parent = parent;
30503
30588
  this.data = value;
30504
- this._path = path8;
30589
+ this._path = path9;
30505
30590
  this._key = key;
30506
30591
  }
30507
30592
  get path() {
@@ -34324,15 +34409,15 @@ var init_vercel = __esm({
34324
34409
  name: "search",
34325
34410
  description: searchDescription,
34326
34411
  inputSchema: searchSchema,
34327
- execute: async ({ query: searchQuery, path: path8, allow_tests, exact, maxTokens: paramMaxTokens, language }) => {
34412
+ execute: async ({ query: searchQuery, path: path9, allow_tests, exact, maxTokens: paramMaxTokens, language }) => {
34328
34413
  try {
34329
34414
  const effectiveMaxTokens = paramMaxTokens || maxTokens;
34330
- let searchPath = path8 || options.defaultPath || ".";
34331
- if ((searchPath === "." || searchPath === "./") && options.defaultPath) {
34415
+ let searchPath = path9 || options.cwd || ".";
34416
+ if ((searchPath === "." || searchPath === "./") && options.cwd) {
34332
34417
  if (debug) {
34333
- console.error(`Using default path "${options.defaultPath}" instead of "${searchPath}"`);
34418
+ console.error(`Using cwd "${options.cwd}" instead of "${searchPath}"`);
34334
34419
  }
34335
- searchPath = options.defaultPath;
34420
+ searchPath = options.cwd;
34336
34421
  }
34337
34422
  if (debug) {
34338
34423
  console.error(`Executing search with query: "${searchQuery}", path: "${searchPath}", exact: ${exact ? "true" : "false"}, language: ${language || "all"}, session: ${sessionId || "none"}`);
@@ -34340,6 +34425,8 @@ var init_vercel = __esm({
34340
34425
  const searchOptions = {
34341
34426
  query: searchQuery,
34342
34427
  path: searchPath,
34428
+ cwd: options.cwd,
34429
+ // Working directory for resolving relative paths
34343
34430
  allowTests: allow_tests,
34344
34431
  exact,
34345
34432
  json: false,
@@ -34367,14 +34454,14 @@ var init_vercel = __esm({
34367
34454
  name: "query",
34368
34455
  description: queryDescription,
34369
34456
  inputSchema: querySchema,
34370
- execute: async ({ pattern, path: path8, language, allow_tests }) => {
34457
+ execute: async ({ pattern, path: path9, language, allow_tests }) => {
34371
34458
  try {
34372
- let queryPath = path8 || options.defaultPath || ".";
34373
- if ((queryPath === "." || queryPath === "./") && options.defaultPath) {
34459
+ let queryPath = path9 || options.cwd || ".";
34460
+ if ((queryPath === "." || queryPath === "./") && options.cwd) {
34374
34461
  if (debug) {
34375
- console.error(`Using default path "${options.defaultPath}" instead of "${queryPath}"`);
34462
+ console.error(`Using cwd "${options.cwd}" instead of "${queryPath}"`);
34376
34463
  }
34377
- queryPath = options.defaultPath;
34464
+ queryPath = options.cwd;
34378
34465
  }
34379
34466
  if (debug) {
34380
34467
  console.error(`Executing query with pattern: "${pattern}", path: "${queryPath}", language: ${language || "auto"}`);
@@ -34382,6 +34469,8 @@ var init_vercel = __esm({
34382
34469
  const results = await query({
34383
34470
  pattern,
34384
34471
  path: queryPath,
34472
+ cwd: options.cwd,
34473
+ // Working directory for resolving relative paths
34385
34474
  language,
34386
34475
  allow_tests,
34387
34476
  json: false
@@ -34402,22 +34491,16 @@ var init_vercel = __esm({
34402
34491
  inputSchema: extractSchema,
34403
34492
  execute: async ({ targets, input_content, line, end_line, allow_tests, context_lines, format: format2 }) => {
34404
34493
  try {
34405
- let extractPath = options.defaultPath || ".";
34406
- if ((extractPath === "." || extractPath === "./") && options.defaultPath) {
34407
- if (debug) {
34408
- console.error(`Using default path "${options.defaultPath}" instead of "${extractPath}"`);
34409
- }
34410
- extractPath = options.defaultPath;
34411
- }
34494
+ const effectiveCwd = options.cwd || ".";
34412
34495
  if (debug) {
34413
34496
  if (targets) {
34414
- console.error(`Executing extract with targets: "${targets}", path: "${extractPath}", context lines: ${context_lines || 10}`);
34497
+ console.error(`Executing extract with targets: "${targets}", cwd: "${effectiveCwd}", context lines: ${context_lines || 10}`);
34415
34498
  } else if (input_content) {
34416
- console.error(`Executing extract with input content, path: "${extractPath}", context lines: ${context_lines || 10}`);
34499
+ console.error(`Executing extract with input content, cwd: "${effectiveCwd}", context lines: ${context_lines || 10}`);
34417
34500
  }
34418
34501
  }
34419
34502
  let tempFilePath = null;
34420
- let extractOptions = { path: extractPath };
34503
+ let extractOptions = { cwd: effectiveCwd };
34421
34504
  if (input_content) {
34422
34505
  const { writeFileSync: writeFileSync2, unlinkSync } = await import("fs");
34423
34506
  const { join: join3 } = await import("path");
@@ -34434,6 +34517,7 @@ var init_vercel = __esm({
34434
34517
  }
34435
34518
  extractOptions = {
34436
34519
  inputFile: tempFilePath,
34520
+ cwd: effectiveCwd,
34437
34521
  allowTests: allow_tests,
34438
34522
  contextLines: context_lines,
34439
34523
  format: effectiveFormat
@@ -34446,6 +34530,7 @@ var init_vercel = __esm({
34446
34530
  }
34447
34531
  extractOptions = {
34448
34532
  files,
34533
+ cwd: effectiveCwd,
34449
34534
  allowTests: allow_tests,
34450
34535
  contextLines: context_lines,
34451
34536
  format: effectiveFormat
@@ -34474,12 +34559,12 @@ var init_vercel = __esm({
34474
34559
  });
34475
34560
  };
34476
34561
  delegateTool = (options = {}) => {
34477
- const { debug = false, timeout = 300, defaultPath, allowedFolders } = options;
34562
+ const { debug = false, timeout = 300, cwd, allowedFolders } = options;
34478
34563
  return (0, import_ai.tool)({
34479
34564
  name: "delegate",
34480
34565
  description: delegateDescription,
34481
34566
  inputSchema: delegateSchema,
34482
- execute: async ({ task, currentIteration, maxIterations, parentSessionId, path: path8, provider, model, tracer }) => {
34567
+ execute: async ({ task, currentIteration, maxIterations, parentSessionId, path: path9, provider, model, tracer }) => {
34483
34568
  if (!task || typeof task !== "string") {
34484
34569
  throw new Error("Task parameter is required and must be a non-empty string");
34485
34570
  }
@@ -34495,7 +34580,7 @@ var init_vercel = __esm({
34495
34580
  if (parentSessionId !== void 0 && parentSessionId !== null && typeof parentSessionId !== "string") {
34496
34581
  throw new TypeError("parentSessionId must be a string, null, or undefined");
34497
34582
  }
34498
- if (path8 !== void 0 && path8 !== null && typeof path8 !== "string") {
34583
+ if (path9 !== void 0 && path9 !== null && typeof path9 !== "string") {
34499
34584
  throw new TypeError("path must be a string, null, or undefined");
34500
34585
  }
34501
34586
  if (provider !== void 0 && provider !== null && typeof provider !== "string") {
@@ -34504,13 +34589,13 @@ var init_vercel = __esm({
34504
34589
  if (model !== void 0 && model !== null && typeof model !== "string") {
34505
34590
  throw new TypeError("model must be a string, null, or undefined");
34506
34591
  }
34507
- const effectivePath = path8 || defaultPath || allowedFolders && allowedFolders[0];
34592
+ const effectivePath = path9 || cwd || allowedFolders && allowedFolders[0];
34508
34593
  if (debug) {
34509
34594
  console.error(`Executing delegate with task: "${task.substring(0, 100)}${task.length > 100 ? "..." : ""}"`);
34510
34595
  if (parentSessionId) {
34511
34596
  console.error(`Parent session: ${parentSessionId}`);
34512
34597
  }
34513
- if (effectivePath && effectivePath !== path8) {
34598
+ if (effectivePath && effectivePath !== path9) {
34514
34599
  console.error(`Using inherited path: ${effectivePath}`);
34515
34600
  }
34516
34601
  }
@@ -35367,8 +35452,8 @@ async function executeBashCommand(command, options = {}) {
35367
35452
  } = options;
35368
35453
  let cwd = workingDirectory;
35369
35454
  try {
35370
- cwd = (0, import_path4.resolve)(cwd);
35371
- if (!(0, import_fs.existsSync)(cwd)) {
35455
+ cwd = (0, import_path5.resolve)(cwd);
35456
+ if (!(0, import_fs4.existsSync)(cwd)) {
35372
35457
  throw new Error(`Working directory does not exist: ${cwd}`);
35373
35458
  }
35374
35459
  } catch (error2) {
@@ -35580,7 +35665,7 @@ function validateExecutionOptions(options = {}) {
35580
35665
  if (options.workingDirectory) {
35581
35666
  if (typeof options.workingDirectory !== "string") {
35582
35667
  errors.push("workingDirectory must be a string");
35583
- } else if (!(0, import_fs.existsSync)(options.workingDirectory)) {
35668
+ } else if (!(0, import_fs4.existsSync)(options.workingDirectory)) {
35584
35669
  errors.push(`workingDirectory does not exist: ${options.workingDirectory}`);
35585
35670
  }
35586
35671
  }
@@ -35593,31 +35678,31 @@ function validateExecutionOptions(options = {}) {
35593
35678
  warnings
35594
35679
  };
35595
35680
  }
35596
- var import_child_process6, import_path4, import_fs;
35681
+ var import_child_process6, import_path5, import_fs4;
35597
35682
  var init_bashExecutor = __esm({
35598
35683
  "src/agent/bashExecutor.js"() {
35599
35684
  "use strict";
35600
35685
  import_child_process6 = require("child_process");
35601
- import_path4 = require("path");
35602
- import_fs = require("fs");
35686
+ import_path5 = require("path");
35687
+ import_fs4 = require("fs");
35603
35688
  init_bashCommandUtils();
35604
35689
  }
35605
35690
  });
35606
35691
 
35607
35692
  // src/tools/bash.js
35608
- var import_ai2, import_path5, bashTool;
35693
+ var import_ai2, import_path6, bashTool;
35609
35694
  var init_bash = __esm({
35610
35695
  "src/tools/bash.js"() {
35611
35696
  "use strict";
35612
35697
  import_ai2 = require("ai");
35613
- import_path5 = require("path");
35698
+ import_path6 = require("path");
35614
35699
  init_bashPermissions();
35615
35700
  init_bashExecutor();
35616
35701
  bashTool = (options = {}) => {
35617
35702
  const {
35618
35703
  bashConfig = {},
35619
35704
  debug = false,
35620
- defaultPath,
35705
+ cwd,
35621
35706
  allowedFolders = []
35622
35707
  } = options;
35623
35708
  const permissionChecker = new BashPermissionChecker({
@@ -35631,8 +35716,8 @@ var init_bash = __esm({
35631
35716
  if (bashConfig.workingDirectory) {
35632
35717
  return bashConfig.workingDirectory;
35633
35718
  }
35634
- if (defaultPath) {
35635
- return defaultPath;
35719
+ if (cwd) {
35720
+ return cwd;
35636
35721
  }
35637
35722
  if (allowedFolders && allowedFolders.length > 0) {
35638
35723
  return allowedFolders[0];
@@ -35720,9 +35805,9 @@ For code exploration, try these safe alternatives:
35720
35805
  }
35721
35806
  const workingDir = workingDirectory || getDefaultWorkingDirectory();
35722
35807
  if (allowedFolders && allowedFolders.length > 0) {
35723
- const resolvedWorkingDir = (0, import_path5.resolve)(workingDir);
35808
+ const resolvedWorkingDir = (0, import_path6.resolve)(workingDir);
35724
35809
  const isAllowed = allowedFolders.some((folder) => {
35725
- const resolvedFolder = (0, import_path5.resolve)(folder);
35810
+ const resolvedFolder = (0, import_path6.resolve)(folder);
35726
35811
  return resolvedWorkingDir.startsWith(resolvedFolder);
35727
35812
  });
35728
35813
  if (!isAllowed) {
@@ -35778,33 +35863,33 @@ Command failed with exit code ${result.exitCode}`;
35778
35863
  // src/tools/edit.js
35779
35864
  function isPathAllowed(filePath, allowedFolders) {
35780
35865
  if (!allowedFolders || allowedFolders.length === 0) {
35781
- const resolvedPath3 = (0, import_path6.resolve)(filePath);
35782
- const cwd = (0, import_path6.resolve)(process.cwd());
35783
- return resolvedPath3 === cwd || resolvedPath3.startsWith(cwd + import_path6.sep);
35866
+ const resolvedPath3 = (0, import_path7.resolve)(filePath);
35867
+ const cwd = (0, import_path7.resolve)(process.cwd());
35868
+ return resolvedPath3 === cwd || resolvedPath3.startsWith(cwd + import_path7.sep);
35784
35869
  }
35785
- const resolvedPath2 = (0, import_path6.resolve)(filePath);
35870
+ const resolvedPath2 = (0, import_path7.resolve)(filePath);
35786
35871
  return allowedFolders.some((folder) => {
35787
- const allowedPath = (0, import_path6.resolve)(folder);
35788
- return resolvedPath2 === allowedPath || resolvedPath2.startsWith(allowedPath + import_path6.sep);
35872
+ const allowedPath = (0, import_path7.resolve)(folder);
35873
+ return resolvedPath2 === allowedPath || resolvedPath2.startsWith(allowedPath + import_path7.sep);
35789
35874
  });
35790
35875
  }
35791
35876
  function parseFileToolOptions(options = {}) {
35792
35877
  return {
35793
35878
  debug: options.debug || false,
35794
35879
  allowedFolders: options.allowedFolders || [],
35795
- defaultPath: options.defaultPath
35880
+ cwd: options.cwd
35796
35881
  };
35797
35882
  }
35798
- var import_ai3, import_fs2, import_path6, import_fs3, editTool, createTool, editDescription, createDescription, editToolDefinition, createToolDefinition;
35883
+ var import_ai3, import_fs5, import_path7, import_fs6, editTool, createTool, editDescription, createDescription, editToolDefinition, createToolDefinition;
35799
35884
  var init_edit = __esm({
35800
35885
  "src/tools/edit.js"() {
35801
35886
  "use strict";
35802
35887
  import_ai3 = require("ai");
35803
- import_fs2 = require("fs");
35804
- import_path6 = require("path");
35805
- import_fs3 = require("fs");
35888
+ import_fs5 = require("fs");
35889
+ import_path7 = require("path");
35890
+ import_fs6 = require("fs");
35806
35891
  editTool = (options = {}) => {
35807
- const { debug, allowedFolders, defaultPath } = parseFileToolOptions(options);
35892
+ const { debug, allowedFolders, cwd } = parseFileToolOptions(options);
35808
35893
  return (0, import_ai3.tool)({
35809
35894
  name: "edit",
35810
35895
  description: `Edit files using exact string replacement (Claude Code style).
@@ -35855,17 +35940,17 @@ Important:
35855
35940
  if (new_string === void 0 || new_string === null || typeof new_string !== "string") {
35856
35941
  return `Error editing file: Invalid new_string - must be a string`;
35857
35942
  }
35858
- const resolvedPath2 = (0, import_path6.isAbsolute)(file_path) ? file_path : (0, import_path6.resolve)(defaultPath || process.cwd(), file_path);
35943
+ const resolvedPath2 = (0, import_path7.isAbsolute)(file_path) ? file_path : (0, import_path7.resolve)(cwd || process.cwd(), file_path);
35859
35944
  if (debug) {
35860
35945
  console.error(`[Edit] Attempting to edit file: ${resolvedPath2}`);
35861
35946
  }
35862
35947
  if (!isPathAllowed(resolvedPath2, allowedFolders)) {
35863
35948
  return `Error editing file: Permission denied - ${file_path} is outside allowed directories`;
35864
35949
  }
35865
- if (!(0, import_fs3.existsSync)(resolvedPath2)) {
35950
+ if (!(0, import_fs6.existsSync)(resolvedPath2)) {
35866
35951
  return `Error editing file: File not found - ${file_path}`;
35867
35952
  }
35868
- const content = await import_fs2.promises.readFile(resolvedPath2, "utf-8");
35953
+ const content = await import_fs5.promises.readFile(resolvedPath2, "utf-8");
35869
35954
  if (!content.includes(old_string)) {
35870
35955
  return `Error editing file: String not found - the specified old_string was not found in ${file_path}`;
35871
35956
  }
@@ -35882,7 +35967,7 @@ Important:
35882
35967
  if (newContent === content) {
35883
35968
  return `Error editing file: No changes made - old_string and new_string might be the same`;
35884
35969
  }
35885
- await import_fs2.promises.writeFile(resolvedPath2, newContent, "utf-8");
35970
+ await import_fs5.promises.writeFile(resolvedPath2, newContent, "utf-8");
35886
35971
  const replacedCount = replace_all ? occurrences : 1;
35887
35972
  if (debug) {
35888
35973
  console.error(`[Edit] Successfully edited ${resolvedPath2}, replaced ${replacedCount} occurrence(s)`);
@@ -35896,7 +35981,7 @@ Important:
35896
35981
  });
35897
35982
  };
35898
35983
  createTool = (options = {}) => {
35899
- const { debug, allowedFolders, defaultPath } = parseFileToolOptions(options);
35984
+ const { debug, allowedFolders, cwd } = parseFileToolOptions(options);
35900
35985
  return (0, import_ai3.tool)({
35901
35986
  name: "create",
35902
35987
  description: `Create new files with specified content.
@@ -35939,20 +36024,20 @@ Important:
35939
36024
  if (content === void 0 || content === null || typeof content !== "string") {
35940
36025
  return `Error creating file: Invalid content - must be a string`;
35941
36026
  }
35942
- const resolvedPath2 = (0, import_path6.isAbsolute)(file_path) ? file_path : (0, import_path6.resolve)(defaultPath || process.cwd(), file_path);
36027
+ const resolvedPath2 = (0, import_path7.isAbsolute)(file_path) ? file_path : (0, import_path7.resolve)(cwd || process.cwd(), file_path);
35943
36028
  if (debug) {
35944
36029
  console.error(`[Create] Attempting to create file: ${resolvedPath2}`);
35945
36030
  }
35946
36031
  if (!isPathAllowed(resolvedPath2, allowedFolders)) {
35947
36032
  return `Error creating file: Permission denied - ${file_path} is outside allowed directories`;
35948
36033
  }
35949
- if ((0, import_fs3.existsSync)(resolvedPath2) && !overwrite) {
36034
+ if ((0, import_fs6.existsSync)(resolvedPath2) && !overwrite) {
35950
36035
  return `Error creating file: File already exists - ${file_path}. Use overwrite: true to replace it.`;
35951
36036
  }
35952
- 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";
36037
+ const dir = (0, import_path7.dirname)(resolvedPath2);
36038
+ await import_fs5.promises.mkdir(dir, { recursive: true });
36039
+ await import_fs5.promises.writeFile(resolvedPath2, content, "utf-8");
36040
+ const action = (0, import_fs6.existsSync)(resolvedPath2) && overwrite ? "overwrote" : "created";
35956
36041
  const bytes = Buffer.byteLength(content, "utf-8");
35957
36042
  if (debug) {
35958
36043
  console.error(`[Create] Successfully ${action} ${resolvedPath2}`);
@@ -36227,10 +36312,10 @@ async function listFilesByLevel(options) {
36227
36312
  maxFiles = 100,
36228
36313
  respectGitignore = true
36229
36314
  } = options;
36230
- if (!import_fs4.default.existsSync(directory)) {
36315
+ if (!import_fs7.default.existsSync(directory)) {
36231
36316
  throw new Error(`Directory does not exist: ${directory}`);
36232
36317
  }
36233
- const gitDirExists = import_fs4.default.existsSync(import_path7.default.join(directory, ".git"));
36318
+ const gitDirExists = import_fs7.default.existsSync(import_path8.default.join(directory, ".git"));
36234
36319
  if (gitDirExists && respectGitignore) {
36235
36320
  try {
36236
36321
  return await listFilesUsingGit(directory, maxFiles);
@@ -36245,8 +36330,8 @@ async function listFilesUsingGit(directory, maxFiles) {
36245
36330
  const { stdout } = await execAsync3("git ls-files", { cwd: directory });
36246
36331
  const files = stdout.split("\n").filter(Boolean);
36247
36332
  const sortedFiles = files.sort((a4, b4) => {
36248
- const depthA = a4.split(import_path7.default.sep).length;
36249
- const depthB = b4.split(import_path7.default.sep).length;
36333
+ const depthA = a4.split(import_path8.default.sep).length;
36334
+ const depthB = b4.split(import_path8.default.sep).length;
36250
36335
  return depthA - depthB;
36251
36336
  });
36252
36337
  return sortedFiles.slice(0, maxFiles);
@@ -36261,19 +36346,25 @@ async function listFilesByLevelManually(directory, maxFiles, respectGitignore) {
36261
36346
  while (queue.length > 0 && result.length < maxFiles) {
36262
36347
  const { dir, level } = queue.shift();
36263
36348
  try {
36264
- const entries = import_fs4.default.readdirSync(dir, { withFileTypes: true });
36265
- const files = entries.filter((entry) => entry.isFile());
36349
+ const entries = import_fs7.default.readdirSync(dir, { withFileTypes: true });
36350
+ const files = entries.filter((entry) => {
36351
+ const fullPath = import_path8.default.join(dir, entry.name);
36352
+ return getEntryTypeSync(entry, fullPath).isFile;
36353
+ });
36266
36354
  for (const file of files) {
36267
36355
  if (result.length >= maxFiles) break;
36268
- const filePath = import_path7.default.join(dir, file.name);
36269
- const relativePath = import_path7.default.relative(directory, filePath);
36356
+ const filePath = import_path8.default.join(dir, file.name);
36357
+ const relativePath = import_path8.default.relative(directory, filePath);
36270
36358
  if (shouldIgnore(relativePath, ignorePatterns)) continue;
36271
36359
  result.push(relativePath);
36272
36360
  }
36273
- const dirs = entries.filter((entry) => entry.isDirectory());
36361
+ const dirs = entries.filter((entry) => {
36362
+ const fullPath = import_path8.default.join(dir, entry.name);
36363
+ return getEntryTypeSync(entry, fullPath).isDirectory;
36364
+ });
36274
36365
  for (const subdir of dirs) {
36275
- const subdirPath = import_path7.default.join(dir, subdir.name);
36276
- const relativeSubdirPath = import_path7.default.relative(directory, subdirPath);
36366
+ const subdirPath = import_path8.default.join(dir, subdir.name);
36367
+ const relativeSubdirPath = import_path8.default.relative(directory, subdirPath);
36277
36368
  if (shouldIgnore(relativeSubdirPath, ignorePatterns)) continue;
36278
36369
  if (subdir.name === "node_modules" || subdir.name === ".git") continue;
36279
36370
  queue.push({ dir: subdirPath, level: level + 1 });
@@ -36285,12 +36376,12 @@ async function listFilesByLevelManually(directory, maxFiles, respectGitignore) {
36285
36376
  return result;
36286
36377
  }
36287
36378
  function loadGitignorePatterns(directory) {
36288
- const gitignorePath = import_path7.default.join(directory, ".gitignore");
36289
- if (!import_fs4.default.existsSync(gitignorePath)) {
36379
+ const gitignorePath = import_path8.default.join(directory, ".gitignore");
36380
+ if (!import_fs7.default.existsSync(gitignorePath)) {
36290
36381
  return [];
36291
36382
  }
36292
36383
  try {
36293
- const content = import_fs4.default.readFileSync(gitignorePath, "utf8");
36384
+ const content = import_fs7.default.readFileSync(gitignorePath, "utf8");
36294
36385
  return content.split("\n").map((line) => line.trim()).filter((line) => line && !line.startsWith("#"));
36295
36386
  } catch (error2) {
36296
36387
  console.error(`Warning: Could not read .gitignore: ${error2.message}`);
@@ -36308,25 +36399,26 @@ function shouldIgnore(filePath, ignorePatterns) {
36308
36399
  }
36309
36400
  return false;
36310
36401
  }
36311
- var import_fs4, import_path7, import_util11, import_child_process7, execAsync3;
36402
+ var import_fs7, import_path8, import_util11, import_child_process7, execAsync3;
36312
36403
  var init_file_lister = __esm({
36313
36404
  "src/utils/file-lister.js"() {
36314
36405
  "use strict";
36315
- import_fs4 = __toESM(require("fs"), 1);
36316
- import_path7 = __toESM(require("path"), 1);
36406
+ import_fs7 = __toESM(require("fs"), 1);
36407
+ import_path8 = __toESM(require("path"), 1);
36317
36408
  import_util11 = require("util");
36318
36409
  import_child_process7 = require("child_process");
36410
+ init_symlink_utils();
36319
36411
  execAsync3 = (0, import_util11.promisify)(import_child_process7.exec);
36320
36412
  }
36321
36413
  });
36322
36414
 
36323
36415
  // src/agent/simpleTelemetry.js
36324
- var import_fs5, import_path8;
36416
+ var import_fs8, import_path9;
36325
36417
  var init_simpleTelemetry = __esm({
36326
36418
  "src/agent/simpleTelemetry.js"() {
36327
36419
  "use strict";
36328
- import_fs5 = require("fs");
36329
- import_path8 = require("path");
36420
+ import_fs8 = require("fs");
36421
+ import_path9 = require("path");
36330
36422
  }
36331
36423
  });
36332
36424
 
@@ -37175,7 +37267,7 @@ var init_escape = __esm({
37175
37267
  });
37176
37268
 
37177
37269
  // node_modules/minimatch/dist/esm/index.js
37178
- var import_brace_expansion, minimatch, starDotExtRE, starDotExtTest, starDotExtTestDot, starDotExtTestNocase, starDotExtTestNocaseDot, starDotStarRE, starDotStarTest, starDotStarTestDot, dotStarRE, dotStarTest, starRE, starTest, starTestDot, qmarksRE, qmarksTestNocase, qmarksTestNocaseDot, qmarksTestDot, qmarksTest, qmarksTestNoExt, qmarksTestNoExtDot, defaultPlatform, path5, sep2, GLOBSTAR, qmark2, star2, twoStarDot, twoStarNoDot, filter, ext, defaults, braceExpand, makeRe, match, globMagic, regExpEscape2, Minimatch;
37270
+ var import_brace_expansion, minimatch, starDotExtRE, starDotExtTest, starDotExtTestDot, starDotExtTestNocase, starDotExtTestNocaseDot, starDotStarRE, starDotStarTest, starDotStarTestDot, dotStarRE, dotStarTest, starRE, starTest, starTestDot, qmarksRE, qmarksTestNocase, qmarksTestNocaseDot, qmarksTestDot, qmarksTest, qmarksTestNoExt, qmarksTestNoExtDot, defaultPlatform, path6, sep2, GLOBSTAR, qmark2, star2, twoStarDot, twoStarNoDot, filter, ext, defaults, braceExpand, makeRe, match, globMagic, regExpEscape2, Minimatch;
37179
37271
  var init_esm = __esm({
37180
37272
  "node_modules/minimatch/dist/esm/index.js"() {
37181
37273
  import_brace_expansion = __toESM(require_brace_expansion(), 1);
@@ -37244,11 +37336,11 @@ var init_esm = __esm({
37244
37336
  return (f4) => f4.length === len && f4 !== "." && f4 !== "..";
37245
37337
  };
37246
37338
  defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
37247
- path5 = {
37339
+ path6 = {
37248
37340
  win32: { sep: "\\" },
37249
37341
  posix: { sep: "/" }
37250
37342
  };
37251
- sep2 = defaultPlatform === "win32" ? path5.win32.sep : path5.posix.sep;
37343
+ sep2 = defaultPlatform === "win32" ? path6.win32.sep : path6.posix.sep;
37252
37344
  minimatch.sep = sep2;
37253
37345
  GLOBSTAR = Symbol("globstar **");
37254
37346
  minimatch.GLOBSTAR = GLOBSTAR;
@@ -40163,22 +40255,22 @@ var init_esm3 = __esm({
40163
40255
  });
40164
40256
 
40165
40257
  // 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;
40258
+ var import_node_path, import_node_url, import_fs9, 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
40259
  var init_esm4 = __esm({
40168
40260
  "node_modules/path-scurry/dist/esm/index.js"() {
40169
40261
  init_esm2();
40170
40262
  import_node_path = require("node:path");
40171
40263
  import_node_url = require("node:url");
40172
- import_fs6 = require("fs");
40264
+ import_fs9 = require("fs");
40173
40265
  actualFS = __toESM(require("node:fs"), 1);
40174
40266
  import_promises = require("node:fs/promises");
40175
40267
  init_esm3();
40176
- realpathSync = import_fs6.realpathSync.native;
40268
+ realpathSync = import_fs9.realpathSync.native;
40177
40269
  defaultFS = {
40178
- lstatSync: import_fs6.lstatSync,
40179
- readdir: import_fs6.readdir,
40180
- readdirSync: import_fs6.readdirSync,
40181
- readlinkSync: import_fs6.readlinkSync,
40270
+ lstatSync: import_fs9.lstatSync,
40271
+ readdir: import_fs9.readdir,
40272
+ readdirSync: import_fs9.readdirSync,
40273
+ readlinkSync: import_fs9.readlinkSync,
40182
40274
  realpathSync,
40183
40275
  promises: {
40184
40276
  lstat: import_promises.lstat,
@@ -40435,12 +40527,12 @@ var init_esm4 = __esm({
40435
40527
  /**
40436
40528
  * Get the Path object referenced by the string path, resolved from this Path
40437
40529
  */
40438
- resolve(path8) {
40439
- if (!path8) {
40530
+ resolve(path9) {
40531
+ if (!path9) {
40440
40532
  return this;
40441
40533
  }
40442
- const rootPath = this.getRootString(path8);
40443
- const dir = path8.substring(rootPath.length);
40534
+ const rootPath = this.getRootString(path9);
40535
+ const dir = path9.substring(rootPath.length);
40444
40536
  const dirParts = dir.split(this.splitSep);
40445
40537
  const result = rootPath ? this.getRoot(rootPath).#resolveParts(dirParts) : this.#resolveParts(dirParts);
40446
40538
  return result;
@@ -41192,8 +41284,8 @@ var init_esm4 = __esm({
41192
41284
  /**
41193
41285
  * @internal
41194
41286
  */
41195
- getRootString(path8) {
41196
- return import_node_path.win32.parse(path8).root;
41287
+ getRootString(path9) {
41288
+ return import_node_path.win32.parse(path9).root;
41197
41289
  }
41198
41290
  /**
41199
41291
  * @internal
@@ -41239,8 +41331,8 @@ var init_esm4 = __esm({
41239
41331
  /**
41240
41332
  * @internal
41241
41333
  */
41242
- getRootString(path8) {
41243
- return path8.startsWith("/") ? "/" : "";
41334
+ getRootString(path9) {
41335
+ return path9.startsWith("/") ? "/" : "";
41244
41336
  }
41245
41337
  /**
41246
41338
  * @internal
@@ -41289,8 +41381,8 @@ var init_esm4 = __esm({
41289
41381
  *
41290
41382
  * @internal
41291
41383
  */
41292
- constructor(cwd = process.cwd(), pathImpl, sep4, { nocase, childrenCacheSize = 16 * 1024, fs: fs8 = defaultFS } = {}) {
41293
- this.#fs = fsFromOption(fs8);
41384
+ constructor(cwd = process.cwd(), pathImpl, sep4, { nocase, childrenCacheSize = 16 * 1024, fs: fs10 = defaultFS } = {}) {
41385
+ this.#fs = fsFromOption(fs10);
41294
41386
  if (cwd instanceof URL || cwd.startsWith("file://")) {
41295
41387
  cwd = (0, import_node_url.fileURLToPath)(cwd);
41296
41388
  }
@@ -41329,11 +41421,11 @@ var init_esm4 = __esm({
41329
41421
  /**
41330
41422
  * Get the depth of a provided path, string, or the cwd
41331
41423
  */
41332
- depth(path8 = this.cwd) {
41333
- if (typeof path8 === "string") {
41334
- path8 = this.cwd.resolve(path8);
41424
+ depth(path9 = this.cwd) {
41425
+ if (typeof path9 === "string") {
41426
+ path9 = this.cwd.resolve(path9);
41335
41427
  }
41336
- return path8.depth();
41428
+ return path9.depth();
41337
41429
  }
41338
41430
  /**
41339
41431
  * Return the cache of child entries. Exposed so subclasses can create
@@ -41820,9 +41912,9 @@ var init_esm4 = __esm({
41820
41912
  process2();
41821
41913
  return results;
41822
41914
  }
41823
- chdir(path8 = this.cwd) {
41915
+ chdir(path9 = this.cwd) {
41824
41916
  const oldCwd = this.cwd;
41825
- this.cwd = typeof path8 === "string" ? this.cwd.resolve(path8) : path8;
41917
+ this.cwd = typeof path9 === "string" ? this.cwd.resolve(path9) : path9;
41826
41918
  this.cwd[setAsCwd](oldCwd);
41827
41919
  }
41828
41920
  };
@@ -41848,8 +41940,8 @@ var init_esm4 = __esm({
41848
41940
  /**
41849
41941
  * @internal
41850
41942
  */
41851
- newRoot(fs8) {
41852
- return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs8 });
41943
+ newRoot(fs10) {
41944
+ return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs10 });
41853
41945
  }
41854
41946
  /**
41855
41947
  * Return true if the provided path string is an absolute path
@@ -41877,8 +41969,8 @@ var init_esm4 = __esm({
41877
41969
  /**
41878
41970
  * @internal
41879
41971
  */
41880
- newRoot(fs8) {
41881
- return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs8 });
41972
+ newRoot(fs10) {
41973
+ return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs10 });
41882
41974
  }
41883
41975
  /**
41884
41976
  * Return true if the provided path string is an absolute path
@@ -42197,8 +42289,8 @@ var init_processor = __esm({
42197
42289
  }
42198
42290
  // match, absolute, ifdir
42199
42291
  entries() {
42200
- return [...this.store.entries()].map(([path8, n4]) => [
42201
- path8,
42292
+ return [...this.store.entries()].map(([path9, n4]) => [
42293
+ path9,
42202
42294
  !!(n4 & 2),
42203
42295
  !!(n4 & 1)
42204
42296
  ]);
@@ -42411,9 +42503,9 @@ var init_walker = __esm({
42411
42503
  signal;
42412
42504
  maxDepth;
42413
42505
  includeChildMatches;
42414
- constructor(patterns, path8, opts) {
42506
+ constructor(patterns, path9, opts) {
42415
42507
  this.patterns = patterns;
42416
- this.path = path8;
42508
+ this.path = path9;
42417
42509
  this.opts = opts;
42418
42510
  this.#sep = !opts.posix && opts.platform === "win32" ? "\\" : "/";
42419
42511
  this.includeChildMatches = opts.includeChildMatches !== false;
@@ -42432,11 +42524,11 @@ var init_walker = __esm({
42432
42524
  });
42433
42525
  }
42434
42526
  }
42435
- #ignored(path8) {
42436
- return this.seen.has(path8) || !!this.#ignore?.ignored?.(path8);
42527
+ #ignored(path9) {
42528
+ return this.seen.has(path9) || !!this.#ignore?.ignored?.(path9);
42437
42529
  }
42438
- #childrenIgnored(path8) {
42439
- return !!this.#ignore?.childrenIgnored?.(path8);
42530
+ #childrenIgnored(path9) {
42531
+ return !!this.#ignore?.childrenIgnored?.(path9);
42440
42532
  }
42441
42533
  // backpressure mechanism
42442
42534
  pause() {
@@ -42651,8 +42743,8 @@ var init_walker = __esm({
42651
42743
  };
42652
42744
  GlobWalker = class extends GlobUtil {
42653
42745
  matches = /* @__PURE__ */ new Set();
42654
- constructor(patterns, path8, opts) {
42655
- super(patterns, path8, opts);
42746
+ constructor(patterns, path9, opts) {
42747
+ super(patterns, path9, opts);
42656
42748
  }
42657
42749
  matchEmit(e4) {
42658
42750
  this.matches.add(e4);
@@ -42689,8 +42781,8 @@ var init_walker = __esm({
42689
42781
  };
42690
42782
  GlobStream = class extends GlobUtil {
42691
42783
  results;
42692
- constructor(patterns, path8, opts) {
42693
- super(patterns, path8, opts);
42784
+ constructor(patterns, path9, opts) {
42785
+ super(patterns, path9, opts);
42694
42786
  this.results = new Minipass({
42695
42787
  signal: this.signal,
42696
42788
  objectMode: true
@@ -43087,7 +43179,7 @@ function createWrappedTools(baseTools) {
43087
43179
  }
43088
43180
  return wrappedTools;
43089
43181
  }
43090
- var import_child_process8, import_util12, import_crypto3, import_events, import_fs7, import_fs8, import_path9, toolCallEmitter, activeToolExecutions, wrapToolWithEmitter, listFilesTool, searchFilesTool, listFilesToolInstance, searchFilesToolInstance;
43182
+ var import_child_process8, import_util12, import_crypto3, import_events, import_fs10, import_fs11, import_path10, toolCallEmitter, activeToolExecutions, wrapToolWithEmitter, listFilesTool, searchFilesTool, listFilesToolInstance, searchFilesToolInstance;
43091
43183
  var init_probeTool = __esm({
43092
43184
  "src/agent/probeTool.js"() {
43093
43185
  "use strict";
@@ -43096,10 +43188,11 @@ var init_probeTool = __esm({
43096
43188
  import_util12 = require("util");
43097
43189
  import_crypto3 = require("crypto");
43098
43190
  import_events = require("events");
43099
- import_fs7 = __toESM(require("fs"), 1);
43100
- import_fs8 = require("fs");
43101
- import_path9 = __toESM(require("path"), 1);
43191
+ import_fs10 = __toESM(require("fs"), 1);
43192
+ import_fs11 = require("fs");
43193
+ import_path10 = __toESM(require("path"), 1);
43102
43194
  init_esm5();
43195
+ init_symlink_utils();
43103
43196
  toolCallEmitter = new import_events.EventEmitter();
43104
43197
  activeToolExecutions = /* @__PURE__ */ new Map();
43105
43198
  wrapToolWithEmitter = (tool4, toolName, baseExecute) => {
@@ -43186,17 +43279,17 @@ var init_probeTool = __esm({
43186
43279
  execute: async (params) => {
43187
43280
  const { directory = ".", workingDirectory } = params;
43188
43281
  const baseCwd = workingDirectory || process.cwd();
43189
- const secureBaseDir = import_path9.default.resolve(baseCwd);
43282
+ const secureBaseDir = import_path10.default.resolve(baseCwd);
43190
43283
  const isDependencyPath = directory.startsWith("/dep/") || directory.startsWith("go:") || directory.startsWith("js:") || directory.startsWith("rust:");
43191
43284
  let targetDir;
43192
- if (import_path9.default.isAbsolute(directory)) {
43193
- targetDir = import_path9.default.resolve(directory);
43194
- if (!isDependencyPath && !targetDir.startsWith(secureBaseDir + import_path9.default.sep) && targetDir !== secureBaseDir) {
43285
+ if (import_path10.default.isAbsolute(directory)) {
43286
+ targetDir = import_path10.default.resolve(directory);
43287
+ if (!isDependencyPath && !targetDir.startsWith(secureBaseDir + import_path10.default.sep) && targetDir !== secureBaseDir) {
43195
43288
  throw new Error(`Path traversal attempt detected. Cannot access directory outside workspace: ${directory}`);
43196
43289
  }
43197
43290
  } else {
43198
- targetDir = import_path9.default.resolve(secureBaseDir, directory);
43199
- if (!isDependencyPath && !targetDir.startsWith(secureBaseDir + import_path9.default.sep) && targetDir !== secureBaseDir) {
43291
+ targetDir = import_path10.default.resolve(secureBaseDir, directory);
43292
+ if (!isDependencyPath && !targetDir.startsWith(secureBaseDir + import_path10.default.sep) && targetDir !== secureBaseDir) {
43200
43293
  throw new Error(`Path traversal attempt detected. Access denied: ${directory}`);
43201
43294
  }
43202
43295
  }
@@ -43205,7 +43298,7 @@ var init_probeTool = __esm({
43205
43298
  console.log(`[DEBUG] Listing files in directory: ${targetDir}`);
43206
43299
  }
43207
43300
  try {
43208
- const files = await import_fs8.promises.readdir(targetDir, { withFileTypes: true });
43301
+ const files = await import_fs11.promises.readdir(targetDir, { withFileTypes: true });
43209
43302
  const formatSize = (size) => {
43210
43303
  if (size < 1024) return `${size}B`;
43211
43304
  if (size < 1024 * 1024) return `${(size / 1024).toFixed(1)}K`;
@@ -43213,21 +43306,12 @@ var init_probeTool = __esm({
43213
43306
  return `${(size / (1024 * 1024 * 1024)).toFixed(1)}G`;
43214
43307
  };
43215
43308
  const entries = await Promise.all(files.map(async (file) => {
43216
- const isDirectory = file.isDirectory();
43217
- 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
- }
43309
+ const fullPath = import_path10.default.join(targetDir, file.name);
43310
+ const entryType = await getEntryType(file, fullPath);
43227
43311
  return {
43228
43312
  name: file.name,
43229
- isDirectory,
43230
- size
43313
+ isDirectory: entryType.isDirectory,
43314
+ size: entryType.size
43231
43315
  };
43232
43316
  }));
43233
43317
  entries.sort((a4, b4) => {
@@ -43259,17 +43343,17 @@ var init_probeTool = __esm({
43259
43343
  throw new Error("Pattern is required for file search");
43260
43344
  }
43261
43345
  const baseCwd = workingDirectory || process.cwd();
43262
- const secureBaseDir = import_path9.default.resolve(baseCwd);
43346
+ const secureBaseDir = import_path10.default.resolve(baseCwd);
43263
43347
  const isDependencyPath = directory.startsWith("/dep/") || directory.startsWith("go:") || directory.startsWith("js:") || directory.startsWith("rust:");
43264
43348
  let targetDir;
43265
- if (import_path9.default.isAbsolute(directory)) {
43266
- targetDir = import_path9.default.resolve(directory);
43267
- if (!isDependencyPath && !targetDir.startsWith(secureBaseDir + import_path9.default.sep) && targetDir !== secureBaseDir) {
43349
+ if (import_path10.default.isAbsolute(directory)) {
43350
+ targetDir = import_path10.default.resolve(directory);
43351
+ if (!isDependencyPath && !targetDir.startsWith(secureBaseDir + import_path10.default.sep) && targetDir !== secureBaseDir) {
43268
43352
  throw new Error(`Path traversal attempt detected. Cannot access directory outside workspace: ${directory}`);
43269
43353
  }
43270
43354
  } else {
43271
- targetDir = import_path9.default.resolve(secureBaseDir, directory);
43272
- if (!isDependencyPath && !targetDir.startsWith(secureBaseDir + import_path9.default.sep) && targetDir !== secureBaseDir) {
43355
+ targetDir = import_path10.default.resolve(secureBaseDir, directory);
43356
+ if (!isDependencyPath && !targetDir.startsWith(secureBaseDir + import_path10.default.sep) && targetDir !== secureBaseDir) {
43273
43357
  throw new Error(`Path traversal attempt detected. Access denied: ${directory}`);
43274
43358
  }
43275
43359
  }
@@ -45397,11 +45481,11 @@ var init_toKey = __esm({
45397
45481
  });
45398
45482
 
45399
45483
  // node_modules/lodash-es/_baseGet.js
45400
- function baseGet(object, path8) {
45401
- path8 = castPath_default(path8, object);
45402
- var index = 0, length = path8.length;
45484
+ function baseGet(object, path9) {
45485
+ path9 = castPath_default(path9, object);
45486
+ var index = 0, length = path9.length;
45403
45487
  while (object != null && index < length) {
45404
- object = object[toKey_default(path8[index++])];
45488
+ object = object[toKey_default(path9[index++])];
45405
45489
  }
45406
45490
  return index && index == length ? object : void 0;
45407
45491
  }
@@ -45415,8 +45499,8 @@ var init_baseGet = __esm({
45415
45499
  });
45416
45500
 
45417
45501
  // node_modules/lodash-es/get.js
45418
- function get2(object, path8, defaultValue) {
45419
- var result = object == null ? void 0 : baseGet_default(object, path8);
45502
+ function get2(object, path9, defaultValue) {
45503
+ var result = object == null ? void 0 : baseGet_default(object, path9);
45420
45504
  return result === void 0 ? defaultValue : result;
45421
45505
  }
45422
45506
  var get_default;
@@ -46779,11 +46863,11 @@ var init_baseHasIn = __esm({
46779
46863
  });
46780
46864
 
46781
46865
  // node_modules/lodash-es/_hasPath.js
46782
- function hasPath(object, path8, hasFunc) {
46783
- path8 = castPath_default(path8, object);
46784
- var index = -1, length = path8.length, result = false;
46866
+ function hasPath(object, path9, hasFunc) {
46867
+ path9 = castPath_default(path9, object);
46868
+ var index = -1, length = path9.length, result = false;
46785
46869
  while (++index < length) {
46786
- var key = toKey_default(path8[index]);
46870
+ var key = toKey_default(path9[index]);
46787
46871
  if (!(result = object != null && hasFunc(object, key))) {
46788
46872
  break;
46789
46873
  }
@@ -46809,8 +46893,8 @@ var init_hasPath = __esm({
46809
46893
  });
46810
46894
 
46811
46895
  // node_modules/lodash-es/hasIn.js
46812
- function hasIn(object, path8) {
46813
- return object != null && hasPath_default(object, path8, baseHasIn_default);
46896
+ function hasIn(object, path9) {
46897
+ return object != null && hasPath_default(object, path9, baseHasIn_default);
46814
46898
  }
46815
46899
  var hasIn_default;
46816
46900
  var init_hasIn = __esm({
@@ -46822,13 +46906,13 @@ var init_hasIn = __esm({
46822
46906
  });
46823
46907
 
46824
46908
  // node_modules/lodash-es/_baseMatchesProperty.js
46825
- function baseMatchesProperty(path8, srcValue) {
46826
- if (isKey_default(path8) && isStrictComparable_default(srcValue)) {
46827
- return matchesStrictComparable_default(toKey_default(path8), srcValue);
46909
+ function baseMatchesProperty(path9, srcValue) {
46910
+ if (isKey_default(path9) && isStrictComparable_default(srcValue)) {
46911
+ return matchesStrictComparable_default(toKey_default(path9), srcValue);
46828
46912
  }
46829
46913
  return function(object) {
46830
- var objValue = get_default(object, path8);
46831
- return objValue === void 0 && objValue === srcValue ? hasIn_default(object, path8) : baseIsEqual_default(srcValue, objValue, COMPARE_PARTIAL_FLAG6 | COMPARE_UNORDERED_FLAG4);
46914
+ var objValue = get_default(object, path9);
46915
+ return objValue === void 0 && objValue === srcValue ? hasIn_default(object, path9) : baseIsEqual_default(srcValue, objValue, COMPARE_PARTIAL_FLAG6 | COMPARE_UNORDERED_FLAG4);
46832
46916
  };
46833
46917
  }
46834
46918
  var COMPARE_PARTIAL_FLAG6, COMPARE_UNORDERED_FLAG4, baseMatchesProperty_default;
@@ -46861,9 +46945,9 @@ var init_baseProperty = __esm({
46861
46945
  });
46862
46946
 
46863
46947
  // node_modules/lodash-es/_basePropertyDeep.js
46864
- function basePropertyDeep(path8) {
46948
+ function basePropertyDeep(path9) {
46865
46949
  return function(object) {
46866
- return baseGet_default(object, path8);
46950
+ return baseGet_default(object, path9);
46867
46951
  };
46868
46952
  }
46869
46953
  var basePropertyDeep_default;
@@ -46875,8 +46959,8 @@ var init_basePropertyDeep = __esm({
46875
46959
  });
46876
46960
 
46877
46961
  // node_modules/lodash-es/property.js
46878
- function property(path8) {
46879
- return isKey_default(path8) ? baseProperty_default(toKey_default(path8)) : basePropertyDeep_default(path8);
46962
+ function property(path9) {
46963
+ return isKey_default(path9) ? baseProperty_default(toKey_default(path9)) : basePropertyDeep_default(path9);
46880
46964
  }
46881
46965
  var property_default;
46882
46966
  var init_property = __esm({
@@ -47495,8 +47579,8 @@ var init_baseHas = __esm({
47495
47579
  });
47496
47580
 
47497
47581
  // node_modules/lodash-es/has.js
47498
- function has(object, path8) {
47499
- return object != null && hasPath_default(object, path8, baseHas_default);
47582
+ function has(object, path9) {
47583
+ return object != null && hasPath_default(object, path9, baseHas_default);
47500
47584
  }
47501
47585
  var has_default;
47502
47586
  var init_has = __esm({
@@ -47702,14 +47786,14 @@ var init_negate = __esm({
47702
47786
  });
47703
47787
 
47704
47788
  // node_modules/lodash-es/_baseSet.js
47705
- function baseSet(object, path8, value, customizer) {
47789
+ function baseSet(object, path9, value, customizer) {
47706
47790
  if (!isObject_default(object)) {
47707
47791
  return object;
47708
47792
  }
47709
- path8 = castPath_default(path8, object);
47710
- var index = -1, length = path8.length, lastIndex = length - 1, nested = object;
47793
+ path9 = castPath_default(path9, object);
47794
+ var index = -1, length = path9.length, lastIndex = length - 1, nested = object;
47711
47795
  while (nested != null && ++index < length) {
47712
- var key = toKey_default(path8[index]), newValue = value;
47796
+ var key = toKey_default(path9[index]), newValue = value;
47713
47797
  if (key === "__proto__" || key === "constructor" || key === "prototype") {
47714
47798
  return object;
47715
47799
  }
@@ -47717,7 +47801,7 @@ function baseSet(object, path8, value, customizer) {
47717
47801
  var objValue = nested[key];
47718
47802
  newValue = customizer ? customizer(objValue, key, nested) : void 0;
47719
47803
  if (newValue === void 0) {
47720
- newValue = isObject_default(objValue) ? objValue : isIndex_default(path8[index + 1]) ? [] : {};
47804
+ newValue = isObject_default(objValue) ? objValue : isIndex_default(path9[index + 1]) ? [] : {};
47721
47805
  }
47722
47806
  }
47723
47807
  assignValue_default(nested, key, newValue);
@@ -47741,9 +47825,9 @@ var init_baseSet = __esm({
47741
47825
  function basePickBy(object, paths, predicate) {
47742
47826
  var index = -1, length = paths.length, result = {};
47743
47827
  while (++index < length) {
47744
- var path8 = paths[index], value = baseGet_default(object, path8);
47745
- if (predicate(value, path8)) {
47746
- baseSet_default(result, castPath_default(path8, object), value);
47828
+ var path9 = paths[index], value = baseGet_default(object, path9);
47829
+ if (predicate(value, path9)) {
47830
+ baseSet_default(result, castPath_default(path9, object), value);
47747
47831
  }
47748
47832
  }
47749
47833
  return result;
@@ -47767,8 +47851,8 @@ function pickBy(object, predicate) {
47767
47851
  return [prop];
47768
47852
  });
47769
47853
  predicate = baseIteratee_default(predicate);
47770
- return basePickBy_default(object, props, function(value, path8) {
47771
- return predicate(value, path8[0]);
47854
+ return basePickBy_default(object, props, function(value, path9) {
47855
+ return predicate(value, path9[0]);
47772
47856
  });
47773
47857
  }
47774
47858
  var pickBy_default;
@@ -50481,12 +50565,12 @@ function assignCategoriesMapProp(tokenTypes) {
50481
50565
  singleAssignCategoriesToksMap([], currTokType);
50482
50566
  });
50483
50567
  }
50484
- function singleAssignCategoriesToksMap(path8, nextNode) {
50485
- forEach_default(path8, (pathNode) => {
50568
+ function singleAssignCategoriesToksMap(path9, nextNode) {
50569
+ forEach_default(path9, (pathNode) => {
50486
50570
  nextNode.categoryMatchesMap[pathNode.tokenTypeIdx] = true;
50487
50571
  });
50488
50572
  forEach_default(nextNode.CATEGORIES, (nextCategory) => {
50489
- const newPath = path8.concat(nextNode);
50573
+ const newPath = path9.concat(nextNode);
50490
50574
  if (!includes_default(newPath, nextCategory)) {
50491
50575
  singleAssignCategoriesToksMap(newPath, nextCategory);
50492
50576
  }
@@ -51656,10 +51740,10 @@ var init_interpreter = __esm({
51656
51740
  init_rest();
51657
51741
  init_api2();
51658
51742
  AbstractNextPossibleTokensWalker = class extends RestWalker {
51659
- constructor(topProd, path8) {
51743
+ constructor(topProd, path9) {
51660
51744
  super();
51661
51745
  this.topProd = topProd;
51662
- this.path = path8;
51746
+ this.path = path9;
51663
51747
  this.possibleTokTypes = [];
51664
51748
  this.nextProductionName = "";
51665
51749
  this.nextProductionOccurrence = 0;
@@ -51703,9 +51787,9 @@ var init_interpreter = __esm({
51703
51787
  }
51704
51788
  };
51705
51789
  NextAfterTokenWalker = class extends AbstractNextPossibleTokensWalker {
51706
- constructor(topProd, path8) {
51707
- super(topProd, path8);
51708
- this.path = path8;
51790
+ constructor(topProd, path9) {
51791
+ super(topProd, path9);
51792
+ this.path = path9;
51709
51793
  this.nextTerminalName = "";
51710
51794
  this.nextTerminalOccurrence = 0;
51711
51795
  this.nextTerminalName = this.path.lastTok.name;
@@ -51946,10 +52030,10 @@ function initializeArrayOfArrays(size) {
51946
52030
  }
51947
52031
  return result;
51948
52032
  }
51949
- function pathToHashKeys(path8) {
52033
+ function pathToHashKeys(path9) {
51950
52034
  let keys2 = [""];
51951
- for (let i4 = 0; i4 < path8.length; i4++) {
51952
- const tokType = path8[i4];
52035
+ for (let i4 = 0; i4 < path9.length; i4++) {
52036
+ const tokType = path9[i4];
51953
52037
  const longerKeys = [];
51954
52038
  for (let j4 = 0; j4 < keys2.length; j4++) {
51955
52039
  const currShorterKey = keys2[j4];
@@ -52252,7 +52336,7 @@ function validateRuleIsOverridden(ruleName, definedRulesNames, className) {
52252
52336
  }
52253
52337
  return errors;
52254
52338
  }
52255
- function validateNoLeftRecursion(topRule, currRule, errMsgProvider, path8 = []) {
52339
+ function validateNoLeftRecursion(topRule, currRule, errMsgProvider, path9 = []) {
52256
52340
  const errors = [];
52257
52341
  const nextNonTerminals = getFirstNoneTerminal(currRule.definition);
52258
52342
  if (isEmpty_default(nextNonTerminals)) {
@@ -52264,15 +52348,15 @@ function validateNoLeftRecursion(topRule, currRule, errMsgProvider, path8 = [])
52264
52348
  errors.push({
52265
52349
  message: errMsgProvider.buildLeftRecursionError({
52266
52350
  topLevelRule: topRule,
52267
- leftRecursionPath: path8
52351
+ leftRecursionPath: path9
52268
52352
  }),
52269
52353
  type: ParserDefinitionErrorType.LEFT_RECURSION,
52270
52354
  ruleName
52271
52355
  });
52272
52356
  }
52273
- const validNextSteps = difference_default(nextNonTerminals, path8.concat([topRule]));
52357
+ const validNextSteps = difference_default(nextNonTerminals, path9.concat([topRule]));
52274
52358
  const errorsFromNextSteps = flatMap_default(validNextSteps, (currRefRule) => {
52275
- const newPath = clone_default(path8);
52359
+ const newPath = clone_default(path9);
52276
52360
  newPath.push(currRefRule);
52277
52361
  return validateNoLeftRecursion(topRule, currRefRule, errMsgProvider, newPath);
52278
52362
  });
@@ -57747,7 +57831,7 @@ function validateFlowchart(text, options = {}) {
57747
57831
  const byLine = /* @__PURE__ */ new Map();
57748
57832
  const collect = (arr) => {
57749
57833
  for (const e4 of arr || []) {
57750
- if (e4 && (e4.code === "FL-LABEL-PARENS-UNQUOTED" || e4.code === "FL-LABEL-AT-IN-UNQUOTED")) {
57834
+ if (e4 && (e4.code === "FL-LABEL-PARENS-UNQUOTED" || e4.code === "FL-LABEL-AT-IN-UNQUOTED" || e4.code === "FL-LABEL-QUOTE-IN-UNQUOTED")) {
57751
57835
  const ln = e4.line ?? 0;
57752
57836
  const col = e4.column ?? 1;
57753
57837
  const list2 = byLine.get(ln) || [];
@@ -57828,6 +57912,8 @@ function validateFlowchart(text, options = {}) {
57828
57912
  const covered = existing.some((r4) => !(endCol < r4.start || startCol > r4.end));
57829
57913
  const hasParens = seg.includes("(") || seg.includes(")");
57830
57914
  const hasAt = seg.includes("@");
57915
+ const hasQuote = seg.includes('"');
57916
+ const isSingleQuoted = /^'[^]*'$/.test(trimmed);
57831
57917
  if (!covered && !isQuoted && !isParenWrapped && hasParens) {
57832
57918
  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
57919
  existing.push({ start: startCol, end: endCol });
@@ -57838,6 +57924,11 @@ function validateFlowchart(text, options = {}) {
57838
57924
  existing.push({ start: startCol, end: endCol });
57839
57925
  byLine.set(ln, existing);
57840
57926
  }
57927
+ if (!covered && !isQuoted && !isSlashPair && hasQuote && !isSingleQuoted) {
57928
+ 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;"]' });
57929
+ existing.push({ start: startCol, end: endCol });
57930
+ byLine.set(ln, existing);
57931
+ }
57841
57932
  i4 = j4;
57842
57933
  continue;
57843
57934
  } else {
@@ -64869,11 +64960,11 @@ var require_baseGet = __commonJS({
64869
64960
  "node_modules/lodash/_baseGet.js"(exports2, module2) {
64870
64961
  var castPath2 = require_castPath();
64871
64962
  var toKey2 = require_toKey();
64872
- function baseGet2(object, path8) {
64873
- path8 = castPath2(path8, object);
64874
- var index = 0, length = path8.length;
64963
+ function baseGet2(object, path9) {
64964
+ path9 = castPath2(path9, object);
64965
+ var index = 0, length = path9.length;
64875
64966
  while (object != null && index < length) {
64876
- object = object[toKey2(path8[index++])];
64967
+ object = object[toKey2(path9[index++])];
64877
64968
  }
64878
64969
  return index && index == length ? object : void 0;
64879
64970
  }
@@ -64885,8 +64976,8 @@ var require_baseGet = __commonJS({
64885
64976
  var require_get = __commonJS({
64886
64977
  "node_modules/lodash/get.js"(exports2, module2) {
64887
64978
  var baseGet2 = require_baseGet();
64888
- function get3(object, path8, defaultValue) {
64889
- var result = object == null ? void 0 : baseGet2(object, path8);
64979
+ function get3(object, path9, defaultValue) {
64980
+ var result = object == null ? void 0 : baseGet2(object, path9);
64890
64981
  return result === void 0 ? defaultValue : result;
64891
64982
  }
64892
64983
  module2.exports = get3;
@@ -64912,11 +65003,11 @@ var require_hasPath = __commonJS({
64912
65003
  var isIndex2 = require_isIndex();
64913
65004
  var isLength2 = require_isLength();
64914
65005
  var toKey2 = require_toKey();
64915
- function hasPath2(object, path8, hasFunc) {
64916
- path8 = castPath2(path8, object);
64917
- var index = -1, length = path8.length, result = false;
65006
+ function hasPath2(object, path9, hasFunc) {
65007
+ path9 = castPath2(path9, object);
65008
+ var index = -1, length = path9.length, result = false;
64918
65009
  while (++index < length) {
64919
- var key = toKey2(path8[index]);
65010
+ var key = toKey2(path9[index]);
64920
65011
  if (!(result = object != null && hasFunc(object, key))) {
64921
65012
  break;
64922
65013
  }
@@ -64937,8 +65028,8 @@ var require_hasIn = __commonJS({
64937
65028
  "node_modules/lodash/hasIn.js"(exports2, module2) {
64938
65029
  var baseHasIn2 = require_baseHasIn();
64939
65030
  var hasPath2 = require_hasPath();
64940
- function hasIn2(object, path8) {
64941
- return object != null && hasPath2(object, path8, baseHasIn2);
65031
+ function hasIn2(object, path9) {
65032
+ return object != null && hasPath2(object, path9, baseHasIn2);
64942
65033
  }
64943
65034
  module2.exports = hasIn2;
64944
65035
  }
@@ -64956,13 +65047,13 @@ var require_baseMatchesProperty = __commonJS({
64956
65047
  var toKey2 = require_toKey();
64957
65048
  var COMPARE_PARTIAL_FLAG7 = 1;
64958
65049
  var COMPARE_UNORDERED_FLAG5 = 2;
64959
- function baseMatchesProperty2(path8, srcValue) {
64960
- if (isKey2(path8) && isStrictComparable2(srcValue)) {
64961
- return matchesStrictComparable2(toKey2(path8), srcValue);
65050
+ function baseMatchesProperty2(path9, srcValue) {
65051
+ if (isKey2(path9) && isStrictComparable2(srcValue)) {
65052
+ return matchesStrictComparable2(toKey2(path9), srcValue);
64962
65053
  }
64963
65054
  return function(object) {
64964
- var objValue = get3(object, path8);
64965
- return objValue === void 0 && objValue === srcValue ? hasIn2(object, path8) : baseIsEqual2(srcValue, objValue, COMPARE_PARTIAL_FLAG7 | COMPARE_UNORDERED_FLAG5);
65055
+ var objValue = get3(object, path9);
65056
+ return objValue === void 0 && objValue === srcValue ? hasIn2(object, path9) : baseIsEqual2(srcValue, objValue, COMPARE_PARTIAL_FLAG7 | COMPARE_UNORDERED_FLAG5);
64966
65057
  };
64967
65058
  }
64968
65059
  module2.exports = baseMatchesProperty2;
@@ -64985,9 +65076,9 @@ var require_baseProperty = __commonJS({
64985
65076
  var require_basePropertyDeep = __commonJS({
64986
65077
  "node_modules/lodash/_basePropertyDeep.js"(exports2, module2) {
64987
65078
  var baseGet2 = require_baseGet();
64988
- function basePropertyDeep2(path8) {
65079
+ function basePropertyDeep2(path9) {
64989
65080
  return function(object) {
64990
- return baseGet2(object, path8);
65081
+ return baseGet2(object, path9);
64991
65082
  };
64992
65083
  }
64993
65084
  module2.exports = basePropertyDeep2;
@@ -65001,8 +65092,8 @@ var require_property = __commonJS({
65001
65092
  var basePropertyDeep2 = require_basePropertyDeep();
65002
65093
  var isKey2 = require_isKey();
65003
65094
  var toKey2 = require_toKey();
65004
- function property2(path8) {
65005
- return isKey2(path8) ? baseProperty2(toKey2(path8)) : basePropertyDeep2(path8);
65095
+ function property2(path9) {
65096
+ return isKey2(path9) ? baseProperty2(toKey2(path9)) : basePropertyDeep2(path9);
65006
65097
  }
65007
65098
  module2.exports = property2;
65008
65099
  }
@@ -65064,8 +65155,8 @@ var require_has = __commonJS({
65064
65155
  "node_modules/lodash/has.js"(exports2, module2) {
65065
65156
  var baseHas2 = require_baseHas();
65066
65157
  var hasPath2 = require_hasPath();
65067
- function has2(object, path8) {
65068
- return object != null && hasPath2(object, path8, baseHas2);
65158
+ function has2(object, path9) {
65159
+ return object != null && hasPath2(object, path9, baseHas2);
65069
65160
  }
65070
65161
  module2.exports = has2;
65071
65162
  }
@@ -67339,14 +67430,14 @@ var require_baseSet = __commonJS({
67339
67430
  var isIndex2 = require_isIndex();
67340
67431
  var isObject2 = require_isObject();
67341
67432
  var toKey2 = require_toKey();
67342
- function baseSet2(object, path8, value, customizer) {
67433
+ function baseSet2(object, path9, value, customizer) {
67343
67434
  if (!isObject2(object)) {
67344
67435
  return object;
67345
67436
  }
67346
- path8 = castPath2(path8, object);
67347
- var index = -1, length = path8.length, lastIndex = length - 1, nested = object;
67437
+ path9 = castPath2(path9, object);
67438
+ var index = -1, length = path9.length, lastIndex = length - 1, nested = object;
67348
67439
  while (nested != null && ++index < length) {
67349
- var key = toKey2(path8[index]), newValue = value;
67440
+ var key = toKey2(path9[index]), newValue = value;
67350
67441
  if (key === "__proto__" || key === "constructor" || key === "prototype") {
67351
67442
  return object;
67352
67443
  }
@@ -67354,7 +67445,7 @@ var require_baseSet = __commonJS({
67354
67445
  var objValue = nested[key];
67355
67446
  newValue = customizer ? customizer(objValue, key, nested) : void 0;
67356
67447
  if (newValue === void 0) {
67357
- newValue = isObject2(objValue) ? objValue : isIndex2(path8[index + 1]) ? [] : {};
67448
+ newValue = isObject2(objValue) ? objValue : isIndex2(path9[index + 1]) ? [] : {};
67358
67449
  }
67359
67450
  }
67360
67451
  assignValue2(nested, key, newValue);
@@ -67375,9 +67466,9 @@ var require_basePickBy = __commonJS({
67375
67466
  function basePickBy2(object, paths, predicate) {
67376
67467
  var index = -1, length = paths.length, result = {};
67377
67468
  while (++index < length) {
67378
- var path8 = paths[index], value = baseGet2(object, path8);
67379
- if (predicate(value, path8)) {
67380
- baseSet2(result, castPath2(path8, object), value);
67469
+ var path9 = paths[index], value = baseGet2(object, path9);
67470
+ if (predicate(value, path9)) {
67471
+ baseSet2(result, castPath2(path9, object), value);
67381
67472
  }
67382
67473
  }
67383
67474
  return result;
@@ -67392,8 +67483,8 @@ var require_basePick = __commonJS({
67392
67483
  var basePickBy2 = require_basePickBy();
67393
67484
  var hasIn2 = require_hasIn();
67394
67485
  function basePick(object, paths) {
67395
- return basePickBy2(object, paths, function(value, path8) {
67396
- return hasIn2(object, path8);
67486
+ return basePickBy2(object, paths, function(value, path9) {
67487
+ return hasIn2(object, path9);
67397
67488
  });
67398
67489
  }
67399
67490
  module2.exports = basePick;
@@ -68447,15 +68538,15 @@ var require_parent_dummy_chains = __commonJS({
68447
68538
  var node = g4.node(v4);
68448
68539
  var edgeObj = node.edgeObj;
68449
68540
  var pathData = findPath(g4, postorderNums, edgeObj.v, edgeObj.w);
68450
- var path8 = pathData.path;
68541
+ var path9 = pathData.path;
68451
68542
  var lca = pathData.lca;
68452
68543
  var pathIdx = 0;
68453
- var pathV = path8[pathIdx];
68544
+ var pathV = path9[pathIdx];
68454
68545
  var ascending = true;
68455
68546
  while (v4 !== edgeObj.w) {
68456
68547
  node = g4.node(v4);
68457
68548
  if (ascending) {
68458
- while ((pathV = path8[pathIdx]) !== lca && g4.node(pathV).maxRank < node.rank) {
68549
+ while ((pathV = path9[pathIdx]) !== lca && g4.node(pathV).maxRank < node.rank) {
68459
68550
  pathIdx++;
68460
68551
  }
68461
68552
  if (pathV === lca) {
@@ -68463,10 +68554,10 @@ var require_parent_dummy_chains = __commonJS({
68463
68554
  }
68464
68555
  }
68465
68556
  if (!ascending) {
68466
- while (pathIdx < path8.length - 1 && g4.node(pathV = path8[pathIdx + 1]).minRank <= node.rank) {
68557
+ while (pathIdx < path9.length - 1 && g4.node(pathV = path9[pathIdx + 1]).minRank <= node.rank) {
68467
68558
  pathIdx++;
68468
68559
  }
68469
- pathV = path8[pathIdx];
68560
+ pathV = path9[pathIdx];
68470
68561
  }
68471
68562
  g4.setParent(v4, pathV);
68472
68563
  v4 = g4.successors(v4)[0];
@@ -70639,8 +70730,8 @@ var init_svg_generator = __esm({
70639
70730
  elements.push(this.generateNodeWithPad(node, padX, padY));
70640
70731
  }
70641
70732
  for (const edge of layout.edges) {
70642
- const { path: path8, overlay } = this.generateEdge(edge, padX, padY, nodeMap);
70643
- elements.push(path8);
70733
+ const { path: path9, overlay } = this.generateEdge(edge, padX, padY, nodeMap);
70734
+ elements.push(path9);
70644
70735
  if (overlay)
70645
70736
  overlays.push(overlay);
70646
70737
  }
@@ -76956,8 +77047,8 @@ var require_utils = __commonJS({
76956
77047
  }
76957
77048
  return ind;
76958
77049
  }
76959
- function removeDotSegments(path8) {
76960
- let input = path8;
77050
+ function removeDotSegments(path9) {
77051
+ let input = path9;
76961
77052
  const output = [];
76962
77053
  let nextSlash = -1;
76963
77054
  let len = 0;
@@ -77156,8 +77247,8 @@ var require_schemes = __commonJS({
77156
77247
  wsComponent.secure = void 0;
77157
77248
  }
77158
77249
  if (wsComponent.resourceName) {
77159
- const [path8, query2] = wsComponent.resourceName.split("?");
77160
- wsComponent.path = path8 && path8 !== "/" ? path8 : void 0;
77250
+ const [path9, query2] = wsComponent.resourceName.split("?");
77251
+ wsComponent.path = path9 && path9 !== "/" ? path9 : void 0;
77161
77252
  wsComponent.query = query2;
77162
77253
  wsComponent.resourceName = void 0;
77163
77254
  }
@@ -80500,7 +80591,7 @@ function validateJsonResponse(response, options = {}) {
80500
80591
  }
80501
80592
  if (!valid) {
80502
80593
  const formattedErrors = validate2.errors.map((err) => {
80503
- const path8 = err.instancePath ? err.instancePath.substring(1).replace(/\//g, ".") : "<root>";
80594
+ const path9 = err.instancePath ? err.instancePath.substring(1).replace(/\//g, ".") : "<root>";
80504
80595
  let message = "";
80505
80596
  let suggestion = "";
80506
80597
  if (err.keyword === "additionalProperties") {
@@ -80538,7 +80629,7 @@ function validateJsonResponse(response, options = {}) {
80538
80629
  message = err.message;
80539
80630
  suggestion = "";
80540
80631
  }
80541
- const location = path8 ? `at '${path8}'` : "at root";
80632
+ const location = path9 ? `at '${path9}'` : "at root";
80542
80633
  return suggestion ? `${location}: ${message} \u2192 ${suggestion}` : `${location}: ${message}`;
80543
80634
  });
80544
80635
  const errorSummary = formattedErrors.join("\n ");
@@ -80861,7 +80952,7 @@ function extractMermaidFromJson(response) {
80861
80952
  }
80862
80953
  const diagrams = [];
80863
80954
  const jsonPaths = [];
80864
- function searchObject(obj, path8 = []) {
80955
+ function searchObject(obj, path9 = []) {
80865
80956
  if (typeof obj === "string") {
80866
80957
  const mermaidPattern = /```mermaid([^\n`]*?)(?:\n|\\n)([\s\S]*?)```/gi;
80867
80958
  let match2;
@@ -80875,14 +80966,14 @@ function extractMermaidFromJson(response) {
80875
80966
  endIndex: match2.index + match2[0].length,
80876
80967
  attributes,
80877
80968
  isInJson: true,
80878
- jsonPath: path8.join(".")
80969
+ jsonPath: path9.join(".")
80879
80970
  });
80880
- jsonPaths.push(path8.join("."));
80971
+ jsonPaths.push(path9.join("."));
80881
80972
  }
80882
80973
  } else if (Array.isArray(obj)) {
80883
- obj.forEach((item, index) => searchObject(item, [...path8, `[${index}]`]));
80974
+ obj.forEach((item, index) => searchObject(item, [...path9, `[${index}]`]));
80884
80975
  } else if (obj && typeof obj === "object") {
80885
- Object.entries(obj).forEach(([key, value]) => searchObject(value, [...path8, key]));
80976
+ Object.entries(obj).forEach(([key, value]) => searchObject(value, [...path9, key]));
80886
80977
  }
80887
80978
  }
80888
80979
  searchObject(parsedJson);
@@ -81139,7 +81230,7 @@ async function tryMaidAutoFix(diagramContent, options = {}) {
81139
81230
  }
81140
81231
  }
81141
81232
  async function validateAndFixMermaidResponse(response, options = {}) {
81142
- const { schema, debug, path: path8, provider, model, tracer } = options;
81233
+ const { schema, debug, path: path9, provider, model, tracer } = options;
81143
81234
  const startTime = Date.now();
81144
81235
  if (debug) {
81145
81236
  console.log(`[DEBUG] Mermaid validation: Starting maid-based validation for response (${response.length} chars)`);
@@ -81296,7 +81387,7 @@ ${maidResult.fixed}
81296
81387
  }
81297
81388
  const aiFixingStart = Date.now();
81298
81389
  const mermaidFixer = new MermaidFixingAgent({
81299
- path: path8,
81390
+ path: path9,
81300
81391
  provider,
81301
81392
  model,
81302
81393
  debug,
@@ -81538,8 +81629,8 @@ Schema Validation Errors:
81538
81629
  ${validationResult.errorSummary}`;
81539
81630
  } else if (validationResult.schemaErrors && validationResult.schemaErrors.length > 0) {
81540
81631
  const errors = validationResult.schemaErrors.map((err) => {
81541
- const path8 = err.instancePath || "(root)";
81542
- return ` ${path8}: ${err.message}`;
81632
+ const path9 = err.instancePath || "(root)";
81633
+ return ` ${path9}: ${err.message}`;
81543
81634
  }).join("\n");
81544
81635
  schemaErrorDetails = `
81545
81636
 
@@ -81899,11 +81990,11 @@ function loadMCPConfigurationFromPath(configPath) {
81899
81990
  if (!configPath) {
81900
81991
  throw new Error("Config path is required");
81901
81992
  }
81902
- if (!(0, import_fs9.existsSync)(configPath)) {
81993
+ if (!(0, import_fs12.existsSync)(configPath)) {
81903
81994
  throw new Error(`MCP configuration file not found: ${configPath}`);
81904
81995
  }
81905
81996
  try {
81906
- const content = (0, import_fs9.readFileSync)(configPath, "utf8");
81997
+ const content = (0, import_fs12.readFileSync)(configPath, "utf8");
81907
81998
  const config = JSON.parse(content);
81908
81999
  if (process.env.DEBUG === "1" || process.env.DEBUG_MCP === "1") {
81909
82000
  console.error(`[MCP DEBUG] Loaded configuration from: ${configPath}`);
@@ -81918,19 +82009,19 @@ function loadMCPConfiguration() {
81918
82009
  // Environment variable path
81919
82010
  process.env.MCP_CONFIG_PATH,
81920
82011
  // Local project paths
81921
- (0, import_path10.join)(process.cwd(), ".mcp", "config.json"),
81922
- (0, import_path10.join)(process.cwd(), "mcp.config.json"),
82012
+ (0, import_path11.join)(process.cwd(), ".mcp", "config.json"),
82013
+ (0, import_path11.join)(process.cwd(), "mcp.config.json"),
81923
82014
  // Home directory paths
81924
- (0, import_path10.join)((0, import_os3.homedir)(), ".config", "probe", "mcp.json"),
81925
- (0, import_path10.join)((0, import_os3.homedir)(), ".mcp", "config.json"),
82015
+ (0, import_path11.join)((0, import_os3.homedir)(), ".config", "probe", "mcp.json"),
82016
+ (0, import_path11.join)((0, import_os3.homedir)(), ".mcp", "config.json"),
81926
82017
  // Claude-style config location
81927
- (0, import_path10.join)((0, import_os3.homedir)(), "Library", "Application Support", "Claude", "mcp_config.json")
82018
+ (0, import_path11.join)((0, import_os3.homedir)(), "Library", "Application Support", "Claude", "mcp_config.json")
81928
82019
  ].filter(Boolean);
81929
82020
  let config = null;
81930
82021
  for (const configPath of configPaths) {
81931
- if ((0, import_fs9.existsSync)(configPath)) {
82022
+ if ((0, import_fs12.existsSync)(configPath)) {
81932
82023
  try {
81933
- const content = (0, import_fs9.readFileSync)(configPath, "utf8");
82024
+ const content = (0, import_fs12.readFileSync)(configPath, "utf8");
81934
82025
  config = JSON.parse(content);
81935
82026
  if (process.env.DEBUG === "1" || process.env.DEBUG_MCP === "1") {
81936
82027
  console.error(`[MCP DEBUG] Loaded configuration from: ${configPath}`);
@@ -82026,22 +82117,22 @@ function parseEnabledServers(config) {
82026
82117
  }
82027
82118
  return servers;
82028
82119
  }
82029
- var import_fs9, import_path10, import_os3, import_url4, __filename4, __dirname4, DEFAULT_CONFIG;
82120
+ var import_fs12, import_path11, import_os3, import_url4, __filename4, __dirname4, DEFAULT_CONFIG;
82030
82121
  var init_config = __esm({
82031
82122
  "src/agent/mcp/config.js"() {
82032
82123
  "use strict";
82033
- import_fs9 = require("fs");
82034
- import_path10 = require("path");
82124
+ import_fs12 = require("fs");
82125
+ import_path11 = require("path");
82035
82126
  import_os3 = require("os");
82036
82127
  import_url4 = require("url");
82037
82128
  __filename4 = (0, import_url4.fileURLToPath)("file:///");
82038
- __dirname4 = (0, import_path10.dirname)(__filename4);
82129
+ __dirname4 = (0, import_path11.dirname)(__filename4);
82039
82130
  DEFAULT_CONFIG = {
82040
82131
  mcpServers: {
82041
82132
  // Example probe server configuration
82042
82133
  "probe-local": {
82043
82134
  command: "node",
82044
- args: [(0, import_path10.join)(__dirname4, "../../../examples/chat/mcpServer.js")],
82135
+ args: [(0, import_path11.join)(__dirname4, "../../../examples/chat/mcpServer.js")],
82045
82136
  transport: "stdio",
82046
82137
  enabled: false
82047
82138
  },
@@ -84161,12 +84252,12 @@ async function createEnhancedClaudeCLIEngine(options = {}) {
84161
84252
  console.log("[DEBUG] Built-in MCP server started");
84162
84253
  console.log("[DEBUG] MCP URL:", `http://${host}:${port}/mcp`);
84163
84254
  }
84164
- mcpConfigPath = import_path11.default.join(import_os4.default.tmpdir(), `probe-mcp-${session.id}.json`);
84255
+ mcpConfigPath = import_path12.default.join(import_os4.default.tmpdir(), `probe-mcp-${session.id}.json`);
84165
84256
  const mcpConfig = {
84166
84257
  mcpServers: {
84167
84258
  probe: {
84168
84259
  command: "node",
84169
- args: [import_path11.default.join(process.cwd(), "mcp-probe-server.js")],
84260
+ args: [import_path12.default.join(process.cwd(), "mcp-probe-server.js")],
84170
84261
  env: {
84171
84262
  PROBE_WORKSPACE: process.cwd(),
84172
84263
  DEBUG: debug ? "true" : "false"
@@ -84535,14 +84626,14 @@ function combinePrompts(systemPrompt, customPrompt, agent) {
84535
84626
  }
84536
84627
  return systemPrompt || "";
84537
84628
  }
84538
- var import_child_process9, import_crypto6, import_promises2, import_path11, import_os4, import_events3;
84629
+ var import_child_process9, import_crypto6, import_promises2, import_path12, import_os4, import_events3;
84539
84630
  var init_enhanced_claude_code = __esm({
84540
84631
  "src/agent/engines/enhanced-claude-code.js"() {
84541
84632
  "use strict";
84542
84633
  import_child_process9 = require("child_process");
84543
84634
  import_crypto6 = require("crypto");
84544
84635
  import_promises2 = __toESM(require("fs/promises"), 1);
84545
- import_path11 = __toESM(require("path"), 1);
84636
+ import_path12 = __toESM(require("path"), 1);
84546
84637
  import_os4 = __toESM(require("os"), 1);
84547
84638
  import_events3 = require("events");
84548
84639
  init_built_in_server();
@@ -84900,7 +84991,7 @@ __export(ProbeAgent_exports, {
84900
84991
  ProbeAgent: () => ProbeAgent
84901
84992
  });
84902
84993
  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;
84994
+ var import_dotenv2, import_anthropic2, import_openai2, import_google2, import_ai5, import_crypto8, import_events4, import_fs13, import_promises3, import_path13, MAX_TOOL_ITERATIONS, MAX_HISTORY_MESSAGES, MAX_IMAGE_FILE_SIZE, ProbeAgent;
84904
84995
  var init_ProbeAgent = __esm({
84905
84996
  "src/agent/ProbeAgent.js"() {
84906
84997
  import_dotenv2 = __toESM(require_main(), 1);
@@ -84911,9 +85002,9 @@ var init_ProbeAgent = __esm({
84911
85002
  import_ai5 = require("ai");
84912
85003
  import_crypto8 = require("crypto");
84913
85004
  import_events4 = require("events");
84914
- import_fs10 = require("fs");
85005
+ import_fs13 = require("fs");
84915
85006
  import_promises3 = require("fs/promises");
84916
- import_path12 = require("path");
85007
+ import_path13 = require("path");
84917
85008
  init_tokenCounter();
84918
85009
  init_InMemoryStorageAdapter();
84919
85010
  init_HookManager();
@@ -84952,6 +85043,7 @@ var init_ProbeAgent = __esm({
84952
85043
  * @param {boolean} [options.allowEdit=false] - Allow the use of the 'implement' tool
84953
85044
  * @param {boolean} [options.enableDelegate=false] - Enable the delegate tool for task distribution to subagents
84954
85045
  * @param {string} [options.path] - Search directory path
85046
+ * @param {string} [options.cwd] - Working directory for resolving relative paths (independent of allowedFolders)
84955
85047
  * @param {string} [options.provider] - Force specific AI provider
84956
85048
  * @param {string} [options.model] - Override model name
84957
85049
  * @param {boolean} [options.debug] - Enable debug mode
@@ -84980,6 +85072,7 @@ var init_ProbeAgent = __esm({
84980
85072
  * @param {Array<Object>} [options.fallback.providers] - List of provider configurations for custom fallback
84981
85073
  * @param {boolean} [options.fallback.stopOnSuccess=true] - Stop on first success
84982
85074
  * @param {number} [options.fallback.maxTotalAttempts=10] - Maximum total attempts across all providers
85075
+ * @param {string} [options.completionPrompt] - Custom prompt to run after attempt_completion for validation/review (runs before mermaid/JSON validation)
84983
85076
  */
84984
85077
  constructor(options = {}) {
84985
85078
  this.sessionId = options.sessionId || (0, import_crypto8.randomUUID)();
@@ -85001,6 +85094,7 @@ var init_ProbeAgent = __esm({
85001
85094
  this.maxIterations = options.maxIterations || null;
85002
85095
  this.disableMermaidValidation = !!options.disableMermaidValidation;
85003
85096
  this.disableJsonValidation = !!options.disableJsonValidation;
85097
+ this.completionPrompt = options.completionPrompt || null;
85004
85098
  const effectiveAllowedTools = options.disableTools ? [] : options.allowedTools;
85005
85099
  this.allowedTools = this._parseAllowedTools(effectiveAllowedTools);
85006
85100
  this.storageAdapter = options.storageAdapter || new InMemoryStorageAdapter();
@@ -85019,6 +85113,7 @@ var init_ProbeAgent = __esm({
85019
85113
  } else {
85020
85114
  this.allowedFolders = [process.cwd()];
85021
85115
  }
85116
+ this.cwd = options.cwd || null;
85022
85117
  this.clientApiProvider = options.provider || null;
85023
85118
  this.clientApiModel = options.model || null;
85024
85119
  this.clientApiKey = null;
@@ -85197,7 +85292,8 @@ var init_ProbeAgent = __esm({
85197
85292
  const configOptions = {
85198
85293
  sessionId: this.sessionId,
85199
85294
  debug: this.debug,
85200
- defaultPath: this.allowedFolders.length > 0 ? this.allowedFolders[0] : process.cwd(),
85295
+ // Use explicit cwd if set, otherwise fall back to first allowed folder
85296
+ cwd: this.cwd || (this.allowedFolders.length > 0 ? this.allowedFolders[0] : process.cwd()),
85201
85297
  allowedFolders: this.allowedFolders,
85202
85298
  outline: this.outline,
85203
85299
  allowEdit: this.allowEdit,
@@ -85235,7 +85331,7 @@ var init_ProbeAgent = __esm({
85235
85331
  if (!imagePath) {
85236
85332
  throw new Error("Image path is required");
85237
85333
  }
85238
- const filename = (0, import_path12.basename)(imagePath);
85334
+ const filename = (0, import_path13.basename)(imagePath);
85239
85335
  const extension = filename.toLowerCase().split(".").pop();
85240
85336
  if (!extension || !SUPPORTED_IMAGE_EXTENSIONS.includes(extension)) {
85241
85337
  throw new Error(`Invalid or unsupported image extension: ${extension}. Supported formats: ${SUPPORTED_IMAGE_EXTENSIONS.join(", ")}`);
@@ -85790,7 +85886,7 @@ var init_ProbeAgent = __esm({
85790
85886
  let resolvedPath2 = imagePath;
85791
85887
  if (!imagePath.includes("/") && !imagePath.includes("\\")) {
85792
85888
  for (const dir of listFilesDirectories) {
85793
- const potentialPath = (0, import_path12.resolve)(dir, imagePath);
85889
+ const potentialPath = (0, import_path13.resolve)(dir, imagePath);
85794
85890
  const loaded = await this.loadImageIfValid(potentialPath);
85795
85891
  if (loaded) {
85796
85892
  if (this.debug) {
@@ -85815,7 +85911,7 @@ var init_ProbeAgent = __esm({
85815
85911
  let match2;
85816
85912
  while ((match2 = fileHeaderPattern.exec(content)) !== null) {
85817
85913
  const filePath = match2[1].trim();
85818
- const dir = (0, import_path12.dirname)(filePath);
85914
+ const dir = (0, import_path13.dirname)(filePath);
85819
85915
  if (dir && dir !== ".") {
85820
85916
  directories.push(dir);
85821
85917
  if (this.debug) {
@@ -85860,17 +85956,17 @@ var init_ProbeAgent = __esm({
85860
85956
  const allowedDirs = this.allowedFolders && this.allowedFolders.length > 0 ? this.allowedFolders : [process.cwd()];
85861
85957
  let absolutePath;
85862
85958
  let isPathAllowed2 = false;
85863
- if ((0, import_path12.isAbsolute)(imagePath)) {
85864
- absolutePath = (0, import_path12.normalize)((0, import_path12.resolve)(imagePath));
85959
+ if ((0, import_path13.isAbsolute)(imagePath)) {
85960
+ absolutePath = (0, import_path13.normalize)((0, import_path13.resolve)(imagePath));
85865
85961
  isPathAllowed2 = allowedDirs.some((dir) => {
85866
- const normalizedDir = (0, import_path12.normalize)((0, import_path12.resolve)(dir));
85867
- return absolutePath === normalizedDir || absolutePath.startsWith(normalizedDir + import_path12.sep);
85962
+ const normalizedDir = (0, import_path13.normalize)((0, import_path13.resolve)(dir));
85963
+ return absolutePath === normalizedDir || absolutePath.startsWith(normalizedDir + import_path13.sep);
85868
85964
  });
85869
85965
  } else {
85870
85966
  for (const dir of allowedDirs) {
85871
- const normalizedDir = (0, import_path12.normalize)((0, import_path12.resolve)(dir));
85872
- const resolvedPath2 = (0, import_path12.normalize)((0, import_path12.resolve)(dir, imagePath));
85873
- if (resolvedPath2 === normalizedDir || resolvedPath2.startsWith(normalizedDir + import_path12.sep)) {
85967
+ const normalizedDir = (0, import_path13.normalize)((0, import_path13.resolve)(dir));
85968
+ const resolvedPath2 = (0, import_path13.normalize)((0, import_path13.resolve)(dir, imagePath));
85969
+ if (resolvedPath2 === normalizedDir || resolvedPath2.startsWith(normalizedDir + import_path13.sep)) {
85874
85970
  absolutePath = resolvedPath2;
85875
85971
  isPathAllowed2 = true;
85876
85972
  break;
@@ -87048,6 +87144,46 @@ IMPORTANT: When using <attempt_complete>, this must be the ONLY content in your
87048
87144
  } catch (error2) {
87049
87145
  console.error(`[ERROR] Failed to save messages to storage:`, error2);
87050
87146
  }
87147
+ if (completionAttempted && this.completionPrompt && !options._completionPromptProcessed) {
87148
+ if (this.debug) {
87149
+ console.log("[DEBUG] Running completion prompt for post-completion validation/review...");
87150
+ }
87151
+ try {
87152
+ if (this.tracer) {
87153
+ this.tracer.recordEvent("completion_prompt.started", {
87154
+ "completion_prompt.original_result_length": finalResult?.length || 0
87155
+ });
87156
+ }
87157
+ const completionPromptMessage = `${this.completionPrompt}
87158
+
87159
+ Here is the result to review:
87160
+ <result>
87161
+ ${finalResult}
87162
+ </result>
87163
+
87164
+ After reviewing, provide your final answer using attempt_completion.`;
87165
+ const completionResult = await this.answer(completionPromptMessage, [], {
87166
+ ...options,
87167
+ _completionPromptProcessed: true
87168
+ });
87169
+ finalResult = completionResult;
87170
+ if (this.debug) {
87171
+ console.log(`[DEBUG] Completion prompt finished. New result length: ${finalResult?.length || 0}`);
87172
+ }
87173
+ if (this.tracer) {
87174
+ this.tracer.recordEvent("completion_prompt.completed", {
87175
+ "completion_prompt.final_result_length": finalResult?.length || 0
87176
+ });
87177
+ }
87178
+ } catch (error2) {
87179
+ console.error("[ERROR] Completion prompt failed:", error2);
87180
+ if (this.tracer) {
87181
+ this.tracer.recordEvent("completion_prompt.error", {
87182
+ "completion_prompt.error": error2.message
87183
+ });
87184
+ }
87185
+ }
87186
+ }
87051
87187
  const reachedMaxIterations = currentIteration >= maxIterations && !completionAttempted;
87052
87188
  if (options.schema && !options._schemaFormatted && !completionAttempted && !reachedMaxIterations) {
87053
87189
  if (this.debug) {
@@ -87514,6 +87650,8 @@ Convert your previous response content into actual JSON data that follows this s
87514
87650
  path: this.allowedFolders[0],
87515
87651
  // Use first allowed folder as primary path
87516
87652
  allowedFolders: [...this.allowedFolders],
87653
+ cwd: this.cwd,
87654
+ // Preserve explicit working directory
87517
87655
  provider: this.clientApiProvider,
87518
87656
  model: this.clientApiModel,
87519
87657
  debug: this.debug,
@@ -87522,6 +87660,7 @@ Convert your previous response content into actual JSON data that follows this s
87522
87660
  maxIterations: this.maxIterations,
87523
87661
  disableMermaidValidation: this.disableMermaidValidation,
87524
87662
  disableJsonValidation: this.disableJsonValidation,
87663
+ completionPrompt: this.completionPrompt,
87525
87664
  allowedTools: allowedToolsArray,
87526
87665
  enableMcp: !!this.mcpBridge,
87527
87666
  mcpConfig: this.mcpConfig,