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
test(goals): route goal store calls through session store kv
Steven Enamakel2bf6e093c902
diff --git a/crates/openhuman-core/src/agent/goals/runtime_tests.rs b/crates/openhuman-core/src/agent/goals/runtime_tests.rsindex 4f42dd8d48..eb3a0ae8b6 100644--- a/crates/openhuman-core/src/agent/goals/runtime_tests.rs+++ b/crates/openhuman-core/src/agent/goals/runtime_tests.rs@@ -15,9 +15,9 @@ fn cost_with_tokens(input: u64, output: u64) -> TurnCost {async fn account_turn_charges_active_goal_and_trips_budget() {let tmp = tempfile::tempdir().unwrap();let dir = tmp.path().to_path_buf();- store::set(&dir, "t-acct", "obj", Some(100)).await.unwrap();+ tinyagents_graph::goals::store::set(&crate::agent::session_store::stores_or_ephemeral(&dir).kv, "t-acct", "obj", Some(100)).await.unwrap();account_turn_against_goal(&dir, Some("t-acct"), 80, 40, 3).await; // 120 >= 100- let g = store::get(&dir, "t-acct").await.unwrap().unwrap();+ let g = tinyagents_graph::goals::store::get(&crate::agent::session_store::stores_or_ephemeral(&dir).kv, "t-acct").await.unwrap().unwrap();assert_eq!(g.tokens_used, 120);assert_eq!(g.status, ThreadGoalStatus::BudgetLimited);}@@ -26,12 +26,12 @@ async fn account_turn_charges_active_goal_and_trips_budget() {async fn account_turn_skips_non_active_goal() {let tmp = tempfile::tempdir().unwrap();let dir = tmp.path().to_path_buf();- store::set(&dir, "t-paused", "obj", Some(1000))+ tinyagents_graph::goals::store::set(&crate::agent::session_store::stores_or_ephemeral(&dir).kv, "t-paused", "obj", Some(1000)).await.unwrap();store::pause(&dir, "t-paused").await.unwrap();account_turn_against_goal(&dir, Some("t-paused"), 500, 500, 1).await;- let g = store::get(&dir, "t-paused").await.unwrap().unwrap();+ let g = tinyagents_graph::goals::store::get(&crate::agent::session_store::stores_or_ephemeral(&dir).kv, "t-paused").await.unwrap().unwrap();assert_eq!(g.tokens_used, 0, "paused goal must not accrue usage");}@@ -41,11 +41,11 @@ async fn complete_for_thread_settles_active_goal() {// later turn stops re-injecting its `[active_goal]` block (#1725).let tmp = tempfile::tempdir().unwrap();let dir = tmp.path().to_path_buf();- store::set(&dir, "t-complete", "obj", Some(1000))+ tinyagents_graph::goals::store::set(&crate::agent::session_store::stores_or_ephemeral(&dir).kv, "t-complete", "obj", Some(1000)).await.unwrap();complete_for_thread(&dir, Some("t-complete")).await;- let g = store::get(&dir, "t-complete").await.unwrap().unwrap();+ let g = tinyagents_graph::goals::store::get(&crate::agent::session_store::stores_or_ephemeral(&dir).kv, "t-complete").await.unwrap().unwrap();assert_eq!(g.status,ThreadGoalStatus::Complete,@@ -63,11 +63,11 @@ async fn clear_for_thread_removes_the_goal_row() {// injects no goal block at all — the strongest anti-leak guarantee.let tmp = tempfile::tempdir().unwrap();let dir = tmp.path().to_path_buf();- store::set(&dir, "t-clear", "obj", Some(1000))+ tinyagents_graph::goals::store::set(&crate::agent::session_store::stores_or_ephemeral(&dir).kv, "t-clear", "obj", Some(1000)).await.unwrap();clear_for_thread(&dir, Some("t-clear")).await;- let g = store::get(&dir, "t-clear").await.unwrap();+ let g = tinyagents_graph::goals::store::get(&crate::agent::session_store::stores_or_ephemeral(&dir).kv, "t-clear").await.unwrap();assert!(g.is_none(),"clearing must delete the goal row so no [active_goal] can leak forward"@@ -82,7 +82,7 @@ async fn complete_and_clear_are_safe_without_a_goal_or_thread() {let dir = tmp.path().to_path_buf();complete_for_thread(&dir, Some("t-empty")).await;clear_for_thread(&dir, Some("t-empty")).await;- assert!(store::get(&dir, "t-empty").await.unwrap().is_none());+ assert!(tinyagents_graph::goals::store::get(&crate::agent::session_store::stores_or_ephemeral(&dir).kv, "t-empty").await.unwrap().is_none());// No ambient thread scope at all.complete_for_thread(&dir, None).await;clear_for_thread(&dir, None).await;@@ -92,11 +92,11 @@ async fn complete_and_clear_are_safe_without_a_goal_or_thread() {async fn account_turn_clears_suppression_without_losing_usage() {let tmp = tempfile::tempdir().unwrap();let dir = tmp.path().to_path_buf();- let goal = store::set(&dir, "t-suppressed", "obj", Some(1000))+ let goal = tinyagents_graph::goals::store::set(&crate::agent::session_store::stores_or_ephemeral(&dir).kv, "t-suppressed", "obj", Some(1000)).await.unwrap();tinyagents_graph::goals::store::set_continuation_suppressed_if(- &goals_store(&dir),+ &crate::agent::session_store::stores_or_ephemeral(&dir).kv,"t-suppressed",&goal.goal_id,true,@@ -106,7 +106,7 @@ async fn account_turn_clears_suppression_without_losing_usage() {account_turn_against_goal(&dir, Some("t-suppressed"), 80, 40, 3).await;- let updated = store::get(&dir, "t-suppressed").await.unwrap().unwrap();+ let updated = tinyagents_graph::goals::store::get(&crate::agent::session_store::stores_or_ephemeral(&dir).kv, "t-suppressed").await.unwrap().unwrap();assert_eq!(updated.goal_id, goal.goal_id);assert!(!updated.continuation_suppressed);assert_eq!(updated.tokens_used, 120);@@ -117,12 +117,12 @@ async fn account_turn_clears_suppression_without_losing_usage() {async fn budget_stop_hook_fires_on_crossing() {let tmp = tempfile::tempdir().unwrap();let dir = tmp.path().to_path_buf();- let goal = store::set(&dir, "t-hook", "obj", Some(1000)).await.unwrap();+ let goal = tinyagents_graph::goals::store::set(&crate::agent::session_store::stores_or_ephemeral(&dir).kv, "t-hook", "obj", Some(1000)).await.unwrap();// 600 already used in a prior turn.store::account_usage(&dir, "t-hook", &goal.goal_id, 600, 0).await.unwrap();- let goal = store::get(&dir, "t-hook").await.unwrap().unwrap();+ let goal = tinyagents_graph::goals::store::get(&crate::agent::session_store::stores_or_ephemeral(&dir).kv, "t-hook").await.unwrap().unwrap();let hook = GoalBudgetStopHook::for_goal(&dir, &goal).expect("budgeted active goal");// This turn so far: 300 in + 200 out = 500. 600 + 500 = 1100 >= 1000.@@ -150,10 +150,10 @@ async fn budget_stop_hook_fires_on_crossing() {async fn no_hook_without_budget_or_when_inactive() {let tmp = tempfile::tempdir().unwrap();let dir = tmp.path().to_path_buf();- let no_budget = store::set(&dir, "a", "obj", None).await.unwrap();+ let no_budget = tinyagents_graph::goals::store::set(&crate::agent::session_store::stores_or_ephemeral(&dir).kv, "a", "obj", None).await.unwrap();assert!(GoalBudgetStopHook::for_goal(&dir, &no_budget).is_none());- store::set(&dir, "b", "obj", Some(100)).await.unwrap();+ tinyagents_graph::goals::store::set(&crate::agent::session_store::stores_or_ephemeral(&dir).kv, "b", "obj", Some(100)).await.unwrap();store::pause(&dir, "b").await.unwrap();- let paused = store::get(&dir, "b").await.unwrap().unwrap();+ let paused = tinyagents_graph::goals::store::get(&crate::agent::session_store::stores_or_ephemeral(&dir).kv, "b").await.unwrap().unwrap();assert!(GoalBudgetStopHook::for_goal(&dir, &paused).is_none());}diff --git a/crates/openhuman-core/src/agent/session_host/runtime_adapter_tests.rs b/crates/openhuman-core/src/agent/session_host/runtime_adapter_tests.rsindex 23abe088b5..f5acaaee9e 100644--- a/crates/openhuman-core/src/agent/session_host/runtime_adapter_tests.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime_adapter_tests.rs@@ -298,8 +298,7 @@ fn wildcard_delegate_visibility_admits_new_connections_and_removes_revoked_ones(#[tokio::test]async fn committed_goal_accounting_uses_direct_and_completed_child_usage() {let workspace = tempfile::tempdir().unwrap();- crate::agent::goals::store::set(- workspace.path(),+ tinyagents_graph::goals::store::set(&crate::agent::session_store::stores_or_ephemeral(workspace.path()).kv,"receipt-goal","finish migration",Some(20),@@ -326,7 +325,7 @@ async fn committed_goal_accounting_uses_direct_and_completed_child_usage() {account_committed_turn_against_goal(workspace.path(), Some("receipt-goal"), &sidecar).await;- let goal = crate::agent::goals::store::get(workspace.path(), "receipt-goal")+ let goal = tinyagents_graph::goals::store::get(&crate::agent::session_store::stores_or_ephemeral(workspace.path()).kv, "receipt-goal").await.unwrap().unwrap();diff --git a/crates/openhuman-core/src/threads/ops/live_state_tests.rs b/crates/openhuman-core/src/threads/ops/live_state_tests.rsindex 84f02fde38..37b45168a6 100644--- a/crates/openhuman-core/src/threads/ops/live_state_tests.rs+++ b/crates/openhuman-core/src/threads/ops/live_state_tests.rs@@ -63,7 +63,7 @@ async fn goal_get_reads_back_a_stored_goal() {.await.unwrap().workspace_dir;- crate::agent::goals::store::set(&dir, "thread-goal-live", "ship it", Some(1000))+ tinyagents_graph::goals::store::set(&crate::agent::session_store::stores_or_ephemeral(&dir).kv, "thread-goal-live", "ship it", Some(1000)).await.unwrap();