feat(desktop): InlineDiff component for compact before/after tool results#3129
Open
HUQIANTAO wants to merge 1 commit into
Open
feat(desktop): InlineDiff component for compact before/after tool results#3129HUQIANTAO wants to merge 1 commit into
HUQIANTAO wants to merge 1 commit into
Conversation
…ults
The Edit / MultiEdit / sed-style bash tool results all carry a
before/after pair, but today the only way to see the diff is the
full DiffView, which lives in the workspace panel and requires
opening a side pane. Users scroll back to the turn that made the
edit, then context-switch to the workspace — friction during the
exact moment they're verifying the agent's work.
Add components/InlineDiff.tsx: a compact, expandable diff card that
fits inside a tool result. It calls the existing diffLines() from
lib/diff (the same seam DiffView uses) and renders a unified diff
with +/- row coloring from the existing --add-bg / --del-bg tokens.
Behavior:
- Folds at 12 rows by default; the footer shows the hidden count
and expands on click. (12 covers ~80% of real edits; longer
diffs usually have big function rewrites the user DOES want to
see in full, so a single click reveals them.)
- The header shows the filename (truncated middle-ellipsis if
long), +/- counts, and a Copy button that writes a plain-text
unified diff to the clipboard.
- Reuses the same monospace family / spacing / surface tokens
as the rest of the chat, so it sits inside any tool card
without a wrapper.
The component is standalone — it doesn't reach into the controller
or assume a particular caller. The follow-up is a one-line import
in ToolCard.tsx that wraps Edit/MultiEdit results in <InlineDiff />
once the tool's before/after shape is exposed on the item.
862d259 to
8d3720a
Compare
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.
The Edit / MultiEdit / sed-style bash tool results all carry a before/after pair, but today the only way to see the diff is the full DiffView, which lives in the workspace panel and requires opening a side pane.
Add
components/InlineDiff.tsx: a compact, expandable diff card that fits inside a tool result. It calls the existingdiffLines()fromlib/diff(the same seam DiffView uses) and renders a unified diff with +/- row coloring from the existing --add-bg / --del-bg tokens.Folds at 12 rows by default; the footer shows the hidden count and expands on click. The header shows the filename (truncated middle-ellipsis if long), +/- counts, and a Copy button.