Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -1031,6 +1031,10 @@ during the wait.
- `/api/cwd/validate`, `/api/default-cwd`, and `/api/worktrees` call `allowFileRoot()` when they make a new location browsable.
- The session-id → file path cache (`cacheSessionPath`, `lib/session-reader.ts`) on main is filled by main's own scans and by wrappers on the local host; it only serves the readers listed under "Session list caching".

### Explorer hidden items
- The tree skip-list (`IGNORED_NAMES`/`IGNORED_SUFFIXES`) is **duplicated** in `app/api/files/[...path]/route.ts` and `app/api/file-index/route.ts` — edit both or extract a shared module.
- The Explorer's "Show hidden items" toggle sends `?hidden=1`, which bypasses the skip-list for `type=list` only. It deliberately does NOT touch `/api/file-index` — @-mentions and file search keep ignoring those paths. State is AppShell-owned (localStorage `omp-web:show-hidden-files`, off by default); flipping it makes `FileExplorer` drop its cached listings and re-read the visible directories, keeping expansion.

### Session list caching — new sessions must appear immediately
- The sidebar and command palette list sessions per host: `listSessionsAllHosts()` (`lib/hosts/session-index.ts`) calls each host's `listSessions` op and caches it 30 s per host (`LIST_TTL_MS`, the daemon's own TTL). **This machine's list is its daemon's**; a host that fails or is offline keeps its last list. Nothing on main parses session files to build it.
- The daemon's `listSessions` is `listAllSessions()` (`lib/session-reader.ts`): a 30 s TTL list cache plus an mtime-keyed directory walk in `lib/omp/session-files.ts` (`listSessionFiles`), both in the daemon process.
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Linux トレイ、Windows サービス)はインストール時に `OMP_WEB_PA
- **セッション管理**: プロジェクトごとに履歴を一覧表示、分岐やフォークにも対応。
- **下書きの復元**: 未送信のテキストを会話または新規セッションのワークスペースごとに保存し、ブラウザストレージが利用可能な場合は、同じタブでの「戻る」「進む」や再読み込み後に復元します(最大 50 件)。画像と添付ファイルはメモリ内にのみ保持されます。
- **ライブタスク&サブエージェント**: Todo リストと稼働中サブエージェントの進捗を折りたたみパネルでリアルタイム表示。
- **ファイル閲覧・プレビュー**: チャットと並べてファイルを閲覧、コード・Markdown・画像・音声・PDF をプレビュー。
- **ファイル閲覧・プレビュー**: チャットと並べてファイルを閲覧、コード・Markdown・画像・音声・PDF をプレビュー。「隠し項目を表示」でビルド生成物や依存関係も一覧できます。
- **Git Worktree サポート**: サイドバーから直接 Git ワークツリーを切り替え・管理。
- **GUI 設定管理**: 設定ファイルを直接編集することなく、モデル、API キー、MCP サーバー、スキル、プラグイン、OMP 設定を変更可能。
- **スラッシュコマンド・ショートカット**: `/plan`、`/review`、`/fix`、`/test` などの定型プロンプトと `⌘K` / `Ctrl+K` コマンドパレット。
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ Stop it with `Stop-ScheduledTask ompweb-host`, then end the running host with
- **Draft Recovery**: Unsent text stays scoped to its conversation or new-session workspace and is restored after Back/Forward navigation or reload in the same tab when browser storage is available (up to 50 drafts). Images and file attachments remain in memory only.
- **Live Plans & Subagents**: Collapsible panels pinned above the composer track live todo phases and running subagents (status, tool, retries, tokens/cost, nested tasks) with transcript dialogs and history recovery.
- **Tool Preset Picker**: Choose the toolset for new sessions in the composer — `none` / `default` (`read,bash,edit,write`) / `full` (all tools including subagents). Persists to localStorage.
- **File Explorer & Previews**: Browse workspaces side-by-side with chat; preview code, markdown, Mermaid, images, audio, PDFs, and diffs with allow-listed access.
- **File Explorer & Previews**: Browse workspaces side-by-side with chat; preview code, markdown, Mermaid, images, audio, PDFs, and diffs with allow-listed access. The **Show hidden items** switch lists build and dependency folders.
- **Git Worktree Support**: Create, switch, and manage Git worktrees directly from the sidebar; sessions and file roots stay grouped by project.
- **Remote Hosts**: Link other machines (for example a MacBook) and run sessions there from one ompweb. The sidebar groups sessions by host. See [Run sessions on another machine](#run-sessions-on-another-machine).
- **Usage & Analytics**: Dashboard in **Settings → Usage** for tokens, costs, cache savings, and breakdowns by provider / model / day / project with SQLite persistence.
Expand Down
2 changes: 1 addition & 1 deletion README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Windows 服务)仍在安装时接受 `OMP_WEB_PASSWORD`,但在写入配置
- **会话管理**:按项目浏览历史会话,支持会话分叉与分支回溯。
- **草稿恢复**:未发送的文本按会话或新会话的工作区分别保存;浏览器存储可用时,在同一标签页后退、前进或重新加载后可恢复(最多 50 份草稿)。图片和文件附件仅保留在内存中。
- **实时任务与子智能体**:可折叠面板实时展示任务清单(todo)与子智能体进度,并支持查看完整转录。
- **文件管理与预览**:与对话并排浏览文件,支持代码、Markdown、图片、音频及 PDF 预览。
- **文件管理与预览**:与对话并排浏览文件,支持代码、Markdown、图片、音频及 PDF 预览。通过「显示隐藏项目」可列出构建产物与依赖目录。
- **Git Worktree 支持**:直接在侧边栏切换与管理 Git 工作树。
- **可视化设置**:在 Web 界面中直接配置模型、API 密钥、MCP 服务器、技能、插件及 OMP 原生设置。
- **快捷指令与命令面板**:内置常用指令(`/plan`、`/review`、`/fix`、`/test` 等)及 `⌘K` / `Ctrl+K` 全局面板。
Expand Down
8 changes: 6 additions & 2 deletions app/api/files/[...path]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"];
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down
18 changes: 18 additions & 0 deletions components/AppShell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@
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 =
Expand Down Expand Up @@ -180,6 +183,7 @@
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);
Expand All @@ -200,6 +204,7 @@
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.
}
Expand Down Expand Up @@ -268,6 +273,17 @@
// 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.
Expand Down Expand Up @@ -358,7 +374,7 @@
if (container && active instanceof HTMLElement && container.contains(active)) {
active.blur();
}
}, [sidebarOpen, mobileSidebarReady]);

Check warning on line 377 in components/AppShell.tsx

View workflow job for this annotation

GitHub Actions / Verify (windows-latest)

React Hook useLayoutEffect has a missing dependency: 'sidebarContainerRef'. Either include it or remove the dependency array

Check warning on line 377 in components/AppShell.tsx

View workflow job for this annotation

GitHub Actions / Verify (ubuntu-latest)

React Hook useLayoutEffect has a missing dependency: 'sidebarContainerRef'. Either include it or remove the dependency array
const refreshAppUpdate = useCallback(async (force = false, autoOpen = false): Promise<AppUpdateInfo | null> => {
const data = await fetchAppUpdateJson<AppUpdateInfo>(
force ? "/api/app-update?force=1" : "/api/app-update",
Expand Down Expand Up @@ -823,7 +839,7 @@
sidebarResizeHandlersRef.current = { onMove, onUp };
window.addEventListener("mousemove", onMove);
window.addEventListener("mouseup", onUp);
}, [isMobile, sidebarWidth]);

Check warning on line 842 in components/AppShell.tsx

View workflow job for this annotation

GitHub Actions / Verify (windows-latest)

React Hook useCallback has a missing dependency: 'sidebarContainerRef'. Either include it or remove the dependency array

Check warning on line 842 in components/AppShell.tsx

View workflow job for this annotation

GitHub Actions / Verify (ubuntu-latest)

React Hook useCallback has a missing dependency: 'sidebarContainerRef'. Either include it or remove the dependency array

// If the app unmounts mid-drag, remove the window listeners and restore the
// body cursor; otherwise the handlers leak and body stays cursor:col-resize.
Expand All @@ -840,7 +856,7 @@
const resetRightPanelWidth = useCallback(() => {
rightPanelRef.current?.style.removeProperty("--right-panel-width");
setRightPanelWidth(null);
}, []);

Check warning on line 859 in components/AppShell.tsx

View workflow job for this annotation

GitHub Actions / Verify (windows-latest)

React Hook useCallback has a missing dependency: 'rightPanelRef'. Either include it or remove the dependency array

Check warning on line 859 in components/AppShell.tsx

View workflow job for this annotation

GitHub Actions / Verify (ubuntu-latest)

React Hook useCallback has a missing dependency: 'rightPanelRef'. Either include it or remove the dependency array

const changeRightPanelWidth = useCallback((delta: number) => {
setRightPanelWidth((prev) => {
Expand All @@ -851,7 +867,7 @@
rightPanelRef.current?.style.setProperty("--right-panel-width", `${next}px`);
return next;
});
}, []);

Check warning on line 870 in components/AppShell.tsx

View workflow job for this annotation

GitHub Actions / Verify (windows-latest)

React Hook useCallback has a missing dependency: 'rightPanelRef'. Either include it or remove the dependency array

Check warning on line 870 in components/AppShell.tsx

View workflow job for this annotation

GitHub Actions / Verify (ubuntu-latest)

React Hook useCallback has a missing dependency: 'rightPanelRef'. Either include it or remove the dependency array

const handleRightPanelResizeKey = useCallback((e: React.KeyboardEvent) => {
// The handle sits on the panel's left edge: left widens, right narrows.
Expand Down Expand Up @@ -912,7 +928,7 @@
rightResizeHandlersRef.current = { onMove, onUp };
window.addEventListener("mousemove", onMove);
window.addEventListener("mouseup", onUp);
}, [isMobile]);

Check warning on line 931 in components/AppShell.tsx

View workflow job for this annotation

GitHub Actions / Verify (windows-latest)

React Hook useCallback has a missing dependency: 'rightPanelRef'. Either include it or remove the dependency array

Check warning on line 931 in components/AppShell.tsx

View workflow job for this annotation

GitHub Actions / Verify (ubuntu-latest)

React Hook useCallback has a missing dependency: 'rightPanelRef'. Either include it or remove the dependency array

// If the app unmounts mid-drag, remove the window listeners and restore the
// body cursor; otherwise the handlers leak and body stays cursor:col-resize.
Expand Down Expand Up @@ -2660,6 +2676,8 @@
fileSearchOpen={fileSearchOpen}
onToggleFileSearch={handleToggleFileSearch}
onFileSearchOpenChange={setFileSearchOpen}
showHiddenFiles={showHiddenFiles}
onToggleShowHiddenFiles={handleToggleShowHiddenFiles}
explorerUploadBusy={explorerUploadBusy}
onUploadBusyChange={setExplorerUploadBusy}
explorerGitCount={explorerGitCount}
Expand Down
48 changes: 43 additions & 5 deletions components/FileExplorer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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). */
Expand Down Expand Up @@ -100,9 +102,9 @@ interface PendingConflict {
nonReplaceable: string[];
}

async function fetchEntries(dirPath: string): Promise<FileNode[]> {
async function fetchEntries(dirPath: string, showHidden: boolean): Promise<FileNode[]> {
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 {
Expand Down Expand Up @@ -512,6 +514,7 @@ export const FileExplorer = forwardRef<FileExplorerHandle, Props>(function FileE
onRefreshDone,
fileSearchOpen = false,
onFileSearchOpenChange,
showHidden = false,
activeFilePath = null,
revealPath = null,
onRevealDone,
Expand Down Expand Up @@ -549,6 +552,15 @@ export const FileExplorer = forwardRef<FileExplorerHandle, Props>(function FileE
const uploadInputRef = useRef<HTMLInputElement>(null);
const scrollRef = useRef<HTMLDivElement>(null);
const loadingPathsRef = useRef<Set<string>>(new Set());
// Listing generation: advanced whenever every cached listing is dropped
// (cwd change, hidden-items flip). An in-flight fetch carries the
// generation it started on; a response of an older one is discarded, so it
// cannot repopulate the cleared map, resurrect the hidden-item mode it
// listed, or clear the new request's loading state.
const listingGenerationRef = useRef(0);
// Last hidden-items mode the listing cache was built for (see the flip
// effect below); initialised to the mount value so mounting never counts.
const prevShowHiddenRef = useRef(showHidden);
const rootRequestRef = useRef(0);
const expandedPathsRef = useRef<Set<string>>(new Set());
expandedPathsRef.current = expandedPaths;
Expand Down Expand Up @@ -707,10 +719,16 @@ export const FileExplorer = forwardRef<FileExplorerHandle, Props>(function FileE
// against duplicate in-flight requests; the state copy drives spinners.
const fetchDir = useCallback((dirPath: string) => {
if (loadingPathsRef.current.has(dirPath)) return Promise.resolve();
const generation = listingGenerationRef.current;
// The shared loading bookkeeping belongs to the current generation only:
// a superseded response must neither clear the current request's spinner
// nor touch the ref the new dedupe guard reads.
const isCurrent = () => listingGenerationRef.current === generation;
loadingPathsRef.current.add(dirPath);
setLoadingPaths((prev) => new Set(prev).add(dirPath));
return fetchEntries(dirPath)
return fetchEntries(dirPath, showHidden)
.then((entries) => {
if (!isCurrent()) return;
setChildrenByPath((prev) => {
const next = new Map(prev);
next.set(dirPath, entries);
Expand All @@ -719,17 +737,18 @@ export const FileExplorer = forwardRef<FileExplorerHandle, Props>(function FileE
if (dirPath === cwd) setError(null);
})
.catch((e) => {
if (dirPath === cwd) setError(e instanceof Error ? e.message : String(e));
if (isCurrent() && dirPath === cwd) setError(e instanceof Error ? e.message : String(e));
})
.finally(() => {
if (!isCurrent()) return;
loadingPathsRef.current.delete(dirPath);
setLoadingPaths((prev) => {
const next = new Set(prev);
next.delete(dirPath);
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
Expand Down Expand Up @@ -971,6 +990,8 @@ export const FileExplorer = forwardRef<FileExplorerHandle, Props>(function FileE

// Reset expanded state only when cwd changes, not on refreshKey bumps
if (cwdChanged) {
// Supersede in-flight listings of the previous directory too.
listingGenerationRef.current += 1;
setExpandedPaths(new Set());
setHighlightedPaths(new Set());
setUploadSummary(null);
Expand Down Expand Up @@ -1003,6 +1024,23 @@ export const FileExplorer = forwardRef<FileExplorerHandle, Props>(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) and supersede the generation, so listings still in flight
// from the previous mode are discarded instead of repopulating the map.
// Expansion state is deliberately kept.
useEffect(() => {
if (prevShowHiddenRef.current === showHidden) return;
prevShowHiddenRef.current = showHidden;
listingGenerationRef.current += 1;
setChildrenByPath(new Map());
loadingPathsRef.current = new Set();
setLoadingPaths(new Set());
setTreeRefreshKey((key) => key + 1);
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
}, [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
Expand Down
Loading
Loading