import { useEffect, useRef, useState } from "react"; import { api } from "../api/client"; import type { AgentProfile } from "../types"; import type { SceneFloorChrome } from "../sceneFloorChrome"; const DEFAULT_OPT = "__default__"; /** * Settings wheel on the manager staging tile — points the team manager at an * installed profile's backend (model + base_url + API key). The manager only * makes plain LLM calls (audits / judge / titles), never tool calls. */ export function ManagerModelMenu({ chrome, agents }: { chrome: SceneFloorChrome; agents: AgentProfile[] }) { const [open, setOpen] = useState(false); const [profile, setProfile] = useState(""); // "" = default ~/.hermes const [model, setModel] = useState(""); const [loading, setLoading] = useState(false); const [saving, setSaving] = useState(false); const btnRef = useRef(null); useEffect(() => { if (!open) return; let cancelled = false; setLoading(true); api.manager.getProfile() .then((r) => { if (!cancelled) { setProfile(r.profile ?? ""); setModel(r.model ?? ""); } }) .catch(() => {}) .finally(() => { if (!cancelled) setLoading(false); }); return () => { cancelled = true; }; }, [open]); async function choose(value: string) { const next = value === DEFAULT_OPT ? "" : value; setSaving(true); try { const r = await api.manager.setProfile(next); setProfile(r.profile ?? ""); setModel(r.model ?? ""); } catch { /* ignore */ } finally { setSaving(false); setOpen(false); } } const rect = open ? btnRef.current?.getBoundingClientRect() : undefined; // The Claude Agent SDK isn't an LLM endpoint (it resolves models itself — no // base_url to POST the manager's aux calls to), so it can't run the manager. const selectable = agents.filter( (a) => a.available !== false && a.base_url !== "claude-agent-sdk", ); return ( <> {open && rect && ( <>
{ e.stopPropagation(); setOpen(false); }} />
e.stopPropagation()} style={{ position: "fixed", left: Math.min(rect.left, window.innerWidth - 240), top: rect.bottom + 6, zIndex: 601, width: 230, background: "#16213e", border: "1px solid #2a3558", borderRadius: 8, boxShadow: "0 8px 28px rgba(0,0,0,0.5)", padding: 10, }} >
Manager profile
{loading ? (
Loading…
) : ( )}
Runs the manager's audits, judging & titles on this profile's backend {model ? ` · ${model}` : ""}. Applies to all teams.
)} ); }