mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 03:01:56 +00:00
Fix characters (#372)
* Fix cat command * Fix text rendering crash from undefined code points in bash output * Revert unintentional model parameter changes from fix cat command commit
This commit is contained in:
parent
46bb5dcde8
commit
bbf23bd5f1
3 changed files with 40 additions and 9 deletions
|
|
@ -13,6 +13,7 @@ import {
|
|||
import stripAnsi from "strip-ansi";
|
||||
import type { CustomTool } from "../../../core/custom-tools/types.js";
|
||||
import { DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, formatSize } from "../../../core/tools/truncate.js";
|
||||
import { sanitizeBinaryOutput } from "../../../utils/shell.js";
|
||||
import { getLanguageFromPath, highlightCode, theme } from "../theme/theme.js";
|
||||
import { renderDiff } from "./diff.js";
|
||||
import { truncateToVisualLines } from "./visual-truncate.js";
|
||||
|
|
@ -295,10 +296,8 @@ export class ToolExecutionComponent extends Container {
|
|||
|
||||
let output = textBlocks
|
||||
.map((c: any) => {
|
||||
let text = stripAnsi(c.text || "").replace(/\r/g, "");
|
||||
text = text.replace(/\x1b./g, "");
|
||||
text = text.replace(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f-\x9f]/g, "");
|
||||
return text;
|
||||
// Use sanitizeBinaryOutput to handle binary data that crashes string-width
|
||||
return sanitizeBinaryOutput(stripAnsi(c.text || "")).replace(/\r/g, "");
|
||||
})
|
||||
.join("\n");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue