Agent Zero AI framework
Add file browser search and bulk actions
Alessandrof17e13b859e2
diff --git a/api/delete_work_dir_files.py b/api/delete_work_dir_files.pynew file mode 100644index 000000000..b3ff00c75--- /dev/null+++ b/api/delete_work_dir_files.py@@ -0,0 +1,83 @@+from helpers.api import ApiHandler, Input, Output, Request+from helpers.file_browser import FileBrowser+from helpers import runtime, extension+from api import get_work_dir_files+from api.download_work_dir_files import normalize_paths+++class DeleteWorkDirFiles(ApiHandler):+ async def process(self, input: Input, request: Request) -> Output:+ try:+ paths = normalize_paths(input.get("paths", []))+ except ValueError as exc:+ return {"error": str(exc)}++ current_path = input.get("currentPath", "")++ if not paths:+ return {"error": "No file paths provided"}++ result = await runtime.call_development_function(delete_files, paths)+ deleted = result["deleted"]+ failed = result["failed"]++ if deleted:+ await extension.call_extensions_async(+ "workdir_file_mutation_after",+ agent=None,+ data={+ "action": "bulk_delete",+ "path": deleted[0],+ "paths": deleted,+ "current_path": current_path,+ },+ )++ files_result = await runtime.call_development_function(+ get_work_dir_files.get_files, current_path+ )++ if not deleted:+ return {+ "error": "Selected items could not be deleted",+ "data": files_result,+ "deleted": deleted,+ "failed": failed,+ }++ return {+ "data": files_result,+ "deleted": deleted,+ "failed": failed,+ }+++async def delete_files(paths: list[str]) -> dict:+ browser = FileBrowser()+ deleted: list[str] = []+ failed: list[str] = []++ for path in collapse_nested_paths(paths):+ if path == "/":+ failed.append(path)+ continue++ if browser.delete_file(path):+ deleted.append(path)+ else:+ failed.append(path)++ return {"deleted": deleted, "failed": failed}+++def collapse_nested_paths(paths: list[str]) -> list[str]:+ collapsed: list[str] = []+ for path in sorted(normalize_paths(paths), key=lambda item: item.count("/")):+ clean_path = "/" + path.strip("/")+ if any(+ clean_path == parent or clean_path.startswith(parent.rstrip("/") + "/")+ for parent in collapsed+ ):+ continue+ collapsed.append(clean_path)+ return collapseddiff --git a/api/download_work_dir_files.py b/api/download_work_dir_files.pynew file mode 100644index 000000000..a7a18d5de--- /dev/null+++ b/api/download_work_dir_files.py@@ -0,0 +1,179 @@+import base64+from datetime import datetime+from io import BytesIO+import os+from pathlib import Path+import tempfile+import zipfile++from flask import Response++from helpers.api import ApiHandler, Input, Output, Request+from helpers import files, runtime+from api.download_work_dir_file import fetch_file, stream_file_download+++class DownloadFiles(ApiHandler):+ async def process(self, input: Input, request: Request) -> Output:+ try:+ paths = normalize_paths(input.get("paths", []))+ except ValueError as exc:+ return Response(str(exc), status=400)++ current_path = input.get("currentPath", "")++ if not paths:+ return Response("No file paths provided", status=400)++ try:+ zip_file = await runtime.call_development_function(+ create_selected_zip, paths, current_path+ )+ except ValueError as exc:+ return Response(str(exc), status=400)+ except FileNotFoundError as exc:+ return Response(str(exc), status=404)++ download_name = selected_archive_name(len(paths))+ if runtime.is_development():+ b64 = await runtime.call_development_function(fetch_file, zip_file)+ file_data = BytesIO(base64.b64decode(b64))+ return stream_file_download(file_data, download_name=download_name)++ return stream_file_download(zip_file, download_name=download_name)+++def normalize_paths(paths) -> list[str]:+ if not isinstance(paths, list):+ raise ValueError("Paths must be a list")++ normalized: list[str] = []+ seen: set[str] = set()+ for raw_path in paths:+ if not isinstance(raw_path, str):+ continue+ path = raw_path.strip()+ if not path:+ continue+ if not path.startswith("/"):+ path = f"/{path}"+ if path not in seen:+ normalized.append(path)+ seen.add(path)++ return normalized+++def selected_archive_name(count: int) -> str:+ stamp = datetime.now().strftime("%Y%m%d-%H%M%S")+ return f"agent-zero-selected-{count}-{stamp}.zip"+++def create_selected_zip(paths: list[str], current_path: str = "") -> str:+ base_dir = Path(files.get_base_dir()).resolve()+ current_dir = resolve_download_path(current_path, base_dir) if current_path else None+ if current_dir and current_dir.is_file():+ current_dir = current_dir.parent++ selected_paths = []+ for path in normalize_paths(paths):+ resolved = resolve_download_path(path, base_dir)+ if resolved.exists():+ selected_paths.append(resolved)++ selected_paths = collapse_nested_paths(selected_paths)+ if not selected_paths:+ raise FileNotFoundError("No selected files were found")++ zip_file_path = tempfile.NamedTemporaryFile(suffix=".zip", delete=False).name+ used_names: set[str] = set()++ with zipfile.ZipFile(+ zip_file_path, "w", compression=zipfile.ZIP_DEFLATED, allowZip64=True+ ) as zip_file:+ for source_path in selected_paths:+ arc_root = unique_archive_name(+ archive_root_name(source_path, current_dir, base_dir), used_names+ )+ write_zip_entry(zip_file, source_path, arc_root)++ return zip_file_path+++def resolve_download_path(path: str, base_dir: Path) -> Path:+ if not path:+ raise ValueError("Invalid file path")++ candidate = Path(path)+ resolved = candidate.resolve() if candidate.is_absolute() else (base_dir / candidate).resolve()++ try:+ resolved.relative_to(base_dir)+ except ValueError as exc:+ raise ValueError("Invalid file path") from exc++ return resolved+++def collapse_nested_paths(paths: list[Path]) -> list[Path]:+ collapsed: list[Path] = []+ for path in sorted(paths, key=lambda item: len(item.parts)):+ if any(path == parent or parent in path.parents for parent in collapsed):+ continue+ collapsed.append(path)+ return collapsed+++def archive_root_name(source_path: Path, current_dir: Path | None, base_dir: Path) -> str:+ if current_dir:+ try:+ return source_path.relative_to(current_dir).as_posix().strip("/")+ except ValueError:+ pass++ try:+ return source_path.relative_to(base_dir).as_posix().strip("/")+ except ValueError:+ return source_path.name+++def unique_archive_name(name: str, used_names: set[str]) -> str:+ clean_name = name or "selection"+ if clean_name not in used_names:+ used_names.add(clean_name)+ return clean_name++ stem, suffix = os.path.splitext(clean_name)+ index = 2+ while True:+ candidate = f"{stem}-{index}{suffix}"+ if candidate not in used_names:+ used_names.add(candidate)+ return candidate+ index += 1+++def write_zip_entry(zip_file: zipfile.ZipFile, source_path: Path, arc_root: str) -> None:+ if source_path.is_dir():+ wrote_any = False+ for root, dirs, file_names in os.walk(source_path):+ dirs.sort()+ file_names.sort()+ root_path = Path(root)+ rel_root = root_path.relative_to(source_path)++ if not dirs and not file_names:+ empty_dir = Path(arc_root) / rel_root+ zip_file.writestr(empty_dir.as_posix().rstrip("/") + "/", "")++ for file_name in file_names:+ file_path = root_path / file_name+ rel_path = file_path.relative_to(source_path)+ zip_file.write(file_path, (Path(arc_root) / rel_path).as_posix())+ wrote_any = True++ if not wrote_any:+ zip_file.writestr(Path(arc_root).as_posix().rstrip("/") + "/", "")+ return++ zip_file.write(source_path, arc_root)diff --git a/webui/components/modals/file-browser/file-browser-store.js b/webui/components/modals/file-browser/file-browser-store.jsindex 32008d005..282ec1ab7 100644--- a/webui/components/modals/file-browser/file-browser-store.js+++ b/webui/components/modals/file-browser/file-browser-store.js@@ -26,6 +26,8 @@ const model = {renameAfterConfirm: null,renameValidateName: null,openDropdownPath: null, // Track which dropdown is currently open+ searchQuery: "",+ isBulkBusy: false,// --- Lifecycle -----------------------------------------------------------init() {@@ -38,6 +40,8 @@ const model = {this.isLoading = true;this.error = null;this.history = [];+ this.searchQuery = "";+ this.isBulkBusy = false;try {// Open modal FIRST (immediate UI feedback)@@ -75,6 +79,8 @@ const model = {this.initialPath = "";this.browser.entries = [];this.openDropdownPath = null;+ this.searchQuery = "";+ this.isBulkBusy = false;this.resetRenameState();},@@ -137,6 +143,76 @@ const model = {return new Date(dateString).toLocaleDateString(undefined, options);},+ decorateEntries(entries = [], selectedPaths = new Set()) {+ return entries.map((entry) => ({+ ...entry,+ selected: selectedPaths.has(entry.path),+ }));+ },++ get filteredEntries() {+ const query = this.searchQuery.trim().toLowerCase();+ if (!query) return this.browser.entries;++ return this.browser.entries.filter((file) => {+ const searchable = [+ file.name,+ file.path,+ file.type,+ file.symlink_target,+ file.is_dir ? "folder directory" : "file",+ ]+ .filter(Boolean)+ .join(" ")+ .toLowerCase();+ return searchable.includes(query);+ });+ },++ get visibleEntries() {+ return this.sortFiles(this.filteredEntries);+ },++ clearSearch() {+ this.searchQuery = "";+ },++ get selectedFiles() {+ return this.browser.entries.filter((file) => file.selected);+ },++ get selectedCount() {+ return this.selectedFiles.length;+ },++ get selectedCountLabel() {+ return `${this.selectedCount} ${this.selectedCount === 1 ? "item" : "items"} selected`;+ },++ get allVisibleSelected() {+ return (+ this.filteredEntries.length > 0 &&+ this.filteredEntries.every((file) => file.selected)+ );+ },++ get someVisibleSelected() {+ return this.filteredEntries.some((file) => file.selected);+ },++ toggleSelectAllVisible() {+ const shouldSelect = !this.allVisibleSelected;+ this.filteredEntries.forEach((file) => {+ file.selected = shouldSelect;+ });+ },++ clearSelection() {+ this.browser.entries.forEach((file) => {+ file.selected = false;+ });+ },+// --- Modal helpers -------------------------------------------------------normalizePath(path) {if (!path) return "";@@ -223,6 +299,9 @@ const model = {const isSamePath = this.browser.currentPath === path ||(!path && !this.browser.currentPath);const scrollPos = isSamePath ? this.saveScrollPosition() : null;+ const selectedPaths = isSamePath+ ? new Set(this.selectedFiles.map((file) => file.path))+ : new Set();try {const response = await fetchApi(@@ -231,7 +310,11 @@ const model = {const data = await response.json().catch(() => ({}));if (response.ok && !data.error) {- this.browser.entries = data.data.entries;+ if (!isSamePath) this.searchQuery = "";+ this.browser.entries = this.decorateEntries(+ data.data.entries || [],+ selectedPaths+ );this.browser.currentPath = data.data.current_path;this.browser.parentPath = data.data.parent_path;@@ -448,6 +531,162 @@ const model = {}},+ copySelectedPaths() {+ const selectedFiles = this.selectedFiles;+ if (!selectedFiles.length) return;++ const paths = selectedFiles.map((file) => file.path).join("\n");+ this.copyToClipboard(paths, () => {+ window.toastFrontendSuccess(+ `Copied ${selectedFiles.length} ${selectedFiles.length === 1 ? "path" : "paths"}`,+ "File Browser"+ );+ });+ },++ copyToClipboard(text, onSuccess) {+ if (navigator.clipboard && window.isSecureContext) {+ navigator.clipboard+ .writeText(text)+ .then(() => onSuccess?.())+ .catch(() => this.fallbackCopyToClipboard(text, onSuccess));+ } else {+ this.fallbackCopyToClipboard(text, onSuccess);+ }+ },++ fallbackCopyToClipboard(text, onSuccess) {+ const textArea = document.createElement("textarea");+ textArea.value = text;+ textArea.style.position = "fixed";+ textArea.style.left = "-999999px";+ textArea.style.top = "-999999px";+ document.body.appendChild(textArea);+ textArea.focus();+ textArea.select();+ try {+ document.execCommand("copy");+ onSuccess?.();+ } catch (error) {+ console.error("Clipboard copy failed:", error);+ window.toastFrontendError("Failed to copy selected paths", "File Browser");+ } finally {+ document.body.removeChild(textArea);+ }+ },++ getDownloadFilename(response, fallback) {+ const disposition = response.headers.get("Content-Disposition") || "";+ const utf8Match = disposition.match(/filename\*=UTF-8''([^;]+)/i);+ if (utf8Match?.[1]) {+ try {+ return decodeURIComponent(utf8Match[1].replace(/^"|"$/g, ""));+ } catch {+ return utf8Match[1].replace(/^"|"$/g, "");+ }+ }++ const asciiMatch = disposition.match(/filename="([^"]+)"/i);+ return asciiMatch?.[1] || fallback;+ },++ async bulkDownloadFiles() {+ const selectedFiles = this.selectedFiles;+ if (!selectedFiles.length || this.isBulkBusy) return;++ this.isBulkBusy = true;+ this.closeDropdown();++ try {+ const resp = await fetchApi("/download_work_dir_files", {+ method: "POST",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({+ paths: selectedFiles.map((file) => file.path),+ currentPath: this.browser.currentPath,+ }),+ });++ if (!resp.ok) {+ const message = await resp.text();+ throw new Error(message || "Download failed");+ }++ const blob = await resp.blob();+ const url = URL.createObjectURL(blob);+ const fallback = `agent-zero-files-${selectedFiles.length}.zip`;+ const link = document.createElement("a");+ link.href = url;+ link.download = this.getDownloadFilename(resp, fallback);+ document.body.appendChild(link);+ link.click();+ document.body.removeChild(link);+ setTimeout(() => URL.revokeObjectURL(url), 0);++ window.toastFrontendSuccess(+ `Prepared ${selectedFiles.length} ${selectedFiles.length === 1 ? "item" : "items"} as ZIP`,+ "File Browser"+ );+ } catch (error) {+ window.toastFrontendError(+ error?.message || "Failed to download selected files",+ "File Browser"+ );+ } finally {+ this.isBulkBusy = false;+ }+ },++ async bulkDeleteFiles() {+ const selectedFiles = this.selectedFiles;+ if (!selectedFiles.length || this.isBulkBusy) return;++ this.isBulkBusy = true;+ this.closeDropdown();++ try {+ const resp = await fetchApi("/delete_work_dir_files", {+ method: "POST",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({+ paths: selectedFiles.map((file) => file.path),+ currentPath: this.browser.currentPath,+ }),+ });+ const data = await resp.json().catch(() => ({}));++ if (resp.ok && !data.error) {+ this.browser.entries = this.decorateEntries(data.data?.entries || []);+ this.browser.currentPath = data.data?.current_path || this.browser.currentPath;+ this.browser.parentPath = data.data?.parent_path || this.browser.parentPath;+ const deletedCount = data.deleted?.length || selectedFiles.length;+ window.toastFrontendSuccess(+ `Deleted ${deletedCount} ${deletedCount === 1 ? "item" : "items"}`,+ "File Browser"+ );++ if (data.failed?.length) {+ window.toastFrontendError(+ `${data.failed.length} selected ${data.failed.length === 1 ? "item" : "items"} could not be deleted`,+ "File Browser"+ );+ }+ } else {+ window.toastFrontendError(+ data.error || "Error deleting selected files",+ "File Browser"+ );+ }+ } catch (error) {+ window.toastFrontendError(+ "Error deleting selected files: " + error.message,+ "File Browser"+ );+ } finally {+ this.isBulkBusy = false;+ }+ },+async handleFileUpload(event) {return store._handleFileUpload(event); // bind to model to ensure correct context},@@ -475,7 +714,7 @@ const model = {});const data = await resp.json().catch(() => ({}));if (resp.ok && !data.error) {- this.browser.entries = data.data.entries;+ this.browser.entries = this.decorateEntries(data.data.entries || []);this.browser.currentPath = data.data.current_path;this.browser.parentPath = data.data.parent_path;if (data.failed && data.failed.length) {diff --git a/webui/components/modals/file-browser/file-browser.html b/webui/components/modals/file-browser/file-browser.htmlindex 6e5e8ac63..271438b1c 100644--- a/webui/components/modals/file-browser/file-browser.html+++ b/webui/components/modals/file-browser/file-browser.html@@ -28,29 +28,142 @@</button><div id="current-path"><span id="path-text" x-text="$store.fileBrowser.browser.currentPath"></span></div></div>- <div class="new-item-buttons">- <button class="btn btn-ok btn-new-item" @click="$store.fileBrowser.openNewFile()">- <span class="material-symbols-outlined">note_add</span>- New File- </button>- <button class="btn btn-ok btn-new-item" @click="$store.fileBrowser.openNewFolderModal()">- <span class="material-symbols-outlined">create_new_folder</span>- New Folder- </button>+ <div class="file-browser-toolbar">+ <div class="file-search-shell">+ <span class="material-symbols-outlined file-search-icon" aria-hidden="true">search</span>+ <input+ type="search"+ class="file-search-input"+ x-model="$store.fileBrowser.searchQuery"+ @keydown.escape="$store.fileBrowser.clearSearch()"+ placeholder="Search files..."+ aria-label="Search files"+ />+ <button+ type="button"+ class="btn-icon-action file-search-clear"+ x-show="$store.fileBrowser.searchQuery"+ @click="$store.fileBrowser.clearSearch()"+ aria-label="Clear search"+ title="Clear search"+ >+ <span class="material-symbols-outlined">close</span>+ </button>+ </div>++ <div class="new-item-buttons">+ <button class="btn btn-ok btn-new-item" @click="$store.fileBrowser.openNewFile()">+ <span class="material-symbols-outlined">note_add</span>+ New File+ </button>+ <button class="btn btn-ok btn-new-item" @click="$store.fileBrowser.openNewFolderModal()">+ <span class="material-symbols-outlined">create_new_folder</span>+ New Folder+ </button>+ </div>+ </div>++ <div class="data-status-bar data-status-bar-standalone file-status-bar">+ <div class="status-info">+ <span class="status-item">+ <span class="material-symbols-outlined">folder</span>+ Total: <strong x-text="$store.fileBrowser.browser.entries.length"></strong>+ </span>+ <span class="status-separator">•</span>+ <span class="status-item">+ Filtered: <strong x-text="$store.fileBrowser.filteredEntries.length"></strong>+ </span>+ <template x-if="$store.fileBrowser.selectedCount > 0">+ <span class="status-separator">•</span>+ </template>+ <template x-if="$store.fileBrowser.selectedCount > 0">+ <span class="status-item">+ Selected: <strong x-text="$store.fileBrowser.selectedCount"></strong>+ </span>+ </template>+ </div>+ </div>++ <div x-show="$store.fileBrowser.selectedCount > 0" class="mass-action-toolbar file-mass-toolbar">+ <div class="selection-info" x-text="$store.fileBrowser.selectedCountLabel"></div>++ <div class="mass-actions">+ <button+ type="button"+ class="btn btn-mass copy"+ @click="$store.fileBrowser.copySelectedPaths()"+ :disabled="$store.fileBrowser.isBulkBusy"+ title="Copy Selected Paths"+ >+ <span class="material-symbols-outlined">content_copy</span>+ Copy Paths+ </button>++ <button+ type="button"+ class="btn btn-mass export"+ @click="$store.fileBrowser.bulkDownloadFiles()"+ :disabled="$store.fileBrowser.isBulkBusy"+ title="Download Selected Items"+ >+ <span class="material-symbols-outlined">folder_zip</span>+ Download ZIP+ </button>++ <button+ type="button"+ class="btn btn-mass delete"+ @click="$confirmClick($event, () => $store.fileBrowser.bulkDeleteFiles())"+ :disabled="$store.fileBrowser.isBulkBusy"+ title="Delete Selected Items"+ >+ <span class="material-symbols-outlined">delete</span>+ Delete+ </button>++ <button+ type="button"+ class="btn btn-mass clear"+ @click="$store.fileBrowser.clearSelection()"+ :disabled="$store.fileBrowser.isBulkBusy"+ title="Clear Selection"+ >+ <span class="material-symbols-outlined">close</span>+ Clear+ </button>+ </div></div><!-- Files list --><div class="files-list"><div class="file-header">+ <div class="file-cell-select">+ <input+ type="checkbox"+ :checked="$store.fileBrowser.allVisibleSelected"+ :indeterminate="$store.fileBrowser.someVisibleSelected && !$store.fileBrowser.allVisibleSelected"+ @change="$store.fileBrowser.toggleSelectAllVisible()"+ title="Select visible items"+ aria-label="Select visible items"+ />+ </div><div class="file-cell" @click="$store.fileBrowser.toggleSort('name')">Name <span x-show="$store.fileBrowser.browser.sortBy === 'name'" x-text="$store.fileBrowser.browser.sortDirection === 'asc' ? '↑' : '↓'"></span></div><div class="file-cell-size" @click="$store.fileBrowser.toggleSort('size')">Size <span x-show="$store.fileBrowser.browser.sortBy === 'size'" x-text="$store.fileBrowser.browser.sortDirection === 'asc' ? '↑' : '↓'"></span></div><div class="file-cell-date" @click="$store.fileBrowser.toggleSort('date')">Modified <span x-show="$store.fileBrowser.browser.sortBy === 'date'" x-text="$store.fileBrowser.browser.sortDirection === 'asc' ? '↑' : '↓'"></span></div>+ <div class="file-cell-actions"></div></div><!-- File list entries -->- <template x-if="$store.fileBrowser.browser.entries.length">- <template x-for="file in $store.fileBrowser.sortFiles($store.fileBrowser.browser.entries)" :key="file.path">- <div class="file-item" :data-is-dir="file.is_dir">+ <template x-if="$store.fileBrowser.visibleEntries.length">+ <template x-for="file in $store.fileBrowser.visibleEntries" :key="file.path">+ <div class="file-item" :data-is-dir="file.is_dir" :class="{ 'selected': file.selected }">+ <label class="file-select-cell" @click.stop>+ <input+ type="checkbox"+ x-model="file.selected"+ :aria-label="`Select ${file.name}`"+ />+ </label><div class="file-name" @click="file.is_dir && $store.fileBrowser.navigateToFolder(file.path)"><img :src="'/public/' + (file.type === 'unknown' ? 'file' : ($store.fileBrowser.isArchive(file.name) ? 'archive' : file.type)) + '.svg'" class="file-icon" :alt="file.type" /><span x-text="file.name"></span>@@ -116,7 +229,7 @@<button class="btn-icon-action" x-show="!file.is_dir" @click.stop="$store.fileBrowser.downloadFile(file)" title="Download file"><span class="material-symbols-outlined">download</span></button>- <button class="btn-icon-action" @click.stop="$confirmClick($event, () => $store.fileBrowser.deleteFile(file))" title="Delete item">+ <button class="btn-icon-action danger" @click.stop="$confirmClick($event, () => $store.fileBrowser.deleteFile(file))" title="Delete item"><span class="material-symbols-outlined">delete</span></button></div>@@ -128,6 +241,15 @@<template x-if="!$store.fileBrowser.browser.entries.length"><div class="no-files">No files found</div></template>+ <template x-if="$store.fileBrowser.browser.entries.length && !$store.fileBrowser.visibleEntries.length">+ <div class="no-files">+ <div>No matching files found</div>+ <button class="btn btn-cancel btn-clear-search" @click="$store.fileBrowser.clearSearch()">+ <span class="material-symbols-outlined">close</span>+ Clear+ </button>+ </div>+ </template></div></div></div>@@ -193,6 +315,7 @@display: flex;flex-direction: column;padding: var(--spacing-sm) var(--spacing-sm);+ gap: var(--spacing-sm);}/* File Browser Styles */@@ -208,13 +331,19 @@border-radius: 4px;overflow: hidden;display: grid;- grid-template-columns: 1.5fr 0.71fr 1.05fr 0.6fr;+ grid-template-columns: 2.5rem minmax(0, 1.5fr) minmax(5.5rem, 0.7fr) minmax(9rem, 1fr) 7.5rem;background: var(--secondary-bg);padding: 8px 0;font-weight: bold;border-bottom: 1px solid var(--border-color);color: var(--color-primary);}+ .file-cell-select,+ .file-cell-actions {+ display: flex;+ align-items: center;+ justify-content: center;+ }.file-cell,.file-cell-size,.file-cell-date {@@ -226,7 +355,7 @@/* File Item Styles */.file-item {display: grid;- grid-template-columns: 1.5fr 0.7fr 1fr 0.6fr;+ grid-template-columns: 2.5rem minmax(0, 1.5fr) minmax(5.5rem, 0.7fr) minmax(9rem, 1fr) 7.5rem;align-items: center;padding: 8px 0;font-size: 0.875rem;@@ -240,6 +369,25 @@.file-item:hover {background-color: var(--color-secondary);}+ .file-item.selected {+ background: color-mix(in srgb, var(--color-primary) 12%, transparent);+ }++ .file-select-cell {+ display: flex;+ align-items: center;+ justify-content: center;+ cursor: pointer;+ min-height: 1.75rem;+ }++ .file-cell-select input,+ .file-select-cell input {+ width: 1rem;+ height: 1rem;+ accent-color: var(--color-primary);+ cursor: pointer;+ }/* File Icon and Name */.file-icon {@@ -271,6 +419,12 @@text-align: center;color: var(--text-secondary);}+ .no-files .btn-clear-search {+ display: inline-flex;+ align-items: center;+ gap: 0.25rem;+ margin-top: 0.75rem;+ }/* Light Mode Adjustments */.light-mode .file-item:hover {background-color: var(--color-secondary-light);@@ -284,20 +438,86 @@gap: 24px;background-color: var(--color-message-bg);padding: 0.5rem var(--spacing-sm);- margin: 0 0 var(--spacing-sm) 0;+ margin: 0;border: 1px solid var(--color-border);border-radius: 8px;}+ .file-browser-toolbar {+ display: flex;+ align-items: center;+ justify-content: space-between;+ gap: var(--spacing-sm);+ }++ .file-search-shell {+ position: relative;+ display: flex;+ align-items: center;+ min-width: 16rem;+ flex: 1;+ }++ .file-search-icon {+ position: absolute;+ left: 0.65rem;+ font-size: 1.1rem;+ color: var(--color-primary);+ opacity: 0.72;+ pointer-events: none;+ }++ .file-search-input {+ width: 100%;+ height: 2.4rem;+ border: 1px solid var(--color-border);+ border-radius: 6px;+ background: var(--color-input);+ color: var(--color-text);+ padding: 0 2.35rem 0 2.2rem;+ font: inherit;+ transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;+ }++ .file-search-input:focus {+ outline: none;+ border-color: var(--color-primary);+ background: var(--color-input-focus);+ box-shadow: 0 0 0 1px color-mix(in srgb, var(--color-primary) 20%, transparent);+ }++ .file-search-clear {+ position: absolute;+ right: 0.35rem;+ width: 1.65rem;+ height: 1.65rem;+ color: var(--color-text);+ }+.new-item-buttons {display: flex;justify-content: flex-end;gap: 0.5em;- margin-bottom: 0.5em;}.new-item-buttons button {margin-left: 0.5em;}++ .file-status-bar {+ border-radius: 8px 8px 0 0;+ margin-bottom: calc(-1 * var(--spacing-sm));+ }++ .file-mass-toolbar {+ border-left: 1px solid var(--color-border);+ border-right: 1px solid var(--color-border);+ border-bottom: 1px solid var(--color-border);+ }++ .file-mass-toolbar .btn-mass:disabled {+ opacity: 0.55;+ cursor: wait;+ }.nav-button {padding: 4px 12px;@@ -362,6 +582,8 @@.file-actions {display: flex;gap: var(--spacing-xs);+ justify-content: flex-end;+ padding-right: 0.5rem;}.file-actions .dropdown-menu {top: auto !important;@@ -388,11 +610,26 @@}/* Responsive Design */@media (max-width: 768px) {+ .file-browser-toolbar {+ align-items: stretch;+ flex-direction: column;+ }+ .file-search-shell {+ min-width: 0;+ width: 100%;+ }+ .new-item-buttons {+ width: 100%;+ }+ .new-item-buttons .btn-new-item {+ flex: 1;+ justify-content: center;+ }.file-header {- grid-template-columns: 1fr 0.52fr 120px;+ grid-template-columns: 2.25rem minmax(0, 1fr) minmax(5rem, 0.52fr) 7.5rem;}.file-item {- grid-template-columns: 1fr 0.5fr 120px;+ grid-template-columns: 2.25rem minmax(0, 1fr) minmax(5rem, 0.5fr) 7.5rem;}.file-cell-date,.file-date {@@ -402,7 +639,7 @@@media (max-width: 540px) {.file-header,.file-item {- grid-template-columns: 1fr 120px;+ grid-template-columns: 2.25rem minmax(0, 1fr) 7.5rem;}.file-cell-size,.file-size,