mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-31 19:16:29 +00:00
fix(web): strip ANSI erase codes and blank-line bursts from PTY stream
Ink two-pass virtual scrolling during session resume floods the PTY output with \x1b[K (erase-line), \x1b[NX (erase-char), and thousand-line \n bursts. In the Dashboard INLINE mode, xterm main scrollback buffer absorbs these as blank rows. Filter all three in ws.onmessage before they reach xterm. Refs #47313.
This commit is contained in:
parent
aff380ddbe
commit
4b6e1e440e
1 changed files with 8 additions and 2 deletions
|
|
@ -990,11 +990,17 @@ export default function ChatPage({ isActive = true }: { isActive?: boolean }) {
|
|||
};
|
||||
|
||||
ws.onmessage = (ev) => {
|
||||
let text: string;
|
||||
if (typeof ev.data === "string") {
|
||||
term.write(ev.data);
|
||||
text = ev.data;
|
||||
} else {
|
||||
term.write(new Uint8Array(ev.data as ArrayBuffer));
|
||||
text = new TextDecoder().decode(new Uint8Array(ev.data as ArrayBuffer));
|
||||
}
|
||||
term.write(
|
||||
text.replace(/\n{3,}/g, "\n\n")
|
||||
.replace(/\x1b\[\d*K/g, "")
|
||||
.replace(/\x1b\[\d*X/g, "")
|
||||
);
|
||||
};
|
||||
|
||||
ws.onclose = (ev) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue