Agent Zero AI framework
Polish surface modal headers and file tree interactions
Alessandroa4226fe0a303
diff --git a/plugins/_browser/webui/browser-panel.html b/plugins/_browser/webui/browser-panel.htmlindex a62af44ae..30213aa96 100644--- a/plugins/_browser/webui/browser-panel.html+++ b/plugins/_browser/webui/browser-panel.html@@ -380,8 +380,6 @@}.modal-inner.browser-modal .modal-header {- min-height: 34px;- padding: 0.35rem 0.75rem 0.35rem 1rem;cursor: move;user-select: none;background: color-mix(in srgb, var(--color-background) 92%, #000 8%);diff --git a/plugins/_desktop/AGENTS.md b/plugins/_desktop/AGENTS.mdindex 98a48833f..718707f5c 100644--- a/plugins/_desktop/AGENTS.md+++ b/plugins/_desktop/AGENTS.md@@ -19,6 +19,8 @@- Do not expose desktop routes without the expected auth protections.- Keep Desktop host visibility tied to an attached modal or canvas host; modal cleanup may preserve the iframe in keepalive, but must not leave stale modal mode behind.- Keep LibreOffice Writer as the default handler for Markdown and plain text files; keep Agent Zero Editor available as a secondary Open With target through the desktop intent bridge.+- Style the shutdown-state restart action with shared `btn btn-field`, matching Open Browser.+- Use shared `surface-workspace` and `--surface-background` for panel, body, and viewer backdrops so shutdown/loading states match the lighter Files, Editor, and Browser palette.## Work Guidancediff --git a/plugins/_desktop/webui/desktop-panel.html b/plugins/_desktop/webui/desktop-panel.htmlindex 6e1f55de9..4a18a4dcc 100644--- a/plugins/_desktop/webui/desktop-panel.html+++ b/plugins/_desktop/webui/desktop-panel.html@@ -7,7 +7,7 @@<body><div x-data><template x-if="$store.desktop">- <div class="office-panel" x-create="$store.desktop.onMount($el, xAttrs($el) || {})" x-destroy="$store.desktop.cleanup()">+ <div class="office-panel surface-workspace" x-create="$store.desktop.onMount($el, xAttrs($el) || {})" x-destroy="$store.desktop.cleanup()"><div class="office-shell"><div class="office-document-header" x-show="$store.desktop.hasActiveFile()" style="display: none;"><div class="office-document-title" :title="$store.desktop.tabLabel($store.desktop.session)">@@ -76,9 +76,9 @@<div class="office-desktop-empty" x-show="$store.desktop.shouldShowDesktopEmptyState()" style="display: none;"><x-icon aria-hidden="true" name="power_settings_new"></x-icon><span class="office-desktop-empty-title">Desktop is shut down</span>- <button type="button" class="office-icon-button office-command-button" @click="$store.desktop.restartDesktopSession()">+ <button type="button" class="btn btn-field" @click="$store.desktop.restartDesktopSession()"><x-icon aria-hidden="true" name="restart_alt"></x-icon>- <span class="office-button-label">Restart Desktop</span>+ <span>Restart Desktop</span></button></div></div>@@ -97,7 +97,7 @@height: 100%;min-width: 0;min-height: 0;- background: var(--color-background);+ background: var(--surface-background);color: var(--color-text);}@@ -610,7 +610,7 @@flex: 1 1 auto;min-height: 0;overflow: hidden;- background: var(--color-background);+ background: var(--surface-background);}.office-body.is-source {@@ -643,7 +643,7 @@display: flex;overflow: hidden;padding: 0;- background: #1f2329;+ background: var(--surface-background);}.office-desktop-wrap {@@ -654,7 +654,7 @@min-width: 0;min-height: 0;aspect-ratio: auto;- background: #1f2329;+ background: var(--surface-background);}.office-desktop-empty {@@ -675,6 +675,12 @@color: color-mix(in srgb, var(--color-text) 68%, transparent);}+ .office-desktop-empty > .btn {+ display: inline-flex;+ align-items: center;+ gap: 5px;+ }+.office-desktop-empty-title {font-size: 13px;font-weight: 700;diff --git a/tests/test_file_tree.py b/tests/test_file_tree.pyindex e4f1f59f0..b5acde819 100644--- a/tests/test_file_tree.py+++ b/tests/test_file_tree.py@@ -31,6 +31,14 @@ assert.equal(tree.rows[1].depth, 1);await tree.expand(folder);await tree.expand(folder);assert.equal(requests.length, 2, 'reopening a branch uses loaded children');+await tree.open(folder);+assert.equal(folder.expanded, false, 'folder name collapses an expanded branch');+assert.deepEqual(opened, [], 'collapse does not navigate and reopen the branch');+assert.equal(tree.rows.some(row => row.node.name === 'nested.md'), false);+await tree.open(folder);+assert.equal(folder.expanded, true, 'folder name expands a collapsed branch');+assert.deepEqual(opened.splice(0), ['/a0/folder'], 'expanding still navigates');+assert.equal(requests.length, 2, 'name toggle reuses loaded children');tree.query = 'NESTED';assert.deepEqual(tree.rows.map(row => row.node.name), ['folder', 'nested.md'], 'filter retains parent');await tree.open(folder.children[0]);diff --git a/webui/components/modals/file-browser/AGENTS.md b/webui/components/modals/file-browser/AGENTS.mdindex cb1ceb7f6..2f11c5e1e 100644--- a/webui/components/modals/file-browser/AGENTS.md+++ b/webui/components/modals/file-browser/AGENTS.md@@ -31,10 +31,13 @@- Preserve surface actions that route supported files to Browser, Desktop, or Editor.- Keep native drag moves available outside picker modes: dragging an unselected row moves only that row without changing selection, dragging a selected row moves the selection, folder rows accept drops, and Up moves items to the parent directory. Moves must reject overwrites and self-nesting.+- Folder names and chevrons both toggle expansion; name clicks navigate only when expanding. Indent branch status messages to the child-name column at each depth.- Tree branches load through the existing authenticated file-list API on expansion; filtering covers loaded folders. Keep only the filter above the raw tree, without path, parent, or refresh controls. Preserve expanded ancestors during navigation within the root and reset when moving outside it.- Keep the tree on the right in canvas and modal modes; at narrow panel widths it overlays the content below the toolbar. Tree file clicks reuse picker selection or existing file-opening actions.- Scope unmount cleanup to the owning panel element; destroying an old host must not clean up the active modal.+- Display a dash for folder sizes; only files show byte sizes. Do not recursively scan folders for list metadata.+## Work Guidance- Share markup and store behavior between modal and canvas modes; branch only on explicit component `mode`.diff --git a/webui/components/modals/file-browser/file-browser.html b/webui/components/modals/file-browser/file-browser.htmlindex 8e3e060ef..159feb27e 100644--- a/webui/components/modals/file-browser/file-browser.html+++ b/webui/components/modals/file-browser/file-browser.html@@ -211,7 +211,7 @@</template><span x-text="file.name"></span></div>- <div class="file-size" x-text="$store.fileBrowser.formatFileSize(file.size)"></div>+ <div class="file-size" x-text="file.is_dir ? '—' : $store.fileBrowser.formatFileSize(file.size)"></div><div class="file-date" x-text="$store.fileBrowser.formatDate(file.modified)"></div><div class="file-actions" x-show="!$store.fileBrowser.isPickerMode()"><button@@ -407,8 +407,6 @@}.modal-inner.file-browser-modal .modal-header {- min-height: 34px;- padding: 0.35rem 0.75rem 0.35rem 1rem;background: color-mix(in srgb, var(--color-background) 92%, #000 8%);border-bottom: 1px solid color-mix(in srgb, var(--color-border) 70%, transparent);}diff --git a/webui/components/modals/file-browser/file-tree.html b/webui/components/modals/file-browser/file-tree.htmlindex 863abbefb..56c3e1ac8 100644--- a/webui/components/modals/file-browser/file-tree.html+++ b/webui/components/modals/file-browser/file-tree.html@@ -15,13 +15,13 @@<button type="button" class="file-tree-chevron" :style="{ visibility: row.node.is_dir ? 'visible' : 'hidden' }" :tabindex="row.node.is_dir ? 0 : -1" :aria-label="(row.node.expanded ? 'Collapse ' : 'Expand ') + row.node.name" :aria-expanded="row.node.is_dir ? String(row.node.expanded) : null" @click="tree.expand(row.node)"><x-icon :name="row.node.loading ? 'progress_activity' : (row.node.expanded ? 'expand_more' : 'chevron_right')"></x-icon></button>- <button type="button" class="file-tree-entry" :title="row.node.path" :aria-current="tree.selectedPath === row.node.path ? 'true' : null" @click="tree.open(row.node)">+ <button type="button" class="file-tree-entry" :title="row.node.path" :aria-expanded="row.node.is_dir ? String(row.node.expanded) : null" :aria-current="tree.selectedPath === row.node.path ? 'true' : null" @click="tree.open(row.node)"><x-icon :name="row.node.is_dir ? (row.node.expanded ? 'folder_open' : 'folder') : (/\.md$/i.test(row.node.name) ? 'markdown' : 'description')"></x-icon><span x-text="row.node.name"></span></button></div>- <button type="button" class="file-tree-status file-tree-retry" x-show="row.node.expanded && row.node.error" @click="tree.load(row.node)">Could not load folder. Retry</button>- <p class="file-tree-status" x-show="row.node.expanded && row.node.children?.length === 0">Empty folder</p>+ <button type="button" class="file-tree-status file-tree-retry" :style="{ marginLeft: (71 + row.depth * 16) + 'px' }" x-show="row.node.expanded && row.node.error" @click="tree.load(row.node)">Could not load folder. Retry</button>+ <p class="file-tree-status" :style="{ marginLeft: (71 + row.depth * 16) + 'px' }" x-show="row.node.expanded && row.node.children?.length === 0">Empty folder</p></div></template></div>diff --git a/webui/components/modals/file-browser/file-tree.js b/webui/components/modals/file-browser/file-tree.jsindex 30d82ba56..6591ec37e 100644--- a/webui/components/modals/file-browser/file-tree.js+++ b/webui/components/modals/file-browser/file-tree.js@@ -67,7 +67,10 @@ export function createFileTree(onOpen) {},async open(node) {- if (node.is_dir && !node.expanded) await this.expand(node);+ if (node.is_dir) {+ await this.expand(node);+ if (!node.expanded) return;+ }await onOpen(node);},diff --git a/webui/css/AGENTS.md b/webui/css/AGENTS.mdindex efba8d65d..53ec92c64 100644--- a/webui/css/AGENTS.md+++ b/webui/css/AGENTS.md@@ -11,7 +11,7 @@- `loading-indicators.css` owns reusable loading visuals; `messages.css` owns chat-history paging placement, the context-switch splash surface, and lazy message-preview states in addition to message presentation.- Component-specific styles should usually stay inside the component HTML unless they are intentionally shared.- `modals.css` owns the shared stacked modal shell, backdrop, scroll area, footer slot, modal button classes, floating/no-backdrop modal behavior, and shared modal section primitives.-- `surfaces.css` owns surface modal switchers, action rails, draggable header affordances, focus-button state, and right-canvas surface primitives. Files, Editor, and Browser opt into `surface-workspace` for the lighter panel palette, common toolbar chrome, flat `surface-control` buttons, and group separators. Tab bars and toolbars share a 48px baseline with vertically centered controls. Keep these styles opt-in and preserve viewer/content themes; primary empty-state actions such as Open Browser retain their existing button styling.+- `surfaces.css` owns surface modal switchers, action rails, draggable header affordances, focus-button state, and right-canvas surface primitives. Files, Editor, and Browser opt into `surface-workspace` for the lighter panel palette, common toolbar chrome, flat `surface-control` buttons, and group separators. Surface modal headers share a 48px border-box height with centered titles and controls; component styles must not override their sizing. Surface modal header controls are borderless in normal, hover, and active states; preserve group separators and keyboard focus outlines. Tab bars and toolbars share a 48px baseline with vertically centered controls. Keep these styles opt-in and preserve viewer/content themes; primary empty-state actions such as Open Browser retain their existing button styling.- `index.css` defines global theme variables such as `--color-*`, `--spacing-*`, `--font-size-*`, and `--transition-speed`.## Local Contractsdiff --git a/webui/css/surfaces.css b/webui/css/surfaces.cssindex 4b3b7e7df..f6c9336ab 100644--- a/webui/css/surfaces.css+++ b/webui/css/surfaces.css@@ -20,6 +20,15 @@pointer-events: auto;}+.modal-inner.surface-modal .modal-header {+ box-sizing: border-box;+ height: 48px;+ min-height: 48px;+ flex-shrink: 0;+ padding: 6px 12px 6px 16px;+ align-items: center;+}+.modal-inner.surface-modal.is-draggable-surface-modal .modal-header {cursor: move;user-select: none;@@ -93,7 +102,7 @@min-width: 34px;min-height: 34px;padding: 0;- border: 1px solid transparent;+ border: 0;border-radius: 7px;background: transparent;color: var(--color-text);@@ -109,7 +118,6 @@.modal-surface-button:hover,.modal-surface-button.is-active {opacity: 1;- border-color: color-mix(in srgb, var(--color-primary) 28%, var(--color-border));background: color-mix(in srgb, var(--color-background-hover) 72%, transparent);}@@ -129,7 +137,7 @@height: 34px;min-height: 34px;padding: 0 9px 0 8px;- border: 1px solid transparent;+ border: 0;border-radius: 7px;background: transparent;color: var(--color-text);@@ -147,10 +155,16 @@.surface-modal-new-button:hover:not(:disabled),.surface-modal-new-action.is-open .surface-modal-new-button {opacity: 1;- border-color: color-mix(in srgb, var(--color-primary) 28%, var(--color-border));background: color-mix(in srgb, var(--color-background-hover) 72%, transparent);}+.surface-modal-actions .surface-modal-new-button { border: 0; }++.surface-modal-actions button:focus-visible {+ outline: 1px solid var(--color-primary);+ outline-offset: 1px;+}+.surface-modal-new-button:disabled {cursor: default;opacity: 0.45;