peppa/apps/web/components/PlatformDelays.tsx
Асель b5c0e704a5 PEP-150: сбои не идут пользователю — задержка на стороне платформы, одно сообщение суперадмину
platformDelay/sessionDelay вместо attention владельцу: падения и зависания агентов, лимиты,
красные и зависшие проверки, запуск агента, обновление версии, приёмка; guard конвейера —
вопрос суперадмину в платформенном проекте; строка задержки в задаче и на карточке;
список задержек на Главной суперадмина.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-16 14:09:30 +05:00

33 lines
1.7 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import Link from "next/link";
import { DELAY_REASON_NAMES, type DelayView } from "@peppa/core";
import { Badge } from "@/components/ui/badge";
import { Key } from "@/components/common";
import { getT } from "@/lib/i18n";
/**
* PEP-150: what is held up on the platform's side right now — the superadmin's list on the
* home page. Owners see one line on the story instead; a row leaves when its cause is gone.
*/
export async function PlatformDelays({ delays }: { delays: DelayView[] }) {
const t = await getT();
const hhmm = (ms: number) => new Date(ms).toLocaleString("ru-RU", { day: "2-digit", month: "2-digit", hour: "2-digit", minute: "2-digit" });
return (
<ul className="m-0 flex list-none flex-col gap-2 p-0">
{delays.map((d) => (
<li key={`${d.key}:${d.reason}`} className="rounded-lg border bg-card px-3 py-2 text-sm">
<div className="flex flex-wrap items-center gap-x-2 gap-y-1">
<Link href={d.url} className="hover:underline">
<Key>{d.key}</Key>
</Link>
<span className="font-medium">{t.text(DELAY_REASON_NAMES[d.reason])}</span>
{d.exhausted ? <Badge variant="danger">{t("нужна ваша помощь")}</Badge> : <Badge variant="muted">{t("Peppa FACTORY пробует сама")}</Badge>}
<span className="text-xs text-muted-foreground">{t("с {time} · попыток: {n}", { time: hhmm(d.since), n: d.attempts })}</span>
</div>
{d.title && <div className="text-muted-foreground">{d.title}</div>}
<p className="m-0 mt-1 line-clamp-3 whitespace-pre-wrap break-words text-xs text-muted-foreground">{t.text(d.details)}</p>
</li>
))}
</ul>
);
}