INNER CODE UNIT · Python
_update_log
VisionForge-OU/foreman · src/foreman/tui/app.py:218
def _update_log(self) -> None:
workers = self.app.controller.workers
body = self.query_one("#logbody", Static)
if self.selected and self.selected in workers:
w = workers[self.selected]
# The worker lines are raw agent output (shell commands etc.) and routinely
# contain unbalanced '[' — escape them so Textual doesn't parse them as markup.
body.update(self._budget_bar(self.selected, w) + "\n"
+ escape("\n".join(w.lines[-300:])))
else:
body.update("No active workers. Start a build from the dashboard ([b]b[/b]).")
def _budget_bar(self, iid: str, w) -> str:
return f"[b]{iid}[/b] status={w.status} cost=${w.cost:.4f} turns={w.turns}\n" + ("─" * 40)
def on_list_view_selected(self, event: ListView.Selected) -> None:
if event.item is None:
return