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
fix(appshot): say when Downloads access is denied on the corner card
rubenluetke10-beep3b7a6e13c6e8
diff --git a/jarvis/appshot/card_actions.py b/jarvis/appshot/card_actions.pyindex a872689663..b46c3834c2 100644--- a/jarvis/appshot/card_actions.py+++ b/jarvis/appshot/card_actions.py@@ -23,6 +23,7 @@ import asyncioimport base64import ioimport logging+import sysimport timefrom pathlib import Pathfrom typing import Any@@ -42,6 +43,8 @@ _LABELS: dict[str, dict[str, str]] = {"copied": "Copied","saved": "Saved to Downloads","failed": "That did not work",+ "no_access": "No permission to save in Downloads",+ "no_access_mac": "Allow Downloads in Privacy & Security > Files and Folders","gone": "No longer kept","text_copied": "Text copied","no_text": "No text found",@@ -57,6 +60,8 @@ _LABELS: dict[str, dict[str, str]] = {"copied": "Kopiert", # i18n-allow: product UI string"saved": "In Downloads gespeichert", # i18n-allow: product UI string"failed": "Das hat nicht geklappt", # i18n-allow: product UI string+ "no_access": "Keine Berechtigung für Downloads", # i18n-allow: product UI string+ "no_access_mac": "Downloads in Dateien und Ordner erlauben", # i18n-allow: UI"gone": "Nicht mehr aufbewahrt", # i18n-allow: product UI string"text_copied": "Text kopiert", # i18n-allow: product UI string"no_text": "Kein Text gefunden", # i18n-allow: product UI string@@ -72,6 +77,8 @@ _LABELS: dict[str, dict[str, str]] = {"copied": "Copiado", # i18n-allow: product UI string"saved": "Guardado en Descargas", # i18n-allow: product UI string"failed": "No ha funcionado", # i18n-allow: product UI string+ "no_access": "Sin permiso para guardar en Descargas", # i18n-allow: product UI string+ "no_access_mac": "Permite Descargas en Archivos y carpetas", # i18n-allow: UI"gone": "Ya no se conserva", # i18n-allow: product UI string"text_copied": "Texto copiado", # i18n-allow: product UI string"no_text": "No se encontró texto", # i18n-allow: product UI string@@ -186,6 +193,11 @@ async def run_card_action(action: str, shot_id: str = "") -> str:path = await asyncio.to_thread(save_shot_to_downloads, shot)log.info("appshot: card saved %s", path.name)return labels["saved"]+ except PermissionError:+ # macOS asks once for Downloads (Files and Folders); a "Don't Allow"+ # lands here, and the card says where to change it.+ log.warning("appshot: no permission to write into Downloads", exc_info=True)+ return labels["no_access_mac" if sys.platform == "darwin" else "no_access"]except Exception: # noqa: BLE001 - the card says so; nothing else depends on itlog.warning("appshot: card action %r failed", action, exc_info=True)return labels["failed"]diff --git a/tests/unit/appshot/test_appshot_card_save_denied.py b/tests/unit/appshot/test_appshot_card_save_denied.pynew file mode 100644index 0000000000..b85d31c490--- /dev/null+++ b/tests/unit/appshot/test_appshot_card_save_denied.py@@ -0,0 +1,65 @@+"""A denied Downloads folder says so on the card instead of "That did not work"."""++from __future__ import annotations++import io+import sys+from types import SimpleNamespace++import pytest+from PIL import Image++from jarvis.appshot import card_actions+from jarvis.appshot.store import Appshot, AppshotStore+++def _png() -> bytes:+ out = io.BytesIO()+ Image.new("RGB", (8, 6), (1, 2, 3)).save(out, "PNG")+ return out.getvalue()+++def held(monkeypatch: pytest.MonkeyPatch) -> None:+ from jarvis.appshot import store as store_module++ store = AppshotStore()+ store.remember(+ Appshot(+ id="d0d0d0d0",+ image=_png(),+ mime="image/png",+ width=8,+ height=6,+ label="active window",+ app_name="Editor",+ note="APPSHOT: evidence",+ ui_text="",+ trigger="hotkey",+ taken_at=1.0,+ ),+ keep_s=60,+ )+ monkeypatch.setattr(store_module, "_STORE", store)+ monkeypatch.setattr(+ "jarvis.core.config.load_config", lambda: SimpleNamespace(ui=SimpleNamespace(language="en"))+ )++ def denied(_shot):+ raise PermissionError(1, "Operation not permitted")++ monkeypatch.setattr(card_actions, "save_shot_to_downloads", denied)+++ ("platform", "status"),+ [+ ("darwin", "Allow Downloads in Privacy & Security > Files and Folders"),+ ("linux", "No permission to save in Downloads"),+ ],+)+async def test_a_denied_save_names_the_permission(+ held, monkeypatch: pytest.MonkeyPatch, platform: str, status: str+) -> None:+ monkeypatch.setattr(sys, "platform", platform)+ assert await card_actions.run_card_action("save") == status