@@ -80,6 +80,10 @@ export const MessageBlock = ({
8080 ancestorBranchStates : boolean [ ] ,
8181 isLastBranch : boolean ,
8282 ) => {
83+ // Only show branching characters when inside a subagent (indentLevel > 0)
84+ if ( ancestorBranchStates . length === 0 ) {
85+ return ''
86+ }
8387 const ancestorPrefix = ancestorBranchStates
8488 . map ( ( ancestorIsLast ) => ( ancestorIsLast ? ' ' : '│ ' ) )
8589 . join ( '' )
@@ -181,15 +185,23 @@ export const MessageBlock = ({
181185
182186 const branchChar = computeBranchChar ( ancestorBranchStates , isLastBranch )
183187 const indentPrefix = branchChar . replace ( / [ ├ └ ] \s * $ / , '' )
188+ // Only show preview prefix with branching when inside a subagent
184189 const previewBasePrefix =
185- indentPrefix . length > 0 ? `${ indentPrefix } │ ` : ' │ '
190+ ancestorBranchStates . length > 0
191+ ? indentPrefix . length > 0
192+ ? `${ indentPrefix } │ `
193+ : ' │ '
194+ : ''
186195 const branchIndentWidth = stringWidth ( branchChar )
187196 const headerPrefixWidth = stringWidth ( branchChar )
188197 const previewBaseWidth = stringWidth ( previewBasePrefix )
189198 const alignmentPadding = Math . max ( 0 , headerPrefixWidth - previewBaseWidth )
190- const paddedPreviewPrefix = `${ previewBasePrefix } ${ ' ' . repeat ( alignmentPadding ) } `
191- const blankPreviewPrefix =
192- previewBasePrefix . replace ( / \s + $ / , '' ) || previewBasePrefix
199+ const paddedPreviewPrefix = previewBasePrefix
200+ ? `${ previewBasePrefix } ${ ' ' . repeat ( alignmentPadding ) } `
201+ : ''
202+ const blankPreviewPrefix = previewBasePrefix
203+ ? previewBasePrefix . replace ( / \s + $ / , '' ) || previewBasePrefix
204+ : ''
193205 const toolRenderConfig = getToolRenderConfig ( toolBlock , theme , {
194206 availableWidth,
195207 indentationOffset : branchIndentWidth ,
@@ -198,6 +210,10 @@ export const MessageBlock = ({
198210 } )
199211 const formatPreview = ( value : string | null ) : string => {
200212 if ( ! value ) return ''
213+ // At top level, don't add preview prefix with branching characters
214+ if ( ancestorBranchStates . length === 0 ) {
215+ return value
216+ }
201217 const rawLines = value . split ( '\n' )
202218 const decorated = rawLines . map ( ( line ) =>
203219 line . trim ( ) . length > 0
0 commit comments