Agent Zero AI framework
Add responsive interface control visibility
Alessandro3ac63c61662f
diff --git a/api/settings_get.py.dox.md b/api/settings_get.py.dox.mdindex e584283fd..46b2ccdd7 100644--- a/api/settings_get.py.dox.md+++ b/api/settings_get.py.dox.md@@ -28,6 +28,7 @@## Key Concepts- Important called helpers/classes observed in the source: `settings.get_settings`, `settings.convert_out`.+- The returned settings map includes normalized `ui_control_visibility` mobile and desktop flags for the configurable WebUI controls.- Keep request/response, tool, or helper semantics documented here at the same time as source changes.## Work Guidancediff --git a/api/settings_set.py.dox.md b/api/settings_set.py.dox.mdindex 0f08f9862..0d3e62e6c 100644--- a/api/settings_set.py.dox.md+++ b/api/settings_set.py.dox.md@@ -26,6 +26,7 @@## Key Concepts- Important called helpers/classes observed in the source: `settings.convert_in`, `settings.set_settings`, `settings.convert_out`, `settings.Settings`.+- The settings payload accepts normalized `ui_control_visibility` mobile and desktop flags and returns the persisted map with the rest of the settings.- Keep request/response, tool, or helper semantics documented here at the same time as source changes.## Work Guidancediff --git a/helpers/settings.py b/helpers/settings.pyindex 8e191441a..fcd66eef6 100644--- a/helpers/settings.py+++ b/helpers/settings.py@@ -59,6 +59,7 @@ class Settings(TypedDict):max_consecutive_unusable_responses: inttimezone: strtime_format: str+ ui_control_visibility: dict[str, dict[str, bool]]workdir_path: strworkdir_show: bool@@ -164,6 +165,12 @@ API_KEY_PLACEHOLDER = "************"TIMEZONE_AUTO = "auto"TIME_FORMAT_12H = "12h"TIME_FORMAT_24H = "24h"+UI_CONTROL_VISIBILITY_DEFAULTS = {+ "projectSelector": {"mobile": True, "desktop": True},+ "time": {"mobile": False, "desktop": True},+ "connectionStatus": {"mobile": True, "desktop": True},+ "rightCanvasRail": {"mobile": True, "desktop": True},+}SETTINGS_FILE = files.get_abs_path("usr/settings.json")_settings: Settings | None = None@@ -210,6 +217,22 @@ def _normalize_time_format(value: Any, default: str = TIME_FORMAT_12H) -> str:return default if default in {TIME_FORMAT_12H, TIME_FORMAT_24H} else TIME_FORMAT_12H+def _normalize_ui_control_visibility(value: Any) -> dict[str, dict[str, bool]]:+ submitted = value if isinstance(value, dict) else {}+ normalized = {}+ for control, devices in UI_CONTROL_VISIBILITY_DEFAULTS.items():+ submitted_devices = submitted.get(control, {})+ if not isinstance(submitted_devices, dict):+ submitted_devices = {}+ normalized[control] = {+ device: submitted_devices.get(device)+ if isinstance(submitted_devices.get(device), bool)+ else default+ for device, default in devices.items()+ }+ return normalized++def _resolve_runtime_timezone(setting_value: str, browser_timezone: str | None = None) -> str:if setting_value == TIMEZONE_AUTO:candidate = str(browser_timezone or "").strip()@@ -407,6 +430,7 @@ def normalize_settings(settings: Settings) -> Settings:)copy["timezone"] = _normalize_timezone_setting(copy.get("timezone"), default["timezone"])copy["time_format"] = _normalize_time_format(copy.get("time_format"), default["time_format"])+ copy["ui_control_visibility"] = _normalize_ui_control_visibility(copy.get("ui_control_visibility"))return copy@@ -507,6 +531,9 @@ def get_default_settings() -> Settings:),timezone=_normalize_timezone_setting(get_default_value("timezone", TIMEZONE_AUTO)),time_format=_normalize_time_format(get_default_value("time_format", TIME_FORMAT_12H)),+ ui_control_visibility=_normalize_ui_control_visibility(+ get_default_value("ui_control_visibility", UI_CONTROL_VISIBILITY_DEFAULTS)+ ),workdir_path=get_default_value("workdir_path", files.get_abs_path_dockerized("usr/workdir")),workdir_show=get_default_value("workdir_show", True),workdir_max_depth=get_default_value("workdir_max_depth", 5),diff --git a/helpers/settings.py.dox.md b/helpers/settings.py.dox.mdindex e136941b6..d4bdb974c 100644--- a/helpers/settings.py.dox.md+++ b/helpers/settings.py.dox.md@@ -25,6 +25,7 @@- `_is_valid_timezone(value: str) -> bool`- `_normalize_timezone_setting(value: Any, default: str=...) -> str`- `_normalize_time_format(value: Any, default: str=...) -> str`+- `_normalize_ui_control_visibility(value: Any) -> dict[str, dict[str, bool]]`- `_resolve_runtime_timezone(setting_value: str, browser_timezone: str | None=...) -> str`- `_timezone_options() -> list[FieldOption]`- `convert_out(settings: Settings) -> SettingsOutput`@@ -50,7 +51,7 @@- `_dict_to_env(data_dict)`- `set_root_password(password: str)`- `get_runtime_config(set: Settings)`-- Notable constants/configuration names: `T`, `PASSWORD_PLACEHOLDER`, `API_KEY_PLACEHOLDER`, `TIMEZONE_AUTO`, `TIME_FORMAT_12H`, `TIME_FORMAT_24H`, `SETTINGS_FILE`.+- Notable constants/configuration names: `T`, `PASSWORD_PLACEHOLDER`, `API_KEY_PLACEHOLDER`, `TIMEZONE_AUTO`, `TIME_FORMAT_12H`, `TIME_FORMAT_24H`, `UI_CONTROL_VISIBILITY_DEFAULTS`, `SETTINGS_FILE`.## Runtime Contracts@@ -65,6 +66,7 @@- Applying settings refreshes active context configs while preserving each subordinate agent's own profile.- Applying settings starts a deferred `MCPConfig.update(...)` with the current `mcp_servers` string when global MCP server settings change.- `max_consecutive_unusable_responses` defaults to `2` and controls the cost circuit breaker for malformed or repeated main-model outputs.+- `ui_control_visibility` stores validated mobile and desktop visibility flags for the project selector, clock, connection status, and right canvas rail; missing or malformed values fall back per device.- Keep request/response, tool, or helper semantics documented here at the same time as source changes.## Work Guidancediff --git a/helpers/ui_server.py b/helpers/ui_server.pyindex cbf14a054..fdea68b01 100644--- a/helpers/ui_server.py+++ b/helpers/ui_server.py@@ -1,6 +1,7 @@from dataclasses import dataclass, fieldfrom datetime import timedeltaimport asyncio+import jsonimport loggingimport osimport secrets@@ -262,6 +263,13 @@ class UiRouteHandlers:user_time_format_setting = str(settings_helper.get_settings().get("time_format", "12h"))except Exception:user_time_format_setting = "12h"+ try:+ user_ui_control_visibility = json.dumps(+ settings_helper.get_settings()["ui_control_visibility"],+ separators=(",", ":"),+ )+ except Exception:+ user_ui_control_visibility = json.dumps(settings_helper.UI_CONTROL_VISIBILITY_DEFAULTS)index = files.read_file("webui/index.html")return files.replace_placeholders_text(@@ -273,6 +281,7 @@ class UiRouteHandlers:logged_in=("true" if login.get_credentials_hash() else "false"),user_timezone_setting=user_timezone_setting,user_time_format_setting=user_time_format_setting,+ user_ui_control_visibility=user_ui_control_visibility,)@requires_authdiff --git a/helpers/ui_server.py.dox.md b/helpers/ui_server.py.dox.mdindex 4c993c84d..ae430843f 100644--- a/helpers/ui_server.py.dox.md+++ b/helpers/ui_server.py.dox.md@@ -41,6 +41,7 @@## Key Concepts- Important called helpers/classes observed in the source: `logging.getLogger.setLevel`, `Localization.get.apply_process_timezone`, `_positive_int_env`, `field`, `Flask`, `threading.RLock`, `socketio.AsyncServer`, `WsManager`, `set_shared_ws_manager`, `cls`, `server_runtime.refresh_runtime_settings`, `settings_helper.get_settings`, `settings_helper.set_runtime_settings_snapshot`, `self.ws_manager.set_server_restart_broadcast`, `UiRouteHandlers`, `self.webapp.add_url_rule`, `register_api_route`, `register_ws_namespace`, `files.read_file`, `render_template_string`, `session.pop`.+- `serve_index()` bootstraps the normalized UI control visibility map alongside timezone and time-format preferences so controls render correctly before Settings is opened.- Keep request/response, tool, or helper semantics documented here at the same time as source changes.## Work Guidancediff --git a/tests/test_ui_control_visibility.py b/tests/test_ui_control_visibility.pynew file mode 100644index 000000000..0bb3cae75--- /dev/null+++ b/tests/test_ui_control_visibility.py@@ -0,0 +1,79 @@+import json+from pathlib import Path+import subprocess+import sys+++ROOT = Path(__file__).resolve().parents[1]+++def read(path: str) -> str:+ return (ROOT / path).read_text(encoding="utf-8")+++def test_ui_controls_have_independent_mobile_and_desktop_visibility() -> None:+ preferences = read("webui/components/sidebar/bottom/preferences/preferences-store.js")+ settings_store = read("webui/components/settings/settings-store.js")+ settings = read("webui/components/settings/agent/agent-settings.html")+ interface = read("webui/components/settings/agent/interface.html")+ chat_top = read("webui/components/chat/top-section/chat-top.html")+ canvas = read("webui/components/canvas/right-canvas.html")+ index = read("webui/index.html")+ ui_server = read("helpers/ui_server.py")++ for control in ("projectSelector", "time", "connectionStatus", "rightCanvasRail"):+ assert control in preferences+ assert control in settings_store++ assert "section-interface" in settings_store+ assert 'settings/agent/interface.html' in settings+ assert "smartphone" in interface+ assert "desktop_windows" in interface+ assert 'globalThis.addEventListener("resize"' in preferences+ assert "uiControlVisibility" in index+ assert "user_ui_control_visibility" in ui_server+ assert "ui_control_visibility" in settings_store+ assert "Shown everywhere" in settings_store+ assert "Mobile only" in settings_store+ assert "Desktop only" in settings_store+ assert "Hidden everywhere" in settings_store+ assert "isUiControlVisible('time')" in chat_top+ assert "isUiControlVisible('connectionStatus')" in chat_top+ assert "isUiControlVisible('projectSelector')" in chat_top+ assert "isUiControlVisible('rightCanvasRail')" in canvas+++def test_ui_control_visibility_settings_are_normalized() -> None:+ result = subprocess.run(+ [+ sys.executable,+ "-c",+ """+import json+from helpers import settings++defaults = settings.get_default_settings()["ui_control_visibility"]+normalized = settings.normalize_settings({+ **settings.get_default_settings(),+ "ui_control_visibility": {+ "time": {"mobile": True, "desktop": False},+ "projectSelector": "invalid",+ "unknown": {"mobile": False},+ },+})["ui_control_visibility"]+print(json.dumps({"defaults": defaults, "normalized": normalized}))+""",+ ],+ cwd=ROOT,+ check=True,+ capture_output=True,+ text=True,+ )+ data = json.loads(result.stdout)+ defaults = data["defaults"]+ normalized = data["normalized"]++ assert defaults["time"] == {"mobile": False, "desktop": True}+ assert normalized["time"] == {"mobile": True, "desktop": False}+ assert normalized["projectSelector"] == {"mobile": True, "desktop": True}+ assert "unknown" not in normalizeddiff --git a/webui/components/canvas/AGENTS.md b/webui/components/canvas/AGENTS.mdindex 1d5eca08e..491295816 100644--- a/webui/components/canvas/AGENTS.md+++ b/webui/components/canvas/AGENTS.md@@ -18,6 +18,7 @@- Keep the right-canvas rail and docked shell hidden while the welcome screen is active; non-action surface opens during welcome must route into floating/modal surfaces instead of docking beside the welcome screen.- Preserve docked canvas open state across same-tab reloads with session-scoped state, but do not treat it as durable cross-session UI state.- In mobile mode, keep the rail below blocking modal layers and compact it on very narrow screens instead of letting it cover modal content.+- Keep the canvas shell functional when the instance-level visibility preference hides only the right-canvas rail.## Work Guidancediff --git a/webui/components/canvas/right-canvas.html b/webui/components/canvas/right-canvas.htmlindex 3cba11a98..fc4a9a575 100644--- a/webui/components/canvas/right-canvas.html+++ b/webui/components/canvas/right-canvas.html@@ -2,6 +2,7 @@<head><script type="module">import { store } from "/components/canvas/right-canvas-store.js";+ import { store as preferencesStore } from "/components/sidebar/bottom/preferences/preferences-store.js";</script></head><body>@@ -24,7 +25,7 @@><div class="right-canvas-resize-handle" title="Resize canvas" @pointerdown="$store.rightCanvas.startResize($event)"></div>- <nav class="right-canvas-rail" aria-label="Canvas surfaces">+ <nav class="right-canvas-rail" aria-label="Canvas surfaces" x-show="$store.preferences.isUiControlVisible('rightCanvasRail')"><buttontype="button"class="right-canvas-rail-button right-canvas-toggle-button"diff --git a/webui/components/chat/AGENTS.md b/webui/components/chat/AGENTS.mdindex 51b25eecd..d4104e929 100644--- a/webui/components/chat/AGENTS.md+++ b/webui/components/chat/AGENTS.md@@ -25,6 +25,7 @@- The setup gate must delegate Cloud/Local setup, account connections, and advanced model configuration to the existing onboarding and plugin settings modals; do not duplicate provider/model/key forms inline.- A connected OAuth account without Main/Utility model selection is its own gate state; route to model configuration and do not select models automatically.- Model setup surfaces that change readiness must notify the gate with `model-setup-changed`, `model-configured`, or an existing modal/onboarding completion signal so the pending prompt can retry automatically.+- The top-section project selector, clock, and connection indicator must respect the instance-level mobile/desktop visibility preferences.## Work Guidancediff --git a/webui/components/chat/top-section/chat-top.html b/webui/components/chat/top-section/chat-top.htmlindex 2809fa6f2..679e1d1de 100644--- a/webui/components/chat/top-section/chat-top.html+++ b/webui/components/chat/top-section/chat-top.html@@ -6,6 +6,7 @@<!-- Import the alpine store --><script type="module">import { store } from "/components/chat/top-section/chat-top-store.js";+ import { store as preferencesStore } from "/components/sidebar/bottom/preferences/preferences-store.js";</script></head>@@ -17,12 +18,16 @@<!-- Time and Date --><div id="time-date-container"><x-extension id="chat-top-start"></x-extension>- <div id="time-date"></div>- <x-component path="sync/sync-status.html"></x-component>+ <div id="time-date" x-show="$store.preferences.isUiControlVisible('time')"></div>+ <div x-show="$store.preferences.isUiControlVisible('connectionStatus')">+ <x-component path="sync/sync-status.html"></x-component>+ </div><!-- Notification Toggle positioned next to time-date --><x-component path="notifications/notification-icons.html"></x-component><!-- Project Selector -->- <x-component path="projects/project-selector.html"></x-component>+ <div x-show="$store.preferences.isUiControlVisible('projectSelector')">+ <x-component path="projects/project-selector.html"></x-component>+ </div><x-extension id="chat-top-end"></x-extension></div></template>diff --git a/webui/components/settings/AGENTS.md b/webui/components/settings/AGENTS.mdindex 1a9b30223..b4b8ec83a 100644--- a/webui/components/settings/AGENTS.md+++ b/webui/components/settings/AGENTS.md@@ -17,6 +17,7 @@- Settings tabs that expose plugin `settings_sections` must mount `settings/plugins/plugins-subsection.html` with matching `data-tab` and sidebar/nav section IDs.- Do not store secrets in localStorage, URLs, or console output.- Preserve Store Gating and modal footer conventions in settings components.+- Interface control visibility is edited as a Save/Cancel draft, persisted with instance settings, and applied through the shared frontend preference store after Settings saves successfully.- MCP manager tool toggles write `disabled_tools` into the draft JSON and require Apply before changing the running MCP tool set.- Confirmed MCP server removals apply immediately and refresh server status; other MCP manager draft edits still require Apply.- MCP manager local command forms accept shell-style command and argument lines; quote argument values that intentionally contain spaces.@@ -31,7 +32,7 @@## Verification-- Smoke-test changed settings tabs and save/reload behavior after visible or API changes.+- Smoke-test changed settings tabs, Interface mobile/desktop selectors, and save/reload behavior after visible or API changes.## Child DOX Indexdiff --git a/webui/components/settings/agent/agent-settings.html b/webui/components/settings/agent/agent-settings.htmlindex 6e0d27656..4baecfcb3 100644--- a/webui/components/settings/agent/agent-settings.html+++ b/webui/components/settings/agent/agent-settings.html@@ -39,6 +39,12 @@<span>Locale</span></a></li>+ <li>+ <a href="#section-interface">+ <span class="material-symbols-outlined" aria-hidden="true">dashboard_customize</span>+ <span>Interface</span>+ </a>+ </li><li><a href="#section-agent-plugins"><span class="material-symbols-outlined" aria-hidden="true">extension</span>@@ -68,6 +74,10 @@<x-component path="settings/agent/locale.html"></x-component></div>+ <div id="section-interface" class="section">+ <x-component path="settings/agent/interface.html"></x-component>+ </div>+<!-- Plugin settings subsection: shows plugins tagged with "agent" --><div id="section-agent-plugins" class="section"><x-component path="settings/plugins/plugins-subsection.html" data-tab="agent"></x-component>diff --git a/webui/components/settings/agent/interface.html b/webui/components/settings/agent/interface.htmlnew file mode 100644index 000000000..ae540c12c--- /dev/null+++ b/webui/components/settings/agent/interface.html@@ -0,0 +1,161 @@+<html>+ <head>+ <title>Interface</title>+ </head>++ <body>+ <div x-data>+ <template x-if="$store.settings.uiVisibility">+ <div>+ <div class="section-title">Interface controls</div>+ <div class="section-description">+ Choose where each control appears. Bright devices are shown; dim devices are hidden.+ </div>++ <div class="ui-visibility-list">+ <template x-for="control in $store.settings.uiControls" :key="control.id">+ <div class="ui-visibility-row">+ <div class="ui-visibility-control">+ <span class="material-symbols-outlined" aria-hidden="true" x-text="control.icon"></span>+ <div>+ <div class="field-title" x-text="control.label"></div>+ <div class="ui-visibility-state" x-text="$store.settings.uiControlVisibilityLabel(control.id)"></div>+ </div>+ </div>++ <div class="ui-device-selector" :aria-label="`${control.label} visibility`">+ <button+ type="button"+ class="ui-device-button"+ :class="{ 'is-visible': $store.settings.isUiControlVisible(control.id, 'mobile') }"+ :aria-label="`Show ${control.label.toLowerCase()} on mobile`"+ :aria-pressed="$store.settings.isUiControlVisible(control.id, 'mobile').toString()"+ :title="$store.settings.isUiControlVisible(control.id, 'mobile') ? 'Shown on mobile' : 'Hidden on mobile'"+ @click="$store.settings.toggleUiControl(control.id, 'mobile')"+ >+ <span class="material-symbols-outlined" aria-hidden="true">smartphone</span>+ <span>Mobile</span>+ </button>+ <button+ type="button"+ class="ui-device-button"+ :class="{ 'is-visible': $store.settings.isUiControlVisible(control.id, 'desktop') }"+ :aria-label="`Show ${control.label.toLowerCase()} on desktop`"+ :aria-pressed="$store.settings.isUiControlVisible(control.id, 'desktop').toString()"+ :title="$store.settings.isUiControlVisible(control.id, 'desktop') ? 'Shown on desktop' : 'Hidden on desktop'"+ @click="$store.settings.toggleUiControl(control.id, 'desktop')"+ >+ <span class="material-symbols-outlined" aria-hidden="true">desktop_windows</span>+ <span>Desktop</span>+ </button>+ </div>+ </div>+ </template>+ </div>+ </div>+ </template>+ </div>+ </body>++ <style>+ .ui-visibility-list {+ margin-top: 1rem;+ overflow: hidden;+ border: 1px solid color-mix(in srgb, var(--color-border) 72%, transparent);+ border-radius: 10px;+ background: color-mix(in srgb, var(--color-panel) 48%, transparent);+ }++ .ui-visibility-row {+ display: grid;+ grid-template-columns: minmax(0, 1fr) auto;+ align-items: center;+ gap: 1rem;+ min-height: 78px;+ padding: 0.8rem 0.9rem;+ border-bottom: 1px solid color-mix(in srgb, var(--color-border) 55%, transparent);+ }++ .ui-visibility-row:last-child {+ border-bottom: 0;+ }++ .ui-visibility-control {+ display: flex;+ align-items: center;+ gap: 0.75rem;+ min-width: 0;+ }++ .ui-visibility-control > .material-symbols-outlined {+ display: grid;+ flex: 0 0 38px;+ width: 38px;+ height: 38px;+ place-items: center;+ border-radius: 9px;+ background: color-mix(in srgb, var(--color-text) 8%, transparent);+ color: var(--color-text);+ font-size: 21px;+ }++ .ui-visibility-state {+ margin-top: 0.18rem;+ color: var(--color-text-muted);+ font-size: 0.78rem;+ }++ .ui-device-selector {+ display: grid;+ grid-template-columns: repeat(2, 78px);+ gap: 0.45rem;+ }++ .ui-device-button {+ display: flex;+ min-height: 54px;+ align-items: center;+ justify-content: center;+ flex-direction: column;+ gap: 0.15rem;+ padding: 0.4rem;+ border: 1px solid transparent;+ border-radius: 8px;+ background: transparent;+ color: var(--color-text-muted);+ cursor: pointer;+ font: inherit;+ font-size: 0.72rem;+ opacity: 0.35;+ transition: opacity 0.16s ease, color 0.16s ease, border-color 0.16s ease, background-color 0.16s ease;+ }++ .ui-device-button:hover,+ .ui-device-button:focus-visible {+ opacity: 0.72;+ outline: none;+ border-color: color-mix(in srgb, var(--color-border) 80%, transparent);+ }++ .ui-device-button.is-visible {+ opacity: 1;+ color: var(--color-text);+ border-color: color-mix(in srgb, var(--color-primary) 34%, var(--color-border));+ background: color-mix(in srgb, var(--color-primary) 10%, transparent);+ }++ .ui-device-button .material-symbols-outlined {+ font-size: 22px;+ }++ @media (max-width: 640px) {+ .ui-visibility-row {+ grid-template-columns: 1fr;+ }++ .ui-device-selector {+ grid-template-columns: repeat(2, minmax(0, 1fr));+ }+ }+ </style>+</html>diff --git a/webui/components/settings/settings-store.js b/webui/components/settings/settings-store.jsindex fae2905ec..13a22e8c8 100644--- a/webui/components/settings/settings-store.js+++ b/webui/components/settings/settings-store.js@@ -1,6 +1,7 @@import { createStore } from "/js/AlpineStore.js";import * as API from "/js/api.js";import { store as notificationStore } from "/components/notifications/notification-store.js";+import { store as preferencesStore } from "/components/sidebar/bottom/preferences/preferences-store.js";import {getBrowserTimezone,setConfiguredTimeFormat,@@ -14,6 +15,13 @@ const UPDATE_STATUS_REFRESH_COOLDOWN_MS = 60 * 1000;// Match the modal header/padding breathing room before promoting a section link.const SECTION_ACTIVATION_OFFSET = 56;+const UI_CONTROLS = Object.freeze([+ { id: "projectSelector", label: "Project selector", icon: "folder_open" },+ { id: "time", label: "Time", icon: "schedule" },+ { id: "connectionStatus", label: "Connection status", icon: "wifi" },+ { id: "rightCanvasRail", label: "Right canvas rail", icon: "dock_to_right" },+]);+const TAB_ITEMS = Object.freeze([{id: "agent",@@ -25,6 +33,7 @@ const TAB_ITEMS = Object.freeze([{ id: "section-voice", label: "Voice", icon: "mic" },{ id: "section-workdir", label: "Workdir", icon: "folder" },{ id: "section-locale", label: "Locale", icon: "language" },+ { id: "section-interface", label: "Interface", icon: "dashboard_customize" },{ id: "section-agent-plugins", label: "Plugins", icon: "extension" },],},@@ -110,6 +119,7 @@ const model = {_updateStatusRefreshedAt: 0,expandedNavGroups: {},searchQuery: "",+ uiVisibility: null,// Tab state_activeTab: DEFAULT_TAB,@@ -140,6 +150,7 @@ const model = {async onOpen() {this.error = null;this.isLoading = true;+ this.uiVisibility = preferencesStore.uiVisibilitySnapshot();try {const response = await API.callJsonApi("settings_get", null);@@ -147,6 +158,8 @@ const model = {this.settings = response.settings;this.additional = response.additional || null;this.applyLocaleRuntime(this.settings);+ preferencesStore.setUiVisibility(this.settings.ui_control_visibility);+ this.uiVisibility = preferencesStore.uiVisibilitySnapshot();} else {throw new Error("Invalid settings response");}@@ -182,6 +195,34 @@ const model = {this.error = null;this.isLoading = false;this.searchQuery = "";+ this.uiVisibility = null;+ },++ get uiControls() {+ return UI_CONTROLS;+ },++ isUiControlVisible(control, device) {+ return this.uiVisibility?.[control]?.[device] !== false;+ },++ toggleUiControl(control, device) {+ this.uiVisibility = {+ ...this.uiVisibility,+ [control]: {+ ...this.uiVisibility?.[control],+ [device]: !this.isUiControlVisible(control, device),+ },+ };+ },++ uiControlVisibilityLabel(control) {+ const mobile = this.isUiControlVisible(control, "mobile");+ const desktop = this.isUiControlVisible(control, "desktop");+ if (mobile && desktop) return "Shown everywhere";+ if (mobile) return "Mobile only";+ if (desktop) return "Desktop only";+ return "Hidden everywhere";},// Tab management@@ -589,6 +630,7 @@ const model = {return false;}+ this.settings.ui_control_visibility = this.uiVisibility;this.isLoading = true;try {const response = await API.callJsonApi("settings_set", {@@ -599,6 +641,7 @@ const model = {this.settings = response.settings;this.additional = response.additional || this.additional;this.applyLocaleRuntime(this.settings);+ preferencesStore.setUiVisibility(response.settings.ui_control_visibility);toast("Settings saved successfully", "success");document.dispatchEvent(new CustomEvent("settings-updated", { detail: response.settings })diff --git a/webui/components/sidebar/AGENTS.md b/webui/components/sidebar/AGENTS.mdindex 9ad7c7a16..c0d277a76 100644--- a/webui/components/sidebar/AGENTS.md+++ b/webui/components/sidebar/AGENTS.md@@ -21,6 +21,7 @@- A restored selected parent chat with children auto-expands once during context hydration unless the user has already toggled it.- The Tasks list is reserved for scheduler-backed task contexts and must not be used for chat-bound parallel children.- Avoid text or controls overflowing fixed sidebar widths.+- Instance-level interface visibility preferences own independent mobile and desktop states for the chat-top controls and right canvas rail; mobile uses the shared 768px breakpoint.## Work Guidancediff --git a/webui/components/sidebar/bottom/preferences/preferences-store.js b/webui/components/sidebar/bottom/preferences/preferences-store.jsindex d48618127..8a3fc98d8 100644--- a/webui/components/sidebar/bottom/preferences/preferences-store.js+++ b/webui/components/sidebar/bottom/preferences/preferences-store.js@@ -3,8 +3,29 @@ import * as css from "/js/css.js";import { ttsService } from "/js/tts-service.js";import { applyModeSteps } from "/components/messages/process-group/process-group-dom.js";+const UI_VISIBILITY_DEFAULTS = Object.freeze({+ projectSelector: { mobile: true, desktop: true },+ time: { mobile: false, desktop: true },+ connectionStatus: { mobile: true, desktop: true },+ rightCanvasRail: { mobile: true, desktop: true },+});++function normalizeUiVisibility(value = {}) {+ return Object.fromEntries(+ Object.entries(UI_VISIBILITY_DEFAULTS).map(([control, defaults]) => [+ control,+ {+ mobile: typeof value?.[control]?.mobile === "boolean" ? value[control].mobile : defaults.mobile,+ desktop: typeof value?.[control]?.desktop === "boolean" ? value[control].desktop : defaults.desktop,+ },+ ])+ );+}+// Preferences store centralizes user preference toggles and side-effectsconst model = {+ _initialized: false,+// UI toggles (initialized with safe defaults, loaded from localStorage in init)get autoScroll() {return this._autoScroll;@@ -70,6 +91,22 @@ const model = {},_detailMode: "current", // Default: show current step only+ _uiVisibility: normalizeUiVisibility(globalThis.runtimeInfo?.uiControlVisibility),+ _isMobileViewport: false,++ uiVisibilitySnapshot() {+ return normalizeUiVisibility(this._uiVisibility);+ },++ setUiVisibility(value) {+ this._uiVisibility = normalizeUiVisibility(value);+ },++ isUiControlVisible(control) {+ const device = this._isMobileViewport ? "mobile" : "desktop";+ return this._uiVisibility?.[control]?.[device] !== false;+ },+// Detail mode options for UI sidebardetailModeOptions: [{ label: "NO", value: "collapsed", title: "All collapsed" },@@ -80,6 +117,9 @@ const model = {// Initialize preferences and apply current stateinit() {+ if (this._initialized) return;+ this._initialized = true;+try {// Load persisted preferences with safe fallbackstry {@@ -124,6 +164,11 @@ const model = {this._showUtils = false; // Default to speech off if localStorage is unavailable}+ this._isMobileViewport = globalThis.innerWidth <= 768;+ globalThis.addEventListener("resize", () => {+ this._isMobileViewport = globalThis.innerWidth <= 768;+ });+// Apply all preferencesthis._applyDarkMode(this._darkMode);this._applyAutoScroll(this._autoScroll);diff --git a/webui/index.css b/webui/index.cssindex 5b1362c6f..3eacf6d7d 100644--- a/webui/index.css+++ b/webui/index.css@@ -982,10 +982,6 @@ input:checked + .slider:before {/* Media Queries */@media (max-width: 640px) {/* Responsive tiles for mobile */- #time-date {- display: none;- }-.preview-section {grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));gap: 8px;diff --git a/webui/index.html b/webui/index.htmlindex 2bb97e51b..3e49a24d3 100644--- a/webui/index.html+++ b/webui/index.html@@ -68,6 +68,7 @@loggedIn: "{{logged_in}}" === "true",timezone: "{{user_timezone_setting}}",timeFormat: "{{user_time_format_setting}}",+ uiControlVisibility: {{user_ui_control_visibility}},};</script><!-- Plugin head injections (scripts, stylesheets) -->