feat: add MetaPlugin.configure method and update status generation
Co-authored-by: aider (openai/andrew/openrouter/qwen/qwen3-coder) <aider@aider.chat>
This commit is contained in:
@@ -8,6 +8,7 @@ use crate::compression_engine::CompressionType;
|
|||||||
use crate::compression_engine::program::CompressionEngineProgram;
|
use crate::compression_engine::program::CompressionEngineProgram;
|
||||||
use crate::meta_plugin::MetaPluginType;
|
use crate::meta_plugin::MetaPluginType;
|
||||||
use crate::meta_plugin;
|
use crate::meta_plugin;
|
||||||
|
use crate::config;
|
||||||
|
|
||||||
#[derive(serde::Serialize, serde::Deserialize, ToSchema)]
|
#[derive(serde::Serialize, serde::Deserialize, ToSchema)]
|
||||||
pub struct StatusInfo {
|
pub struct StatusInfo {
|
||||||
@@ -111,6 +112,16 @@ pub fn generate_status_info(
|
|||||||
// Plugin initialized successfully
|
// Plugin initialized successfully
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Configure plugin with settings if available
|
||||||
|
// Create a dummy settings object to get plugin configs
|
||||||
|
let dummy_settings = config::Settings::default();
|
||||||
|
if let Some(meta_plugin_configs) = &dummy_settings.meta_plugins {
|
||||||
|
if let Some(config) = meta_plugin_configs.iter().find(|c| c.name == meta_plugin.meta_name()) {
|
||||||
|
// Configure the plugin with options and outputs from config
|
||||||
|
let _ = meta_plugin.configure(&config.options, &config.outputs.iter().map(|(k, v)| (k.clone(), serde_yaml::Value::String(v.clone()))).collect());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let (binary_display, args_display) = if !is_supported {
|
let (binary_display, args_display) = if !is_supported {
|
||||||
("<NOT FOUND>".to_string(), "".to_string())
|
("<NOT FOUND>".to_string(), "".to_string())
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ pub trait MetaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Configure plugin with options (excluding outputs)
|
// Configure plugin with options (excluding outputs)
|
||||||
fn configure_options(&mut self, _options: &std::collections::HashMap<String, serde_yaml::Value>) -> Result<()> {
|
fn configure_options(&mut self, options: &std::collections::HashMap<String, serde_yaml::Value>) -> Result<()> {
|
||||||
// Default implementation does nothing - plugins can override this
|
// Default implementation does nothing - plugins can override this
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@@ -128,6 +128,13 @@ pub trait MetaPlugin {
|
|||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Configure both options and outputs
|
||||||
|
fn configure(&mut self, options: &std::collections::HashMap<String, serde_yaml::Value>, outputs: &std::collections::HashMap<String, serde_yaml::Value>) -> Result<()> {
|
||||||
|
self.configure_options(options)?;
|
||||||
|
self.configure_outputs(outputs)?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_meta_plugin(meta_plugin_type: MetaPluginType) -> Box<dyn MetaPlugin> {
|
pub fn get_meta_plugin(meta_plugin_type: MetaPluginType) -> Box<dyn MetaPlugin> {
|
||||||
|
|||||||
Reference in New Issue
Block a user