The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
chore: files changed crates/openhuman-core/src/agent/session_host/runtime_session/memory_ingest_test
Steven Enamakel68dcfe6a00ed
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session/memory_ingest_tests.rs b/crates/openhuman-core/src/agent/session_host/runtime_session/memory_ingest_tests.rsnew file mode 100644index 0000000000..726ef61591--- /dev/null+++ b/crates/openhuman-core/src/agent/session_host/runtime_session/memory_ingest_tests.rs@@ -0,0 +1,68 @@+use super::*;++use tinyagents_harness::summarization::checkpoint_message;+use tinyinference_llm::message::ToolCall;++fn assistant_with_call(id: &str, name: &str) -> Message {+ let mut message = Message::assistant("");+ if let Message::Assistant(assistant) = &mut message {+ assistant.tool_calls.push(ToolCall {+ id: id.to_string(),+ name: name.to_string(),+ arguments: serde_json::json!({}),+ ..ToolCall::default()+ });+ }+ message+}++#[test]+fn without_a_checkpoint_the_whole_thread_is_in_the_prompt() {+ let history = vec![+ Message::user("one"),+ Message::assistant("a"),+ Message::user("two"),+ ];+ assert_eq!(in_prompt_window(&history, 2, None), (0, false));+}++#[test]+fn after_a_checkpoint_the_window_starts_at_the_first_kept_turn() {+ let current = Message::user("five");+ let history = vec![+ Message::system("prompt"),+ checkpoint_message("earlier turns"),+ Message::user("three"),+ Message::assistant("c"),+ Message::user("four"),+ Message::assistant("d"),+ current.clone(),+ ];+ // Five turns committed before this one; turns 3 and 4 are verbatim, so+ // the window opens at turn 3, user index 6.+ assert_eq!(in_prompt_window(&history, 5, Some(¤t)), (6, true));+ assert_eq!(+ in_prompt_window(&history[..6], 5, None),+ (6, true),+ "the request input is not counted whether or not it was appended"+ );+}++#[test]+fn committed_tool_calls_pair_each_call_with_its_result() {+ let history = vec![+ Message::user("earlier"),+ assistant_with_call("old", "ignored"),+ Message::user("find the file"),+ assistant_with_call("c1", "glob"),+ Message::tool("c1", "src/main.rs"),+ assistant_with_call("c2", "noop"),+ Message::assistant("Found it."),+ ];+ let calls = committed_tool_calls(&history);+ assert_eq!(calls.len(), 2);+ assert_eq!(calls[0].name, "glob");+ assert_eq!(calls[0].id.as_deref(), Some("c1"));+ assert_eq!(calls[0].result.as_deref(), Some("src/main.rs"));+ assert_eq!(calls[1].result, None);+}