feat(ui): Add UI toggles for available tools per-project

This commit is contained in:
2026-02-23 11:24:44 -05:00
parent 9c5fcab9e8
commit 1677d25298
3 changed files with 51 additions and 0 deletions

23
gui.py
View File

@@ -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(

View File

@@ -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",

View File

@@ -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