refactor(app_controller): remove gemini_cli state and config
Drop the 11 gemini_cli sites: the ui_gemini_cli_path state field, the gcli_path settable map entry, the _update_gcli_adapter method, the project load/save gemini_cli binary_path entries, and the per-provider gemini_cli guard at startup.
This commit is contained in:
+1
-3
@@ -85,7 +85,6 @@ Thread Safety:
|
||||
|
||||
Configuration:
|
||||
- `--enable-test-hooks`: Required for Hook API to be available
|
||||
- `gemini_cli` provider: Hook API is automatically available for synchronous HITL
|
||||
|
||||
See Also:
|
||||
- docs/guide_tools.md for full API reference
|
||||
@@ -938,8 +937,7 @@ class HookServer:
|
||||
def start(self) -> None:
|
||||
if self.thread and self.thread.is_alive():
|
||||
return
|
||||
is_gemini_cli = _get_app_attr(self.app, 'current_provider', '') == 'gemini_cli'
|
||||
if not _get_app_attr(self.app, 'test_hooks_enabled', False) and not is_gemini_cli:
|
||||
if not _get_app_attr(self.app, 'test_hooks_enabled', False):
|
||||
return
|
||||
if not _has_app_attr(self.app, '_pending_gui_tasks'): _set_app_attr(self.app, '_pending_gui_tasks', [])
|
||||
if not _has_app_attr(self.app, '_pending_gui_tasks_lock'): _set_app_attr(self.app, '_pending_gui_tasks_lock', threading.Lock())
|
||||
|
||||
+2
-22
@@ -571,8 +571,6 @@ def _handle_set_value(controller: 'AppController', task: dict):
|
||||
if item in controller._settable_fields:
|
||||
attr_name = controller._settable_fields[item]
|
||||
setattr(controller, attr_name, value)
|
||||
if item == "gcli_path":
|
||||
controller._update_gcli_adapter(str(value))
|
||||
return
|
||||
# Dict-key bracket notation: e.g. 'show_windows["Project Settings"]'
|
||||
if "[" in item and item.endswith("]"):
|
||||
@@ -1081,7 +1079,6 @@ class AppController:
|
||||
self.ui_project_git_dir: str = ""
|
||||
self.ui_project_system_prompt: str = ""
|
||||
self.ui_project_execution_mode: str = "native"
|
||||
self.ui_gemini_cli_path: str = "gemini"
|
||||
self.ui_word_wrap: bool = True
|
||||
self.ui_auto_add_history: bool = False
|
||||
self.ui_separate_message_panel: bool = False
|
||||
@@ -1121,7 +1118,6 @@ class AppController:
|
||||
'project_git_dir': 'ui_project_git_dir',
|
||||
'auto_add_history': 'ui_auto_add_history',
|
||||
'disc_new_name_input': 'ui_disc_new_name_input',
|
||||
'gcli_path': 'ui_gemini_cli_path',
|
||||
'output_dir': 'ui_output_dir',
|
||||
'files_base_dir': 'ui_files_base_dir',
|
||||
'files': 'ui_file_paths',
|
||||
@@ -1313,7 +1309,7 @@ class AppController:
|
||||
"ui_new_ticket_target", "ui_new_ticket_deps", "ui_output_dir",
|
||||
"ui_files_base_dir", "ui_shots_base_dir", "ui_project_git_dir",
|
||||
"ui_project_system_prompt", "ui_project_execution_mode",
|
||||
"ui_gemini_cli_path", "ui_word_wrap", "ui_auto_add_history",
|
||||
"ui_word_wrap", "ui_auto_add_history",
|
||||
"ui_separate_message_panel", "ui_separate_response_panel",
|
||||
"ui_separate_tool_calls_panel", "ui_global_system_prompt",
|
||||
"ui_base_system_prompt", "ui_use_default_base_prompt",
|
||||
@@ -1833,12 +1829,6 @@ class AppController:
|
||||
'_cb_create_track': self._cb_create_track,
|
||||
}
|
||||
|
||||
def _update_gcli_adapter(self, path: str) -> None:
|
||||
if not ai_client._gemini_cli_adapter:
|
||||
ai_client._gemini_cli_adapter = ai_client.GeminiCliAdapter(binary_path=str(path))
|
||||
else:
|
||||
ai_client._gemini_cli_adapter.binary_path = str(path)
|
||||
|
||||
def _trigger_gui_refresh(self):
|
||||
with self._pending_gui_tasks_lock:
|
||||
self._pending_gui_tasks.append({'action': 'set_comms_dirty'})
|
||||
@@ -2019,8 +2009,6 @@ class AppController:
|
||||
self.ui_project_git_dir = proj_meta.get("git_dir", "")
|
||||
self.ui_project_conductor_dir = self.project.get('conductor', {}).get('dir', 'conductor')
|
||||
self.ui_project_system_prompt = proj_meta.get("system_prompt", "")
|
||||
self.ui_gemini_cli_path = self.project.get("gemini_cli", {}).get("binary_path", "gemini")
|
||||
self._update_gcli_adapter(self.ui_gemini_cli_path)
|
||||
self.ui_word_wrap = proj_meta.get("word_wrap", True)
|
||||
self.ui_auto_add_history = disc_sec.get("auto_add", False)
|
||||
self.ui_global_system_prompt = self.config.get("ai", {}).get("system_prompt", "")
|
||||
@@ -2722,11 +2710,6 @@ class AppController:
|
||||
# provider-SDK import) on the main thread during startup. _fetch_models
|
||||
# corrects the model against the live list after the first frame, off-thread.
|
||||
ai_client.set_provider(self._current_provider, self._current_model, validate=False)
|
||||
if self._current_provider == "gemini_cli":
|
||||
if not ai_client._gemini_cli_adapter:
|
||||
ai_client._gemini_cli_adapter = ai_client.GeminiCliAdapter(binary_path=self.ui_gemini_cli_path)
|
||||
else:
|
||||
ai_client._gemini_cli_adapter.binary_path = self.ui_gemini_cli_path
|
||||
ai_client.confirm_and_run_callback = self._confirm_and_run
|
||||
ai_client.set_comms_log_callback(self._on_comms_entry)
|
||||
ai_client.tool_log_callback = self._on_tool_log
|
||||
@@ -2929,7 +2912,6 @@ class AppController:
|
||||
proj["project"]["word_wrap"] = self.ui_word_wrap
|
||||
proj["project"]["auto_scroll_comms"] = self.ui_auto_scroll_comms
|
||||
proj["project"]["auto_scroll_tool_calls"] = self.ui_auto_scroll_tool_calls
|
||||
proj.setdefault("gemini_cli", {})["binary_path"] = self.ui_gemini_cli_path
|
||||
proj.setdefault("agent", {}).setdefault("tools", {})
|
||||
for t_name in mcp_tool_specs.tool_names():
|
||||
proj["agent"]["tools"][t_name] = self.ui_agent_tools.get(t_name, True)
|
||||
@@ -3212,7 +3194,6 @@ class AppController:
|
||||
self.ui_project_git_dir = proj_meta.get("git_dir", "")
|
||||
self.ui_project_system_prompt = proj_meta.get("system_prompt", "")
|
||||
self.ui_project_preset_name = proj_meta.get("active_preset")
|
||||
self.ui_gemini_cli_path = self.project.get("gemini_cli", {}).get("binary_path", "gemini")
|
||||
self.ui_auto_add_history = proj.get("discussion", {}).get("auto_add", False)
|
||||
self.ui_auto_scroll_comms = proj.get("project", {}).get("auto_scroll_comms", True)
|
||||
self.ui_auto_scroll_tool_calls = proj.get("project", {}).get("auto_scroll_tool_calls", True)
|
||||
@@ -4120,8 +4101,7 @@ class AppController:
|
||||
self.discussion_sent_markdown = event.stable_md
|
||||
self.discussion_sent_system_prompt = self.last_resolved_system_prompt
|
||||
ai_client.set_model_params(self.temperature, self.max_tokens, self.history_trunc_limit, self.top_p)
|
||||
ai_client.set_agent_tools(self.ui_agent_tools) # Force update adapter path right before send to bypass potential duplication issues
|
||||
self._update_gcli_adapter(self.ui_gemini_cli_path)
|
||||
ai_client.set_agent_tools(self.ui_agent_tools)
|
||||
# FR2 / Bug #1: per conductor/code_styleguides/error_handling.md section 3.1 (AND over OR),
|
||||
# we check result.ok instead of catching a ProviderError exception.
|
||||
result = ai_client.send(
|
||||
|
||||
@@ -2937,13 +2937,6 @@ def render_provider_panel(app: App) -> None:
|
||||
| [=========== ] 4096 Top-P: [1.00] |
|
||||
| [====== ] 8192 MaxTok: [8192] |
|
||||
| History Truncation Limit: |900000| |
|
||||
| (If gemini_cli active): |
|
||||
| --- |
|
||||
| Gemini CLI |
|
||||
| Session ID: cba123 |
|
||||
| [Reset CLI Session] |
|
||||
| Binary Path: |
|
||||
| [C:\tools\gemini.exe_______________________] [Browse] |
|
||||
+---------------------------------------------------------+
|
||||
"""
|
||||
if app.perf_profiling_enabled: app.perf_monitor.start_component("_render_provider_panel")
|
||||
@@ -3004,25 +2997,6 @@ def render_provider_panel(app: App) -> None:
|
||||
imgui.pop_id()
|
||||
|
||||
ch, app.history_trunc_limit = imgui.input_int("History Truncation Limit", app.history_trunc_limit, 1024)
|
||||
|
||||
if app.current_provider == "gemini_cli":
|
||||
imgui.separator()
|
||||
imgui.text("Gemini CLI")
|
||||
sid = "None"
|
||||
if hasattr(ai_client, "_gemini_cli_adapter") and ai_client._gemini_cli_adapter: sid = ai_client._gemini_cli_adapter.session_id or "None"
|
||||
imgui.text("Session ID:"); imgui.same_line(); render_selectable_label(app, "gemini_cli_sid", sid, width=200)
|
||||
if imgui.button("Reset CLI Session"): ai_client.reset_session()
|
||||
imgui.text("Binary Path")
|
||||
ch, app.ui_gemini_cli_path = imgui.input_text("##gcli_path", app.ui_gemini_cli_path)
|
||||
imgui.same_line()
|
||||
if imgui.button("Browse##gcli"):
|
||||
r = hide_tk_root()
|
||||
p = filedialog.askopenfilename(title="Select gemini CLI binary")
|
||||
r.destroy()
|
||||
if p: app.ui_gemini_cli_path = p
|
||||
if ch:
|
||||
if hasattr(ai_client, "_gemini_cli_adapter") and ai_client._gemini_cli_adapter:
|
||||
ai_client._gemini_cli_adapter.binary_path = app.ui_gemini_cli_path
|
||||
if app.perf_profiling_enabled: app.perf_monitor.end_component("_render_provider_panel")
|
||||
|
||||
def render_persona_selector_panel(app: App) -> None:
|
||||
|
||||
@@ -123,8 +123,7 @@ def default_project(name: str = "unnamed") -> Metadata:
|
||||
"files": {"base_dir": ".", "paths": [], "tier_assignments": {}},
|
||||
"screenshots": {"base_dir": ".", "paths": []},
|
||||
"context_presets": {},
|
||||
"gemini_cli": {"binary_path": "gemini"},
|
||||
"deepseek": {"reasoning_effort": "medium"},
|
||||
"deepseek": {"reasoning_effort": "medium"},
|
||||
"agent": {
|
||||
"tools": {
|
||||
"run_powershell": True,
|
||||
|
||||
Reference in New Issue
Block a user