import { Crosshair, MousePointer2, Sparkles, type LucideIcon } from 'lucide-react'; interface Props { /** The action verb from , e.g. "spotlight" | "point". */ actionType: string; /** Raw JSON payload inside the tag — parsed here only to surface the screen number. */ content: string; } // Known Mac action verbs → a friendly label + an icon. Unknown/future verbs fall back // to a title-cased label and a generic icon, so new action types still render cleanly. const ACTION_PRESENTATION: Record = { spotlight: { label: 'Spotlight', icon: Crosshair }, point: { label: 'Point', icon: MousePointer2 }, }; function titleCase(value: string): string { return value.charAt(0).toUpperCase() + value.slice(1); } function parseScreenNumber(rawJson: string): number | null { try { const data = JSON.parse(rawJson); return typeof data?.screen === 'number' ? data.screen : null; } catch { return null; } } /** * Compact "Agent actions" chip for a the agent sent to the Mac * (spotlight, point, …). We surface only the action and which screen it ran on — * never the raw coordinates — so the chat reads as a clean activity line. */ export default function MorphyActionCard({ actionType, content }: Props) { const presentation = ACTION_PRESENTATION[actionType.toLowerCase()] ?? { label: titleCase(actionType), icon: Sparkles }; const screenNumber = parseScreenNumber(content); const Icon = presentation.icon; return (
Agent actions:{' '} {presentation.label} {screenNumber !== null && at screen {screenNumber}}
); }