This commit is contained in:
Noah Waldner
2026-02-27 11:39:03 +01:00
parent 1424373895
commit 25293a0349
2 changed files with 11 additions and 12 deletions
+2 -1
View File
@@ -18,7 +18,8 @@
* Note: Has global flag - reset lastIndex before exec() if reusing.
*/
// eslint-disable-next-line no-control-regex
export const ANSI_ESCAPE_PATTERN_FULL = /\x1b(?:\[[0-9;?]*[A-Za-z]|\][^\x07\x1b]*(?:\x07|\x1b\\)|[=>])/g;
export const ANSI_ESCAPE_PATTERN_FULL =
/\x1b(?:\[[0-9;?]*[A-Za-z]|\][^\x07\x1b]*(?:\x07|\x1b\\)|[=>])/g;
/**
* Simple ANSI CSI-only pattern for basic escape code stripping.
+9 -11
View File
@@ -4036,17 +4036,15 @@ NOW: Generate the implementation plan for the task above. Think step by step.`;
repaired = repaired.replace(/,(\s*[\]}])/g, '$1');
// Fix unescaped control characters within JSON strings
repaired = repaired.replace(/"([^"\\]|\\.)*"/g, (match) => {
return (
match
.replace(/\n/g, '\\n')
.replace(/\r/g, '\\r')
.replace(/\t/g, '\\t')
.replace(
// eslint-disable-next-line no-control-regex
/[\x00-\x1f]/g,
(c) => `\\u${c.charCodeAt(0).toString(16).padStart(4, '0')}`
)
);
return match
.replace(/\n/g, '\\n')
.replace(/\r/g, '\\r')
.replace(/\t/g, '\\t')
.replace(
// eslint-disable-next-line no-control-regex
/[\x00-\x1f]/g,
(c) => `\\u${c.charCodeAt(0).toString(16).padStart(4, '0')}`
);
});
parsed = JSON.parse(repaired);
} catch {