From 9d59a454e01e479c2ec125f6143daef04a8dfb4e Mon Sep 17 00:00:00 2001 From: Ed_ Date: Tue, 24 Feb 2026 19:40:18 -0500 Subject: [PATCH] feat(gui2): Complete EventEmitter integration --- conductor/tracks/gui2_parity_20260224/plan.md | 2 +- gui_2.py | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/conductor/tracks/gui2_parity_20260224/plan.md b/conductor/tracks/gui2_parity_20260224/plan.md index edb54ac..2ae3fcb 100644 --- a/conductor/tracks/gui2_parity_20260224/plan.md +++ b/conductor/tracks/gui2_parity_20260224/plan.md @@ -15,7 +15,7 @@ Identify and document the exact differences between `gui.py` and `gui_2.py`. Address all identified gaps and ensure functional equivalence. - [x] Task: Implement missing panels and UX nuances (text sizing, font rendering) in `gui_2.py`. [a85293f] -- [ ] Task: Complete integration of all `EventEmitter` hooks in `gui_2.py` to match `gui.py`. +- [x] Task: Complete integration of all `EventEmitter` hooks in `gui_2.py` to match `gui.py`. - [ ] Task: Verify functional parity by running `tests/test_gui2_events.py` and `tests/test_gui2_layout.py`. - [ ] Task: Address any identified regressions or missing interactive elements. - [ ] Task: Conductor - User Manual Verification 'Phase 2: Visual and Functional Parity Implementation' (Protocol in workflow.md) diff --git a/gui_2.py b/gui_2.py index 14d44ab..0e2e631 100644 --- a/gui_2.py +++ b/gui_2.py @@ -239,6 +239,7 @@ class App: ai_client.comms_log_callback = self._on_comms_entry ai_client.tool_log_callback = self._on_tool_log mcp_client.perf_monitor_callback = self.perf_monitor.get_metrics + self.perf_monitor.alert_callback = self._on_performance_alert # AI client event subscriptions ai_client.events.on("request_start", self._on_api_event) @@ -404,6 +405,17 @@ class App: with self._pending_gui_tasks_lock: self._pending_gui_tasks.append({"action": "refresh_api_metrics", "payload": payload}) + def _on_performance_alert(self, message: str): + """Called by PerformanceMonitor when a threshold is exceeded.""" + alert_text = f"[PERFORMANCE ALERT] {message}. Please consider optimizing recent changes or reducing load." + # Inject into history as a 'System' message + with self._pending_history_adds_lock: + self._pending_history_adds.append({ + "role": "System", + "content": alert_text, + "ts": project_manager.now_ts() + }) + def _process_pending_gui_tasks(self): if not self._pending_gui_tasks: return