8 Commits

Author SHA1 Message Date
ed 24b831c712 feat(gui2): Integrate core event system
Integrates the ai_client.events emitter into the gui_2.py App class. Adds a new test file to verify that the App subscribes to API lifecycle events upon initialization. This is the first step in aligning gui_2.py with the project's event-driven architecture.
2026-02-23 20:22:36 -05:00
ed bf873dc110 for some reason didn't add? 2026-02-23 20:17:55 -05:00
ed f65542add8 chore(conductor): Add new track 'get gui_2 working with latest changes to the project.' 2026-02-23 20:16:53 -05:00
ed 229ebaf238 Merge branch 'sim' 2026-02-23 20:11:01 -05:00
ed e51194a9be remove live_ux_test from active tracks 2026-02-23 20:10:47 -05:00
ed 85f8f08f42 chore(conductor): Archive track 'live_ux_test_20260223' 2026-02-23 20:10:22 -05:00
ed 70358f8151 conductor(plan): Mark task 'Apply review suggestions' as complete 2026-02-23 20:09:54 -05:00
ed 064d7ba235 fix(conductor): Apply review suggestions for track 'live_ux_test_20260223' 2026-02-23 20:09:41 -05:00
14 changed files with 222 additions and 17 deletions
@@ -35,3 +35,6 @@ Consolidate the simulation into end-user artifacts and CI tests.
- [x] Task: Create `tests/test_live_workflow.py` for automated regression testing. 8bd280e - [x] Task: Create `tests/test_live_workflow.py` for automated regression testing. 8bd280e
- [x] Task: Perform a full visual walkthrough and verify 'human-readable' pace. 8e63b31 - [x] Task: Perform a full visual walkthrough and verify 'human-readable' pace. 8e63b31
- [x] Task: Conductor - User Manual Verification 'Phase 4: Final Integration & Regression' (Protocol in workflow.md) 8e63b31 - [x] Task: Conductor - User Manual Verification 'Phase 4: Final Integration & Regression' (Protocol in workflow.md) 8e63b31
## Phase: Review Fixes
- [x] Task: Apply review suggestions 064d7ba
+8 -8
View File
@@ -7,13 +7,13 @@ This file tracks all major tracks for the project. Each track has its own detail
- [x] **Track: Implement context visualization and memory management improvements** - [x] **Track: Implement context visualization and memory management improvements**
*Link: [./tracks/context_management_20260223/](./tracks/context_management_20260223/)* *Link: [./tracks/context_management_20260223/](./tracks/context_management_20260223/)*
--- ---
- [x] **Track: Make a human-like test ux interaction where the AI creates a small python project, engages in a 5-turn discussion, and verifies history/session management features via API hooks.** - [ ] **Track: get gui_2 working with latest changes to the project.**
*Link: [./tracks/live_ux_test_20260223/](./tracks/live_ux_test_20260223/)* *Link: [./tracks/gui2_feature_parity_20260223/](./tracks/gui2_feature_parity_20260223/)*
@@ -0,0 +1,5 @@
# Track gui2_feature_parity_20260223 Context
- [Specification](./spec.md)
- [Implementation Plan](./plan.md)
- [Metadata](./metadata.json)
@@ -0,0 +1,8 @@
{
"track_id": "gui2_feature_parity_20260223",
"type": "feature",
"status": "new",
"created_at": "2026-02-23T20:15:30Z",
"updated_at": "2026-02-23T20:15:30Z",
"description": "get gui_2 working with latest changes to the project."
}
@@ -0,0 +1,79 @@
# Implementation Plan: GUIv2 Feature Parity
## Phase 1: Core Architectural Integration
- [ ] **Task:** Integrate `events.py` into `gui_2.py`.
- [ ] Sub-task: Import the `events` module in `gui_2.py`.
- [ ] Sub-task: Refactor the `ai_client` call in `_do_send` to use the event-driven `send` method.
- [ ] Sub-task: Create event handlers in `App` class for `request_start`, `response_received`, and `tool_execution`.
- [ ] Sub-task: Subscribe the handlers to `ai_client.events` upon `App` initialization.
- [ ] **Task:** Integrate `mcp_client.py` for native file tools.
- [ ] Sub-task: Import `mcp_client` in `gui_2.py`.
- [ ] Sub-task: Add `mcp_client.perf_monitor_callback` to the `App` initialization.
- [ ] Sub-task: In `ai_client`, ensure the MCP tools are registered and available for the AI to call when `gui_2.py` is the active UI.
- [ ] **Task:** Write tests for new core integrations.
- [ ] Sub-task: Create `tests/test_gui2_events.py` to verify that `gui_2.py` correctly handles AI lifecycle events.
- [ ] Sub-task: Create `tests/test_gui2_mcp.py` to verify that the AI can use MCP tools through `gui_2.py`.
- [ ] **Task:** Conductor - User Manual Verification 'Core Architectural Integration' (Protocol in workflow.md)
## Phase 2: Major Feature Implementation
- [ ] **Task:** Port the API Hooks System.
- [ ] Sub-task: Import `api_hooks` in `gui_2.py`.
- [ ] Sub-task: Instantiate `HookServer` in the `App` class.
- [ ] Sub-task: Implement the logic to start the server based on a CLI flag (e.g., `--enable-test-hooks`).
- [ ] Sub-task: Implement the queue and lock for pending GUI tasks from the hook server, similar to `gui.py`.
- [ ] Sub-task: Add a main loop task to process the GUI task queue.
- [ ] **Task:** Port the Performance & Diagnostics feature.
- [ ] Sub-task: Import `PerformanceMonitor` in `gui_2.py`.
- [ ] Sub-task: Instantiate `PerformanceMonitor` in the `App` class.
- [ ] Sub-task: Create a new "Diagnostics" window in `gui_2.py`.
- [ ] Sub-task: Add UI elements (plots, labels) to the Diagnostics window to display FPS, CPU, frame time, etc.
- [ ] Sub-task: Add a throttled update mechanism in the main loop to refresh diagnostics data.
- [ ] **Task:** Implement the Prior Session Viewer.
- [ ] Sub-task: Add a "Load Prior Session" button to the UI.
- [ ] Sub-task: Implement the file dialog logic to select a `.log` file.
- [ ] Sub-task: Implement the logic to parse the log file and populate the comms history view.
- [ ] Sub-task: Implement the "tinted" theme application when in viewing mode and a way to exit this mode.
- [ ] **Task:** Write tests for major features.
- [ ] Sub-task: Create `tests/test_gui2_api_hooks.py` to test the hook server integration.
- [ ] Sub-task: Create `tests/test_gui2_diagnostics.py` to verify the diagnostics panel displays data.
- [ ] **Task:** Conductor - User Manual Verification 'Major Feature Implementation' (Protocol in workflow.md)
## Phase 3: UI/UX Refinement
- [ ] **Task:** Refactor UI to a "Hub" based layout.
- [ ] Sub-task: Analyze the docking layout of `gui.py`.
- [ ] Sub-task: Create wrapper windows for "Context Hub", "AI Settings Hub", "Discussion Hub", and "Operations Hub" in `gui_2.py`.
- [ ] Sub-task: Move existing windows into their respective Hubs using the `imgui-bundle` docking API.
- [ ] Sub-task: Ensure the default layout is saved to and loaded from `manualslop_layout.ini`.
- [ ] **Task:** Add Agent Capability Toggles to the UI.
- [ ] Sub-task: In the "Projects" or a new "Agent" panel, add checkboxes for each agent tool (e.g., `run_powershell`, `read_file`).
- [ ] Sub-task: Ensure these UI toggles are saved to the project's `.toml` file.
- [ ] Sub-task: Ensure `ai_client` respects these settings when determining which tools are available to the AI.
- [ ] **Task:** Full Theme Integration.
- [ ] Sub-task: Review all newly added windows and controls.
- [ ] Sub-task: Ensure that colors, fonts, and scaling from `theme_2.py` are correctly applied everywhere.
- [ ] Sub-task: Test theme switching to confirm all elements update correctly.
- [ ] **Task:** Write tests for UI/UX changes.
- [ ] Sub-task: Create `tests/test_gui2_layout.py` to verify the hub structure is created.
- [ ] Sub-task: Add tests to verify agent capability toggles are respected.
- [ ] **Task:** Conductor - User Manual Verification 'UI/UX Refinement' (Protocol in workflow.md)
## Phase 4: Finalization and Verification
- [ ] **Task:** Conduct full manual testing against `spec.md` Acceptance Criteria.
- [ ] Sub-task: Verify AC1: `gui_2.py` launches.
- [ ] Sub-task: Verify AC2: Hub layout is correct.
- [ ] Sub-task: Verify AC3: Diagnostics panel works.
- [ ] Sub-task: Verify AC4: API hooks server runs.
- [ ] Sub-task: Verify AC5: MCP tools are usable by AI.
- [ ] Sub-task: Verify AC6: Prior Session Viewer works.
- [ ] Sub-task: Verify AC7: Theming is consistent.
- [ ] **Task:** Run the full project test suite.
- [ ] Sub-task: Execute `uv run run_tests.py` (or equivalent).
- [ ] Sub-task: Ensure all existing and new tests pass.
- [ ] **Task:** Code Cleanup and Refactoring.
- [ ] Sub-task: Remove any dead code or temporary debug statements.
- [ ] Sub-task: Ensure code follows project style guides.
- [ ] **Task:** Conductor - User Manual Verification 'Finalization and Verification' (Protocol in workflow.md)
@@ -0,0 +1,45 @@
# Specification: GUIv2 Feature Parity
## 1. Overview
This track aims to bring `gui_2.py` (the `imgui-bundle` based UI) to feature parity with the existing `gui.py` (the `dearpygui` based UI). This involves porting several major systems and features to ensure `gui_2.py` can serve as a viable replacement and support the latest project capabilities like automated testing and advanced diagnostics.
## 2. Functional Requirements
### FR1: Port Core Architectural Systems
- **FR1.1: Event-Driven Architecture:** `gui_2.py` MUST be refactored to use the `events.py` module for handling API lifecycle events, decoupling the UI from the AI client.
- **FR1.2: MCP File Tools Integration:** `gui_2.py` MUST integrate and use `mcp_client.py` to provide the AI with native, sandboxed file system capabilities (read, list, search).
### FR2: Port Major Features
- **FR2.1: API Hooks System:** The full API hooks system, including `api_hooks.py` and `api_hook_client.py`, MUST be integrated into `gui_2.py`. This will enable external test automation and state inspection.
- **FR2.2: Performance & Diagnostics:** The performance monitoring capabilities from `performance_monitor.py` MUST be integrated. A new "Diagnostics" panel, mirroring the one in `gui.py`, MUST be created to display real-time metrics (FPS, CPU, Frame Time, etc.).
- **FR2.3: Prior Session Viewer:** The functionality to load and view previous session logs (`.log` files from the `/logs` directory) MUST be implemented, including the distinctive "tinted" UI theme when viewing a prior session.
### FR3: UI/UX Alignment
- **FR3.1: 'Hub' UI Layout:** The windowing layout of `gui_2.py` MUST be refactored to match the "Hub" paradigm of `gui.py`. This includes creating:
- `Context Hub`
- `AI Settings Hub`
- `Discussion Hub`
- `Operations Hub`
- **FR3.2: Agent Capability Toggles:** The UI MUST include checkboxes or similar controls to allow the user to enable or disable the AI's agent-level tools (e.g., `run_powershell`, `read_file`).
- **FR3.3: Full Theme Integration:** All new UI components, windows, and controls MUST correctly apply and respond to the application's theming system (`theme_2.py`).
## 3. Non-Functional Requirements
- **NFR1: Stability:** The application must remain stable and responsive during and after the feature porting.
- **NFR2: Maintainability:** The new code should follow existing project conventions and be well-structured to ensure maintainability.
## 4. Acceptance Criteria
- **AC1:** `gui_2.py` successfully launches without errors.
- **AC2:** The "Hub" layout is present and organizes the UI elements as specified.
- **AC3:** The Diagnostics panel is present and displays updating performance metrics.
- **AC4:** The API hooks server starts and is reachable when `gui_2.py` is run with the appropriate flag.
- **AC5:** The AI can successfully use file system tools provided by `mcp_client.py`.
- **AC6:** The "Prior Session Viewer" can successfully load and display a log file.
- **AC7:** All new UI elements correctly reflect the selected theme.
## 5. Out of Scope
- Deprecating or removing `gui.py`. Both will coexist for now.
- Any new features not already present in `gui.py`. This is strictly a porting and alignment task.
+10
View File
@@ -14,6 +14,7 @@ import session_logger
import project_manager import project_manager
import theme_2 as theme import theme_2 as theme
import tomllib import tomllib
import events
from imgui_bundle import imgui, hello_imgui, immapp from imgui_bundle import imgui, hello_imgui, immapp
@@ -187,6 +188,15 @@ class App:
ai_client.comms_log_callback = self._on_comms_entry ai_client.comms_log_callback = self._on_comms_entry
ai_client.tool_log_callback = self._on_tool_log ai_client.tool_log_callback = self._on_tool_log
# Subscribe to API lifecycle events
ai_client.events.on("request_start", self._on_api_event)
ai_client.events.on("response_received", self._on_api_event)
ai_client.events.on("tool_execution", self._on_api_event)
def _on_api_event(self, *args, **kwargs):
"""Callback for ai_client events. For now, a placeholder."""
pass
# ---------------------------------------------------------------- project loading # ---------------------------------------------------------------- project loading
def _load_active_project(self): def _load_active_project(self):
+3 -2
View File
@@ -24,9 +24,10 @@ def main():
project_name = f"LiveTest_{int(time.time())}" project_name = f"LiveTest_{int(time.time())}"
# Use actual project dir for realism # Use actual project dir for realism
git_dir = os.path.abspath(".") git_dir = os.path.abspath(".")
project_path = os.path.join(git_dir, "tests", f"{project_name}.toml")
print(f"\n[Action] Scaffolding Project: {project_name}") print(f"\n[Action] Scaffolding Project: {project_name} at {project_path}")
sim.setup_new_project(project_name, git_dir) sim.setup_new_project(project_name, git_dir, project_path)
# Enable auto-add so results appear in history automatically # Enable auto-add so results appear in history automatically
client.set_value("auto_add_history", True) client.set_value("auto_add_history", True)
+7 -4
View File
@@ -31,11 +31,14 @@ class UserSimAgent:
break break
# We need to set a custom system prompt for the User Simulator # We need to set a custom system prompt for the User Simulator
ai_client.set_custom_system_prompt(self.system_prompt) try:
ai_client.set_custom_system_prompt(self.system_prompt)
# We'll use a blank md_content for now as the 'User' doesn't need to read its own files
# via the same mechanism, but we could provide it if needed.
response = ai_client.send(md_content="", user_message=last_ai_msg)
finally:
ai_client.set_custom_system_prompt("")
# We'll use a blank md_content for now as the 'User' doesn't need to read its own files
# via the same mechanism, but we could provide it if needed.
response = ai_client.send(md_content="", user_message=last_ai_msg)
return response return response
def perform_action_with_delay(self, action_func, *args, **kwargs): def perform_action_with_delay(self, action_func, *args, **kwargs):
+5 -2
View File
@@ -8,9 +8,12 @@ class WorkflowSimulator:
self.client = hook_client self.client = hook_client
self.user_agent = UserSimAgent(hook_client) self.user_agent = UserSimAgent(hook_client)
def setup_new_project(self, name, git_dir): def setup_new_project(self, name, git_dir, project_path=None):
print(f"Setting up new project: {name}") print(f"Setting up new project: {name}")
self.client.click("btn_project_new") if project_path:
self.client.click("btn_project_new_automated", user_data=project_path)
else:
self.client.click("btn_project_new")
time.sleep(1) time.sleep(1)
self.client.set_value("project_git_dir", git_dir) self.client.set_value("project_git_dir", git_dir)
self.client.click("btn_project_save") self.client.click("btn_project_save")
+48
View File
@@ -0,0 +1,48 @@
import pytest
from unittest.mock import MagicMock, patch
from gui_2 import App
import ai_client
from events import EventEmitter
@pytest.fixture
def app_instance():
"""
Fixture to create an instance of the gui_2.App class for testing.
It mocks functions that would render a window or block execution.
"""
if not hasattr(ai_client, 'events') or ai_client.events is None:
ai_client.events = EventEmitter()
with (
patch('gui_2.load_config', return_value={'ai': {}, 'projects': {}}),
patch('gui_2.save_config'),
patch('gui_2.project_manager'),
patch('gui_2.session_logger'),
patch('gui_2.immapp.run'),
patch.object(App, '_load_active_project'),
patch.object(App, '_fetch_models'),
patch.object(App, '_load_fonts'),
patch.object(App, '_post_init')
):
yield App
def test_app_subscribes_to_events(app_instance):
"""
This test checks that the App's __init__ method subscribes the necessary
event handlers to the ai_client.events emitter.
This test will fail until the event subscription logic is added to gui_2.App.
"""
with patch.object(ai_client.events, 'on') as mock_on:
app = app_instance()
mock_on.assert_called()
calls = mock_on.call_args_list
event_names = [call.args[0] for call in calls]
assert "request_start" in event_names
assert "response_received" in event_names
assert "tool_execution" in event_names
for call in calls:
handler = call.args[1]
assert hasattr(handler, '__self__')
assert handler.__self__ is app