Skip to content

Commit 5a693c9

Browse files
committed
fix(cli): collapse set_output tool toggle by default
1 parent 5b7b149 commit 5a693c9

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { memo, useCallback } from 'react'
33
import { ContentWithMarkdown } from './content-with-markdown'
44
import { useTheme } from '../../hooks/use-theme'
55
import { getToolDisplayInfo } from '../../utils/codebuff-client'
6+
import { shouldCollapseToolByDefault } from '../../utils/constants'
67
import { renderToolComponent } from '../tools/registry'
78
import { 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\`\`\``

cli/src/utils/constants.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
1+
import type { ToolName } from '@codebuff/sdk'
2+
13
// Agent IDs that should not be rendered in the CLI UI
24
export 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
*/

0 commit comments

Comments
 (0)