# Implementation Plan: Text Viewer and Tool Call Fixes

## Phase 1: Text Viewer Unification
- [x] Task: Update Window Management in `gui_2.py`
    - [x] Remove `app._render_window_if_open("Text Viewer", lambda: render_text_viewer_window(app))` from `render_main_interface`.
    - [x] Add a direct call to `render_text_viewer_window(app)` in `render_main_interface` (e.g., right before or after modals).
    - [x] Update `render_text_viewer_window` to use `app.show_windows["Text Viewer"]` for its visibility check and `imgui.begin` state tracking.
- [x] Task: Update State Initialization
    - [x] In `src/app_controller.py`, ensure `"Text Viewer": False` is present in `_default_windows`.
    - [x] Remove usages of the legacy `app.show_text_viewer` across `gui_2.py` and replace them with `app.show_windows["Text Viewer"] = True`.

## Phase 2: Tool Call Row Interactivity
- [x] Task: Refactor Row Rendering
    - [x] In `_render_tool_calls_panel` (or `render_tool_calls_panel`), modify the first column (`#` index) rendering to include an `imgui.selectable(..., span_all_columns=True)`.
    - [x] Attach the `is_item_clicked()` logic to this selectable to populate `text_viewer_content` and set `app.show_windows["Text Viewer"] = True`.

## Phase 3: Verification
- [x] Task: Manual Verification
    - [x] Trigger a text viewer opening (e.g., via a `[+]` button) and attempt to dock it. Verify it remains stable.
    - [x] Click a row in the Tool Calls panel and verify the detail window opens.
- [x] Task: Conductor - User Manual Verification 'Phase 3: Verification' (Protocol in workflow.md)