bingocode 1.1.174 → 1.1.175
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/package.json
CHANGED
|
@@ -474,9 +474,23 @@ export const FileEditTool = buildTool({
|
|
|
474
474
|
}
|
|
475
475
|
}
|
|
476
476
|
|
|
477
|
-
// 3. Use findActualString to handle quote normalization
|
|
477
|
+
// 3. Use findActualString to handle quote normalization.
|
|
478
|
+
// validateInput already verified this matches in the file. If it returns null
|
|
479
|
+
// now, the file content changed between reads — fall back to raw old_string
|
|
480
|
+
// only when it is a literal substring, otherwise throw.
|
|
478
481
|
const actualOldString =
|
|
479
|
-
findActualString(originalFileContents, old_string)
|
|
482
|
+
findActualString(originalFileContents, old_string) ??
|
|
483
|
+
(originalFileContents.includes(old_string) ? old_string : null)
|
|
484
|
+
if (!actualOldString) {
|
|
485
|
+
throw new EditNotFoundError(
|
|
486
|
+
'String to replace not found in file.',
|
|
487
|
+
{
|
|
488
|
+
searchString: old_string,
|
|
489
|
+
visibleSearch: visibleWhitespace(old_string),
|
|
490
|
+
closestMatches: findClosestLines(originalFileContents, old_string),
|
|
491
|
+
},
|
|
492
|
+
)
|
|
493
|
+
}
|
|
480
494
|
|
|
481
495
|
// Preserve curly quotes in new_string when the file uses them
|
|
482
496
|
const actualNewString = preserveQuoteStyle(
|