Skip to content

Commit a26f73c

Browse files
committed
Make default tool renderer collapse the output by default
1 parent 5a48dd3 commit a26f73c

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

cli/src/components/blocks/tool-branch.tsx

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,19 @@ export const ToolBranch = memo(
4545
}
4646

4747
const displayInfo = getToolDisplayInfo(toolBlock.toolName)
48-
const isCollapsed = toolBlock.isCollapsed ?? shouldCollapseToolByDefault(toolBlock.toolName)
48+
49+
// Check if there's a registered custom component for this tool
50+
const toolRenderConfig = renderToolComponent(toolBlock, theme, {
51+
availableWidth,
52+
indentationOffset: 0,
53+
previewPrefix: '',
54+
labelWidth: 0,
55+
})
56+
57+
// Tools without a registered component (fallback rendering) should be collapsed by default
58+
const hasRegisteredComponent = toolRenderConfig !== undefined
59+
const isCollapsed = toolBlock.isCollapsed ??
60+
(hasRegisteredComponent ? shouldCollapseToolByDefault(toolBlock.toolName) : true)
4961

5062
const inputContent = `\`\`\`json\n${JSON.stringify(toolBlock.input, null, 2)}\n\`\`\``
5163
const codeBlockLang =
@@ -67,13 +79,6 @@ export const ToolBranch = memo(
6779
? `$ ${toolBlock.input.command.trim()}`
6880
: null
6981

70-
let toolRenderConfig = renderToolComponent(toolBlock, theme, {
71-
availableWidth,
72-
indentationOffset: 0,
73-
previewPrefix: '',
74-
labelWidth: 0,
75-
})
76-
7782
const streamingPreview = isStreaming
7883
? commandPreview ?? `${sanitizePreview(firstLine)}...`
7984
: ''

0 commit comments

Comments
 (0)