Repository navigation
feat(native): right panel with tabs and the diff panel - #18
Merged
Merged
Conversation
This was referenced Nov 2, 2026
Open
rynfar
force-pushed
the
nw/w6-diff
branch
2 times, most recently
from
November 2, 2026 10:27
a5f3fdb to
663cc32
Compare
Parses unified diffs (git headers, renames, binary, quoted paths, no newline at EOF) into files, hunks and lines; lays them out as stacked or split rows with hunk separators; builds the changed-files tree; derives checkpointed turns and the requests behind each diff scope. Ports the right panel tab model and closed-tab history from rightPanelStore.ts and closedViewStore.ts.
ClientHandle::request runs one unary RPC on the live session (diffs today, other surfaces next). store gains small JSON files for UI state the web keeps in localStorage. The diff_probe example fetches a thread's turn, full-thread and git diffs headlessly and prints what they parse to.
gen-theme evaluates color-mix in CIE Lab, so the diff row and gutter fills Pierre paints over the code surface come out of the web theme like every other token. Icons are vendored from lucide-react 0.564.0 with the web's 1.75 stroke and served next to gpui-component's own set.
An inline right panel beside the thread: 540px default, 8px resize handle, width per thread, tab bar with close, middle-click and context menu, an add menu and the Open a surface launcher, maximize, and cmd-alt-b / cmd-w / cmd-shift-t. The diff surface shows Changes, Uncommitted, the latest or any turn (getTurnDiff, getFullThreadDiff, review.getDiffPreview), fetched and parsed off the UI thread and painted as a virtualized list with sticky file headers, stacked or split layout, wrap, whitespace, folds and a file tree. cmd-d toggles it; a turn's files-changed row opens it on that turn.
…eview - Content lines keep their carriage return, so a line-ending change still reads as one; headers ignore it. Combined diffs (diff --cc) fall back to raw text instead of an empty file. - No newline at end of file gets Pierre's marker row, stacked and split. - Rows build per file (file_rows), so a fold rebuilds only that file. - Persisted panel state decodes leniently: bad entries drop on their own and the active tab is repaired like rightPanelStore.ts's migration. - UI state files have one writer thread that coalesces to the newest value and renames a uniquely named temporary into place. - workspace_mutation_id ports deriveWorkspaceMutationId; preview_is_repository reads review.getDiffPreview's empty-sources answer; ClientHandle names its environment.
- Folding a file splices only that file's rows (View keeps rows per file). - Failed diff requests rerun once the connection settles; cache keys carry the environment. - A cwd with no repository shows the web's explanation and stops refetching. - Git scopes refetch when the workspace mutation id changes mid-turn. - The diff paints on background, as StyledDiffCodeView.tsx overrides --code-background; row tokens regenerate from that surface. - Buttons, layout segments, tabs and launcher rows are tab stops with the design-system focus ring; Enter and Space activate them. - Panel state saves go through the single writer; icons live in icons.rs beside the transcript's, served with gpui-component's own set.
… vendor-icons diff.toggle, rightPanel.toggle, rightPanel.toggleMaximized, rightPanel.close and view.reopenClosed map to the right panel's actions in keymap::action_for, so their keys and when clauses live with the other defaults; the right panel only registers the handlers. The keymap's rightPanelOpen flag now reflects the panel. The panel's width cap and its maximized tab bar inset follow the collapsible sidebar. Diff icons regenerate through vendor-icons.ts.
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.
Problem
The native client had no right panel and no way to see what an agent changed. Issue #11 asks for the diff panel; it needs the tabbed right panel (PN-RIGHT) to live in.
Approach
Ported from the web, logic first:
crates/core/src/diff.rs(+diff/): a unified-diff parser standing in for@pierre/diffsparsePatchFiles. It handles git headers, new/deleted/renamed/copied files, binary files, C-quoted paths, paths with spaces, plain---/+++patches with timestamps,\ No newline at end of file, empty hunks, missing counts, and tabs at Pierre's tab size 2. Content keeps its\r, and combined diffs (diff --cc) fall back to raw text. The rest of the module: per-file stacked/split rows withN unmodified linesseparators and Pierre's "No newline at end of file" row, the changed-files tree,deriveThreadCheckpointSummaries,useCheckpointDiff(turn 1 →getFullThreadDiff, later →getTurnDiff),review.getDiffPreviewsource picking with non-repository detection,deriveWorkspaceMutationId, and thediffPanelStore.tsselection.crates/core/src/right_panel.rs: therightPanelStore.tstab model (upsert, toggle, close with neighbor fallback, close others/to the right/all, move, maximize),closedViewStore.tshistory withplanNextReopen, and width clamping. Persisted state decodes leniently: bad entries drop on their own, and the active tab and visibility are repaired as the store's migration does. Surfaces are{ id, kind }, so files/preview/terminal/side chats plug in as newSurfaceKinds.crates/client: uses the singleClientHandle::requestthat feat(native): drive agents from the composer: new threads, pickers, approvals #20 landed (mine merged into it), andClientHandle::environment()names the server.store::{load,save}_ui_statewrites through one writer thread that coalesces to the newest value per file, then renames a uniquely named temporary into place. Loads tolerate corrupt files.crates/app/src/right_panel/: the inline panel. It defaults to 540px (min 360, max 70% of the window or row − 360) and has an 8px resize handle (borderon hover,primary/60 while dragging). Width persists per thread and is saved once the drag settles. The 52px tab bar has 24px tabs (max 144, radius 6, 12px text) with a hover X and middle-click close, a Close / Close others / Close to the right / Close all context menu, a+add menu, and the "Open a surface" launcher. Maximize and right-panel toggles sit at the window's top right. Shortcuts go through W3's keymap:diff.toggle,rightPanel.toggle,rightPanel.toggleMaximized,rightPanel.closeandview.reopenClosedmap to the panel's actions inkeymap::action_for, so their keys andwhenclauses live with the other defaults, and the keymap'srightPanelOpenflag reflects the panel. The width cap and the maximized tab bar's inset follow the collapsible sidebar. Buttons, layout segments, tabs and launcher rows are tab stops with the §4.2 focus ring (2pxringinside a 1pxbackgroundgap); Enter and Space activate them.crates/app/src/diff/: scopes are Changes, Uncommitted, Latest turn and Turn ▸ N. Requests are fetched and parsed on the network runtime, with an LRU cache keyed by environment. Git scopes refetch when the workspace mutation id changes (finished file tools and commands, new checkpoints), on refresh, and when the panel is shown with a diff older than 10s. Failed requests rerun once the connection settles. A cwd that is not a repository shows the web's explanation and stops refetching. The code view is a virtualized list: one row per line, rows kept per file so a fold splices only that file. It has sticky 32px headers, 24px separators, 13px mono on 20px lines and a 4px change bar, and paints onbackground(the viewer overrides--code-background). It supports stacked/split, wrap (sideways scroll when off), hide-whitespace viaignoreWhitespace, per-file and fold-all folds (files start folded, perdiffFilesCollapsed: true), copy path, and a file tree that reveals on click. Loading, empty, error, raw and truncated states use the web's copy. The diff view is.cached(), so transcript streaming doesn't repaint it.AppState::open_turn_diff(run_id, file_path)(the diff menu's turn items go through it; the transcript's per-turn changed-files summary isn't ported yet, see gaps),cmd-d(diff.toggle), the launcher and+menu, and the header toggle. Opening the diff without an explicit request resets it to Changes, asChatView.tsxdoes.gen-theme.tsevaluatescolor-mix(in lab, …);diff_row_{addition,deletion}{,_gutter}anddiff_hunk_separatorderive from the web CSS over--background. My icons are registered in the sharedicons.rs(one asset source, alongside feat(native): web-parity sidebar, thread actions, keybindings and command palette #19'ssized/from_name) and vendored throughscripts/vendor-icons.ts; the source also serves gpui-component's own icons so the existingIconNamewidgets render.Review fixes (Sol 6.1)
Viewkeeps rows per file; a fold splices one file's range (core::diff::file_rows)sources: []→ "Turn diffs are unavailable because this project is not a git repository."; no refetch; turn diffs disabled thereworkspace_mutation_id(port ofderiveWorkspaceMutationId) bumps the request revision\rkept in content (hidden when painted, like the web); "No newline at end of file" rowsbackground; regenerated,--checkpassesdiff --cc→ raw textLedger
PN-RIGHT→ partial,crates/app/src/right_panel, crates/core/src/right_panel.rsDF-PANEL→ partial,crates/app/src/diff, crates/core/src/diff.rsTR-DIFFstays todo (see gaps)Verification
fork/nativewith feat(native): bounded thread snapshots, history paging, conformance drift alarm, session harness #16, feat(native): transcript rows and streaming markdown at web fidelity #17, feat(native): web-parity sidebar, thread actions, keybindings and command palette #19, feat(native): drive agents from the composer: new threads, pickers, approvals #20, fix(native): controller-level deletion, per-op conformance, off-thread history merge #21 and fix(native): transcript review fixes, history control, output on expand #22.cargo test -p t3-core -p t3-client(core 265, client 9, conformance 3),cargo clippy --workspace --all-targets -- -D warnings,node scripts/gen-theme.ts --check,node scripts/vendor-icons.ts --check,node --test parity/sync.test.ts(42), andcargo build -p t3-nativeall pass. No shared conformance-modeled types changed, so fixtures were not regenerated.cargo run -p t3-client --example diff_probe -- --thread <id>against the isolated dev server:That server's turns changed no files, so the turn and full-thread diffs answer empty. Real patches come through Changes: a truncated 120 KB branch diff with a 4,000-line
Cargo.lock.panels.json(unknown tab active, bad width, bad selection, unknown layout) loaded leniently and was rewritten atomically with no temp files left.cmd-alt-b/cmd-d, tab through the toolbar, and compare againstdesign-system.md§4.2, §5 and §7.8.Gaps (follow-ups)
orchestration.getTurnItem, thetoolCallDiff.tssynthesis and a transcript entry point.timeline/rows.rslists "per-turn diff summaries" as not ported. Its ChangedFilesTree should callopen_turn_diff(run_id, Some(path)).move_surface), no tab-strip scroll buttons, no launcher letter shortcuts, no proactive diff open when a turn finishes. File tree width is a fixed 40%.Part of #11 (left open: see gaps).
Built by Claude Opus 5.5 (worker W6) in Claude Code.