From 1c977d25d5986b8ae71165706f41514e2e4f611b Mon Sep 17 00:00:00 2001 From: Ed_ Date: Fri, 6 Mar 2026 19:04:09 -0500 Subject: [PATCH] fix: Add missing _render_comms_history_panel method to gui_2.py --- src/app_controller.py | 4 +- src/gui_2.py | 92 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+), 2 deletions(-) diff --git a/src/app_controller.py b/src/app_controller.py index 4b7c512..1ceb5f4 100644 --- a/src/app_controller.py +++ b/src/app_controller.py @@ -596,7 +596,7 @@ class AppController: self.files = list(self.project.get("files", {}).get("paths", [])) self.screenshots = list(self.project.get("screenshots", {}).get("paths", [])) disc_sec = self.project.get("discussion", {}) - self.disc_roles = list(disc_sec.get("roles", ["User", "AI"])) + self.disc_roles = list(disc_sec.get("roles", ["User", "AI", "Vendor API", "System"])) self.active_discussion = disc_sec.get("active", "main") disc_data = disc_sec.get("discussions", {}).get(self.active_discussion, {}) with self._disc_entries_lock: @@ -1326,7 +1326,7 @@ class AppController: self.files = list(self.project.get("files", {}).get("paths", [])) self.screenshots = list(self.project.get("screenshots", {}).get("paths", [])) disc_sec = self.project.get("discussion", {}) - self.disc_roles = list(disc_sec.get("roles", ["User", "AI"])) + self.disc_roles = list(disc_sec.get("roles", ["User", "AI", "Vendor API", "System"])) self.active_discussion = disc_sec.get("active", "main") disc_data = disc_sec.get("discussions", {}).get(self.active_discussion, {}) with self._disc_entries_lock: diff --git a/src/gui_2.py b/src/gui_2.py index b9c36c7..ea4d184 100644 --- a/src/gui_2.py +++ b/src/gui_2.py @@ -1306,6 +1306,98 @@ class App: if is_blinking: imgui.pop_style_color(2) + def _render_comms_history_panel(self) -> None: + imgui.text_colored(vec4(200, 220, 160), f"Status: {self.ai_status}") + imgui.same_line() + if imgui.button("Clear##comms"): + ai_client.clear_comms_log() + self._comms_log.clear() + imgui.same_line() + if imgui.button("Load Log"): + self.cb_load_prior_log() + if self.is_viewing_prior_session: + imgui.same_line() + if imgui.button("Exit Prior Session"): + self.is_viewing_prior_session = False + self.prior_session_entries.clear() + self.ai_status = "idle" + imgui.separator() + imgui.text_colored(vec4(255, 200, 100), "VIEWING PRIOR SESSION") + imgui.separator() + imgui.text_colored(C_OUT, "OUT") + imgui.same_line() + imgui.text_colored(C_REQ, "request") + imgui.same_line() + imgui.text_colored(C_TC, "tool_call") + imgui.same_line() + imgui.text(" ") + imgui.same_line() + imgui.text_colored(C_IN, "IN") + imgui.same_line() + imgui.text_colored(C_RES, "response") + imgui.same_line() + imgui.text_colored(C_TR, "tool_result") + imgui.separator() + if self.is_viewing_prior_session: + imgui.push_style_color(imgui.Col_.child_bg, vec4(40, 30, 20)) + imgui.begin_child("comms_scroll", imgui.ImVec2(0, 0), False, imgui.WindowFlags_.horizontal_scrollbar) + log_to_render = self.prior_session_entries if self.is_viewing_prior_session else list(self._comms_log) + if self.ui_focus_agent and not self.is_viewing_prior_session: + log_to_render = [e for e in log_to_render if e.get("source_tier") == self.ui_focus_agent] + clipper = imgui.ListClipper() + clipper.begin(len(log_to_render)) + while clipper.step(): + for i_minus_one in range(clipper.display_start, clipper.display_end): + i = i_minus_one + 1 + entry = log_to_render[i_minus_one] + local_ts = entry.get("local_ts", 0) + blink_alpha = 0.0 + if entry.get("_blinking", False): + elapsed = time.time() - entry.get("_blink_start", 0) + if elapsed < 1.5: + blink_alpha = 0.3 + 0.7 * abs(math.sin(elapsed * 8 * math.pi)) + else: + entry["_blinking"] = False + source = entry.get("source_tier", "?") + msg_type = entry.get("type", "?") + content_text = entry.get("content", "") + if len(content_text) > COMMS_CLAMP_CHARS: + content_text = content_text[:COMMS_CLAMP_CHARS] + "..." + if msg_type == "request": + bg = vec4(60, 40, 20, 180) + fg = C_REQ + elif msg_type == "response": + bg = vec4(20, 60, 40, 180) + fg = C_RES + elif msg_type == "tool_call": + bg = vec4(40, 40, 80, 180) + fg = C_TC + elif msg_type == "tool_result": + bg = vec4(80, 40, 40, 180) + fg = C_TR + elif msg_type == "error": + bg = vec4(80, 20, 20, 180) + fg = vec4(1, 0.3, 0.3, 1) + else: + bg = vec4(50, 50, 50, 180) + fg = C_OUT if source == "AI" else C_IN + imgui.push_style_color(imgui.Col_.child_bg, bg) + imgui.push_style_color(imgui.Col_.text, fg) + imgui.text_colored(C_KEY, f"#{i}") + imgui.same_line() + imgui.text_colored(C_LBL, f"[{source}]") + imgui.same_line() + imgui.text_colored(C_LBL, msg_type) + if blink_alpha > 0: + imgui.same_line() + imgui.text_colored(vec4(1, 1, 0, blink_alpha), " ●") + imgui.same_line() + imgui.text_wrapped(content_text) + imgui.pop_style_color(2) + imgui.end_child() + if self.is_viewing_prior_session: + imgui.pop_style_color() + def _render_tool_calls_panel(self) -> None: imgui.text("Tool call history") imgui.same_line()