Agent Zero AI framework
feat: make the canvas rail movable and customizable
Alessandro80a98474061b
diff --git a/helpers/settings.py b/helpers/settings.pyindex 907cdf73c..eb900b180 100644--- a/helpers/settings.py+++ b/helpers/settings.py@@ -230,7 +230,12 @@ def _normalize_time_format(value: Any, default: str = TIME_FORMAT_12H) -> str: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():+ defaults = {+ **{control: {"mobile": True, "desktop": True} for control in submitted+ if isinstance(control, str) and control.startswith("canvas:") and len(control) > 7},+ **UI_CONTROL_VISIBILITY_DEFAULTS,+ }+ for control, devices in defaults.items():submitted_devices = submitted.get(control, {})if not isinstance(submitted_devices, dict):submitted_devices = {}diff --git a/helpers/settings.py.dox.md b/helpers/settings.py.dox.mdindex 80193016a..b5a16a65d 100644--- a/helpers/settings.py.dox.md+++ b/helpers/settings.py.dox.md@@ -55,6 +55,8 @@## Runtime Contracts+- `ui_control_visibility` accepts dynamic `canvas:<surface-id>` entries as well as built-in controls, normalizes device values to booleans (default shown), and preserves choices for temporarily unavailable plugins.+- `file_browser_max_text_size_mb` persists the instance-wide text-editing limit, default 10 MiB and normalized to 1–100. FileBrowser reads it directly so its scoped settings API can update it without restarting or reinitializing agents.- `file_browser_max_transfer_size_mb` independently persists the Files transfer limit, default 100 MiB, normalized to a positive integer without an upper ceiling. It does not change Backup & Restore or WebSocket limits.diff --git a/tests/test_ui_control_visibility.py b/tests/test_ui_control_visibility.pyindex 8becf85d6..88292179d 100644--- a/tests/test_ui_control_visibility.py+++ b/tests/test_ui_control_visibility.py@@ -89,6 +89,9 @@ normalized = settings.normalize_settings({"contextWindowUsage": {"mobile": False, "desktop": True},"projectSelector": "invalid","unknown": {"mobile": False},+ "canvas:files": {"mobile": False, "desktop": True},+ "canvas:plugin": {"mobile": "false", "desktop": False},+ "canvas:": {"mobile": False},},})["ui_control_visibility"]print(json.dumps({"defaults": defaults, "normalized": normalized}))@@ -108,3 +111,128 @@ print(json.dumps({"defaults": defaults, "normalized": normalized}))assert normalized["contextWindowUsage"] == {"mobile": False, "desktop": True}assert normalized["projectSelector"] == {"mobile": True, "desktop": True}assert "unknown" not in normalized+ assert "canvas:" not in normalized+ assert normalized["canvas:files"] == {"mobile": False, "desktop": True}+ assert normalized["canvas:plugin"] == {"mobile": True, "desktop": False}+++def test_canvas_visibility_and_rail_position_behavior() -> None:+ script = r"""+const assert = require('node:assert/strict');+const fs = require('node:fs');+const vm = require('node:vm');+function load(path, context = {}) {+ const source = fs.readFileSync(path, 'utf8')+ .replace(/^import [\s\S]*?;\n/gm, '')+ .replace(/export const store = createStore[^;]+;/, '')+ .replace(/export \{ store \};/, '');+ return vm.runInNewContext(source + '\nmodel;', {+ console, createStore: (_, model) => model, ...context,+ });+}+const preferences = load('webui/components/sidebar/bottom/preferences/preferences-store.js');+preferences.setUiVisibility({ 'canvas:files': { desktop: false, mobile: true },+ 'canvas:unavailable': { desktop: false, mobile: false } });+preferences.registerUiControlVisibility('canvas:files');+assert.equal(preferences.isUiControlVisible('canvas:files'), false);+assert.equal(preferences.uiVisibilitySnapshot()['canvas:unavailable'].desktop, false);+const local = new Map();+const canvas = load('webui/components/canvas/right-canvas-store.js', {+ preferencesStore: preferences,+ chatsStore: { selected: 'test' },+ normalizeSurfaceId: id => String(id || ''),+ registerSurfaceDefinition: () => {},+ getRegisteredSurfaces: () => [],+ SURFACE_MODE_DOCKED: 'docked',+ SURFACE_MODE_FLOATING: 'floating',+ migratePersistedSurfaceState: value => value,+ normalizeSurfaceMode: value => value,+ localStorage: { getItem: key => local.get(key), setItem: (key, value) => local.set(key, value) },+ sessionStorage: { setItem() {}, removeItem() {} },+ performance: { getEntriesByType: () => [] },+});+canvas.applyLayoutState = () => {};+canvas.setWidth = () => {};+canvas.defaultWidth = () => 720;+canvas.registerSurface({ id: 'files', title: 'Files' });+canvas.registerSurface({ id: 'browser', title: 'Browser' });+canvas.registerSurface({ id: 'action', title: 'Action', actionOnly: true });+assert.equal(canvas.railSurfaces.map(s => s.id).join(','), 'browser,action');+assert.equal(canvas.panelSurfaces.map(s => s.id).join(','), 'browser');+preferences._isMobileViewport = true;+assert.equal(canvas.panelSurfaces.map(s => s.id).join(','), 'files,browser');+preferences._isMobileViewport = false;+canvas.railHeight = 200;+assert.match(canvas.railStyle(), /clamp\(108px, 33%, calc\(100% - 108px\)\)/);+canvas.moveRail({key: 'End', preventDefault() {}});+assert.equal(canvas.railPosition, 1);+canvas.moveRail({key: 'ArrowDown', preventDefault() {}});+assert.equal(canvas.railPosition, 1);+canvas.moveRail({key: 'Home', preventDefault() {}});+canvas.moveRail({key: 'ArrowUp', preventDefault() {}});+assert.equal(canvas.railPosition, 0);+canvas.moveRail({key: 'ArrowDown', preventDefault() {}});+assert.equal(canvas.railPosition, 0.02);+canvas.railPosition = null;+canvas.restore();+assert.equal(canvas.railPosition, 0.02);+const listeners = new Map();+const handle = {+ closest: () => ({getBoundingClientRect: () => ({top: 200, height: 200})}),+ setPointerCapture() {},+ addEventListener: (type, fn) => listeners.set(type, fn),+ removeEventListener: type => listeners.delete(type),+};+canvas._rootElement = {getBoundingClientRect: () => ({top: 0, height: 800})};+canvas.startRailDrag({button: 0, clientY: 210, pointerId: 1, currentTarget: handle, preventDefault() {}});+listeners.get('pointermove')({clientY: -1000});+assert.equal(canvas.railPosition, 108 / 800);+listeners.get('pointermove')({clientY: 2000});+assert.equal(canvas.railPosition, 692 / 800);+listeners.get('lostpointercapture')();+assert.equal(listeners.size, 0);+(async () => {+ let modalId;+ canvas.openModalSurface = async id => { modalId = id; return true; };+ await canvas.open('files');+ assert.equal(modalId, 'files');+ assert.equal(canvas.isOpen, false);+ await canvas.open('browser');+ assert.equal(canvas.isOpen, true);+ canvas.isOpen = false;+ preferences.setUiVisibility(Object.fromEntries(canvas.surfaces.map(s =>+ [`canvas:${s.id}`, {mobile: false, desktop: false}])));+ assert.equal(await canvas.toggleCanvas(), false);+ assert.equal(canvas.activeSurfaceId, '');+})();+let loading = true;+let observer;+let scrolled;+const settings = load('webui/components/settings/settings-store.js', {+ rightCanvasStore: canvas,+ requestAnimationFrame: fn => fn(),+ history: {replaceState() {}},+ MutationObserver: class {+ constructor(fn) { this.fn = fn; observer = this; }+ observe() {}+ disconnect() { this.disconnected = true; }+ },+});+settings.activateSection = () => true;+settings.updateActiveSectionFromScroll = () => {};+settings.getSettingsPane = () => ({+ querySelector: () => loading,+ getBoundingClientRect: () => ({top: 100}),+ scrollTop: 0,+ scrollTo: options => {scrolled = options;},+});+settings.getSectionTarget = () => ({getBoundingClientRect: () => ({top: 800})});+settings.scrollToSection('section-interface', null, 'instant');+assert.equal(scrolled, undefined);+loading = false;+observer.fn();+assert.equal(observer.disconnected, true);+assert.equal(scrolled.top, 688);+assert.equal(scrolled.behavior, 'instant');+"""+ subprocess.run(["node", "-e", script], cwd=ROOT, check=True, text=True)diff --git a/webui/components/canvas/AGENTS.md b/webui/components/canvas/AGENTS.mdindex 491295816..d342300a0 100644--- a/webui/components/canvas/AGENTS.md+++ b/webui/components/canvas/AGENTS.md@@ -20,6 +20,10 @@- 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.+- Rail icons open their respective surfaces directly; keep the rail free of a separate Show/Hide toggle and keep the grip free of a tooltip.+- The rail grip moves vertically with pointer capture or arrow/Home/End keys; its local position persists with canvas state and is clamped to the available height. Disconnect its size observer on unmount.+- Register each surface as `canvas:<surface-id>` in shared Interface visibility. Filter rail icons and tabs by device; hidden panels requested elsewhere open as windows. Customize opens Settings at Interface.+## Work Guidance- Use existing surface and extension helpers before adding new canvas infrastructure.diff --git a/webui/components/canvas/right-canvas-store.js b/webui/components/canvas/right-canvas-store.jsindex e6b3b7989..d52b77efc 100644--- a/webui/components/canvas/right-canvas-store.js+++ b/webui/components/canvas/right-canvas-store.js@@ -1,5 +1,6 @@import { createStore } from "/js/AlpineStore.js";import { store as chatsStore } from "/components/sidebar/chats/chats-store.js";+import { store as preferencesStore } from "/components/sidebar/bottom/preferences/preferences-store.js";import { callJsExtensions } from "/js/extensions.js";import {SURFACE_MODE_DOCKED,@@ -47,6 +48,9 @@ const model = {mountedSurfaces: {},isOpen: false,width: DEFAULT_WIDTH,+ railPosition: null,+ railHeight: 0,+ _railObserver: null,isOverlayMode: false,isMobileMode: false,_initialized: false,@@ -113,6 +117,7 @@ const model = {this.surfaceModes[normalized.id] = SURFACE_MODE_DOCKED;}registerSurfaceDefinition(normalized);+ preferencesStore.registerUiControlVisibility(`canvas:${normalized.id}`);this.surfaces.sort((a, b) => (a.order ?? 100) - (b.order ?? 100));if (!this._registering) {this.ensureActiveSurface();@@ -152,7 +157,7 @@ const model = {return true;}- if (!this.shouldRender()) {+ if (!this.shouldRender() || !this.isSurfaceEnabled(targetId)) {return await this.openModalSurface(targetId, payload);}@@ -369,6 +374,7 @@ const model = {async toggleCanvas() {if (!this.shouldRender()) return false;+ this.ensureActiveSurface();if (this.isMobileMode) {return await this.open(this.activeSurfaceId || this.panelSurfaces[0]?.id || "", { source: "mobile-toggle" });}@@ -379,6 +385,62 @@ const model = {return await this.open(this.activeSurfaceId || this.panelSurfaces[0]?.id || "");},+ mountRail(element) {+ this._railObserver?.disconnect();+ this._railObserver = new ResizeObserver(() => {+ this.railHeight = element.offsetHeight;+ });+ this._railObserver.observe(element);+ },++ unmountRail() {+ this._railObserver?.disconnect();+ this._railObserver = null;+ },++ railStyle() {+ const inset = this.railHeight / 2 + 8;+ const position = this.railPosition ?? (this.isMobileMode ? 0.5 : 0.33);+ return `top: clamp(${inset}px, ${position * 100}%, calc(100% - ${inset}px));`;+ },++ startRailDrag(event) {+ if (event.button !== 0) return;+ event.preventDefault();+ const handle = event.currentTarget;+ const rail = handle.closest(".right-canvas-rail");+ const bounds = this._rootElement.getBoundingClientRect();+ const rect = rail.getBoundingClientRect();+ const offset = event.clientY - (rect.top + rect.height / 2);+ handle.setPointerCapture(event.pointerId);+ const move = (e) => {+ const inset = this.railHeight / 2 + 8;+ const center = clamp(e.clientY - offset - bounds.top, inset, bounds.height - inset);+ this.railPosition = clamp(center / bounds.height, 0, 1);+ };+ const end = () => {+ handle.removeEventListener("pointermove", move);+ handle.removeEventListener("lostpointercapture", end);+ this.persist();+ };+ handle.addEventListener("pointermove", move);+ handle.addEventListener("lostpointercapture", end);+ },++ moveRail(event) {+ if (!["ArrowUp", "ArrowDown", "Home", "End"].includes(event.key)) return;+ event.preventDefault();+ const position = this.railPosition ?? (this.isMobileMode ? 0.5 : 0.33);+ this.railPosition = event.key === "Home" ? 0 : event.key === "End" ? 1+ : clamp(position + (event.key === "ArrowUp" ? -0.02 : 0.02), 0, 1);+ this.persist();+ },++ async customize() {+ const { store: settingsStore } = await import("/components/settings/settings-store.js");+ await settingsStore.open("agent", "section-interface");+ },+setWidth(px, options = {}) {const { persist = true } = options;const next = clamp(normalizeWidth(px), MIN_WIDTH, this.maxWidth());@@ -482,6 +544,7 @@ const model = {activeSurfaceId: this.activeSurfaceId,surfaceModes: this.surfaceModes,width: this.width,+ railPosition: this.railPosition,};try {localStorage.setItem(STORAGE_KEY, JSON.stringify(state));@@ -500,6 +563,9 @@ const model = {try {const saved = migratePersistedSurfaceState(JSON.parse(localStorage.getItem(STORAGE_KEY) || "{}"));this.isOpen = false;+ if (typeof saved.railPosition === "number" && Number.isFinite(saved.railPosition)) {+ this.railPosition = clamp(saved.railPosition, 0, 1);+ }this.activeSurfaceId = String(saved.activeSurfaceId || "");this.surfaceModes = Object.fromEntries(Object.entries(saved.surfaceModes || {}).map(([surfaceId, mode]) => [@@ -565,6 +631,11 @@ const model = {applyLayoutState() {this.updateLayoutMode();+ if (this.isOpen && !this.isSurfaceEnabled(this.activeSurfaceId)) {+ this.isOpen = false;+ this.ensureActiveSurface();+ this.persist();+ }document.documentElement.style.setProperty("--right-canvas-width", `${this.width}px`);document.body.classList.toggle("right-canvas-open", this.isOpen && !this.isMobileMode && this.shouldRender());document.body.classList.toggle("right-canvas-overlay-mode", this.isOverlayMode);@@ -588,12 +659,16 @@ const model = {|| null;},+ isSurfaceEnabled(id) {+ return preferencesStore.isUiControlVisible(`canvas:${normalizeSurfaceId(id)}`);+ },+get railSurfaces() {- return this.surfaces;+ return this.surfaces.filter((surface) => this.isSurfaceEnabled(surface.id));},get panelSurfaces() {- return this.surfaces.filter((surface) => !surface.actionOnly);+ return this.railSurfaces.filter((surface) => !surface.actionOnly);},currentSurface() {diff --git a/webui/components/canvas/right-canvas.css b/webui/components/canvas/right-canvas.cssindex 868a16d29..e5e427391 100644--- a/webui/components/canvas/right-canvas.css+++ b/webui/components/canvas/right-canvas.css@@ -49,7 +49,9 @@ body.right-canvas-resizing {align-items: center;gap: 7px;height: auto;- max-height: min(70vh, calc(100vh - 32px));+ max-height: calc(100dvh - 32px);+ overflow-y: auto;+ scrollbar-width: none;padding: 10px 7px;transform: translateY(-50%);border-right: 0;@@ -108,10 +110,6 @@ body.right-canvas-resizing {transition: background-color 0.16s ease, border-color 0.16s ease, opacity 0.16s ease;}-.right-canvas-toggle-button {- color: color-mix(in srgb, var(--color-primary) 70%, var(--color-text));-}-.right-canvas-rail-button:hover,.right-canvas-icon-button:hover,.right-canvas-rail-button.is-active {@@ -382,3 +380,23 @@ body.right-canvas-mobile-mode .right-canvas-resize-handle {display: none;}}++.right-canvas-rail .right-canvas-rail-grip {+ min-height: 20px;+ height: 20px;+ flex-shrink: 0;+ cursor: ns-resize;+ touch-action: none;+}++.right-canvas-rail-grip span {+ width: 18px;+ height: 3px;+ border-radius: 2px;+ background: var(--color-text-muted);+}++.right-canvas-rail-button:focus-visible {+ outline: 2px solid var(--color-text-muted);+ outline-offset: -2px;+}diff --git a/webui/components/canvas/right-canvas.html b/webui/components/canvas/right-canvas.htmlindex 08b26e4d3..4f3616e80 100644--- a/webui/components/canvas/right-canvas.html+++ b/webui/components/canvas/right-canvas.html@@ -25,21 +25,16 @@><div class="right-canvas-resize-handle" title="Resize canvas" @pointerdown="$store.rightCanvas.startResize($event)"></div>- <nav class="right-canvas-rail" aria-label="Canvas surfaces" x-show="$store.preferences.isUiControlVisible('rightCanvasRail')">- <button- type="button"- class="right-canvas-rail-button right-canvas-toggle-button"- :class="{ 'is-active': $store.rightCanvas.isOpen }"- :title="$store.rightCanvas.isOpen ? 'Hide canvas' : 'Show canvas'"- :aria-label="$store.rightCanvas.isOpen ? 'Hide canvas' : 'Show canvas'"- :aria-pressed="$store.rightCanvas.isOpen.toString()"- @click="$store.rightCanvas.toggleCanvas()"- >- <x-icon name="dock_to_right"></x-icon>+ <nav class="right-canvas-rail" aria-label="Canvas surfaces"+ x-create="$store.rightCanvas.mountRail($el)"+ x-destroy="$store.rightCanvas.unmountRail()"+ :style="$store.rightCanvas.railStyle()" x-show="$store.preferences.isUiControlVisible('rightCanvasRail')">+ <button type="button" class="right-canvas-rail-button right-canvas-rail-grip"+ aria-label="Move canvas rail vertically"+ @pointerdown="$store.rightCanvas.startRailDrag($event)"+ @keydown="$store.rightCanvas.moveRail($event)">+ <span aria-hidden="true"></span></button>-- <div class="right-canvas-rail-separator" aria-hidden="true"></div>-<template x-for="surface in $store.rightCanvas.railSurfaces" :key="surface.id"><buttontype="button"@@ -57,6 +52,12 @@</template></button></template>+ <div class="right-canvas-rail-separator" aria-hidden="true"></div>+ <button type="button" class="right-canvas-rail-button"+ title="Customize canvas" aria-label="Customize canvas"+ @click="$store.rightCanvas.customize()">+ <x-icon name="tune"></x-icon>+ </button></nav><section class="right-canvas-shell">diff --git a/webui/components/settings/AGENTS.md b/webui/components/settings/AGENTS.mdindex d381a8094..5dbbe4f7a 100644--- a/webui/components/settings/AGENTS.md+++ b/webui/components/settings/AGENTS.md@@ -26,6 +26,8 @@- 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.+- Interface nests registered canvas surfaces under the right canvas rail control, using their plain titles, with independent mobile/desktop visibility in the same Save/Cancel draft. `open(tab, section)` supports direct section entry; initial scrolling waits for component markup and uses instant positioning so scroll anchoring follows later content growth.+## Work Guidance- Prefer subsection-local stores for complex settings areas.diff --git a/webui/components/settings/agent/interface.html b/webui/components/settings/agent/interface.htmlindex 7e804792a..83b1e0f34 100644--- a/webui/components/settings/agent/interface.html+++ b/webui/components/settings/agent/interface.html@@ -10,13 +10,19 @@<div class="section-title">Interface controls</div><div class="section-description">Choose where each control appears. Bright devices are shown; dim devices are hidden.+ Canvas entries control both the rail icons and panel tabs.</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-row" :class="{ 'is-nested': control.parent }"><div class="ui-visibility-control">- <x-icon aria-hidden="true" :name="control.icon"></x-icon>+ <template x-if="control.image">+ <img :src="control.image" alt="" class="right-canvas-surface-image">+ </template>+ <template x-if="!control.image">+ <x-icon aria-hidden="true" :name="control.icon"></x-icon>+ </template><div><div class="field-title" x-text="control.label"></div><div class="ui-visibility-state" x-text="$store.settings.uiControlVisibilityLabel(control.id)"></div>@@ -77,6 +83,11 @@border-bottom: 1px solid color-mix(in srgb, var(--color-border) 55%, transparent);}+ .ui-visibility-row.is-nested {+ margin-left: 2.4rem;+ border-left: 1px solid color-mix(in srgb, var(--color-border) 55%, transparent);+ }+.ui-visibility-row:last-child {border-bottom: 0;}diff --git a/webui/components/settings/settings-store.js b/webui/components/settings/settings-store.jsindex db9c616c6..039143ea2 100644--- a/webui/components/settings/settings-store.js+++ b/webui/components/settings/settings-store.js@@ -1,4 +1,5 @@import { createStore } from "/js/AlpineStore.js";+import { store as rightCanvasStore } from "/components/canvas/right-canvas-store.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";@@ -127,6 +128,7 @@ const model = {_paneScrollHandler: null,_paneScrollPane: null,_scrollSyncFrame: null,+ _sectionLoadObserver: null,_updateStatusRefreshedAt: 0,expandedNavGroups: {},searchQuery: "",@@ -195,12 +197,14 @@ const model = {this.bindPaneScroll();if (openedHashSection) {- this.scrollToSection(hashSectionId);+ this.scrollToSection(hashSectionId, null, "instant");}},cleanup() {this.unbindPaneScroll();+ this._sectionLoadObserver?.disconnect();+ this._sectionLoadObserver = null;this.settings = null;this.additional = null;this.error = null;@@ -210,7 +214,13 @@ const model = {},get uiControls() {- return UI_CONTROLS;+ return [...UI_CONTROLS, ...rightCanvasStore.surfaces.map((surface) => ({+ id: `canvas:${surface.id}`,+ label: surface.title,+ parent: "rightCanvasRail",+ icon: surface.icon,+ image: surface.image,+ }))];},isUiControlVisible(control, device) {@@ -498,21 +508,32 @@ const model = {return activePanel?.querySelector(selector) || pane?.querySelector(selector) || document.getElementById(sectionId);},- scrollToSection(sectionId, event = null) {+ scrollToSection(sectionId, event = null, behavior = "smooth") {event?.preventDefault?.();+ this._sectionLoadObserver?.disconnect();if (!this.activateSection(sectionId)) {this._activeSection = sectionId;}const performScroll = () => {const pane = this.getSettingsPane();+ const loading = "x-component > .loading:empty, x-extension.loading";+ if (pane?.querySelector(loading)) {+ this._sectionLoadObserver = new MutationObserver(() => {+ if (pane.querySelector(loading)) return;+ this._sectionLoadObserver.disconnect();+ requestAnimationFrame(performScroll);+ });+ this._sectionLoadObserver.observe(pane, { childList: true, subtree: true, attributes: true, attributeFilter: ["class"] });+ return;+ }const target = this.getSectionTarget(sectionId, pane);if (!target) {history.replaceState(null, "", `#${sectionId}`);return;}if (!pane) {- target.scrollIntoView({ behavior: "smooth", block: "start", inline: "nearest" });+ target.scrollIntoView({ behavior, block: "start", inline: "nearest" });history.replaceState(null, "", `#${sectionId}`);return;}@@ -520,7 +541,7 @@ const model = {const targetRect = target.getBoundingClientRect();pane.scrollTo({top: Math.max(0, pane.scrollTop + targetRect.top - paneRect.top - 12),- behavior: "smooth",+ behavior,});history.replaceState(null, "", `#${sectionId}`);this.updateActiveSectionFromScroll();@@ -710,10 +731,10 @@ const model = {},// Open settings modal from external callers- async open(initialTab = null) {+ async open(initialTab = null, initialSection = null) {if (initialTab) {this.activeTab = initialTab;- history.replaceState(null, "", `#${this.getFirstSectionId(this.activeTab)}`);+ history.replaceState(null, "", `#${initialSection || this.getFirstSectionId(this.activeTab)}`);}await window.openModal("settings/settings.html");},diff --git a/webui/components/sidebar/AGENTS.md b/webui/components/sidebar/AGENTS.mdindex 1e030c231..6d1098655 100644--- a/webui/components/sidebar/AGENTS.md+++ b/webui/components/sidebar/AGENTS.md@@ -34,6 +34,8 @@- Chat selection must synchronize the sidebar store even when the low-level context has already switched to the requested ID.- Context snapshots preserve the Alpine contexts-array and row identities while their order is stable, updating changed row metadata in place so streaming log counters do not reconcile the whole chat list. Additions, removals, reordering, and deletion tombstones must still replace the visible list; selection and parent-expansion synchronization must not publish unchanged state.+- Preserve `canvas:<surface-id>` visibility entries even when a plugin is absent, so later registration restores its saved choice.+## Work Guidance- Coordinate navigation and state changes with WebSocket sync and chat/project stores.diff --git a/webui/components/sidebar/bottom/preferences/preferences-store.js b/webui/components/sidebar/bottom/preferences/preferences-store.jsindex b8fe45bad..a0d8e8027 100644--- a/webui/components/sidebar/bottom/preferences/preferences-store.js+++ b/webui/components/sidebar/bottom/preferences/preferences-store.js@@ -11,7 +11,11 @@ const UI_VISIBILITY_DEFAULTS = {function normalizeUiVisibility(value = {}) {return Object.fromEntries(- Object.entries(UI_VISIBILITY_DEFAULTS).map(([control, defaults]) => [+ Object.entries({+ ...Object.fromEntries(Object.keys(value || {}).filter((id) => id.startsWith("canvas:") && id.length > 7)+ .map((id) => [id, { mobile: true, desktop: true }])),+ ...UI_VISIBILITY_DEFAULTS,+ }).map(([control, defaults]) => [control,{mobile: typeof value?.[control]?.mobile === "boolean" ? value[control].mobile : defaults.mobile,