feat(mma): Phase 3 — Focus Agent UI + filter logic
- gui_2.__init__: add ui_focus_agent: str | None = None - _gui_func: Focus Agent combo (All/Tier2/3/4) + clear button above OperationsTabs - _render_comms_history_panel: filter by ui_focus_agent; show [source_tier] label per entry - _render_tool_calls_panel: pre-filter with tool_log_filtered; fix missing i=i_minus_one+1; remove stale tuple destructure - tests: 6 new Phase 3 tests, 18/18 total
This commit is contained in:
32
gui_2.py
32
gui_2.py
@@ -260,6 +260,7 @@ class App:
|
||||
self.active_track: Track | None = None
|
||||
self.active_tickets: list[dict[str, Any]] = []
|
||||
self.active_tier: str | None = None
|
||||
self.ui_focus_agent: str | None = None
|
||||
self.mma_status = "idle"
|
||||
self._pending_mma_approval: dict[str, Any] | None = None
|
||||
self._mma_approval_open = False
|
||||
@@ -1746,6 +1747,21 @@ class App:
|
||||
if self.show_windows.get("Operations Hub", False):
|
||||
exp, self.show_windows["Operations Hub"] = imgui.begin("Operations Hub", self.show_windows["Operations Hub"])
|
||||
if exp:
|
||||
imgui.text("Focus Agent:")
|
||||
imgui.same_line()
|
||||
focus_label = self.ui_focus_agent or "All"
|
||||
if imgui.begin_combo("##focus_agent", focus_label, imgui.ComboFlags_.width_fit_preview):
|
||||
if imgui.selectable("All", self.ui_focus_agent is None)[0]:
|
||||
self.ui_focus_agent = None
|
||||
for tier in ["Tier 2", "Tier 3", "Tier 4"]:
|
||||
if imgui.selectable(tier, self.ui_focus_agent == tier)[0]:
|
||||
self.ui_focus_agent = tier
|
||||
imgui.end_combo()
|
||||
imgui.same_line()
|
||||
if self.ui_focus_agent:
|
||||
if imgui.button("x##clear_focus"):
|
||||
self.ui_focus_agent = None
|
||||
imgui.separator()
|
||||
if imgui.begin_tab_bar("OperationsTabs"):
|
||||
if imgui.begin_tab_item("Tool Calls")[0]:
|
||||
self._render_tool_calls_panel()
|
||||
@@ -2968,14 +2984,17 @@ class App:
|
||||
imgui.separator()
|
||||
imgui.begin_child("scroll_area")
|
||||
clipper = imgui.ListClipper()
|
||||
clipper.begin(len(self._tool_log))
|
||||
tool_log_filtered = self._tool_log if not self.ui_focus_agent else [
|
||||
e for e in self._tool_log if e.get("source_tier") == self.ui_focus_agent
|
||||
]
|
||||
clipper = imgui.ListClipper()
|
||||
clipper.begin(len(tool_log_filtered))
|
||||
while clipper.step():
|
||||
for i_minus_one in range(clipper.display_start, clipper.display_end):
|
||||
entry = self._tool_log[i_minus_one]
|
||||
i = i_minus_one + 1
|
||||
entry = tool_log_filtered[i_minus_one]
|
||||
script = entry["script"]
|
||||
result = entry["result"]
|
||||
script, result, _ = self._tool_log[i_minus_one]
|
||||
first_line = script.strip().splitlines()[0][:80] if script.strip() else "(empty)"
|
||||
imgui.text_colored(C_KEY, f"Call #{i}: {first_line}")
|
||||
# Script Display
|
||||
imgui.text_colored(C_LBL, "Script:")
|
||||
@@ -3411,6 +3430,8 @@ class App:
|
||||
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]
|
||||
for idx_minus_one, entry in enumerate(log_to_render):
|
||||
idx = idx_minus_one + 1
|
||||
local_ts = entry.get("local_ts", 0)
|
||||
@@ -3442,6 +3463,9 @@ class App:
|
||||
imgui.text_colored(KIND_COLORS.get(k, C_VAL), k)
|
||||
imgui.same_line()
|
||||
imgui.text_colored(C_LBL, f"{entry.get('provider', '?')}/{entry.get('model', '?')}")
|
||||
imgui.same_line()
|
||||
tier_label = entry.get("source_tier") or "main"
|
||||
imgui.text_colored(C_SUB, f"[{tier_label}]")
|
||||
payload = entry.get("payload", {})
|
||||
if k == "request":
|
||||
self._render_heavy_text("message", payload.get("message", ""))
|
||||
|
||||
Reference in New Issue
Block a user