import { useEffect, useState } from 'react'; import { api, isElectronMode } from '@renderer/api'; import { AlertTriangle } from 'lucide-react'; import type { WindowsElevationStatus } from '@shared/types/api'; export const WindowsAdministratorBanner = (): React.JSX.Element | null => { const [status, setStatus] = useState(null); useEffect(() => { if (!isElectronMode()) { return undefined; } const getStatus = api.getWindowsElevationStatus; if (typeof getStatus !== 'function') { return undefined; } let cancelled = false; void getStatus() .then((nextStatus) => { if (!cancelled) { setStatus(nextStatus); } }) .catch(() => { if (!cancelled) { setStatus(null); } }); return () => { cancelled = true; }; }, []); if (!status?.isWindows || status.isAdministrator !== false) { return null; } return (
Windows Administrator mode recommended

OpenCode runtime checks can time out when Agent Teams AI is not elevated. Restart the app with Run as administrator before launching OpenCode teams.

); };