Skip to content

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

chore: files changed crates/openhuman-core/src/memory/ops.rs

Steven Enamakel0eec47d62fbc
diff --git a/crates/openhuman-core/src/memory/ops.rs b/crates/openhuman-core/src/memory/ops.rs
index 1f33e0edad..57aa0e0158 100644
--- a/crates/openhuman-core/src/memory/ops.rs
+++ b/crates/openhuman-core/src/memory/ops.rs
@@ -294,7 +294,7 @@ pub fn learning_item(params: LearnParams, host_meta: Option<MemoryMeta>) -> Resu
}
let mut meta = params.meta.unwrap_or_default();
if let Some(host) = host_meta {
- merge_meta(&mut meta, host);
+ meta = meta.overlay(host);
}
if meta.observed_at.is_none() {
meta.observed_at = Some(Utc::now());
@@ -309,41 +309,6 @@ pub fn learning_item(params: LearnParams, host_meta: Option<MemoryMeta>) -> Resu
Ok(item)
}
-/// Overlays every field `host` sets onto `meta`.
-fn merge_meta(meta: &mut MemoryMeta, host: MemoryMeta) {
- macro_rules! take {
- ($($field:ident),*) => {$(
- if host.$field.is_some() {
- meta.$field = host.$field;
- }
- )*};
- }
- take!(
- workspace,
- folder,
- file_path,
- language,
- repo,
- commit,
- url,
- thread_id,
- turns,
- agent_id,
- tool_call,
- observed_at,
- derive
- );
- meta.source = host.source;
- // The host's node is authoritative: a caller cannot write into another
- // agent's memory.
- meta.namespace = host.namespace;
- for tag in host.tags {
- if !meta.tags.contains(&tag) {
- meta.tags.push(tag);
- }
- }
-}
-
/// `memory_learn`: returns once the learning is readable.
pub async fn learn(
config: &Config,