feat(tui): add respawn status polling and display

- Poll session API every 2 seconds for respawn status
- Display respawn state and cycle count in StatusBar
- Show respawn status in magenta to match web UI
- Format state (underscores to spaces) for readability

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
arkon
2026-01-21 06:38:38 +01:00
co-authored by Claude Opus 4.5
parent 9c995d204c
commit bd3bfced96
3 changed files with 70 additions and 2 deletions
+17 -1
View File
@@ -13,9 +13,16 @@ import React from 'react';
import { Box, Text } from 'ink';
import type { ScreenSession } from '../../types.js';
interface RespawnStatus {
enabled: boolean;
state: string;
cycleCount: number;
}
interface StatusBarProps {
session: ScreenSession | null;
inputMode?: boolean;
respawnStatus?: RespawnStatus | null;
}
/**
@@ -38,7 +45,7 @@ function formatDuration(ms: number): string {
/**
* StatusBar component showing session information
*/
export function StatusBar({ session, inputMode = false }: StatusBarProps): React.ReactElement {
export function StatusBar({ session, inputMode = false, respawnStatus }: StatusBarProps): React.ReactElement {
if (!session) {
return (
<Box
@@ -88,6 +95,15 @@ export function StatusBar({ session, inputMode = false }: StatusBarProps): React
<Text color="yellow" bold>INPUT MODE</Text>
</>
)}
{respawnStatus?.enabled && (
<>
<Text> | </Text>
<Text color="magenta">
respawn: {respawnStatus.state.replace(/_/g, ' ')}
{respawnStatus.cycleCount > 0 && ` (${respawnStatus.cycleCount})`}
</Text>
</>
)}
</Box>
{/* Right side: Keyboard hints */}