CenaForge: primeira versão pública
Gerador de vídeos narrativos (Godot + FFmpeg), painel Next.js, serviço de voz, Clipador de lives e Publicador para YouTube, TikTok e Instagram. Inclui a leitura das visualizações dos posts para o Dashboard e o botão "Publicar no <rede>" nos cartões das publicações. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,402 @@
|
||||
"use client";
|
||||
// Console do agente: escolhe a tarefa (que define o agente padrão), o agente, o modelo e o
|
||||
// contexto; envia o pedido e mostra ao vivo o que o agente faz (texto, ferramentas, resultado, custo).
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useEffect, useRef, useState, type ComponentType } from "react";
|
||||
import type { AgentEvent, AgentKind, AgentRun, Provider, StoryKind } from "@/lib/types";
|
||||
import { BookIcon, CubeIcon, ChatIcon, ClapperIcon, PenIcon, SendIcon, SparkIcon, StopIcon, TerminalIcon } from "./icons";
|
||||
import { unitTerms } from "./story-formats";
|
||||
import { Badge, Button, EmptyState, Feedback, Field, Kbd, Select, StatusBadge, Textarea, cx } from "./ui";
|
||||
|
||||
type ProviderInfo = { id: Provider; available: boolean; version: string | null; note: string };
|
||||
type StoryOption = { id: string; title: string; kind: StoryKind; episodes: { id: number; number: number; title: string }[] };
|
||||
/** Padrões calculados no servidor (defaultProviderFor / defaultModelFor). */
|
||||
export type AgentDefaults = {
|
||||
provider: Record<AgentKind, Provider>;
|
||||
preferred: Record<AgentKind, Provider>;
|
||||
model: Record<AgentKind, Record<Provider, string>>;
|
||||
};
|
||||
|
||||
const KINDS: { id: AgentKind; label: string; description: string; icon: ComponentType<{ size?: number }> }[] = [
|
||||
{ id: "story", label: "Nova história", description: "Bíblia, ep01 e título a partir de um texto", icon: BookIcon },
|
||||
{ id: "script", label: "Roteiro", description: "Escreve o episódio escolhido", icon: PenIcon },
|
||||
{ id: "scene", label: "Cena", description: "Monta o JSON da cena a partir do roteiro", icon: ClapperIcon },
|
||||
{ id: "godot", label: "Cena no Godot", description: "Constrói uma cena 3D nova e guarda na biblioteca", icon: CubeIcon },
|
||||
{ id: "free", label: "Pedido livre", description: "Ajustes no projeto, testes, iluminação", icon: ChatIcon },
|
||||
];
|
||||
|
||||
export const PROVIDER_LABEL: Record<Provider, string> = { claude: "Claude Code", codex: "GPT · Codex" };
|
||||
const PROVIDER_SHORT: Record<Provider, string> = { claude: "Claude", codex: "GPT" };
|
||||
|
||||
const PLACEHOLDER: Record<AgentKind, string> = {
|
||||
story: "Ex.: Um entregador recebe um pacote sem remetente; toda vez que tenta entregar, o endereço muda. Suspense leve com humor.",
|
||||
script: "Ex.: Escreva o episódio com tom de suspense leve; o entregador desconfia do pacote.",
|
||||
scene: "Ex.: Monte a cena a partir do roteiro; fim de tarde, moto azul.",
|
||||
free: "Ex.: Melhore a iluminação do cenário e rode os testes.",
|
||||
branches: "Ex.: Prepare as vertentes do episódio com consequências bem diferentes entre si.",
|
||||
godot: "Ex.: Faça um campo de futebol de estádio, gramado listrado, traves e torcida; câmera de transmissão e atrás do gol. Depois, o Pelé batendo o pênalti do milésimo gol, de 1969, no Maracanã.",
|
||||
};
|
||||
|
||||
const SUGGESTIONS: { kind: AgentKind; text: string }[] = [
|
||||
{ kind: "script", text: "Escreva o episódio com tom de suspense leve; o entregador desconfia do pacote." },
|
||||
{ kind: "scene", text: "Monte a cena a partir do roteiro; fim de tarde, moto azul." },
|
||||
{ kind: "free", text: "Melhore a iluminação do cenário e rode os testes." },
|
||||
];
|
||||
|
||||
export function AgentConsole(props: {
|
||||
providers: ProviderInfo[];
|
||||
models: Record<Provider, { id: string; label: string }[]>;
|
||||
defaults: AgentDefaults;
|
||||
stories: StoryOption[];
|
||||
initial: { storyId?: string; episodeId?: number; kind?: AgentKind; runId?: number; request?: string };
|
||||
viewing: AgentRun | null;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const initialKind = props.initial.kind ?? "free";
|
||||
const initialProvider = props.viewing?.provider ?? props.defaults.provider[initialKind];
|
||||
const [kind, setKind] = useState<AgentKind>(initialKind);
|
||||
const [provider, setProvider] = useState<Provider>(initialProvider);
|
||||
const [model, setModel] = useState<string>(props.viewing?.model ?? props.defaults.model[initialKind][initialProvider]);
|
||||
const [storyId, setStoryId] = useState(props.initial.storyId ?? "");
|
||||
const [episodeId, setEpisodeId] = useState<number | "">(props.initial.episodeId ?? "");
|
||||
const [request, setRequest] = useState(props.initial.request ?? "");
|
||||
const [sentPrompt, setSentPrompt] = useState<string | null>(null);
|
||||
const [runId, setRunId] = useState<number | null>(props.initial.runId ?? null);
|
||||
const [events, setEvents] = useState<AgentEvent[]>([]);
|
||||
const [status, setStatus] = useState<string | null>(props.viewing?.status ?? null);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const log = useRef<HTMLDivElement>(null);
|
||||
/** Mensagem enviada durante a execução, aguardando o agente fechar ("Enviar ao terminar"). */
|
||||
const [queued, setQueued] = useState<string | null>(null);
|
||||
/** Texto da mensagem durante a execução: vira o "pedido" exibido na continuação. */
|
||||
const pendingMessage = useRef<string | null>(null);
|
||||
|
||||
const story = props.stories.find((s) => s.id === storyId);
|
||||
const terms = unitTerms(story?.kind);
|
||||
|
||||
useEffect(() => {
|
||||
if (!runId) return;
|
||||
setEvents([]);
|
||||
const source = new EventSource(`/api/agent/runs/${runId}/events`);
|
||||
source.addEventListener("event", (m) => setEvents((prev) => [...prev, JSON.parse((m as MessageEvent).data)]));
|
||||
source.addEventListener("end", (m) => {
|
||||
const run = JSON.parse((m as MessageEvent).data) as (AgentRun & { followUpRunId?: number | null }) | null;
|
||||
source.close();
|
||||
// Mensagem enviada durante a execução: o servidor já retomou a sessão; seguimos para a continuação.
|
||||
if (run?.followUpRunId) {
|
||||
setRunId(run.followUpRunId);
|
||||
setStatus("running");
|
||||
setSentPrompt(pendingMessage.current);
|
||||
pendingMessage.current = null;
|
||||
setQueued(null);
|
||||
router.replace(`/agent?run=${run.followUpRunId}`, { scroll: false });
|
||||
return;
|
||||
}
|
||||
setStatus(run?.status ?? "success");
|
||||
setQueued(null);
|
||||
router.refresh();
|
||||
});
|
||||
source.onerror = () => source.close();
|
||||
return () => source.close();
|
||||
}, [runId, router]);
|
||||
|
||||
// Rola só a área da conversa (não a página). Sempre com chaves: nenhum useEffect devolve valor
|
||||
// implícito (no Chromium novo, scrollIntoView devolve uma Promise e quebraria a limpeza do React).
|
||||
useEffect(() => {
|
||||
const el = log.current;
|
||||
if (el) el.scrollTop = el.scrollHeight;
|
||||
}, [events]);
|
||||
|
||||
/** Trocar de tarefa troca também o agente e o modelo padrão dela. */
|
||||
function chooseKind(next: AgentKind) {
|
||||
const nextProvider = props.defaults.provider[next];
|
||||
setKind(next);
|
||||
setProvider(nextProvider);
|
||||
setModel(props.defaults.model[next][nextProvider]);
|
||||
}
|
||||
|
||||
function chooseProvider(next: Provider) {
|
||||
setProvider(next);
|
||||
setModel(props.defaults.model[kind][next]);
|
||||
}
|
||||
|
||||
async function send(resume: boolean) {
|
||||
setError(null);
|
||||
const sent = request;
|
||||
const r = await fetch("/api/agent/runs", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
provider, model, kind, request,
|
||||
storyId: storyId || null, episodeId: episodeId || null,
|
||||
resumeRunId: resume ? runId : null,
|
||||
}),
|
||||
});
|
||||
const body = await r.json();
|
||||
if (!r.ok) return setError(body.error);
|
||||
setStatus("running");
|
||||
setRunId(body.id);
|
||||
setSentPrompt(sent);
|
||||
setRequest("");
|
||||
router.replace(`/agent?run=${body.id}`, { scroll: false });
|
||||
}
|
||||
|
||||
/** Mensagem com o agente rodando: "now" interrompe e corrige; "queue" envia quando ele terminar. */
|
||||
async function sendDuringRun(mode: "now" | "queue") {
|
||||
if (!runId) return;
|
||||
setError(null);
|
||||
const text = request.trim();
|
||||
const r = await fetch(`/api/agent/runs/${runId}/messages`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ text, mode }),
|
||||
});
|
||||
const body = await r.json();
|
||||
if (!r.ok) return setError(body.error);
|
||||
pendingMessage.current = text;
|
||||
setQueued(mode === "queue" ? text : null);
|
||||
setRequest("");
|
||||
}
|
||||
|
||||
async function cancel() {
|
||||
if (runId) await fetch(`/api/agent/runs/${runId}/cancel`, { method: "POST" });
|
||||
}
|
||||
|
||||
const running = status === "running";
|
||||
// Claude (--resume) e Codex (exec resume) retomam a sessão; só vale para o mesmo agente.
|
||||
const canResume = !!runId && !running && provider === props.viewing?.provider && !!props.viewing?.session_id;
|
||||
const prompt = props.viewing && props.viewing.id === runId ? props.viewing.prompt : sentPrompt;
|
||||
const modelOptions = props.models[provider];
|
||||
const preferred = props.defaults.preferred[kind];
|
||||
|
||||
return (
|
||||
<div className="grid min-w-0 gap-6">
|
||||
{/* 1. Tarefa: define o agente padrão */}
|
||||
<fieldset className="grid gap-3">
|
||||
<legend className="mb-3 text-eyebrow font-semibold uppercase text-fg-subtle">1 · Tarefa</legend>
|
||||
<div className="grid gap-3 sm:grid-cols-2 2xl:grid-cols-4">
|
||||
{KINDS.map(({ id, label, description, icon: Icon }) => {
|
||||
const selected = kind === id;
|
||||
return (
|
||||
<label key={id}
|
||||
className={cx(
|
||||
"group relative grid cursor-pointer gap-3 rounded-card border p-4 transition-[border-color,background-color]",
|
||||
"has-focus-visible:outline-2 has-focus-visible:outline-offset-2 has-focus-visible:outline-accent",
|
||||
selected ? "border-accent/60 bg-accent-soft/60" : "border-line bg-surface hover:border-line-strong hover:bg-raised/50",
|
||||
)}>
|
||||
<input type="radio" name="agent-kind" value={id} checked={selected} onChange={() => chooseKind(id)} className="sr-only" />
|
||||
<span className="flex items-center justify-between gap-2">
|
||||
<span className={cx("grid size-9 place-items-center rounded-lg border", selected ? "border-accent/40 bg-accent text-accent-fg" : "border-line-strong bg-raised text-fg-muted")}>
|
||||
<Icon size={18} />
|
||||
</span>
|
||||
<span className={cx("rounded-full border px-2 py-0.5 text-[0.6875rem] font-semibold",
|
||||
props.defaults.preferred[id] === "codex" ? "border-info/25 bg-info-soft text-info" : "border-violet/25 bg-violet-soft text-violet")}>
|
||||
{PROVIDER_SHORT[props.defaults.preferred[id]]}
|
||||
</span>
|
||||
</span>
|
||||
<span className="grid gap-0.5">
|
||||
<span className="text-sm font-semibold text-fg">{label}</span>
|
||||
<span className="text-xs leading-relaxed text-fg-subtle">{description}</span>
|
||||
</span>
|
||||
</label>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
{/* 2. Agente */}
|
||||
<fieldset className="grid gap-3">
|
||||
<legend className="mb-3 text-eyebrow font-semibold uppercase text-fg-subtle">2 · Agente</legend>
|
||||
<div className="grid gap-3 md:grid-cols-2">
|
||||
{props.providers.map((p) => (
|
||||
<ProviderCard key={p.id} info={p} selected={provider === p.id} recommended={preferred === p.id}
|
||||
onSelect={() => chooseProvider(p.id)} />
|
||||
))}
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
{/* 3. Conversa */}
|
||||
<section aria-label="Conversa com o agente" className="overflow-hidden rounded-panel border border-line bg-sunken shadow-card">
|
||||
<div className="flex items-center gap-3 border-b border-line bg-surface px-5 py-3">
|
||||
<TerminalIcon size={16} />
|
||||
<span className="text-[0.8125rem] font-medium text-fg">{runId ? `Execução #${runId}` : "Nova conversa"}</span>
|
||||
{status && <StatusBadge status={status} />}
|
||||
<span className="ml-auto text-xs text-fg-subtle">{PROVIDER_LABEL[provider]}</span>
|
||||
{running && <Button variant="danger" size="sm" onClick={cancel}><StopIcon size={14} />Cancelar</Button>}
|
||||
</div>
|
||||
|
||||
<div ref={log} className="grid max-h-[60vh] min-h-80 content-start gap-4 overflow-y-auto px-5 py-6" aria-live="polite">
|
||||
{!runId && (
|
||||
<EmptyState className="border-none bg-transparent" icon={<SparkIcon />} title="O que vamos produzir agora?">
|
||||
Escolha a tarefa, descreva o pedido e envie com <Kbd>Ctrl</Kbd> + <Kbd>Enter</Kbd>. Ou comece por um exemplo:
|
||||
<span className="mt-4 grid gap-2 text-left">
|
||||
{SUGGESTIONS.map((s) => (
|
||||
<button key={s.text} type="button" onClick={() => { chooseKind(s.kind); setRequest(s.text); }}
|
||||
className="flex items-center gap-3 rounded-control border border-line-strong bg-surface px-3.5 py-2.5 text-sm text-fg transition-colors hover:border-accent/40 hover:bg-raised">
|
||||
<span className="shrink-0 text-eyebrow font-semibold uppercase text-accent">{KINDS.find((k) => k.id === s.kind)?.label ?? (s.kind === "branches" ? "Vertentes" : s.kind)}</span>
|
||||
<span className="min-w-0 text-fg-muted">{s.text}</span>
|
||||
</button>
|
||||
))}
|
||||
</span>
|
||||
</EmptyState>
|
||||
)}
|
||||
{runId && prompt && (
|
||||
<div className="ml-auto max-w-[85%] rounded-2xl rounded-br-md border border-accent/20 bg-accent-soft px-4 py-3 text-sm leading-relaxed whitespace-pre-wrap text-fg">{prompt}</div>
|
||||
)}
|
||||
{events.map((e, i) => <EventLine key={i} event={e} />)}
|
||||
{running && events.length === 0 && (
|
||||
<p className="flex items-center gap-2 text-sm text-fg-subtle"><span className="size-2 animate-pulse rounded-full bg-info" />Aguardando o agente…</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* 4. Pedido */}
|
||||
<div className="grid gap-4 border-t border-line bg-surface p-5">
|
||||
<div className="grid gap-3 md:grid-cols-3">
|
||||
<Field label="História">
|
||||
<Select value={storyId} onChange={(e) => { setStoryId(e.target.value); setEpisodeId(""); }}>
|
||||
<option value="">Nenhuma</option>
|
||||
{props.stories.map((s) => <option key={s.id} value={s.id}>{s.title}</option>)}
|
||||
</Select>
|
||||
</Field>
|
||||
<Field label={terms.One}>
|
||||
<Select value={episodeId} disabled={!story} onChange={(e) => setEpisodeId(e.target.value ? Number(e.target.value) : "")}>
|
||||
<option value="">—</option>
|
||||
{story?.episodes.map((ep) => {
|
||||
const code = terms.code(ep.number);
|
||||
return <option key={ep.id} value={ep.id}>{code.charAt(0).toUpperCase() + code.slice(1)}{ep.title ? ` — ${ep.title}` : ""}</option>;
|
||||
})}
|
||||
</Select>
|
||||
</Field>
|
||||
<Field label="Modelo">
|
||||
<Select value={model} disabled={modelOptions.length < 2} onChange={(e) => setModel(e.target.value)}>
|
||||
{modelOptions.map((m) => <option key={m.id} value={m.id}>{m.label}</option>)}
|
||||
</Select>
|
||||
</Field>
|
||||
</div>
|
||||
<Textarea aria-label="Pedido ao agente" className="min-h-28 bg-sunken/80" value={request} onChange={(e) => setRequest(e.target.value)}
|
||||
placeholder={running ? "Não gostou do rumo? Escreva a correção: \"Corrigir agora\" interrompe e o agente continua com ela." : PLACEHOLDER[kind]}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key !== "Enter" || !(e.ctrlKey || e.metaKey) || !request.trim()) return;
|
||||
void (running ? sendDuringRun("now") : send(false));
|
||||
}} />
|
||||
{queued && (
|
||||
<p className="rounded-control border border-info/25 bg-info-soft px-3.5 py-2.5 text-xs leading-relaxed text-info">
|
||||
Na fila, vai quando o agente terminar: <span className="text-fg">{queued.length > 160 ? `${queued.slice(0, 160)}…` : queued}</span>
|
||||
</p>
|
||||
)}
|
||||
<div className="flex flex-wrap items-center gap-3">
|
||||
{running ? <>
|
||||
<Button disabled={!request.trim()} onClick={() => sendDuringRun("now")}
|
||||
title="Interrompe o agente e continua a mesma conversa com a sua correção">
|
||||
<SendIcon size={16} />Corrigir agora
|
||||
</Button>
|
||||
<Button variant="secondary" disabled={!request.trim()} onClick={() => sendDuringRun("queue")}
|
||||
title="Deixa o agente terminar e então envia a mensagem na mesma conversa">
|
||||
Enviar ao terminar
|
||||
</Button>
|
||||
</> : <>
|
||||
<Button disabled={!request.trim()} onClick={() => send(false)}><SendIcon size={16} />Enviar</Button>
|
||||
{canResume && <Button variant="secondary" disabled={!request.trim()} onClick={() => send(true)}>Continuar esta conversa</Button>}
|
||||
</>}
|
||||
<span className="text-xs text-fg-subtle"><Kbd>Ctrl</Kbd> + <Kbd>Enter</Kbd></span>
|
||||
<span className="ml-auto max-w-md text-right text-xs leading-relaxed text-fg-subtle max-md:ml-0 max-md:text-left">
|
||||
Edita só dentro do projeto e roda só os comandos liberados (render, testes, scripts da skill).
|
||||
</span>
|
||||
</div>
|
||||
{error && <Feedback ok={false}>{error}</Feedback>}
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function ProviderCard({ info, selected, recommended, onSelect }:
|
||||
{ info: ProviderInfo; selected: boolean; recommended: boolean; onSelect: () => void }) {
|
||||
const disabled = !info.available;
|
||||
const hintId = `provider-${info.id}-hint`;
|
||||
return (
|
||||
<label className={cx(
|
||||
"relative flex items-start gap-3.5 rounded-card border p-4 transition-[border-color,background-color]",
|
||||
"has-focus-visible:outline-2 has-focus-visible:outline-offset-2 has-focus-visible:outline-accent",
|
||||
disabled ? "cursor-not-allowed border-line bg-surface opacity-60"
|
||||
: selected ? "cursor-pointer border-accent/60 bg-accent-soft/60" : "cursor-pointer border-line bg-surface hover:border-line-strong",
|
||||
)}>
|
||||
<input type="radio" name="provider" value={info.id} checked={selected} disabled={disabled} onChange={onSelect}
|
||||
aria-describedby={hintId} className="sr-only" />
|
||||
<span aria-hidden="true"
|
||||
className={cx("mt-0.5 grid size-5 shrink-0 place-items-center rounded-full border-2", selected && !disabled ? "border-accent" : "border-line-strong")}>
|
||||
{selected && !disabled && <span className="size-2 rounded-full bg-accent" />}
|
||||
</span>
|
||||
<span className="grid min-w-0 gap-1">
|
||||
<span className="flex flex-wrap items-center gap-2">
|
||||
<span className="text-sm font-semibold text-fg">{PROVIDER_LABEL[info.id]}</span>
|
||||
{recommended && <Badge tone="accent" dot={false}>padrão desta tarefa</Badge>}
|
||||
{!info.available && <Badge tone="warning" dot={false}>não instalado</Badge>}
|
||||
</span>
|
||||
<span id={hintId} className="grid gap-1 text-xs leading-relaxed text-fg-subtle">
|
||||
{info.version && <span className="font-mono text-[0.6875rem] text-fg-muted">{info.version}</span>}
|
||||
{info.note && <span>{info.note}</span>}
|
||||
</span>
|
||||
</span>
|
||||
</label>
|
||||
);
|
||||
}
|
||||
|
||||
function EventLine({ event }: { event: AgentEvent }) {
|
||||
switch (event.kind) {
|
||||
case "text":
|
||||
return (
|
||||
<div className="flex max-w-[92%] gap-3">
|
||||
<span className="mt-0.5 grid size-7 shrink-0 place-items-center rounded-full border border-line-strong bg-raised text-accent"><SparkIcon size={14} /></span>
|
||||
<div className="min-w-0 rounded-2xl rounded-tl-md border border-line bg-surface px-4 py-3 text-sm leading-relaxed whitespace-pre-wrap text-fg">{event.text}</div>
|
||||
</div>
|
||||
);
|
||||
case "tool":
|
||||
return <div className="ml-10 flex gap-2 font-mono text-xs text-info"><span aria-hidden="true">▸</span><span className="min-w-0 break-words">{event.text}</span></div>;
|
||||
case "tool_result":
|
||||
return (
|
||||
<details className={cx("ml-10 font-mono text-xs", event.isError ? "text-danger" : "text-fg-subtle")}>
|
||||
<summary className="cursor-pointer hover:text-fg">resultado{event.isError ? " (erro)" : ""}</summary>
|
||||
<pre className="mt-1.5 max-h-60 overflow-auto rounded-control border border-line bg-surface p-3 whitespace-pre-wrap">{event.text}</pre>
|
||||
</details>
|
||||
);
|
||||
case "result":
|
||||
return (
|
||||
<div className={cx("rounded-control border px-4 py-3 text-sm",
|
||||
event.isError ? "border-danger/30 bg-danger-soft text-danger" : "border-success/25 bg-success-soft text-success")}>
|
||||
{event.text}
|
||||
</div>
|
||||
);
|
||||
case "error":
|
||||
case "stderr":
|
||||
return <div className="ml-10 font-mono text-xs break-words text-danger">{event.text}</div>;
|
||||
default:
|
||||
return <div className="ml-10 font-mono text-xs break-words text-fg-subtle">{event.text}</div>;
|
||||
}
|
||||
}
|
||||
|
||||
export function RunHistory({ runs, activeId }: { runs: AgentRun[]; activeId?: number }) {
|
||||
if (runs.length === 0) {
|
||||
return <EmptyState compact icon={<TerminalIcon />} title="Nenhuma execução ainda">Os pedidos enviados aparecem aqui, com custo e estado.</EmptyState>;
|
||||
}
|
||||
return (
|
||||
<ul className="grid gap-1 text-sm">
|
||||
{runs.map((r) => (
|
||||
<li key={r.id}>
|
||||
<Link href={`/agent?run=${r.id}`} aria-current={r.id === activeId ? "page" : undefined}
|
||||
className={cx("grid gap-1.5 rounded-control border px-3 py-2.5 transition-colors",
|
||||
r.id === activeId ? "border-line-strong bg-raised" : "border-transparent hover:bg-raised/60")}>
|
||||
<span className="flex items-center gap-2">
|
||||
<StatusBadge status={r.status} />
|
||||
<span className="truncate text-xs text-fg-subtle">
|
||||
#{r.id} · {PROVIDER_SHORT[r.provider]}{r.model ? ` ${r.model}` : ""}{r.cost_usd != null ? ` · US$ ${r.cost_usd.toFixed(3)}` : ""}
|
||||
</span>
|
||||
</span>
|
||||
<span className="line-clamp-2 text-[0.8125rem] leading-snug text-fg-muted">{r.prompt.slice(0, 120)}</span>
|
||||
</Link>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user