donobu
Version:
Create browser automations with an LLM agent and replay them as Playwright scripts.
16 lines • 736 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.stripAnsi = stripAnsi;
/**
* Remove ANSI escape sequences (color/style codes) from a string.
*
* Playwright matchers emit terminal-styled errors. Once those messages cross
* into Donobu data flows — `forLlm` strings sent to the model, JSON-stringified
* exception messages, persisted reports — the codes never render as colors and
* just become visible junk (worse: `JSON.stringify` escapes the ESC byte into
* the 6-char literal `\u001b[..]m`). Strip at the boundary.
*/
function stripAnsi(str) {
return str.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, '');
}
//# sourceMappingURL=ansi.js.map