diff --git a/src/agent/tools/memory.rs b/src/agent/tools/memory.rs index 4596e38..d50cf3d 100644 --- a/src/agent/tools/memory.rs +++ b/src/agent/tools/memory.rs @@ -179,7 +179,7 @@ macro_rules! memory_tool { #[allow(unused_mut)] let mut map = serde_json::Map::new(); $($(memory_tool!(@insert_json map, $arg, $($typ)+);)*)? - return crate::mcp_server::memory_rpc(concat!("memory_", stringify!($name)), serde_json::Value::Object(map)); + return crate::mcp_server::memory_rpc(stringify!($name), serde_json::Value::Object(map)); } let prov = match agent { Some(a) => a.state.lock().await.provenance.clone(), @@ -208,7 +208,7 @@ macro_rules! memory_tool { #[allow(unused_mut)] let mut map = serde_json::Map::new(); $($(memory_tool!(@insert_json map, $arg, $($typ)+);)*)? - return crate::mcp_server::memory_rpc(concat!("memory_", stringify!($name)), serde_json::Value::Object(map)); + return crate::mcp_server::memory_rpc(stringify!($name), serde_json::Value::Object(map)); } let prov = match agent { Some(a) => a.state.lock().await.provenance.clone(), @@ -224,18 +224,18 @@ macro_rules! memory_tool { // ── Memory tools ─────────────────────────────────────────────── -memory_tool!(render, ref, key: [str], raw: [Option]); -memory_tool!(write, mut, key: [str], content: [str]); -memory_tool!(search, ref, keys: [Vec], max_hops: [Option], edge_decay: [Option], min_activation: [Option], limit: [Option]); -memory_tool!(links, ref, key: [str]); -memory_tool!(link_set, mut, source: [str], target: [str], strength: [f32]); -memory_tool!(link_add, mut, source: [str], target: [str]); -memory_tool!(delete, mut, key: [str]); -memory_tool!(history, ref, key: [str], full: [Option]); -memory_tool!(weight_set, mut, key: [str], weight: [f32]); -memory_tool!(rename, mut, old_key: [str], new_key: [str]); -memory_tool!(supersede, mut, old_key: [str], new_key: [str], reason: [Option<&str>]); -memory_tool!(query, ref, query: [str], format: [Option<&str>]); +memory_tool!(memory_render, ref, key: [str], raw: [Option]); +memory_tool!(memory_write, mut, key: [str], content: [str]); +memory_tool!(memory_search, ref, keys: [Vec], max_hops: [Option], edge_decay: [Option], min_activation: [Option], limit: [Option]); +memory_tool!(memory_links, ref, key: [str]); +memory_tool!(memory_link_set, mut, source: [str], target: [str], strength: [f32]); +memory_tool!(memory_link_add, mut, source: [str], target: [str]); +memory_tool!(memory_delete, mut, key: [str]); +memory_tool!(memory_history, ref, key: [str], full: [Option]); +memory_tool!(memory_weight_set, mut, key: [str], weight: [f32]); +memory_tool!(memory_rename, mut, old_key: [str], new_key: [str]); +memory_tool!(memory_supersede, mut, old_key: [str], new_key: [str], reason: [Option<&str>]); +memory_tool!(memory_query, ref, query: [str], format: [Option<&str>]); // ── Journal tools ────────────────────────────────────────────── @@ -276,18 +276,18 @@ async fn dispatch( // Daemon path - dispatch to implementation match tool_name { - "memory_render" => jsonargs_render(&args).await, - "memory_write" => jsonargs_write(&args).await, - "memory_search" => jsonargs_search(&args).await, - "memory_links" => jsonargs_links(&args).await, - "memory_link_set" => jsonargs_link_set(&args).await, - "memory_link_add" => jsonargs_link_add(&args).await, - "memory_delete" => jsonargs_delete(&args).await, - "memory_history" => jsonargs_history(&args).await, - "memory_weight_set" => jsonargs_weight_set(&args).await, - "memory_rename" => jsonargs_rename(&args).await, - "memory_supersede" => jsonargs_supersede(&args).await, - "memory_query" => jsonargs_query(&args).await, + "memory_render" => jsonargs_memory_render(&args).await, + "memory_write" => jsonargs_memory_write(&args).await, + "memory_search" => jsonargs_memory_search(&args).await, + "memory_links" => jsonargs_memory_links(&args).await, + "memory_link_set" => jsonargs_memory_link_set(&args).await, + "memory_link_add" => jsonargs_memory_link_add(&args).await, + "memory_delete" => jsonargs_memory_delete(&args).await, + "memory_history" => jsonargs_memory_history(&args).await, + "memory_weight_set" => jsonargs_memory_weight_set(&args).await, + "memory_rename" => jsonargs_memory_rename(&args).await, + "memory_supersede" => jsonargs_memory_supersede(&args).await, + "memory_query" => jsonargs_memory_query(&args).await, "graph_topology" => jsonargs_graph_topology(&args).await, "graph_health" => jsonargs_graph_health(&args).await, "graph_communities" => jsonargs_graph_communities(&args).await, diff --git a/src/cli/admin.rs b/src/cli/admin.rs index 2c48ca6..03bd3b6 100644 --- a/src/cli/admin.rs +++ b/src/cli/admin.rs @@ -328,20 +328,18 @@ pub fn cmd_dedup(apply: bool) -> Result<(), String> { Ok(()) } -pub fn cmd_health() -> Result<(), String> { - let result = crate::mcp_server::memory_rpc( - "graph_health", - serde_json::json!({}), - ).map_err(|e| e.to_string())?; +pub async fn cmd_health() -> Result<(), String> { + use crate::agent::tools::memory; + let result = memory::graph_health(None).await + .map_err(|e| e.to_string())?; print!("{}", result); Ok(()) } -pub fn cmd_topology() -> Result<(), String> { - let result = crate::mcp_server::memory_rpc( - "graph_topology", - serde_json::json!({}), - ).map_err(|e| e.to_string())?; +pub async fn cmd_topology() -> Result<(), String> { + use crate::agent::tools::memory; + let result = memory::graph_topology(None).await + .map_err(|e| e.to_string())?; print!("{}", result); Ok(()) } @@ -422,11 +420,10 @@ pub fn cmd_export(files: &[String], export_all: bool) -> Result<(), String> { Ok(()) } -pub fn cmd_status() -> Result<(), String> { - let result = crate::mcp_server::memory_rpc( - "graph_topology", - serde_json::json!({}), - ).map_err(|e| e.to_string())?; +pub async fn cmd_status() -> Result<(), String> { + use crate::agent::tools::memory; + let result = memory::graph_topology(None).await + .map_err(|e| e.to_string())?; print!("{}", result); Ok(()) } diff --git a/src/cli/graph.rs b/src/cli/graph.rs index 99a3f96..d8d667e 100644 --- a/src/cli/graph.rs +++ b/src/cli/graph.rs @@ -4,6 +4,7 @@ // link, link-add, link-impact, link-audit, cap-degree, // normalize-strengths, trace, spectral-*, organize, communities. +use crate::agent::tools::memory; use crate::store; pub fn cmd_cap_degree(max_deg: usize) -> Result<(), String> { @@ -14,67 +15,55 @@ pub fn cmd_cap_degree(max_deg: usize) -> Result<(), String> { Ok(()) } -pub fn cmd_normalize_strengths(apply: bool) -> Result<(), String> { +pub async fn cmd_normalize_strengths(apply: bool) -> Result<(), String> { if apply { super::check_dry_run(); } - let result = crate::mcp_server::memory_rpc( - "graph_normalize_strengths", - serde_json::json!({"apply": apply}), - ).map_err(|e| e.to_string())?; + let result = memory::graph_normalize_strengths(None, Some(apply)).await + .map_err(|e| e.to_string())?; print!("{}", result); Ok(()) } -pub fn cmd_link(key: &[String]) -> Result<(), String> { +pub async fn cmd_link(key: &[String]) -> Result<(), String> { if key.is_empty() { return Err("link requires a key".into()); } let key = key.join(" "); - let result = crate::mcp_server::memory_rpc( - "memory_links", - serde_json::json!({"key": key}), - ).map_err(|e| e.to_string())?; + let result = memory::memory_links(None, &key).await + .map_err(|e| e.to_string())?; print!("{}", result); Ok(()) } -pub fn cmd_link_add(source: &str, target: &str, _reason: &[String]) -> Result<(), String> { +pub async fn cmd_link_add(source: &str, target: &str, _reason: &[String]) -> Result<(), String> { super::check_dry_run(); - let result = crate::mcp_server::memory_rpc( - "memory_link_add", - serde_json::json!({"source": source, "target": target}), - ).map_err(|e| e.to_string())?; + let result = memory::memory_link_add(None, source, target).await + .map_err(|e| e.to_string())?; println!("{}", result); Ok(()) } -pub fn cmd_link_set(source: &str, target: &str, strength: f32) -> Result<(), String> { +pub async fn cmd_link_set(source: &str, target: &str, strength: f32) -> Result<(), String> { super::check_dry_run(); - let result = crate::mcp_server::memory_rpc( - "memory_link_set", - serde_json::json!({"source": source, "target": target, "strength": strength}), - ).map_err(|e| e.to_string())?; + let result = memory::memory_link_set(None, source, target, strength).await + .map_err(|e| e.to_string())?; println!("{}", result); Ok(()) } -pub fn cmd_link_impact(source: &str, target: &str) -> Result<(), String> { - let result = crate::mcp_server::memory_rpc( - "graph_link_impact", - serde_json::json!({"source": source, "target": target}), - ).map_err(|e| e.to_string())?; +pub async fn cmd_link_impact(source: &str, target: &str) -> Result<(), String> { + let result = memory::graph_link_impact(None, source, target).await + .map_err(|e| e.to_string())?; print!("{}", result); Ok(()) } -pub fn cmd_trace(key: &[String]) -> Result<(), String> { +pub async fn cmd_trace(key: &[String]) -> Result<(), String> { if key.is_empty() { return Err("trace requires a key".into()); } let key = key.join(" "); - let result = crate::mcp_server::memory_rpc( - "graph_trace", - serde_json::json!({"key": key}), - ).map_err(|e| e.to_string())?; + let result = memory::graph_trace(None, &key).await + .map_err(|e| e.to_string())?; print!("{}", result); Ok(()) } @@ -82,11 +71,9 @@ pub fn cmd_trace(key: &[String]) -> Result<(), String> { /// Show communities sorted by isolation (most isolated first). /// Useful for finding poorly-integrated knowledge clusters that need /// organize agents aimed at them. -pub fn cmd_communities(top_n: usize, min_size: usize) -> Result<(), String> { - let result = crate::mcp_server::memory_rpc( - "graph_communities", - serde_json::json!({"top_n": top_n, "min_size": min_size}), - ).map_err(|e| e.to_string())?; +pub async fn cmd_communities(top_n: usize, min_size: usize) -> Result<(), String> { + let result = memory::graph_communities(None, Some(top_n), Some(min_size)).await + .map_err(|e| e.to_string())?; print!("{}", result); Ok(()) } diff --git a/src/cli/journal.rs b/src/cli/journal.rs index f8772c6..c1ec6fe 100644 --- a/src/cli/journal.rs +++ b/src/cli/journal.rs @@ -1,5 +1,6 @@ // cli/journal.rs — journal subcommand handlers +use crate::agent::tools::memory; pub fn cmd_tail(n: usize, full: bool, provenance: Option<&str>, dedup: bool) -> Result<(), String> { let path = crate::store::nodes_path(); @@ -66,32 +67,23 @@ pub fn cmd_tail(n: usize, full: bool, provenance: Option<&str>, dedup: bool) -> Ok(()) } -pub fn cmd_journal_tail(n: usize, full: bool, level: u8) -> Result<(), String> { - let format = if full { "full" } else { "compact" }; - let result = crate::mcp_server::memory_rpc( - "journal_tail", - serde_json::json!({"count": n, "level": level, "format": format}), - ).map_err(|e| e.to_string())?; +pub async fn cmd_journal_tail(n: usize, full: bool, level: u8) -> Result<(), String> { + let format = if full { Some("full") } else { Some("compact") }; + let result = memory::journal_tail(None, Some(n as u64), Some(level as u64), format, None).await + .map_err(|e| e.to_string())?; print!("{}", result); Ok(()) } -pub fn cmd_journal_write(name: &str, text: &[String]) -> Result<(), String> { +pub async fn cmd_journal_write(name: &str, text: &[String]) -> Result<(), String> { if text.is_empty() { return Err("journal write requires text".into()); } super::check_dry_run(); let body = text.join(" "); - let result = crate::mcp_server::memory_rpc( - "journal_new", - serde_json::json!({ - "name": name, - "title": name, - "body": body, - "level": 0 - }), - ).map_err(|e| e.to_string())?; + let result = memory::journal_new(None, name, name, &body, Some(0)).await + .map_err(|e| e.to_string())?; println!("{}", result); Ok(()) } diff --git a/src/cli/node.rs b/src/cli/node.rs index 7b4fcd5..2745041 100644 --- a/src/cli/node.rs +++ b/src/cli/node.rs @@ -8,7 +8,7 @@ use crate::store; pub async fn cmd_weight_set(key: &str, weight: f32) -> Result<(), String> { super::check_dry_run(); - let result = memory::weight_set(None, key, weight).await + let result = memory::memory_weight_set(None, key, weight).await .map_err(|e| e.to_string())?; println!("{}", result); Ok(()) @@ -20,7 +20,7 @@ pub async fn cmd_node_delete(key: &[String]) -> Result<(), String> { } super::check_dry_run(); let key = key.join(" "); - let result = memory::delete(None, &key).await + let result = memory::memory_delete(None, &key).await .map_err(|e| e.to_string())?; println!("{}", result); Ok(()) @@ -28,7 +28,7 @@ pub async fn cmd_node_delete(key: &[String]) -> Result<(), String> { pub async fn cmd_node_rename(old_key: &str, new_key: &str) -> Result<(), String> { super::check_dry_run(); - let result = memory::rename(None, old_key, new_key).await + let result = memory::memory_rename(None, old_key, new_key).await .map_err(|e| e.to_string())?; println!("{}", result); Ok(()) @@ -41,7 +41,7 @@ pub async fn cmd_render(key: &[String]) -> Result<(), String> { let key = key.join(" "); let bare = store::strip_md_suffix(&key); - let rendered = memory::render(None, &bare, None).await + let rendered = memory::memory_render(None, &bare, None).await .map_err(|e| e.to_string())?; print!("{}", rendered); @@ -71,7 +71,7 @@ pub async fn cmd_history(key: &[String], full: bool) -> Result<(), String> { return Err("history requires a key".into()); } let key = key.join(" "); - let result = memory::history(None, &key, Some(full)).await + let result = memory::memory_history(None, &key, Some(full)).await .map_err(|e| e.to_string())?; print!("{}", result); Ok(()) @@ -91,7 +91,7 @@ pub async fn cmd_write(key: &[String]) -> Result<(), String> { } super::check_dry_run(); - let result = memory::write(None, &key, &content).await + let result = memory::memory_write(None, &key, &content).await .map_err(|e| e.to_string())?; println!("{}", result); Ok(()) @@ -104,7 +104,7 @@ pub async fn cmd_edit(key: &[String]) -> Result<(), String> { let key = key.join(" "); // Get raw content - let content = memory::render(None, &key, Some(true)).await + let content = memory::memory_render(None, &key, Some(true)).await .unwrap_or_default(); let tmp = std::env::temp_dir().join(format!("poc-memory-edit-{}.md", key.replace('/', "_"))); @@ -136,7 +136,7 @@ pub async fn cmd_edit(key: &[String]) -> Result<(), String> { } super::check_dry_run(); - let result = memory::write(None, &key, &new_content).await + let result = memory::memory_write(None, &key, &new_content).await .map_err(|e| e.to_string())?; println!("{}", result); Ok(()) @@ -146,7 +146,7 @@ pub async fn cmd_search(keys: &[String]) -> Result<(), String> { if keys.is_empty() { return Err("search requires seed keys".into()); } - let result = memory::search(None, keys.to_vec(), None, None, None, None).await + let result = memory::memory_search(None, keys.to_vec(), None, None, None, None).await .map_err(|e| e.to_string())?; print!("{}", result); Ok(()) @@ -158,7 +158,7 @@ pub async fn cmd_query(expr: &[String]) -> Result<(), String> { } let query_str = expr.join(" "); - let result = memory::query(None, &query_str, None).await + let result = memory::memory_query(None, &query_str, None).await .map_err(|e| e.to_string())?; print!("{}", result); Ok(()) @@ -173,7 +173,7 @@ pub async fn get_group_content(group: &crate::config::ContextGroup, cfg: &crate: let query = format!("all | type:episodic | age:<{} | sort:timestamp | limit:{}", window, cfg.journal_max); - let keys_str = match memory::query(None, &query, None).await { + let keys_str = match memory::memory_query(None, &query, None).await { Ok(s) => s, Err(_) => return vec![], }; @@ -181,7 +181,7 @@ pub async fn get_group_content(group: &crate::config::ContextGroup, cfg: &crate: // Parse keys (one per line) and render each let mut results = Vec::new(); for key in keys_str.lines().filter(|k| !k.is_empty() && *k != "no results") { - if let Ok(content) = memory::render(None, key, Some(true)).await { + if let Ok(content) = memory::memory_render(None, key, Some(true)).await { if !content.trim().is_empty() { results.push((key.to_string(), content)); } @@ -199,7 +199,7 @@ pub async fn get_group_content(group: &crate::config::ContextGroup, cfg: &crate: crate::config::ContextSource::Store => { let mut results = Vec::new(); for key in &group.keys { - if let Ok(content) = memory::render(None, key, Some(true)).await { + if let Ok(content) = memory::memory_render(None, key, Some(true)).await { if !content.trim().is_empty() { results.push((key.clone(), content.trim().to_string())); } diff --git a/src/hippocampus/mod.rs b/src/hippocampus/mod.rs index 999f676..d659fd4 100644 --- a/src/hippocampus/mod.rs +++ b/src/hippocampus/mod.rs @@ -26,7 +26,7 @@ use crate::neuro::{consolidation_priority, ReplayItem}; // ── Memory operations ────────────────────────────────────────── -pub fn render(store: &Store, _provenance: &str, key: &str, raw: Option) -> Result { +pub fn memory_render(store: &Store, _provenance: &str, key: &str, raw: Option) -> Result { let node = MemoryNode::from_store(store, key) .ok_or_else(|| anyhow::anyhow!("node not found: {}", key))?; if raw.unwrap_or(false) { @@ -36,14 +36,14 @@ pub fn render(store: &Store, _provenance: &str, key: &str, raw: Option) -> } } -pub fn write(store: &mut Store, provenance: &str, key: &str, content: &str) -> Result { +pub fn memory_write(store: &mut Store, provenance: &str, key: &str, content: &str) -> Result { let result = store.upsert_provenance(key, content, provenance) .map_err(|e| anyhow::anyhow!("{}", e))?; store.save().map_err(|e| anyhow::anyhow!("{}", e))?; Ok(format!("{} '{}'", result, key)) } -pub fn search( +pub fn memory_search( store: &Store, _provenance: &str, keys: Vec, @@ -84,7 +84,7 @@ pub fn search( .collect::>().join("\n")) } -pub fn links(store: &Store, _provenance: &str, key: &str) -> Result { +pub fn memory_links(store: &Store, _provenance: &str, key: &str) -> Result { let node = MemoryNode::from_store(store, key) .ok_or_else(|| anyhow::anyhow!("node not found: {}", key))?; let mut out = format!("Neighbors of '{}':\n", key); @@ -95,7 +95,7 @@ pub fn links(store: &Store, _provenance: &str, key: &str) -> Result { Ok(out) } -pub fn link_set(store: &mut Store, _provenance: &str, source: &str, target: &str, strength: f32) -> Result { +pub fn memory_link_set(store: &mut Store, _provenance: &str, source: &str, target: &str, strength: f32) -> Result { let s = store.resolve_key(source).map_err(|e| anyhow::anyhow!("{}", e))?; let t = store.resolve_key(target).map_err(|e| anyhow::anyhow!("{}", e))?; let old = store.set_link_strength(&s, &t, strength).map_err(|e| anyhow::anyhow!("{}", e))?; @@ -103,7 +103,7 @@ pub fn link_set(store: &mut Store, _provenance: &str, source: &str, target: &str Ok(format!("{} ↔ {} strength {:.2} → {:.2}", s, t, old, strength)) } -pub fn link_add(store: &mut Store, provenance: &str, source: &str, target: &str) -> Result { +pub fn memory_link_add(store: &mut Store, provenance: &str, source: &str, target: &str) -> Result { let s = store.resolve_key(source).map_err(|e| anyhow::anyhow!("{}", e))?; let t = store.resolve_key(target).map_err(|e| anyhow::anyhow!("{}", e))?; let strength = store.add_link(&s, &t, provenance).map_err(|e| anyhow::anyhow!("{}", e))?; @@ -111,14 +111,14 @@ pub fn link_add(store: &mut Store, provenance: &str, source: &str, target: &str) Ok(format!("linked {} → {} (strength={:.2})", s, t, strength)) } -pub fn delete(store: &mut Store, _provenance: &str, key: &str) -> Result { +pub fn memory_delete(store: &mut Store, _provenance: &str, key: &str) -> Result { let resolved = store.resolve_key(key).map_err(|e| anyhow::anyhow!("{}", e))?; store.delete_node(&resolved).map_err(|e| anyhow::anyhow!("{}", e))?; store.save().map_err(|e| anyhow::anyhow!("{}", e))?; Ok(format!("deleted {}", resolved)) } -pub fn history(store: &Store, _provenance: &str, key: &str, full: Option) -> Result { +pub fn memory_history(store: &Store, _provenance: &str, key: &str, full: Option) -> Result { let key = store.resolve_key(key).unwrap_or_else(|_| key.to_string()); let full = full.unwrap_or(false); @@ -168,21 +168,21 @@ pub fn history(store: &Store, _provenance: &str, key: &str, full: Option) Ok(out) } -pub fn weight_set(store: &mut Store, _provenance: &str, key: &str, weight: f32) -> Result { +pub fn memory_weight_set(store: &mut Store, _provenance: &str, key: &str, weight: f32) -> Result { let resolved = store.resolve_key(key).map_err(|e| anyhow::anyhow!("{}", e))?; let (old, new) = store.set_weight(&resolved, weight).map_err(|e| anyhow::anyhow!("{}", e))?; store.save().map_err(|e| anyhow::anyhow!("{}", e))?; Ok(format!("weight {} {:.2} → {:.2}", resolved, old, new)) } -pub fn rename(store: &mut Store, _provenance: &str, old_key: &str, new_key: &str) -> Result { +pub fn memory_rename(store: &mut Store, _provenance: &str, old_key: &str, new_key: &str) -> Result { let resolved = store.resolve_key(old_key).map_err(|e| anyhow::anyhow!("{}", e))?; store.rename_node(&resolved, new_key).map_err(|e| anyhow::anyhow!("{}", e))?; store.save().map_err(|e| anyhow::anyhow!("{}", e))?; Ok(format!("Renamed '{}' → '{}'", resolved, new_key)) } -pub fn supersede(store: &mut Store, provenance: &str, old_key: &str, new_key: &str, reason: Option<&str>) -> Result { +pub fn memory_supersede(store: &mut Store, provenance: &str, old_key: &str, new_key: &str, reason: Option<&str>) -> Result { let reason = reason.unwrap_or("superseded"); let content = store.nodes.get(old_key) .map(|n| n.content.clone()) @@ -221,7 +221,7 @@ pub fn keys_to_replay_items( .collect() } -pub fn query(store: &Store, _provenance: &str, query_str: &str, format: Option<&str>) -> Result { +pub fn memory_query(store: &Store, _provenance: &str, query_str: &str, format: Option<&str>) -> Result { let graph = store.build_graph(); match format.unwrap_or("compact") { @@ -267,7 +267,7 @@ pub fn journal_tail(store: &Store, _provenance: &str, count: Option, level: } q.push_str(&std::format!(" | limit:{}", count)); - query(store, _provenance, &q, Some(format)) + memory_query(store, _provenance, &q, Some(format)) } fn level_to_node_type(level: i64) -> crate::store::NodeType { diff --git a/src/main.rs b/src/main.rs index 86a31de..00a48f0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -397,7 +397,7 @@ impl Run for Command { Self::History { full, key } => cli::node::cmd_history(&key, full).await, Self::Tail { n, full, provenance, all_versions } => cli::journal::cmd_tail(n, full, provenance.as_deref(), !all_versions), - Self::Status => cli::admin::cmd_status(), + Self::Status => cli::admin::cmd_status().await, Self::Query { expr } => cli::node::cmd_query(&expr).await, Self::WeightSet { key, weight } => cli::node::cmd_weight_set(&key, weight).await, Self::Node(sub) => sub.run().await, @@ -422,8 +422,8 @@ impl Run for NodeCmd { impl Run for JournalCmd { async fn run(self) -> Result<(), String> { match self { - Self::Write { name, text } => cli::journal::cmd_journal_write(&name, &text), - Self::Tail { n, full, level } => cli::journal::cmd_journal_tail(n, full, level), + Self::Write { name, text } => cli::journal::cmd_journal_write(&name, &text).await, + Self::Tail { n, full, level } => cli::journal::cmd_journal_tail(n, full, level).await, } } } @@ -431,16 +431,16 @@ impl Run for JournalCmd { impl Run for GraphCmd { async fn run(self) -> Result<(), String> { match self { - Self::Link { key } => cli::graph::cmd_link(&key), + Self::Link { key } => cli::graph::cmd_link(&key).await, Self::LinkAdd { source, target, reason } - => cli::graph::cmd_link_add(&source, &target, &reason), + => cli::graph::cmd_link_add(&source, &target, &reason).await, Self::LinkSet { source, target, strength } - => cli::graph::cmd_link_set(&source, &target, strength), - Self::LinkImpact { source, target } => cli::graph::cmd_link_impact(&source, &target), + => cli::graph::cmd_link_set(&source, &target, strength).await, + Self::LinkImpact { source, target } => cli::graph::cmd_link_impact(&source, &target).await, Self::CapDegree { max_degree } => cli::graph::cmd_cap_degree(max_degree), - Self::NormalizeStrengths { apply } => cli::graph::cmd_normalize_strengths(apply), - Self::Trace { key } => cli::graph::cmd_trace(&key), - Self::Communities { top_n, min_size } => cli::graph::cmd_communities(top_n, min_size), + Self::NormalizeStrengths { apply } => cli::graph::cmd_normalize_strengths(apply).await, + Self::Trace { key } => cli::graph::cmd_trace(&key).await, + Self::Communities { top_n, min_size } => cli::graph::cmd_communities(top_n, min_size).await, } } } @@ -458,8 +458,8 @@ impl Run for AdminCmd { async fn run(self) -> Result<(), String> { match self { Self::Init => cli::admin::cmd_init(), - Self::Health => cli::admin::cmd_health(), - Self::Topology => cli::admin::cmd_topology(), + Self::Health => cli::admin::cmd_health().await, + Self::Topology => cli::admin::cmd_topology().await, Self::Fsck => cli::admin::cmd_fsck(), Self::Dedup { apply } => cli::admin::cmd_dedup(apply), Self::DailyCheck => cli::admin::cmd_daily_check(),