import { useEffect, useRef } from 'react' import { Loader2, Terminal } from 'lucide-react' import type { Agent, TerminalLine } from '../../types' import { getAgentMeta } from '../../lib/agentMeta' import { cn } from '../../lib/utils' import { subTabIdle } from '../../lib/tabActive' type Props = { agent: Agent lines: TerminalLine[] busy: boolean onSendPrompt: (message: string, agentId?: string) => void compact?: boolean } const LEVEL: Record = { info: 'text-foreground-muted', ok: 'text-success', warn: 'text-warning', err: 'text-danger', cmd: 'text-docker', llm: 'text-violet-400', fetch: 'text-cyan-400', probe: 'text-amber-300', } export function AgentWorkbench({ agent, lines, busy, onSendPrompt, compact }: Props) { const meta = getAgentMeta(agent.id) const Icon = meta.icon const bottomRef = useRef(null) useEffect(() => { bottomRef.current?.scrollIntoView({ behavior: 'smooth' }) }, [lines, busy]) return (

{agent.name}

{!compact &&

{meta.domain} · {agent.zone}

}
{busy && } Terminal
{!compact && (
{(agent.suggested_prompts || []).slice(0, 4).map((prompt) => ( ))}
)}
{lines.length === 0 && (

Agent terminal ready

)} {lines.map((line) => (
{line.ts ? new Date(line.ts).toLocaleTimeString('en-US', { hour12: false }) : ''} {' '} [{line.phase}] {line.text}
))} {busy && }
) }