@lvce-editor/chat-tool-worker 7.9.0 → 7.10.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 +72 -48
- package/package.json +1 -1
|
@@ -1093,6 +1093,20 @@ const executeGetWorkspaceUriTool = async (_args, _options) => {
|
|
|
1093
1093
|
}
|
|
1094
1094
|
};
|
|
1095
1095
|
|
|
1096
|
+
const executeGlobTool = async (args, _options) => {
|
|
1097
|
+
const pattern = typeof args.pattern === 'string' ? args.pattern : '';
|
|
1098
|
+
if (!pattern) {
|
|
1099
|
+
return {
|
|
1100
|
+
error: 'Invalid argument: pattern must be a non-empty string.'
|
|
1101
|
+
};
|
|
1102
|
+
}
|
|
1103
|
+
const paths = ['./src/main.ts', './src/utils/search.ts', './test/Main.test.ts'];
|
|
1104
|
+
return {
|
|
1105
|
+
paths,
|
|
1106
|
+
pattern
|
|
1107
|
+
};
|
|
1108
|
+
};
|
|
1109
|
+
|
|
1096
1110
|
const executeListFilesTool = async (args, _options) => {
|
|
1097
1111
|
const uri = typeof args.uri === 'string' ? args.uri : '';
|
|
1098
1112
|
if (!uri || !isAbsoluteUri(uri)) {
|
|
@@ -1515,54 +1529,44 @@ const parseToolArguments = rawArguments => {
|
|
|
1515
1529
|
|
|
1516
1530
|
const executeChatTool = async (name, rawArguments, options) => {
|
|
1517
1531
|
const args = parseToolArguments(rawArguments);
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
return executeRunInTerminalTool(args);
|
|
1556
|
-
}
|
|
1557
|
-
if (name === 'create_directory') {
|
|
1558
|
-
return executeCreateDirectoryTool(args);
|
|
1559
|
-
}
|
|
1560
|
-
if (name === 'update_todo') {
|
|
1561
|
-
return executeUpdateTodoTool(args);
|
|
1532
|
+
switch (name) {
|
|
1533
|
+
case 'close_preview':
|
|
1534
|
+
return executeClosePreviewTool();
|
|
1535
|
+
case 'create_directory':
|
|
1536
|
+
return executeCreateDirectoryTool(args);
|
|
1537
|
+
case 'edit_file':
|
|
1538
|
+
return executeEditFileTool(args);
|
|
1539
|
+
case 'getWorkspaceUri':
|
|
1540
|
+
return executeGetWorkspaceUriTool();
|
|
1541
|
+
case 'glob':
|
|
1542
|
+
return executeGlobTool(args);
|
|
1543
|
+
case 'list_files':
|
|
1544
|
+
return executeListFilesTool(args);
|
|
1545
|
+
case 'open_preview':
|
|
1546
|
+
return executeOpenPreviewTool(args);
|
|
1547
|
+
case 'openEditor':
|
|
1548
|
+
return executeOpenEditorTool(args);
|
|
1549
|
+
case 'read_file':
|
|
1550
|
+
return executeReadFileTool(args);
|
|
1551
|
+
case 'rename':
|
|
1552
|
+
return executeRenameTool(args);
|
|
1553
|
+
case 'render_html':
|
|
1554
|
+
return executeRenderHtmlTool(args);
|
|
1555
|
+
case 'rg':
|
|
1556
|
+
return executeRgTool(args);
|
|
1557
|
+
case 'run_in_terminal':
|
|
1558
|
+
return executeRunInTerminalTool(args);
|
|
1559
|
+
case 'search_text':
|
|
1560
|
+
return executeSearchTextTool(args);
|
|
1561
|
+
case 'update_todo':
|
|
1562
|
+
return executeUpdateTodoTool(args);
|
|
1563
|
+
case 'write_file':
|
|
1564
|
+
return executeWriteFileTool(args);
|
|
1565
|
+
default:
|
|
1566
|
+
return {
|
|
1567
|
+
error: `Unknown tool: ${name}`
|
|
1568
|
+
};
|
|
1562
1569
|
}
|
|
1563
|
-
return {
|
|
1564
|
-
error: `Unknown tool: ${name}`
|
|
1565
|
-
};
|
|
1566
1570
|
};
|
|
1567
1571
|
|
|
1568
1572
|
const getReadFileTool = () => {
|
|
@@ -1904,6 +1908,26 @@ const getCreateDirectoryTool = () => {
|
|
|
1904
1908
|
type: 'function'
|
|
1905
1909
|
};
|
|
1906
1910
|
};
|
|
1911
|
+
const getGlobTool = () => {
|
|
1912
|
+
return {
|
|
1913
|
+
function: {
|
|
1914
|
+
description: 'Find files by glob pattern and return matching relative paths.',
|
|
1915
|
+
name: 'glob',
|
|
1916
|
+
parameters: {
|
|
1917
|
+
additionalProperties: false,
|
|
1918
|
+
properties: {
|
|
1919
|
+
pattern: {
|
|
1920
|
+
description: 'Glob pattern to match files, for example `packages/e2e/src/*.ts`.',
|
|
1921
|
+
type: 'string'
|
|
1922
|
+
}
|
|
1923
|
+
},
|
|
1924
|
+
required: ['pattern'],
|
|
1925
|
+
type: 'object'
|
|
1926
|
+
}
|
|
1927
|
+
},
|
|
1928
|
+
type: 'function'
|
|
1929
|
+
};
|
|
1930
|
+
};
|
|
1907
1931
|
const getUpdateTodoTool = () => {
|
|
1908
1932
|
return {
|
|
1909
1933
|
function: {
|
|
@@ -1925,7 +1949,7 @@ const getUpdateTodoTool = () => {
|
|
|
1925
1949
|
};
|
|
1926
1950
|
};
|
|
1927
1951
|
const getBasicChatTools = () => {
|
|
1928
|
-
return [getReadFileTool(), getWriteFileTool(), getRenameTool(), getEditFileTool(), getListFilesTool(), getGetWorkspaceUriTool(), getRenderHtmlTool(), getOpenPreviewTool(), getOpenEditorTool(), getClosePreviewTool(), getSearchTextTool(), getRgTool(), getRunInTerminalTool(), getCreateDirectoryTool(), getUpdateTodoTool()];
|
|
1952
|
+
return [getReadFileTool(), getWriteFileTool(), getRenameTool(), getEditFileTool(), getListFilesTool(), getGetWorkspaceUriTool(), getRenderHtmlTool(), getOpenPreviewTool(), getOpenEditorTool(), getClosePreviewTool(), getSearchTextTool(), getRgTool(), getRunInTerminalTool(), getCreateDirectoryTool(), getGlobTool(), getUpdateTodoTool()];
|
|
1929
1953
|
};
|
|
1930
1954
|
|
|
1931
1955
|
const handleMessagePort = async port => {
|