refactor(gui): Migrate application state to AppController

This commit is contained in:
2026-03-04 10:36:41 -05:00
parent 5cc8f76bf8
commit d0009bb23a
4 changed files with 355 additions and 211 deletions

View File

@@ -1,6 +1,33 @@
from dataclasses import dataclass, field
from typing import List, Optional, Dict, Any
from datetime import datetime
from pathlib import Path
import tomllib
from src import project_manager
CONFIG_PATH: Path = Path('config.toml')
DISC_ROLES: list[str] = ['User', 'AI', 'Vendor API', 'System']
AGENT_TOOL_NAMES: list[str] = [
"run_powershell", "read_file", "list_directory", "search_files", "get_file_summary",
"web_search", "fetch_url", "py_get_skeleton", "py_get_code_outline", "get_file_slice",
"py_get_definition", "py_get_signature", "py_get_class_summary", "py_get_var_declaration",
"get_git_diff", "py_find_usages", "py_get_imports", "py_check_syntax", "py_get_hierarchy",
"py_get_docstring", "get_tree", "get_ui_performance",
# Mutating tools — disabled by default
"set_file_slice", "py_update_definition", "py_set_signature", "py_set_var_declaration",
]
def load_config() -> dict[str, Any]:
with open(CONFIG_PATH, "rb") as f:
return tomllib.load(f)
def parse_history_entries(history: list[str], roles: list[str] | None = None) -> list[dict[str, Any]]:
known = roles if roles is not None else DISC_ROLES
entries = []
for raw in history:
entry = project_manager.str_to_entry(raw, known)
entries.append(entry)
return entries
@dataclass
class Ticket: