From 1677d252980ab9e81f8920087f82d8ff64fccd83 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Mon, 23 Feb 2026 11:24:44 -0500 Subject: [PATCH] feat(ui): Add UI toggles for available tools per-project --- gui.py | 23 +++++++++++++++++++++++ project_manager.py | 11 +++++++++++ tests/test_agent_capabilities.py | 17 +++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 tests/test_agent_capabilities.py diff --git a/gui.py b/gui.py index 62fce20..68390b9 100644 --- a/gui.py +++ b/gui.py @@ -589,6 +589,13 @@ class App: dpg.set_value("auto_add_history", proj.get("discussion", {}).get("auto_add", False)) if dpg.does_item_exist("project_word_wrap"): dpg.set_value("project_word_wrap", proj.get("project", {}).get("word_wrap", True)) + + agent_tools = proj.get("agent", {}).get("tools", {}) + for t_name in ["run_powershell", "read_file", "list_directory", "search_files", "get_file_summary", "web_search", "fetch_url"]: + tag = f"tool_toggle_{t_name}" + if dpg.does_item_exist(tag): + dpg.set_value(tag, agent_tools.get(t_name, True)) + self.cb_word_wrap_toggled(app_data=proj.get("project", {}).get("word_wrap", True)) def _save_active_project(self): @@ -867,6 +874,13 @@ class App: if dpg.does_item_exist("project_word_wrap"): proj["project"]["word_wrap"] = dpg.get_value("project_word_wrap") + # Agent tools + proj.setdefault("agent", {}).setdefault("tools", {}) + for t_name in ["run_powershell", "read_file", "list_directory", "search_files", "get_file_summary", "web_search", "fetch_url"]: + tag = f"tool_toggle_{t_name}" + if dpg.does_item_exist(tag): + proj["agent"]["tools"][t_name] = dpg.get_value(tag) + # Discussion self._flush_disc_entries_to_project() disc_sec = proj.setdefault("discussion", {}) @@ -1699,6 +1713,15 @@ class App: default_value=self.project.get("project", {}).get("word_wrap", True), callback=self.cb_word_wrap_toggled ) + dpg.add_separator() + dpg.add_text("Agent Capabilities") + agent_tools = self.project.get("agent", {}).get("tools", {}) + for t_name in ["run_powershell", "read_file", "list_directory", "search_files", "get_file_summary", "web_search", "fetch_url"]: + dpg.add_checkbox( + tag=f"tool_toggle_{t_name}", + label=f"Enable {t_name}", + default_value=agent_tools.get(t_name, True) + ) # ---- Files panel ---- with dpg.window( diff --git a/project_manager.py b/project_manager.py index 25b196b..5727874 100644 --- a/project_manager.py +++ b/project_manager.py @@ -100,6 +100,17 @@ def default_project(name: str = "unnamed") -> dict: "output": {"output_dir": "./md_gen"}, "files": {"base_dir": ".", "paths": []}, "screenshots": {"base_dir": ".", "paths": []}, + "agent": { + "tools": { + "run_powershell": True, + "read_file": True, + "list_directory": True, + "search_files": True, + "get_file_summary": True, + "web_search": True, + "fetch_url": True + } + }, "discussion": { "roles": ["User", "AI", "Vendor API", "System"], "active": "main", diff --git a/tests/test_agent_capabilities.py b/tests/test_agent_capabilities.py new file mode 100644 index 0000000..a46f983 --- /dev/null +++ b/tests/test_agent_capabilities.py @@ -0,0 +1,17 @@ +import pytest + +def test_agent_capabilities_config(): + # A dummy test to fulfill the Red Phase for Agent Capability Configuration. + # The new function in gui.py should be get_active_tools() or we check the project dict. + from project_manager import default_project + + proj = default_project("test_proj") + + # We expect 'agent' config to exist in a default project and list tools + assert "agent" in proj + assert "tools" in proj["agent"] + + # By default, all tools should probably be True or defined + tools = proj["agent"]["tools"] + assert "run_powershell" in tools + assert tools["run_powershell"] is True