feat: add options to meta plugins

Co-authored-by: aider (openai/andrew/openrouter/anthropic/claude-sonnet-4) <aider@aider.chat>
This commit is contained in:
Andrew Phillips
2025-08-19 14:18:59 -03:00
parent 107a1f3eb4
commit a3494ee831
6 changed files with 173 additions and 0 deletions

View File

@@ -11,6 +11,7 @@ pub struct DigestSha256MetaPlugin {
meta_name: String,
item_id: Option<i64>,
outputs: std::collections::HashMap<String, serde_yaml::Value>,
options: std::collections::HashMap<String, serde_yaml::Value>,
}
impl DigestSha256MetaPlugin {
@@ -35,6 +36,7 @@ impl DigestSha256MetaPlugin {
meta_name: "digest_sha256".to_string(),
item_id: None,
outputs: final_outputs,
options: final_options,
}
}
@@ -88,6 +90,14 @@ impl MetaPlugin for DigestSha256MetaPlugin {
fn default_options(&self) -> std::collections::HashMap<String, serde_yaml::Value> {
std::collections::HashMap::new()
}
fn options(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
&self.options
}
fn options_mut(&mut self) -> &mut std::collections::HashMap<String, serde_yaml::Value> {
&mut self.options
}
}
@@ -96,6 +106,7 @@ pub struct ReadTimeMetaPlugin {
start_time: Option<Instant>,
meta_name: String,
outputs: std::collections::HashMap<String, serde_yaml::Value>,
options: std::collections::HashMap<String, serde_yaml::Value>,
}
impl ReadTimeMetaPlugin {
@@ -119,6 +130,7 @@ impl ReadTimeMetaPlugin {
start_time: None,
meta_name: "read_time".to_string(),
outputs: final_outputs,
options: final_options,
}
}
@@ -161,6 +173,14 @@ impl MetaPlugin for ReadTimeMetaPlugin {
fn default_options(&self) -> std::collections::HashMap<String, serde_yaml::Value> {
std::collections::HashMap::new()
}
fn options(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
&self.options
}
fn options_mut(&mut self) -> &mut std::collections::HashMap<String, serde_yaml::Value> {
&mut self.options
}
}
#[derive(Debug, Clone, Default)]
@@ -169,6 +189,7 @@ pub struct ReadRateMetaPlugin {
bytes_read: u64,
meta_name: String,
outputs: std::collections::HashMap<String, serde_yaml::Value>,
options: std::collections::HashMap<String, serde_yaml::Value>,
}
impl ReadRateMetaPlugin {
@@ -193,6 +214,7 @@ impl ReadRateMetaPlugin {
bytes_read: 0,
meta_name: "read_rate".to_string(),
outputs: final_outputs,
options: final_options,
}
}
@@ -236,4 +258,12 @@ impl MetaPlugin for ReadRateMetaPlugin {
fn default_options(&self) -> std::collections::HashMap<String, serde_yaml::Value> {
std::collections::HashMap::new()
}
fn options(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
&self.options
}
fn options_mut(&mut self) -> &mut std::collections::HashMap<String, serde_yaml::Value> {
&mut self.options
}
}