Agent pane: another agent's message shows under its line, cut to six lines

Merged
TE
15d ago
+203-70

Another agent's message now shows its text under its line by default, as the muted glass card with Markdown, instead of hiding it behind a one-line preview. A message longer than about six lines is cut there, with the last line fading out. The line's chevron, or a click on the cut card, opens it whole, with Details (the prompt as the agent got it) under it. Leo asked for this on nightly 331e2e9: agent messages left, styled, markdown rendered, collapsed past about 6 lines.

  • IncomingMessageCard.tsx: the card always draws. A layout effect with a ResizeObserver measures whether the text runs past RECEIVED_LINES (6) at its drawn width. A cut card opens on click, unless the click follows a link, presses a button or ends a selection. The chevron shows only when opening shows more (a cut message's rest, or Details). The reply editor and the Replied note no longer wait for the message to be opened. Find in Chat still opens a cut message that holds its match.
  • conversation.css: .cv-received__body[data-cut] > .cv-received__text caps the text at six lines, with a mask fade (glass shows through, no cover), the same way a long prompt is cut. The unused preview rule is removed.
  • model.ts: the row estimate counts the card (4 px above, 8 px padding on each side, 6 px below) plus the text's height up to RECEIVED_LINES lines, so a message mounting moves nothing.
  • Gallery agent-pane.incoming-message: new long variant (cut), and opened now opens a long message whole.

Changelog

Changed: another agent's message shows its text under its line, cut to six lines when longer.

Tests

  • rowEstimates.test.ts: a short message's estimate is its line plus a one-line card, and a 40-line message's estimate stops at six lines.
  • agent-pane-suggested-tasks.test.ts:
    • New: "a long message's card shows its first six lines; the chevron or a click opens it whole" (real Chromium layout).
    • The provenance test now reads the body directly instead of the preview.

Observed / Not run

  • Observed on huge-blue at this diff, on base 783c2068f4c:
    • bun test src/agent-session/acpmux/rowEstimates.test.ts src/agent-session/acpmux/conversation/: 145 pass.
    • CMUX_BROWSER_TESTS=1 bun test test/agent-pane-suggested-tasks.test.ts -t "messages from other agents": 14 pass, including the new one.
    • tsc --noEmit: clean.
    • oxlint on the changed files: 0 errors.
    • vp fmt.
    • scripts/cmux-next/prepush-gate.py: no new violations.
  • Not run: the full webview suite, which CI runs.

Agent session: cosmic-gray

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Another agent's message now always shows its text under its line as a muted glass card, instead of hiding behind a one-line preview. Messages longer than about six lines are clipped with the last line fading out; the line's chevron, or a click on the clipped card, opens the message whole, with Details (the prompt as the agent got it) underneath.

  • The row estimator accounts for the card and clips it to the same six lines, so mounting a message shifts nothing.
  • The reply editor and the "Replied" note no longer wait for the message to be opened.
  • A click on a clipped card opens it unless it follows a link, activates a control (button, input, label, role=button, video, audio), or ends a selection.
  • A queued agent message draws the card under its line too, whole when short.

Tests

  • A new browser test verifies the six-line clip, a card click opening it whole, and the chevron closing it again.
  • Row-estimate tests cover a short message (line plus card) and a 40-line message clipped at six lines.
  • The provenance test reads the message body directly instead of the preview, and the queue test reads the card instead of the preview.