refactor: remove redundant meta_name field and simplify default outputs
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
@@ -16,7 +16,6 @@ impl BinaryMetaPlugin {
|
|||||||
outputs: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
outputs: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||||
) -> BinaryMetaPlugin {
|
) -> BinaryMetaPlugin {
|
||||||
let mut base = crate::meta_plugin::BaseMetaPlugin::new();
|
let mut base = crate::meta_plugin::BaseMetaPlugin::new();
|
||||||
base.meta_name = "binary".to_string();
|
|
||||||
|
|
||||||
// Initialize with helper function
|
// Initialize with helper function
|
||||||
base.initialize_plugin(
|
base.initialize_plugin(
|
||||||
@@ -138,9 +137,6 @@ impl MetaPlugin for BinaryMetaPlugin {
|
|||||||
self.base.outputs_mut()
|
self.base.outputs_mut()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn default_outputs(&self) -> Vec<String> {
|
|
||||||
vec!["binary".to_string()]
|
|
||||||
}
|
|
||||||
|
|
||||||
fn options(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
fn options(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
self.base.options()
|
self.base.options()
|
||||||
|
|||||||
@@ -111,9 +111,6 @@ impl MetaPlugin for CwdMetaPlugin {
|
|||||||
self.base.outputs_mut()
|
self.base.outputs_mut()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn default_outputs(&self) -> Vec<String> {
|
|
||||||
vec!["cwd".to_string()]
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
fn options(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
fn options(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
|
|||||||
@@ -128,9 +128,6 @@ impl MetaPlugin for KeepPidMetaPlugin {
|
|||||||
&mut self.outputs
|
&mut self.outputs
|
||||||
}
|
}
|
||||||
|
|
||||||
fn default_outputs(&self) -> Vec<String> {
|
|
||||||
vec!["keep_pid".to_string()]
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
fn options(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
fn options(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ pub struct MetaPluginResponse {
|
|||||||
pub struct BaseMetaPlugin {
|
pub struct BaseMetaPlugin {
|
||||||
pub outputs: std::collections::HashMap<String, serde_yaml::Value>,
|
pub outputs: std::collections::HashMap<String, serde_yaml::Value>,
|
||||||
pub options: std::collections::HashMap<String, serde_yaml::Value>,
|
pub options: std::collections::HashMap<String, serde_yaml::Value>,
|
||||||
pub meta_name: String,
|
|
||||||
pub is_finalized: bool,
|
pub is_finalized: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,10 +95,6 @@ impl BaseMetaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl MetaPlugin for BaseMetaPlugin {
|
impl MetaPlugin for BaseMetaPlugin {
|
||||||
fn meta_name(&self) -> String {
|
|
||||||
self.meta_name.clone()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
fn outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
&self.outputs
|
&self.outputs
|
||||||
}
|
}
|
||||||
@@ -187,11 +182,6 @@ pub fn process_metadata_outputs(internal_name: &str, value: serde_yaml::Value, o
|
|||||||
pub trait MetaPlugin where Self: 'static {
|
pub trait MetaPlugin where Self: 'static {
|
||||||
fn meta_type(&self) -> MetaPluginType;
|
fn meta_type(&self) -> MetaPluginType;
|
||||||
|
|
||||||
// For backward compatibility, provide meta_name() that uses meta_type()
|
|
||||||
fn meta_name(&self) -> String {
|
|
||||||
self.meta_type().to_string()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn is_supported(&self) -> bool {
|
fn is_supported(&self) -> bool {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
@@ -267,8 +257,8 @@ pub trait MetaPlugin where Self: 'static {
|
|||||||
|
|
||||||
// Get the default output names this plugin can produce
|
// Get the default output names this plugin can produce
|
||||||
fn default_outputs(&self) -> Vec<String> {
|
fn default_outputs(&self) -> Vec<String> {
|
||||||
// Default implementation returns empty - plugins should override this
|
// Default implementation returns the meta type as a string
|
||||||
Vec::new()
|
vec![self.meta_type().to_string()]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -127,9 +127,6 @@ impl MetaPlugin for ReadRateMetaPlugin {
|
|||||||
&mut self.outputs
|
&mut self.outputs
|
||||||
}
|
}
|
||||||
|
|
||||||
fn default_outputs(&self) -> Vec<String> {
|
|
||||||
vec!["read_rate".to_string()]
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
fn options(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
fn options(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
|
|||||||
@@ -120,9 +120,6 @@ impl MetaPlugin for ReadTimeMetaPlugin {
|
|||||||
&mut self.outputs
|
&mut self.outputs
|
||||||
}
|
}
|
||||||
|
|
||||||
fn default_outputs(&self) -> Vec<String> {
|
|
||||||
vec!["read_time".to_string()]
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
fn options(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
fn options(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
|
|||||||
@@ -131,9 +131,6 @@ impl MetaPlugin for ShellMetaPlugin {
|
|||||||
&mut self.outputs
|
&mut self.outputs
|
||||||
}
|
}
|
||||||
|
|
||||||
fn default_outputs(&self) -> Vec<String> {
|
|
||||||
vec!["shell".to_string()]
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
fn options(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
fn options(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
|
|||||||
@@ -132,9 +132,6 @@ impl MetaPlugin for ShellPidMetaPlugin {
|
|||||||
&mut self.outputs
|
&mut self.outputs
|
||||||
}
|
}
|
||||||
|
|
||||||
fn default_outputs(&self) -> Vec<String> {
|
|
||||||
vec!["shell_pid".to_string()]
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
fn options(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
fn options(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ impl TextMetaPlugin {
|
|||||||
outputs: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
outputs: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||||
) -> TextMetaPlugin {
|
) -> TextMetaPlugin {
|
||||||
let mut base = crate::meta_plugin::BaseMetaPlugin::new();
|
let mut base = crate::meta_plugin::BaseMetaPlugin::new();
|
||||||
base.meta_name = "text".to_string();
|
|
||||||
|
|
||||||
// Initialize with helper function
|
// Initialize with helper function
|
||||||
base.initialize_plugin(
|
base.initialize_plugin(
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ impl UserMetaPlugin {
|
|||||||
outputs: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
outputs: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||||
) -> UserMetaPlugin {
|
) -> UserMetaPlugin {
|
||||||
let mut base = crate::meta_plugin::BaseMetaPlugin::new();
|
let mut base = crate::meta_plugin::BaseMetaPlugin::new();
|
||||||
base.meta_name = "user".to_string();
|
|
||||||
|
|
||||||
// Initialize with helper function
|
// Initialize with helper function
|
||||||
base.initialize_plugin(
|
base.initialize_plugin(
|
||||||
|
|||||||
Reference in New Issue
Block a user