From d63c7d170bf4fe69e490b048804507d7f2e59f45 Mon Sep 17 00:00:00 2001 From: vikingowl Date: Thu, 26 Mar 2026 18:37:33 +0100 Subject: [PATCH] fix: build Rune provider registrations from manifest [[providers]] declarations --- crates/owlry-rune/src/loader.rs | 16 ++++++++++++++-- crates/owlry-rune/src/manifest.rs | 22 ++++++++++++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/crates/owlry-rune/src/loader.rs b/crates/owlry-rune/src/loader.rs index ce7ab9d..b809e09 100644 --- a/crates/owlry-rune/src/loader.rs +++ b/crates/owlry-rune/src/loader.rs @@ -59,8 +59,20 @@ impl LoadedPlugin { } } - // Collect registrations - let registrations = api::get_registrations(); + // Collect registrations — from runtime API or from manifest [[providers]] + let mut registrations = api::get_registrations(); + if registrations.is_empty() && !manifest.providers.is_empty() { + for decl in &manifest.providers { + registrations.push(ProviderRegistration { + name: decl.id.clone(), + display_name: decl.name.clone(), + type_id: decl.type_id.clone().unwrap_or_else(|| decl.id.clone()), + default_icon: decl.icon.clone().unwrap_or_else(|| "application-x-addon".to_string()), + is_static: decl.provider_type != "dynamic", + prefix: decl.prefix.clone(), + }); + } + } log::info!( "Loaded Rune plugin '{}' with {} provider(s)", diff --git a/crates/owlry-rune/src/manifest.rs b/crates/owlry-rune/src/manifest.rs index 04516e4..bfc3f1e 100644 --- a/crates/owlry-rune/src/manifest.rs +++ b/crates/owlry-rune/src/manifest.rs @@ -11,6 +11,28 @@ pub struct PluginManifest { pub provides: PluginProvides, #[serde(default)] pub permissions: PluginPermissions, + /// Provider declarations from [[providers]] sections + #[serde(default)] + pub providers: Vec, +} + +/// A provider declared in [[providers]] section of plugin.toml +#[derive(Debug, Clone, Deserialize)] +pub struct ProviderDecl { + pub id: String, + pub name: String, + #[serde(default)] + pub prefix: Option, + #[serde(default)] + pub icon: Option, + #[serde(default = "default_provider_type", rename = "type")] + pub provider_type: String, + #[serde(default)] + pub type_id: Option, +} + +fn default_provider_type() -> String { + "static".to_string() } /// Core plugin information