// Runners console (PEP-38): list rows with status and limit info, and the details panel of the chosen runner.
import Link from "next/link";
import { SquareTerminal, X } from "lucide-react";
import type { SessionView } from "@peppa/core";
import { MAX_LIMIT_RESUMES_PER_DAY } from "@peppa/runner";
import { PanelSection } from "@/components/ActivityAside";
import { AttachCommand, QuestionCard, SessionActions } from "@/components/cards";
import { ago, Key, StatusBadge } from "@/components/common";
import { LocalTime, ScrollIntoViewOnNarrow } from "@/components/LocalTime";
import type { InboxItem } from "@/lib/queries";
import { SESSION_STATUS, TONE_BG, TONE_TEXT } from "@/lib/status";
import { cn } from "@/lib/utils";
/** «остановлена · продолжит в 03:10» for a runner that hit the usage limit (PEP-56). */
export function LimitNote({ s }: { s: SessionView }) {
if (s.status !== "rate_limited") return null;
if (!s.resumeAt) return <>остановлена · лимит>;
if (s.resumeAt.getTime() <= Date.now()) return <>остановлена · продолжит сейчас>;
return (
<>
остановлена · продолжит в
>
);
}
/** `selected`: "wide" — picked by default, highlighted only where the side panel is visible. */
export function RunnerRow({ s, href, selected, needsPm }: { s: SessionView; href: string; selected: boolean | "wide"; needsPm: boolean }) {
const limited = s.status === "rate_limited";
const st = SESSION_STATUS[s.status] ?? { label: s.status, tone: "muted" as const };
return (