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(settings): add GET/PUT /api/settings/bar-size for the Bar-size slider
Ruben Lütkecf32b458023f
diff --git a/jarvis/ui/web/settings_routes.py b/jarvis/ui/web/settings_routes.pyindex d646b350fb..6f3a2cfd8e 100644--- a/jarvis/ui/web/settings_routes.py+++ b/jarvis/ui/web/settings_routes.py@@ -1926,6 +1926,80 @@ async def put_bar_persistent(body: BoolToggleBody, request: Request) -> dict[str}+# ---------------------------------------------------------------------------+# "Bar size" slider (ui.bar_size_scale): a proportional multiplier for the+# on-screen bar (width AND height scale together, shape preserved). Persists to+# jarvis.toml and live-applies to the running bar via app.state.desktop_app —+# no restart. The slider streams live PUTs with persist=false while dragging+# (so the bar resizes on screen in real time) and one persist=true PUT on+# release. Range mirrors renderer.USER_SIZE_MIN/MAX (0.5–2.0).+# ---------------------------------------------------------------------------++_BAR_SIZE_DEFAULT = 1.0+++class BarSizeBody(BaseModel):+ scale: float = Field(..., ge=0.5, le=2.0)+ persist: bool = Field(default=True, description="Persist as boot default in jarvis.toml")++[email protected]("/bar-size")+async def get_bar_size(request: Request) -> dict[str, object]:+ cfg = _config(request)+ ui = getattr(cfg, "ui", None)+ return {+ "scale": float(getattr(ui, "bar_size_scale", _BAR_SIZE_DEFAULT)),+ "default": _BAR_SIZE_DEFAULT,+ "min": 0.5,+ "max": 2.0,+ }++[email protected]("/bar-size")+async def put_bar_size(body: BarSizeBody, request: Request) -> dict[str, object]:+ scale = float(body.scale) # already range-validated by the Pydantic Field+ cfg = _config(request)+ ui = getattr(cfg, "ui", None)+ if ui is not None:+ try:+ ui.bar_size_scale = scale # type: ignore[attr-defined]+ except Exception as exc: # noqa: BLE001+ log.debug("in-memory bar_size_scale update skipped: %s", exc)++ persisted = False+ if body.persist:+ try:+ from jarvis.core import config_writer++ config_writer.set_bar_size_scale(scale)+ persisted = True+ except Exception as exc: # noqa: BLE001 — persist is best-effort+ log.warning("bar-size persist failed (live apply still attempted): %s", exc)++ # Live-apply to the running bar so the resize is visible immediately. A+ # headless / down desktop app falls back to "applies on next start".+ applied_live = False+ desktop = getattr(request.app.state, "desktop_app", None)+ fn = getattr(desktop, "set_bar_size", None)+ if callable(fn):+ try:+ res = await asyncio.to_thread(fn, scale)+ applied_live = (+ bool(res.get("applied_live")) if isinstance(res, dict) else bool(res)+ )+ except Exception as exc: # noqa: BLE001 — never fail the save on a live hiccup+ log.warning("bar-size live-apply failed (persisted; applies on restart): %s", exc)++ return {+ "ok": True,+ "scale": scale,+ "default": _BAR_SIZE_DEFAULT,+ "persisted": persisted,+ "applied_live": applied_live,+ "restart_required": not applied_live,+ }++@router.get("/mute-music")async def get_mute_music(request: Request) -> dict[str, object]:cfg = _config(request)diff --git a/tests/integration/test_settings_routes.py b/tests/integration/test_settings_routes.pyindex 38c66fd7c5..05566a5607 100644--- a/tests/integration/test_settings_routes.py+++ b/tests/integration/test_settings_routes.py@@ -91,3 +91,69 @@ def test_get_503_without_brain(server: WebServer) -> None:with TestClient(server.app) as client:resp = client.get("/api/settings/reply-language")assert resp.status_code == 503+++# ---------------------------------------------------------------------------+# Bar size slider (/api/settings/bar-size)+# ---------------------------------------------------------------------------+def test_bar_size_get_returns_default_and_range(server: WebServer) -> None:+ with TestClient(server.app) as client:+ resp = client.get("/api/settings/bar-size")+ assert resp.status_code == 200+ body = resp.json()+ assert body["scale"] == 1.0+ assert body["min"] == 0.5+ assert body["max"] == 2.0+++def test_bar_size_put_persists_and_updates_config(+ server: WebServer, monkeypatch: pytest.MonkeyPatch+) -> None:+ from jarvis.core import config_writer++ written: list[float] = []+ monkeypatch.setattr(config_writer, "set_bar_size_scale", lambda s, **kw: written.append(s))+ with TestClient(server.app) as client:+ resp = client.put("/api/settings/bar-size", json={"scale": 1.5})+ assert resp.status_code == 200+ body = resp.json()+ assert body["scale"] == 1.5+ assert body["persisted"] is True+ # No live desktop app in this harness → not applied live, restart flagged.+ assert body["applied_live"] is False+ assert body["restart_required"] is True+ assert written == [1.5]+ assert server.app.state.config.ui.bar_size_scale == 1.5+++def test_bar_size_put_live_applies_to_the_desktop_app(+ server: WebServer, monkeypatch: pytest.MonkeyPatch+) -> None:+ from jarvis.core import config_writer++ monkeypatch.setattr(config_writer, "set_bar_size_scale", lambda s, **kw: None)++ class _FakeDesktop:+ def __init__(self) -> None:+ self.applied: list[float] = []++ def set_bar_size(self, scale: float) -> dict[str, object]:+ self.applied.append(scale)+ return {"ok": True, "applied_live": True, "scale": scale}++ desktop = _FakeDesktop()+ server.app.state.desktop_app = desktop+ with TestClient(server.app) as client:+ resp = client.put("/api/settings/bar-size", json={"scale": 0.7, "persist": False})+ assert resp.status_code == 200+ body = resp.json()+ assert body["applied_live"] is True+ assert body["restart_required"] is False+ assert body["persisted"] is False # persist=false → nothing written to disk+ assert desktop.applied == [0.7]+++def test_bar_size_put_rejects_out_of_range(server: WebServer) -> None:+ with TestClient(server.app) as client:+ assert client.put("/api/settings/bar-size", json={"scale": 5.0}).status_code == 422+ assert client.put("/api/settings/bar-size", json={"scale": 0.1}).status_code == 422