peppa/apps/web/components/AgentBadge.tsx
peppa-bot 10363f8592 PEP-270: задачи агентов — предложения, не больше 5 в сутки на проект
- MCP create_task агента: origin agent + «Предложено» (раньше — задача человека, диспетчер брал её сам)
- AgentLimits.perDay (5, скользящие 24 ч), proposalRoom/proposalsToday; сверх — отказ агенту,
  находки приёмки — в недельную сводку; событие proposal_limited
- CLI agent-limits perDay=N, правило агентам в template/RULES.md, тест proposal-daily-limit

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 17:02:04 +00:00

28 lines
1.6 KiB
TypeScript

"use client";
import { Bot } from "lucide-react";
import { useT } from "@/components/I18n";
import { cn } from "@/lib/utils";
const TONES = ["bg-sky-500/20 text-sky-300", "bg-emerald-500/20 text-emerald-300", "bg-amber-500/20 text-amber-300", "bg-blue-500/20 text-blue-300", "bg-indigo-500/20 text-indigo-300", "bg-violet-500/20 text-violet-300", "bg-teal-500/20 text-teal-300", "bg-orange-500/20 text-orange-300"];
/**
* PEP-75/96: an AI agent — a robot in its own colour and «агент <кличка>», so a product manager
* never takes it for a person. PEP-156: an AI role («Аналитик», «Продакт-агент») is shown by its
* name alone, in the reader's language.
*/
export function AgentBadge({ name, className, large = false, role = false }: { name: string; className?: string; large?: boolean; role?: boolean }) {
const t = useT();
const tone = TONES[[...name].reduce((a, c) => a + c.codePointAt(0)!, 0) % TONES.length];
return (
<span className={cn("inline-flex min-w-0 items-center gap-1.5", large ? "text-base font-medium" : "text-xs", className)} title={t("ИИ-агент {name}", { name: role ? t(name) : name })}>
<span aria-hidden className={cn("grid shrink-0 place-items-center rounded-full font-semibold", large ? "size-8 text-sm" : "size-4.5 text-[10px]", tone)}>
<Bot className={large ? "size-4.5" : "size-3"} />
</span>
<span className="truncate">
{role ? t(name) : <><span className="text-muted-foreground">{large ? t("ИИ-агент") : t("агент")}</span> {name}</>}
</span>
</span>
);
}