File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { memo, useCallback } from 'react'
33import { ContentWithMarkdown } from './content-with-markdown'
44import { useTheme } from '../../hooks/use-theme'
55import { getToolDisplayInfo } from '../../utils/codebuff-client'
6+ import { shouldCollapseToolByDefault } from '../../utils/constants'
67import { renderToolComponent } from '../tools/registry'
78import { ToolCallItem } from '../tools/tool-call-item'
89
@@ -43,7 +44,7 @@ export const ToolBranch = memo(
4344 }
4445
4546 const displayInfo = getToolDisplayInfo ( toolBlock . toolName )
46- const isCollapsed = toolBlock . isCollapsed ?? false
47+ const isCollapsed = toolBlock . isCollapsed ?? shouldCollapseToolByDefault ( toolBlock . toolName )
4748 const isStreaming = streamingAgents . has ( toolBlock . toolCallId )
4849
4950 const inputContent = `\`\`\`json\n${ JSON . stringify ( toolBlock . input , null , 2 ) } \n\`\`\``
Original file line number Diff line number Diff line change 1+ import type { ToolName } from '@codebuff/sdk'
2+
13// Agent IDs that should not be rendered in the CLI UI
24export const HIDDEN_AGENT_IDS = [ 'codebuff/context-pruner' ] as const
35
6+ // Tool names that should be collapsed by default when rendered
7+ // Uses ToolName type to ensure only valid tool names are added
8+ export const COLLAPSED_BY_DEFAULT_TOOL_NAMES : readonly ToolName [ ] = [
9+ 'set_output' ,
10+ ] as const
11+
12+ /**
13+ * Check if a tool should be collapsed by default
14+ */
15+ export const shouldCollapseToolByDefault = ( toolName : string ) : boolean => {
16+ return COLLAPSED_BY_DEFAULT_TOOL_NAMES . includes ( toolName as ToolName )
17+ }
18+
419/**
520 * Check if an agent ID should be hidden from rendering
621 */
You can’t perform that action at this time.
0 commit comments