Expand description
The chat scrollback pane — generalized port of tagent’s
repl/tui/chat.rs (build_chat_lines/chat_line_count/draw_chat).
Why: DOC-50 §5 Slice 4 migrates this file’s markdown-aware chat rendering
(fenced code blocks, tables, the banner-as-scrollback-prefix trick) since
it’s the single largest, most product-agnostic piece of tagent’s TUI.
Generalization removed exactly one thing: tagent’s AgentScope-driven
cyan/yellow leader color became crate::app::ReplApp::accent_color, a
plain engine-set field (see that field’s doc comment) — everything else
(fence/table detection via crate::render::markdown, blank-line
collapsing) is a direct, behavior-preserving port.
What: build_chat_lines walks app.chat and returns the rendered
Vec<Line> (banner prepended when app.show_banner); chat_line_count
is the pre-layout height query crate::layout::draw uses to size the
chat Constraint; draw_chat renders into a Frame with
bottom-pinned padding and publishes the scroll cap to
app.last_max_scroll.
§Spec References
SPEC-TTUI-05~draft— Slice 4 deliverable (§5, Slice 4): migratechat.rs.
Functions§
- build_
chat_ lines - Build the rendered
Vec<Line>for the chat pane. - chat_
line_ count - Count chat content lines for layout sizing.
- collapse_
blank_ lines - Drop runs of 2+ consecutive whitespace-only
Lines, keeping at most one. - draw_
chat - Render the chat pane into
area, bottom-pinned when content fits.