Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

refactor(memory): simplify async call chaining

Steven Enamakel30224fcef84f
diff --git a/crates/openhuman-core/src/memory/confine.rs b/crates/openhuman-core/src/memory/confine.rs
index 25daa3b589..ecadc81fbb 100644
--- a/crates/openhuman-core/src/memory/confine.rs
+++ b/crates/openhuman-core/src/memory/confine.rs
@@ -120,9 +120,7 @@ pub async fn recall(
params.filter,
&allowed_reach(config, identity),
)?);
- ops::recall(config, params)
- .await
- .map_err(MemoryError::from)
+ ops::recall(config, params).await.map_err(MemoryError::from)
}
/// `memory_fetch`, confined.
@@ -139,9 +137,7 @@ pub async fn fetch(
params.filter,
&allowed_reach(config, identity),
)?);
- ops::fetch(config, params)
- .await
- .map_err(MemoryError::from)
+ ops::fetch(config, params).await.map_err(MemoryError::from)
}
/// `memory_learn`, confined: the learning lands inside the caller's layout.
@@ -175,9 +171,7 @@ pub async fn forget(
params.reach,
&allowed_reach(config, identity),
)?);
- ops::forget(config, params)
- .await
- .map_err(MemoryError::from)
+ ops::forget(config, params).await.map_err(MemoryError::from)
}
/// `memory_items_list`, confined. The explorer path narrows first (a
diff --git a/crates/openhuman-core/src/memory/schemas/handlers.rs b/crates/openhuman-core/src/memory/schemas/handlers.rs
index 9403368c90..ff18eab6fa 100644
--- a/crates/openhuman-core/src/memory/schemas/handlers.rs
+++ b/crates/openhuman-core/src/memory/schemas/handlers.rs
@@ -31,7 +31,9 @@ fn to_json<T: Serialize>(value: T) -> Result<Value, String> {
Outcome::new(value, Vec::new()).into_cli_compatible_json()
}
-fn finish<T: Serialize, E: Into<MemoryError>>(result: std::result::Result<T, E>) -> Result<Value, String> {
+fn finish<T: Serialize, E: Into<MemoryError>>(
+ result: std::result::Result<T, E>,
+) -> Result<Value, String> {
to_json(result.map_err(Into::into).map_err(String::from)?)
}