@lvce-editor/chat-tool-worker 8.8.0 → 9.1.0

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.
@@ -1787,16 +1787,23 @@ const isFileUri = value => {
1787
1787
  return value.startsWith('file://');
1788
1788
  };
1789
1789
 
1790
+ const defaultExcludeGlobs = ['!**/node_modules/**', '!**/.git/**'];
1790
1791
  const getRipGrepArgs = ({
1791
1792
  includeIgnoredFiles,
1792
1793
  includePattern,
1793
1794
  isRegexp,
1794
- query
1795
+ query,
1796
+ useDefaultExcludes
1795
1797
  }) => {
1796
1798
  const ripGrepArgs = ['--hidden', '--no-require-git', '--smart-case', '--stats', '--json', '--threads', '1', '--ignore-case'];
1797
1799
  if (includeIgnoredFiles) {
1798
1800
  ripGrepArgs.push('--no-ignore');
1799
1801
  }
1802
+ if (useDefaultExcludes) {
1803
+ for (const glob of defaultExcludeGlobs) {
1804
+ ripGrepArgs.push('--glob', glob);
1805
+ }
1806
+ }
1800
1807
  if (includePattern && !isFileUri(includePattern) && !isAbsoluteFileSystemPath(includePattern)) {
1801
1808
  ripGrepArgs.push('--glob', includePattern);
1802
1809
  }
@@ -1921,7 +1928,8 @@ const getGrepSearchArgs = args => {
1921
1928
  isRegexp,
1922
1929
  maxResults,
1923
1930
  outputFormat,
1924
- query
1931
+ query,
1932
+ useDefaultExcludes
1925
1933
  } = args;
1926
1934
  if (typeof query !== 'string' || typeof isRegexp !== 'boolean') {
1927
1935
  return undefined;
@@ -1935,6 +1943,9 @@ const getGrepSearchArgs = args => {
1935
1943
  if (includeIgnoredFiles !== undefined && typeof includeIgnoredFiles !== 'boolean') {
1936
1944
  return undefined;
1937
1945
  }
1946
+ if (useDefaultExcludes !== undefined && typeof useDefaultExcludes !== 'boolean') {
1947
+ return undefined;
1948
+ }
1938
1949
  if (outputFormat !== undefined && outputFormat !== 'xml' && outputFormat !== 'json') {
1939
1950
  return undefined;
1940
1951
  }
@@ -1952,11 +1963,12 @@ const getGrepSearchArgs = args => {
1952
1963
  outputFormat
1953
1964
  }),
1954
1965
  isRegexp,
1955
- query
1966
+ query,
1967
+ useDefaultExcludes: useDefaultExcludes === undefined ? true : useDefaultExcludes
1956
1968
  };
1957
1969
  };
1958
1970
 
1959
- const grepSearchArgumentError = 'Invalid argument: grep_search requires query (string), isRegexp (boolean), optional includePattern (string), optional maxResults (number), optional includeIgnoredFiles (boolean), and optional outputFormat ("xml" | "json").';
1971
+ const grepSearchArgumentError = 'Invalid argument: grep_search requires query (string), isRegexp (boolean), optional includePattern (string), optional maxResults (number), optional includeIgnoredFiles (boolean), optional useDefaultExcludes (boolean), and optional outputFormat ("xml" | "json").';
1960
1972
 
1961
1973
  const executeGrepSearchTool = async (args, options) => {
1962
1974
  const grepSearchArgs = getGrepSearchArgs(args);
@@ -2003,21 +2015,16 @@ const executeListFilesTool = async (args, _options) => {
2003
2015
  }
2004
2016
  if (uri === 'file:///workspace' || uri.startsWith('file:///workspace/')) {
2005
2017
  return {
2006
- error: 'Invalid argument: uri must be a real workspace folder URI. Call getWorkspaceUri first and use the returned workspaceUri value.',
2007
- uri
2018
+ error: 'Invalid argument: uri must be a real workspace folder URI. Call getWorkspaceUri first and use the returned workspaceUri value.'
2008
2019
  };
2009
2020
  }
2010
2021
  try {
2011
2022
  const entries = await invoke$1('FileSystem.readDirWithFileTypes', uri);
2012
2023
  return {
2013
- entries: entries.map(mapEntry),
2014
- uri
2024
+ entries: entries.map(mapEntry)
2015
2025
  };
2016
2026
  } catch (error) {
2017
- return {
2018
- ...getToolErrorPayload(error),
2019
- uri
2020
- };
2027
+ return getToolErrorPayload(error);
2021
2028
  }
2022
2029
  };
2023
2030
 
@@ -2619,7 +2626,7 @@ const getGlobTool = () => {
2619
2626
  const getGrepSearchTool = () => {
2620
2627
  return {
2621
2628
  function: {
2622
- description: "Do a fast text search in the workspace. Use this tool when you want to search with an exact string or regex. If you are not sure what words will appear in the workspace, prefer using regex patterns with alternation (|) or character classes to search for multiple potential words at once instead of making separate searches. For example, use 'function|method|procedure' to look for all of those words at once. Use includePattern to search within files matching a specific pattern, or in a specific file, using a relative path. Use 'includeIgnoredFiles' to include files normally ignored by .gitignore, other ignore files, and `files.exclude` and `search.exclude` settings. Warning: using this may cause the search to be slower, only set it when you want to search in ignored folders like node_modules or build outputs. Use this tool when you want to see an overview of a particular file, instead of using read_file many times to look for code within a file.\n\nIn a multi-root workspace, you can scope the search to a specific workspace folder by using the absolute path to the folder as the includePattern, e.g. /path/to/folder.",
2629
+ description: "Do a fast text search in the workspace. Use this tool when you want to search with an exact string or regex. If you are not sure what words will appear in the workspace, prefer using regex patterns with alternation (|) or character classes to search for multiple potential words at once instead of making separate searches. For example, use 'function|method|procedure' to look for all of those words at once. Use includePattern to search within files matching a specific pattern, or in a specific file, using a relative path. Use 'includeIgnoredFiles' to include files normally ignored by .gitignore, other ignore files and `files.exclude` and `search.exclude` settings. Warning: using this may cause the search to be slower, only set it when you want to search in ignored folders like node_modules or build outputs. By default, grep_search also excludes node_modules and .git via ripgrep globs; set useDefaultExcludes to false if you need to search those directories. Use this tool when you want to see an overview of a particular file, instead of using read_file many times to look for code within a file.\n\nIn a multi-root workspace, you can scope the search to a specific workspace folder by using the absolute path to the folder as the includePattern, e.g. /path/to/folder.",
2623
2630
  name: 'grep_search',
2624
2631
  parameters: {
2625
2632
  additionalProperties: false,
@@ -2648,6 +2655,10 @@ const getGrepSearchTool = () => {
2648
2655
  query: {
2649
2656
  description: "The pattern to search for in files in the workspace. Use regex with alternation (e.g., 'word1|word2|word3') or character classes to find multiple potential words in a single search. Be sure to set the isRegexp property properly to declare whether it's a regex or plain text pattern. Is case-insensitive.",
2650
2657
  type: 'string'
2658
+ },
2659
+ useDefaultExcludes: {
2660
+ description: 'Whether to exclude node_modules and .git with built-in ripgrep globs. Defaults to true. Set to false when you explicitly need to search those directories.',
2661
+ type: 'boolean'
2651
2662
  }
2652
2663
  },
2653
2664
  required: ['query', 'isRegexp'],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/chat-tool-worker",
3
- "version": "8.8.0",
3
+ "version": "9.1.0",
4
4
  "description": "Chat Tool Worker",
5
5
  "repository": {
6
6
  "type": "git",