11pub mod definitions;
22pub mod parse;
3+ pub mod types;
34
45use std:: collections:: {
56 HashMap ,
@@ -43,19 +44,19 @@ use crate::agent::util::error::{
4344 UtilError ,
4445} ;
4546
46- /// Represents an agent config
47+ /// Represents an agent config.
4748///
48- /// Wraps [Config] along with some metadata
49+ /// Basically just wraps [Config] along with some metadata.
4950#[ derive( Debug , Clone ) ]
50- pub struct AgentConfig {
51+ pub struct LoadedAgentConfig {
5152 /// Where the config was sourced from
5253 #[ allow( dead_code) ]
5354 source : ConfigSource ,
5455 /// The actual config content
5556 config : Config ,
5657}
5758
58- impl AgentConfig {
59+ impl LoadedAgentConfig {
5960 pub fn config ( & self ) -> & Config {
6061 & self . config
6162 }
@@ -84,7 +85,7 @@ impl AgentConfig {
8485 self . config . hooks ( )
8586 }
8687
87- pub fn resources ( & self ) -> & Vec < String > {
88+ pub fn resources ( & self ) -> & [ impl AsRef < str > ] {
8889 self . config . resources ( )
8990 }
9091}
@@ -103,7 +104,7 @@ pub enum ConfigSource {
103104 BuiltIn ,
104105}
105106
106- impl Default for AgentConfig {
107+ impl Default for LoadedAgentConfig {
107108 fn default ( ) -> Self {
108109 Self {
109110 source : ConfigSource :: BuiltIn ,
@@ -112,7 +113,7 @@ impl Default for AgentConfig {
112113 }
113114}
114115
115- impl AgentConfig {
116+ impl LoadedAgentConfig {
116117 pub fn system_prompt ( & self ) -> Option < & str > {
117118 self . config . system_prompt ( )
118119 }
@@ -136,7 +137,7 @@ impl From<UtilError> for AgentConfigError {
136137 }
137138}
138139
139- pub async fn load_agents ( ) -> Result < ( Vec < AgentConfig > , Vec < AgentConfigError > ) > {
140+ pub async fn load_agents ( ) -> Result < ( Vec < LoadedAgentConfig > , Vec < AgentConfigError > ) > {
140141 let mut agent_configs = Vec :: new ( ) ;
141142 let mut invalid_agents = Vec :: new ( ) ;
142143 match load_workspace_agents ( ) . await {
@@ -148,7 +149,7 @@ pub async fn load_agents() -> Result<(Vec<AgentConfig>, Vec<AgentConfigError>)>
148149 agent_configs. append (
149150 & mut valid
150151 . into_iter ( )
151- . map ( |( path, config) | AgentConfig {
152+ . map ( |( path, config) | LoadedAgentConfig {
152153 source : ConfigSource :: Workspace { path } ,
153154 config,
154155 } )
@@ -169,7 +170,7 @@ pub async fn load_agents() -> Result<(Vec<AgentConfig>, Vec<AgentConfigError>)>
169170 agent_configs. append (
170171 & mut valid
171172 . into_iter ( )
172- . map ( |( path, config) | AgentConfig {
173+ . map ( |( path, config) | LoadedAgentConfig {
173174 source : ConfigSource :: Global { path } ,
174175 config,
175176 } )
@@ -182,7 +183,7 @@ pub async fn load_agents() -> Result<(Vec<AgentConfig>, Vec<AgentConfigError>)>
182183 } ;
183184
184185 // Always include the default agent as a fallback.
185- agent_configs. push ( AgentConfig :: default ( ) ) ;
186+ agent_configs. push ( LoadedAgentConfig :: default ( ) ) ;
186187
187188 info ! ( ?agent_configs, "loaded agent config" ) ;
188189
0 commit comments