@lvce-editor/chat-tool-worker 7.10.0 → 7.11.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.
- package/dist/chatToolWorkerMain.js +86 -1
- package/package.json +1 -1
|
@@ -1107,6 +1107,53 @@ const executeGlobTool = async (args, _options) => {
|
|
|
1107
1107
|
};
|
|
1108
1108
|
};
|
|
1109
1109
|
|
|
1110
|
+
const getGrepSearchArgs = args => {
|
|
1111
|
+
const {
|
|
1112
|
+
includeIgnoredFiles,
|
|
1113
|
+
includePattern,
|
|
1114
|
+
isRegexp,
|
|
1115
|
+
maxResults,
|
|
1116
|
+
query
|
|
1117
|
+
} = args;
|
|
1118
|
+
if (typeof query !== 'string' || typeof isRegexp !== 'boolean') {
|
|
1119
|
+
return undefined;
|
|
1120
|
+
}
|
|
1121
|
+
if (includePattern !== undefined && typeof includePattern !== 'string') {
|
|
1122
|
+
return undefined;
|
|
1123
|
+
}
|
|
1124
|
+
if (maxResults !== undefined && typeof maxResults !== 'number') {
|
|
1125
|
+
return undefined;
|
|
1126
|
+
}
|
|
1127
|
+
if (includeIgnoredFiles !== undefined && typeof includeIgnoredFiles !== 'boolean') {
|
|
1128
|
+
return undefined;
|
|
1129
|
+
}
|
|
1130
|
+
return {
|
|
1131
|
+
...(includeIgnoredFiles === undefined ? {} : {
|
|
1132
|
+
includeIgnoredFiles
|
|
1133
|
+
}),
|
|
1134
|
+
...(includePattern === undefined ? {} : {
|
|
1135
|
+
includePattern
|
|
1136
|
+
}),
|
|
1137
|
+
...(maxResults === undefined ? {} : {
|
|
1138
|
+
maxResults
|
|
1139
|
+
}),
|
|
1140
|
+
isRegexp,
|
|
1141
|
+
query
|
|
1142
|
+
};
|
|
1143
|
+
};
|
|
1144
|
+
const executeGrepSearchTool = async (args, _options) => {
|
|
1145
|
+
const grepSearchArgs = getGrepSearchArgs(args);
|
|
1146
|
+
if (!grepSearchArgs) {
|
|
1147
|
+
return {
|
|
1148
|
+
error: 'Invalid argument: grep_search requires query (string), isRegexp (boolean), optional includePattern (string), optional maxResults (number), and optional includeIgnoredFiles (boolean).'
|
|
1149
|
+
};
|
|
1150
|
+
}
|
|
1151
|
+
return {
|
|
1152
|
+
arguments: grepSearchArgs,
|
|
1153
|
+
result: 'No matches found.'
|
|
1154
|
+
};
|
|
1155
|
+
};
|
|
1156
|
+
|
|
1110
1157
|
const executeListFilesTool = async (args, _options) => {
|
|
1111
1158
|
const uri = typeof args.uri === 'string' ? args.uri : '';
|
|
1112
1159
|
if (!uri || !isAbsoluteUri(uri)) {
|
|
@@ -1540,6 +1587,8 @@ const executeChatTool = async (name, rawArguments, options) => {
|
|
|
1540
1587
|
return executeGetWorkspaceUriTool();
|
|
1541
1588
|
case 'glob':
|
|
1542
1589
|
return executeGlobTool(args);
|
|
1590
|
+
case 'grep_search':
|
|
1591
|
+
return executeGrepSearchTool(args);
|
|
1543
1592
|
case 'list_files':
|
|
1544
1593
|
return executeListFilesTool(args);
|
|
1545
1594
|
case 'open_preview':
|
|
@@ -1859,6 +1908,42 @@ const getRgTool = () => {
|
|
|
1859
1908
|
type: 'function'
|
|
1860
1909
|
};
|
|
1861
1910
|
};
|
|
1911
|
+
const getGrepSearchTool = () => {
|
|
1912
|
+
return {
|
|
1913
|
+
function: {
|
|
1914
|
+
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.",
|
|
1915
|
+
name: 'grep_search',
|
|
1916
|
+
parameters: {
|
|
1917
|
+
additionalProperties: false,
|
|
1918
|
+
properties: {
|
|
1919
|
+
includeIgnoredFiles: {
|
|
1920
|
+
description: 'Whether to include files that would normally be ignored according to .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.',
|
|
1921
|
+
type: 'boolean'
|
|
1922
|
+
},
|
|
1923
|
+
includePattern: {
|
|
1924
|
+
description: 'Search files matching this glob pattern. Will be applied to the relative path of files within the workspace. To search recursively inside a folder, use a proper glob pattern like "src/folder/**". Do not use | in includePattern. Can also be an absolute path to a workspace folder to scope the search in a multi-root workspace.',
|
|
1925
|
+
type: 'string'
|
|
1926
|
+
},
|
|
1927
|
+
isRegexp: {
|
|
1928
|
+
description: 'Whether the pattern is a regex.',
|
|
1929
|
+
type: 'boolean'
|
|
1930
|
+
},
|
|
1931
|
+
maxResults: {
|
|
1932
|
+
description: "The maximum number of results to return. Do not use this unless necessary, it can slow things down. By default, only some matches are returned. If you use this and don't see what you're looking for, you can try again with a more specific query or a larger maxResults.",
|
|
1933
|
+
type: 'number'
|
|
1934
|
+
},
|
|
1935
|
+
query: {
|
|
1936
|
+
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.",
|
|
1937
|
+
type: 'string'
|
|
1938
|
+
}
|
|
1939
|
+
},
|
|
1940
|
+
required: ['query', 'isRegexp'],
|
|
1941
|
+
type: 'object'
|
|
1942
|
+
}
|
|
1943
|
+
},
|
|
1944
|
+
type: 'function'
|
|
1945
|
+
};
|
|
1946
|
+
};
|
|
1862
1947
|
const getRunInTerminalTool = () => {
|
|
1863
1948
|
return {
|
|
1864
1949
|
function: {
|
|
@@ -1949,7 +2034,7 @@ const getUpdateTodoTool = () => {
|
|
|
1949
2034
|
};
|
|
1950
2035
|
};
|
|
1951
2036
|
const getBasicChatTools = () => {
|
|
1952
|
-
return [getReadFileTool(), getWriteFileTool(), getRenameTool(), getEditFileTool(), getListFilesTool(), getGetWorkspaceUriTool(), getRenderHtmlTool(), getOpenPreviewTool(), getOpenEditorTool(), getClosePreviewTool(), getSearchTextTool(), getRgTool(), getRunInTerminalTool(), getCreateDirectoryTool(), getGlobTool(), getUpdateTodoTool()];
|
|
2037
|
+
return [getReadFileTool(), getWriteFileTool(), getRenameTool(), getEditFileTool(), getListFilesTool(), getGetWorkspaceUriTool(), getRenderHtmlTool(), getOpenPreviewTool(), getOpenEditorTool(), getClosePreviewTool(), getSearchTextTool(), getRgTool(), getGrepSearchTool(), getRunInTerminalTool(), getCreateDirectoryTool(), getGlobTool(), getUpdateTodoTool()];
|
|
1953
2038
|
};
|
|
1954
2039
|
|
|
1955
2040
|
const handleMessagePort = async port => {
|