refactor(tests): Update test suite and API hooks for AppController architecture
This commit is contained in:
@@ -160,6 +160,7 @@ class AppController:
|
||||
|
||||
self.perf_monitor: PerformanceMonitor = PerformanceMonitor()
|
||||
self._pending_gui_tasks: List[Dict[str, Any]] = []
|
||||
self._api_event_queue: List[Dict[str, Any]] = []
|
||||
|
||||
# Pending dialogs state moved from App
|
||||
self._pending_dialog: Optional[ConfirmDialog] = None
|
||||
@@ -409,15 +410,15 @@ class AppController:
|
||||
self.models_thread = threading.Thread(target=do_fetch, daemon=True)
|
||||
self.models_thread.start()
|
||||
|
||||
def start_services(self):
|
||||
def start_services(self, app: Any = None):
|
||||
"""Starts background threads and async event loop."""
|
||||
self._prune_old_logs()
|
||||
self._init_ai_and_hooks()
|
||||
self._init_ai_and_hooks(app)
|
||||
self._loop = asyncio.new_event_loop()
|
||||
self._loop_thread = threading.Thread(target=self._run_event_loop, daemon=True)
|
||||
self._loop_thread.start()
|
||||
|
||||
def _init_ai_and_hooks(self) -> None:
|
||||
def _init_ai_and_hooks(self, app: Any = None) -> None:
|
||||
import api_hooks
|
||||
ai_client.set_provider(self._current_provider, self._current_model)
|
||||
if self._current_provider == "gemini_cli":
|
||||
@@ -460,7 +461,7 @@ class AppController:
|
||||
'manual_approve': 'ui_manual_approve'
|
||||
}
|
||||
|
||||
self.hook_server = api_hooks.HookServer(self)
|
||||
self.hook_server = api_hooks.HookServer(app if app else self)
|
||||
self.hook_server.start()
|
||||
|
||||
def _run_event_loop(self):
|
||||
|
||||
Reference in New Issue
Block a user