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
chore: auto-save WIP via Claude stop-hook safety net (2026-07-08 11:12)
Ruben Lütke8cd3a14831d1
diff --git a/jarvis/assets/__init__.py b/jarvis/assets/__init__.pyindex d970d5969d..1f5d9a3013 100644--- a/jarvis/assets/__init__.py+++ b/jarvis/assets/__init__.py@@ -11,11 +11,14 @@ Currently:drags torch) lives only in the ``[local-voice]`` extra, but the model fileitself is torch-free and run via base ``onnxruntime``. Loaded via:func:`bundled_silero_vad_model`.-- ``icons/``: the Windows desktop/taskbar icon (``jarvis.ico``, the Gigi ghost- mascot). Bundled so every Win32 icon surface (window class icon, AUMID icon,- Start-Menu shortcut, taskbar name) can find it regardless of how the package- was installed. Loaded via :func:`bundled_app_icon`. Byte-identical to the- build-tool copy at ``<repo-root>/assets/icons/jarvis.ico`` (kept in sync by+- ``icons/``: the desktop/taskbar icon (the Gigi ghost mascot), in two formats:+ ``jarvis.ico`` for every Win32 icon surface (window class icon, AUMID icon,+ Start-Menu + autostart shortcut, taskbar name) and ``jarvis.png`` for the+ Linux XDG ``.desktop`` ``Icon=`` key (most Linux desktops cannot render+ ``.ico``). Bundled so both can be found regardless of how the package was+ installed. Loaded via :func:`bundled_app_icon` / :func:`bundled_app_icon_png`.+ The ``.ico`` is byte-identical to the build-tool copy at+ ``<repo-root>/assets/icons/jarvis.ico`` (kept in sync by``tests/unit/ui/test_icon_identity.py``).Future bundles (e.g. packaged voice clips) live under this package.@@ -35,6 +38,7 @@ _SILERO_VAD_FILE = "silero_vad.onnx"_ICONS_DIR = Path(__file__).resolve().parent / "icons"_APP_ICON_FILE = "jarvis.ico"+_APP_ICON_PNG_FILE = "jarvis.png"def bundled_wakeword_models() -> dict[str, Path] | None:@@ -95,8 +99,25 @@ def bundled_app_icon() -> Path | None:return path if path.is_file() else None+def bundled_app_icon_png() -> Path | None:+ """Return the absolute path to the bundled ``jarvis.png``, or ``None``.++ The Linux counterpart to :func:`bundled_app_icon`. Linux desktops read the+ autostart/menu entry's icon from the ``.desktop`` ``Icon=`` key, and most of+ them (and the XDG icon cache) cannot decode a Windows ``.ico`` — they need a+ PNG (or SVG). Without a bundled PNG the ``.desktop`` entry, and therefore the+ taskbar/dock button of the running window, falls back to the generic+ interpreter icon (``python3``) — the Linux face of the same "shows Python,+ not Jarvis" report. Resolved fresh from the installed package so the absolute+ path baked into the ``.desktop`` is correct on any install layout.+ """+ path = _ICONS_DIR / _APP_ICON_PNG_FILE+ return path if path.is_file() else None++__all__ = ["bundled_wakeword_models","bundled_silero_vad_model","bundled_app_icon",+ "bundled_app_icon_png",]diff --git a/jarvis/assets/icons/jarvis.png b/jarvis/assets/icons/jarvis.pngnew file mode 100644index 0000000000..c2158807deBinary files /dev/null and b/jarvis/assets/icons/jarvis.png differdiff --git a/jarvis/autostart/linux.py b/jarvis/autostart/linux.pyindex cfa1cebdb5..be9c5e4dca 100644--- a/jarvis/autostart/linux.py+++ b/jarvis/autostart/linux.py@@ -22,6 +22,30 @@ log = logging.getLogger(__name__)_ENTRY_NAME = "personal-jarvis.desktop"_APP_NAME = "Personal Jarvis"+# The X11/Wayland window-class token the running window is pinned to (see+# ``jarvis.ui.icon_utils.pin_linux_wm_class``). ``StartupWMClass`` must match it+# for the desktop to map the running window to THIS .desktop entry — and thus+# show its ``Icon=`` on the taskbar/dock instead of the generic python3 icon.+_WM_CLASS = "personal-jarvis"+++def _icon_value() -> str | None:+ """Absolute path to the bundled PNG for the ``Icon=`` key, or ``None``.++ Linux desktops read the launcher/menu/taskbar icon from ``Icon=`` and mostly+ cannot decode a Windows ``.ico`` — so we ship and point at ``jarvis.png``.+ Resolved fresh from the installed package (so the baked absolute path is+ correct on any layout); a partial checkout without the PNG simply omits the+ key (the entry still works, just unbranded — never a crash).+ """+ try:+ from jarvis.assets import bundled_app_icon_png++ png = bundled_app_icon_png()+ return str(png) if png is not None else None+ except Exception as exc: # noqa: BLE001 — a missing icon must never block autostart+ log.debug("Linux autostart icon could not be resolved: %s", exc)+ return Nonedef _autostart_dir() -> Path:@@ -39,6 +63,8 @@ def _exec_value(spec: LaunchSpec) -> str:def _render(spec: LaunchSpec) -> str:+ icon = _icon_value()+ icon_line = f"Icon={icon}\n" if icon else ""return ("[Desktop Entry]\n""Type=Application\n"@@ -47,6 +73,8 @@ def _render(spec: LaunchSpec) -> str:f"Exec={_exec_value(spec)}\n"f"Path={spec.working_dir}\n""Terminal=false\n"+ f"{icon_line}"+ f"StartupWMClass={_WM_CLASS}\n""X-GNOME-Autostart-enabled=true\n""Hidden=false\n")diff --git a/jarvis/autostart/windows.py b/jarvis/autostart/windows.pyindex 013de96ec0..55384344c7 100644--- a/jarvis/autostart/windows.py+++ b/jarvis/autostart/windows.py@@ -172,13 +172,22 @@ def parse_task_query(stdout: str) -> _TaskInfo | None:return _TaskInfo(execute=fields[0], arguments=fields[1], working_dir=fields[2])-def build_create_script(link: Path, spec: LaunchSpec) -> str:+def build_create_script(link: Path, spec: LaunchSpec, *, icon: str | None = None) -> str:"""Pure: the PowerShell script that creates/refreshes the fallback ``.lnk``.WindowStyle 7 = minimized (tray-friendly), 1 = normal/visible.++ ``icon`` is the absolute path to ``jarvis.ico``. When given, the shortcut+ carries ``IconLocation`` so the taskbar button is branded with the Jarvis+ icon from the moment the app autostarts — instead of the bare ``pythonw.exe``+ Python logo. Without it (the historical behaviour) an autostart launch on a+ box where the elevated scheduled task was UAC-declined shows the Python logo,+ because this fallback shortcut is then the only launch entry point and the+ runtime class-icon setter is still racing (see the taskbar-icon bug report)."""window_style = 7 if spec.minimized else 1args = " ".join(spec.args)+ icon_line = f"$sc.IconLocation = '{icon},0'\n" if icon else ""return ("$ErrorActionPreference = 'Stop'\n""$ws = New-Object -ComObject WScript.Shell\n"@@ -187,6 +196,7 @@ def build_create_script(link: Path, spec: LaunchSpec) -> str:f"$sc.Arguments = '{args}'\n"f"$sc.WorkingDirectory = '{spec.working_dir}'\n""$sc.Description = 'Personal Jarvis (Autostart)'\n"+ f"{icon_line}"f"$sc.WindowStyle = {window_style}\n""$sc.Save()\n")@@ -209,6 +219,55 @@ def build_read_script(link: Path) -> str:# --------------------------------------------------------------------------- #+def _resolve_app_icon() -> str | None:+ """Absolute ``jarvis.ico`` path for the shortcut, or ``None`` if unresolved.++ Lazy import (never at module scope, HN-7): keeps this Windows-only module+ free of a UI import on other OSes and off the boot critical path. Returns the+ same install-layout-agnostic path every other Win32 icon surface uses.+ """+ try:+ from jarvis.ui.icon_utils import project_icon_path++ ico = project_icon_path()+ return str(ico) if ico.is_file() else None+ except Exception as exc: # noqa: BLE001 — a missing icon must never block autostart+ log.debug("autostart shortcut icon could not be resolved: %s", exc)+ return None+++def _tag_shortcut_aumid(link: Path) -> bool:+ """Best-effort: write the app AUMID into ``link``'s property store.++ Mirrors ``scripts/install_shortcuts._set_shortcut_app_id`` (the proven path).+ Lazy pywin32 import in a try/except: on a host without pywin32 this is a+ silent no-op — the ``IconLocation`` set by :func:`build_create_script` is the+ load-bearing fix, the AUMID is a reinforcement that keeps this shortcut from+ diverging from the Start-Menu one. Never raises, never blocks autostart.+ """+ try:+ import pywintypes # type: ignore[import-not-found]+ from win32com.propsys import propsys, pscon # type: ignore[import-not-found]++ from jarvis.ui.icon_utils import APP_USER_MODEL_ID++ store = propsys.SHGetPropertyStoreFromParsingName(+ str(link),+ None,+ 2, # GPS_READWRITE+ pywintypes.IID("{886D8EEB-8CF2-4446-8D02-CDBA1DBDCF99}"), # IID_IPropertyStore+ )+ store.SetValue(+ pscon.PKEY_AppUserModel_ID,+ propsys.PROPVARIANTType(APP_USER_MODEL_ID),+ )+ store.Commit()+ return True+ except Exception as exc: # noqa: BLE001 — pywin32 absent / COM failure → icon-only fallback+ log.debug("autostart shortcut AUMID not tagged (non-fatal): %s", exc)+ return False++def _run_powershell(script: str) -> subprocess.CompletedProcess[str]:return subprocess.run(["powershell", "-NoProfile", "-ExecutionPolicy", "Bypass", "-Command", script],@@ -435,7 +494,12 @@ class WindowsAutostart:def _default_write_shortcut(self, spec: LaunchSpec) -> None:self._path.parent.mkdir(parents=True, exist_ok=True)self._remove_legacy()- _run_powershell(build_create_script(self._path, spec))+ _run_powershell(build_create_script(self._path, spec, icon=_resolve_app_icon()))+ # Tag the shortcut with the SAME AUMID as the Start-Menu shortcut so the+ # two same-named .lnk files don't diverge and confuse the shell's taskbar+ # button resolution (best-effort; a box without pywin32 still gets the+ # icon above, which is the load-bearing visual fix).+ _tag_shortcut_aumid(self._path)log.info("Windows autostart shortcut (fallback) written: %s", self._path)def _default_remove_shortcut(self) -> None:diff --git a/jarvis/core/config_writer.py b/jarvis/core/config_writer.pyindex f51f9378b4..66eadb53b6 100644--- a/jarvis/core/config_writer.py+++ b/jarvis/core/config_writer.py@@ -551,6 +551,18 @@ def set_voice_mode(mode: str, *, path: Path = DEFAULT_CONFIG_FILE) -> None:_patch_table(path, "voice", "mode", mode)+def set_realtime_provider(provider: str, *, path: Path = DEFAULT_CONFIG_FILE) -> None:+ """Persist the active realtime-voice provider to ``[brain.realtime] provider``.++ ``provider`` is a realtime-tier id (e.g. ``"openai-realtime"``). TOML-only+ by design: ``brain.realtime`` is NOT in the drift-guard's reference+ snapshot, so it is never reverted (same rationale as :func:`set_voice_mode`).+ Takes effect on the next voice session / restart — the realtime client is+ not wired in yet (Phase 2).+ """+ _patch_realtime_provider_toml(path, provider)++def set_silence_window_ms(ms: int, *, path: Path = DEFAULT_CONFIG_FILE) -> None:"""Persist the voice silence window to ``[speech] vad_silence_ms`` in jarvis.toml.@@ -1261,6 +1273,41 @@ def _patch_worker_provider_toml(path: Path, name: str) -> None:_atomic_write(path, out)+def _patch_realtime_provider_toml(path: Path, name: str) -> None:+ """Set ``[brain.realtime] provider = name`` in the TOML.++ Unlike :func:`_patch_table`, this walks the NESTED ``brain`` -> ``realtime``+ path instead of treating ``"brain.realtime"`` as a flat top-level key+ (``doc.get("brain.realtime")`` would create a literal dotted key, not the+ ``[brain.realtime]`` section) — mirrors :func:`_patch_worker_provider_toml`.+ Creates either level if missing. Preserves comments, sibling keys, and the+ optional BOM.+ """+ path = _ensure_writable_config_path(path)++ with _WRITE_LOCK:+ raw = path.read_text(encoding="utf-8")+ had_bom = raw.startswith(_BOM)+ if had_bom:+ raw = raw[len(_BOM) :]+ doc: TOMLDocument = tomlkit.parse(raw)++ brain = doc.get("brain")+ if brain is None:+ brain = tomlkit.table()+ doc["brain"] = brain+ realtime = brain.get("realtime")+ if realtime is None:+ realtime = tomlkit.table()+ brain["realtime"] = realtime+ realtime["provider"] = name++ out = tomlkit.dumps(doc)+ if had_bom:+ out = _BOM + out+ _atomic_write(path, out)++def _patch_worker_key_toml(path: Path, key: str, value: object) -> None:"""Set one key under the nested ``[brain.worker]`` table.diff --git a/jarvis/ui/desktop_app.py b/jarvis/ui/desktop_app.pyindex d515b2f92d..904809a831 100644--- a/jarvis/ui/desktop_app.py+++ b/jarvis/ui/desktop_app.py@@ -2942,6 +2942,16 @@ class DesktopApp:gui = "edgechromium" if sys.platform == "win32" else Nonedebug = os.environ.get("JARVIS_WEBVIEW_DEBUG") == "1"+ # Linux: pin the window's WM_CLASS to match the .desktop's StartupWMClass+ # BEFORE the GTK window is created, so the taskbar/dock shows the Jarvis+ # icon instead of the generic python3 interpreter icon. No-op elsewhere.+ try:+ from jarvis.ui.icon_utils import pin_linux_wm_class++ pin_linux_wm_class()+ except Exception: # noqa: BLE001 — the WM-class pin is never load-bearing+ pass+# Native file drag-out: dragging a saved-download toast drops the REAL# file into any app (Explorer, a browser upload zone, a chat). Must be# installed BEFORE webview.start() — it patches the WebView2 UI-threaddiff --git a/jarvis/ui/icon_utils.py b/jarvis/ui/icon_utils.pyindex 145b3d94fd..36b09aede5 100644--- a/jarvis/ui/icon_utils.py+++ b/jarvis/ui/icon_utils.py@@ -388,6 +388,39 @@ def set_window_icon_for_pid(pid: int, ico_path: Path) -> bool:return _apply_icon_to_hwnd(best[0], ico_path)+# The Linux window-class token the XDG ``.desktop`` pins via ``StartupWMClass``+# (jarvis/autostart/linux.py). Keep the two in lock-step: the desktop maps a+# running window to its launcher entry — and thus shows the entry's ``Icon=`` on+# the taskbar/dock — only when the window's WM_CLASS matches ``StartupWMClass``.+LINUX_WM_CLASS = "personal-jarvis"+++def pin_linux_wm_class(name: str = LINUX_WM_CLASS) -> bool:+ """Pin the X11/Wayland window-class of subsequently-created windows.++ Must run BEFORE the GUI toolkit creates its first window. Without it, a+ ``python3 -m …`` launch leaves the window's WM_CLASS as ``python3`` — so the+ Linux taskbar/dock shows the generic interpreter icon even when the+ ``.desktop`` entry carries the Jarvis ``Icon=`` (they only bind when the+ WM_CLASS matches ``StartupWMClass``). Sets GLib's program name, which GTK+ (pywebview's default Linux backend) uses to derive WM_CLASS.++ No-op on non-Linux and best-effort on Linux (a Qt backend or missing PyGObject+ derives its class differently): never raises, so it can never block the+ window. Returns ``True`` only when the program name was set.+ """+ if sys.platform != "linux":+ return False+ try:+ from gi.repository import GLib # type: ignore[import-not-found]++ GLib.set_prgname(name)+ return True+ except Exception as exc: # noqa: BLE001 — WM-class pin is a nicety, never load-bearing+ logger.debug("Linux WM_CLASS could not be pinned: {}", exc)+ return False++def load_ico_as_pil_image(ico_path: Path, size: int = 64) -> Any | None:"""Loads a ``.ico`` as a ``PIL.Image`` for the pystray tray icon.diff --git a/jarvis/ui/web/provider_routes.py b/jarvis/ui/web/provider_routes.pyindex 29cb563a7f..61c8ce5c07 100644--- a/jarvis/ui/web/provider_routes.py+++ b/jarvis/ui/web/provider_routes.py@@ -7,7 +7,7 @@ Endpoints:POST /api/brain/switch → aktiven Brain-Provider wechseln (+ persist)POST /api/tts/switch → aktiven TTS-Provider wechseln (persist in jarvis.toml)POST /api/stt/switch → aktiven STT-Provider wechseln (persist in jarvis.toml)- POST /api/realtime/switch → aktiven Realtime-Provider wechseln (persist in jarvis.toml)+ POST /api/realtime/switch → aktiven Realtime-Provider wechseln (persist)POST /api/subagent/switch → aktiven Subagent-Provider wechseln (3-layer persist)Wird vom WebServer in `_build_app()` eingehängt:@@ -275,11 +275,14 @@ def _spec_to_payload(active_brain: str | None,active_tts: str | None,active_stt: str | None,+ active_realtime: str | None = None,) -> dict[str, Any]:if spec.tier == "brain":active = spec.id == active_brainelif spec.tier == "tts":active = spec.id == active_tts+ elif spec.tier == "realtime":+ active = spec.id == active_realtimeelse:active = spec.id == active_stt@@ -410,6 +413,24 @@ def _active_stt(request: Request) -> str | None:return configured+def _active_realtime(request: Request) -> str | None:+ """The active realtime-voice provider.++ Realtime is OpenAI-only today (a single spec in ``PROVIDERS``), so an unset+ ``cfg.brain.realtime.provider`` still defaults to ``"openai-realtime"`` — the+ sole card shows as active instead of a confusing "nothing selected" state.+ Never raises: any resolver error falls back to the default id.+ """+ try:+ cfg = _resolve_cfg(request)+ realtime_cfg = getattr(getattr(cfg, "brain", None), "realtime", None)+ provider = (getattr(realtime_cfg, "provider", None) or "").strip()+ return provider or "openai-realtime"+ except Exception as exc: # noqa: BLE001 — the health panel must never 500+ log.debug("active-realtime resolution failed (%s); using default.", exc)+ return "openai-realtime"++def _resolve_cfg(request: Request):"""Liefert die JarvisConfig.@@ -511,6 +532,7 @@ async def list_providers(request: Request) -> dict[str, Any]:active_brain = _active_brain(request)active_tts = _active_tts(request)active_stt = _active_stt(request)+ active_realtime = _active_realtime(request)providers = [_spec_to_payload(@@ -518,6 +540,7 @@ async def list_providers(request: Request) -> dict[str, Any]:active_brain=active_brain,active_tts=active_tts,active_stt=active_stt,+ active_realtime=active_realtime,)for spec in PROVIDERS]@@ -757,6 +780,34 @@ def _jarvis_agent_section_health(cfg: Any) -> SectionHealth:)+def _realtime_section_health(request: Request) -> SectionHealth:+ """Realtime tab: credential-presence ONLY — there is no realtime+ provider-test yet (the client is not wired in, Phase 2), so this never+ calls ``run_provider_test``. Mirrors the shape of ``_tier_section_health``+ without the live connectivity probe.+ """+ spec = get_spec(_active_realtime(request) or "")+ if spec is None:+ return SectionHealth(+ status=_section_health.NEEDS_SETUP,+ reason="no_active",+ detail="No active provider selected",+ )+ try:+ configured = _is_credential_present(spec)+ except Exception: # noqa: BLE001 — a probe failure is "not set up", not a crash+ configured = False+ if configured:+ return SectionHealth(+ status=_section_health.OK, reason="ok", detail=f"{spec.label}: ready"+ )+ return SectionHealth(+ status=_section_health.NEEDS_SETUP,+ reason="not_configured",+ detail=f"{spec.label}: no key set",+ )++def _advanced_section_health(request: Request) -> SectionHealth:"""Advanced tab: every integration here is OPTIONAL, so it never reports``needs_setup`` — only ``error`` when something the user actually configured@@ -803,7 +854,7 @@ async def section_health(request: Request, refresh: bool = False) -> SectionHealsections: dict[str, SectionHealth] = {}if cfg is None:- for key in ("brain", "tts", "stt", "subagents", "advanced"):+ for key in ("brain", "tts", "stt", "realtime", "subagents", "advanced"):sections[key] = SectionHealth(status=_section_health.UNKNOWN,reason="unavailable",@@ -818,6 +869,11 @@ async def section_health(request: Request, refresh: bool = False) -> SectionHeal_tier_section_health(cfg, tts_spec),_tier_section_health(cfg, stt_spec),)+ try:+ sections["realtime"] = _realtime_section_health(request)+ except Exception as exc: # noqa: BLE001+ log.warning("section-health realtime check failed: %s", exc)+ sections["realtime"] = SectionHealth()try:sections["subagents"] = _jarvis_agent_section_health(cfg)except Exception as exc: # noqa: BLE001@@ -1916,6 +1972,67 @@ async def stt_switch(body: SwitchBody, request: Request) -> dict[str, Any]:}[email protected]("/realtime/switch")+async def realtime_switch(body: SwitchBody, request: Request) -> dict[str, Any]:+ """Wechselt den aktiven Realtime-Voice-Provider. Persistiert in jarvis.toml.++ Mirrors ``stt_switch``: no live switch — the realtime engine is only+ selected once the browser realtime client is actually wired in (Phase 2),+ so the choice always needs a restart to take effect. Realtime is+ OpenAI-only today (a single spec in ``PROVIDERS``), so this rejects any+ non-realtime provider id up front.+ """+ spec = get_spec(body.provider)+ if spec is None:+ raise HTTPException(+ status_code=404, detail=f"Unbekannter Provider: {body.provider}"+ )+ if spec.tier != "realtime":+ raise HTTPException(+ status_code=400,+ detail=f"Provider '{body.provider}' ist kein Realtime-Provider (tier={spec.tier})",+ )+ if not _is_credential_present(spec):+ raise HTTPException(+ status_code=409,+ detail=f"Provider '{body.provider}' hat keine Credentials — erst API-Key setzen.",+ )++ if body.persist:+ try:+ from jarvis.core.config_writer import set_realtime_provider++ set_realtime_provider(body.provider)+ except FileNotFoundError as exc:+ raise HTTPException(status_code=500, detail=str(exc)) from exc+ except Exception as exc: # noqa: BLE001+ raise HTTPException(+ status_code=500, detail=f"TOML-Write fehlgeschlagen: {exc}"+ ) from exc++ cfg = _resolve_cfg(request)+ if cfg is not None and getattr(cfg, "brain", None) is not None:+ try:+ realtime_cfg = getattr(cfg.brain, "realtime", None)+ if realtime_cfg is None:+ from jarvis.core.config import BrainTierConfig++ cfg.brain.realtime = BrainTierConfig(provider=body.provider)+ else:+ realtime_cfg.provider = body.provider+ except Exception as exc: # noqa: BLE001 — frozen/detached cfg is not an error+ log.debug("In-memory realtime.provider update skipped: %s", exc)++ await _emit(request, SecretConfigured(key="brain.realtime.provider", action="set"))++ return {+ "ok": True,+ "active": body.provider,+ "persisted": body.persist,+ "restart_required": True,+ }++@router.post("/jarvis-agent/switch")async def jarvis_agent_switch(body: SwitchBody, request: Request) -> dict[str, Any]:"""Wechselt den aktiven SUBAGENT-Provider (``[brain.sub_jarvis].provider``).diff --git a/tests/integration/test_provider_routes.py b/tests/integration/test_provider_routes.pyindex 72b862dd44..1be70c0067 100644--- a/tests/integration/test_provider_routes.py+++ b/tests/integration/test_provider_routes.py@@ -164,7 +164,9 @@ def test_section_health_returns_all_tabs(resp = client.get("/api/providers/section-health")assert resp.status_code == 200body = resp.json()- assert set(body["sections"]) == {"brain", "tts", "stt", "subagents", "advanced"}+ assert set(body["sections"]) == {+ "brain", "tts", "stt", "realtime", "subagents", "advanced",+ }valid = {"ok", "needs_setup", "error", "unknown"}for sec in body["sections"].values():assert sec["status"] in validdiff --git a/tests/unit/autostart/test_linux.py b/tests/unit/autostart/test_linux.pyindex 274182639f..073f76684c 100644--- a/tests/unit/autostart/test_linux.py+++ b/tests/unit/autostart/test_linux.py@@ -35,6 +35,21 @@ def test_install_writes_desktop_entry(monkeypatch, tmp_path: Path) -> None:assert status.matches_spec is True+def test_install_brands_entry_with_icon_and_wmclass(monkeypatch, tmp_path: Path) -> None:+ """The .desktop must carry an Icon= (the bundled PNG) and a StartupWMClass so+ the app menu / taskbar shows Jarvis, not the generic python3 interpreter icon."""+ from jarvis.assets import bundled_app_icon_png++ monkeypatch.setenv("XDG_CONFIG_HOME", str(tmp_path))+ LinuxAutostart().install(_spec())+ text = (tmp_path / "autostart" / "personal-jarvis.desktop").read_text(encoding="utf-8")++ png = bundled_app_icon_png()+ assert png is not None, "bundled jarvis.png must ship for the Linux Icon= key"+ assert f"Icon={png}" in text+ assert "StartupWMClass=personal-jarvis" in text++def test_status_detects_path_drift(monkeypatch, tmp_path: Path) -> None:monkeypatch.setenv("XDG_CONFIG_HOME", str(tmp_path))mgr = LinuxAutostart()diff --git a/tests/unit/autostart/test_windows_scripts.py b/tests/unit/autostart/test_windows_scripts.pyindex 43401ba135..259ce62aae 100644--- a/tests/unit/autostart/test_windows_scripts.py+++ b/tests/unit/autostart/test_windows_scripts.py@@ -43,3 +43,17 @@ def test_read_script_emits_three_sentinel_lines() -> None:assert "$sc.TargetPath" in scriptassert "$sc.Arguments" in scriptassert "$sc.WorkingDirectory" in script+++def test_create_script_embeds_icon_when_given() -> None:+ """The autostart .lnk must carry the Jarvis icon so the taskbar button is+ branded from first paint — not the bare pythonw.exe Python logo."""+ ico = r"C:\Users\u\Personal Jarvis\jarvis\assets\icons\jarvis.ico"+ script = build_create_script(Path(r"C:\startup\Personal Jarvis.lnk"), _spec(), icon=ico)+ assert f"$sc.IconLocation = '{ico},0'" in script+++def test_create_script_omits_icon_line_without_icon() -> None:+ """Back-compat: no icon given → no IconLocation line (never an empty ',0')."""+ script = build_create_script(Path(r"C:\startup\Personal Jarvis.lnk"), _spec())+ assert "IconLocation" not in scriptdiff --git a/tests/unit/ui/test_icon_identity.py b/tests/unit/ui/test_icon_identity.pyindex 9312a93d15..b063df506d 100644--- a/tests/unit/ui/test_icon_identity.py+++ b/tests/unit/ui/test_icon_identity.py@@ -118,6 +118,20 @@ def test_bundled_icon_is_byte_identical_to_repo_root_copy() -> None:)+def test_bundled_app_icon_png_exists_for_linux() -> None:+ """Linux's .desktop Icon= needs a PNG (most desktops can't render .ico).++ Platform-neutral on purpose: the bug is about file *presence*, which must hold+ on every OS / CI runner. Without it the Linux autostart/menu entry — and the+ running window's taskbar button — falls back to the generic python3 icon.+ """+ from jarvis.assets import bundled_app_icon_png++ png = bundled_app_icon_png()+ assert png is not None and png.is_file()+ assert png.as_posix().endswith("jarvis/assets/icons/jarvis.png")++def test_app_display_name_is_personal_jarvis() -> None:assert APP_DISPLAY_NAME == "Personal Jarvis"# The grouping key itself stays the stable PascalCase AUMID.diff --git a/tests/unit/web/test_realtime_provider_category.py b/tests/unit/web/test_realtime_provider_category.pynew file mode 100644index 0000000000..7ab9625e21--- /dev/null+++ b/tests/unit/web/test_realtime_provider_category.py@@ -0,0 +1,183 @@+"""Realtime provider tier — backend for the API-Keys & Providers "Realtime" tab.++Mirrors the brain/tts/stt tier plumbing: a ProviderSpec (``openai-realtime``,+the only realtime provider today — Gemini Live is not implemented), the+``active_realtime`` resolution in ``list_providers``, the credential-presence+section-health check, and the ``POST /realtime/switch`` route. Style follows+``tests/unit/web/test_voice_mode_route.py`` (a lightweight FastAPI app with+just the router mounted, monkeypatched secrets) rather than the heavier+``WebServer`` fixture in ``tests/integration/test_provider_routes.py``.+"""+from __future__ import annotations++from pathlib import Path++from fastapi import FastAPI+from fastapi.testclient import TestClient++from jarvis.core import config as cfg_mod+from jarvis.core import config_writer+from jarvis.core.config import JarvisConfig+from jarvis.ui.web.provider_routes import router+from jarvis.ui.web.provider_spec import get_spec+++def _only_openai_key(key: str, *_a, **_kw) -> str | None:+ """Fake ``cfg_mod.get_secret``: only ``openai_api_key`` looks configured."""+ return "sk-test" if key == "openai_api_key" else None++# ---------------------------------------------------------------------------+# ProviderSpec+# ---------------------------------------------------------------------------+++def test_openai_realtime_spec_is_realtime_tier_with_openai_key():+ spec = get_spec("openai-realtime")+ assert spec is not None+ assert spec.tier == "realtime"+ assert "openai_api_key" in spec.secret_keys+++# ---------------------------------------------------------------------------+# GET /api/providers+# ---------------------------------------------------------------------------+++def _app() -> FastAPI:+ app = FastAPI()+ app.include_router(router)+ app.state.config = JarvisConfig()+ return app+++def test_list_providers_includes_active_realtime_provider(monkeypatch):+ monkeypatch.setattr(cfg_mod, "get_secret", _only_openai_key)+ client = TestClient(_app())+ resp = client.get("/api/providers")+ assert resp.status_code == 200+ by_id = {p["id"]: p for p in resp.json()["providers"]}+ assert "openai-realtime" in by_id+ realtime = by_id["openai-realtime"]+ assert realtime["tier"] == "realtime"+ # No explicit brain.realtime.provider set -> defaults to the sole spec,+ # so the only realtime card shows as active rather than "nothing selected".+ assert realtime["active"] is True+ assert realtime["configured"] is True+++# ---------------------------------------------------------------------------+# POST /api/realtime/switch+# ---------------------------------------------------------------------------+++def test_realtime_switch_persists_with_key(monkeypatch):+ monkeypatch.setattr(cfg_mod, "get_secret", _only_openai_key)+ writes: list[str] = []+ monkeypatch.setattr(+ config_writer, "set_realtime_provider", lambda name, **kw: writes.append(name)+ )++ app = _app()+ client = TestClient(app)+ resp = client.post(+ "/api/realtime/switch", json={"provider": "openai-realtime", "persist": True}+ )+ assert resp.status_code == 200+ body = resp.json()+ assert body["ok"] is True+ assert body["active"] == "openai-realtime"+ assert body["persisted"] is True+ assert body["restart_required"] is True+ assert writes == ["openai-realtime"]+ assert app.state.config.brain.realtime is not None+ assert app.state.config.brain.realtime.provider == "openai-realtime"+++def test_realtime_switch_without_key_is_409(monkeypatch):+ monkeypatch.setattr(cfg_mod, "get_secret", lambda *a, **kw: None)+ client = TestClient(_app())+ resp = client.post(+ "/api/realtime/switch", json={"provider": "openai-realtime", "persist": True}+ )+ assert resp.status_code == 409+++def test_realtime_switch_rejects_non_realtime_provider(monkeypatch):+ monkeypatch.setattr(cfg_mod, "get_secret", lambda key, *a, **kw: "sk-test")+ client = TestClient(_app())+ resp = client.post("/api/realtime/switch", json={"provider": "openai", "persist": True})+ assert resp.status_code == 400+++def test_realtime_switch_unknown_provider_is_404(monkeypatch):+ monkeypatch.setattr(cfg_mod, "get_secret", lambda *a, **kw: None)+ client = TestClient(_app())+ resp = client.post("/api/realtime/switch", json={"provider": "does-not-exist", "persist": True})+ assert resp.status_code == 404+++# ---------------------------------------------------------------------------+# GET /api/providers/section-health+# ---------------------------------------------------------------------------+++def test_section_health_includes_realtime_key(monkeypatch):+ from jarvis.brain import provider_test as _pt++ async def _fake_run(spec, cfg):+ from types import SimpleNamespace++ return SimpleNamespace(status="ok", detail="")++ monkeypatch.setattr(_pt, "run_provider_test", _fake_run)+ monkeypatch.setattr(cfg_mod, "get_secret", _only_openai_key)+ client = TestClient(_app())+ resp = client.get("/api/providers/section-health")+ assert resp.status_code == 200+ sections = resp.json()["sections"]+ assert "realtime" in sections+ assert sections["realtime"]["status"] == "ok"+++def test_section_health_realtime_needs_setup_without_key(monkeypatch):+ from jarvis.brain import provider_test as _pt++ async def _fake_run(spec, cfg):+ from types import SimpleNamespace++ return SimpleNamespace(status="ok", detail="")++ monkeypatch.setattr(_pt, "run_provider_test", _fake_run)+ monkeypatch.setattr(cfg_mod, "get_secret", lambda *a, **kw: None)+ client = TestClient(_app())+ resp = client.get("/api/providers/section-health")+ sections = resp.json()["sections"]+ assert sections["realtime"]["status"] == "needs_setup"+++# ---------------------------------------------------------------------------+# config_writer.set_realtime_provider+# ---------------------------------------------------------------------------+++def test_set_realtime_provider_writes_nested_table(tmp_path: Path):+ toml = tmp_path / "jarvis.toml"+ toml.write_text("", encoding="utf-8")+ config_writer.set_realtime_provider("openai-realtime", path=toml)+ content = toml.read_text(encoding="utf-8")+ assert "[brain.realtime]" in content+ assert 'provider = "openai-realtime"' in content+++def test_set_realtime_provider_preserves_sibling_worker_table(tmp_path: Path):+ toml = tmp_path / "jarvis.toml"+ toml.write_text(+ '[brain.worker]\nprovider = "claude-api"\n',+ encoding="utf-8",+ )+ config_writer.set_realtime_provider("openai-realtime", path=toml)+ content = toml.read_text(encoding="utf-8")+ assert '[brain.worker]' in content+ assert 'provider = "claude-api"' in content+ assert '[brain.realtime]' in content+ assert 'provider = "openai-realtime"' in content