pub struct AgentCapabilityRegistry { /* private fields */ }Expand description
Maps capability id → ordered list of agents that implement it.
Concurrent access via RwLock. Reads (the hot path during
dispatch) are non-blocking under contention; writes (registration,
usage tracking) are infrequent.
Implementations§
Source§impl AgentCapabilityRegistry
impl AgentCapabilityRegistry
pub fn new() -> Self
Sourcepub fn register(
&self,
capability: impl Into<String>,
agent_id: impl Into<String>,
)
pub fn register( &self, capability: impl Into<String>, agent_id: impl Into<String>, )
Register agent_id as a provider for capability. Idempotent —
re-registering is a no-op (insertion order is preserved on the
first registration).
Sourcepub fn unregister(&self, capability: &str, agent_id: &str)
pub fn unregister(&self, capability: &str, agent_id: &str)
Remove agent_id from capability. Used by the bundle uninstall
path (when it exists). Idempotent.
Sourcepub fn agents_for(&self, capability: &str) -> Vec<String>
pub fn agents_for(&self, capability: &str) -> Vec<String>
Snapshot of all agents registered for capability, in
registration order.
Sourcepub fn all_agents(&self) -> Vec<String>
pub fn all_agents(&self) -> Vec<String>
Snapshot of every agent registered for any capability,
deduplicated. Useful for the FFI surface’s list_agents(None)
call.
Sourcepub fn select(&self, capability: &str, hint: Option<&str>) -> Option<String>
pub fn select(&self, capability: &str, hint: Option<&str>) -> Option<String>
Pick one agent for capability. Returns None only when no
agents are registered. See module docs for the selection
strategy.
Sourcepub fn note_used(&self, capability: &str, agent_id: &str)
pub fn note_used(&self, capability: &str, agent_id: &str)
Record that agent_id successfully served capability. Updates
the last-used timestamp for [select]’s MRU tiebreaker.
Silent no-op if the entry isn’t registered.
Sourcepub fn capability_count(&self) -> usize
pub fn capability_count(&self) -> usize
Number of distinct capabilities tracked. For diagnostics.
Trait Implementations§
Source§impl Debug for AgentCapabilityRegistry
impl Debug for AgentCapabilityRegistry
Source§impl Default for AgentCapabilityRegistry
impl Default for AgentCapabilityRegistry
Source§fn default() -> AgentCapabilityRegistry
fn default() -> AgentCapabilityRegistry
Auto Trait Implementations§
impl !Freeze for AgentCapabilityRegistry
impl RefUnwindSafe for AgentCapabilityRegistry
impl Send for AgentCapabilityRegistry
impl Sync for AgentCapabilityRegistry
impl Unpin for AgentCapabilityRegistry
impl UnsafeUnpin for AgentCapabilityRegistry
impl UnwindSafe for AgentCapabilityRegistry
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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