@@ -307,12 +307,24 @@ Element BuildLoadingElement()
307307 // restore the per-agent name here.
308308 const string assistantSenderLabel = "Assistant" ;
309309
310- // Show inline "thinking" indicator when the turn is active but the
311- // last visible entry is NOT an assistant block yet — i.e. we're between
312- // the user's send and the first assistant delta arriving.
313- var showThinking = timeline . TurnActive
314- && ( timeline . Entries . Count == 0
315- || timeline . Entries [ timeline . Entries . Count - 1 ] . Kind != ChatTimelineItemKind . Assistant ) ;
310+ // Show inline "thinking" indicator only until this turn has an
311+ // assistant bubble. Tool calls can arrive before the first assistant
312+ // delta; those should nest under the thinking bubble instead of
313+ // suppressing it. Once an assistant entry exists in the current turn,
314+ // tool calls nest there and the thinking placeholder goes away.
315+ var currentTurnHasAssistant = false ;
316+ for ( var i = timeline . Entries . Count - 1 ; i >= 0 ; i -- )
317+ {
318+ var kind = timeline . Entries [ i ] . Kind ;
319+ if ( kind == ChatTimelineItemKind . User )
320+ break ;
321+ if ( kind == ChatTimelineItemKind . Assistant )
322+ {
323+ currentTurnHasAssistant = true ;
324+ break ;
325+ }
326+ }
327+ var showThinking = timeline . TurnActive && ! currentTurnHasAssistant ;
316328
317329 // Apply preview-state overrides for the four data-dependent states.
318330 // These mutate locals only — real provider data on disk is untouched.
@@ -524,6 +536,7 @@ Element BuildLoadingElement()
524536 AssistantSenderLabel : assistantSenderLabel ,
525537 DefaultModel : effectiveThread . Model ,
526538 ShowThinkingIndicator : showThinking ,
539+ EnableExplorationControls : _provider is FakeChatDataProvider ,
527540 OnReadAloud : _onReadAloud is not null
528541 ? ( text => _onReadAloud ( text ) )
529542 : null ,
0 commit comments