feat(mcp): implement Prompts capability, Resources, and clean up daemon architecture

This commit is contained in:
Riz Ashraf committed 2026-09-22 21:41:17 +01:00
1 parent 9b9b403ef2
commit 251757f8fc
29 files changed
+1276 -182

No files matched your search

+65
View File
@@ -260,3 +260,68 @@ impl McpTool for GenerateStandupReportHandler {
Ok(report_str)
}
}
#[cfg(test)]
mod tests {
use super::*;
use tempfile::tempdir;
use serde_json::json;
#[tokio::test]
async fn test_notes_lifecycle() {
let dir = tempdir().unwrap();
let state = Arc::new(MemoryState::new(dir.path().to_str().unwrap()));
let add_handler = AddStickyNoteHandler;
let args = json!({
"content": "Buy milk",
});
let res = add_handler.execute(args, state.clone()).await.unwrap();
assert!(res.contains("Sticky note added"));
let read_handler = ReadStickyNotesHandler;
let res2 = read_handler.execute(json!({}), state.clone()).await.unwrap();
assert!(res2.contains("Buy milk"));
let delete_handler = DeleteStickyNoteHandler;
let args2 = json!({"index": 1});
let res3 = delete_handler.execute(args2, state.clone()).await.unwrap();
assert_eq!(res3, "Sticky note deleted.");
let res4 = read_handler.execute(json!({}), state.clone()).await.unwrap();
assert!(!res4.contains("Buy milk"));
}
#[tokio::test]
async fn test_handoff_and_summaries() {
let dir = tempdir().unwrap();
let state = Arc::new(MemoryState::new(dir.path().to_str().unwrap()));
let handoff_handler = LeaveHandoffMemoHandler;
let args = json!({
"content": "Finished implementing graph tests",
"author": "Antigravity",
"namespace": "global"
});
let res = handoff_handler.execute(args, state.clone()).await.unwrap();
assert_eq!(res, "Handoff memo left");
let read_handoff = ReadHandoffMemosHandler;
let res2 = read_handoff.execute(json!({"namespace": "global"}), state.clone()).await.unwrap();
assert!(res2.contains("Finished implementing graph tests"));
let summary_handler = AddSessionSummaryHandler;
let args_sum = json!({
"summary": "Completed a bunch of tests",
"namespace": "global"
});
let res3 = summary_handler.execute(args_sum, state.clone()).await.unwrap();
assert_eq!(res3, "Session summary added");
let standup_handler = GenerateStandupReportHandler;
let res4 = standup_handler.execute(json!({"namespace": "global", "hours_lookback": 24}), state.clone()).await.unwrap();
assert!(res4.len() > 0);
}
}