@@ -19,7 +19,7 @@ import {
1919import { useData } from "../context"
2020import { useFileComponent } from "../context/file"
2121import { useDialog } from "../context/dialog"
22- import { useI18n } from "../context/i18n"
22+ import { type UiI18n , useI18n } from "../context/i18n"
2323import { GenericTool , ToolCall } from "./basic-tool"
2424import { Accordion } from "./accordion"
2525import { StickyAccordionHeader } from "./sticky-accordion-header"
@@ -123,6 +123,11 @@ export type ToolInfo = {
123123 subtitle ?: string
124124}
125125
126+ function agentTitle ( i18n : UiI18n , type ?: string ) {
127+ if ( ! type ) return i18n . t ( "ui.tool.agent.default" )
128+ return i18n . t ( "ui.tool.agent" , { type } )
129+ }
130+
126131export function getToolInfo ( tool : string , input : any = { } ) : ToolInfo {
127132 const i18n = useI18n ( )
128133 switch ( tool ) {
@@ -168,12 +173,17 @@ export function getToolInfo(tool: string, input: any = {}): ToolInfo {
168173 title : i18n . t ( "ui.tool.codesearch" ) ,
169174 subtitle : input . query ,
170175 }
171- case "task" :
176+ case "task" : {
177+ const type =
178+ typeof input . subagent_type === "string" && input . subagent_type
179+ ? input . subagent_type [ 0 ] ! . toUpperCase ( ) + input . subagent_type . slice ( 1 )
180+ : undefined
172181 return {
173182 icon : "task" ,
174- title : i18n . t ( "ui.tool.agent" ) ,
183+ title : agentTitle ( i18n , type ) ,
175184 subtitle : input . description ,
176185 }
186+ }
177187 case "bash" :
178188 return {
179189 icon : "console" ,
@@ -1475,11 +1485,12 @@ ToolRegistry.register({
14751485 const data = useData ( )
14761486 const i18n = useI18n ( )
14771487 const childSessionId = ( ) => props . metadata . sessionId as string | undefined
1478- const agentType = createMemo ( ( ) => {
1488+ const type = createMemo ( ( ) => {
14791489 const raw = props . input . subagent_type
14801490 if ( typeof raw !== "string" || ! raw ) return undefined
14811491 return raw [ 0 ] ! . toUpperCase ( ) + raw . slice ( 1 )
14821492 } )
1493+ const title = createMemo ( ( ) => agentTitle ( i18n , type ( ) ) )
14831494 const description = createMemo ( ( ) => {
14841495 const value = props . input . description
14851496 if ( typeof value === "string" ) return value
@@ -1527,9 +1538,8 @@ ToolRegistry.register({
15271538 < div data-slot = "basic-tool-tool-info-structured" >
15281539 < div data-slot = "basic-tool-tool-info-main" >
15291540 < span data-slot = "basic-tool-tool-title" >
1530- < TextShimmer text = { i18n . t ( "ui.tool.agent" ) } active = { running ( ) } />
1541+ < TextShimmer text = { title ( ) } active = { running ( ) } />
15311542 </ span >
1532- < Show when = { agentType ( ) } > { ( type ) => < ToolText text = { type ( ) } animate = { reveal ( ) } /> } </ Show >
15331543 < Show when = { description ( ) } >
15341544 < Switch >
15351545 < Match when = { href ( ) } >
0 commit comments