@lvce-editor/chat-tool-worker 9.2.0 → 9.4.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 +19 -10
- package/package.json +1 -1
|
@@ -1189,8 +1189,8 @@ const sendMessagePortToFileSystemWorker = async (port, rpcId) => {
|
|
|
1189
1189
|
const readFile = async uri => {
|
|
1190
1190
|
return invoke$1('FileSystem.readFile', uri);
|
|
1191
1191
|
};
|
|
1192
|
-
const sendMessagePortToChatStorageWorker = async port => {
|
|
1193
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToChatStorageWorker', port, 'HandleMessagePort.handleMessagePort');
|
|
1192
|
+
const sendMessagePortToChatStorageWorker = async (port, rpcId) => {
|
|
1193
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToChatStorageWorker', port, 'HandleMessagePort.handleMessagePort', rpcId);
|
|
1194
1194
|
};
|
|
1195
1195
|
const writeFile = async (uri, text) => {
|
|
1196
1196
|
await invoke$1('FileSystem.writeFile', uri, text);
|
|
@@ -1312,8 +1312,7 @@ const executeEditFileTool = async (args, _options) => {
|
|
|
1312
1312
|
const nextContent = applyTextEdit(content, start, end, text);
|
|
1313
1313
|
await writeFile(uri, nextContent);
|
|
1314
1314
|
return {
|
|
1315
|
-
ok: true
|
|
1316
|
-
uri
|
|
1315
|
+
ok: true
|
|
1317
1316
|
};
|
|
1318
1317
|
} catch (error) {
|
|
1319
1318
|
return {
|
|
@@ -1323,9 +1322,24 @@ const executeEditFileTool = async (args, _options) => {
|
|
|
1323
1322
|
}
|
|
1324
1323
|
};
|
|
1325
1324
|
|
|
1325
|
+
const windowsDrivePathRegex$1 = /^[a-zA-Z]:[\\/]/;
|
|
1326
|
+
const isAbsoluteFileSystemPath = value => {
|
|
1327
|
+
return value.startsWith('/') || windowsDrivePathRegex$1.test(value);
|
|
1328
|
+
};
|
|
1329
|
+
|
|
1330
|
+
const windowsDrivePathRegex = /^[a-zA-Z]:[\\/]/;
|
|
1331
|
+
const normalizeWorkspaceUri = workspacePathOrUri => {
|
|
1332
|
+
if (!isAbsoluteFileSystemPath(workspacePathOrUri)) {
|
|
1333
|
+
return workspacePathOrUri;
|
|
1334
|
+
}
|
|
1335
|
+
const url = new URL('file:///');
|
|
1336
|
+
url.pathname = windowsDrivePathRegex.test(workspacePathOrUri) ? `/${workspacePathOrUri.replaceAll('\\', '/')}` : workspacePathOrUri;
|
|
1337
|
+
return url.href;
|
|
1338
|
+
};
|
|
1326
1339
|
const executeGetWorkspaceUriTool = async (_args, _options) => {
|
|
1327
1340
|
try {
|
|
1328
|
-
const
|
|
1341
|
+
const workspacePathOrUri = await getWorkspacePath();
|
|
1342
|
+
const workspaceUri = normalizeWorkspaceUri(workspacePathOrUri);
|
|
1329
1343
|
return {
|
|
1330
1344
|
workspaceUri
|
|
1331
1345
|
};
|
|
@@ -1678,11 +1692,6 @@ const formatSearchProcessResults = (results, outputFormat) => {
|
|
|
1678
1692
|
return formatGrepMatches(matches, outputFormat);
|
|
1679
1693
|
};
|
|
1680
1694
|
|
|
1681
|
-
const windowsDrivePathRegex = /^[a-zA-Z]:[\\/]/;
|
|
1682
|
-
const isAbsoluteFileSystemPath = value => {
|
|
1683
|
-
return value.startsWith('/') || windowsDrivePathRegex.test(value);
|
|
1684
|
-
};
|
|
1685
|
-
|
|
1686
1695
|
const isFileUri = value => {
|
|
1687
1696
|
return value.startsWith('file://');
|
|
1688
1697
|
};
|