@@ -10,14 +10,7 @@ import { useChatSurface } from '@/app/workspace/[workspaceId]/home/components/ch
1010import type { ContentBlock , OptionItem , ToolCallData } from '../../types'
1111import { SUBAGENT_LABELS } from '../../types'
1212import type { AgentGroupItem } from './components'
13- import {
14- AgentGroup ,
15- ChatContent ,
16- CircleStop ,
17- Options ,
18- PendingTagIndicator ,
19- ThinkingBlock ,
20- } from './components'
13+ import { AgentGroup , ChatContent , CircleStop , Options , PendingTagIndicator } from './components'
2114import { deriveMessagePhase , isToolDone , type MessagePhase } from './utils'
2215
2316const FILE_SUBAGENT_ID = 'file'
@@ -29,14 +22,6 @@ interface TextSegment {
2922 content : string
3023}
3124
32- interface ThinkingSegment {
33- type : 'thinking'
34- id : string
35- content : string
36- startedAt ?: number
37- endedAt ?: number
38- }
39-
4025interface AgentGroupSegment {
4126 type : 'agent_group'
4227 id : string
@@ -56,12 +41,7 @@ interface StoppedSegment {
5641 type : 'stopped'
5742}
5843
59- type MessageSegment =
60- | TextSegment
61- | ThinkingSegment
62- | AgentGroupSegment
63- | OptionsSegment
64- | StoppedSegment
44+ type MessageSegment = TextSegment | AgentGroupSegment | OptionsSegment | StoppedSegment
6545
6646const SUBAGENT_KEYS = new Set ( Object . keys ( SUBAGENT_LABELS ) )
6747
@@ -279,23 +259,9 @@ function parseBlocksWithSpanTree(blocks: ContentBlock[]): MessageSegment[] {
279259 continue
280260 }
281261
282- if ( block . type === 'thinking' ) {
283- if ( ! block . content ?. trim ( ) ) continue
284- const last = segments [ segments . length - 1 ]
285- if ( last ?. type === 'thinking' && last . endedAt === undefined ) {
286- last . content += block . content
287- if ( block . endedAt !== undefined ) last . endedAt = block . endedAt
288- } else {
289- segments . push ( {
290- type : 'thinking' ,
291- id : `thinking-${ i } ` ,
292- content : block . content ,
293- startedAt : block . timestamp ,
294- endedAt : block . endedAt ,
295- } )
296- }
297- continue
298- }
262+ // Main-agent thinking is intentionally not rendered. The reasoning is still
263+ // reduced and persisted upstream — this is a display-only omission.
264+ if ( block . type === 'thinking' ) continue
299265
300266 if ( block . type === 'text' ) {
301267 if ( ! block . content ) continue
@@ -515,21 +481,10 @@ function parseBlocksLegacy(blocks: ContentBlock[]): MessageSegment[] {
515481 }
516482
517483 if ( block . type === 'thinking' ) {
484+ // Main-agent thinking is not rendered, but it still breaks open subagent
485+ // lanes so later chunks don't merge across it (display-only omission).
518486 if ( ! block . content ?. trim ( ) ) continue
519487 flushLanes ( )
520- const last = segments [ segments . length - 1 ]
521- if ( last ?. type === 'thinking' && last . endedAt === undefined ) {
522- last . content += block . content
523- if ( block . endedAt !== undefined ) last . endedAt = block . endedAt
524- } else {
525- segments . push ( {
526- type : 'thinking' ,
527- id : `thinking-${ i } ` ,
528- content : block . content ,
529- startedAt : block . timestamp ,
530- endedAt : block . endedAt ,
531- } )
532- }
533488 continue
534489 }
535490
@@ -776,29 +731,6 @@ function MessageContentInner({
776731 }
777732 />
778733 )
779- case 'thinking' : {
780- const isActive =
781- isStreaming && i === segments . length - 1 && segment . endedAt === undefined
782- const elapsedMs =
783- segment . startedAt !== undefined && segment . endedAt !== undefined
784- ? segment . endedAt - segment . startedAt
785- : undefined
786- // Hide completed thinking that took 3s or less — quick thinking
787- // isn't worth the visual noise. Still show while active (unknown
788- // duration yet) and still show when timing is missing (old
789- // persisted blocks) so we don't drop historical content.
790- if ( elapsedMs !== undefined && elapsedMs <= 3000 ) return null
791- return (
792- < div key = { segment . id } className = { isStreaming ? 'animate-stream-fade-in' : undefined } >
793- < ThinkingBlock
794- content = { segment . content }
795- isActive = { isActive }
796- startedAt = { segment . startedAt }
797- isStreaming = { isStreaming }
798- />
799- </ div >
800- )
801- }
802734 case 'agent_group' : {
803735 return (
804736 < div key = { segment . id } className = { isStreaming ? 'animate-stream-fade-in' : undefined } >
@@ -809,7 +741,8 @@ function MessageContentInner({
809741 items = { segment . items }
810742 isDelegating = { segment . isDelegating }
811743 isStreaming = { isStreaming }
812- defaultExpanded = { segment . isOpen }
744+ isCurrentSection = { i === segments . length - 1 }
745+ isLaneOpen = { segment . isOpen }
813746 />
814747 </ div >
815748 )
0 commit comments