/* Runs — the inbox: a flat list of every agent across every project on the left, the * selected agent's checkmark + log + answer/resume flow on the right. Maps the design's * "Runs" pane to Handler's agent / checkmark / log model. */ "use client"; import { useMemo, useState } from "react"; import { useDashboard } from "@/components/store"; import { Badge, Button, Callout, Stat, StatusBadge, Tabs, Textarea } from "@/components/ui"; import { fmtFull, shortSha, statusTone, timeAgo } from "@/lib/format"; import type { Agent } from "@/lib/api"; const FILTERS = [ { value: "all", label: "All" }, { value: "needs", label: "Needs Input" }, { value: "working", label: "Working" }, { value: "done", label: "Done" }, ]; function matches(filter: string, status: string): boolean { if (filter === "all") return true; if (filter === "needs") return status === "paused_for_input"; if (filter === "working") return status === "working" || status === "running"; if (filter === "done") return status === "done" || status === "completed"; return true; } export function RunsSection() { const s = useDashboard(); const [filter, setFilter] = useState("all"); const runs = useMemo(() => { const list = s.agents.filter((a) => matches(filter, a.status)); return [...list].sort((a, b) => (a.created_at < b.created_at ? 1 : -1)); }, [s.agents, filter]); const selected = s.selectedRun; const needs = s.agents.filter((a) => a.status === "paused_for_input").length; const working = s.agents.filter((a) => a.status === "working" || a.status === "running").length; return (
| When | Status | Summary | Q / A | Push | CI |
|---|---|---|---|---|---|
| {fmtFull(e.created_at)} |
|
{e.summary || "—"} |
{e.question && (
Q: {e.question}
)}
{e.answer && (
A: {e.answer}
)}
{!e.question && !e.answer && "—"}
|
{shortSha(e.push_sha)} |
|