@@ -168,12 +168,17 @@ function websearch(info: ToolProps<typeof WebSearchTool>) {
168168}
169169
170170function task ( info : ToolProps < typeof TaskTool > ) {
171- const agent = Locale . titlecase ( info . input . subagent_type )
172- const desc = info . input . description
173- const started = info . part . state . status === "running"
171+ const input = info . part . state . input
172+ const status = info . part . state . status
173+ const subagent =
174+ typeof input . subagent_type === "string" && input . subagent_type . trim ( ) . length > 0 ? input . subagent_type : "unknown"
175+ const agent = Locale . titlecase ( subagent )
176+ const desc =
177+ typeof input . description === "string" && input . description . trim ( ) . length > 0 ? input . description : undefined
178+ const icon = status === "error" ? "✗" : status === "running" ? "•" : "✓"
174179 const name = desc ?? `${ agent } Task`
175180 inline ( {
176- icon : started ? "•" : "✓" ,
181+ icon,
177182 title : name ,
178183 description : desc ? `${ agent } Agent` : undefined ,
179184 } )
@@ -451,9 +456,17 @@ export const RunCommand = cmd({
451456 const part = event . properties . part
452457 if ( part . sessionID !== sessionID ) continue
453458
454- if ( part . type === "tool" && part . state . status === "completed" ) {
459+ if ( part . type === "tool" && ( part . state . status === "completed" || part . state . status === "error" ) ) {
455460 if ( emit ( "tool_use" , { part } ) ) continue
456- tool ( part )
461+ if ( part . state . status === "completed" ) {
462+ tool ( part )
463+ continue
464+ }
465+ inline ( {
466+ icon : "✗" ,
467+ title : `${ part . tool } failed` ,
468+ } )
469+ UI . error ( part . state . error )
457470 }
458471
459472 if (
0 commit comments