Skip to content

feat: workspace file manager with tree browsing and previews - #8

Merged
danielglh merged 2 commits into
mainfrom
feat/workspace-file-manager
Aug 28, 2026
Merged

feat: workspace file manager with tree browsing and previews#8
danielglh merged 2 commits into
mainfrom
feat/workspace-file-manager

Conversation

@danielglh

Copy link
Copy Markdown
Owner

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/file already 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 + truncated flag, NUL-byte binary detection), image (extension allowlist) or binary
  • GET /api/fs/raw?path= — inline bytes, restricted to image types only (SVG included — safe in <img> context), served with a lockdown CSP

Viewer

  • markdown rendered through the safe pipeline, with a source toggle
  • HTML inside a sandbox="" iframe — agent-authored scripts stay inert (verified in-browser)
  • images via <img> over the raw endpoint
  • other text as wrapped <pre>; binaries as a download card
  • Escape / backdrop click to close

Tests

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).

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.
@danielglh
danielglh merged commit 9c2e95c into main Aug 28, 2026
1 check passed
@danielglh
danielglh deleted the feat/workspace-file-manager branch August 28, 2026 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant