'use client' import * as React from 'react' import { Wrench, Check, X, Loader2 } from 'lucide-react' import { cn } from '@open-mercato/shared/lib/utils' import type { ToolCall } from '../../types' import { humanizeToolName } from '../../utils/toolMatcher' interface ToolCallDisplayProps { toolCall: ToolCall } export function ToolCallDisplay({ toolCall }: ToolCallDisplayProps) { const displayName = humanizeToolName(toolCall.toolName) return (
{toolCall.status === 'running' && } {toolCall.status === 'completed' && } {toolCall.status === 'error' && } {toolCall.status === 'pending' && }
{displayName}
{Object.keys(toolCall.args).length > 0 && (
{JSON.stringify(toolCall.args, null, 0).slice(0, 100)} {JSON.stringify(toolCall.args).length > 100 && '...'}
)} {toolCall.status === 'completed' && toolCall.result !== undefined && (
Result: {typeof toolCall.result === 'object' ? 'Success' : String(toolCall.result)}
)} {toolCall.status === 'error' && toolCall.error && (
Error: {toolCall.error}
)}
) }