fix: build Rune provider registrations from manifest [[providers]] declarations

This commit is contained in:
2026-03-26 18:37:33 +01:00
parent 5f14ed2b3b
commit d63c7d170b
2 changed files with 36 additions and 2 deletions

View File

@@ -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)",

View File

@@ -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<ProviderDecl>,
}
/// 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<String>,
#[serde(default)]
pub icon: Option<String>,
#[serde(default = "default_provider_type", rename = "type")]
pub provider_type: String,
#[serde(default)]
pub type_id: Option<String>,
}
fn default_provider_type() -> String {
"static".to_string()
}
/// Core plugin information