Skip to content

feat(desktop): InlineDiff component for compact before/after tool results#3129

Open
HUQIANTAO wants to merge 1 commit into
esengine:main-v2from
HUQIANTAO:feat/inline-diff
Open

feat(desktop): InlineDiff component for compact before/after tool results#3129
HUQIANTAO wants to merge 1 commit into
esengine:main-v2from
HUQIANTAO:feat/inline-diff

Conversation

@HUQIANTAO
Copy link
Copy Markdown
Contributor

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

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.

@github-actions github-actions Bot added the v2 Go rewrite (1.x) — main-v2 branch, active development label Jun 4, 2026
…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.
@HUQIANTAO HUQIANTAO requested a review from SivanCola as a code owner June 4, 2026 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant