@@ -32,8 +32,8 @@ use warp::tui_export::{
3232 ParsedSlashCommandInput , PersistenceWriter , PillBarActionKind , PillBarInteractionEvent ,
3333 PillBarPillKind , PillSwitchOutcome , PtyIntent , PtyIntentEvent , QueuedQueryEvent ,
3434 QueuedQueryModel , RepoDetectionSessionType , RepoDetectionSource , ServerConversationToken ,
35- SessionSettings , Sessions , ShellCommandExecutorEvent , SizeInfo , SizeUpdate , SkillReference ,
36- SlashCommandDataSource as _, SlashCommandKind , SlashCommandSelectionBehavior ,
35+ SessionSettings , Sessions , SessionsEvent , ShellCommandExecutorEvent , SizeInfo , SizeUpdate ,
36+ SkillReference , SlashCommandDataSource as _, SlashCommandKind , SlashCommandSelectionBehavior ,
3737 StartAgentExecutorEvent , StartAgentRequest , StaticCommand , TelemetryEvent , TerminalColorList ,
3838 TerminalColors , TerminalModel , TerminalSurface , TerminalSurfaceInit , TranscriptScope ,
3939 TuiMcpAction , TuiMcpManager , TuiMcpServerId , TuiMcpVariableValue , TuiSlashCommandDataSource ,
@@ -1989,6 +1989,7 @@ impl TuiTerminalSessionView {
19891989 }
19901990 ModelEvent :: AfterBlockCompleted ( completed) => {
19911991 view. emit_block_completed_telemetry ( completed, ctx) ;
1992+ view. ensure_external_commands_are_warming ( ctx) ;
19921993 }
19931994 ModelEvent :: AfterBlockStarted { .. } => {
19941995 view. refresh_input_focus ( ctx) ;
@@ -2044,6 +2045,26 @@ impl TuiTerminalSessionView {
20442045 ctx. notify ( ) ;
20452046 }
20462047 } ) ;
2048+ ctx. subscribe_to_model ( & sessions, |view, _, event, ctx| match event {
2049+ SessionsEvent :: SessionBootstrapped ( bootstrap_event)
2050+ if view. active_session . as_ref ( ctx) . session_id ( ctx)
2051+ == Some ( bootstrap_event. session_id ) =>
2052+ {
2053+ let Some ( session) = view. sessions . as_ref ( ctx) . get ( bootstrap_event. session_id )
2054+ else {
2055+ report_error ! (
2056+ "Could not find active TUI session after its bootstrap event" ,
2057+ extra: { "session_id" => ?bootstrap_event. session_id }
2058+ ) ;
2059+ return ;
2060+ } ;
2061+ view. abort_shell_completion ( ctx) ;
2062+ view. warm_shell_completion_sources ( session, ctx) ;
2063+ }
2064+ SessionsEvent :: SessionBootstrapped ( _)
2065+ | SessionsEvent :: SessionInitialized { .. }
2066+ | SessionsEvent :: EnvironmentVariablesUpdated { .. } => { }
2067+ } ) ;
20472068 ctx. subscribe_to_model ( & active_session, |view, _, event, ctx| match event {
20482069 ActiveSessionEvent :: UpdatedPwd => {
20492070 view. abort_shell_completion ( ctx) ;
@@ -2086,7 +2107,7 @@ impl TuiTerminalSessionView {
20862107 } ) ;
20872108 ctx. notify ( ) ;
20882109 }
2089- ActiveSessionEvent :: Bootstrapped => view . abort_shell_completion ( ctx ) ,
2110+ ActiveSessionEvent :: Bootstrapped => { }
20902111 } ) ;
20912112 // The footer's usage entry shows the selected conversation's token/cost
20922113 // totals: re-render when that conversation's usage metadata updates.
@@ -2198,6 +2219,9 @@ impl TuiTerminalSessionView {
21982219 if let Some ( error) = initial_settings_file_error {
21992220 view. show_settings_file_error ( & error, ctx) ;
22002221 }
2222+ if let Some ( session) = view. active_session . as_ref ( ctx) . session ( ctx) {
2223+ view. warm_shell_completion_sources ( session, ctx) ;
2224+ }
22012225 view
22022226 }
22032227
0 commit comments