feat: workspace file manager with tree browsing and previews - #8
Merged
Conversation
New FILES tab in the session side panel: a lazy-loading directory tree rooted at the session's working directory, plus a full-screen viewer. Server endpoints (all constrained to registered session cwds via the same realpath containment as downloads — symlinks cannot escape): - GET /api/fs/entries — directory listing (name/type/size/mtime, dirs-first, capped) - GET /api/fs/preview — JSON classification: text (utf8-decoded, 512KB cap + truncated flag, NUL-byte binary detection), image (by extension allowlist) or binary - GET /api/fs/raw — inline bytes, restricted to image types only (SVG included; safe in <img> context) with a lockdown CSP Viewer renders markdown through the safe pipeline, HTML inside a sandboxed iframe (scripts inert, verified in-browser), images via <img>, other text as pre, binaries as a download card; markdown/html offer a source toggle. Tests: 8 new endpoint cases (containment, symlink/traversal escape, text/ image/binary classification, raw allowlist). Suite: server 117, web 57.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
New FILES tab in the session side panel: browse the session's working directory as a lazily-loaded tree and preview files in a full-screen viewer.
Server endpoints
All three are constrained to registered session working directories through the same realpath containment as downloads — symlinks (files or dirs) cannot escape, matching the trust boundary
/api/fs/filealready had:GET /api/fs/entries?path=— directory listing (name/type/size/mtime, dirs first, capped at 500)GET /api/fs/preview?path=— JSON classification:text(utf8-decoded with a 512KB cap +truncatedflag, NUL-byte binary detection),image(extension allowlist) orbinaryGET /api/fs/raw?path=— inline bytes, restricted to image types only (SVG included — safe in<img>context), served with a lockdown CSPViewer
sandbox=""iframe — agent-authored scripts stay inert (verified in-browser)<img>over the raw endpoint<pre>; binaries as a download cardTests
8 new endpoint cases: containment refusals, symlink + traversal escapes, text/image/binary classification, raw allowlist (415 for non-images), truncation metadata. Suite: server 117 + web 57, all green;
bun run check+ build pass; feature walkthrough verified in-browser (tree, markdown, sandboxed HTML, images).