import { type ClassValue, clsx } from "clsx"; import { twMerge } from "tailwind-merge"; import type { Snippet } from "svelte"; export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)); } export type WithElementRef = T & { ref?: El | null; }; export type WithoutChildren = T extends { children?: Snippet } ? Omit : T; export type WithoutChild = T extends { child?: unknown } ? Omit : T; const AGENT_COLORS = [ '#8b5cf6', '#ec4899', '#f97316', '#14b8a6', '#6366f1', '#84cc16', '#06b6d4', '#f43f5e', ]; export function agentColor(id: string): string { if (id === 'user') return '#2563eb'; let h = 0; for (let i = 0; i < id.length; i++) h = ((h << 5) - h + id.charCodeAt(i)) | 0; return AGENT_COLORS[Math.abs(h) % AGENT_COLORS.length]; } export function formatTime(date: Date): string { if (!(date instanceof Date) || isNaN(date.getTime())) return ''; return date.toLocaleTimeString([], { hour: 'numeric', minute: '2-digit' }); } export const TOOL_LABELS: Record = { send: 'Route message', search_memory: 'Search memory', save_to_memory: 'Save to memory', schedule: 'Schedule', list_schedules: 'List schedules', delete_schedule: 'Delete schedule', list_agents: 'List agents', stop_agent: 'Stop agent', start_agent: 'Start agent', remove_agent: 'Remove agent', spawn_agent: 'Spawn agent', };