Navi Code TUI: show request duration (live timer + chat metadata)
Live elapsed timer next to the activity indicator (ticks once per second
during a turn, format 2m 16s), driven by the same stream_start/stream_end
hooks as the activity indicator — so it spans the whole turn (all LLM calls,
tool calls, planning, sub-agent steps). On stream_end it syncs to the
backend's authoritative elapsed_seconds before freezing; on stream_stopped/
error/disconnect it freezes at the locally-measured value.

On stream_end the model also appends a turn_meta ChatItem rendered as a dim
"⏱ 2m 16s" line below the answer — the total time the agent spent on the
user's request. The value comes from stream_end.elapsed_seconds, already
measured by the backend over the whole turn, so the TUI needs no timer for
accuracy. stream_stopped/error do not get a metadata line (only completed
requests).

Shared format_duration(): None -> "—", <60s -> "16s", <3600 -> "2m 16s",
>=3600 -> "1h 2m".

Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 295479b commit e4cddd6e7f2b75abbc6bda6443ec5696251adcdb
@Eugene Sukhodolskiy Eugene Sukhodolskiy authored 10 hours ago
Showing 12 changed files
View
clients/terminal/tui/chat_model.py
View
clients/terminal/tui/duration.py 0 → 100644
View
clients/terminal/tui/renderers/__init__.py
View
clients/terminal/tui/renderers/turn_meta.py 0 → 100644
View
clients/terminal/tui/tui_app.py
View
clients/terminal/tui/widgets/chat_panel.py
View
clients/terminal/tui/widgets/elapsed_timer.py 0 → 100644
View
clients/terminal/tui/widgets/status_bar.py
View
tests/clients/test_chat_panel.py
View
tests/clients/test_duration.py 0 → 100644
View
tests/clients/test_tui_app.py
View
tests/clients/test_turn_meta_renderer.py 0 → 100644