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): the Appshots page says ready only when a capture would run
rubenluetke10-beep59208c8fb505
diff --git a/jarvis/ui/web/appshot_routes.py b/jarvis/ui/web/appshot_routes.pyindex 77dc0370da..f250ece37b 100644--- a/jarvis/ui/web/appshot_routes.py+++ b/jarvis/ui/web/appshot_routes.py@@ -79,18 +79,42 @@ def _bus(request: Request) -> Any | None:return getattr(request.app.state, "bus", None)-def _capability() -> dict[str, Any]:+def _capture_capability() -> tuple[bool, str]:+ """Whether a capture would run right now, and the reason when not.++ Asks what the capture itself checks: a display, the capture package,+ and the OS gate (Screen Recording on macOS, Wayland on Linux). A page+ that said "ready" and then refused on Try it was the old behaviour.+ """import importlib.util # noqa: PLC0415+ from jarvis.platform.probes import display_present # noqa: PLC0415+ from jarvis.screen_context.ports import capture_permission_error # noqa: PLC0415++ if not display_present():+ return False, "There is no screen on this computer."+ if importlib.util.find_spec("mss") is None:+ return False, "The screen-capture package is not installed."+ issue = capture_permission_error()+ if issue is not None:+ return False, issue.message+ return True, ""+++def _capability() -> dict[str, Any]:+from jarvis.appshot.region import picker_capability # noqa: PLC0415from jarvis.cu.indicator.controller import screen_indicator_capability # noqa: PLC0415- capture_ok = importlib.util.find_spec("mss") is not None+ capture_ok, capture_reason = _capture_capability()effect_ok, effect_reason = screen_indicator_capability()region_ok, region_reason = picker_capability()+ if not capture_ok:+ # The picker would freeze the screens for a capture that is refused.+ region_ok, region_reason = False, capture_reasonreturn {"capture": capture_ok,- "capture_detail": "" if capture_ok else "The screen-capture package is not installed.",+ "capture_detail": capture_reason,"effect": effect_ok,"effect_detail": effect_reason,"region": region_ok,diff --git a/jarvis/ui/web/frontend/src/views/AppshotsView.test.tsx b/jarvis/ui/web/frontend/src/views/AppshotsView.test.tsxindex 208caff1d0..47f23ff589 100644--- a/jarvis/ui/web/frontend/src/views/AppshotsView.test.tsx+++ b/jarvis/ui/web/frontend/src/views/AppshotsView.test.tsx@@ -111,6 +111,25 @@ describe("AppshotsView", () => {expect(screen.queryByTestId("appshots-clipboard")).toBeNull();});+ it("says on the Try row why a capture cannot run here", async () => {+ const blocked = {+ ...SETTINGS,+ readiness: {+ ...SETTINGS.readiness,+ capture: false,+ capture_detail: "Grant Screen Recording.",+ },+ };+ fetchMock.mockImplementation(async (url: string) => {+ if (url === "/api/appshot/settings") return json(blocked);+ if (url === "/api/appshot/latest") return json({ appshot: null });+ return json({}, 404);+ });+ render(<AppshotsView />);+ await screen.findByTestId("appshots-try");+ expect(screen.getByText(/Grant Screen Recording\./)).toBeDefined();+ });+it("disables every other control while appshots are switched off", async () => {fetchMock.mockImplementation(async (url: string) =>url === "/api/appshot/settings"diff --git a/jarvis/ui/web/frontend/src/views/AppshotsView.tsx b/jarvis/ui/web/frontend/src/views/AppshotsView.tsxindex c7a97af404..1875d51b02 100644--- a/jarvis/ui/web/frontend/src/views/AppshotsView.tsx+++ b/jarvis/ui/web/frontend/src/views/AppshotsView.tsx@@ -613,7 +613,12 @@ export function AppshotsView() {? t("appshots.try_counting").replace("{0}", String(countdown)): picking? t("appshots.try_picking")- : t("appshots.try_hint")+ : settings.readiness.capture === false+ ? t("appshots.effect_unavailable").replace(+ "{0}",+ settings.readiness.capture_detail,+ )+ : t("appshots.try_hint")}control={<div className="flex items-center gap-2">diff --git a/tests/unit/appshot/test_appshot_readiness.py b/tests/unit/appshot/test_appshot_readiness.pynew file mode 100644index 0000000000..e82fd2d407--- /dev/null+++ b/tests/unit/appshot/test_appshot_readiness.py@@ -0,0 +1,57 @@+"""The Appshots page says "ready" only when a capture would really run."""++from __future__ import annotations++import pytest++from jarvis.appshot import region+from jarvis.screen_context.ports import CapturePermissionIssue+from jarvis.ui.web import appshot_routes+++def desktop(monkeypatch: pytest.MonkeyPatch):+ monkeypatch.setattr("jarvis.platform.probes.display_present", lambda: True)+ monkeypatch.setattr("jarvis.platform.probes.is_wayland", lambda: False)+ monkeypatch.setattr("jarvis.platform.qt_sidecar.missing_system_library", lambda: "")++ def gate(issue: CapturePermissionIssue | None) -> None:+ monkeypatch.setattr("jarvis.screen_context.ports.capture_permission_error", lambda: issue)++ return gate+++def test_a_mac_without_screen_recording_is_not_ready(desktop) -> None:+ pytest.importorskip("mss")+ desktop(CapturePermissionIssue(code="capture_permission", message="Grant it first."))++ readiness = appshot_routes._capability() # noqa: SLF001++ assert readiness["capture"] is False+ assert readiness["capture_detail"] == "Grant it first."+ # The picker would freeze the screens for a capture that is refused.+ assert readiness["region"] is False+ assert readiness["region_detail"] == "Grant it first."+++def test_a_granted_desktop_is_ready(desktop) -> None:+ pytest.importorskip("mss")+ desktop(None)+ readiness = appshot_routes._capability() # noqa: SLF001+ assert readiness["capture"] is True+ assert readiness["capture_detail"] == ""+++def test_a_box_without_a_screen_is_not_ready(monkeypatch: pytest.MonkeyPatch) -> None:+ monkeypatch.setattr("jarvis.platform.probes.display_present", lambda: False)+ readiness = appshot_routes._capability() # noqa: SLF001+ assert readiness["capture"] is False+ assert "no screen" in readiness["capture_detail"]+++def test_the_picker_names_a_missing_qt_library(desktop, monkeypatch: pytest.MonkeyPatch) -> None:+ pytest.importorskip("PySide6")+ monkeypatch.setattr(+ "jarvis.platform.qt_sidecar.missing_system_library", lambda: "Install libxcb-cursor0"+ )+ assert region.picker_capability() == (False, "Install libxcb-cursor0")