Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/openhuman/memory/tree/retrieval/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,14 @@ pub async fn query_source_rpc(
// ── query_global ──────────────────────────────────────────────────────

/// Request body for `memory_tree_query_global`.
///
/// The consolidated `memory_tree` tool schema advertises `time_window_days`
/// (consistent with `query_source` / `query_topic`), while the standalone
/// tool uses `window_days`. Accept both via serde alias so callers using
/// either field name succeed.
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct QueryGlobalRequest {
#[serde(alias = "time_window_days")]
pub window_days: u32,
}

Expand Down Expand Up @@ -421,6 +427,19 @@ mod tests {
);
}

#[test]
fn query_global_request_accepts_time_window_days_alias() {
// The consolidated memory_tree tool schema uses "time_window_days"
// while the standalone tool uses "window_days". Both must deserialize.
let from_window_days: QueryGlobalRequest =
serde_json::from_str(r#"{"window_days": 14}"#).unwrap();
assert_eq!(from_window_days.window_days, 14);

let from_alias: QueryGlobalRequest =
serde_json::from_str(r#"{"time_window_days": 30}"#).unwrap();
assert_eq!(from_alias.window_days, 30);
}

// ── query_topic_rpc ───────────────────────────────────────────────

#[tokio::test]
Expand Down
Loading