From 2a0d2649e18832d9a1497a7f503e288bcc818a39 Mon Sep 17 00:00:00 2001 From: SleepinDevil Date: Tue, 3 Nov 2026 12:24:23 +1100 Subject: [PATCH 1/3] feat(explorer): toggle to browse normally-hidden directories The file tree always hid the IGNORED_NAMES skip-list (build/, dist/, node_modules/, ...), so a built artifact could not be opened from the Explorer at all. An eye toggle in the explorer toolbar, beside the search button, lists them through ?hidden=1 on the existing list route; the choice persists in localStorage and defaults to off. Toggling drops the cached directory listings and re-reads the visible ones, keeping expansion state. Scope is the file tree only: file-index search and @-mentions keep the current behavior. --- CHANGELOG.md | 1 + app/api/files/[...path]/route.ts | 8 +++-- components/AppShell.tsx | 18 ++++++++++ components/FileExplorer.tsx | 26 +++++++++++--- components/RightPanel.tsx | 18 ++++++++++ lib/files-list-hidden.test.mjs | 61 ++++++++++++++++++++++++++++++++ lib/i18n/locales/en.json | 1 + lib/i18n/locales/ja.json | 1 + lib/i18n/locales/zh-CN.json | 1 + 9 files changed, 129 insertions(+), 6 deletions(-) create mode 100644 lib/files-list-hidden.test.mjs diff --git a/CHANGELOG.md b/CHANGELOG.md index 28068833e..68e28709d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ All notable changes to **omp-web** (`@kahme247/ompweb`) are documented in this f - **Session search shows where each session matched.** While searching the sidebar, the arrow beside a session lists its matches one per line, best match first and newest first among equals, ten at a time with **Load more…**. Matches in the messages of the open conversation are highlighted, typos and partial words included (thinking, tool output and math are not searched; link addresses and image descriptions do not count), and clicking a match opens its session, scrolls to it and marks it as the current one, like the browser's find. Closing or clearing the search removes the highlights. Browsers without the CSS Custom Highlight API (before Chrome 105, Safari 17.2 or Firefox 140) still jump to the match but do not paint it. - **Show tool calls outside Process details.** A new setting keeps each tool call's row in the transcript instead of folding it; whether the row opens still follows "Keep tool calls collapsed". - **Never fold tool activity.** A new setting renders every turn flat, with no Process details rows at all. Long turns are paged, and jumping to a search match reveals its message even outside the current page. +- **Show hidden items in the Explorer.** A switch in the file panel's toolbar lists the folders the tree normally hides — `build/`, `dist/`, `node_modules/`, `target/` and the rest — so you can browse into them and open a file from there. It changes only the file tree; search and @-mentions keep ignoring those paths. It is off by default, and your choice is remembered. - **Updates belong to each host.** Settings → Hosts now shows the ompweb daemon and OMP runtime versions, available updates, and update actions for every machine, including This machine. Checks and installations run on that host. An incompatible or unverifiable daemon update stays visible but blocked, with a reason to update the web server first; OMP updates are independent of the link protocol. A daemon update is refused while session processes or subagents run on that host (close them, then start it again), and the host refuses new sessions while it installs. The host update retains a backup and reports progress after reconnect. **System & Updates** is now **System**, containing only the web server's controls; it no longer updates or restarts a host's OMP sessions globally. ### Fixes & Improvements diff --git a/app/api/files/[...path]/route.ts b/app/api/files/[...path]/route.ts index f219f1e15..9c6458ed3 100644 --- a/app/api/files/[...path]/route.ts +++ b/app/api/files/[...path]/route.ts @@ -26,7 +26,7 @@ import { parseFormDataWithinLimit, parseJsonWithinLimit, RequestBodyTooLargeErro const IGNORED_NAMES = new Set([ "node_modules", ".git", ".next", "dist", "build", "__pycache__", ".turbo", ".cache", "coverage", ".pytest_cache", ".mypy_cache", - "target", "vendor", ".DS_Store", ".git", + "target", "vendor", ".DS_Store", ]); const IGNORED_SUFFIXES = [".pyc"]; @@ -412,6 +412,10 @@ export async function GET( return Response.json({ error: "Invalid file request type", code: "invalid_request_type" }, { status: 400 }); } const sessionId = searchParams.get("sessionId"); + // The explorer's "Show hidden items" toggle: for `type=list` only, skip the + // IGNORED_NAMES/IGNORED_SUFFIXES skip-list so build/ and friends can be + // browsed. Everything else (reads, downloads) never applied it anyway. + const showHidden = searchParams.get("hidden") === "1"; const access = await authorizeFileAccess(segments, sessionId, type !== "list"); if (!access.ok) { @@ -516,7 +520,7 @@ export async function GET( const readDirectorySync = Reflect.get(fs, "readdirSync") as typeof fs.readdirSync; const dirents = readDirectorySync(filePath, { withFileTypes: true }); const entries = dirents - .filter((d) => !IGNORED_NAMES.has(d.name) && !IGNORED_SUFFIXES.some((s) => d.name.endsWith(s))) + .filter((d) => showHidden || (!IGNORED_NAMES.has(d.name) && !IGNORED_SUFFIXES.some((s) => d.name.endsWith(s)))) .flatMap((d) => { const isDir = resolveDirentIsDirectory(d, path.join(filePath, d.name)); return isDir === null diff --git a/components/AppShell.tsx b/components/AppShell.tsx index c6056ccdf..1a2009e84 100644 --- a/components/AppShell.tsx +++ b/components/AppShell.tsx @@ -109,6 +109,9 @@ const EXPAND_THINKING_STORAGE_KEY = "omp-web:expand-thinking"; const PROVIDER_USAGE_VISIBLE_STORAGE_KEY = "omp-web:provider-usage-visible"; const NATIVE_SELECT_ALL_STORAGE_KEY = "omp-web:scope-native-select-all"; const OPEN_URL_AUTOMATICALLY_STORAGE_KEY = "omp-web:open-url-automatically"; +// Off by default, so the Explorer keeps hiding build/, node_modules/ and the +// other IGNORED_NAMES directories until the toolbar switch is flipped. +const SHOW_HIDDEN_FILES_STORAGE_KEY = "omp-web:show-hidden-files"; type AutoNameStatus = @@ -180,6 +183,7 @@ export function AppShell({ appName }: { appName: string }) { const [providerUsageVisible, setProviderUsageVisible] = useState(true); const [scopeNativeSelectAll, setScopeNativeSelectAll] = useState(false); const [openUrlAutomatically, setOpenUrlAutomatically] = useState(false); + const [showHiddenFiles, setShowHiddenFiles] = useState(false); const [sidebarResizing, setSidebarResizing] = useState(false); // Active drag handlers so an unmount mid-drag can detach them. const sidebarResizeHandlersRef = useRef<{ onMove: (ev: MouseEvent) => void; onUp: () => void } | null>(null); @@ -200,6 +204,7 @@ export function AppShell({ appName }: { appName: string }) { setProviderUsageVisible(window.localStorage.getItem(PROVIDER_USAGE_VISIBLE_STORAGE_KEY) !== "false"); setScopeNativeSelectAll(window.localStorage.getItem(NATIVE_SELECT_ALL_STORAGE_KEY) === "true"); setOpenUrlAutomatically(window.localStorage.getItem(OPEN_URL_AUTOMATICALLY_STORAGE_KEY) === "true"); + setShowHiddenFiles(window.localStorage.getItem(SHOW_HIDDEN_FILES_STORAGE_KEY) === "true"); } catch { // Keep the compact default when storage is unavailable. } @@ -268,6 +273,17 @@ export function AppShell({ appName }: { appName: string }) { // The preference still applies for this page load. } }, []); + const handleToggleShowHiddenFiles = useCallback(() => { + setShowHiddenFiles((prev) => { + const next = !prev; + try { + window.localStorage.setItem(SHOW_HIDDEN_FILES_STORAGE_KEY, String(next)); + } catch { + // The preference still applies for this page load. + } + return next; + }); + }, []); // Persist the committed width (after each change; skipped mid-drag, then // written once the drag ends). The first run is skipped so the mount-time // default cannot overwrite the stored width before it is loaded. @@ -2660,6 +2676,8 @@ export function AppShell({ appName }: { appName: string }) { fileSearchOpen={fileSearchOpen} onToggleFileSearch={handleToggleFileSearch} onFileSearchOpenChange={setFileSearchOpen} + showHiddenFiles={showHiddenFiles} + onToggleShowHiddenFiles={handleToggleShowHiddenFiles} explorerUploadBusy={explorerUploadBusy} onUploadBusyChange={setExplorerUploadBusy} explorerGitCount={explorerGitCount} diff --git a/components/FileExplorer.tsx b/components/FileExplorer.tsx index d257878f2..5d50496fa 100644 --- a/components/FileExplorer.tsx +++ b/components/FileExplorer.tsx @@ -57,6 +57,8 @@ interface Props { onRefreshDone?: () => void; fileSearchOpen?: boolean; onFileSearchOpenChange?: (open: boolean) => void; + /** List the IGNORED_NAMES directories (build/, dist/, …) the tree hides by default. */ + showHidden?: boolean; /** Absolute path of the file open in the right panel — rendered selected. */ activeFilePath?: string | null; /** Absolute path to expand, highlight, and scroll into view (one-shot). */ @@ -100,9 +102,9 @@ interface PendingConflict { nonReplaceable: string[]; } -async function fetchEntries(dirPath: string): Promise { +async function fetchEntries(dirPath: string, showHidden: boolean): Promise { const encoded = encodeFilePathForApi(dirPath); - const res = await fetch(`/api/files/${encoded}?type=list`); + const res = await fetch(`/api/files/${encoded}?type=list${showHidden ? "&hidden=1" : ""}`); if (!res.ok) { let message = translate("fileExplorer.loadFailed", { status: res.status }); try { @@ -512,6 +514,7 @@ export const FileExplorer = forwardRef(function FileE onRefreshDone, fileSearchOpen = false, onFileSearchOpenChange, + showHidden = false, activeFilePath = null, revealPath = null, onRevealDone, @@ -709,7 +712,7 @@ export const FileExplorer = forwardRef(function FileE if (loadingPathsRef.current.has(dirPath)) return Promise.resolve(); loadingPathsRef.current.add(dirPath); setLoadingPaths((prev) => new Set(prev).add(dirPath)); - return fetchEntries(dirPath) + return fetchEntries(dirPath, showHidden) .then((entries) => { setChildrenByPath((prev) => { const next = new Map(prev); @@ -729,7 +732,7 @@ export const FileExplorer = forwardRef(function FileE return next; }); }); - }, [cwd]); + }, [cwd, showHidden]); // Scroll the virtual window so a row is visible, then focus it. The focus // retries across frames: the scroll triggers an async window re-render and @@ -1003,6 +1006,21 @@ export const FileExplorer = forwardRef(function FileE // eslint-disable-next-line react-hooks/exhaustive-deps }, [cwd, refreshKey, treeRefreshKey]); + // Flipping "Show hidden items" changes what every listing returns, so no + // cached directory listing may survive it: drop the map (the root and every + // expanded directory are then re-fetched by the effects above — the cached + // listings of collapsed directories would otherwise be served stale when + // they expand). Expansion state is deliberately kept. + const prevShowHiddenRef = useRef(showHidden); + useEffect(() => { + if (prevShowHiddenRef.current === showHidden) return; + prevShowHiddenRef.current = showHidden; + setChildrenByPath(new Map()); + loadingPathsRef.current = new Set(); + setLoadingPaths(new Set()); + setTreeRefreshKey((key) => key + 1); + }, [showHidden]); + // Fetch any expanded directory that has no listing yet. Clicks, keyboard, // and reveal all funnel through expandedPaths, so this single effect covers // every expansion path — including levels that mount while a reveal diff --git a/components/RightPanel.tsx b/components/RightPanel.tsx index 91aae9403..4d32c6509 100644 --- a/components/RightPanel.tsx +++ b/components/RightPanel.tsx @@ -6,6 +6,7 @@ import { ChevronsDownUp, Copy, Download, + Eye, FileX, Files, Folder, @@ -51,6 +52,9 @@ interface Props { fileSearchOpen: boolean; onToggleFileSearch: () => void; onFileSearchOpenChange: (open: boolean) => void; + /** Explorer tree includes the directories hidden by default (build/, dist/, …). */ + showHiddenFiles: boolean; + onToggleShowHiddenFiles: () => void; explorerUploadBusy: boolean; onUploadBusyChange: (busy: boolean) => void; explorerGitCount: number; @@ -103,6 +107,8 @@ export const RightPanel = memo(function RightPanel({ fileSearchOpen, onToggleFileSearch, onFileSearchOpenChange, + showHiddenFiles, + onToggleShowHiddenFiles, explorerUploadBusy, onUploadBusyChange, explorerGitCount, @@ -228,6 +234,17 @@ export const RightPanel = memo(function RightPanel({ >