Skip to content

Commit afb3fd2

Browse files
authored
Update tui.py
1 parent ddf4f39 commit afb3fd2

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

python_agent_harness/tui.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,9 @@ def __init__(self, session: AgentSession, console: Console | None = None) -> Non
413413
# wall-clock start of each agent run (one per user round), used
414414
# by the end-of-run dump to timestamp the round separators
415415
self._round_times: list[float] = []
416+
# wall-clock start of the current run, used to report the total
417+
# time spent once the run finishes
418+
self._run_start: float | None = None
416419
self.prompt_session: PromptSession = _make_prompt_session(
417420
FileHistory(_history_path()),
418421
SlashCompleter(lambda: str(self.session.project_dir)),
@@ -774,6 +777,11 @@ def _dump_conversation(self) -> None:
774777
title += f" · {ts}"
775778
self.console.rule(title, style="dim")
776779
self.console.print(row)
780+
# report the total time spent on this run, mirroring the per-tool
781+
# elapsed shown on tool results
782+
if self._run_start is not None:
783+
elapsed = time.time() - self._run_start
784+
self.console.print(f"[green]✓ time spent ({elapsed:.1f}s):[/green]")
777785

778786
def _visible_row_cap(self) -> int:
779787
"""Max conversation rows that fit the visible terminal area.
@@ -1000,6 +1008,7 @@ def _start_agent(
10001008
self.round_start = len(self.session.last_messages or [])
10011009
self.round_user_text = text
10021010
self._round_times.append(time.time())
1011+
self._run_start = time.time()
10031012
# A new top-level run starts here: invalidate any worker still
10041013
# unwinding from a previous run — from this point on it is stale
10051014
# and must never touch shared state. Bump before clearing the

0 commit comments

Comments
 (0)