Fix live streaming for terminal previews with asciinema player

- Configure asciinema player with eventsource driver for SSE support
- Update server stream endpoint to properly format SSE for asciinema
- Session preview cards now display live terminal output

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Mario Zechner 2025-06-16 05:42:33 +02:00
parent 520cf9641d
commit a7dce56757
2 changed files with 36 additions and 36 deletions

View file

@ -99,9 +99,9 @@ export class SessionList extends LitElement {
const playerElement = this.querySelector(`#player-${sessionId}`) as HTMLElement; const playerElement = this.querySelector(`#player-${sessionId}`) as HTMLElement;
if (playerElement && (window as any).AsciinemaPlayer) { if (playerElement && (window as any).AsciinemaPlayer) {
try { try {
const snapshotUrl = `/api/sessions/${sessionId}/snapshot`; const streamUrl = `/api/sessions/${sessionId}/stream`;
(window as any).AsciinemaPlayer.create(snapshotUrl, playerElement, { (window as any).AsciinemaPlayer.create({driver: "eventsource", url: streamUrl}, playerElement, {
autoPlay: true, autoPlay: true,
loop: false, loop: false,
controls: false, controls: false,

View file

@ -277,7 +277,7 @@ app.post('/api/cleanup-exited', async (req, res) => {
// === TERMINAL I/O === // === TERMINAL I/O ===
// Server-sent events for terminal output streaming // Live streaming cast file for asciinema player
app.get('/api/sessions/:sessionId/stream', (req, res) => { app.get('/api/sessions/:sessionId/stream', (req, res) => {
const sessionId = req.params.sessionId; const sessionId = req.params.sessionId;
const streamOutPath = path.join(TTY_FWD_CONTROL_DIR, sessionId, 'stream-out'); const streamOutPath = path.join(TTY_FWD_CONTROL_DIR, sessionId, 'stream-out');