tui: restore tool args/metadata, assistant-then-tool order, turn_meta on resume
ChatModel.load_history rebuilds the resumed session so the chat renders the
same way as a live turn:

- Recover tool-call args via tool_call_id (the persisted tool message stores
  only the result, not the call args) and forward the stored metadata. Without
  this the filesystem renderer saw args={} -> action=None and fell back to a
  plain, un-highlighted result -- the resume "no syntax highlighting" symptom.
- Emit assistant_message BEFORE tool_started when an assistant message has both
  text and tool_calls, matching the live stream where stream_delta precedes
  tool_started; previously the answer was stranded under its own tool cards.
- Append a turn_meta item when the persisted assistant message carries
  elapsed_seconds, reproducing the single duration line stream_end appends.

is_subagent for resumed tool calls is intentionally deferred (needs storage).
1 parent 851c7be commit 844fa3b44b4086ede87a75466794863098c9bd4e
@Eugene Sukhodolskiy Eugene Sukhodolskiy authored 9 hours ago
Showing 2 changed files
View
clients/terminal/tui/chat_model.py
View
tests/clients/test_chat_panel.py