forked from kent/consciousness
CLI/hippocampus: rename core memory functions to memory_*
Aligns function names with tool names for consistency: - hippocampus: render → memory_render, write → memory_write, etc. - tools/memory.rs: macro no longer prepends memory_ prefix - CLI files: use typed async API throughout (graph.rs, journal.rs, admin.rs) This eliminates the "memory_graph_topology" tool name bug where graph_* and journal_* tools were incorrectly prefixed. Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
fa50f1c826
commit
5b07a81aa7
7 changed files with 106 additions and 130 deletions
|
|
@ -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()));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue