// - the start page's first-time helper: a paperclip with a // speech bubble offering to set up an agent. It renders only while the swarm // has no `ruth` (see `ruthIsMissing`), and a click opens the create-agent // form with her name filled in and `manage_root_agent` checked on top of the // default permissions (`RUTH_EXTRA_PERMISSIONS`); the form already selects // the only hive. No dismiss: once ruth exists it goes away. import { useEffect, useState } from "preact/hooks"; import { Dialog } from "../ui/dialog/Dialog.js"; import { RUTH_EXTRA_PERMISSIONS, ruthIsMissing, } from "../shell/ruth-missing.js"; import { CreateAgentForm } from "./CreateAgentForm.js"; import "./SetupAssistant.css"; export function SetupAssistant() { const [missing, setMissing] = useState(false); const [open, setOpen] = useState(false); useEffect(() => { let cancelled = false; void ruthIsMissing((url) => fetch(url)).then((m) => { if (!cancelled) setMissing(m); }); return () => { cancelled = true; }; }, []); if (!missing) return null; return ( <> setOpen(false)} label="create agent" plain > setOpen(false)} /> ); }