22
33import { memo , useMemo } from 'react'
44import { Read as ReadTool , WorkspaceFile } from '@/lib/copilot/generated/tool-catalog-v1'
5- import { isToolHiddenInUi } from '@/lib/copilot/tools/client/hidden-tools'
65import { resolveToolDisplay } from '@/lib/copilot/tools/client/store-utils'
76import { ClientToolCallState } from '@/lib/copilot/tools/client/tool-call-state'
87import type { ContentBlock , MothershipResource , OptionItem , ToolCallData } from '../../types'
@@ -18,6 +17,7 @@ import {
1817} from './components'
1918
2019const FILE_SUBAGENT_ID = 'file'
20+ const HIDDEN_TOOL_NAMES = new Set ( [ 'tool_search_tool_regex' , 'load_agent_skill' , 'load_custom_tool' ] )
2121
2222interface TextSegment {
2323 type : 'text'
@@ -75,6 +75,10 @@ function isToolResultRead(params?: Record<string, unknown>): boolean {
7575 return typeof path === 'string' && path . startsWith ( 'internal/tool-results/' )
7676}
7777
78+ function isHiddenToolCall ( toolName : string | undefined ) : boolean {
79+ return ! ! toolName && HIDDEN_TOOL_NAMES . has ( toolName )
80+ }
81+
7882function formatToolName ( name : string ) : string {
7983 return name
8084 . replace ( / _ v \d + $ / , '' )
@@ -301,7 +305,7 @@ function parseBlocks(blocks: ContentBlock[]): MessageSegment[] {
301305 if ( block . type === 'tool_call' ) {
302306 if ( ! block . toolCall ) continue
303307 const tc = block . toolCall
304- if ( isToolHiddenInUi ( tc . name ) ) continue
308+ if ( isHiddenToolCall ( tc . name ) ) continue
305309 if ( tc . name === ReadTool . id && isToolResultRead ( tc . params ) ) continue
306310 const isDispatch = SUBAGENT_KEYS . has ( tc . name ) && ! tc . calledBy
307311
0 commit comments