pub struct AgentRegistry { /* private fields */ }Expand description
Agent registry with CCS alias support.
CCS aliases are eagerly resolved and registered as regular agents
when set via set_ccs_aliases(). This allows get() to work
uniformly for both regular agents and CCS aliases.
Implementations§
Source§impl AgentRegistry
impl AgentRegistry
Sourcepub fn set_ccs_aliases(
&mut self,
aliases: &HashMap<String, CcsAliasConfig>,
defaults: CcsConfig,
)
pub fn set_ccs_aliases( &mut self, aliases: &HashMap<String, CcsAliasConfig>, defaults: CcsConfig, )
Set CCS aliases for the registry.
This eagerly registers CCS aliases as agents so they can be
resolved with resolve_config().
Sourcepub fn register(&mut self, name: &str, config: AgentConfig)
pub fn register(&mut self, name: &str, config: AgentConfig)
Register a new agent.
Sourcepub fn resolve_config(&self, name: &str) -> Option<AgentConfig>
pub fn resolve_config(&self, name: &str) -> Option<AgentConfig>
Resolve an agent’s configuration, including on-the-fly CCS references.
CCS supports direct execution via ccs/<alias> even when the alias isn’t
pre-registered in config; those are resolved lazily here.
Sourcepub fn display_name(&self, name: &str) -> String
pub fn display_name(&self, name: &str) -> String
Get display name for an agent.
Returns the agent’s custom display name if set (e.g., “ccs-glm” for CCS aliases), otherwise returns the agent’s registry name.
§Arguments
name- The agent’s registry name (e.g., “ccs/glm”, “claude”)
§Examples
assert_eq!(registry.display_name("ccs/glm"), "ccs-glm");
assert_eq!(registry.display_name("claude"), "claude");Sourcepub fn resolve_fuzzy(&self, name: &str) -> Option<String>
pub fn resolve_fuzzy(&self, name: &str) -> Option<String>
Resolve a fuzzy agent name to a canonical agent name.
This handles common typos and alternative forms:
ccs/<unregistered>: Returns the name as-is for direct CCS execution- Other fuzzy matches: Returns the canonical name if a match is found
- Exact matches: Returns the name as-is
Returns None if the name cannot be resolved to any known agent.
Sourcepub fn list(&self) -> Vec<(&str, &AgentConfig)>
pub fn list(&self) -> Vec<(&str, &AgentConfig)>
List all registered agents.
Sourcepub fn developer_cmd(&self, agent_name: &str) -> Option<String>
pub fn developer_cmd(&self, agent_name: &str) -> Option<String>
Get command for developer role.
Sourcepub fn reviewer_cmd(&self, agent_name: &str) -> Option<String>
pub fn reviewer_cmd(&self, agent_name: &str) -> Option<String>
Get command for reviewer role.
Sourcepub fn load_from_file<P: AsRef<Path>>(
&mut self,
path: P,
) -> Result<usize, AgentConfigError>
pub fn load_from_file<P: AsRef<Path>>( &mut self, path: P, ) -> Result<usize, AgentConfigError>
Load custom agents from a TOML configuration file.
Sourcepub fn apply_unified_config(&mut self, unified: &UnifiedConfig) -> usize
pub fn apply_unified_config(&mut self, unified: &UnifiedConfig) -> usize
Apply settings from the unified config (~/.config/ralph-workflow.toml).
This merges (in increasing priority):
- Built-in defaults (embedded
examples/agents.toml) - Unified config:
[agents],[ccs_aliases], and[agent_chain](if present)
Returns the number of agents loaded from unified config, including CCS aliases.
Sourcepub const fn fallback_config(&self) -> &FallbackConfig
pub const fn fallback_config(&self) -> &FallbackConfig
Get the fallback configuration.
Sourcepub fn available_fallbacks(&self, role: AgentRole) -> Vec<&str>
pub fn available_fallbacks(&self, role: AgentRole) -> Vec<&str>
Get all fallback agents for a role that are registered in this registry.
Sourcepub fn validate_agent_chains(&self) -> Result<(), String>
pub fn validate_agent_chains(&self) -> Result<(), String>
Validate that agent chains are configured for both roles.
Sourcepub fn is_agent_available(&self, name: &str) -> bool
pub fn is_agent_available(&self, name: &str) -> bool
Check if an agent is available (command exists and is executable).
Sourcepub fn list_available(&self) -> Vec<&str>
pub fn list_available(&self) -> Vec<&str>
List all available (installed) agents.
Auto Trait Implementations§
impl Freeze for AgentRegistry
impl RefUnwindSafe for AgentRegistry
impl Send for AgentRegistry
impl Sync for AgentRegistry
impl Unpin for AgentRegistry
impl UnwindSafe for AgentRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more