Skip to content

Commit 5b97c6e

Browse files
committed
fix: container dev now has a starting container status
1 parent 0a1574a commit 5b97c6e

1 file changed

Lines changed: 31 additions & 15 deletions

File tree

src/cli/tui/screens/dev/DevScreen.tsx

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,15 @@ export function DevScreen(props: DevScreenProps) {
127127
const found = agents.find(a => a.name === props.agentName);
128128
if (found) {
129129
setSelectedAgentName(props.agentName);
130-
setMode('input');
130+
setMode('chat');
131131
} else if (agents.length > 0) {
132132
// Agent not found or not supported, show selection
133133
setSelectedAgentName(undefined);
134134
}
135135
} else if (agents.length === 1 && agents[0]) {
136136
// Auto-select if only one agent
137137
setSelectedAgentName(agents[0].name);
138-
setMode('input');
138+
setMode('chat');
139139
} else if (agents.length === 0) {
140140
// No supported agents, show error screen
141141
setNoAgentsError(true);
@@ -177,6 +177,16 @@ export function DevScreen(props: DevScreenProps) {
177177
}, 1000);
178178
}, [props, stop, isExiting]);
179179

180+
// Auto-focus input when server transitions from starting to running
181+
const prevStatusRef = useRef(status);
182+
useEffect(() => {
183+
const wasStarting = prevStatusRef.current === 'starting';
184+
prevStatusRef.current = status;
185+
if (wasStarting && status === 'running' && mode === 'chat') {
186+
setMode('input');
187+
}
188+
}, [status, mode]);
189+
180190
// Calculate available height for conversation display
181191
const terminalHeight = stdout?.rows ?? 24;
182192
const terminalWidth = stdout?.columns ?? 80;
@@ -259,7 +269,7 @@ export function DevScreen(props: DevScreenProps) {
259269
const agent = supportedAgents[selectedAgentIndex];
260270
if (agent) {
261271
setSelectedAgentName(agent.name);
262-
setMode('input');
272+
setMode('chat');
263273
}
264274
}
265275
return;
@@ -289,8 +299,8 @@ export function DevScreen(props: DevScreenProps) {
289299
// Clear the flag on any other key
290300
justCancelledRef.current = false;
291301

292-
// Enter to start typing (only when not streaming)
293-
if (key.return && !isStreaming) {
302+
// Enter to start typing (only when not streaming and server is running)
303+
if (key.return && !isStreaming && status === 'running') {
294304
setMode('input');
295305
return;
296306
}
@@ -314,7 +324,7 @@ export function DevScreen(props: DevScreenProps) {
314324
setUserScrolled(false);
315325
return;
316326
}
317-
if (key.ctrl && input === 'r') {
327+
if (key.ctrl && input === 'r' && status !== 'starting') {
318328
restart();
319329
return;
320330
}
@@ -355,11 +365,13 @@ export function DevScreen(props: DevScreenProps) {
355365
? '↑↓ select · Enter confirm · q quit'
356366
: mode === 'input'
357367
? 'Enter send · Esc cancel'
358-
: isStreaming
359-
? '↑↓ scroll'
360-
: conversation.length > 0
361-
? `↑↓ scroll · Enter invoke · C clear · Ctrl+R restart · ${supportedAgents.length > 1 ? 'Esc back' : 'Esc quit'}`
362-
: `Enter to send a message · Ctrl+R restart · ${supportedAgents.length > 1 ? 'Esc back' : 'Esc quit'}`;
368+
: status === 'starting'
369+
? `${supportedAgents.length > 1 ? 'Esc back' : 'Esc quit'}`
370+
: isStreaming
371+
? '↑↓ scroll'
372+
: conversation.length > 0
373+
? `↑↓ scroll · Enter invoke · C clear · Ctrl+R restart · ${supportedAgents.length > 1 ? 'Esc back' : 'Esc quit'}`
374+
: `Enter to send a message · Ctrl+R restart · ${supportedAgents.length > 1 ? 'Esc back' : 'Esc quit'}`;
363375

364376
// Agent selection screen
365377
if (mode === 'select-agent') {
@@ -394,10 +406,14 @@ export function DevScreen(props: DevScreenProps) {
394406
<Text>Server: </Text>
395407
<Text color="cyan">http://localhost:{actualPort}/invocations</Text>
396408
</Box>
397-
{status !== 'starting' && !isExiting && (
409+
{!isExiting && (
398410
<Box>
399411
<Text>Status: </Text>
400-
<Text color={statusColor}>{status}</Text>
412+
{status === 'starting' ? (
413+
<Text color="yellow">{config?.buildType === 'Container' ? 'Starting container...' : 'Starting...'}</Text>
414+
) : (
415+
<Text color={statusColor}>{status}</Text>
416+
)}
401417
</Box>
402418
)}
403419
{isExiting && (
@@ -444,12 +460,12 @@ export function DevScreen(props: DevScreenProps) {
444460
{/* Input line - always visible at bottom */}
445461
{/* Unfocused: dim arrow, press Enter to focus */}
446462
{/* Focused: blue arrow with cursor, type and press Enter to send */}
447-
{mode === 'chat' && !isStreaming && (
463+
{status === 'running' && mode === 'chat' && !isStreaming && (
448464
<Box>
449465
<Text dimColor>&gt; </Text>
450466
</Box>
451467
)}
452-
{mode === 'input' && (
468+
{status === 'running' && mode === 'input' && (
453469
<Box>
454470
<Text color="blue">&gt; </Text>
455471
<TextInput

0 commit comments

Comments
 (0)