Skip to main content

Module component_factory

Module component_factory 

Source
Expand description

Adapters that wrap existing runtime traits as Components.

behest has many long-lived trait abstractions (ChatProvider, SessionStore, etc.) that predate the Component trait. To make them composable with the ComponentRegistry without forcing every existing implementation to provide a Component::init method, this module provides ready-made wrapper factories that take an already-constructed Arc<T> and expose it as a registered component.

These wrappers are the canonical M3 deliverable: the existing trait surface stays unchanged, while the runtime becomes composable on top.

§Example

use std::sync::Arc;
use behest_runtime::component_factory::ChatProviderComponent;
use behest_runtime::registry::ComponentRegistry;

// Caller-supplied provider, pre-constructed:
let provider: Arc<dyn behest_provider::ChatProvider> = todo!();
let factory = ChatProviderComponent::new("primary", provider);
// ... register with ComponentRegistry via register_factory().

Structs§

ChatProviderAny
AnyComponent adapter for ChatProviderComponent.
ChatProviderComponent
A Component that wraps an existing ChatProvider.
ChatProviderFactory
Factory for ChatProviderComponent that takes a pre-built Arc<dyn ChatProvider> and registers it under the given name.
EmbeddingProviderAny
AnyComponent adapter for EmbeddingProviderComponent.
EmbeddingProviderComponent
A Component that wraps an existing EmbeddingProvider.
EmbeddingProviderFactory
Factory for EmbeddingProviderComponent.
EmptyConfig
Configuration for a chat provider component wrapper. Currently unused; the wrapper takes a pre-constructed provider. Exists to satisfy the Component::Config bound so the wrapper can be registered in a ComponentRegistry.
WrapperError
Error type for wrapper components: lifecycle errors only, since the wrapped provider was constructed externally.

Type Aliases§

FactoryError
Convenience: re-export a name-keyed error so callers don’t have to import ExtensionError separately.