Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
feat(ui): app-wide macOS permission alert banner with Settings deep links
Ruben Lütkefb847e5415d6
diff --git a/jarvis/ui/web/frontend/src/App.tsx b/jarvis/ui/web/frontend/src/App.tsxindex d1d2a8e549..eb5a91a2aa 100644--- a/jarvis/ui/web/frontend/src/App.tsx+++ b/jarvis/ui/web/frontend/src/App.tsx@@ -4,6 +4,7 @@ import { useVoiceStatus } from "@/hooks/useVoiceStatus";import { useAssistantNameSeed } from "@/hooks/useAssistantNameSeed";import { Sidebar } from "@/components/layout/Sidebar";import { TopBar } from "@/components/layout/TopBar";+import { PermissionsAlertBanner } from "@/components/layout/PermissionsAlertBanner";import { VoiceWarmingBanner } from "@/components/layout/VoiceWarmingBanner";import { MainView } from "@/components/layout/MainView";import { ToastLayer } from "@/components/ToastLayer";@@ -28,6 +29,9 @@ export default function App() {<Sidebar /><main className="relative z-10 flex min-w-0 flex-1 flex-col">+ {/* App-wide macOS permission alert — topmost so a missing grant is+ impossible to miss on any view. No-op on other platforms. */}+ <PermissionsAlertBanner /><TopBar /><VoiceWarmingBanner /><div className="min-h-0 flex-1">diff --git a/jarvis/ui/web/frontend/src/__tests__/i18n.test.ts b/jarvis/ui/web/frontend/src/__tests__/i18n.test.tsindex b36ceec1d6..9da131c8d8 100644--- a/jarvis/ui/web/frontend/src/__tests__/i18n.test.ts+++ b/jarvis/ui/web/frontend/src/__tests__/i18n.test.ts@@ -57,6 +57,28 @@ describe("wiki_provider namespace parity (all locales share the same keys)", ()}});+describe("permissions namespace parity (all locales share the same nested keys)", () => {+ const flatten = (obj: Record<string, unknown>, prefix = ""): string[] =>+ Object.entries(obj).flatMap(([key, value]) =>+ value && typeof value === "object"+ ? flatten(value as Record<string, unknown>, `${prefix}${key}.`)+ : [`${prefix}${key}`],+ );+ const keysFor = (loc: unknown) =>+ flatten((loc as { permissions?: Record<string, unknown> }).permissions ?? {}).sort();+ const reference = keysFor(en);++ it("en: has a non-empty permissions namespace", () => {+ expect(reference.length).toBeGreaterThan(0);+ });++ for (const [name, loc] of Object.entries(LOCALES)) {+ it(`${name}: permissions keys match en exactly`, () => {+ expect(keysFor(loc)).toEqual(reference);+ });+ }+});+describe("settings_view languages group (folded-in section)", () => {for (const [name, loc] of Object.entries(LOCALES)) {it(`${name}: has a languages group title for the Settings panel`, () => {diff --git a/jarvis/ui/web/frontend/src/components/layout/PermissionsAlertBanner.test.tsx b/jarvis/ui/web/frontend/src/components/layout/PermissionsAlertBanner.test.tsxnew file mode 100644index 0000000000..129f382558--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/layout/PermissionsAlertBanner.test.tsx@@ -0,0 +1,163 @@+import { cleanup, fireEvent, render, screen } from "@testing-library/react";+import { afterEach, describe, expect, it, vi } from "vitest";+import type { PermissionSnapshot } from "@/hooks/usePermissions";++const request = vi.fn();+const openSettings = vi.fn();++let mockSnapshot: PermissionSnapshot | null = null;++vi.mock("@/i18n", () => ({+ useT: () => (key: string) => key,+}));++vi.mock("@/store/events", () => ({+ useEventStore: (selector: (state: { pushToast: ReturnType<typeof vi.fn> }) => unknown) =>+ selector({ pushToast: vi.fn() }),+}));++vi.mock("@/hooks/usePermissions", () => ({+ usePermissions: () => ({+ snapshot: mockSnapshot,+ loading: false,+ error: null,+ pendingId: null,+ refetch: vi.fn(),+ request,+ openSettings,+ }),+}));++import { PermissionsAlertBanner } from "./PermissionsAlertBanner";++function darwinSnapshot(overrides: Partial<PermissionSnapshot> = {}): PermissionSnapshot {+ return {+ platform: "darwin",+ supported: true,+ headless: false,+ app_identity: { stable: true },+ permissions: [+ {+ id: "microphone",+ status: "denied",+ required: ["voice"],+ can_request: false,+ can_open_settings: true,+ restart_required: false,+ },+ ],+ features: { voice: { ready: false, missing: ["microphone"] } },+ restart_required: false,+ ...overrides,+ };+}++afterEach(() => {+ cleanup();+ vi.clearAllMocks();+ mockSnapshot = null;+});++describe("PermissionsAlertBanner", () => {+ it("shows a blocked permission with its System Settings deep link", () => {+ mockSnapshot = darwinSnapshot();+ render(<PermissionsAlertBanner />);++ expect(screen.getByTestId("permissions-alert-banner")).toBeDefined();+ expect(screen.getByText("permissions.banner.title")).toBeDefined();+ // The broken-feature summary line is rendered from snapshot.features.+ expect(screen.getByText("permissions.banner.impact")).toBeDefined();++ fireEvent.click(screen.getByRole("button", { name: "permissions.open_settings" }));+ expect(openSettings).toHaveBeenCalledWith("microphone");+ });++ it("offers the native prompt when the backend says a request can run", () => {+ mockSnapshot = darwinSnapshot({+ permissions: [+ {+ id: "microphone",+ status: "not_determined",+ required: ["voice"],+ can_request: true,+ can_open_settings: true,+ restart_required: false,+ },+ ],+ });+ render(<PermissionsAlertBanner />);++ fireEvent.click(screen.getByRole("button", { name: "permissions.request" }));+ expect(request).toHaveBeenCalledWith("microphone");+ });++ it("collapses to the headline but never disappears while something is missing", () => {+ mockSnapshot = darwinSnapshot();+ render(<PermissionsAlertBanner />);++ fireEvent.click(screen.getByRole("button", { name: /permissions.banner.collapse/ }));++ expect(screen.getByText("permissions.banner.title")).toBeDefined();+ expect(screen.queryByText("permissions.items.microphone.title")).toBeNull();+ });++ it("shows only the restart call-to-action once everything is granted", () => {+ mockSnapshot = darwinSnapshot({+ permissions: [+ {+ id: "screen_recording",+ status: "granted",+ required: ["computer_use"],+ can_request: false,+ can_open_settings: true,+ restart_required: true,+ },+ ],+ features: {+ computer_use: { ready: false, missing: [] },+ },+ restart_required: true,+ });+ render(<PermissionsAlertBanner />);++ const banner = screen.getByTestId("permissions-alert-banner");+ expect(banner.getAttribute("data-state")).toBe("restart");+ expect(screen.getByRole("button", { name: "permissions.restart_now" })).toBeDefined();+ });++ it("renders nothing on other platforms", () => {+ mockSnapshot = darwinSnapshot({ platform: "win32" });+ render(<PermissionsAlertBanner />);+ expect(screen.queryByTestId("permissions-alert-banner")).toBeNull();+ });++ it("renders nothing while the snapshot has not loaded", () => {+ mockSnapshot = null;+ render(<PermissionsAlertBanner />);+ expect(screen.queryByTestId("permissions-alert-banner")).toBeNull();+ });++ it("renders nothing when every required permission is settled", () => {+ mockSnapshot = darwinSnapshot({+ permissions: [+ {+ id: "microphone",+ status: "granted",+ required: ["voice"],+ can_request: false,+ can_open_settings: true,+ restart_required: false,+ },+ ],+ features: { voice: { ready: true, missing: [] } },+ });+ render(<PermissionsAlertBanner />);+ expect(screen.queryByTestId("permissions-alert-banner")).toBeNull();+ });++ it("renders nothing on a headless install (no desktop session to grant from)", () => {+ mockSnapshot = darwinSnapshot({ headless: true });+ render(<PermissionsAlertBanner />);+ expect(screen.queryByTestId("permissions-alert-banner")).toBeNull();+ });+});diff --git a/jarvis/ui/web/frontend/src/components/layout/PermissionsAlertBanner.tsx b/jarvis/ui/web/frontend/src/components/layout/PermissionsAlertBanner.tsxnew file mode 100644index 0000000000..49d77ab811--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/layout/PermissionsAlertBanner.tsx@@ -0,0 +1,218 @@+import { useState } from "react";+import {+ Accessibility,+ ChevronDown,+ ChevronUp,+ Keyboard,+ Loader2,+ Mic,+ Monitor,+ MousePointer2,+ ShieldAlert,+} from "lucide-react";+import { Button } from "@/components/ui/button";+import { useT } from "@/i18n";+import { useEventStore } from "@/store/events";+import {+ usePermissions,+ type PermissionId,+ type PermissionItem,+} from "@/hooks/usePermissions";++const ICONS = {+ microphone: Mic,+ screen_recording: Monitor,+ accessibility: Accessibility,+ input_monitoring: Keyboard,+ event_posting: MousePointer2,+} satisfies Record<PermissionId, typeof Mic>;++// Mirrors the "waiting for System Settings" logic inside usePermissions: a+// permission only blocks features when some feature requires it AND its state+// is neither granted, exempt, nor unknowable on this installation.+const SETTLED_STATES = new Set(["granted", "not_required", "unavailable"]);++function isBlocking(item: PermissionItem): boolean {+ return item.required.length > 0 && !SETTLED_STATES.has(item.status);+}++/**+ * Fat, app-wide macOS permission alert.+ *+ * macOS TCC permissions cannot be granted at install time — only the user can+ * approve them, in the OS prompt or in System Settings. When a required grant+ * is missing, the affected features (wake word, voice, Computer-Use, …) fail+ * silently and read as "the app is broken" (real field bug: wake word dead+ * because Microphone access was never granted, and only the Settings panel+ * knew). This banner sits above every view, names exactly what is broken, and+ * deep-links each grant to its System Settings pane.+ *+ * Renders nothing on Windows/Linux and on headless installs (no desktop+ * session to grant from), so it is a quiet no-op everywhere but a macOS+ * desktop with work left to do.+ */+export function PermissionsAlertBanner() {+ const t = useT();+ const pushToast = useEventStore((state) => state.pushToast);+ const [collapsed, setCollapsed] = useState(false);+ const [restarting, setRestarting] = useState(false);+ const { snapshot, pendingId, request, openSettings } = usePermissions();++ if (!snapshot || snapshot.platform !== "darwin" || snapshot.headless) return null;++ const missing = snapshot.permissions.filter(isBlocking);+ if (missing.length === 0 && !snapshot.restart_required) return null;++ // Everything is granted, the OS just needs a fresh process to hand the new+ // access to. Collapse the whole banner into a single restart call-to-action.+ const restartOnly = missing.length === 0;++ const brokenFeatures = Object.entries(snapshot.features)+ .filter(([, feature]) => !feature.ready)+ .map(([key]) => t(`permissions.features.${key}`));++ async function run(action: () => Promise<void>) {+ try {+ await action();+ } catch (exc) {+ pushToast("error", exc instanceof Error ? exc.message : String(exc));+ }+ }++ async function restartApp() {+ if (restarting) return;+ setRestarting(true);+ try {+ const response = await fetch("/api/settings/restart-app", { method: "POST" });+ if (response.status === 409) {+ pushToast("warning", t("topbar.restart_missions_running"));+ setRestarting(false);+ return;+ }+ if (!response.ok) throw new Error(`restart-failed:${response.status}`);+ // A successful response schedules process shutdown; keep the button+ // disabled while the window closes and relaunches.+ } catch {+ pushToast("error", t("permissions.restart_failed"));+ setRestarting(false);+ }+ }++ return (+ <div+ data-testid="permissions-alert-banner"+ data-state={restartOnly ? "restart" : "missing"}+ role="alert"+ className="border-b-2 border-amber-500/50 bg-amber-500/10 text-amber-100"+ >+ <div className="flex items-center gap-3 px-4 py-2.5">+ <ShieldAlert className="h-5 w-5 shrink-0 text-amber-400" aria-hidden />+ <div className="min-w-0 flex-1">+ <p className="text-sm font-semibold leading-tight">+ {restartOnly+ ? t("permissions.restart_required")+ : t("permissions.banner.title")}+ </p>+ {!restartOnly && brokenFeatures.length > 0 && (+ <p className="text-xs leading-tight text-amber-200/90">+ {t("permissions.banner.impact").replace("{0}", brokenFeatures.join(", "))}+ </p>+ )}+ </div>+ {restartOnly ? (+ <Button size="sm" disabled={restarting} onClick={() => void restartApp()}>+ {restarting && <Loader2 className="mr-1.5 h-3.5 w-3.5 animate-spin" />}+ {t(restarting ? "permissions.restarting" : "permissions.restart_now")}+ </Button>+ ) : (+ <Button+ size="sm"+ variant="outline"+ aria-expanded={!collapsed}+ onClick={() => setCollapsed((value) => !value)}+ >+ {collapsed ? (+ <ChevronDown className="mr-1.5 h-3.5 w-3.5" aria-hidden />+ ) : (+ <ChevronUp className="mr-1.5 h-3.5 w-3.5" aria-hidden />+ )}+ {t(collapsed ? "permissions.banner.expand" : "permissions.banner.collapse")}+ </Button>+ )}+ </div>++ {!restartOnly && !collapsed && (+ <div className="space-y-2 px-4 pb-3">+ {snapshot.app_identity.stable === false && (+ <p className="text-xs text-amber-200/90">{t("permissions.identity_warning")}</p>+ )}+ {missing.map((item) => (+ <MissingPermissionRow+ key={item.id}+ item={item}+ busy={pendingId === item.id}+ onRequest={() => void run(() => request(item.id))}+ onOpenSettings={() => void run(() => openSettings(item.id))}+ />+ ))}+ {snapshot.restart_required && (+ <div className="flex flex-wrap items-center justify-between gap-2 rounded-lg border border-amber-500/30 bg-background/40 p-3">+ <p className="text-xs text-amber-500">{t("permissions.restart_required")}</p>+ <Button size="sm" disabled={restarting} onClick={() => void restartApp()}>+ {restarting && <Loader2 className="mr-1.5 h-3.5 w-3.5 animate-spin" />}+ {t(restarting ? "permissions.restarting" : "permissions.restart_now")}+ </Button>+ </div>+ )}+ <p className="text-xs text-amber-200/70">{t("permissions.banner.hint")}</p>+ </div>+ )}+ </div>+ );+}++function MissingPermissionRow({+ item,+ busy,+ onRequest,+ onOpenSettings,+}: {+ item: PermissionItem;+ busy: boolean;+ onRequest: () => void;+ onOpenSettings: () => void;+}) {+ const t = useT();+ // A newer backend may report a permission id this build does not know yet;+ // fall back to the generic shield instead of rendering `undefined`.+ const Icon = ICONS[item.id] ?? ShieldAlert;++ return (+ <div className="flex flex-wrap items-center gap-3 rounded-lg border border-amber-500/30 bg-background/40 p-3">+ <Icon className="h-4 w-4 shrink-0 text-amber-400" aria-hidden />+ <div className="min-w-[12rem] flex-1">+ <div className="text-sm font-medium text-foreground">+ {t(`permissions.items.${item.id}.title`)}+ </div>+ <p className="mt-0.5 text-xs text-muted-foreground">+ {t(`permissions.items.${item.id}.description`)}+ </p>+ </div>+ <span className="rounded-full bg-amber-500/10 px-2 py-1 text-[10px] font-medium uppercase tracking-wide text-amber-500">+ {t(`permissions.status.${item.status}`)}+ </span>+ {item.can_request && (+ <Button size="sm" disabled={busy} onClick={onRequest}>+ {busy && <Loader2 className="mr-1.5 h-3.5 w-3.5 animate-spin" />}+ {t("permissions.request")}+ </Button>+ )}+ {item.can_open_settings && (+ <Button size="sm" variant="outline" disabled={busy} onClick={onOpenSettings}>+ {busy && <Loader2 className="mr-1.5 h-3.5 w-3.5 animate-spin" />}+ {t("permissions.open_settings")}+ </Button>+ )}+ </div>+ );+}diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.jsonindex 186fbbee8e..21039ed2fe 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json@@ -1070,6 +1070,19 @@"accessibility": { "title": "Bedienungshilfen", "description": "Erforderlich für zuverlässige Klicks, Eingaben, Fokus und Fenstersteuerung." },"input_monitoring": { "title": "Eingabeüberwachung", "description": "Erforderlich für globale Push-to-Talk- und Tastaturkurzbefehle." },"event_posting": { "title": "Eingabesteuerung", "description": "Erforderlich, damit Computer-Use Maus- und Tastaturereignisse senden kann." }+ },+ "banner": {+ "title": "Aktion nötig: macOS-Berechtigungen fehlen",+ "impact": "Funktioniert gerade nicht: {0}",+ "hint": "Erlaube den Zugriff über die Buttons — macOS öffnet für jede Berechtigung direkt die richtige Seite der Systemeinstellungen. {name} prüft automatisch nach.",+ "collapse": "Details ausblenden",+ "expand": "Details anzeigen"+ },+ "features": {+ "voice": "Sprache & Aktivierungswort",+ "computer_use": "Computer-Use",+ "global_hotkeys": "Globale Kurzbefehle",+ "window_control": "Fenstersteuerung"}},"settings_view": {diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.jsonindex 4ffbd8e221..e71b95b5d0 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json@@ -1071,6 +1071,19 @@"accessibility": { "title": "Accessibility", "description": "Required for reliable clicks, typing, focus, and window control." },"input_monitoring": { "title": "Input Monitoring", "description": "Required for global push-to-talk and keyboard shortcuts." },"event_posting": { "title": "Input control", "description": "Required for Computer-Use to send mouse and keyboard events." }+ },+ "banner": {+ "title": "Action needed: macOS permissions are missing",+ "impact": "Not working right now: {0}",+ "hint": "Use the buttons to allow access — macOS opens the right System Settings page for each permission. {name} re-checks automatically.",+ "collapse": "Hide details",+ "expand": "Show details"+ },+ "features": {+ "voice": "Voice & wake word",+ "computer_use": "Computer-Use",+ "global_hotkeys": "Global shortcuts",+ "window_control": "Window control"}},"settings_view": {diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.jsonindex 00e49dc9f4..0da88a5f74 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json@@ -1070,6 +1070,19 @@"accessibility": { "title": "Accesibilidad", "description": "Necesario para clics, escritura, enfoque y control de ventanas fiables." },"input_monitoring": { "title": "Monitorización de entrada", "description": "Necesario para pulsar para hablar y atajos de teclado globales." },"event_posting": { "title": "Control de entrada", "description": "Necesario para que Computer-Use envíe eventos de ratón y teclado." }+ },+ "banner": {+ "title": "Acción necesaria: faltan permisos de macOS",+ "impact": "Ahora mismo no funciona: {0}",+ "hint": "Permite el acceso con los botones: macOS abre directamente la página correcta de Ajustes del Sistema para cada permiso. {name} vuelve a comprobarlo automáticamente.",+ "collapse": "Ocultar detalles",+ "expand": "Mostrar detalles"+ },+ "features": {+ "voice": "Voz y palabra de activación",+ "computer_use": "Computer-Use",+ "global_hotkeys": "Atajos globales",+ "window_control": "Control de ventanas"}},"settings_view": {