2828if TYPE_CHECKING :
2929 import threading
3030
31- from ..session import Session
31+ from ..controller import Controller
3232 from .input import UiQuestion
3333
3434SPINNER_FRAMES = ["⠋" , "⠙" , "⠹" , "⠸" , "⠼" , "⠴" , "⠦" , "⠧" , "⠇" , "⠏" ]
@@ -189,15 +189,15 @@ def _strip_reasoning(text: str, reasoning: str) -> str:
189189class RenderMixin :
190190 """Rendering methods for the TUI.
191191
192- Expects the host class to provide: ``session ``, ``console``,
192+ Expects the host class to provide: ``_controller ``, ``console``,
193193 ``stream_text``, ``lock``, ``question``, ``agent_running``,
194194 ``status``, ``_current_tool``, ``round_start``, ``round_user_text``,
195195 ``_data_event``, ``_history_cache``, ``_history_dirty``,
196196 ``_round_times``, ``_run_start``.
197197 """
198198
199199 if TYPE_CHECKING :
200- session : Session
200+ _controller : Controller
201201 console : Console
202202 stream_text : str
203203 lock : threading .Lock
@@ -228,7 +228,7 @@ def _build_history_rows(self, full: bool = False) -> list[Any]:
228228 """
229229 rows : list [Any ] = []
230230 calls_by_id : dict [str , Any ] = {}
231- all_messages = self .session .last_messages or []
231+ all_messages = self ._controller .last_messages or []
232232 # tool-call lookup spans the whole conversation so a diff still
233233 # resolves even if its call landed in an earlier round
234234 for m in all_messages :
@@ -331,10 +331,10 @@ def _build_history_rows(self, full: bool = False) -> list[Any]:
331331 def _todos_panel (self ) -> Group | None :
332332 """Todos section — rebuilt every frame (not cached), so a
333333 TodoWrite call shows up immediately even mid-run."""
334- if not self .session .todos :
334+ if not self ._controller .todos :
335335 return None
336336 t = Table .grid (padding = (0 , 1 ))
337- for todo in self .session .todos [- 8 :]:
337+ for todo in self ._controller .todos [- 8 :]:
338338 status = todo .get ("status" , "" )
339339 mark = {"completed" : "✅" , "in_progress" : "⏳" , "pending" : "⬜" }.get (status , "•" )
340340 t .add_row (mark , todo .get ("content" , "" ))
@@ -410,7 +410,7 @@ def _round_time(self, round_no: int) -> str | None:
410410 (``store.round_times``).
411411 """
412412 idx = round_no - 1
413- times = self ._round_times or self .session .store .round_times
413+ times = self ._round_times or self ._controller .store .round_times
414414 if 0 <= idx < len (times ):
415415 return time .strftime ("%H:%M:%S" , time .localtime (times [idx ]))
416416 return None
@@ -471,8 +471,8 @@ def _visible_row_cap(self) -> int:
471471 # reserve: status bar (up to 2 lines) + input prompt (1)
472472 # + the pinned Todos section when visible (its title line + rows)
473473 reserved = 3
474- if self .session .todos :
475- reserved += min (len (self .session .todos ), 8 ) + 1
474+ if self ._controller .todos :
475+ reserved += min (len (self ._controller .todos ), 8 ) + 1
476476 return max (5 , height - reserved )
477477
478478 @staticmethod
@@ -503,9 +503,9 @@ def _render_frame(self) -> Group:
503503 return Group (* parts )
504504
505505 def _status_bar (self ) -> Text :
506- mode = self .session .plan_mode .mode .value
506+ mode = self ._controller .plan_mode .mode .value
507507 mode_style = "bold yellow" if mode == "plan" else "bold green"
508- ratio = self .session .context_ratio
508+ ratio = self ._controller .context_ratio
509509 ctx = ""
510510 if ratio is not None :
511511 pct = round (ratio * 100 )
@@ -518,7 +518,7 @@ def _status_bar(self) -> Text:
518518 if ctx :
519519 over = ratio is not None and ratio >= config .CONTEXT_TRIGGER
520520 t .append (ctx , style = "bold" if over else "" )
521- if getattr ( self .session , "_save_error" , None ) :
521+ if self ._controller . save_error :
522522 t .append (" [!save]" , style = "red bold" )
523523 if self .agent_running :
524524 frame = SPINNER_FRAMES [int (time .time () * 10 ) % len (SPINNER_FRAMES )]
0 commit comments