@@ -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,17 @@ 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' ) {
186+ // eslint-disable-next-line react-hooks/set-state-in-effect -- intentional: synchronizing mode with external server status transition
187+ setMode ( prev => ( prev === 'chat' ? 'input' : prev ) ) ;
188+ }
189+ } , [ status ] ) ;
190+
180191 // Calculate available height for conversation display
181192 const terminalHeight = stdout ?. rows ?? 24 ;
182193 const terminalWidth = stdout ?. columns ?? 80 ;
@@ -259,7 +270,7 @@ export function DevScreen(props: DevScreenProps) {
259270 const agent = supportedAgents [ selectedAgentIndex ] ;
260271 if ( agent ) {
261272 setSelectedAgentName ( agent . name ) ;
262- setMode ( 'input ' ) ;
273+ setMode ( 'chat ' ) ;
263274 }
264275 }
265276 return ;
@@ -289,8 +300,8 @@ export function DevScreen(props: DevScreenProps) {
289300 // Clear the flag on any other key
290301 justCancelledRef . current = false ;
291302
292- // Enter to start typing (only when not streaming)
293- if ( key . return && ! isStreaming ) {
303+ // Enter to start typing (only when not streaming and server is running )
304+ if ( key . return && ! isStreaming && status === 'running' ) {
294305 setMode ( 'input' ) ;
295306 return ;
296307 }
@@ -314,7 +325,7 @@ export function DevScreen(props: DevScreenProps) {
314325 setUserScrolled ( false ) ;
315326 return ;
316327 }
317- if ( key . ctrl && input === 'r' ) {
328+ if ( key . ctrl && input === 'r' && status !== 'starting' ) {
318329 restart ( ) ;
319330 return ;
320331 }
@@ -355,11 +366,13 @@ export function DevScreen(props: DevScreenProps) {
355366 ? '↑↓ select · Enter confirm · q quit'
356367 : mode === 'input'
357368 ? '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' } ` ;
369+ : status === 'starting'
370+ ? `${ supportedAgents . length > 1 ? 'Esc back' : 'Esc quit' } `
371+ : isStreaming
372+ ? '↑↓ scroll'
373+ : conversation . length > 0
374+ ? `↑↓ scroll · Enter invoke · C clear · Ctrl+R restart · ${ supportedAgents . length > 1 ? 'Esc back' : 'Esc quit' } `
375+ : `Enter to send a message · Ctrl+R restart · ${ supportedAgents . length > 1 ? 'Esc back' : 'Esc quit' } ` ;
363376
364377 // Agent selection screen
365378 if ( mode === 'select-agent' ) {
@@ -394,10 +407,14 @@ export function DevScreen(props: DevScreenProps) {
394407 < Text > Server: </ Text >
395408 < Text color = "cyan" > http://localhost:{ actualPort } /invocations</ Text >
396409 </ Box >
397- { status !== 'starting' && ! isExiting && (
410+ { ! isExiting && (
398411 < Box >
399412 < Text > Status: </ Text >
400- < Text color = { statusColor } > { status } </ Text >
413+ { status === 'starting' ? (
414+ < Text color = "yellow" > { config ?. buildType === 'Container' ? 'Starting container...' : 'Starting...' } </ Text >
415+ ) : (
416+ < Text color = { statusColor } > { status } </ Text >
417+ ) }
401418 </ Box >
402419 ) }
403420 { isExiting && (
@@ -444,12 +461,12 @@ export function DevScreen(props: DevScreenProps) {
444461 { /* Input line - always visible at bottom */ }
445462 { /* Unfocused: dim arrow, press Enter to focus */ }
446463 { /* Focused: blue arrow with cursor, type and press Enter to send */ }
447- { mode === 'chat' && ! isStreaming && (
464+ { status === 'running' && mode === 'chat' && ! isStreaming && (
448465 < Box >
449466 < Text dimColor > > </ Text >
450467 </ Box >
451468 ) }
452- { mode === 'input' && (
469+ { status === 'running' && mode === 'input' && (
453470 < Box >
454471 < Text color = "blue" > > </ Text >
455472 < TextInput
0 commit comments