import { Download, Loader2, RefreshCw } from "lucide-react"; import { useState } from "react"; import type { AgentInfo } from "sandbox-agent"; type AgentModeInfo = { id: string; name: string; description: string }; import FeatureCoverageBadges from "../agents/FeatureCoverageBadges"; import { emptyFeatureCoverage } from "../../types/agents"; const AgentsTab = ({ agents, defaultAgents, modesByAgent, onRefresh, onInstall, loading, error }: { agents: AgentInfo[]; defaultAgents: string[]; modesByAgent: Record; onRefresh: () => void; onInstall: (agentId: string, reinstall: boolean) => Promise; loading: boolean; error: string | null; }) => { const [installingAgent, setInstallingAgent] = useState(null); const handleInstall = async (agentId: string, reinstall: boolean) => { setInstallingAgent(agentId); try { await onInstall(agentId, reinstall); } finally { setInstallingAgent(null); } }; return ( <>
{error &&
{error}
} {loading &&
Loading agents...
} {!loading && agents.length === 0 && (
No agents reported. Click refresh to check.
)} {(agents.length ? agents : defaultAgents.map((id) => ({ id, installed: false, credentialsAvailable: false, version: undefined as string | undefined, path: undefined as string | undefined, capabilities: emptyFeatureCoverage as AgentInfo["capabilities"], }))).map((agent) => { const isInstalling = installingAgent === agent.id; return (
{agent.id}
{agent.installed ? "Installed" : "Missing"} {agent.credentialsAvailable ? "Authenticated" : "No Credentials"}
{agent.version ?? "Version unknown"} {agent.path && {agent.path}}
Feature coverage
{modesByAgent[agent.id] && modesByAgent[agent.id].length > 0 && (
Modes: {modesByAgent[agent.id].map((mode) => mode.id).join(", ")}
)}
); })} ); }; export default AgentsTab;