import { useCallback, useEffect, useState } from 'react'; import { api } from '../api'; import { fmtId } from '../util'; import type { RunningTask, Cost } from '../types'; interface Run { count: number; running: RunningTask[] } export function Running({ refreshTick = 0 }: { refreshTick?: number }) { const [run, setRun] = useState(null); const [cost, setCost] = useState(null); const [err, setErr] = useState(''); const load = useCallback(() => { api('/api/running').then((d) => { setRun(d); setErr(''); }).catch((e) => setErr((e as Error).message)); api('/api/cost').then(setCost).catch(() => setCost(null)); }, []); useEffect(() => { load(); }, [load, refreshTick]); const stop = (t: RunningTask) => api(`/api/tasks/${encodeURIComponent(t.instance_id)}/${encodeURIComponent(t.task_id)}/cancel`, { method: 'POST' }) .then(load).catch((e) => alert((e as Error).message)); if (err) return

Could not load running: {err}

; if (!run) return

Loading…

; return ( <>

Fleet overview. Every task running across all stacks — a read-only board. To attach to one and observe or drive it, open it in Sessions (the attached workspace).

{cost && (

Spend across stacks: ${cost.total.usd.toFixed(2)} · {(cost.total.input_tokens + cost.total.output_tokens).toLocaleString()} tokens

)} {!run.running.length ?

Nothing running yet — use “Start a session” (top right or Home) to put an agent to work.

: ( {run.running.map((t) => ( ))}
Running across all stacks — {run.count} task(s)
InstanceRuntimeTransportTaskStateTenantControl
{fmtId(t.instance_id)} {t.runtime_posture ? {t.runtime_posture.label} : unknown} {t.transport ? {t.transport.label} : unknown} {fmtId(t.task_id)} {t.tenant}
)} ); }