cmux next chat: files open on the right beside the chat (labs chatViewer)

Merged
LU
17d ago
+2342-74

stacked on #21315 (base next-chat-ui), retarget to feat-cmux-next once that lands. split out of #21315 so that pr stays the render engine and lawrence's #21760 fixes.

files and files the chat links to open in one column on the right of the chat, inside the chat, instead of a new column or a tab over it. behind agentPane.labs.chatViewer (debug settings, pages section), on by default. changes (the diff) opens exactly as on production today, with the switch on or off.

Summary

the viewer

  • the header's files opens the chat's folder in a column on the right of the transcript: folders open in place, .. goes up (never above the chat's folder), search across the folder, a file opens in the same column. listing is the session host's git.files.list (new file.list), search its git.files.search, so untracked ignored files never show (a tracked file shows even if it matches .gitignore).
  • a path link in a reply shows the file there too, read through the app (link.readPath): same checks as opening a path link today (deny list, agentPane.links.outsideRoots, a user gesture), text only, capped at 1 MiB. a binary file still opens in the app's tab, a folder in finder.
  • files and a file take 320px, about thread details' width; below 820px the column takes the transcript's place. changes is not part of this pr: it and a changed file's open work as before (a tab).
  • the column runs full height on the right, like the browser beside a chat. the transcript, composer and pr dock stay centered in what is left.

header and thread details

  • files lights while open, in every header style (including the tray styles), and every header button hovers and reads on the same way as thread details' button (no accent fill).
  • the files list and a file have one way out, an x at the end of their title row; no back to transcript chevron. escape still closes.
  • one panel on the right: opening files or a file closes thread details; while the viewer is open, thread details floats under its header button, as it does beside the browser.
  • files and a file read like thread details' column: rounded, its shadow, a 28px title row, no line under it.
Preview (files open, thread details open)
Preview
Preview (files closed, thread details open)
Preview

Testing

  • web (bun, one file each): chat-viewer, chat-files-view, chat-viewer-one-panel, chat-header-changes, labs-precedence, live-render; bun run typecheck: 10 errors and 7 warnings, all in HMR consumers this pr does not touch (same on the base).

  • swift (ci only): AgentPaneReplyReadPathTests, AgentPaneFilesListTests, AgentPaneLabsTests.

  • checked in the mock pane (?mock) at 1683 and 1100 px wide; lucas dogfooded the earlier rounds in a tagged dev app.

  • the red-then-green commits for these behaviors are on next-chat-ui (7f9cc9c9deb..c62dfbdf6c4, reverted there in ea7e91aba4e and 189a6c54c18); this branch restores them in one commit. the layout and header styling commits are css only, with no failing test first: happy-dom does not lay out.

  • 2026-10-20, after merging next-chat-ui (#21315 with the latest feat-cmux-next and #22058):

    • dev server file.list now resolves the path and stays inside the chat folder (security pass finding, low, dev only): bun test test/dev-host-file-list.test.ts failed 2 before 018738a0dba (../ and an escaping symlink listed outside names) and passes 4 after.
    • files survive a failed or outside-the-viewer file open: bun test test/chat-viewer.test.tsx failed 6 at 8445c43366f, 32 pass after 45c505cac78.

Observed / Not run

  • ran: the web tests above one file each (119 pass), site icon, header and chip tests (39 pass), bundle build and budgets, prepush-gate.py (no new violations), xcstrings lint, the mock pane at 1683, 1100 and 760 px.
  • scripts/web-lint.sh reds are outside this pr's files: text focus rings in CmuxNextBrowser and Checklist, formatting in settings pages.
  • not run: swift tests and native compile (ci), a fresh tagged-app dogfood on this head.

Changelog

Added: files and linked files open in a column beside the agent chat, with the chat's folder, search and file view (labs, on by default).