Agent Zero AI framework
Move New folder and Rename to the shared footer input
linkliti975129e856c7
diff --git a/plugins/_desktop/webui/desktop-store.js b/plugins/_desktop/webui/desktop-store.jsindex ed0446de9..096f6db7a 100644--- a/plugins/_desktop/webui/desktop-store.js+++ b/plugins/_desktop/webui/desktop-store.js@@ -831,6 +831,7 @@ const model = {type: "document",},{+ modal: true,currentPath: parentPath(path),validateName: (newName) => {if (!extension) return true;diff --git a/plugins/_editor/webui/editor-store.js b/plugins/_editor/webui/editor-store.jsindex dc6f493e4..0c4f8f370 100644--- a/plugins/_editor/webui/editor-store.js+++ b/plugins/_editor/webui/editor-store.js@@ -1460,6 +1460,7 @@ const model = {type: "document",},{+ modal: true,currentPath: parentPath(path),validateName: (newName) => {if (!extension) return true;diff --git a/tests/test_file_browser_navigation.py b/tests/test_file_browser_navigation.pyindex 7ae9e88ce..3ca8b379d 100644--- a/tests/test_file_browser_navigation.py+++ b/tests/test_file_browser_navigation.py@@ -313,6 +313,79 @@ assert.equal(store.browser.currentPath, '/a0/usr', 'surface listing reloaded aftsubprocess.run(['node', '--input-type=module'], input=script, text=True, check=True)+def test_file_browser_inline_rename_and_new_folder_use_footer_input() -> None:+ """New folder and Rename edit the name in the shared footer input; external callers keep the modal."""+ import re+ import subprocess++ source = read("webui", "components", "modals", "file-browser", "file-browser-store.js")+ source = re.sub(r'^import\b[\s\S]*?;\n', '', source, flags=re.M)+ source = source.replace('export const store = createStore', 'const store = createStore')+ html = read("webui", "components", "modals", "file-browser", "file-browser.html")+ script = '''+import assert from 'node:assert/strict';+const window = globalThis;+const createStore = (_name, model) => model;+const createFileTree = () => ({ shown: false, follow: async () => {} });+const localStorage = { getItem: () => null, setItem: () => {} };+const document = { querySelector: () => null };+const callJsonApi = async () => ({ settings: {} });+const formatDateTime = () => '';+const openLatestSurface = async () => {};+const setupFloatingSurfaceModalChrome = () => () => {};+let openModalCalls = 0;+const modalStack = [];+window.isModalOpen = path => modalStack.includes(path);+window.openModal = async path => { openModalCalls++; modalStack.push(path); return Promise.resolve(); };+window.closeModal = async path => { modalStack.splice(modalStack.indexOf(path), 1); };+window.toastFrontendError = () => {};+let renameResponse = { ok: true, json: async () => ({}) };+const fetchApi = async (url, options = {}) => {+ if (String(url).startsWith('/get_work_dir_files')) {+ return { ok: true, json: async () => ({ data: { entries: [], current_path: '/a0/usr' } }) };+ }+ return renameResponse;+};+''' + source + '''+// Rename opens the inline footer input, not a modal window.+await store.openRenameModal({ name: 'note.md', path: '/a0/usr/note.md', is_dir: false });+assert.equal(openModalCalls, 0, 'in-browser rename does not open a modal');+assert.equal(store.renameInline, true);+assert.equal(store.renameMode, 'rename');+assert.equal(store.renameName, 'note.md');+store.renameName = 'renamed.md';+await store.confirmRename();+assert.equal(store.pickerMode, '', 'confirm closes the inline editor');+assert.equal(store.renameInline, false);++// New folder opens the inline footer input in create mode.+await store.openNewFolderModal();+assert.equal(openModalCalls, 0, 'in-browser New folder does not open a modal');+assert.equal(store.renameInline, true);+assert.equal(store.renameMode, 'create-folder');+store.closeRenameModal();+assert.equal(store.renameInline, false, 'cancel resets the inline editor');++// External callers keep the modal window.+await store.openRenameModal({ name: 'doc.md', path: '/a0/doc.md', is_dir: false }, { modal: true });+assert.equal(openModalCalls, 1, 'external rename keeps the modal window');+assert.equal(store.renameInline, false);+await store.openNewFolderModal({ modal: true });+assert.equal(openModalCalls, 2, 'external New folder keeps the modal window');+modalStack.length = 0;+'''+ subprocess.run(['node', '--input-type=module'], input=script, text=True, check=True)++ assert 'file-browser-picker-actions" x-show="$store.fileBrowser.isPickerMode() || $store.fileBrowser.renameInline"' in html+ assert 'renameInline ? $store.fileBrowser.confirmRename() : $store.fileBrowser.confirmPicker()' in html+ assert "x-model=\"$store.fileBrowser.renameName\"" in html+ assert "modal: true" in read("plugins", "_editor", "webui", "editor-store.js")+ assert "modal: true" in read("plugins", "_desktop", "webui", "desktop-store.js")+ dox = read("webui", "components", "modals", "file-browser", "AGENTS.md")+ assert "shared footer input" in dox+ assert "rename-modal.html` owns the rename and create-folder prompt for external callers" in dox++def test_file_browser_extract_and_editor_download_actions() -> None:browser_html = read("webui", "components", "modals", "file-browser", "file-browser.html")browser_store = read("webui", "components", "modals", "file-browser", "file-browser-store.js")diff --git a/webui/components/modals/file-browser/AGENTS.md b/webui/components/modals/file-browser/AGENTS.mdindex b2c2a4b4d..616167640 100644--- a/webui/components/modals/file-browser/AGENTS.md+++ b/webui/components/modals/file-browser/AGENTS.md@@ -10,7 +10,7 @@- `../../settings/file-browser/file-browser-settings.html` owns the shared Settings fields for default sort, list/icon view, tree visibility and starting folder, plus the saved remote connection list/form and per-connection permissions.- `file-browser-store.js` owns directory loading, remembered-location state, selection, upload/download/delete actions, and surface handoff state.- `file-tree.js` and `file-tree.html` own the shared lazy directory tree; Files and Editor each retain independent tree state.-- `rename-modal.html` owns rename and create-folder prompts that reuse the file-browser store.+- `rename-modal.html` owns the rename and create-folder prompt for external callers (Editor, Desktop) that have no live browser footer; inside the browser both flows use the shared footer input.## Local Contracts@@ -48,6 +48,7 @@- The list pane uses `padding: 0 6px`, a borderless list container/header bottom, and square file rows. Folder rows use the same `folder` Material Symbol as the tree; file-type SVGs remain for files. All list icons use a fixed 22px slot, with a 22px folder glyph, so folder and file names align. Folder glyphs match the muted gray in `webui/public/file.svg`.- Keep the list compact: 4px vertical header padding and 5px vertical item padding. The path-submit button (pencil icon in raw mode) is borderless and transparent, with opacity-only hover feedback.- One Create new (+) control owns both create actions across canvas and modal modes: its dropdown lists New file and New folder with accessible labels, each item keeping its original permission and picker visibility guards; the menu reuses the teleported dropdown chrome and closes on pick, outside click, Escape, and list scroll.+- New folder and Rename edit the name in the shared footer input (same `file-browser-picker-actions` row as the Save As filename) through `renameInline`; `openRenameModal(file, { modal: true })` and `openNewFolderModal({ modal: true })` keep the `rename-modal.html` window for external callers (Editor, Desktop) without a live browser. Inline close resets through `closeRenameModal()`, and `resetOpenState()` clears the inline state so reopen never merges picker and rename fields.- Keep Up, path, the Create new control, the tree toggle, and the settings gear in one compact row, with equal button heights. Do not add a separate search or totals row.- The path bar has two preference modes persisted in `fileBrowser.preferences.pathBar` (`buttons` default, `raw`): `raw` keeps the Up button plus the plain path input with the pencil submit button; `buttons` replaces Up and the input with parent-folder crumb buttons and an Edit toggle. Both modes share one field frame owned by the shell (`1px solid var(--color-border)`, 6px radius, 36px outer height, `background: var(--color-input)`); the input fills it via `height: 100%` with `border: 0` and must never set its own 36px height.- The raw input pins its scroll to the right end through the shared `pinPathInput` helper (ResizeObserver + double-rAF, re-run on `pathInput` changes and on blur): always when unfocused, and when focused only with the caret at the end; a caret moved mid-string keeps native caret-follow behavior.diff --git a/webui/components/modals/file-browser/file-browser-store.js b/webui/components/modals/file-browser/file-browser-store.jsindex 6941a5138..0438f52d5 100644--- a/webui/components/modals/file-browser/file-browser-store.js+++ b/webui/components/modals/file-browser/file-browser-store.js@@ -163,6 +163,7 @@ const model = {renameTarget: null,renameName: "",renameMode: "rename",+ renameInline: false,isRenaming: false,renameError: null,renameAfterConfirm: null,@@ -541,6 +542,7 @@ const model = {this.loadPreferences();this.closeDropdown();this.cancelMountedDefaultLoad();+ this.resetRenameState();this.isLoading = true;this.error = null;this.history = [];@@ -1342,6 +1344,7 @@ const model = {this.renameTarget = null;this.renameName = "";this.renameMode = "rename";+ this.renameInline = false;this.isRenaming = false;this.renameError = null;this.renameAfterConfirm = null;@@ -1699,18 +1702,32 @@ const model = {if (Array.isArray(options.entries)) {this.browser.entries = options.entries;}- window.openModal("modals/file-browser/rename-modal.html");+ // External callers without a live browser (Editor, Desktop) keep the modal window;+ // inside the browser the name is edited in the shared footer input.+ if (options.modal) {+ window.openModal("modals/file-browser/rename-modal.html");+ } else {+ this.renameInline = true;+ }},- async openNewFolderModal() {+ async openNewFolderModal(options = {}) {this.resetRenameState();this.renameMode = "create-folder";this.renameName = "";this.renameError = null;- window.openModal("modals/file-browser/rename-modal.html");+ if (options.modal) {+ window.openModal("modals/file-browser/rename-modal.html");+ } else {+ this.renameInline = true;+ }},closeRenameModal() {+ if (this.renameInline) {+ this.resetRenameState();+ return;+ }window.closeModal("modals/file-browser/rename-modal.html");},diff --git a/webui/components/modals/file-browser/file-browser.html b/webui/components/modals/file-browser/file-browser.htmlindex 7f9a473f3..19bd2e916 100644--- a/webui/components/modals/file-browser/file-browser.html+++ b/webui/components/modals/file-browser/file-browser.html@@ -562,7 +562,10 @@<!-- Modal Footer (outside template x-if so it exists immediately) --><template x-if="$store.fileBrowser"><div class="modal-footer file-browser-footer" data-modal-footer :class="{ 'is-surface': xAttrs($el)?.mode === 'canvas' }">- <div class="file-browser-picker-actions" x-show="$store.fileBrowser.isPickerMode()" style="display: none">+ <div class="file-browser-picker-actions" x-show="$store.fileBrowser.isPickerMode() || $store.fileBrowser.renameInline" style="display: none">+ <template x-if="$store.fileBrowser.renameInline">+ <span class="picker-inline-label" x-text="$store.fileBrowser.renameMode === 'create-folder' ? 'New folder' : 'Rename'"></span>+ </template><template x-if="$store.fileBrowser.isSaveAsPicker()"><inputtype="text"@@ -575,19 +578,36 @@spellcheck="false"/></template>+ <template x-if="$store.fileBrowser.renameInline">+ <input+ type="text"+ class="picker-filename-input"+ x-model="$store.fileBrowser.renameName"+ x-init="$el.focus()"+ @keydown.enter.prevent="$store.fileBrowser.confirmRename()"+ :placeholder="$store.fileBrowser.renameMode === 'create-folder' ? 'Folder name' : 'New name'"+ :aria-label="$store.fileBrowser.renameMode === 'create-folder' ? 'Folder name' : 'New name'"+ spellcheck="false"+ />+ </template><template x-if="$store.fileBrowser.pickerFilenameError"><span class="picker-inline-error" x-text="$store.fileBrowser.pickerFilenameError"></span></template>+ <template x-if="$store.fileBrowser.renameError">+ <span class="picker-inline-error" x-text="$store.fileBrowser.renameError"></span>+ </template><buttontype="button"class="btn btn-ok picker-confirm-button"- :disabled="!$store.fileBrowser.canConfirmPicker() || $store.fileBrowser.isBulkBusy"- @click="$store.fileBrowser.confirmPicker()"- x-text="$store.fileBrowser.pickerConfirmLabel"+ :disabled="$store.fileBrowser.renameInline+ ? ($store.fileBrowser.isRenaming || !$store.fileBrowser.renameName.trim())+ : (!$store.fileBrowser.canConfirmPicker() || $store.fileBrowser.isBulkBusy)"+ @click="$store.fileBrowser.renameInline ? $store.fileBrowser.confirmRename() : $store.fileBrowser.confirmPicker()"+ x-text="$store.fileBrowser.renameInline ? ($store.fileBrowser.renameMode === 'create-folder' ? 'Create Folder' : 'Rename') : $store.fileBrowser.pickerConfirmLabel"></button>- <button type="button" class="btn btn-cancel" :disabled="$store.fileBrowser.isBulkBusy" @click="$store.fileBrowser.cancelPicker()">Cancel</button>+ <button type="button" class="btn btn-cancel" :disabled="$store.fileBrowser.isBulkBusy || $store.fileBrowser.isRenaming" @click="$store.fileBrowser.renameInline ? $store.fileBrowser.closeRenameModal() : $store.fileBrowser.cancelPicker()">Cancel</button></div>- <label class="btn btn-upload" x-show="!$store.fileBrowser.isPickerMode() && $store.fileBrowser.remoteAllowed('upload')">+ <label class="btn btn-upload" x-show="!$store.fileBrowser.isPickerMode() && !$store.fileBrowser.renameInline && $store.fileBrowser.remoteAllowed('upload')"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><pathstroke-linecap="round"@@ -600,7 +620,7 @@</label><buttonclass="btn btn-cancel"- x-show="xAttrs($el)?.mode !== 'canvas' && !$store.fileBrowser.isPickerMode()"+ x-show="xAttrs($el)?.mode !== 'canvas' && !$store.fileBrowser.isPickerMode() && !$store.fileBrowser.renameInline"@click="$store.fileBrowser.handleClose()">Close Browser