({ name, args, status }: ToolReasoningProps)
| 23 | } |
| 24 | |
| 25 | export function ToolReasoning({ name, args, status }: ToolReasoningProps) { |
| 26 | const entries = args ? Object.entries(args) : []; |
| 27 | const detailsRef = useRef<HTMLDetailsElement>(null); |
| 28 | const toolStatus = status as "complete" | "inProgress" | "executing" |
| 29 | |
| 30 | // Auto-open while executing, auto-close when complete |
| 31 | useEffect(() => { |
| 32 | if (!detailsRef.current) return; |
| 33 | detailsRef.current.open = status === "executing"; |
| 34 | }, [status]); |
| 35 | |
| 36 | return ( |
| 37 | <div className="my-2 text-sm"> |
| 38 | {entries.length > 0 ? ( |
| 39 | <details ref={detailsRef} open> |
| 40 | <summary className="flex items-center gap-2 text-gray-600 dark:text-gray-400 cursor-pointer list-none"> |
| 41 | {statusIndicator[toolStatus]} |
| 42 | <span className="font-medium">{name}</span> |
| 43 | <span className="text-[10px]">▼</span> |
| 44 | </summary> |
| 45 | <div className="pl-5 mt-1 space-y-1 text-xs text-gray-500 dark:text-zinc-400"> |
| 46 | {entries.map(([key, value]) => ( |
| 47 | <div key={key} className="flex gap-2 min-w-0"> |
| 48 | <span className="font-medium shrink-0">{key}:</span> |
| 49 | <span className="text-gray-600 dark:text-gray-400 truncate"> |
| 50 | {formatValue(value)} |
| 51 | </span> |
| 52 | </div> |
| 53 | ))} |
| 54 | </div> |
| 55 | </details> |
| 56 | ) : ( |
| 57 | <div className="flex items-center gap-2 text-gray-600 dark:text-gray-400"> |
| 58 | {statusIndicator[toolStatus]} |
| 59 | <span className="font-medium">{name}</span> |
| 60 | </div> |
| 61 | )} |
| 62 | </div> |
| 63 | ); |
| 64 | } |
nothing calls this directly
no test coverage detected