import { useState } from 'react'; import type { CSSProperties } from 'react'; import { ChevronRight, FileText } from 'lucide-react'; import { cn } from '../../lib/cn'; import { Avatar } from '../core/Avatar'; import { ConfidenceRing } from './ConfidenceRing'; import { ReasoningBody } from './ReasoningBody'; export type Citation = string | { title: string }; export interface AIDecisionCardProps { employee?: string; role?: string; activity?: string; /** Confidence 0โ€“1. @default 0.85 */ confidence?: number; summary?: string; reasoning?: string | null; citations?: Citation[]; time?: string | null; defaultExpanded?: boolean; /** Autonomy threshold. @default 0.7 */ threshold?: number; className?: string; style?: CSSProperties; } /** * AI DECISION CARD โ€” Aria's signature component. * Which AI employee acted, the activity, a confidence ring, a one-line * reasoning summary, expandable full reasoning, and cited-knowledge chips. */ export function AIDecisionCard({ employee = 'Aria', role = 'Lead Qualifier', activity, confidence = 0.85, summary, reasoning = null, citations = [], time = null, defaultExpanded = false, threshold = 0.7, className, style, }: AIDecisionCardProps) { const [open, setOpen] = useState(defaultExpanded); const autonomous = confidence >= threshold; const accent = autonomous ? 'var(--status-autonomous)' : 'var(--status-escalated)'; const accentSoft = autonomous ? 'var(--status-autonomous-soft)' : 'var(--status-escalated-soft)'; return (
{/* accent rail */} {/* header band โ€” identity + confidence, tinted by autonomy state */}
{employee} {role}
{activity} {time && ยท {time}}
{/* status pill */}
{autonomous ? 'AUTONOMOUS DECISION' : 'ESCALATED TO HUMAN'}
{/* one-line reasoning summary */}

{summary}

{/* expandable full reasoning */} {reasoning && (
{open && (
)}
)} {/* citation chips */} {citations.length > 0 && (
Cited knowledge
{citations.map((c, i) => ( {typeof c === 'string' ? c : c.title} ))}
)}
); }