From 130f01a19fac88fd1b684c6744994a62e81e340d Mon Sep 17 00:00:00 2001 From: Jared Miller Date: Sat, 31 Jan 2026 09:53:22 -0500 Subject: [PATCH] Clean up deprecated ANSI processing code (Phase 4) Removed the ansiCarryovers Map from server.ts since terminal emulation now handles all ANSI sequence buffering internally. Marked ansi.ts and ansi-carryover.ts as deprecated with JSDoc comments, but kept them for backward compatibility and potential rollback. --- src/ansi-carryover.ts | 6 ++++++ src/ansi.ts | 6 ++++++ src/server.ts | 3 --- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/ansi-carryover.ts b/src/ansi-carryover.ts index 461a93c..b2651cf 100644 --- a/src/ansi-carryover.ts +++ b/src/ansi-carryover.ts @@ -1,3 +1,9 @@ +/** + * @deprecated This module is deprecated. Terminal output is now handled by + * the headless terminal emulator in terminal.ts. Kept for backward compatibility. + * See docs/terminal-emulation.md for details. + */ + /** * Detect and split any incomplete ANSI control sequence at the end of a chunk. * diff --git a/src/ansi.ts b/src/ansi.ts index 58e6d5c..a33c673 100644 --- a/src/ansi.ts +++ b/src/ansi.ts @@ -1,3 +1,9 @@ +/** + * @deprecated This module is deprecated. Terminal output is now handled by + * the headless terminal emulator in terminal.ts. Kept for backward compatibility. + * See docs/terminal-emulation.md for details. + */ + // ANSI to HTML converter - processes escape sequences and renders as inline styled spans const colors: Record = { diff --git a/src/server.ts b/src/server.ts index 7fd0fc1..9c38fad 100644 --- a/src/server.ts +++ b/src/server.ts @@ -35,8 +35,6 @@ import type { const sseClients = new Set>(); const sessionWebSockets = new Map>(); const sessionStates = new Map(); -// Buffer for incomplete ANSI sequences per session to avoid leaking partial control codes -const ansiCarryovers = new Map(); const sessionTerminals = new Map(); interface SessionData { @@ -686,7 +684,6 @@ const server = Bun.serve({ close(ws) { if (ws.data.sessionId) { sessionWebSockets.delete(ws.data.sessionId); - ansiCarryovers.delete(ws.data.sessionId); // Dispose terminal emulator const termSession = sessionTerminals.get(ws.data.sessionId);