Parse ANSI codes in output before SSE broadcast

This commit is contained in:
Jared Miller 2026-01-28 14:17:13 -05:00
parent 3f226996e7
commit 11e72b1025
Signed by: shmup
GPG key ID: 22B5C6D66A38B06C

View file

@ -1,6 +1,7 @@
// Core server: HTTP + WebSocket + SSE
import type { ServerWebSocket } from "bun";
import { ansiToHtml } from "./ansi";
import {
appendOutput,
createPrompt,
@ -420,11 +421,11 @@ const server = Bun.serve<SessionData>({
// Handle output message
if (msg.type === "output") {
appendOutput(ws.data.sessionId, msg.data);
appendOutput(ws.data.sessionId, msg.data); // Store raw ANSI
broadcastSSE({
type: "output",
session_id: ws.data.sessionId,
data: msg.data,
data: ansiToHtml(msg.data), // Parse for display
});
return;
}