|
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> |
|---|
|
|
| clients/terminal/tui/chat_model.py |
|---|
| clients/terminal/tui/duration.py 0 → 100644 |
|---|
| clients/terminal/tui/renderers/__init__.py |
|---|
| clients/terminal/tui/renderers/turn_meta.py 0 → 100644 |
|---|
| clients/terminal/tui/tui_app.py |
|---|
| clients/terminal/tui/widgets/chat_panel.py |
|---|
| clients/terminal/tui/widgets/elapsed_timer.py 0 → 100644 |
|---|
| clients/terminal/tui/widgets/status_bar.py |
|---|
| tests/clients/test_chat_panel.py |
|---|
| tests/clients/test_duration.py 0 → 100644 |
|---|
| tests/clients/test_tui_app.py |
|---|
| tests/clients/test_turn_meta_renderer.py 0 → 100644 |
|---|