File tree Expand file tree Collapse file tree 3 files changed +20
-14
lines changed
Expand file tree Collapse file tree 3 files changed +20
-14
lines changed Original file line number Diff line number Diff line change @@ -4,12 +4,17 @@ import { Thinking } from '../thinking'
44
55import type { ContentBlock } from '../../types/chat'
66
7+ // Nested thinking blocks need more offset to account for the subagent's border and padding
8+ const WIDTH_OFFSET = 8
9+ const NESTED_WIDTH_OFFSET = 12
10+
711interface ThinkingBlockProps {
812 blocks : Extract < ContentBlock , { type : 'text' } > [ ]
913 keyPrefix : string
1014 startIndex : number
1115 onToggleCollapsed : ( id : string ) => void
1216 availableWidth : number
17+ isNested : boolean
1318}
1419
1520export const ThinkingBlock = memo (
@@ -19,6 +24,7 @@ export const ThinkingBlock = memo(
1924 startIndex,
2025 onToggleCollapsed,
2126 availableWidth,
27+ isNested,
2228 } : ThinkingBlockProps ) => {
2329 const thinkingId = `${ keyPrefix } -thinking-${ startIndex } `
2430 const combinedContent = blocks
@@ -28,7 +34,8 @@ export const ThinkingBlock = memo(
2834
2935 const firstBlock = blocks [ 0 ]
3036 const isCollapsed = firstBlock ?. isCollapsed ?? true
31- const availWidth = Math . max ( 10 , availableWidth - 10 )
37+ const offset = isNested ? NESTED_WIDTH_OFFSET : WIDTH_OFFSET
38+ const availWidth = Math . max ( 10 , availableWidth - offset )
3239
3340 const handleToggle = useCallback ( ( ) => {
3441 onToggleCollapsed ( thinkingId )
Original file line number Diff line number Diff line change @@ -433,6 +433,7 @@ const AgentBody = memo(
433433 startIndex = { start }
434434 onToggleCollapsed = { onToggleCollapsed }
435435 availableWidth = { availableWidth }
436+ isNested = { true }
436437 /> ,
437438 )
438439 continue
@@ -716,6 +717,11 @@ const AgentBranchWrapper = memo(
716717 ? theme . foreground
717718 : theme . muted
718719
720+ // Split "Strategy #N: prompt" into parts for separate styling
721+ const strategyMatch = displayName . match ( / ^ ( S t r a t e g y # \d + : ) ( .* ) $ / )
722+ const strategyLabel = strategyMatch ? strategyMatch [ 1 ] : displayName
723+ const strategyPrompt = strategyMatch ? strategyMatch [ 2 ] : ''
724+
719725 return (
720726 < box
721727 key = { keyPrefix }
@@ -729,8 +735,11 @@ const AgentBranchWrapper = memo(
729735 < span fg = { statusColor } > { statusIndicator } </ span >
730736 < span fg = { theme . foreground } attributes = { TextAttributes . BOLD } >
731737 { ' ' }
732- { displayName }
738+ { strategyLabel }
733739 </ span >
740+ { strategyPrompt && (
741+ < span fg = { theme . foreground } > { strategyPrompt } </ span >
742+ ) }
734743 </ text >
735744 </ box >
736745 )
@@ -1237,6 +1246,7 @@ const BlocksRenderer = memo(
12371246 startIndex = { start }
12381247 onToggleCollapsed = { onToggleCollapsed }
12391248 availableWidth = { availableWidth }
1249+ isNested = { false }
12401250 /> ,
12411251 )
12421252 continue
Original file line number Diff line number Diff line change @@ -84,27 +84,16 @@ export const Thinking = memo(
8484 style = { {
8585 paddingLeft : 1 ,
8686 flexGrow : 1 ,
87- flexDirection : 'column' ,
88- gap : 0 ,
8987 } }
9088 >
91- < text
92- style = { {
93- wrapMode : 'none' ,
94- fg : theme . muted ,
95- } }
96- attributes = { TextAttributes . ITALIC }
97- >
98- { hasMore ? '...' : ' ' }
99- </ text >
10089 < text
10190 style = { {
10291 wrapMode : 'word' ,
10392 fg : theme . muted ,
10493 } }
10594 attributes = { TextAttributes . ITALIC }
10695 >
107- { previewLines . join ( ' ' ) }
96+ { ( hasMore ? '...' : '' ) + previewLines . join ( ' ' ) }
10897 </ text >
10998 </ box >
11099 </ box >
You can’t perform that action at this time.
0 commit comments