/** * InvocationPills - ADR-116: Structured Invocation Tokens * * MentionPill: renders <<@slug>> as a styled pill/chip (blue bg, user icon) * CommandPill: renders <> as a styled command pill (purple bg, bot icon) * * Plain @slug and /slug render as subtle reference highlights (not pills). */ import React from 'react'; import { Bot, User } from 'lucide-react'; import { cn } from '@/shared/utils/cn'; // ── MentionPill ────────────────────────────────────────────────────────────── interface MentionPillProps { /** The slug without delimiters, e.g. "dev-user" */ slug: string; /** Optional click handler */ onClick?: (token: string) => void; className?: string; } /** * Renders a structured invocation mention (<<@slug>>) as a styled pill. * Blue background with user icon. */ export const MentionPill: React.FC = ({ slug, onClick, className }) => { return ( { e.preventDefault(); e.stopPropagation(); onClick?.(`<<@${slug}>>`); }} className={cn( 'inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full', 'bg-blue-500/20 text-blue-400 text-xs font-medium', 'cursor-pointer hover:bg-blue-500/30 transition-colors', 'align-middle leading-tight', className )} title={`Invocation: @${slug}`} > @{slug} ); }; // ── CommandPill ────────────────────────────────────────────────────────────── interface CommandPillProps { /** The slug without delimiters, e.g. "developer" */ slug: string; /** Optional click handler */ onClick?: (token: string) => void; className?: string; } /** * Renders a structured invocation command (<>) as a styled pill. * Purple background with bot icon. */ export const CommandPill: React.FC = ({ slug, onClick, className }) => { return ( { e.preventDefault(); e.stopPropagation(); onClick?.(`<>`); }} className={cn( 'inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full', 'bg-purple-500/20 text-purple-400 text-xs font-medium', 'cursor-pointer hover:bg-purple-500/30 transition-colors', 'align-middle leading-tight', className )} title={`Invocation: /${slug}`} > /{slug} ); }; export default { MentionPill, CommandPill };