From 3cfe39e5f2764ec020b41b66cd8679040ee873d2 Mon Sep 17 00:00:00 2001 From: asepharyana Date: Sun, 12 Jul 2026 03:22:55 +0700 Subject: [PATCH] refactor: remove agent mode and related functionality; update help and README --- README.md | 13 ++----- src-misc/system-prompt.txt | 2 +- src/app/mode/agents/mod.rs | 10 ------ src/app/mode/editor.rs | 65 ---------------------------------- src/app/mode/help.rs | 2 +- src/app/mode/mod.rs | 1 - src/app/runtime/actions/mod.rs | 1 - src/app/state/types.rs | 1 - src/app/subagent/spawn.rs | 14 -------- src/controller/command.rs | 1 - src/main.rs | 2 +- src/resources.rs | 8 +---- src/service/provider.rs | 14 -------- src/view/mod.rs | 16 +-------- src/view/theme.rs | 2 -- 15 files changed, 8 insertions(+), 144 deletions(-) delete mode 100644 src/app/mode/agents/mod.rs diff --git a/README.md b/README.md index df4090b..956369a 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Zesdex is a Rust-powered AI assistant that operates directly in your terminal vi ## Features - **TUI Interface** — Full-screen terminal UI with chat panel, input bar, and status bar built with ratatui and crossterm. -- **Multi-Agent Modes** — Auto (full autonomy), Normal (review risky ops), Plan (no mutations), Yolo (unrestricted). + - **Rich Tool System** — 20+ built-in tools for file operations, searching, bash execution, git operations, web access, memory management, and workflow orchestration. - **Daemon Architecture** — Run as a background daemon with client attach/detach via Unix domain sockets. - **IPC Protocol** — Bidirectional state synchronization between daemon and client processes. @@ -27,7 +27,7 @@ src/ ├── app/ # Application core │ ├── state/ # State management (AppStateRest, types, misc) │ ├── runtime/ # Action dispatch and event loop -│ ├── mode/ # Agent mode definitions (Auto/Normal/Plan/Yolo) +│ ├── mode/ # UI modes and overlays │ ├── harness.rs # Tool harness for agent execution │ ├── workflow/ # Workflow engine (script, engine) │ ├── mcp/ # Model Context Protocol manager @@ -111,7 +111,7 @@ RUST_LOG=debug zesdex | `Ctrl+Q` | Quit | | `Ctrl+H` | Help overlay | | `Ctrl+P` | Settings overlay | -| `Ctrl+A` | Cycle agent mode | +| `Ctrl+A` | Toggle yolo arm | | `Ctrl+B` | Bash panel | | `Ctrl+S` | Session hub | | `Ctrl+T` | Task list | @@ -132,13 +132,6 @@ RUST_LOG=debug zesdex | `/settings` | Open settings | | `/session` | Session management | -## Agent Modes - -- **Auto** — Full autonomy. The agent can read, write, edit files, run bash commands, and execute git operations without confirmation. -- **Normal** — Risky operations (write, delete, edit, bash, destructive git) require manual approval. -- **Plan** — Planning mode. The agent can analyze and propose changes but cannot execute mutations. -- **Yolo** — Unrestricted mode. Full autonomy with no confirmation prompts. - ## Security Zesdex includes multiple layers of security: diff --git a/src-misc/system-prompt.txt b/src-misc/system-prompt.txt index a87fc64..cbd3774 100644 --- a/src-misc/system-prompt.txt +++ b/src-misc/system-prompt.txt @@ -10,6 +10,6 @@ Core principles: 7. Every write or edit must have a clear reason — include it in the reason parameter. 8. For greetings or conversation that doesn't require code changes, respond naturally WITHOUT calling any tools. 9. After making changes, verify they work by running builds or tests. -10. Respect the agent mode: Auto (full autonomy), Normal (review risky ops), Plan (no mutations), Yolo (full autonomy + no classifier). + Available tools are described in the system-tools.txt section. Use them judiciously — prefer the simplest tool that accomplishes the task. \ No newline at end of file diff --git a/src/app/mode/agents/mod.rs b/src/app/mode/agents/mod.rs deleted file mode 100644 index 8d55b39..0000000 --- a/src/app/mode/agents/mod.rs +++ /dev/null @@ -1,10 +0,0 @@ -use crate::app::state::rest::AppStateRest; - -pub fn get_agent_count(state: &AppStateRest) -> usize { - state.session_runtime.as_ref().map_or(0, |rt| rt.subagent_queue) -} - -pub fn get_active_agents(state: &AppStateRest) -> Vec { - let count = get_agent_count(state); - (0..count).map(|i| format!("agent-{}", i)).collect() -} diff --git a/src/app/mode/editor.rs b/src/app/mode/editor.rs index cf34998..c006072 100644 --- a/src/app/mode/editor.rs +++ b/src/app/mode/editor.rs @@ -32,31 +32,12 @@ impl EditorState { } } - pub fn change_line(&mut self, text: String) { - self.save_undo(); - if self.cursor_line < self.content.len() { - self.content[self.cursor_line] = text; - } - } - pub fn insert_line_after(&mut self) { self.save_undo(); let pos = (self.cursor_line + 1).min(self.content.len()); self.content.insert(pos, String::new()); } - pub fn delete_current_line(&mut self) { - if self.content.len() <= 1 { - return; - } - self.save_undo(); - self.content.remove(self.cursor_line); - if self.cursor_line >= self.content.len() { - self.cursor_line = self.content.len() - 1; - } - self.cursor_col = 0; - } - fn save_undo(&mut self) { self.undo_stack.push(self.content.clone()); if self.undo_stack.len() > 50 { @@ -64,23 +45,6 @@ impl EditorState { } } - pub fn undo(&mut self) { - if let Some(prev) = self.undo_stack.pop() { - self.content = prev; - self.cursor_line = self.cursor_line.min(self.content.len().saturating_sub(1)); - self.cursor_col = 0; - } - } - - pub fn cursor_up(&mut self) { - if self.cursor_line > 0 { - self.cursor_line -= 1; - } - self.cursor_col = self.cursor_col.min( - self.content.get(self.cursor_line).map(|l| l.len()).unwrap_or(0), - ); - } - pub fn cursor_down(&mut self) { if self.cursor_line + 1 < self.content.len() { self.cursor_line += 1; @@ -90,26 +54,6 @@ impl EditorState { ); } - pub fn cursor_left(&mut self) { - if self.cursor_col > 0 { - self.cursor_col -= 1; - } else if self.cursor_line > 0 { - self.cursor_line -= 1; - self.cursor_col = self.content.get(self.cursor_line).map(|l| l.len()).unwrap_or(0); - } - } - - pub fn cursor_right(&mut self) { - if let Some(line) = self.content.get(self.cursor_line) { - if self.cursor_col < line.len() { - self.cursor_col += 1; - } else if self.cursor_line + 1 < self.content.len() { - self.cursor_line += 1; - self.cursor_col = 0; - } - } - } - pub fn insert_char(&mut self, c: char) { self.save_undo(); if let Some(line) = self.content.get_mut(self.cursor_line) { @@ -134,15 +78,6 @@ impl EditorState { } } - pub fn join_lines(&mut self) { - if self.cursor_line + 1 >= self.content.len() { - return; - } - self.save_undo(); - let next = self.content.remove(self.cursor_line + 1); - self.content[self.cursor_line].push_str(&next); - } - pub fn as_string(&self) -> String { self.content.join("\n") } diff --git a/src/app/mode/help.rs b/src/app/mode/help.rs index a6a0d58..ca69b17 100644 --- a/src/app/mode/help.rs +++ b/src/app/mode/help.rs @@ -20,7 +20,7 @@ Keybindings: Slash commands: /help Show this help /quit Quit session - /mode Switch mode (chat, agents, bash, workflow) + /mode Switch mode (chat, bash, workflow) /lesson Create a lesson /lesson list List lessons /lesson export Export lessons diff --git a/src/app/mode/mod.rs b/src/app/mode/mod.rs index 87cdd66..178a54f 100644 --- a/src/app/mode/mod.rs +++ b/src/app/mode/mod.rs @@ -15,7 +15,6 @@ pub mod todo; #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] pub enum ModeKind { Chat, - Agents, Bash, Workflow, Help, diff --git a/src/app/runtime/actions/mod.rs b/src/app/runtime/actions/mod.rs index cd99b4f..a85ee75 100644 --- a/src/app/runtime/actions/mod.rs +++ b/src/app/runtime/actions/mod.rs @@ -72,7 +72,6 @@ pub fn apply_action(state: &mut AppStateRest, action: Action) { Action::SwitchMode(mode) => { state.misc.overlay = match mode { ModeKind::Chat - | ModeKind::Agents | ModeKind::Bash | ModeKind::Workflow => Overlay::None, ModeKind::Help => Overlay::Help, diff --git a/src/app/state/types.rs b/src/app/state/types.rs index 17b9a8b..c21de8c 100644 --- a/src/app/state/types.rs +++ b/src/app/state/types.rs @@ -38,7 +38,6 @@ pub enum Overlay { None, Help, Settings, - Agents, Bash, QuitConfirm, Workflow, diff --git a/src/app/subagent/spawn.rs b/src/app/subagent/spawn.rs index 2df125d..0803e4a 100644 --- a/src/app/subagent/spawn.rs +++ b/src/app/subagent/spawn.rs @@ -22,23 +22,9 @@ impl AgentDefinition { } } - pub fn with_system_prompt(mut self, prompt: String) -> Self { - self.system_prompt = Some(prompt); - self - } - - pub fn with_allowed_tools(mut self, tools: Vec) -> Self { - self.allowed_tools = Some(tools); - self - } - pub fn with_max_steps(mut self, steps: usize) -> Self { self.max_steps = Some(steps); self } - pub fn with_temperature(mut self, temp: f32) -> Self { - self.temperature = Some(temp); - self - } } diff --git a/src/controller/command.rs b/src/controller/command.rs index b8baa20..ee6cc5d 100644 --- a/src/controller/command.rs +++ b/src/controller/command.rs @@ -41,7 +41,6 @@ pub fn parse_command(text: &str) -> Command { "/mode" => { let mode = match arg1 { "chat" | "c" => ModeKind::Chat, - "agents" | "a" => ModeKind::Agents, "bash" | "b" => ModeKind::Bash, "workflow" | "w" => ModeKind::Workflow, "help" | "h" => ModeKind::Help, diff --git a/src/main.rs b/src/main.rs index e7865ac..7947233 100644 --- a/src/main.rs +++ b/src/main.rs @@ -204,7 +204,7 @@ fn apply_client_update( state.misc.overlay = match payload.overlay.as_deref() { Some("Help") => Overlay::Help, Some("Settings") => Overlay::Settings, - Some("Agents") => Overlay::Agents, + Some("Bash") => Overlay::Bash, Some("QuitConfirm") => Overlay::QuitConfirm, Some("Workflow") => Overlay::Workflow, diff --git a/src/resources.rs b/src/resources.rs index ef54507..cb86ca1 100644 --- a/src/resources.rs +++ b/src/resources.rs @@ -8,7 +8,7 @@ Navigation: Ctrl+Q Quit Ctrl+H Help (this screen) Ctrl+P Settings - Ctrl+A Cycle agent mode (Auto/Normal/Plan/Yolo) + Ctrl+A Toggle yolo arm Ctrl+B Bash panel Ctrl+S Session hub Ctrl+T Task list @@ -18,12 +18,6 @@ Navigation: Tab Autocomplete Up/Down History navigation -Modes: - Auto Automatic approval of most operations - Normal Manual approval for risky operations - Plan Planning mode - no code changes - Yolo Unrestricted - full autonomy - Input: /help Show help /clear Clear screen diff --git a/src/service/provider.rs b/src/service/provider.rs index f7da80c..a37cefb 100644 --- a/src/service/provider.rs +++ b/src/service/provider.rs @@ -42,20 +42,6 @@ impl LlmClient { } } - pub fn chat(&self, messages: &[ChatMessage]) -> Result { - let response = self.chat_with_tools(messages, None)?; - Ok(response.content.unwrap_or_default()) - } - - pub fn chat_with_tools( - &self, - messages: &[ChatMessage], - tools: Option>, - ) -> Result { - let (msg, _usage) = self.chat_with_tools_non_streaming(messages, tools)?; - Ok(msg) - } - pub fn chat_with_tools_non_streaming( &self, messages: &[ChatMessage], diff --git a/src/view/mod.rs b/src/view/mod.rs index 71569b6..a586ff0 100644 --- a/src/view/mod.rs +++ b/src/view/mod.rs @@ -93,21 +93,7 @@ fn render_overlay(frame: &mut Frame, area: Rect, overlay: crate::app::state::typ let paragraph = Paragraph::new(lines).block(block); frame.render_widget(paragraph, overlay_area); } - crate::app::state::types::Overlay::Agents => { - let block = block.title(" Agents "); - let lines = vec![ - Line::from(Span::styled( - "Sub-agent management panel", - Style::default().fg(Theme::TEXT), - )), - Line::from(Span::styled( - format!("Subagent queue: {}", state.session_runtime.as_ref().map(|r| r.subagent_queue).unwrap_or(0)), - Style::default().fg(Theme::INFO), - )), - ]; - let paragraph = Paragraph::new(lines).block(block); - frame.render_widget(paragraph, overlay_area); - } + crate::app::state::types::Overlay::Bash => { let block = block.title(" Bash "); let lines: Vec = state.session_runtime.as_ref().map(|r| { diff --git a/src/view/theme.rs b/src/view/theme.rs index ebf4bd4..edc33f1 100644 --- a/src/view/theme.rs +++ b/src/view/theme.rs @@ -19,7 +19,5 @@ impl Theme { pub const BG: Color = Color::Reset; pub const STATUS_BAR_BG: Color = Color::Blue; pub const MODE_AUTO: Color = Color::Green; - pub const MODE_NORMAL: Color = Color::Yellow; - pub const MODE_PLAN: Color = Color::Cyan; pub const MODE_YOLO: Color = Color::Red; }