@lvce-editor/chat-tool-worker 9.2.0 → 9.3.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 +16 -6
- package/package.json +1 -1
|
@@ -1323,9 +1323,24 @@ const executeEditFileTool = async (args, _options) => {
|
|
|
1323
1323
|
}
|
|
1324
1324
|
};
|
|
1325
1325
|
|
|
1326
|
+
const windowsDrivePathRegex$1 = /^[a-zA-Z]:[\\/]/;
|
|
1327
|
+
const isAbsoluteFileSystemPath = value => {
|
|
1328
|
+
return value.startsWith('/') || windowsDrivePathRegex$1.test(value);
|
|
1329
|
+
};
|
|
1330
|
+
|
|
1331
|
+
const windowsDrivePathRegex = /^[a-zA-Z]:[\\/]/;
|
|
1332
|
+
const normalizeWorkspaceUri = workspacePathOrUri => {
|
|
1333
|
+
if (!isAbsoluteFileSystemPath(workspacePathOrUri)) {
|
|
1334
|
+
return workspacePathOrUri;
|
|
1335
|
+
}
|
|
1336
|
+
const url = new URL('file:///');
|
|
1337
|
+
url.pathname = windowsDrivePathRegex.test(workspacePathOrUri) ? `/${workspacePathOrUri.replaceAll('\\', '/')}` : workspacePathOrUri;
|
|
1338
|
+
return url.href;
|
|
1339
|
+
};
|
|
1326
1340
|
const executeGetWorkspaceUriTool = async (_args, _options) => {
|
|
1327
1341
|
try {
|
|
1328
|
-
const
|
|
1342
|
+
const workspacePathOrUri = await getWorkspacePath();
|
|
1343
|
+
const workspaceUri = normalizeWorkspaceUri(workspacePathOrUri);
|
|
1329
1344
|
return {
|
|
1330
1345
|
workspaceUri
|
|
1331
1346
|
};
|
|
@@ -1678,11 +1693,6 @@ const formatSearchProcessResults = (results, outputFormat) => {
|
|
|
1678
1693
|
return formatGrepMatches(matches, outputFormat);
|
|
1679
1694
|
};
|
|
1680
1695
|
|
|
1681
|
-
const windowsDrivePathRegex = /^[a-zA-Z]:[\\/]/;
|
|
1682
|
-
const isAbsoluteFileSystemPath = value => {
|
|
1683
|
-
return value.startsWith('/') || windowsDrivePathRegex.test(value);
|
|
1684
|
-
};
|
|
1685
|
-
|
|
1686
1696
|
const isFileUri = value => {
|
|
1687
1697
|
return value.startsWith('file://');
|
|
1688
1698
|
};
|