Navi Code TUI: show final answer below tools, not scrolled out of view
The assistant answer bubble was created at stream_start (the first event of a
turn), placing it at the TOP of the turn — above the thinking blocks and tool
cards that follow. chat_panel._refresh() calls scroll_end, so the view pinned to
the bottom (tools/thinking) and the answer at the top scrolled out of view.
Users saw tool results, planning, and thinking, but not the final answer.

Fix in chat_model.handle_ws_event (client-only, no protocol/server change):
- stream_start no longer eagerly adds an empty assistant bubble; it resets the
  current-assistant pointer so the first stream_delta opens the bubble lazily
  at the position where text actually arrives.
- tool_started/tool_call reset the current-assistant pointer so the next
  stream_delta opens a fresh bubble BELOW the tool cards — the final answer
  lands at the bottom, visible after scroll_end.
- stream_end purges empty assistant/thinking bubbles and resets pointers.

Tests: stream_start creates no empty bubble; final assistant_message renders
after the last tool_call with no empty bubbles; empty bubbles purged on
stream_end. 574 passed, 1 skipped.

Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 9f3af7e commit 55e141f91c3c0af5e2f7fd6e4f9e98222771a91a
@Eugene Sukhodolskiy Eugene Sukhodolskiy authored 20 hours ago
Showing 2 changed files
View
clients/terminal/tui/chat_model.py
View
tests/clients/test_tui_app.py