pub struct WorkerRegistry { /* private fields */ }Expand description
A set of available workers, in the user’s preference order. The composition
root (the CLI) builds this from config + doctor; the engine consumes it.
Implementations§
Source§impl WorkerRegistry
impl WorkerRegistry
pub fn new() -> WorkerRegistry
Sourcepub fn register(&mut self, worker: Arc<dyn Worker>) -> &mut WorkerRegistry
pub fn register(&mut self, worker: Arc<dyn Worker>) -> &mut WorkerRegistry
Add a worker. Insertion order is preference order: earlier wins ties.
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
Sourcepub fn descriptors(&self) -> Vec<WorkerDescriptor>
pub fn descriptors(&self) -> Vec<WorkerDescriptor>
Clones of all worker descriptors, for handing the conductor the worker
registry (CONTEXT.md §7).
Sourcepub fn first(&self) -> Option<Arc<dyn Worker>>
pub fn first(&self) -> Option<Arc<dyn Worker>>
The first registered (most-preferred) worker, if any. Used as the harness-conductor fallback.
Sourcepub fn by_family(&self, family: WorkerFamily) -> Vec<Arc<dyn Worker>>
pub fn by_family(&self, family: WorkerFamily) -> Vec<Arc<dyn Worker>>
All registered workers of family, in preference order. Used to build the
conductor’s fallback chain so planning survives one harness failing.
Sourcepub fn resolve(
&self,
needs: &[Capability],
prefer: Option<&str>,
) -> Option<Arc<dyn Worker>>
pub fn resolve( &self, needs: &[Capability], prefer: Option<&str>, ) -> Option<Arc<dyn Worker>>
Resolve a node’s needs (and optional prefer) to a concrete worker.
Resolution order (CONTEXT.md §13):
- the preferred worker, if present and it satisfies
needs; - otherwise the first registered worker that satisfies
needs.
Sourcepub fn resolve_for(
&self,
needs: &[Capability],
prefer: Option<&str>,
needs_tools: bool,
) -> Option<(Arc<dyn Worker>, bool)>
pub fn resolve_for( &self, needs: &[Capability], prefer: Option<&str>, needs_tools: bool, ) -> Option<(Arc<dyn Worker>, bool)>
Resolve a worker for a node, accounting for whether it attaches MCP tools
(MCP_SKILLS.md §6 tool-aware routing). Returns the worker and whether it
can actually serve those tools.
When needs_tools, a tool-capable worker (API host loop or a provisioning
harness) is preferred over one that can’t serve the tools — even over the
prefer hint, since silently dropping a node’s tools is worse than
overriding a soft preference. Only when no capable worker satisfies needs
does it fall back to the plain resolution, with false so the caller can
narrate the degraded landing. With needs_tools == false this is exactly
[resolve], always true.
Sourcepub fn resolve_candidates(
&self,
needs: &[Capability],
prefer: Option<&str>,
needs_tools: bool,
) -> Vec<(Arc<dyn Worker>, bool)>
pub fn resolve_candidates( &self, needs: &[Capability], prefer: Option<&str>, needs_tools: bool, ) -> Vec<(Arc<dyn Worker>, bool)>
All compatible workers in dispatch order, used when a worker’s transport fails and the engine needs a fallback.
Trait Implementations§
Source§impl Clone for WorkerRegistry
impl Clone for WorkerRegistry
Source§fn clone(&self) -> WorkerRegistry
fn clone(&self) -> WorkerRegistry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more