INNER CODE UNIT · Python
_refresh_sidebar_titles
ApodexAI/FrontierAgent · apodex/tui/app.py:696
def _refresh_sidebar_titles(self) -> None:
"""Keep tab labels' off-screen counts current.
Driven from the status tick rather than wired into every mutation, so no
code path can forget it. Cached because ``Static.update`` refreshes
unconditionally and this runs 2.5×/s.
"""
for widget_id, label, summary in (
("#sidebar-tab-plan", "Plan", self.todos_pane.summary()),
("#sidebar-tab-activity", "Activity", self.activity.summary()),
("#sidebar-tab-diff", "Diff", str(len(self._workspace_diff_stats)) if self._workspace_diff_stats else ""),
):
heading = f"{label} {summary}" if summary else label
if self._sidebar_titles.get(widget_id) != heading:
self._sidebar_titles[widget_id] = heading
with contextlib.suppress(Exception):
self.query_one(widget_id, Tab).label = heading