pub struct HandlerRegistry { /* private fields */ }Expand description
Registry of named handlers and agents for pipeline execution.
Implementations§
Source§impl HandlerRegistry
impl HandlerRegistry
pub fn new() -> Self
Sourcepub fn register_metadata(&mut self, meta: HandlerMetadata)
pub fn register_metadata(&mut self, meta: HandlerMetadata)
Register handler metadata for validation and introspection.
Sourcepub fn get_metadata(&self, name: &str) -> Option<&HandlerMetadata>
pub fn get_metadata(&self, name: &str) -> Option<&HandlerMetadata>
Look up metadata for a registered handler by name.
Sourcepub fn handler<F, Fut>(&mut self, name: impl Into<String>, f: F)
pub fn handler<F, Fut>(&mut self, name: impl Into<String>, f: F)
Register a handler that returns HandlerOutput directly.
Use this when the handler needs to control confidence. The returned
HandlerOutput may carry confidence: Some(f32) or confidence: None.
When confidence is None, {{ steps.<name>.confidence }} in templates
will return an ExprError::NoConfidence error — it does NOT silently
resolve to 1.0. Only an explicit Some(score) is template-accessible.
Prefer handler_value when confidence is irrelevant.
Sourcepub fn handler_value<F, Fut>(&mut self, name: impl Into<String>, f: F)
pub fn handler_value<F, Fut>(&mut self, name: impl Into<String>, f: F)
Register a handler that returns a plain Value, without a confidence score.
Convenience wrapper over handler. The Value is auto-wrapped
via HandlerOutput::from(value), which sets confidence = None. Accessing
{{ steps.<name>.confidence }} in templates will fail with
ExprError::NoConfidence — handler_value steps cannot be used as input to
route_on_confidence.
Use this for handlers where confidence is not meaningful. Use
handler when the handler must emit a real confidence score.
Sourcepub fn handler_value_with_metadata<F, Fut>(
&mut self,
meta: HandlerMetadata,
f: F,
)
pub fn handler_value_with_metadata<F, Fut>( &mut self, meta: HandlerMetadata, f: F, )
Register a plain-value handler together with its HandlerMetadata.
Combines handler_value and
register_metadata in one call. The metadata
name is used as the handler name — the two must match.
Sourcepub fn agent<A>(&mut self, name: impl Into<String>)
pub fn agent<A>(&mut self, name: impl Into<String>)
Register a cruxx Agent by name for delegation.
The agent’s run method will be called with a fresh CruxCtx.
Sourcepub fn get_handler(&self, name: &str) -> Option<&BoxHandler>
pub fn get_handler(&self, name: &str) -> Option<&BoxHandler>
Look up a handler by name.
Sourcepub fn get_agent(&self, name: &str) -> Option<&BoxAgentRunner>
pub fn get_agent(&self, name: &str) -> Option<&BoxAgentRunner>
Look up an agent runner by name.