Large pastes (>800 chars or >2 newlines) are collapsed into a `[Pasted
text #N +M lines]` placeholder in the input box. At submission the
placeholder is expanded back to full text so the agent receives the
complete content. Rendered user messages over 10,000 chars are truncated
to head+tail (2,500 each) with an elision marker, matching Claude Code's
behaviour.
## Changes
- **`paste_collapse.py`** (new) — threshold constants, `PastedContent`
dataclass, `should_collapse_paste`, `format_paste_ref`,
`parse_paste_refs`, `expand_paste_refs`
- **`ChatTextArea`** — new `PastedText` message; `_on_paste` and
`_flush_paste_burst` intercept large pastes before Textual inserts them
- **`ChatInput`** — stores paste content, inserts placeholder, expands
at submit, cleans up orphaned content on delete, expands for clipboard
copy
- **`UserMessage` / `QueuedUserMessage`** — `_truncate_for_display()`
renders head+tail with elision marker for messages over 10k chars; full
text preserved in `_content` for copy/select
## Video
https://github.com/user-attachments/assets/1d5425ed-d953-41f7-a898-0520610dd711
---------
Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
Co-authored-by: Mason Daugherty <github@mdrxy.com>
Co-authored-by: Mason Daugherty <mason@langchain.dev>