Agent pane: a Reply chip over selected text quotes it into the composer

Merged
TE
2d ago
+474-0

Leo asked:

anyways we have this but would it make sense to have a direct reply button? or would you mostly just re-read your own thing anyways? what makes sense here?

Recommendation

A Reply button on every message's action row would be clutter, since in an agent chat you almost always reply to the latest message. Replying to a part of a message is the useful case, so this PR does what Claude and ChatGPT do: selecting text shows a small Reply chip over the selection, and clicking it quotes the selection into the composer (the same Quote in Reply as the right-click menu, which stays).

What changed

  • conversation/SelectionReply.tsx (new): the chip. It shows when a selection ends (pointer up, or Shift-arrow / Select All key up) with no fade-in, sits above the selection's end (below it near the pane's top), and goes as soon as the selection collapses. It never shows for text in the composer or any editable field, a code block, or a read-only transcript. Pressing it keeps the selection; clicking quotes > text + a blank line through chat.quoteReply's path (quoteIntoComposer), so it appends after the draft like the menu item. No per-token work: it reads the DOM only on a selection's end and while shown.
  • The look is a theme trial (theme.selectionReply): chip (default), icon, none, row. row adds a Reply button to each message's action row (ReplyActions, TurnFooter), only to show why it wasn't picked.
  • App.tsx: mounts the chip and points it at the existing Quote in Reply sink.
  • New string message.quoteReply ("Reply") in all pane languages.
  • Gallery: agent-pane.selection-reply with variants none, chip-above, chip-icon-only, row-reply-button.

Gallery (agent-pane.selection-reply, synthetic data, 2x)

VariantDarkLight
none (before: right-click menu only)
chip-above (shipped default)
chip-icon-only
row-reply-button (not picked)

Tests

bun test src/agent-session/acpmux/conversation/SelectionReply.test.tsx: 5 pass, both locally and on the fleet. TurnFooter.test.tsx and TurnRows.test.tsx pass too. Selecting text shows the chip; clicking it quotes the selection into the composer; collapsing the selection removes it; no chip in a code block or the composer; the none and icon looks.

Observed / Not run

  • Observed: the unit tests above, and scripts/web-lint.sh clean apart from an exhaustive-deps warning in App.tsx (a useMemo that misses shownSessionId) that is also red on base.
  • test/gallery-coverage.test.ts fails on base with the same findings, none of them about this entry.
  • Not run: a fleet app build. Leo will try the build himself.

Changelog

Added: Select text in an agent reply to get a Reply chip that quotes it into the composer.

Agent session: agent session

šŸ¤– Generated with Claude Code