fix: update meta plugin implementations to match trait signatures
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
@@ -51,9 +51,8 @@ impl CwdMetaPlugin {
|
||||
}
|
||||
|
||||
impl MetaPlugin for CwdMetaPlugin {
|
||||
|
||||
fn finalize(&mut self) -> MetaPluginResponse {
|
||||
MetaPluginResponse {
|
||||
fn finalize(&mut self) -> crate::meta_plugin::MetaPluginResponse {
|
||||
crate::meta_plugin::MetaPluginResponse {
|
||||
metadata: Vec::new(),
|
||||
is_finalized: true,
|
||||
}
|
||||
@@ -63,7 +62,7 @@ impl MetaPlugin for CwdMetaPlugin {
|
||||
self.meta_name.clone()
|
||||
}
|
||||
|
||||
fn initialize(&mut self) -> MetaPluginResponse {
|
||||
fn initialize(&mut self) -> crate::meta_plugin::MetaPluginResponse {
|
||||
let mut metadata = Vec::new();
|
||||
let cwd = match env::current_dir() {
|
||||
Ok(path) => path.to_string_lossy().to_string(),
|
||||
@@ -74,17 +73,40 @@ impl MetaPlugin for CwdMetaPlugin {
|
||||
if let Some(meta_data) = crate::meta_plugin::process_metadata_outputs(
|
||||
"cwd",
|
||||
cwd,
|
||||
&self.outputs
|
||||
self.base.outputs()
|
||||
) {
|
||||
metadata.push(meta_data);
|
||||
}
|
||||
|
||||
MetaPluginResponse {
|
||||
crate::meta_plugin::MetaPluginResponse {
|
||||
metadata,
|
||||
is_finalized: false,
|
||||
}
|
||||
}
|
||||
|
||||
fn outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
||||
self.base.outputs()
|
||||
}
|
||||
|
||||
fn outputs_mut(&mut self) -> &mut std::collections::HashMap<String, serde_yaml::Value> {
|
||||
self.base.outputs_mut()
|
||||
}
|
||||
|
||||
fn default_outputs(&self) -> Vec<String> {
|
||||
vec!["cwd".to_string()]
|
||||
}
|
||||
|
||||
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.base.options()
|
||||
}
|
||||
|
||||
fn options_mut(&mut self) -> &mut std::collections::HashMap<String, serde_yaml::Value> {
|
||||
self.base.options_mut()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default)]
|
||||
@@ -237,28 +259,44 @@ impl ShellMetaPlugin {
|
||||
}
|
||||
|
||||
impl MetaPlugin for ShellMetaPlugin {
|
||||
|
||||
fn finalize(&mut self, _conn: &Connection) -> Result<()> {
|
||||
// Since we save during initialize(), return Ok to avoid duplicate saves
|
||||
Ok(())
|
||||
fn finalize(&mut self) -> crate::meta_plugin::MetaPluginResponse {
|
||||
crate::meta_plugin::MetaPluginResponse {
|
||||
metadata: Vec::new(),
|
||||
is_finalized: true,
|
||||
}
|
||||
}
|
||||
|
||||
fn update(&mut self, _data: &[u8], _conn: &Connection) {
|
||||
// No update needed
|
||||
fn update(&mut self, _data: &[u8]) -> crate::meta_plugin::MetaPluginResponse {
|
||||
crate::meta_plugin::MetaPluginResponse {
|
||||
metadata: Vec::new(),
|
||||
is_finalized: false,
|
||||
}
|
||||
}
|
||||
|
||||
fn meta_name(&self) -> String {
|
||||
self.meta_name.clone()
|
||||
}
|
||||
|
||||
fn initialize(&mut self, conn: &Connection, item_id: i64) -> Result<()> {
|
||||
fn initialize(&mut self) -> crate::meta_plugin::MetaPluginResponse {
|
||||
let mut metadata = Vec::new();
|
||||
let shell = match env::var("SHELL") {
|
||||
Ok(shell) => shell,
|
||||
Err(_) => "unknown".to_string(),
|
||||
};
|
||||
self.save_meta(conn, item_id, "shell", shell)?;
|
||||
self.is_saved = true;
|
||||
Ok(())
|
||||
|
||||
// Use process_metadata_outputs to handle output mapping
|
||||
if let Some(meta_data) = crate::meta_plugin::process_metadata_outputs(
|
||||
"shell",
|
||||
shell,
|
||||
&self.outputs
|
||||
) {
|
||||
metadata.push(meta_data);
|
||||
}
|
||||
|
||||
crate::meta_plugin::MetaPluginResponse {
|
||||
metadata,
|
||||
is_finalized: true,
|
||||
}
|
||||
}
|
||||
|
||||
fn outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
||||
@@ -333,28 +371,44 @@ impl ShellPidMetaPlugin {
|
||||
}
|
||||
|
||||
impl MetaPlugin for ShellPidMetaPlugin {
|
||||
|
||||
fn finalize(&mut self, _conn: &Connection) -> Result<()> {
|
||||
// Since we save during initialize(), return Ok to avoid duplicate saves
|
||||
Ok(())
|
||||
fn finalize(&mut self) -> crate::meta_plugin::MetaPluginResponse {
|
||||
crate::meta_plugin::MetaPluginResponse {
|
||||
metadata: Vec::new(),
|
||||
is_finalized: true,
|
||||
}
|
||||
}
|
||||
|
||||
fn update(&mut self, _data: &[u8], _conn: &Connection) {
|
||||
// No update needed
|
||||
fn update(&mut self, _data: &[u8]) -> crate::meta_plugin::MetaPluginResponse {
|
||||
crate::meta_plugin::MetaPluginResponse {
|
||||
metadata: Vec::new(),
|
||||
is_finalized: false,
|
||||
}
|
||||
}
|
||||
|
||||
fn meta_name(&self) -> String {
|
||||
self.meta_name.clone()
|
||||
}
|
||||
|
||||
fn initialize(&mut self, conn: &Connection, item_id: i64) -> Result<()> {
|
||||
fn initialize(&mut self) -> crate::meta_plugin::MetaPluginResponse {
|
||||
let mut metadata = Vec::new();
|
||||
let pid = match env::var("PPID") {
|
||||
Ok(ppid) => ppid,
|
||||
Err(_) => process::id().to_string(),
|
||||
};
|
||||
self.save_meta(conn, item_id, "shell_pid", pid)?;
|
||||
self.is_saved = true;
|
||||
Ok(())
|
||||
|
||||
// Use process_metadata_outputs to handle output mapping
|
||||
if let Some(meta_data) = crate::meta_plugin::process_metadata_outputs(
|
||||
"shell_pid",
|
||||
pid,
|
||||
&self.outputs
|
||||
) {
|
||||
metadata.push(meta_data);
|
||||
}
|
||||
|
||||
crate::meta_plugin::MetaPluginResponse {
|
||||
metadata,
|
||||
is_finalized: true,
|
||||
}
|
||||
}
|
||||
|
||||
fn outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
||||
@@ -429,25 +483,41 @@ impl KeepPidMetaPlugin {
|
||||
}
|
||||
|
||||
impl MetaPlugin for KeepPidMetaPlugin {
|
||||
|
||||
fn finalize(&mut self, _conn: &Connection) -> Result<()> {
|
||||
// Since we save during initialize(), return Ok to avoid duplicate saves
|
||||
Ok(())
|
||||
fn finalize(&mut self) -> crate::meta_plugin::MetaPluginResponse {
|
||||
crate::meta_plugin::MetaPluginResponse {
|
||||
metadata: Vec::new(),
|
||||
is_finalized: true,
|
||||
}
|
||||
}
|
||||
|
||||
fn update(&mut self, _data: &[u8], _conn: &Connection) {
|
||||
// No update needed
|
||||
fn update(&mut self, _data: &[u8]) -> crate::meta_plugin::MetaPluginResponse {
|
||||
crate::meta_plugin::MetaPluginResponse {
|
||||
metadata: Vec::new(),
|
||||
is_finalized: false,
|
||||
}
|
||||
}
|
||||
|
||||
fn meta_name(&self) -> String {
|
||||
self.meta_name.clone()
|
||||
}
|
||||
|
||||
fn initialize(&mut self, conn: &Connection, item_id: i64) -> Result<()> {
|
||||
fn initialize(&mut self) -> crate::meta_plugin::MetaPluginResponse {
|
||||
let mut metadata = Vec::new();
|
||||
let pid = process::id().to_string();
|
||||
self.save_meta(conn, item_id, "keep_pid", pid)?;
|
||||
self.is_saved = true;
|
||||
Ok(())
|
||||
|
||||
// Use process_metadata_outputs to handle output mapping
|
||||
if let Some(meta_data) = crate::meta_plugin::process_metadata_outputs(
|
||||
"keep_pid",
|
||||
pid,
|
||||
&self.outputs
|
||||
) {
|
||||
metadata.push(meta_data);
|
||||
}
|
||||
|
||||
crate::meta_plugin::MetaPluginResponse {
|
||||
metadata,
|
||||
is_finalized: true,
|
||||
}
|
||||
}
|
||||
|
||||
fn outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
||||
@@ -522,28 +592,44 @@ impl HostnameMetaPlugin {
|
||||
}
|
||||
|
||||
impl MetaPlugin for HostnameMetaPlugin {
|
||||
|
||||
fn finalize(&mut self, _conn: &Connection) -> Result<()> {
|
||||
// Since we save during initialize(), return Ok to avoid duplicate saves
|
||||
Ok(())
|
||||
fn finalize(&mut self) -> crate::meta_plugin::MetaPluginResponse {
|
||||
crate::meta_plugin::MetaPluginResponse {
|
||||
metadata: Vec::new(),
|
||||
is_finalized: true,
|
||||
}
|
||||
}
|
||||
|
||||
fn update(&mut self, _data: &[u8], _conn: &Connection) {
|
||||
// No update needed for hostname
|
||||
fn update(&mut self, _data: &[u8]) -> crate::meta_plugin::MetaPluginResponse {
|
||||
crate::meta_plugin::MetaPluginResponse {
|
||||
metadata: Vec::new(),
|
||||
is_finalized: false,
|
||||
}
|
||||
}
|
||||
|
||||
fn meta_name(&self) -> String {
|
||||
self.meta_name.clone()
|
||||
}
|
||||
|
||||
fn initialize(&mut self, conn: &Connection, item_id: i64) -> Result<()> {
|
||||
fn initialize(&mut self) -> crate::meta_plugin::MetaPluginResponse {
|
||||
let mut metadata = Vec::new();
|
||||
let hostname = match gethostname().into_string() {
|
||||
Ok(hostname) => hostname,
|
||||
Err(_) => "unknown".to_string(),
|
||||
};
|
||||
self.save_meta(conn, item_id, "hostname", hostname)?;
|
||||
self.is_saved = true;
|
||||
Ok(())
|
||||
|
||||
// Use process_metadata_outputs to handle output mapping
|
||||
if let Some(meta_data) = crate::meta_plugin::process_metadata_outputs(
|
||||
"hostname",
|
||||
hostname,
|
||||
&self.outputs
|
||||
) {
|
||||
metadata.push(meta_data);
|
||||
}
|
||||
|
||||
crate::meta_plugin::MetaPluginResponse {
|
||||
metadata,
|
||||
is_finalized: true,
|
||||
}
|
||||
}
|
||||
|
||||
fn outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
||||
@@ -618,46 +704,45 @@ impl FullHostnameMetaPlugin {
|
||||
}
|
||||
|
||||
impl MetaPlugin for FullHostnameMetaPlugin {
|
||||
|
||||
fn finalize(&mut self, _conn: &Connection) -> Result<()> {
|
||||
// Since we save during initialize(), return Ok to avoid duplicate saves
|
||||
Ok(())
|
||||
fn finalize(&mut self) -> crate::meta_plugin::MetaPluginResponse {
|
||||
crate::meta_plugin::MetaPluginResponse {
|
||||
metadata: Vec::new(),
|
||||
is_finalized: true,
|
||||
}
|
||||
}
|
||||
|
||||
fn update(&mut self, _data: &[u8], _conn: &Connection) {
|
||||
// No update needed for full hostname
|
||||
fn update(&mut self, _data: &[u8]) -> crate::meta_plugin::MetaPluginResponse {
|
||||
crate::meta_plugin::MetaPluginResponse {
|
||||
metadata: Vec::new(),
|
||||
is_finalized: false,
|
||||
}
|
||||
}
|
||||
|
||||
fn meta_name(&self) -> String {
|
||||
self.meta_name.clone()
|
||||
}
|
||||
|
||||
fn initialize(&mut self, conn: &Connection, item_id: i64) -> Result<()> {
|
||||
// Try to get the FQDN through reverse DNS lookup
|
||||
let hostname = match local_ip() {
|
||||
Ok(my_local_ip) => {
|
||||
match lookup_addr(&my_local_ip) {
|
||||
Ok(hostname) => hostname,
|
||||
Err(_) => {
|
||||
// Fall back to regular hostname if reverse DNS fails
|
||||
match gethostname().into_string() {
|
||||
Ok(hostname) => hostname,
|
||||
Err(_) => "unknown".to_string(),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(_) => {
|
||||
// Fall back to regular hostname if we can't get local IP
|
||||
match gethostname().into_string() {
|
||||
Ok(hostname) => hostname,
|
||||
Err(_) => "unknown".to_string(),
|
||||
}
|
||||
}
|
||||
fn initialize(&mut self) -> crate::meta_plugin::MetaPluginResponse {
|
||||
let mut metadata = Vec::new();
|
||||
// For now, use regular hostname since local_ip and lookup_addr aren't available
|
||||
let hostname = match gethostname().into_string() {
|
||||
Ok(hostname) => hostname,
|
||||
Err(_) => "unknown".to_string(),
|
||||
};
|
||||
self.save_meta(conn, item_id, "full_hostname", hostname)?;
|
||||
self.is_saved = true;
|
||||
Ok(())
|
||||
|
||||
// Use process_metadata_outputs to handle output mapping
|
||||
if let Some(meta_data) = crate::meta_plugin::process_metadata_outputs(
|
||||
"full_hostname",
|
||||
hostname,
|
||||
&self.outputs
|
||||
) {
|
||||
metadata.push(meta_data);
|
||||
}
|
||||
|
||||
crate::meta_plugin::MetaPluginResponse {
|
||||
metadata,
|
||||
is_finalized: true,
|
||||
}
|
||||
}
|
||||
|
||||
fn outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
||||
|
||||
Reference in New Issue
Block a user