@@ -10,7 +10,11 @@ interface AgentToolsTabProps {
1010}
1111
1212export function AgentToolsTab ( { agent } : AgentToolsTabProps ) {
13- const tools = agent . tools ?? [ ]
13+ const tools = Array . isArray ( agent . tools )
14+ ? agent . tools
15+ : agent . tools
16+ ? [ agent . tools ]
17+ : [ ]
1418
1519 if ( tools . length === 0 ) {
1620 return (
@@ -25,16 +29,21 @@ export function AgentToolsTab({ agent }: AgentToolsTabProps) {
2529 return (
2630 < div className = "space-y-3" >
2731 { tools . map ( ( tool , index ) => {
28- const toolId = typeof tool === "string" ? tool : tool . id
29- const toolName = typeof tool === "string" ? tool : tool . name || tool . id
32+ const toolId = typeof tool === "string" ? tool : ( tool as any ) . id
33+ const toolName = typeof tool === "string" ? tool : tool . name || ( tool as any ) . id
3034 return (
3135 < div
32- key = { `${ toolId } -${ index } ` }
36+ key = { `${ toolName } - ${ toolId } -${ index } ` }
3337 className = "flex items-center justify-between p-3 rounded-md border"
38+ data-testid = { `agent-tool-${ toolId } -${ toolName } ` }
3439 >
3540 < div className = "flex items-center gap-3" >
3641 < Wrench className = "h-4 w-4 text-muted-foreground" />
37- < span className = "font-medium" > { toolName } </ span >
42+ < span className = "text-sm font-medium" >
43+ { typeof tool === "string"
44+ ? tool
45+ : String ( tool . name ?? ( tool as any ) . id ?? JSON . stringify ( tool ) ) }
46+ </ span >
3847 </ div >
3948 < Badge variant = "secondary" > Tool</ Badge >
4049 </ div >
0 commit comments