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(stt): the local recognizer says when it cannot reach the GPU, and installs the fix in-app
rubenluetke10-beep223e9074d828
diff --git a/docs/os-parity.md b/docs/os-parity.mdindex 1ecbe99f10..dd496dc45c 100644--- a/docs/os-parity.md+++ b/docs/os-parity.md@@ -245,6 +245,7 @@ experiences today.| P-27 | Low | Mouse-button shortcuts | A shortcut may now be a MOUSE BUTTON (middle, and the two side buttons — `mouse_middle` / `mouse_x1` / `mouse_x2`). All three OSes are implemented in the same change and share one token vocabulary, but the delivery is not uniform: Windows needs nothing extra (the backend polls `GetAsyncKeyState`, which reports mouse buttons); macOS needs pyobjc `Quartz` plus the Accessibility + Input Monitoring grants the hotkey tap already requires; Linux/X11 needs `pynput`, which is the opt-in `[desktop-linux]` extra for the reason recorded in P-24 (`evdev` is source-only). Wayland cannot do it at all — no global button grab exists, the same design reason keyboard shortcuts degrade there. The left and right buttons are deliberately not bindable on any OS: their meaning follows the system "swap mouse buttons" setting, so a shortcut recorded as "left" would fire on the physical right button for a left-handed user | `jarvis/trigger/hotkey.py::mouse_hotkeys_available`, `backends/global_hotkeys.py::_MOUSE_TOKEN_TO_VK`, `backends/pynput.py::_start_mouse_listener`, `backends/quartz.py::_MOUSE_BUTTON_TO_TOKEN` | Every host answers the capability question BEFORE offering the control: `mouse_hotkeys_available()` returns an English sentence naming what is missing and what still works, and a backend that cannot start its mouse hook logs the same thing and keeps the KEYBOARD shortcuts alive rather than failing the whole binding. macOS/Linux desktop with the extras: full parity with Windows. Wayland and headless: key combinations only || P-28 | Low | Local realtime | The one-click managed install AND the 2026-08-08 supervisor (prewarm, pidfile ownership, start/stop routes, Ollama keep-alive warm ping) are built cross-platform — pathlib, `os.name` venv layout with a POSIX `lib/python*/site-packages` glob, per-hardware torch flavor, `start_new_session` + `killpg` SIGTERM→SIGKILL escalation on POSIX, `HF_HUB_DISABLE_SYMLINKS` Windows-only — but have only been RUN on the Windows dev box. The preflight's accelerator probe knows two sources: NVIDIA VRAM (nvidia-smi) and Apple-Silicon unified memory (total RAM); the derived launch command maps them to `cuda`/`mps`; an AMD/Intel/no-nvidia-smi host gets the honest "no supported accelerator" blocker (unit-tested) | `jarvis/realtime/local_server/{preflight,install,supervisor}.py` | Any host under 12 GB usable accelerator memory (including every GPU-less/headless box) gets the honest blocker with a cloud pointer instead of an install — verified by unit tests. macOS Apple-Silicon: preflight and install should work but the smoke boot (`--qwen3_tts_device mps`) is UNVERIFIED on real hardware; a failure is honest (install ends in an error state naming the smoke log, readiness stays fail-closed). Linux+NVIDIA: expected to work via the same cu130 wheel index, unverified; the supervisor's POSIX kill/spawn branches are unit-tested but not live-run. The bring-your-own-server URL socket keeps full parity everywhere |+| P-30 | Medium | Local STT on the GPU | The on-device CTranslate2 recognizer (faster-whisper) needs the cuBLAS 12 / cuDNN 9 runtime wheels, which the `[full]` profile deliberately does not carry. Without them the engine self-heals onto the CPU and, until 2026-08-22, nothing but a log line said so (36 silent fallbacks in one live log; the cloud fallback then ran at ~1× realtime). The wheels are now the opt-in `[cuda]` extra, the provider card reports the accelerator truth (`accelerator_status`: requested device, effective device, reason code) and offers the install from inside the app (`POST /api/local-gpu/libraries`), and the library probe is a pure on-disk look — the out-of-process inference probe (AP-25) remains the only verdict on whether the GPU WORKS | `jarvis/plugins/stt/fwhisper.py::cuda_runtime_libraries_present`, `GPU_LIBRARY_PACKAGES`, `jarvis/speech/local_models.py::accelerator_status`, `jarvis/speech/local_install.py::start_gpu_libraries_install` | Windows: verified live on the dev box (install → `ctranslate2.get_cuda_device_count() == 1`, base/cuda decode). Linux: the same wheels land in `nvidia/cublas/lib`; the probe also accepts a system-wide CUDA via `ctypes.util.find_library("cublas")` — expected to work, UNVERIFIED on real hardware. macOS: no CUDA exists; the card says `unsupported_os` and the recognizer runs on the CPU with no install offered. Headless/GPU-less Linux: libraries absent → honest `cuda_libraries_missing` when the config asks for `cuda`, silent when it asks for `cpu` || P-32 | Low | Local models | The in-app Ollama runtime install (the plug-and-go path for local models: detect → install → start → pull, no terminal) has one silent path per OS and an honest refusal elsewhere: Windows uses winget or the official per-user OllamaSetup.exe (built, not yet live-run on a machine WITHOUT Ollama); macOS automates only Homebrew — a dmg drag cannot be scripted honestly, so brew-less Macs get the download pointer; Linux runs the official install.sh only when non-interactive sudo exists (the script escalates internally; without it the refusal names the one terminal command instead of hanging on an invisible password prompt). Detection and start are cross-platform | `jarvis/brain/ollama_runtime.py`, `jarvis/ui/web/provider_routes.py` (ollama-runtime routes), `jarvis/realtime/local_server/install.py::_setup_local_brain` | Every OS gets the same three-state truth (not installed / stopped / running) and the same buttons; only the INSTALL leg differs. Refusals are one honest sentence with the exact fixing action. All install legs are unit-tested with fakes; no leg has been live-run on a machine without Ollama yet — the cold-machine drill is the recorded release gate || P-31 | Low | Detached views | The "own window" detach (Agentic IDE / Voice into a second pywebview window) creates the window at RUNTIME, after `webview.start()`. pywebview documents runtime multi-window, and the code path is OS-neutral (worker-thread create, distinct title, shared backend), but it has only been RUN against the Windows/WebView2 backend; whether the cocoa and GTK backends accept a runtime `create_window` is unverified from this machine. Browser-lock auth in the second window additionally relies on a shared cookie jar, which is verified for WebView2 only | `jarvis/ui/desktop_app.py::open_detached_window`, `jarvis/platform/probes.py::webview_backend_available`, `jarvis/ui/web/desktop_routes.py` | Every failure is honest and keeps the feature usable: a shell whose backend refuses the runtime create answers `ok: false` with the solo URL and the frontend opens it in the user's real browser tab (via open-external); plain-browser clients open the tab directly; headless answers `no_desktop_shell` the same way. macOS/Linux desktop live check pending: detach, close main, reattach, tray-reopen — on success this row shrinks to the cookie-jar note or disappears |diff --git a/jarvis/plugins/stt/__init__.py b/jarvis/plugins/stt/__init__.pyindex d19da47fc2..5e9f4e3c10 100644--- a/jarvis/plugins/stt/__init__.py+++ b/jarvis/plugins/stt/__init__.py@@ -990,6 +990,24 @@ def _persist_wake_gpu_probe(ok: bool, ct2_version: str | None = None) -> None:logger.debug("Wake-GPU probe cache write failed ({}).", exc)+def forget_gpu_probe_results() -> None:+ """Drop both persisted GPU verdicts so the next build probes afresh.++ Called after the GPU libraries were installed from inside the app: the+ verdicts on disk were written by a runtime that could not load cuBLAS and+ would otherwise keep every later build on the CPU until the ctranslate2+ version changes. Best-effort; a missing file is the goal, not an error.+ """+ _wake_cuda_available.cache_clear()+ for path in (_wake_cuda_cache_path(), _wake_gpu_probe_cache_path()):+ try:+ path.unlink()+ except FileNotFoundError:+ pass+ except Exception as exc: # noqa: BLE001 — best-effort cache hygiene+ logger.debug("GPU probe cache {} not removed ({}).", path, exc)++def mark_wake_gpu_bad() -> None:"""Record that the LIVE GPU wake model wedged — future builds stay on CPU.diff --git a/jarvis/plugins/stt/fwhisper.py b/jarvis/plugins/stt/fwhisper.pyindex 22e378ee28..ee16fac2a5 100644--- a/jarvis/plugins/stt/fwhisper.py+++ b/jarvis/plugins/stt/fwhisper.py@@ -203,6 +203,80 @@ _CUDA_DLL_PACKAGE_DIRS: Final[tuple[tuple[str, tuple[str, ...]], ...]] = (("nvidia.cudnn", ("bin",)),)+#: The pip wheels that put the CUDA runtime CTranslate2 needs into THIS+#: interpreter — cuBLAS 12 and cuDNN 9, the pair ctranslate2 4.x links against.+#: Mirrored by the ``cuda`` extra in ``pyproject.toml`` (a test pins the two+#: together) and installed from inside the app by+#: :func:`jarvis.speech.local_install.start_gpu_libraries_install`, because a+#: GPU that the app cannot reach is not something a person should have to fix+#: in a terminal (CLAUDE.md §2, credentials-and-capabilities recoverable in-app).+GPU_LIBRARY_PACKAGES: Final[tuple[str, ...]] = (+ "nvidia-cublas-cu12>=12.4,<13",+ "nvidia-cudnn-cu12>=9,<10",+)++#: Where the same libraries live per package on Linux (``.so``), next to the+#: Windows ``bin`` directories above.+_CUDA_SO_PACKAGE_DIRS: Final[tuple[tuple[str, tuple[str, ...]], ...]] = (+ ("torch", ("lib",)),+ ("nvidia.cublas", ("lib",)),+ ("nvidia.cudnn", ("lib",)),+)+++def cuda_runtime_libraries_present() -> bool:+ """Whether a cuBLAS runtime the local recognizer could load is installed+ in THIS interpreter. A cheap on-disk look, never a CUDA call (AP-26).++ This answers one precise question — "is the library there?" — and not+ "does the GPU work" (that is the out-of-process inference probe, AP-25).+ It exists because the two used to be indistinguishable: on a desktop with+ a working driver but no ``nvidia-cublas-cu12`` wheel, ctranslate2 fails+ with "Library cublas64_12.dll is not found", the provider self-heals onto+ the CPU and nothing but a log line says why. macOS has no CUDA at all and+ reads as absent.+ """+ import importlib.util # noqa: PLC0415 — lazy path must stay cheap++ if sys.platform == "darwin":+ return False+ if os.name == "nt":+ candidates, pattern = _CUDA_DLL_PACKAGE_DIRS, "cublas64_*.dll"+ else:+ candidates, pattern = _CUDA_SO_PACKAGE_DIRS, "libcublas.so*"+ for module_name, relative_parts in candidates:+ try:+ spec = importlib.util.find_spec(module_name)+ except (ImportError, ValueError):+ continue+ if spec is None:+ continue+ roots: list[Path] = []+ origin = getattr(spec, "origin", None)+ if origin:+ roots.append(Path(origin).parent)+ for location in getattr(spec, "submodule_search_locations", ()) or ():+ root = Path(location)+ if root not in roots:+ roots.append(root)+ for root in roots:+ directory = root.joinpath(*relative_parts)+ try:+ if directory.is_dir() and any(directory.glob(pattern)):+ return True+ except OSError:+ continue+ if os.name != "nt":+ # A system-wide CUDA install (distro package, conda) is just as real;+ # the dynamic loader finds it without any of the wheels above.+ import ctypes.util # noqa: PLC0415 — lazy path must stay cheap++ try:+ return ctypes.util.find_library("cublas") is not None+ except Exception: # noqa: BLE001 — a broken loader config is "absent"+ return False+ return False+#: Loaded explicitly, in dependency order, once a directory holding them is#: found. Adding that directory to the search path is NOT enough on its own —#: measured: ctranslate2 still raised "Library cublas64_12.dll is not found ordiff --git a/jarvis/speech/local_install.py b/jarvis/speech/local_install.pyindex 8761fdb9bd..a77cc1936d 100644--- a/jarvis/speech/local_install.py+++ b/jarvis/speech/local_install.py@@ -145,6 +145,96 @@ def _run_install(provider_id: str) -> None:log.info("local install for %s finished: ok=%s msg=%s", provider_id, ok, message[:200])+#: Registry key under which the GPU-library install keeps its progress. Not a+#: provider: the libraries serve every CTranslate2 provider at once.+GPU_LIBRARIES_RUN_KEY = "gpu-libraries"+++def _run_gpu_libraries_install() -> None:+ """pip-install cuBLAS/cuDNN into this interpreter, then verify. Never raises.++ The CPU fallback it repairs is silent by construction (the engine+ self-heals onto the CPU and only a log line says why), so the verification+ at the end is the on-disk library look the card reads — the same authority,+ so the card cannot claim a success the next load would contradict. A+ finished install also forgets the cached GPU probe verdicts: they were+ written under a runtime that could not load the libraries and must not+ keep the engine on the CPU now that it can.+ """+ run = _run_for(GPU_LIBRARIES_RUN_KEY)+ from jarvis.plugins.stt.fwhisper import (+ GPU_LIBRARY_PACKAGES,+ cuda_runtime_libraries_present,+ )+ from jarvis.setup.dependencies import install_pip_package++ ok = True+ message = ""+ for package in GPU_LIBRARY_PACKAGES:+ with run.lock:+ run.message = f"Installing {package.split('>=')[0].split('<')[0]}…"+ ok, message = install_pip_package(package, only_binary=True)+ if not ok:+ break+ importlib.invalidate_caches()+ if ok:+ if cuda_runtime_libraries_present():+ message = (+ "The GPU libraries are installed. The local recognizer uses the "+ "GPU from its next load on."+ )+ try:+ from jarvis.plugins.stt import forget_gpu_probe_results++ forget_gpu_probe_results()+ except Exception as exc: # noqa: BLE001 — a stale cache is not a failure+ log.debug("GPU probe cache could not be cleared: %s", exc)+ else:+ ok = False+ message = (+ "The install finished, but the GPU libraries still cannot be "+ "found in this app. Try again; if it keeps failing, this "+ "machine may not have a CUDA-capable setup."+ )+ with run.lock:+ run.state = "done" if ok else "error"+ run.message = message+ log.info("GPU library install finished: ok=%s msg=%s", ok, message[:200])+++def start_gpu_libraries_install() -> dict[str, Any]:+ """Begin (or join) the GPU-library install; returns the current state."""+ run = _run_for(GPU_LIBRARIES_RUN_KEY)+ with run.lock:+ if run.state != "running":+ run.state = "running"+ run.message = "Starting the GPU library install…"+ threading.Thread(+ target=_run_gpu_libraries_install,+ name="jarvis-gpu-libraries-install",+ daemon=True,+ ).start()+ return gpu_libraries_install_status()+++def gpu_libraries_install_status() -> dict[str, Any]:+ """Progress of the GPU-library install plus the independent on-disk truth."""+ run = _run_for(GPU_LIBRARIES_RUN_KEY)+ try:+ from jarvis.plugins.stt.fwhisper import cuda_runtime_libraries_present++ present = cuda_runtime_libraries_present()+ except Exception: # noqa: BLE001 — the status must never raise+ present = False+ with run.lock:+ return {+ "state": run.state,+ "message": run.message,+ "ready": present,+ "libraries_present": present,+ }++def start_install(provider_id: str) -> dict[str, Any]:"""Begin (or join) an install for *provider_id*; returns the current state.diff --git a/jarvis/speech/local_models.py b/jarvis/speech/local_models.pyindex 95e5dda06d..5652add54f 100644--- a/jarvis/speech/local_models.py+++ b/jarvis/speech/local_models.py@@ -38,6 +38,7 @@ from __future__ import annotationsimport importlib.utilimport loggingimport os+import sysfrom dataclasses import dataclassfrom pathlib import Pathfrom typing import Literal@@ -87,6 +88,127 @@ class LocalModelStatus:return self.engine_installed and self.model_present+@dataclass(frozen=True)+class AcceleratorStatus:+ """Whether the local recognizer will really run on the GPU it was asked for.++ ``requested`` is the configured device (``[stt].device``), ``effective`` the+ one the engine will actually build on once it loads, ``reason`` a stable+ code for the difference (``""`` when there is none):++ * ``not_requested`` — the config asks for the CPU;+ * ``unsupported_os`` — no CUDA on this platform (macOS);+ * ``cuda_libraries_missing`` — the cuBLAS/cuDNN wheels are not in this+ interpreter, so the load fails and the provider self-heals onto the CPU+ (the live 2026-08-22 finding: 36 silent CPU fallbacks in one log);+ * ``gpu_probe_failed`` — the libraries are there but the out-of-process+ inference probe recorded a hang (AP-25);+ * ``unverified`` — libraries present, no probe verdict on disk yet; the+ engine will try the GPU.++ ``installable`` says whether the in-app installer can fix the reason.+ """++ requested: str+ effective: str+ reason: str+ libraries_present: bool+ verified: bool | None+ installable: bool+ detail: str+++def accelerator_status(runtime: str, *, requested_device: str) -> AcceleratorStatus | None:+ """GPU truth for *runtime*, or ``None`` for a runtime that never uses CUDA.++ Cheap: an on-disk library look plus the cached probe verdict — never a+ CUDA call, never the blocking probe (AP-26). Only the CTranslate2 runtime+ has a GPU path today; the ONNX-Runtime providers run on the CPU by design+ and report nothing here rather than a misleading "CPU fallback".+ """+ if runtime != "faster-whisper":+ return None+ requested = (requested_device or "cpu").strip().lower() or "cpu"+ try:+ from jarvis.plugins.stt.fwhisper import cuda_runtime_libraries_present++ libraries = cuda_runtime_libraries_present()+ except Exception as exc: # noqa: BLE001 — a probe failure reads as "absent"+ log.debug("CUDA library probe failed (%s); reporting absent.", exc)+ libraries = False+ verified: bool | None = None+ try:+ from jarvis.plugins.stt import wake_gpu_probe_cached++ verified = wake_gpu_probe_cached()+ except Exception as exc: # noqa: BLE001 — no verdict is an honest state+ log.debug("GPU probe cache unreadable (%s); treating as unprobed.", exc)+ verified = None++ if requested == "cpu":+ return AcceleratorStatus(+ requested=requested,+ effective="cpu",+ reason="not_requested",+ libraries_present=libraries,+ verified=verified,+ installable=False,+ detail="Runs on the CPU, as configured.",+ )+ if sys.platform == "darwin":+ return AcceleratorStatus(+ requested=requested,+ effective="cpu",+ reason="unsupported_os",+ libraries_present=False,+ verified=None,+ installable=False,+ detail="There is no CUDA on macOS — the local recognizer runs on the CPU here.",+ )+ if not libraries:+ return AcceleratorStatus(+ requested=requested,+ effective="cpu",+ reason="cuda_libraries_missing",+ libraries_present=False,+ verified=verified,+ installable=True,+ detail=(+ "The GPU libraries (cuBLAS/cuDNN) are not installed in this app, "+ "so the local recognizer falls back to the CPU — roughly eight "+ "times slower. Install them from here (about 700 MB, once)."+ ),+ )+ if verified is False:+ return AcceleratorStatus(+ requested=requested,+ effective="cpu",+ reason="gpu_probe_failed",+ libraries_present=True,+ verified=False,+ installable=False,+ detail=(+ "The GPU libraries are installed, but a real test run on this "+ "GPU hung, so the recognizer stays on the CPU until the runtime "+ "changes."+ ),+ )+ return AcceleratorStatus(+ requested=requested,+ effective=requested,+ reason="" if verified else "unverified",+ libraries_present=True,+ verified=verified,+ installable=False,+ detail=(+ f"Runs on the GPU ({requested}) — verified with a real test run."+ if verified+ else f"Runs on the GPU ({requested}); the libraries are installed and "+ "the first load will confirm it."+ ),+ )++def runtime_installed(runtime: str) -> bool:"""True when *runtime*'s inference package is importable here.@@ -525,7 +647,9 @@ def local_status(__all__ = ["LOCAL_PROVIDERS","WHISPER_VOICE_MODEL",+ "AcceleratorStatus","LocalModelStatus",+ "accelerator_status","LocalProvider","get_local_provider","local_status",diff --git a/jarvis/ui/web/frontend/src/components/providers/LocalRuntimePanel.test.tsx b/jarvis/ui/web/frontend/src/components/providers/LocalRuntimePanel.test.tsxindex c5c7d286c0..3765664d40 100644--- a/jarvis/ui/web/frontend/src/components/providers/LocalRuntimePanel.test.tsx+++ b/jarvis/ui/web/frontend/src/components/providers/LocalRuntimePanel.test.tsx@@ -25,6 +25,9 @@ vi.mock("@/i18n", () => ({"apikeys_view.local_installing": "Installing…","apikeys_view.local_install_retry": "Try again","apikeys_view.local_install_hint": "This downloads a few gigabytes.",+ "apikeys_view.gpu_libraries_install_cta": "Install GPU libraries (about 700 MB)",+ "apikeys_view.gpu_libraries_installing": "Installing GPU libraries…",+ "apikeys_view.gpu_libraries_install_hint": "This downloads about 700 MB once.",})[key] ?? key,}));@@ -173,3 +176,81 @@ describe("local runtime panel", () => {).toBe(false);});});++describe("local runtime panel — accelerator truth", () => {+ const MISSING = {+ requested: "cuda",+ effective: "cpu",+ reason: "cuda_libraries_missing" as const,+ libraries_present: false,+ verified: null,+ installable: true,+ detail:+ "The GPU libraries (cuBLAS/cuDNN) are not installed in this app, so the local recognizer falls back to the CPU.",+ };++ it("names a CPU fallback the user did not ask for and offers the fix", () => {+ render(+ <AuthWidget+ descriptor={withRuntime({ ready: true, accelerator: MISSING })}+ onChanged={() => {}}+ />,+ );++ expect(screen.getByTestId("local-accelerator").textContent).toMatch(/falls back to the CPU/);+ expect(screen.getByRole("button", { name: /install gpu libraries/i })).toBeTruthy();+ });++ it("stays quiet when the GPU is used or the CPU was configured", () => {+ render(+ <AuthWidget+ descriptor={withRuntime({+ ready: true,+ accelerator: { ...MISSING, effective: "cuda", reason: "", libraries_present: true, verified: true, installable: false },+ })}+ onChanged={() => {}}+ />,+ );+ expect(screen.queryByTestId("local-accelerator")).toBeNull();+ cleanup();++ render(+ <AuthWidget+ descriptor={withRuntime({+ ready: true,+ accelerator: { ...MISSING, requested: "cpu", reason: "not_requested", installable: false },+ })}+ onChanged={() => {}}+ />,+ );+ expect(screen.queryByTestId("local-accelerator")).toBeNull();+ expect(screen.queryByRole("button", { name: /gpu/i })).toBeNull();+ });++ it("starts the GPU-library install through its own route and reports progress", async () => {+ const calls: string[] = [];+ installFetchMock((url) => {+ calls.push(url);+ return { state: "running", ready: false, message: "Installing nvidia-cublas-cu12…" };+ });++ render(+ <AuthWidget+ descriptor={withRuntime({ ready: true, accelerator: MISSING })}+ onChanged={() => {}}+ />,+ );+ fireEvent.click(screen.getByRole("button", { name: /install gpu libraries/i }));++ await waitFor(() => {+ expect(calls.some((u) => u.endsWith("/api/local-gpu/libraries"))).toBe(true);+ });+ await waitFor(() => {+ expect(screen.getByText("Installing nvidia-cublas-cu12…")).toBeTruthy();+ });+ expect(+ (screen.getByRole("button", { name: /installing gpu libraries/i }) as HTMLButtonElement)+ .disabled,+ ).toBe(true);+ });+});diff --git a/jarvis/ui/web/frontend/src/components/providers/ProviderTierSection.tsx b/jarvis/ui/web/frontend/src/components/providers/ProviderTierSection.tsxindex c53092d3e8..c2249d8639 100644--- a/jarvis/ui/web/frontend/src/components/providers/ProviderTierSection.tsx+++ b/jarvis/ui/web/frontend/src/components/providers/ProviderTierSection.tsx@@ -1,5 +1,5 @@import { useCallback, useEffect, useMemo, useRef, useState } from "react";-import { AlertCircle, Bot, Brain, Check, ChevronDown, Copy, Download, HardDrive, Loader2, LogIn, LogOut, Mic, Play, PlugZap, Radio, Search, Sparkles, Square, Terminal, Volume2, Wand2, Waypoints, XCircle } from "lucide-react";+import { AlertCircle, Bot, Brain, Check, ChevronDown, Copy, Cpu, Download, HardDrive, Loader2, LogIn, LogOut, Mic, Play, PlugZap, Radio, Search, Sparkles, Square, Terminal, Volume2, Wand2, Waypoints, XCircle } from "lucide-react";import { AltCredentialNote } from "@/components/AltCredentialNote";import { ApiKeyForm } from "@/components/ApiKeyForm";import { BrainModelSelector } from "@/components/BrainModelSelector";@@ -34,6 +34,8 @@ import {type OllamaRuntimeStatus,pullableModels,searchModelLibrary,+ startGpuLibrariesInstall,+ gpuLibrariesInstallStatus,startLocalInstall,type LibraryModel,type LibraryTag,@@ -1820,6 +1822,37 @@ function LocalRuntimePanel({const [progress, setProgress] = useState<LocalInstallProgress | null>(null);const [error, setError] = useState<string | null>(null);const running = progress?.state === "running";+ // The GPU-library install is its own run: it serves every on-device+ // recognizer at once and is offered only when the card's accelerator truth+ // names the missing libraries as the reason for a CPU fallback.+ const [gpuProgress, setGpuProgress] = useState<LocalInstallProgress | null>(null);+ const [gpuError, setGpuError] = useState<string | null>(null);+ const gpuRunning = gpuProgress?.state === "running";++ useEffect(() => {+ if (!gpuRunning) return;+ let cancelled = false;+ const timer = window.setInterval(async () => {+ try {+ const next = await gpuLibrariesInstallStatus();+ if (cancelled) return;+ setGpuProgress(next);+ if (next.state === "done" || next.state === "error") {+ window.clearInterval(timer);+ onChanged();+ }+ } catch (err) {+ if (cancelled) return;+ window.clearInterval(timer);+ setGpuError(err instanceof Error ? err.message : String(err));+ setGpuProgress(null);+ }+ }, 3000);+ return () => {+ cancelled = true;+ window.clearInterval(timer);+ };+ }, [gpuRunning, onChanged]);// Poll only while an install is actually in flight, and stop on the terminal// state. A finished run refreshes the provider list so the card's own@@ -1860,7 +1893,22 @@ function LocalRuntimePanel({}};+ const startGpu = async () => {+ setGpuError(null);+ try {+ setGpuProgress(await startGpuLibrariesInstall());+ } catch (err) {+ setGpuError(err instanceof Error ? err.message : String(err));+ }+ };+const failed = progress?.state === "error";+ const gpuFailed = gpuProgress?.state === "error";+ const accelerator = status.accelerator ?? null;+ // Only a CPU fallback the person did not ask for is worth a line and a+ // button; "CPU, as configured" and a verified GPU are the quiet cases.+ const showAccelerator =+ accelerator !== null && accelerator.reason !== "not_requested" && accelerator.reason !== "";return (<div className="space-y-2 rounded-md border border-border/60 bg-muted/30 p-3"><div className="flex items-start gap-2 text-xs">@@ -1873,6 +1921,51 @@ function LocalRuntimePanel({{progress?.message ?? status.detail}</span></div>+ {showAccelerator && accelerator && (+ <div+ className="flex items-start gap-2 text-xs"+ data-testid="local-accelerator"+ >+ <Cpu+ className={cn(+ "mt-0.5 h-3.5 w-3.5 shrink-0",+ accelerator.effective === "cpu" && accelerator.installable+ ? "text-amber-500"+ : "text-muted-foreground",+ )}+ />+ <span className="text-muted-foreground">+ {gpuProgress?.message ?? accelerator.detail}+ </span>+ </div>+ )}+ {showAccelerator && accelerator?.installable && (+ <Button+ size="sm"+ variant="secondary"+ onClick={startGpu}+ disabled={gpuRunning}+ className="gap-2"+ data-testid="install-gpu-libraries"+ >+ {gpuRunning ? (+ <Loader2 className="h-3.5 w-3.5 animate-spin" />+ ) : (+ <Download className="h-3.5 w-3.5" />+ )}+ {gpuRunning+ ? t("apikeys_view.gpu_libraries_installing")+ : gpuFailed+ ? t("apikeys_view.local_install_retry")+ : t("apikeys_view.gpu_libraries_install_cta")}+ </Button>+ )}+ {gpuRunning && (+ <p className="text-[11px] text-muted-foreground">+ {t("apikeys_view.gpu_libraries_install_hint")}+ </p>+ )}+ {gpuError && <p className="text-[11px] text-destructive">{gpuError}</p>}{!status.ready && (<Buttonsize="sm"diff --git a/jarvis/ui/web/frontend/src/hooks/useProviders.ts b/jarvis/ui/web/frontend/src/hooks/useProviders.tsindex cda8bb0686..c371a3cc11 100644--- a/jarvis/ui/web/frontend/src/hooks/useProviders.ts+++ b/jarvis/ui/web/frontend/src/hooks/useProviders.ts@@ -34,6 +34,28 @@ export interface AltCredential {* doing inference) and the model (its weights) are tracked separately because* they fail separately and need different fixes: install versus download.*/+/**+ * GPU truth for an on-device recognizer: what the config asked for, what the+ * engine will really run on, and why they differ. `reason` is a stable code+ * (`""` when they agree); `installable` says the in-app installer can fix it.+ */+export interface AcceleratorStatus {+ requested: string;+ effective: string;+ reason:+ | ""+ | "not_requested"+ | "unsupported_os"+ | "cuda_libraries_missing"+ | "gpu_probe_failed"+ | "unverified";+ libraries_present: boolean;+ verified: boolean | null;+ installable: boolean;+ /** One honest sentence for the card — render it verbatim. */+ detail: string;+}+export interface LocalRuntimeStatus {runtime: string;engine_installed: boolean;@@ -42,6 +64,8 @@ export interface LocalRuntimeStatus {ready: boolean;/** One honest sentence for the card — render it verbatim. */detail: string;+ /** GPU truth for the CTranslate2 runtime; null for runtimes without a GPU path. */+ accelerator?: AcceleratorStatus | null;}export interface ProviderDescriptor {@@ -863,6 +887,29 @@ export async function localInstallStatus(return body as LocalInstallProgress;}+/**+ * Start (or join) the in-app install of the CUDA runtime libraries the local+ * recognizer needs for the GPU. Returns at once; poll `gpuLibrariesInstallStatus`.+ */+export async function startGpuLibrariesInstall(): Promise<LocalInstallProgress> {+ const res = await fetch("/api/local-gpu/libraries", { method: "POST" });+ const body = await res.json().catch(() => ({}));+ if (!res.ok) {+ throw new Error(body.detail ?? `HTTP ${res.status}`);+ }+ return body as LocalInstallProgress;+}++/** Poll the GPU-library install; `ready` is the on-disk library truth. */+export async function gpuLibrariesInstallStatus(): Promise<LocalInstallProgress> {+ const res = await fetch("/api/local-gpu/libraries/status");+ const body = await res.json().catch(() => ({}));+ if (!res.ok) {+ throw new Error(body.detail ?? `HTTP ${res.status}`);+ }+ return body as LocalInstallProgress;+}+/** Fail-closed readiness of the managed local realtime server. */export interface ManagedServerStatus {ready: boolean;diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.jsonindex 752546229f..f9c5c53321 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json@@ -1211,6 +1211,9 @@"local_installing": "Wird installiert …","local_install_retry": "Erneut versuchen","local_install_hint": "Dabei werden einige Gigabyte geladen, das kann mehrere Minuten dauern. Du kannst die App währenddessen weiter benutzen.",+ "gpu_libraries_install_cta": "GPU-Bibliotheken installieren (ca. 700 MB)",+ "gpu_libraries_installing": "GPU-Bibliotheken werden installiert …",+ "gpu_libraries_install_hint": "Dabei werden einmalig etwa 700 MB geladen. Die lokale Erkennung wechselt beim nächsten Laden auf die GPU – kein Neustart nötig.","managed_check_cta": "Gerät prüfen & installieren","managed_install_cta": "Jetzt installieren","managed_retry": "Installation erneut versuchen",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.jsonindex e0ad679f46..00af73b64e 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json@@ -1211,6 +1211,9 @@"local_installing": "Installing…","local_install_retry": "Try again","local_install_hint": "This downloads a few gigabytes and can take several minutes. You can keep using the app meanwhile.",+ "gpu_libraries_install_cta": "Install GPU libraries (about 700 MB)",+ "gpu_libraries_installing": "Installing GPU libraries…",+ "gpu_libraries_install_hint": "This downloads about 700 MB once. The local recognizer switches to the GPU on its next load — no restart needed.","managed_check_cta": "Check this machine & install","managed_install_cta": "Install now","managed_retry": "Retry install",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.jsonindex 59d0d75e83..b2fde17091 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json@@ -1211,6 +1211,9 @@"local_installing": "Instalando…","local_install_retry": "Reintentar","local_install_hint": "Esto descarga varios gigabytes y puede tardar varios minutos. Mientras tanto puedes seguir usando la aplicación.",+ "gpu_libraries_install_cta": "Instalar bibliotecas de GPU (unos 700 MB)",+ "gpu_libraries_installing": "Instalando bibliotecas de GPU…",+ "gpu_libraries_install_hint": "Esto descarga unos 700 MB una sola vez. El reconocedor local pasa a la GPU en su próxima carga, sin reiniciar.","managed_check_cta": "Comprobar este equipo e instalar","managed_install_cta": "Instalar ahora","managed_retry": "Reintentar la instalación",diff --git a/jarvis/ui/web/provider_routes.py b/jarvis/ui/web/provider_routes.pyindex 8f14137ce0..4314fd5af4 100644--- a/jarvis/ui/web/provider_routes.py+++ b/jarvis/ui/web/provider_routes.py@@ -385,7 +385,10 @@ def _stored_base_url(spec: ProviderSpec) -> str | None:def _local_runtime_payload(- spec: ProviderSpec, *, model_override: str | None = None+ spec: ProviderSpec,+ *,+ model_override: str | None = None,+ requested_device: str = "cpu",) -> dict[str, Any] | None:"""On-disk truth for a provider that runs locally; ``None`` for cloud cards.@@ -405,6 +408,23 @@ def _local_runtime_payload(return Noneif status is None:return None+ accelerator: dict[str, Any] | None = None+ try:+ from jarvis.speech.local_models import accelerator_status++ acc = accelerator_status(status.runtime, requested_device=requested_device)+ if acc is not None:+ accelerator = {+ "requested": acc.requested,+ "effective": acc.effective,+ "reason": acc.reason,+ "libraries_present": acc.libraries_present,+ "verified": acc.verified,+ "installable": acc.installable,+ "detail": acc.detail,+ }+ except Exception as exc: # noqa: BLE001 — the provider list must never 500+ log.debug("Accelerator probe for %s failed (%s); reporting none.", spec.id, exc)return {"runtime": status.runtime,"engine_installed": status.engine_installed,@@ -412,6 +432,9 @@ def _local_runtime_payload("model_label": status.model_label,"ready": status.ready,"detail": status.detail,+ # GPU truth for the CTranslate2 runtime; null for runtimes without a+ # GPU path. Rendered verbatim, like ``detail``.+ "accelerator": accelerator,}@@ -492,6 +515,7 @@ def _spec_to_payload(active_computer_use: str | None = None,active_dictation: str | None = None,local_model_override: str | None = None,+ local_requested_device: str = "cpu",) -> dict[str, Any]:if spec.tier == "brain":active = spec.id == active_brain@@ -623,7 +647,11 @@ def _spec_to_payload(# On-device cards only: whether the engine and its weights are REALLY# here, so the UI can offer the install instead of a false "ready".# ``None`` on every cloud card.- "local_runtime": _local_runtime_payload(spec, model_override=local_model_override),+ "local_runtime": _local_runtime_payload(+ spec,+ model_override=local_model_override,+ requested_device=local_requested_device,+ ),# Self-hosted realtime card only: state of the one-click managed# server install (fail-closed, server sentence rendered verbatim)."managed_server": _managed_server_payload(spec),@@ -1177,10 +1205,17 @@ async def list_providers(request: Request) -> dict[str, Any]:# user who pinned a different Whisper size in jarvis.toml would read a# reassuring "ready" about a model their install never loads.local_model_override: str | None = None+ # The device the config asks the local recognizer for. Read regardless of+ # the active provider: the local card shows GPU truth even while a cloud+ # provider is active, because that is when a person decides to switch.+ local_requested_device = "cpu"try:stt_cfg = getattr(_resolve_cfg(request), "stt", None)if (getattr(stt_cfg, "provider", "") or "").strip() == "faster-whisper":local_model_override = (getattr(stt_cfg, "model", "") or "").strip() or None+ local_requested_device = (+ (getattr(stt_cfg, "device", "") or "cpu").strip().lower() or "cpu"+ )except Exception as exc: # noqa: BLE001 — the provider list must never 500log.debug("Local STT model override lookup failed (%s); using the default.", exc)@@ -1200,6 +1235,7 @@ async def list_providers(request: Request) -> dict[str, Any]:active_computer_use=active_computer_use,active_dictation=active_dictation,local_model_override=local_model_override,+ local_requested_device=local_requested_device,)for spec in PROVIDERS# A hidden spec is withdrawn from the catalog: no card, no CLI@@ -2539,6 +2575,29 @@ async def start_local_install(provider_id: str) -> dict[str, Any]:return result[email protected]("/local-gpu/libraries")+async def start_gpu_libraries_install_route() -> dict[str, Any]:+ """Install the CUDA runtime libraries (cuBLAS/cuDNN) into this app.++ The §3 "recoverable in-app" contract for the GPU: on a desktop with a+ working driver but without these wheels, the local recognizer silently+ falls back to the CPU (the engine self-heals; only a log line says why).+ Returns immediately with a ``state`` the UI polls; a second call while a+ run is in flight joins it.+ """+ from jarvis.speech.local_install import start_gpu_libraries_install++ return await asyncio.to_thread(start_gpu_libraries_install)++[email protected]("/local-gpu/libraries/status")+async def get_gpu_libraries_install_status() -> dict[str, Any]:+ """Progress of the GPU-library install plus the on-disk library truth."""+ from jarvis.speech.local_install import gpu_libraries_install_status++ return await asyncio.to_thread(gpu_libraries_install_status)++@router.get("/providers/{provider_id}/local-install/status")async def get_local_install_status(provider_id: str) -> dict[str, Any]:"""Report install progress AND the independent on-disk readiness probe.diff --git a/pyproject.toml b/pyproject.tomlindex 18cd512e45..ad257fed16 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -468,6 +468,18 @@ local-voice = [# an honest unavailable state when the optional runtime is absent."sherpa-onnx>=1.13.3; sys_platform != 'win32' or platform_machine != 'ARM64'",]+# GPU runtime for the on-device CTranslate2 recognizer (faster-whisper): the+# cuBLAS 12 / cuDNN 9 wheels ctranslate2 4.x links against. Opt-in and OUTSIDE+# [full] on purpose — ~700 MB that only a CUDA desktop can use, and [full] stays+# portable to every cell of the install matrix. Without it the recognizer+# self-heals onto the CPU and the provider card says so (and offers this install+# from inside the app). Mirrored by jarvis/plugins/stt/fwhisper.py::+# GPU_LIBRARY_PACKAGES, which the in-app installer asks pip for; a test pins the+# two together. macOS has no CUDA, hence the marker.+cuda = [+ "nvidia-cublas-cu12>=12.4,<13; sys_platform != 'darwin'",+ "nvidia-cudnn-cu12>=9,<10; sys_platform != 'darwin'",+]# Objective TTS evaluation suite (jarvis/speech/tts_eval): round-trip ASR WER via# faster-whisper (CPU). onnxruntime + numpy are already in base; the DNSMOS MOS# and speaker-drift backends attach their own models at runtime. Opt-in dev/CIdiff --git a/tests/unit/speech/test_gpu_accelerator_status.py b/tests/unit/speech/test_gpu_accelerator_status.pynew file mode 100644index 0000000000..b1c19608b6--- /dev/null+++ b/tests/unit/speech/test_gpu_accelerator_status.py@@ -0,0 +1,182 @@+"""The GPU is used when it exists, and the app says so when it cannot.++What this guards (live 2026-08-22): the desktop app ran on an interpreter+without the cuBLAS/cuDNN wheels, every local model silently self-healed onto+the CPU (36 times in one log), the preview ran on the CPU beside the microphone+thread and the cloud fallback took 48 s for a 70 s recording. Nothing in the+app said why. Now the provider card carries the accelerator truth and offers+the install from inside the app; the ``cuda`` extra and the in-app package+list are pinned to each other.+"""++from __future__ import annotations++import tomllib+from pathlib import Path++import pytest++from jarvis.plugins.stt.fwhisper import GPU_LIBRARY_PACKAGES+from jarvis.speech import local_install, local_models+from jarvis.speech.local_models import accelerator_status++REPO = Path(__file__).resolve().parents[3]+++# --------------------------------------------------------------------------+# The extra and the in-app installer name the same packages+# --------------------------------------------------------------------------+++def test_cuda_extra_mirrors_the_in_app_package_list() -> None:+ pyproject = tomllib.loads((REPO / "pyproject.toml").read_text(encoding="utf-8"))+ extra = pyproject["project"]["optional-dependencies"]["cuda"]+ declared = [line.split(";", 1)[0].strip() for line in extra]+ assert declared == list(GPU_LIBRARY_PACKAGES)+ # macOS has no CUDA; every line carries the marker.+ assert all("sys_platform != 'darwin'" in line for line in extra)+++def test_cuda_extra_stays_out_of_the_full_profile() -> None:+ pyproject = tomllib.loads((REPO / "pyproject.toml").read_text(encoding="utf-8"))+ full = pyproject["project"]["optional-dependencies"]["full"][0]+ bundled = full.split("[", 1)[1].split("]", 1)[0].split(",")+ assert "cuda" not in bundled+++# --------------------------------------------------------------------------+# accelerator_status — every reason code, decided on facts on disk only+# --------------------------------------------------------------------------+++def _force(monkeypatch: pytest.MonkeyPatch, *, libraries: bool, verified: bool | None) -> None:+ import jarvis.plugins.stt as stt_pkg+ import jarvis.plugins.stt.fwhisper as fwhisper++ monkeypatch.setattr(fwhisper, "cuda_runtime_libraries_present", lambda: libraries)+ monkeypatch.setattr(stt_pkg, "wake_gpu_probe_cached", lambda: verified)+ monkeypatch.setattr(local_models.sys, "platform", "win32")+++def test_cpu_as_configured_is_not_a_fallback(monkeypatch: pytest.MonkeyPatch) -> None:+ _force(monkeypatch, libraries=False, verified=None)+ status = accelerator_status("faster-whisper", requested_device="cpu")+ assert status is not None+ assert (status.effective, status.reason, status.installable) == ("cpu", "not_requested", False)+++def test_missing_libraries_are_named_and_installable(monkeypatch: pytest.MonkeyPatch) -> None:+ _force(monkeypatch, libraries=False, verified=None)+ status = accelerator_status("faster-whisper", requested_device="cuda")+ assert status is not None+ assert status.effective == "cpu"+ assert status.reason == "cuda_libraries_missing"+ assert status.installable is True+ assert "CPU" in status.detail+++def test_a_failed_probe_keeps_the_cpu_and_is_not_installable(+ monkeypatch: pytest.MonkeyPatch,+) -> None:+ _force(monkeypatch, libraries=True, verified=False)+ status = accelerator_status("faster-whisper", requested_device="cuda")+ assert status is not None+ assert status.effective == "cpu"+ assert status.reason == "gpu_probe_failed"+ assert status.installable is False+++def test_libraries_present_means_the_gpu_is_used(monkeypatch: pytest.MonkeyPatch) -> None:+ _force(monkeypatch, libraries=True, verified=None)+ unverified = accelerator_status("faster-whisper", requested_device="cuda")+ assert unverified is not None+ assert (unverified.effective, unverified.reason) == ("cuda", "unverified")++ _force(monkeypatch, libraries=True, verified=True)+ verified = accelerator_status("faster-whisper", requested_device="cuda")+ assert verified is not None+ assert (verified.effective, verified.reason) == ("cuda", "")+++def test_macos_has_no_cuda(monkeypatch: pytest.MonkeyPatch) -> None:+ _force(monkeypatch, libraries=True, verified=True)+ monkeypatch.setattr(local_models.sys, "platform", "darwin")+ status = accelerator_status("faster-whisper", requested_device="cuda")+ assert status is not None+ assert (status.effective, status.reason) == ("cpu", "unsupported_os")+++def test_runtimes_without_a_gpu_path_report_nothing(monkeypatch: pytest.MonkeyPatch) -> None:+ _force(monkeypatch, libraries=True, verified=True)+ assert accelerator_status("sherpa-onnx", requested_device="cuda") is None+++# --------------------------------------------------------------------------+# The in-app install: pip per package, then the on-disk truth decides+# --------------------------------------------------------------------------+++def _fresh_run() -> None:+ with local_install._runs_guard:+ local_install._runs.pop(local_install.GPU_LIBRARIES_RUN_KEY, None)+++def test_install_runs_pip_for_every_package_and_verifies(monkeypatch: pytest.MonkeyPatch) -> None:+ import jarvis.plugins.stt as stt_pkg+ import jarvis.plugins.stt.fwhisper as fwhisper+ import jarvis.setup.dependencies as deps++ _fresh_run()+ installed: list[str] = []+ present = {"value": False}+ monkeypatch.setattr(fwhisper, "cuda_runtime_libraries_present", lambda: present["value"])+ forgotten: list[bool] = []+ monkeypatch.setattr(stt_pkg, "forget_gpu_probe_results", lambda: forgotten.append(True))++ # The first verify after the pip runs finds the libraries.+ def _install_and_flip(package: str, **_kw: object) -> tuple[bool, str]:+ installed.append(package)+ present["value"] = True+ return True, "ok"++ monkeypatch.setattr(deps, "install_pip_package", _install_and_flip)+ local_install._run_gpu_libraries_install()++ status = local_install.gpu_libraries_install_status()+ assert installed == list(GPU_LIBRARY_PACKAGES)+ assert status["state"] == "done"+ assert status["ready"] is True+ assert forgotten == [True]+++def test_a_failed_pip_run_is_an_honest_error(monkeypatch: pytest.MonkeyPatch) -> None:+ import jarvis.plugins.stt.fwhisper as fwhisper+ import jarvis.setup.dependencies as deps++ _fresh_run()+ monkeypatch.setattr(deps, "install_pip_package", lambda *_a, **_kw: (False, "no wheel"))+ monkeypatch.setattr(fwhisper, "cuda_runtime_libraries_present", lambda: False)++ local_install._run_gpu_libraries_install()++ status = local_install.gpu_libraries_install_status()+ assert status["state"] == "error"+ assert status["ready"] is False+ assert "no wheel" in status["message"]+++def test_a_finished_install_without_libraries_is_not_a_success(+ monkeypatch: pytest.MonkeyPatch,+) -> None:+ import jarvis.plugins.stt.fwhisper as fwhisper+ import jarvis.setup.dependencies as deps++ _fresh_run()+ monkeypatch.setattr(deps, "install_pip_package", lambda *_a, **_kw: (True, "ok"))+ monkeypatch.setattr(fwhisper, "cuda_runtime_libraries_present", lambda: False)++ local_install._run_gpu_libraries_install()++ status = local_install.gpu_libraries_install_status()+ assert status["state"] == "error"+ assert "still cannot be found" in status["message"]