import { Link } from "@tanstack/react-router" import { ClockIcon, LightningIcon, PauseIcon, PlayIcon, PlusIcon, WarningCircleIcon, } from "@phosphor-icons/react" import type { AgentSchedule } from "@/lib/agents/types" import { buttonVariants } from "@/components/ui/button" import { Skeleton } from "@/components/ui/skeleton" import { describeCron } from "@/lib/agents/cron" import { useAgentSchedules, useUpdateAgentSchedule, } from "@/lib/agents/queries" import { cn } from "@/lib/utils" function formatDate(value?: string | null): string { if (!value) return "Never run" const date = new Date(value) if (Number.isNaN(date.getTime())) return "Never run" return date.toLocaleString(undefined, { month: "short", day: "numeric", hour: "numeric", minute: "2-digit", }) } export function AutomationsList() { const schedulesQuery = useAgentSchedules() const schedules = schedulesQuery.data ?? [] const total = schedules.length const active = schedules.filter((s) => s.enabled).length const paused = total - active const issues = schedules.filter((s) => !!s.lastError).length return (

Automations

Run Open SWE on a recurring schedule. Each run starts a fresh agent thread.

0} />
{total} {total === 1 ? "automation" : "automations"} New Automation
{schedulesQuery.isLoading ? (
) : total === 0 ? ( ) : (
{schedules.map((schedule) => ( ))}
)}
) } function StatCard({ label, value, highlight, }: { label: string value: number highlight?: boolean }) { return (
{label}
{value}
) } function EmptyState() { return (

No automations yet

Schedule Open SWE to run on a recurring cadence — review code, triage issues, or keep docs up to date.

New Automation
) } function AutomationRow({ schedule }: { schedule: AgentSchedule }) { const updateSchedule = useUpdateAgentSchedule() const isToggling = updateSchedule.isPending && updateSchedule.variables.scheduleId === schedule.id const onToggle = (e: React.MouseEvent) => { e.preventDefault() e.stopPropagation() updateSchedule.mutate({ scheduleId: schedule.id, body: { enabled: !schedule.enabled }, }) } return (
{schedule.name} {schedule.lastError && ( Last run failed )}
{describeCron(schedule.schedule)} {schedule.repo && {schedule.repo}} Last run: {formatDate(schedule.lastTriggeredAt)}
) }