@lvce-editor/chat-tool-worker 9.4.0 → 9.6.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 +187 -124
- package/package.json +1 -1
|
@@ -1248,14 +1248,16 @@ const isAbsoluteUri = value => {
|
|
|
1248
1248
|
return ABSOLUTE_URI_REGEX.test(value);
|
|
1249
1249
|
};
|
|
1250
1250
|
|
|
1251
|
+
const isValidUri = value => {
|
|
1252
|
+
return URL.canParse(value);
|
|
1253
|
+
};
|
|
1254
|
+
|
|
1251
1255
|
const executeCreateDirectoryTool = async (args, _options) => {
|
|
1252
1256
|
const uri = typeof args.uri === 'string' ? args.uri : '';
|
|
1253
1257
|
if (!uri || !isAbsoluteUri(uri)) {
|
|
1254
1258
|
return getInvalidUriErrorPayload('uri');
|
|
1255
1259
|
}
|
|
1256
|
-
|
|
1257
|
-
new URL(uri);
|
|
1258
|
-
} catch {
|
|
1260
|
+
if (!isValidUri(uri)) {
|
|
1259
1261
|
return getInvalidUrlErrorPayload();
|
|
1260
1262
|
}
|
|
1261
1263
|
try {
|
|
@@ -1287,9 +1289,7 @@ const executeEditFileTool = async (args, _options) => {
|
|
|
1287
1289
|
if (!uri || !isAbsoluteUri(uri)) {
|
|
1288
1290
|
return getInvalidUriErrorPayload('uri');
|
|
1289
1291
|
}
|
|
1290
|
-
|
|
1291
|
-
new URL(uri);
|
|
1292
|
-
} catch {
|
|
1292
|
+
if (!isValidUri(uri)) {
|
|
1293
1293
|
return getInvalidUrlErrorPayload();
|
|
1294
1294
|
}
|
|
1295
1295
|
if (!Number.isInteger(start) || start < 0) {
|
|
@@ -1336,6 +1336,7 @@ const normalizeWorkspaceUri = workspacePathOrUri => {
|
|
|
1336
1336
|
url.pathname = windowsDrivePathRegex.test(workspacePathOrUri) ? `/${workspacePathOrUri.replaceAll('\\', '/')}` : workspacePathOrUri;
|
|
1337
1337
|
return url.href;
|
|
1338
1338
|
};
|
|
1339
|
+
|
|
1339
1340
|
const executeGetWorkspaceUriTool = async (_args, _options) => {
|
|
1340
1341
|
try {
|
|
1341
1342
|
const workspacePathOrUri = await getWorkspacePath();
|
|
@@ -1365,6 +1366,27 @@ const MULTIPLE_SLASHES_REGEX$1 = /\/+/g;
|
|
|
1365
1366
|
const escapeRegExp = str => {
|
|
1366
1367
|
return str.replaceAll(REGEX_SPECIAL_CHARS_REGEX, '\\$&');
|
|
1367
1368
|
};
|
|
1369
|
+
const getCharacterClassRegex = (classContents, negated) => {
|
|
1370
|
+
if (negated) {
|
|
1371
|
+
return `[^${escapeRegExp(classContents)}]`;
|
|
1372
|
+
}
|
|
1373
|
+
return `[${classContents.replaceAll('\\', '\\\\')}]`;
|
|
1374
|
+
};
|
|
1375
|
+
const readCharacterClass = (segment, index) => {
|
|
1376
|
+
let classIndex = index + 1;
|
|
1377
|
+
const negated = segment[classIndex] === '!';
|
|
1378
|
+
if (negated) {
|
|
1379
|
+
classIndex++;
|
|
1380
|
+
}
|
|
1381
|
+
const closingIndex = segment.indexOf(']', classIndex);
|
|
1382
|
+
if (closingIndex === -1) {
|
|
1383
|
+
return undefined;
|
|
1384
|
+
}
|
|
1385
|
+
return {
|
|
1386
|
+
nextIndex: closingIndex + 1,
|
|
1387
|
+
regex: getCharacterClassRegex(segment.slice(classIndex, closingIndex), negated)
|
|
1388
|
+
};
|
|
1389
|
+
};
|
|
1368
1390
|
|
|
1369
1391
|
/*
|
|
1370
1392
|
* Convert a glob pattern to a regex, but only for segments between separators
|
|
@@ -1374,60 +1396,58 @@ const segmentToRegex = segment => {
|
|
|
1374
1396
|
let i = 0;
|
|
1375
1397
|
while (i < segment.length) {
|
|
1376
1398
|
const char = segment[i];
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
classStr += segment[j];
|
|
1395
|
-
j++;
|
|
1396
|
-
}
|
|
1397
|
-
if (j < segment.length) {
|
|
1398
|
-
if (negated) {
|
|
1399
|
-
regexStr += `[^${escapeRegExp(classStr)}]`;
|
|
1400
|
-
} else {
|
|
1401
|
-
regexStr += `[${classStr.replaceAll('\\', '\\\\')}]`;
|
|
1402
|
-
}
|
|
1403
|
-
i = j + 1;
|
|
1404
|
-
} else {
|
|
1405
|
-
regexStr += escapeRegExp(char);
|
|
1406
|
-
i++;
|
|
1407
|
-
}
|
|
1408
|
-
break;
|
|
1409
|
-
}
|
|
1410
|
-
case '*':
|
|
1411
|
-
{
|
|
1412
|
-
regexStr += '[^/]*';
|
|
1413
|
-
i++;
|
|
1414
|
-
break;
|
|
1415
|
-
}
|
|
1416
|
-
default:
|
|
1417
|
-
{
|
|
1418
|
-
regexStr += escapeRegExp(char);
|
|
1419
|
-
i++;
|
|
1420
|
-
}
|
|
1399
|
+
if (char === '?') {
|
|
1400
|
+
regexStr += '[^/]';
|
|
1401
|
+
i++;
|
|
1402
|
+
continue;
|
|
1403
|
+
}
|
|
1404
|
+
if (char === '*') {
|
|
1405
|
+
regexStr += '[^/]*';
|
|
1406
|
+
i++;
|
|
1407
|
+
continue;
|
|
1408
|
+
}
|
|
1409
|
+
if (char === '[') {
|
|
1410
|
+
const characterClass = readCharacterClass(segment, i);
|
|
1411
|
+
if (characterClass) {
|
|
1412
|
+
regexStr += characterClass.regex;
|
|
1413
|
+
i = characterClass.nextIndex;
|
|
1414
|
+
continue;
|
|
1415
|
+
}
|
|
1421
1416
|
}
|
|
1417
|
+
regexStr += escapeRegExp(char);
|
|
1418
|
+
i++;
|
|
1422
1419
|
}
|
|
1423
1420
|
return new RegExp(`^${regexStr}$`);
|
|
1424
1421
|
};
|
|
1425
|
-
const
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1422
|
+
const normalizePath = path => {
|
|
1423
|
+
return path.replaceAll('\\', '/').replaceAll(LEADING_DOT_SLASH_REGEX$1, '');
|
|
1424
|
+
};
|
|
1425
|
+
const normalizePattern$1 = pattern => {
|
|
1426
|
+
const normalizedPattern = pattern.replaceAll('\\', '/').replaceAll(LEADING_DOT_SLASH_REGEX$1, '').replaceAll(MULTIPLE_SLASHES_REGEX$1, '/');
|
|
1427
|
+
if (!normalizedPattern.endsWith('/')) {
|
|
1428
|
+
return normalizedPattern;
|
|
1429
|
+
}
|
|
1430
|
+
return normalizedPattern.slice(0, -1) + '/*';
|
|
1431
|
+
};
|
|
1432
|
+
const matchesSinglePatternPart = (pathPart, patternPart) => {
|
|
1433
|
+
return segmentToRegex(patternPart).test(pathPart);
|
|
1434
|
+
};
|
|
1435
|
+
const matchesEmbeddedDoubleStarPattern = (pathParts, patternParts, pathIdx, patternIdx) => {
|
|
1436
|
+
const patternPart = patternParts[patternIdx];
|
|
1437
|
+
const pathPart = pathParts[pathIdx];
|
|
1438
|
+
return matchesSinglePatternPart(pathPart, patternPart.replace('**', '')) && matchesPatternParts(pathParts, patternParts, pathIdx + 1, patternIdx + 1);
|
|
1439
|
+
};
|
|
1440
|
+
const matchesDoubleStarPattern = (pathParts, patternParts, pathIdx, patternIdx) => {
|
|
1441
|
+
for (let i = pathIdx; i <= pathParts.length; i++) {
|
|
1442
|
+
if (matchesPatternParts(pathParts, patternParts, i, patternIdx + 1)) {
|
|
1443
|
+
return true;
|
|
1444
|
+
}
|
|
1430
1445
|
}
|
|
1446
|
+
return false;
|
|
1447
|
+
};
|
|
1448
|
+
const matchesGlobPattern = (path, pattern) => {
|
|
1449
|
+
const normalizedPath = normalizePath(path);
|
|
1450
|
+
const normalizedPattern = normalizePattern$1(pattern);
|
|
1431
1451
|
const patternParts = normalizedPattern.split('/');
|
|
1432
1452
|
const pathParts = normalizedPath.split('/');
|
|
1433
1453
|
return matchesPatternParts(pathParts, patternParts, 0, 0);
|
|
@@ -1440,34 +1460,17 @@ const matchesPatternParts = (pathParts, patternParts, pathIdx, patternIdx) => {
|
|
|
1440
1460
|
return false;
|
|
1441
1461
|
}
|
|
1442
1462
|
const patternPart = patternParts[patternIdx];
|
|
1443
|
-
if (patternPart === undefined) {
|
|
1444
|
-
return false;
|
|
1445
|
-
}
|
|
1446
1463
|
if (patternPart === '**') {
|
|
1447
|
-
|
|
1448
|
-
if (matchesPatternParts(pathParts, patternParts, i, patternIdx + 1)) {
|
|
1449
|
-
return true;
|
|
1450
|
-
}
|
|
1451
|
-
}
|
|
1452
|
-
return false;
|
|
1464
|
+
return matchesDoubleStarPattern(pathParts, patternParts, pathIdx, patternIdx);
|
|
1453
1465
|
}
|
|
1454
1466
|
if (pathIdx === pathParts.length) {
|
|
1455
1467
|
return false;
|
|
1456
1468
|
}
|
|
1457
1469
|
if (patternPart.includes('**')) {
|
|
1458
|
-
|
|
1459
|
-
const pathPart = pathParts[pathIdx];
|
|
1460
|
-
if (pathPart !== undefined && regex.test(pathPart)) {
|
|
1461
|
-
return matchesPatternParts(pathParts, patternParts, pathIdx + 1, patternIdx + 1);
|
|
1462
|
-
}
|
|
1463
|
-
return false;
|
|
1470
|
+
return matchesEmbeddedDoubleStarPattern(pathParts, patternParts, pathIdx, patternIdx);
|
|
1464
1471
|
}
|
|
1465
|
-
const regex = segmentToRegex(patternPart);
|
|
1466
1472
|
const pathPart = pathParts[pathIdx];
|
|
1467
|
-
|
|
1468
|
-
return matchesPatternParts(pathParts, patternParts, pathIdx + 1, patternIdx + 1);
|
|
1469
|
-
}
|
|
1470
|
-
return false;
|
|
1473
|
+
return matchesSinglePatternPart(pathPart, patternPart) && matchesPatternParts(pathParts, patternParts, pathIdx + 1, patternIdx + 1);
|
|
1471
1474
|
};
|
|
1472
1475
|
|
|
1473
1476
|
// cspell:ignore venv
|
|
@@ -1539,59 +1542,99 @@ const joinUri = (baseUri, path) => {
|
|
|
1539
1542
|
}
|
|
1540
1543
|
return baseUri.endsWith('/') ? `${baseUri}${path}` : `${baseUri}/${path}`;
|
|
1541
1544
|
};
|
|
1542
|
-
const
|
|
1545
|
+
const isPlaceholderWorkspaceUri = baseUri => {
|
|
1546
|
+
return baseUri === PLACEHOLDER_WORKSPACE_URI || baseUri.startsWith(`${PLACEHOLDER_WORKSPACE_URI}/`);
|
|
1547
|
+
};
|
|
1548
|
+
const getPattern = args => {
|
|
1543
1549
|
const pattern = typeof args.pattern === 'string' ? args.pattern : '';
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1550
|
+
return pattern || undefined;
|
|
1551
|
+
};
|
|
1552
|
+
const getBaseUri = args => {
|
|
1553
|
+
const baseUri = typeof args.baseUri === 'string' ? args.baseUri : '';
|
|
1554
|
+
if (!baseUri || !isAbsoluteUri(baseUri) || isPlaceholderWorkspaceUri(baseUri)) {
|
|
1555
|
+
return undefined;
|
|
1548
1556
|
}
|
|
1557
|
+
return baseUri;
|
|
1558
|
+
};
|
|
1559
|
+
const getBaseUriError = args => {
|
|
1549
1560
|
const baseUri = typeof args.baseUri === 'string' ? args.baseUri : '';
|
|
1550
1561
|
if (!baseUri || !isAbsoluteUri(baseUri)) {
|
|
1551
1562
|
return getInvalidUriErrorPayload('baseUri');
|
|
1552
1563
|
}
|
|
1553
|
-
if (baseUri
|
|
1564
|
+
if (isPlaceholderWorkspaceUri(baseUri)) {
|
|
1554
1565
|
return {
|
|
1555
1566
|
baseUri,
|
|
1556
1567
|
error: 'Invalid argument: baseUri must be a real workspace folder URI. Call getWorkspaceUri first and use the returned workspaceUri value.'
|
|
1557
1568
|
};
|
|
1558
1569
|
}
|
|
1570
|
+
return undefined;
|
|
1571
|
+
};
|
|
1572
|
+
const getDirectoryMatches = async (baseUri, globPart) => {
|
|
1573
|
+
const dirUri = joinUri(baseUri, globPart);
|
|
1574
|
+
const entries = await readDirWithFileTypes(dirUri);
|
|
1575
|
+
return entries.map(entry => globPart ? `${globPart}/${entry.name}` : entry.name);
|
|
1576
|
+
};
|
|
1577
|
+
const getRecursiveMatches = async (baseUri, baseDir, normalizedPattern) => {
|
|
1578
|
+
const matches = [];
|
|
1579
|
+
const baseDirUri = joinUri(baseUri, baseDir);
|
|
1580
|
+
await traverseDirectory(baseDirUri, '', async (relativePath, entry) => {
|
|
1581
|
+
if (entry.type !== File) {
|
|
1582
|
+
return;
|
|
1583
|
+
}
|
|
1584
|
+
const fullPath = baseDir ? `${baseDir}/${relativePath}` : relativePath;
|
|
1585
|
+
if (matchesGlobPattern(fullPath, normalizedPattern)) {
|
|
1586
|
+
matches.push(fullPath);
|
|
1587
|
+
}
|
|
1588
|
+
});
|
|
1589
|
+
return matches;
|
|
1590
|
+
};
|
|
1591
|
+
const getDirectMatches = async (baseUri, baseDir, normalizedPattern) => {
|
|
1592
|
+
const dirUri = joinUri(baseUri, baseDir);
|
|
1593
|
+
const entries = await readDirWithFileTypes(dirUri);
|
|
1594
|
+
const matches = [];
|
|
1595
|
+
for (const entry of entries) {
|
|
1596
|
+
const fullPath = baseDir ? `${baseDir}/${entry.name}` : entry.name;
|
|
1597
|
+
if (matchesGlobPattern(fullPath, normalizedPattern)) {
|
|
1598
|
+
matches.push(fullPath);
|
|
1599
|
+
}
|
|
1600
|
+
}
|
|
1601
|
+
return matches;
|
|
1602
|
+
};
|
|
1603
|
+
const getMatches = async (baseUri, pattern) => {
|
|
1559
1604
|
const normalizedPattern = normalizeInputPattern(pattern);
|
|
1560
1605
|
const {
|
|
1561
1606
|
baseDir,
|
|
1562
1607
|
globPart,
|
|
1563
1608
|
matchDirectories
|
|
1564
1609
|
} = normalizePattern(pattern);
|
|
1565
|
-
|
|
1610
|
+
if (matchDirectories) {
|
|
1611
|
+
return getDirectoryMatches(baseUri, globPart);
|
|
1612
|
+
}
|
|
1613
|
+
if (globPart.includes('**')) {
|
|
1614
|
+
return getRecursiveMatches(baseUri, baseDir, normalizedPattern);
|
|
1615
|
+
}
|
|
1616
|
+
return getDirectMatches(baseUri, baseDir, normalizedPattern);
|
|
1617
|
+
};
|
|
1618
|
+
const sortMatches = matches => {
|
|
1619
|
+
return matches.toSorted((left, right) => left.localeCompare(right));
|
|
1620
|
+
};
|
|
1621
|
+
const executeGlobTool = async (args, _options) => {
|
|
1622
|
+
const pattern = getPattern(args);
|
|
1623
|
+
if (!pattern) {
|
|
1624
|
+
return {
|
|
1625
|
+
error: 'Invalid argument: pattern must be a non-empty string.'
|
|
1626
|
+
};
|
|
1627
|
+
}
|
|
1628
|
+
const baseUriError = getBaseUriError(args);
|
|
1629
|
+
if (baseUriError) {
|
|
1630
|
+
return baseUriError;
|
|
1631
|
+
}
|
|
1632
|
+
const baseUri = getBaseUri(args);
|
|
1633
|
+
if (!baseUri) {
|
|
1634
|
+
return getInvalidUriErrorPayload('baseUri');
|
|
1635
|
+
}
|
|
1566
1636
|
try {
|
|
1567
|
-
|
|
1568
|
-
const dirUri = joinUri(baseUri, globPart);
|
|
1569
|
-
const entries = await readDirWithFileTypes(dirUri);
|
|
1570
|
-
for (const entry of entries) {
|
|
1571
|
-
matches.push(globPart ? `${globPart}/${entry.name}` : entry.name);
|
|
1572
|
-
}
|
|
1573
|
-
} else if (globPart.includes('**')) {
|
|
1574
|
-
const baseDirUri = joinUri(baseUri, baseDir);
|
|
1575
|
-
await traverseDirectory(baseDirUri, '', async (relativePath, entry) => {
|
|
1576
|
-
if (entry.type !== File) {
|
|
1577
|
-
return;
|
|
1578
|
-
}
|
|
1579
|
-
const fullPath = baseDir ? `${baseDir}/${relativePath}` : relativePath;
|
|
1580
|
-
if (matchesGlobPattern(fullPath, normalizedPattern)) {
|
|
1581
|
-
matches.push(fullPath);
|
|
1582
|
-
}
|
|
1583
|
-
});
|
|
1584
|
-
} else {
|
|
1585
|
-
const dirUri = joinUri(baseUri, baseDir);
|
|
1586
|
-
const entries = await readDirWithFileTypes(dirUri);
|
|
1587
|
-
for (const entry of entries) {
|
|
1588
|
-
const fullPath = baseDir ? `${baseDir}/${entry.name}` : entry.name;
|
|
1589
|
-
if (matchesGlobPattern(fullPath, normalizedPattern)) {
|
|
1590
|
-
matches.push(fullPath);
|
|
1591
|
-
}
|
|
1592
|
-
}
|
|
1593
|
-
}
|
|
1594
|
-
matches.sort();
|
|
1637
|
+
const matches = sortMatches(await getMatches(baseUri, pattern));
|
|
1595
1638
|
return {
|
|
1596
1639
|
paths: matches,
|
|
1597
1640
|
pattern
|
|
@@ -1644,10 +1687,7 @@ const formatJsonMatches = matches => {
|
|
|
1644
1687
|
matchesFound: matches.length > 0
|
|
1645
1688
|
};
|
|
1646
1689
|
};
|
|
1647
|
-
const
|
|
1648
|
-
if (outputFormat === 'json') {
|
|
1649
|
-
return formatJsonMatches(matches);
|
|
1650
|
-
}
|
|
1690
|
+
const formatStringMatches = (matches, outputFormat) => {
|
|
1651
1691
|
if (matches.length === 0) {
|
|
1652
1692
|
return 'No matches found.';
|
|
1653
1693
|
}
|
|
@@ -1658,6 +1698,16 @@ const formatGrepMatches = (matches, outputFormat) => {
|
|
|
1658
1698
|
return formatTextMatches(matches);
|
|
1659
1699
|
}
|
|
1660
1700
|
};
|
|
1701
|
+
const getMatchesFormatter = outputFormat => {
|
|
1702
|
+
if (outputFormat === 'json') {
|
|
1703
|
+
return formatJsonMatches;
|
|
1704
|
+
}
|
|
1705
|
+
return matches => formatStringMatches(matches, outputFormat);
|
|
1706
|
+
};
|
|
1707
|
+
const formatGrepMatches = (matches, outputFormat) => {
|
|
1708
|
+
const formatter = getMatchesFormatter(outputFormat);
|
|
1709
|
+
return formatter(matches);
|
|
1710
|
+
};
|
|
1661
1711
|
|
|
1662
1712
|
const formatSearchProcessResults = (results, outputFormat) => {
|
|
1663
1713
|
if (!results || results.length === 0) {
|
|
@@ -1830,6 +1880,21 @@ const executeMemoryGrepSearch = async (workspaceUri, grepSearchArgs, options) =>
|
|
|
1830
1880
|
}
|
|
1831
1881
|
};
|
|
1832
1882
|
|
|
1883
|
+
const isBoolean = value => {
|
|
1884
|
+
return typeof value === 'boolean';
|
|
1885
|
+
};
|
|
1886
|
+
const isNumber = value => {
|
|
1887
|
+
return typeof value === 'number';
|
|
1888
|
+
};
|
|
1889
|
+
const isString = value => {
|
|
1890
|
+
return typeof value === 'string';
|
|
1891
|
+
};
|
|
1892
|
+
const isOptional = (value, predicate) => {
|
|
1893
|
+
return value === undefined || predicate(value);
|
|
1894
|
+
};
|
|
1895
|
+
const isOutputFormat = value => {
|
|
1896
|
+
return value === 'xml' || value === 'json';
|
|
1897
|
+
};
|
|
1833
1898
|
const getGrepSearchArgs = args => {
|
|
1834
1899
|
const {
|
|
1835
1900
|
includeIgnoredFiles,
|
|
@@ -1840,22 +1905,22 @@ const getGrepSearchArgs = args => {
|
|
|
1840
1905
|
query,
|
|
1841
1906
|
useDefaultExcludes
|
|
1842
1907
|
} = args;
|
|
1843
|
-
if (
|
|
1908
|
+
if (!isString(query) || !isBoolean(isRegexp)) {
|
|
1844
1909
|
return undefined;
|
|
1845
1910
|
}
|
|
1846
|
-
if (includePattern
|
|
1911
|
+
if (!isOptional(includePattern, isString)) {
|
|
1847
1912
|
return undefined;
|
|
1848
1913
|
}
|
|
1849
|
-
if (maxResults
|
|
1914
|
+
if (!isOptional(maxResults, isNumber)) {
|
|
1850
1915
|
return undefined;
|
|
1851
1916
|
}
|
|
1852
|
-
if (includeIgnoredFiles
|
|
1917
|
+
if (!isOptional(includeIgnoredFiles, isBoolean)) {
|
|
1853
1918
|
return undefined;
|
|
1854
1919
|
}
|
|
1855
|
-
if (useDefaultExcludes
|
|
1920
|
+
if (!isOptional(useDefaultExcludes, isBoolean)) {
|
|
1856
1921
|
return undefined;
|
|
1857
1922
|
}
|
|
1858
|
-
if (outputFormat
|
|
1923
|
+
if (!isOptional(outputFormat, isOutputFormat)) {
|
|
1859
1924
|
return undefined;
|
|
1860
1925
|
}
|
|
1861
1926
|
return {
|
|
@@ -1999,7 +2064,7 @@ const executeRenameTool = async (args, _options) => {
|
|
|
1999
2064
|
if (!newUri || !isAbsoluteUri(newUri)) {
|
|
2000
2065
|
return getInvalidUriErrorPayload('newUri');
|
|
2001
2066
|
}
|
|
2002
|
-
if (!
|
|
2067
|
+
if (!isValidUri(oldUri) || !isValidUri(newUri)) {
|
|
2003
2068
|
return getInvalidUrlErrorPayload();
|
|
2004
2069
|
}
|
|
2005
2070
|
const oldUrl = new URL(oldUri);
|
|
@@ -2339,9 +2404,7 @@ const executeWriteFileTool = async (args, _options) => {
|
|
|
2339
2404
|
if (!uri || !isAbsoluteUri(uri)) {
|
|
2340
2405
|
return getInvalidUriErrorPayload('uri');
|
|
2341
2406
|
}
|
|
2342
|
-
|
|
2343
|
-
new URL(uri);
|
|
2344
|
-
} catch {
|
|
2407
|
+
if (!isValidUri(uri)) {
|
|
2345
2408
|
return getInvalidUrlErrorPayload();
|
|
2346
2409
|
}
|
|
2347
2410
|
try {
|