feat(core): register built-in providers in ProviderManager

Calculator and converter registered as built-in dynamic providers.
System registered as built-in static provider. All gated by config
toggles (calculator, converter, system — default true).
This commit is contained in:
2026-03-28 12:19:12 +01:00
parent 81626c33dd
commit c5f1f35167
2 changed files with 24 additions and 0 deletions

View File

@@ -162,6 +162,9 @@ pub struct ProvidersConfig {
/// Enable calculator provider (= expression or calc expression)
#[serde(default = "default_true")]
pub calculator: bool,
/// Enable converter provider (> expression or auto-detect)
#[serde(default = "default_true")]
pub converter: bool,
/// Enable frecency-based result ranking
#[serde(default = "default_true")]
pub frecency: bool,
@@ -239,6 +242,7 @@ impl Default for ProvidersConfig {
commands: true,
uuctl: true,
calculator: true,
converter: true,
frecency: true,
frecency_weight: 0.3,
websearch: true,

View File

@@ -295,7 +295,27 @@ impl ProviderManager {
core_providers.push(provider);
}
// Built-in dynamic providers
let mut builtin_dynamic: Vec<Box<dyn DynamicProvider>> = Vec::new();
if config.providers.calculator {
builtin_dynamic.push(Box::new(calculator::CalculatorProvider));
info!("Registered built-in calculator provider");
}
if config.providers.converter {
builtin_dynamic.push(Box::new(converter::ConverterProvider::new()));
info!("Registered built-in converter provider");
}
// Built-in static providers
if config.providers.system {
core_providers.push(Box::new(system::SystemProvider::new()));
info!("Registered built-in system provider");
}
let mut manager = Self::new(core_providers, native_providers);
manager.builtin_dynamic = builtin_dynamic;
manager.runtimes = runtimes;
manager.runtime_type_ids = runtime_type_ids;
manager