import { Terminal } from "lucide-react"; import { Badge } from "@/components/ui/badge"; import type { RequestHostAttribution } from "@/lib/host-attribution"; import { cn } from "@/lib/utils"; import type { Host } from "@/lib/types"; // Exact product colors from the current official app assets. Label colors meet // WCAG AA for the badge's small text: Claude 5.65:1, Codex 5.39:1, OpenCode 18.93:1. const HOST_META: Record< Exclude, { label: string; badgeClass: string; dotClass: string } > = { "claude-code": { label: "Claude Code", badgeClass: "border-[#D97757] bg-[#D97757] text-[#2A120B]", dotClass: "bg-[#D97757]", }, codex: { label: "Codex", badgeClass: "border-[#0169CC] bg-[#0169CC] text-white", dotClass: "bg-[#0169CC]", }, opencode: { label: "OpenCode", badgeClass: "border-[#131010] bg-[#131010] text-white dark:border-white/30", dotClass: "bg-[#131010] dark:bg-white", }, }; export function HostBadge({ host, display = "badge", size = "md", className, }: { host: Host | null; display?: "badge" | "provenance"; size?: "md" | "sm"; className?: string; }) { const knownHost = host && host !== "unknown" ? host : null; const meta = knownHost ? HOST_META[knownHost] : null; const label = meta?.label ?? "unknown host"; if (display === "provenance") { return ( Generated via ); } const compact = size === "sm"; const sizeClass = compact ? "h-4 px-1.5 text-[10px]" : "h-5"; const badgeLabel = knownHost ? label : "Host unknown"; return ( {badgeLabel} ); } export function LearningHostProvenance({ attribution, requestId, }: { attribution: RequestHostAttribution; requestId: string; }) { if (attribution.unavailable) { return Unavailable; } return ( ); }