Agent Zero AI framework
Navigate a live file browser in place for path links
linkliti48b1fa815223
diff --git a/tests/test_file_browser_path_link.py b/tests/test_file_browser_path_link.pynew file mode 100644index 000000000..044240f56--- /dev/null+++ b/tests/test_file_browser_path_link.py@@ -0,0 +1,21 @@+from __future__ import annotations++from pathlib import Path+++PROJECT_ROOT = Path(__file__).resolve().parents[1]+STORE_PATH = PROJECT_ROOT / "webui/components/modals/file-browser/file-browser-store.js"+++def test_open_file_link_navigates_live_browser_in_place():+ """Path-link clicks must reuse a live file browser instead of stacking a second window."""+ source = STORE_PATH.read_text(encoding="utf-8")+ assert "window.openFileLink" in source+ assert "hasLiveBrowser" in source+ assert "navigateToFolder(resp.abs_path)" in source+++def test_open_file_link_keeps_modal_fallback():+ """Without a live browser the path link still opens the browser with the clicked path."""+ source = STORE_PATH.read_text(encoding="utf-8")+ assert "await store.open(resp.abs_path)" in sourcediff --git a/webui/components/modals/file-browser/AGENTS.md b/webui/components/modals/file-browser/AGENTS.mdindex 7c4d001fa..38c7f9c57 100644--- a/webui/components/modals/file-browser/AGENTS.md+++ b/webui/components/modals/file-browser/AGENTS.md@@ -15,6 +15,7 @@## Local Contracts- Keep `open(path)` as the modal entry point for workflows that await browser close.+- `openFileLink` path-link clicks reuse a live browser in place: an open browser modal or a visible docked Files surface navigates through `navigateToFolder` instead of stacking a second window; with no live browser it falls back to `open(path)` preserving the clicked path.- A picker opened while a canvas surface is mounted must restore the surface listing on close (`openSurface(retainedPath)`), never destroy the shared store state — destroy only runs when no surface is active.- Keep `openSurface(path)` as the right-canvas entry point; it must load files without opening or awaiting a modal.- The floating file-browser modal must use the shared surface modal chrome so it remains draggable/resizable and exposes Focus mode.diff --git a/webui/components/modals/file-browser/file-browser-store.js b/webui/components/modals/file-browser/file-browser-store.jsindex 065337fde..7a62923f9 100644--- a/webui/components/modals/file-browser/file-browser-store.js+++ b/webui/components/modals/file-browser/file-browser-store.js@@ -2170,8 +2170,15 @@ window.openFileLink = async function (path) {return;}if (resp.is_dir) {- // Set initial path and open via store- await store.open(resp.abs_path);+ // A live browser navigates in place instead of stacking a second window.+ const { store: canvasStore } = await import("/components/canvas/right-canvas-store.js");+ const hasLiveBrowser = window.isModalOpen?.(FILE_BROWSER_MODAL_PATH)+ || (canvasStore.shouldRender?.() && canvasStore.isSurfaceVisible?.("files"));+ if (hasLiveBrowser) {+ await store.navigateToFolder(resp.abs_path);+ } else {+ await store.open(resp.abs_path);+ }} else {store.downloadFile({ path: resp.abs_path, name: resp.file_name });}