refactor: remove agent mode and related functionality; update help and README
This commit is contained in:
@@ -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<String> {
|
||||
let count = get_agent_count(state);
|
||||
(0..count).map(|i| format!("agent-{}", i)).collect()
|
||||
}
|
||||
@@ -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")
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ Keybindings:
|
||||
Slash commands:
|
||||
/help Show this help
|
||||
/quit Quit session
|
||||
/mode <name> Switch mode (chat, agents, bash, workflow)
|
||||
/mode <name> Switch mode (chat, bash, workflow)
|
||||
/lesson <text> Create a lesson
|
||||
/lesson list List lessons
|
||||
/lesson export Export lessons
|
||||
|
||||
@@ -15,7 +15,6 @@ pub mod todo;
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub enum ModeKind {
|
||||
Chat,
|
||||
Agents,
|
||||
Bash,
|
||||
Workflow,
|
||||
Help,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -38,7 +38,6 @@ pub enum Overlay {
|
||||
None,
|
||||
Help,
|
||||
Settings,
|
||||
Agents,
|
||||
Bash,
|
||||
QuitConfirm,
|
||||
Workflow,
|
||||
|
||||
@@ -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<String>) -> 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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user