"use client"; import { useEffect, useState } from "react"; import Link from "next/link"; import { ArrowRight, Play, RefreshCw } from "lucide-react"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@/components/ui/card"; import { Badge } from "@/components/ui/badge"; import { api, type Run } from "@/lib/api"; import { formatDate } from "@/lib/utils"; function statusVariant(s?: string) { switch ((s || "").toLowerCase()) { case "success": case "completed": return "success" as const; case "running": case "pending": return "secondary" as const; case "failed": case "error": return "destructive" as const; case "waiting": case "paused": return "warning" as const; default: return "outline" as const; } } export default function RunsListPage() { const [runs, setRuns] = useState(null); const [error, setError] = useState(null); async function load() { try { const list = await api.listRuns({ limit: 50 }); setRuns(list); setError(null); } catch (e) { setError(e instanceof Error ? e.message : "load failed"); } } useEffect(() => { load(); const t = setInterval(load, 2000); // Push notifications: reload immediately when any run is created. const es = new EventSource(api.runsStreamURL()); es.onmessage = () => load(); es.onerror = () => { /* polling fallback covers it */ }; return () => { clearInterval(t); es.close(); }; }, []); return (

Runs

Recent pipeline executions across all agents.

{error && ( {error} )} {runs === null ? (

Loading…

) : runs.length === 0 ? (
No runs yet

Trigger a run from an agent or pipeline.

) : (
{runs.map((r) => (
{r.pipelineName || r.pipelineId} {r.status}
{r.id}
{formatDate(r.startedAt)}
))}
)}
); } // Imports below are referenced via JSX above; ensure CardTitle isn't unused. void CardTitle;