// Detail panel — agent profile + crons // Relative-time formatter for "última execução …" const timeAgo = (iso) => { if (!iso) return null; const d = new Date(iso); if (isNaN(d.getTime())) return null; const s = Math.floor((Date.now() - d.getTime()) / 1000); if (s < 0) return d.toLocaleString('pt-BR'); if (s < 45) return 'agora mesmo'; if (s < 3600) return `há ${Math.floor(s / 60)} min`; if (s < 86400) return `há ${Math.floor(s / 3600)} h`; if (s < 604800) return `há ${Math.floor(s / 86400)} d`; return d.toLocaleDateString('pt-BR'); }; // Returns "green" | "yellow" | "red" | "gray" given an agent. const computeStatusColor = (agent) => { if (!agent || !agent.last_run_at) return "gray"; const lastMs = Date.parse(agent.last_run_at); if (isNaN(lastMs)) return "gray"; const ageMs = Date.now() - lastMs; const hours = ageMs / (1000 * 60 * 60); // Atraso vs cron: se cron_next_at já passou faz mais de 30min, está atrasado if (agent.cron_next_at) { const nextMs = Date.parse(agent.cron_next_at); if (!isNaN(nextMs) && Date.now() - nextMs > 30 * 60 * 1000) return "red"; } if (hours < 1) return "green"; if (hours < 24) return "yellow"; return "red"; }; const formatNextRun = (iso) => { if (!iso) return null; const ms = Date.parse(iso); if (isNaN(ms)) return null; const d = new Date(ms); const today = new Date(); const sameDay = d.toDateString() === today.toDateString(); const tomorrow = new Date(today); tomorrow.setDate(today.getDate() + 1); const isTomorrow = d.toDateString() === tomorrow.toDateString(); const hh = String(d.getHours()).padStart(2, "0"); const mm = String(d.getMinutes()).padStart(2, "0"); if (sameDay) return `hoje ${hh}:${mm}`; if (isTomorrow) return `amanhã ${hh}:${mm}`; return d.toLocaleDateString("pt-BR") + ` ${hh}:${mm}`; }; // ── Toast ───────────────────────────────────────────────────────────────────── const Toast = ({ msg, onDone }) => { React.useEffect(() => { const t = setTimeout(onDone, 2800); return () => clearTimeout(t); }, [onDone]); return
{agent.id}
Edição de metadados via UI em breve. Por enquanto edite via registry.yaml no container.
{agent.description}
Como ela escreve: {agent.personality}
"{agent.quote}" > ) : (
Sem descrição configurada. Adicione os campos description, personality e quote via edição.