@@ -192,11 +192,31 @@ export function SessionTurn(
192192 ( item ) : item is AssistantMessage => item . role === "assistant" && typeof item . time . completed !== "number" ,
193193 )
194194 } )
195+
196+ const pendingUser = createMemo ( ( ) => {
197+ const item = pending ( )
198+ if ( ! item ?. parentID ) return
199+ const messages = allMessages ( ) ?? emptyMessages
200+ const result = Binary . search ( messages , item . parentID , ( m ) => m . id )
201+ const msg = result . found ? messages [ result . index ] : messages . find ( ( m ) => m . id === item . parentID )
202+ if ( ! msg || msg . role !== "user" ) return
203+ return msg
204+ } )
205+
195206 const active = createMemo ( ( ) => {
196207 const msg = message ( )
208+ const parent = pendingUser ( )
209+ if ( ! msg || ! parent ) return false
210+ return parent . id === msg . id
211+ } )
212+
213+ const queued = createMemo ( ( ) => {
214+ const id = message ( ) ?. id
215+ if ( ! id ) return false
216+ if ( ! pendingUser ( ) ) return false
197217 const item = pending ( )
198- if ( ! msg || ! item ) return false
199- return item . parentID === msg . id
218+ if ( ! item ) return false
219+ return id > item . id
200220 } )
201221
202222 const parts = createMemo ( ( ) => {
@@ -334,6 +354,7 @@ export function SessionTurn(
334354 )
335355 const showThinking = createMemo ( ( ) => {
336356 if ( ! working ( ) || ! ! error ( ) ) return false
357+ if ( queued ( ) ) return false
337358 if ( status ( ) . type === "retry" ) return false
338359 if ( showReasoningSummaries ( ) ) return assistantVisible ( ) === 0
339360 if ( assistantTailVisible ( ) === "text" ) return false
@@ -364,7 +385,7 @@ export function SessionTurn(
364385 class = { props . classes ?. container }
365386 >
366387 < div data-slot = "session-turn-message-content" aria-live = "off" >
367- < Message message = { msg ( ) } parts = { parts ( ) } interrupted = { interrupted ( ) } />
388+ < Message message = { msg ( ) } parts = { parts ( ) } interrupted = { interrupted ( ) } queued = { queued ( ) } />
368389 </ div >
369390 < Show when = { compaction ( ) } >
370391 { ( part ) => (
0 commit comments