11import type { ComponentType , SVGProps } from 'react'
22import {
3- Asterisk ,
43 Blimp ,
54 Bug ,
65 Database ,
7- Eye ,
86 File ,
9- FolderCode ,
107 Hammer ,
118 Integration ,
12- Layout ,
13- Library ,
14- Pencil ,
159 PlayOutline ,
1610 Rocket ,
1711 Search ,
18- Settings ,
19- TerminalWindow ,
2012 Wrench ,
2113} from '@sim/emcn'
2214import { Calendar , Table as TableIcon } from '@sim/emcn/icons'
23- import { AgentIcon , ImageIcon , TTSIcon , VideoIcon } from '@/components/icons'
24- import type { ToolCallStatus } from '@/app/workspace/[workspaceId]/home /types'
15+ import { AgentIcon , VideoIcon } from '@/components/icons'
16+ import type { ToolCallStatus } from '../.. /types'
2517
2618export type IconComponent = ComponentType < SVGProps < SVGSVGElement > >
2719
28- const TOOL_ICONS : Record < string , IconComponent > = {
20+ const AGENT_ICONS : Record < string , IconComponent > = {
2921 mothership : Blimp ,
30- glob : FolderCode ,
31- grep : Search ,
32- read : File ,
33- mv : FolderCode ,
34- cp : Layout ,
35- mkdir : FolderCode ,
36- search_online : Search ,
37- scrape_page : Search ,
38- get_page_contents : Search ,
39- search_library_docs : Library ,
40- manage_mcp_tool : Settings ,
41- manage_skill : Asterisk ,
42- user_memory : Database ,
43- function_execute : TerminalWindow ,
44- run_code : TerminalWindow ,
4522 superagent : Blimp ,
46- user_table : TableIcon ,
47- workspace_file : File ,
48- edit_content : File ,
49- create_workflow : Layout ,
50- edit_workflow : Pencil ,
5123 workflow : Hammer ,
5224 debug : Bug ,
5325 run : PlayOutline ,
5426 deploy : Rocket ,
5527 auth : Integration ,
5628 knowledge : Database ,
57- knowledge_base : Database ,
58- search_knowledge_base : Database ,
5929 table : TableIcon ,
60- query_user_table : TableIcon ,
6130 scheduled_task : Calendar ,
6231 job : Calendar ,
6332 agent : AgentIcon ,
6433 custom_tool : Wrench ,
6534 research : Search ,
6635 scout : Search ,
6736 search : Search ,
68- context_compaction : Asterisk ,
69- open_resource : Eye ,
7037 file : File ,
7138 media : VideoIcon ,
72- generate_image : ImageIcon ,
73- generate_video : VideoIcon ,
74- generate_audio : TTSIcon ,
75- ffmpeg : Wrench ,
7639}
7740
7841export function getAgentIcon ( name : string ) : IconComponent {
79- return TOOL_ICONS [ name as keyof typeof TOOL_ICONS ] ?? Blimp
80- }
81-
82- export function getToolIcon ( name : string ) : IconComponent | undefined {
83- const icon = TOOL_ICONS [ name as keyof typeof TOOL_ICONS ]
84- return icon === Blimp ? undefined : icon
42+ return AGENT_ICONS [ name as keyof typeof AGENT_ICONS ] ?? Blimp
8543}
8644
8745export type MessagePhase = 'streaming' | 'revealing' | 'settled'
@@ -100,19 +58,6 @@ export function deriveMessagePhase({
10058 return 'settled'
10159}
10260
103- type ToolDisplayState = 'spinner' | 'cancelled' | 'interrupted' | 'icon'
104-
105- export function resolveToolDisplayState ( status : ToolCallStatus ) : ToolDisplayState {
106- // Pure projection of the tool's own status. A row spins iff it is genuinely
107- // executing; every terminal status maps to a glyph. No transport/turn-live
108- // gating — deterministic terminals (tool `result`, turn propagation) guarantee
109- // a row never lingers `executing` after its work is done.
110- if ( status === 'executing' ) return 'spinner'
111- if ( status === 'cancelled' ) return 'cancelled'
112- if ( status === 'interrupted' ) return 'interrupted'
113- return 'icon'
114- }
115-
11661export function isToolDone ( status : ToolCallStatus ) : boolean {
11762 return (
11863 status === 'success' ||
0 commit comments