Private
Public Access
refactor(ai_client): move DEFAULT_TOOL_CATEGORIES from models.py to ai_client.py
Per post_module_taxonomy_de_cruft_20260627 Phase 3 (FR6). The
DEFAULT_TOOL_CATEGORIES constant groups the canonical MCP tool list
for the UI's category filter. The AI client is the natural owner
(it owns the tool spec registry via src.mcp_tool_specs); models.py
is a data-class shim, not a UI-config registry.
This commit:
1. Adds DEFAULT_TOOL_CATEGORIES (the 7-category dict) to src/ai_client.py
after the PROVIDERS constant. The dict is identical to the one that
was in models.py.
2. Updates src/gui_2.py (the single consumer) to:
- Add 'from src.ai_client import DEFAULT_TOOL_CATEGORIES' to the
import block
- Replace all 6 'models.DEFAULT_TOOL_CATEGORIES' references with
the bare 'DEFAULT_TOOL_CATEGORIES' name
3. Removes the DEFAULT_TOOL_CATEGORIES dict from src/models.py
(it was already removed as a side effect of the Phase 2.3
__getattr__ removal commit; the file is now 70 lines).
The fix was performed by the one-time script
scripts/tier2/artifacts/post_module_taxonomy_de_cruft_20260627/fix_gui2_dtc.py
which does an in-place re.sub on src/gui_2.py.
Verification:
- 'from src.ai_client import DEFAULT_TOOL_CATEGORIES' works
- 'from src.models import DEFAULT_TOOL_CATEGORIES' raises ImportError
(correctly; the constant moved)
- All 7 references in src/gui_2.py resolve to the ai_client version
- 'from src.models import Metadata' still returns TrackMetadata
(the legacy alias is preserved)
This commit is contained in:
@@ -61,6 +61,33 @@ from src.tool_presets import ToolPresetManager
|
||||
|
||||
PROVIDERS: List[str] = ["gemini", "anthropic", "gemini_cli", "deepseek", "minimax", "qwen", "grok", "llama"]
|
||||
|
||||
# DEFAULT_TOOL_CATEGORIES moved from src/models.py in
|
||||
# post_module_taxonomy_de_cruft_20260627 Phase 3. The categories are the
|
||||
# canonical grouping of the MCP tool registry for the UI's category
|
||||
# filter. The AI client is the natural owner (it owns the tool spec
|
||||
# registry via src.mcp_tool_specs).
|
||||
DEFAULT_TOOL_CATEGORIES: Dict[str, List[str]] = {
|
||||
"General": ["read_file", "list_directory", "search_files", "get_tree", "get_file_summary"],
|
||||
"Surgical": ["get_file_slice", "set_file_slice", "edit_file"],
|
||||
"Python": [
|
||||
"py_get_skeleton", "py_get_code_outline", "py_get_definition", "py_update_definition",
|
||||
"py_get_signature", "py_set_signature", "py_get_class_summary",
|
||||
"py_get_var_declaration", "py_set_var_declaration", "py_get_docstring",
|
||||
"py_find_usages", "py_get_imports", "py_check_syntax", "py_get_hierarchy",
|
||||
"py_remove_def", "py_add_def", "py_move_def", "py_region_wrap",
|
||||
],
|
||||
"C/C++": [
|
||||
"ts_c_get_skeleton", "ts_cpp_get_skeleton", "ts_c_get_code_outline",
|
||||
"ts_cpp_get_code_outline", "ts_c_get_definition", "ts_cpp_get_definition",
|
||||
"ts_c_get_signature", "ts_cpp_get_signature", "ts_c_update_definition",
|
||||
"ts_cpp_update_definition",
|
||||
],
|
||||
"Web": ["web_search", "fetch_url"],
|
||||
"Runtime": ["run_powershell", "get_ui_performance"],
|
||||
"Analysis": ["derive_code_path"],
|
||||
"Beads": ["bd_create", "bd_update", "bd_list", "bd_ready"],
|
||||
}
|
||||
|
||||
# _require_warmed lives
|
||||
# _require_warmed lives in src/module_loader.py to avoid duplicating the
|
||||
# lookup logic across files that need heavy modules. Re-exported here so
|
||||
|
||||
Reference in New Issue
Block a user