Refactor and clean up code across multiple modules
- Simplified token type assignment in OAuth service. - Removed unused session_lock module and re-exported Session from zesdex_entities. - Cleaned up session entity by removing unnecessary comments and code. - Consolidated session handling in HTTP handlers for better readability. - Improved formatting and readability in OAuth repository tests. - Enhanced session lock repository with clearer match statements. - Streamlined session repository error handling. - Refined RNG tests for better clarity. - Adjusted module visibility and organization in lib.rs. - Updated IPC client and connection code for better error handling and clarity. - Improved frame handling in IPC for better readability. - Organized module imports and added test utilities for IPC. - Enhanced database connection error handling. - Simplified JWT token creation error handling. - Improved password verification error handling. - Cleaned up state management code for better readability. - Refactored middleware for session authentication and rate limiting. - Simplified clipboard utility for better error handling. - Enhanced logging initialization for better error reporting. - Improved pagination utility with clearer method annotations. - Cleaned up sanitization functions for filenames and paths. - Enhanced slug generation functions for better clarity and usability.
This commit is contained in:
@@ -14,13 +14,11 @@ use crate::app::subagent::spawn::AgentDefinition;
|
||||
/// researcher, planner).
|
||||
pub fn builtin_agents() -> Vec<AgentDefinition> {
|
||||
vec![
|
||||
AgentDefinition::new(
|
||||
"coder".to_string(),
|
||||
"coder".to_string(),
|
||||
).with_system_prompt(
|
||||
"You are a coding agent. Write correct, idiomatic Rust code.".to_string()
|
||||
).with_allowed_tools(
|
||||
vec![
|
||||
AgentDefinition::new("coder".to_string(), "coder".to_string())
|
||||
.with_system_prompt(
|
||||
"You are a coding agent. Write correct, idiomatic Rust code.".to_string(),
|
||||
)
|
||||
.with_allowed_tools(vec![
|
||||
"read".to_string(),
|
||||
"write".to_string(),
|
||||
"edit".to_string(),
|
||||
@@ -35,16 +33,14 @@ pub fn builtin_agents() -> Vec<AgentDefinition> {
|
||||
"lsp_references".to_string(),
|
||||
"lsp_completion".to_string(),
|
||||
"lsp_disconnect".to_string(),
|
||||
]
|
||||
).with_max_steps(usize::MAX),
|
||||
|
||||
AgentDefinition::new(
|
||||
"reviewer".to_string(),
|
||||
"reviewer".to_string(),
|
||||
).with_system_prompt(
|
||||
"You are a code reviewer. Focus on correctness, safety, and performance.".to_string()
|
||||
).with_allowed_tools(
|
||||
vec![
|
||||
])
|
||||
.with_max_steps(usize::MAX),
|
||||
AgentDefinition::new("reviewer".to_string(), "reviewer".to_string())
|
||||
.with_system_prompt(
|
||||
"You are a code reviewer. Focus on correctness, safety, and performance."
|
||||
.to_string(),
|
||||
)
|
||||
.with_allowed_tools(vec![
|
||||
"read".to_string(),
|
||||
"grep".to_string(),
|
||||
"glob".to_string(),
|
||||
@@ -54,39 +50,34 @@ pub fn builtin_agents() -> Vec<AgentDefinition> {
|
||||
"lsp_hover".to_string(),
|
||||
"lsp_definition".to_string(),
|
||||
"lsp_references".to_string(),
|
||||
]
|
||||
).with_max_steps(usize::MAX),
|
||||
|
||||
AgentDefinition::new(
|
||||
"researcher".to_string(),
|
||||
"researcher".to_string(),
|
||||
).with_system_prompt(
|
||||
"You are a research agent. Search for information and summarize findings.".to_string()
|
||||
).with_allowed_tools(
|
||||
vec![
|
||||
])
|
||||
.with_max_steps(usize::MAX),
|
||||
AgentDefinition::new("researcher".to_string(), "researcher".to_string())
|
||||
.with_system_prompt(
|
||||
"You are a research agent. Search for information and summarize findings."
|
||||
.to_string(),
|
||||
)
|
||||
.with_allowed_tools(vec![
|
||||
"read".to_string(),
|
||||
"grep".to_string(),
|
||||
"glob".to_string(),
|
||||
"bash".to_string(),
|
||||
"search_web".to_string(),
|
||||
"fetch_url".to_string(),
|
||||
]
|
||||
).with_max_steps(usize::MAX),
|
||||
|
||||
AgentDefinition::new(
|
||||
"planner".to_string(),
|
||||
"planner".to_string(),
|
||||
).with_system_prompt(
|
||||
"You are a planning agent. Break down tasks into clear steps.".to_string()
|
||||
).with_allowed_tools(
|
||||
vec![
|
||||
])
|
||||
.with_max_steps(usize::MAX),
|
||||
AgentDefinition::new("planner".to_string(), "planner".to_string())
|
||||
.with_system_prompt(
|
||||
"You are a planning agent. Break down tasks into clear steps.".to_string(),
|
||||
)
|
||||
.with_allowed_tools(vec![
|
||||
"read".to_string(),
|
||||
"write".to_string(),
|
||||
"edit".to_string(),
|
||||
"bash".to_string(),
|
||||
"todo_write".to_string(),
|
||||
"todo_finish".to_string(),
|
||||
]
|
||||
).with_max_steps(usize::MAX),
|
||||
])
|
||||
.with_max_steps(usize::MAX),
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#![allow(dead_code)]
|
||||
//! Load, save, add, and remove agent definitions scoped to a single
|
||||
//! session (`<session_dir>/agents.json`).
|
||||
use std::path::Path;
|
||||
use crate::app::subagent::spawn::AgentDefinition;
|
||||
use std::path::Path;
|
||||
|
||||
/// Load agent definitions saved for a specific session.
|
||||
///
|
||||
@@ -21,12 +21,10 @@ pub fn load_session_agents(session_dir: &Path) -> Vec<AgentDefinition> {
|
||||
return Vec::new();
|
||||
}
|
||||
match std::fs::read_to_string(&agents_file) {
|
||||
Ok(content) => {
|
||||
serde_json::from_str(&content).unwrap_or_else(|e| {
|
||||
tracing::warn!("[session] failed to parse agents.json: {}", e);
|
||||
Vec::new()
|
||||
})
|
||||
}
|
||||
Ok(content) => serde_json::from_str(&content).unwrap_or_else(|e| {
|
||||
tracing::warn!("[session] failed to parse agents.json: {}", e);
|
||||
Vec::new()
|
||||
}),
|
||||
Err(_) => Vec::new(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
pub mod store {
|
||||
pub use zesdex_entities::seaorm::common::store::*;
|
||||
}
|
||||
pub mod agent_def;
|
||||
/// Local modules not extracted to workspace crates
|
||||
pub mod msglog;
|
||||
pub mod agent_def;
|
||||
|
||||
Reference in New Issue
Block a user