pub struct AgentRegistry { /* private fields */ }Expand description
Holds every known delegate keyed by name(). Additional aliases can
be registered to route shorthand request names to canonical entries.
Implementations§
Source§impl AgentRegistry
impl AgentRegistry
pub fn new() -> Self
Sourcepub fn register(&mut self, delegate: Arc<dyn AgentDelegate>)
pub fn register(&mut self, delegate: Arc<dyn AgentDelegate>)
Register a delegate under its declared name(). Last write wins.
Sourcepub fn register_manual(
&mut self,
delegate: Arc<dyn AgentDelegate>,
binary: PathBuf,
version: Option<String>,
)
pub fn register_manual( &mut self, delegate: Arc<dyn AgentDelegate>, binary: PathBuf, version: Option<String>, )
Register a delegate that came from hand-written agents.delegates[]
config. Records agent_status as AgentSource::Manual so the
operator surface (QueryAgents, doctor) sees the entry instead of
silently diverging from what the orchestrator will actually run.
Sourcepub fn register_subprocess_spec(
&mut self,
spec: &CustomAgentSpec,
source: AgentSource,
) -> PathBuf
pub fn register_subprocess_spec( &mut self, spec: &CustomAgentSpec, source: AgentSource, ) -> PathBuf
Build a SubprocessAgentDelegate from a CustomAgentSpec and
register it under spec.id with the given source attribution.
Returns the binary path so callers can reuse it for status/log
messages.
This is the canonical entry point for both the YAML
agents.delegates[] flow (source = AgentSource::Manual) and the
programmatic DelegateOverrides::custom flow
(source = AgentSource::Custom). Centralising the
SubprocessAgentConfig construction here keeps the two paths from
drifting — every new field on CustomAgentSpec is honoured by
both.
Sourcepub fn alias(&mut self, alias: impl Into<String>, canonical: impl Into<String>)
pub fn alias(&mut self, alias: impl Into<String>, canonical: impl Into<String>)
Add an alias: alias -> canonical_name. If canonical_name isn’t
registered yet, the alias is still stored — resolved lazily.
pub fn get(&self, name: &str) -> Result<Arc<dyn AgentDelegate>, AgentError>
pub fn contains(&self, name: &str) -> bool
pub fn is_empty(&self) -> bool
Sourcepub fn agent_status(&self, id: &str) -> Option<&RegistryAgentStatus>
pub fn agent_status(&self, id: &str) -> Option<&RegistryAgentStatus>
Known state for an agent id — including ones we saw but did not
register (disabled, probe-failed). Returns None for ids the
discovery pass never encountered.
Sourcepub fn known_agents(&self) -> Vec<(&str, &RegistryAgentStatus)>
pub fn known_agents(&self) -> Vec<(&str, &RegistryAgentStatus)>
Every agent id we’ve learned about, whether registered or not.
Sourcepub fn populate_from_discovery(
&mut self,
discovered: Vec<DiscoveredBinary>,
overrides: &DelegateOverrides,
)
pub fn populate_from_discovery( &mut self, discovered: Vec<DiscoveredBinary>, overrides: &DelegateOverrides, )
Consume a discovery pass + user overrides and register runnable
delegates for every Available agent that isn’t disabled.
Unavailable or disabled agents are not registered but their
reason is retained in agent_status so the operator surface can
answer “why isn’t X available”. Existing manual registrations
are left untouched.