Parse ANSI codes in output before SSE broadcast
This commit is contained in:
parent
3f226996e7
commit
11e72b1025
1 changed files with 3 additions and 2 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
// Core server: HTTP + WebSocket + SSE
|
// Core server: HTTP + WebSocket + SSE
|
||||||
|
|
||||||
import type { ServerWebSocket } from "bun";
|
import type { ServerWebSocket } from "bun";
|
||||||
|
import { ansiToHtml } from "./ansi";
|
||||||
import {
|
import {
|
||||||
appendOutput,
|
appendOutput,
|
||||||
createPrompt,
|
createPrompt,
|
||||||
|
|
@ -420,11 +421,11 @@ const server = Bun.serve<SessionData>({
|
||||||
|
|
||||||
// Handle output message
|
// Handle output message
|
||||||
if (msg.type === "output") {
|
if (msg.type === "output") {
|
||||||
appendOutput(ws.data.sessionId, msg.data);
|
appendOutput(ws.data.sessionId, msg.data); // Store raw ANSI
|
||||||
broadcastSSE({
|
broadcastSSE({
|
||||||
type: "output",
|
type: "output",
|
||||||
session_id: ws.data.sessionId,
|
session_id: ws.data.sessionId,
|
||||||
data: msg.data,
|
data: ansiToHtml(msg.data), // Parse for display
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue