Commit 25bce2a
committed
refactor(tui): replace content_buffer String with structured ChatMessage model
Core architecture change — the TUI now uses a typed message list
instead of a flat String buffer for conversation display:
New data model:
ChatMessage::User { text } → rendered as "❯ {text}"
ChatMessage::Assistant { text } → rendered as "● " + markdown
ChatMessage::ToolUse { name } → rendered as "● {name}" dim
ChatMessage::ToolResult { ... } → collapsible output (10 line max)
ChatMessage::System { text } → dim italic
Benefits:
- Each message type has independent rendering logic
- Streaming ContentDelta appends to last Assistant message
- No more string prefix matching for style classification
- ● marker added exactly once per assistant response
- Tool results properly typed with is_error flag
- Foundation for message-level folding, selection, rewind
Event handlers now push to messages Vec instead of appending
to content_buffer. render_messages() replaces render_content_scrolled().
Old content_buffer kept as dead_code for gradual removal.1 parent 2748556 commit 25bce2a
1 file changed
Lines changed: 211 additions & 87 deletions
0 commit comments