diff --git a/src/agent/profile.rs b/src/agent/profile.rs index 2cd1322..8fb2a58 100644 --- a/src/agent/profile.rs +++ b/src/agent/profile.rs @@ -78,15 +78,20 @@ impl AgentProfile { // Security: take from parent if not set in child // Simple heuristic: if child has default values, use parent's if self.security.allowed_paths == vec!["*"] && parent.security.allowed_paths != vec!["*"] { - self.security.allowed_paths.clone_from(&parent.security.allowed_paths); + self.security + .allowed_paths + .clone_from(&parent.security.allowed_paths); } if self.security.denied_paths.is_empty() && !parent.security.denied_paths.is_empty() { - self.security.denied_paths.clone_from(&parent.security.denied_paths); + self.security + .denied_paths + .clone_from(&parent.security.denied_paths); } if self.security.allowed_commands == vec!["*"] && parent.security.allowed_commands != vec!["*"] { - self.security.allowed_commands + self.security + .allowed_commands .clone_from(&parent.security.allowed_commands); } diff --git a/tests/agent_types_test.rs b/tests/agent_types_test.rs index 0e0f98c..45f7ed6 100644 --- a/tests/agent_types_test.rs +++ b/tests/agent_types_test.rs @@ -1,11 +1,11 @@ -use rustagent::agent::{Agent, AgentContext, AgentId, AgentOutcome}; +use async_trait::async_trait; use rustagent::agent::profile::AgentProfile; -use rustagent::graph::{GraphNode, NodeStatus, EdgeType}; +use rustagent::agent::{Agent, AgentContext, AgentId, AgentOutcome}; +use rustagent::graph::{EdgeType, GraphNode, NodeStatus}; use rustagent::security::SecurityScope; use std::collections::HashMap; use std::path::PathBuf; use std::sync::Arc; -use async_trait::async_trait; /// Mock agent for testing trait implementation struct MockAgent { @@ -248,10 +248,7 @@ impl rustagent::graph::store::GraphStore for MockGraphStore { Ok(vec![]) } - async fn get_children( - &self, - _node_id: &str, - ) -> anyhow::Result> { + async fn get_children(&self, _node_id: &str) -> anyhow::Result> { Ok(vec![]) } @@ -263,7 +260,10 @@ impl rustagent::graph::store::GraphStore for MockGraphStore { Ok(vec![]) } - async fn get_full_graph(&self, _goal_id: &str) -> anyhow::Result { + async fn get_full_graph( + &self, + _goal_id: &str, + ) -> anyhow::Result { Ok(rustagent::graph::store::WorkGraph { nodes: vec![], edges: vec![], diff --git a/tests/profile_test.rs b/tests/profile_test.rs index 93f2285..185e6d4 100644 --- a/tests/profile_test.rs +++ b/tests/profile_test.rs @@ -65,13 +65,19 @@ fn test_agent_profile_deserialize() { assert_eq!(profile.name, "coder"); assert_eq!(profile.role, "Implementation specialist"); - assert_eq!(profile.system_prompt, "You are a code implementation specialist"); + assert_eq!( + profile.system_prompt, + "You are a code implementation specialist" + ); assert_eq!(profile.allowed_tools, vec!["file", "shell"]); assert_eq!(profile.turn_limit, Some(50)); assert_eq!(profile.token_budget, Some(100000)); assert_eq!(profile.security.allowed_paths, vec!["/project"]); assert_eq!(profile.security.allowed_commands, vec!["ls", "cat"]); - assert_eq!(profile.llm.model, Some("claude-3-sonnet-20250219".to_string())); + assert_eq!( + profile.llm.model, + Some("claude-3-sonnet-20250219".to_string()) + ); assert_eq!(profile.llm.temperature, Some(0.7)); assert_eq!(profile.llm.max_tokens, Some(4096)); } @@ -237,7 +243,11 @@ fn test_agent_profile_inheritance_system_prompt_appends() { child.apply_inheritance(&parent); assert!(child.system_prompt.contains("Parent instructions")); - assert!(child.system_prompt.contains("Project-Specific Instructions")); + assert!( + child + .system_prompt + .contains("Project-Specific Instructions") + ); assert!(child.system_prompt.contains("Child instructions")); }