// Whether the swarm has no agent named `ruth`, from `GET /api/agents/status`. // The start page's setup assistant shows only then. It is a nudge, so // anything short of a clear "ruth is not in the roster" answers `false`: a // failed request or an unreadable list must not tell the operator to set // up an agent that may already exist. type Fetch = (url: string) => Promise<{ ok: boolean; json: () => Promise; }>; export async function ruthIsMissing(fetchImpl: Fetch): Promise { try { const r = await fetchImpl("/api/agents/status"); if (!r.ok) return false; const rows = await r.json(); if (!Array.isArray(rows)) return false; return !rows.some((row) => (row as { name?: unknown }).name === "ruth"); } catch { return false; } }