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: reformat code for consistent style across memory and agent modules
Steven Enamakel72e04283ff6b
diff --git a/crates/openhuman-core/src/agent/bus.rs b/crates/openhuman-core/src/agent/bus.rsindex 57c68b7158..f9958841bd 100644--- a/crates/openhuman-core/src/agent/bus.rs+++ b/crates/openhuman-core/src/agent/bus.rs@@ -299,33 +299,37 @@ async fn handle_agent_run_turn(req: AgentTurnRequest) -> Result<AgentTurnRespons.unwrap_or_default();let outcome = turn_origin::with_origin(origin,- crate::memory::scope::within_agent(&memory_config, &memory_agent, with_file_state_agent_id(- file_state_id,- with_current_sandbox_mode(sandbox_mode, async {- // Channel/CLI turns run through the tinyagents harness- // (issue #4249); the legacy `run_tool_call_loop` is removed.- // `on_progress` mirrors the harness event stream (tool- // timeline, text deltas, cost footer) — production channel- // dispatch always supplies it and now expects it live.- // `on_delta` (raw Sender<String>) is superseded by- // `on_progress` text deltas, so it's intentionally unused.- let _ = (&provider_name, silent, &channel_name, on_delta);- run_channel_turn_via_graph(- turn_model_source.clone(),- &mut history,- tools_registry.clone(),- extra_tools,- visible_tool_names.as_ref(),- &model,- temperature,- max_tool_iterations,- multimodal.clone(),- multimodal_files.clone(),- on_progress,- )- .await- }),- )),+ crate::memory::scope::within_agent(+ &memory_config,+ &memory_agent,+ with_file_state_agent_id(+ file_state_id,+ with_current_sandbox_mode(sandbox_mode, async {+ // Channel/CLI turns run through the tinyagents harness+ // (issue #4249); the legacy `run_tool_call_loop` is removed.+ // `on_progress` mirrors the harness event stream (tool+ // timeline, text deltas, cost footer) — production channel+ // dispatch always supplies it and now expects it live.+ // `on_delta` (raw Sender<String>) is superseded by+ // `on_progress` text deltas, so it's intentionally unused.+ let _ = (&provider_name, silent, &channel_name, on_delta);+ run_channel_turn_via_graph(+ turn_model_source.clone(),+ &mut history,+ tools_registry.clone(),+ extra_tools,+ visible_tool_names.as_ref(),+ &model,+ temperature,+ max_tool_iterations,+ multimodal.clone(),+ multimodal_files.clone(),+ on_progress,+ )+ .await+ }),+ ),+ ),).await.map_err(|e| e.to_string())?;diff --git a/crates/openhuman-core/src/agent/orchestration/agent_teams/runtime.rs b/crates/openhuman-core/src/agent/orchestration/agent_teams/runtime.rsindex 383531062e..1f4987b9ed 100644--- a/crates/openhuman-core/src/agent/orchestration/agent_teams/runtime.rs+++ b/crates/openhuman-core/src/agent/orchestration/agent_teams/runtime.rs@@ -236,9 +236,9 @@ async fn run_member_loop(.await});let outcome = crate::memory::scope::within(identity, member_turn)- .await- // Flatten: outer Err = root-parent build failure, inner = drive_member result.- .unwrap_or_else(Err);+ .await+ // Flatten: outer Err = root-parent build failure, inner = drive_member result.+ .unwrap_or_else(Err);if let Err(err) = outcome {log::error!(diff --git a/crates/openhuman-core/src/config/schema/mod.rs b/crates/openhuman-core/src/config/schema/mod.rsindex 27f1e18097..484cbbd1c7 100644--- a/crates/openhuman-core/src/config/schema/mod.rs+++ b/crates/openhuman-core/src/config/schema/mod.rs@@ -92,8 +92,9 @@ pub use dictation::{DictationActivationMode, DictationConfig};pub use identity_cost::{CostConfig, ModelPricing};pub use local_ai::{LocalAiConfig, LocalAiUsage};pub use memory::{- migrate_legacy_source, MemoryAgentConfig, MemoryConfig, MemoryContextConfig, MemoryConversationsConfig,- MemoryEngineSettings, MemorySourceConfig, MemorySourceKind, MEMORY_CORTEXDB_KEY_NAME,+ migrate_legacy_source, MemoryAgentConfig, MemoryConfig, MemoryContextConfig,+ MemoryConversationsConfig, MemoryEngineSettings, MemorySourceConfig, MemorySourceKind,+ MEMORY_CORTEXDB_KEY_NAME,};pub use modules::{ModuleOverride, ModulesConfig};pub use node::NodeConfig;diff --git a/crates/openhuman-core/src/memory/bus_tests.rs b/crates/openhuman-core/src/memory/bus_tests.rsindex e1994bbc3c..d9eb95d0ee 100644--- a/crates/openhuman-core/src/memory/bus_tests.rs+++ b/crates/openhuman-core/src/memory/bus_tests.rs@@ -96,7 +96,7 @@ async fn run_system_job_starts_due_source_syncs() {target: folder.display().to_string(),label: "Notes".into(),schedule_mins: Some(15),- namespace: None,+ namespace: None,});run_system_job(&config, SOURCES_SYNC_JOB).await;// The sync runs in the background; wait for its recorded state.diff --git a/crates/openhuman-core/src/memory/context_tests.rs b/crates/openhuman-core/src/memory/context_tests.rsindex 0df38c446a..4114c7948d 100644--- a/crates/openhuman-core/src/memory/context_tests.rs+++ b/crates/openhuman-core/src/memory/context_tests.rs@@ -175,10 +175,10 @@ fn as_agent(agent: &str) -> tinymemory::MemoryMeta {async fn each_agent_gets_its_own_context_md_from_its_reach() {let tmp = tempfile::tempdir().unwrap();let mut config = config_in(&tmp);- config- .memory- .agents- .insert("planner".into(), crate::config::schema::MemoryAgentConfig::default());+ config.memory.agents.insert(+ "planner".into(),+ crate::config::schema::MemoryAgentConfig::default(),+ );bind_reference(&config);let researcher = Namespace::agent("researcher");for (text, meta) in [@@ -195,7 +195,10 @@ async fn each_agent_gets_its_own_context_md_from_its_reach() {assert_eq!(view.namespace, "agent:researcher");assert!(view.markdown.contains("arxiv"), "{}", view.markdown);assert!(view.markdown.contains("Sam"), "the root is inherited");- assert!(!view.markdown.contains("British"), "a sibling is out of reach");+ assert!(+ !view.markdown.contains("British"),+ "a sibling is out of reach"+ );let path = context_path_for(&config.workspace_dir, &researcher);assert!(path.ends_with("memory/context/agent-researcher/context.md"));assert!(path.is_file());@@ -223,14 +226,17 @@ async fn an_agent_without_a_document_falls_back_to_its_ancestor_s() {let tmp = tempfile::tempdir().unwrap();let mut config = config_in(&tmp);bind_reference(&config);- learn(&config, params("The user is called Sam", LearningKind::Fact), None)- .await- .unwrap();+ learn(+ &config,+ params("The user is called Sam", LearningKind::Fact),+ None,+ )+ .await+ .unwrap();refresh(&config).await.unwrap();- let injected = crate::memory::scope::within_agent(&config, "scout", async {- injection_block(&config)- })- .await;+ let injected =+ crate::memory::scope::within_agent(&config, "scout", async { injection_block(&config) })+ .await;assert!(injected.unwrap().contains("Sam"));config.memory.agents.insert(@@ -240,9 +246,8 @@ async fn an_agent_without_a_document_falls_back_to_its_ancestor_s() {..Default::default()},);- let none = crate::memory::scope::within_agent(&config, "quiet", async {- injection_block(&config)- })- .await;+ let none =+ crate::memory::scope::within_agent(&config, "quiet", async { injection_block(&config) })+ .await;assert!(none.is_none(), "an agent can switch its context off");}diff --git a/crates/openhuman-core/src/memory/conversations/buffer_tests.rs b/crates/openhuman-core/src/memory/conversations/buffer_tests.rsindex fde7c2b2ab..be4f3105f3 100644--- a/crates/openhuman-core/src/memory/conversations/buffer_tests.rs+++ b/crates/openhuman-core/src/memory/conversations/buffer_tests.rs@@ -203,7 +203,11 @@ fn a_batch_never_mixes_two_agents() {assert!(buffer.push(by("researcher", 0), 0, 10).is_empty());assert!(buffer.push(by("researcher", 1), 1, 10).is_empty());let flushed = buffer.push(by("writer", 2), 2, 10);- assert_eq!(flushed.len(), 1, "the researcher's turns are stored on their own");+ assert_eq!(+ flushed.len(),+ 1,+ "the researcher's turns are stored on their own"+ );assert_eq!(flushed[0].turns.len(), 2);let item = flushed[0].clone().into_item();assert_eq!(item.meta().namespace, Namespace::agent("researcher"));@@ -211,5 +215,8 @@ fn a_batch_never_mixes_two_agents() {assert_eq!(buffer.pending("t"), 1);let rest = buffer.take_all();assert_eq!(rest[0].first, 2);- assert_eq!(rest[0].clone().into_item().meta().namespace, Namespace::agent("writer"));+ assert_eq!(+ rest[0].clone().into_item().meta().namespace,+ Namespace::agent("writer")+ );}diff --git a/crates/openhuman-core/src/memory/explore_tests.rs b/crates/openhuman-core/src/memory/explore_tests.rsindex 0b631c1cad..aca84f14b3 100644--- a/crates/openhuman-core/src/memory/explore_tests.rs+++ b/crates/openhuman-core/src/memory/explore_tests.rs@@ -194,10 +194,16 @@ async fn bad_requests_are_invalid_and_memory_off_is_reported() {);}assert_eq!(- items_get(&config, ItemsGetParams { ids: Vec::new(), reach: None })- .await- .unwrap_err()- .code(),+ items_get(+ &config,+ ItemsGetParams {+ ids: Vec::new(),+ reach: None+ }+ )+ .await+ .unwrap_err()+ .code(),INVALID_REQUEST);}diff --git a/crates/openhuman-core/src/memory/schemas/handlers.rs b/crates/openhuman-core/src/memory/schemas/handlers.rsindex d81d014130..4b2280a965 100644--- a/crates/openhuman-core/src/memory/schemas/handlers.rs+++ b/crates/openhuman-core/src/memory/schemas/handlers.rs@@ -11,10 +11,10 @@ use crate::core::Outcome;use crate::memory::error::{MemoryError, MemoryResult};use crate::memory::explore::{self, ExploreParams, ItemsGetParams};use crate::memory::types::{- ContextNodeParams, ContextSetParams, ConversationsSetParams, EmptyParams, EngineSetParams, FetchParams,- ForgetParams, ImportStartParams, ImportStateView, ItemsListParams, LearnParams, RecallParams,- SourceAddedView, SourceRemovedView, SourcesAddParams, SourcesListView, SourcesRemoveParams,- SourcesSyncParams, SourcesSyncView,+ ContextNodeParams, ContextSetParams, ConversationsSetParams, EmptyParams, EngineSetParams,+ FetchParams, ForgetParams, ImportStartParams, ImportStateView, ItemsListParams, LearnParams,+ RecallParams, SourceAddedView, SourceRemovedView, SourcesAddParams, SourcesListView,+ SourcesRemoveParams, SourcesSyncParams, SourcesSyncView,};use crate::memory::{context, conversations, engine, import, ops, sources};diff --git a/crates/openhuman-core/src/memory/scope.rs b/crates/openhuman-core/src/memory/scope.rsindex 97c7726f00..7ab9f2dc4b 100644--- a/crates/openhuman-core/src/memory/scope.rs+++ b/crates/openhuman-core/src/memory/scope.rs@@ -139,7 +139,11 @@ pub fn namespace_for(config: &Config, agent_id: &str, team: Option<&str>) -> Nam/// Whether `agent_id` reads and writes the root node.#[must_use]pub fn is_root_agent(config: &Config, agent_id: &str) -> bool {- config.memory.root_agents.iter().any(|root| root == agent_id)+ config+ .memory+ .root_agents+ .iter()+ .any(|root| root == agent_id)}/// `namespace` with a sanitized `kind:id` segment appended; past the depthdiff --git a/crates/openhuman-core/src/memory/scope_tests.rs b/crates/openhuman-core/src/memory/scope_tests.rsindex b005ae532c..ad9569862b 100644--- a/crates/openhuman-core/src/memory/scope_tests.rs+++ b/crates/openhuman-core/src/memory/scope_tests.rs@@ -13,8 +13,14 @@ fn ns(value: &str) -> Namespace {#[test]fn the_main_agent_is_the_root_and_others_get_their_own_node() {let config = config();- assert_eq!(namespace_for(&config, "orchestrator", None), Namespace::ROOT);- assert_eq!(namespace_for(&config, "researcher", None), ns("agent:researcher"));+ assert_eq!(+ namespace_for(&config, "orchestrator", None),+ Namespace::ROOT+ );+ assert_eq!(+ namespace_for(&config, "researcher", None),+ ns("agent:researcher")+ );assert_eq!(namespace_for(&config, "writer", Some("acme")),ns("team:acme/agent:writer")@@ -74,7 +80,11 @@ fn sub_agents_nest_under_their_parent() {assert_eq!(scout.namespace, ns("agent:researcher/agent:scout"));assert_eq!(scout.reach().nodes(),- vec![Namespace::ROOT, ns("agent:researcher"), scout.namespace.clone()]+ vec![+ Namespace::ROOT,+ ns("agent:researcher"),+ scout.namespace.clone()+ ]);assert_eq!(researcher.child(&config, "orchestrator").namespace,diff --git a/crates/openhuman-core/src/memory/sources/composio_tests.rs b/crates/openhuman-core/src/memory/sources/composio_tests.rsindex cd2a94a3f0..6e53ea3127 100644--- a/crates/openhuman-core/src/memory/sources/composio_tests.rs+++ b/crates/openhuman-core/src/memory/sources/composio_tests.rs@@ -1,7 +1,7 @@use super::*;-use tinymemory::Namespace;use crate::config::schema::MemorySourceKind;use crate::memory::test_fixtures::{bind_reference, config_in, stored};+use tinymemory::Namespace;use tinymemory::{ItemKind, MetaFilter};fn record(id: &str, title: &str, content: &str) -> ConnectorRecord {@@ -79,9 +79,16 @@ async fn store_records_stores_the_non_empty_ones() {record("2", "Empty", " "),record("3", "Three", "third record"),];- let stored_count = store_records(&bound, "notion", "conn-1", "src-n", &Namespace::ROOT, &records)- .await- .unwrap();+ let stored_count = store_records(+ &bound,+ "notion",+ "conn-1",+ "src-n",+ &Namespace::ROOT,+ &records,+ )+ .await+ .unwrap();assert_eq!(stored_count, 2);let docs = stored(&engine,@@ -125,7 +132,7 @@ fn source_id_for_toolkit_prefers_the_configured_source() {target: "gmail".into(),label: "Gmail".into(),schedule_mins: None,- namespace: None,+ namespace: None,});config.memory@@ -136,7 +143,7 @@ fn source_id_for_toolkit_prefers_the_configured_source() {target: "notion".into(),label: "Folder named like a toolkit".into(),schedule_mins: None,- namespace: None,+ namespace: None,});assert_eq!(source_id_for_toolkit(&config, "GMAIL"), "src-gmail");assert_eq!(source_id_for_toolkit(&config, "notion"), "composio:notion");@@ -193,7 +200,7 @@ async fn sync_toolkit_without_a_connector_is_an_error_not_a_panic() {target: "gmail".into(),label: "Gmail".into(),schedule_mins: None,- namespace: None,+ namespace: None,};assert!(sync_toolkit(&config, &bound, &source).await.is_err());}diff --git a/crates/openhuman-core/src/memory/sources/mod_tests.rs b/crates/openhuman-core/src/memory/sources/mod_tests.rsindex 287b31bb6b..525b102ca8 100644--- a/crates/openhuman-core/src/memory/sources/mod_tests.rs+++ b/crates/openhuman-core/src/memory/sources/mod_tests.rs@@ -10,7 +10,7 @@ fn add_params(kind: &str, target: &str) -> SourcesAddParams {target: target.to_string(),label: None,schedule_mins: None,- namespace: None,+ namespace: None,}}@@ -21,7 +21,7 @@ fn source(id: &str, mins: Option<u32>) -> MemorySourceConfig {target: "/tmp/x".to_string(),label: id.to_string(),schedule_mins: mins,- namespace: None,+ namespace: None,}}@@ -278,7 +278,10 @@ fn a_source_can_store_at_an_agent_node() {let mut bad = add_params("link", "https://example.com/b");bad.namespace = Some("nope".into());- assert_eq!(apply_add(&mut config, &bad).unwrap_err().code(), INVALID_REQUEST);+ assert_eq!(+ apply_add(&mut config, &bad).unwrap_err().code(),+ INVALID_REQUEST+ );let mut hand_edited = source("x", None);hand_edited.namespace = Some("not a node".into());diff --git a/crates/openhuman-core/src/memory/sources/sync_tests.rs b/crates/openhuman-core/src/memory/sources/sync_tests.rsindex 07ba991def..153b27b30c 100644--- a/crates/openhuman-core/src/memory/sources/sync_tests.rs+++ b/crates/openhuman-core/src/memory/sources/sync_tests.rs@@ -11,7 +11,7 @@ fn folder_source(id: &str, dir: &std::path::Path, mins: Option<u32>) -> MemorySotarget: dir.display().to_string(),label: id.to_string(),schedule_mins: mins,- namespace: None,+ namespace: None,}}@@ -49,7 +49,7 @@ fn reader_entry_maps_every_kind() {target: target.into(),label: "L".into(),schedule_mins: None,- namespace: None,+ namespace: None,};let folder = reader_entry(&mk(MemorySourceKind::Folder, "/p")).unwrap()@@ -257,13 +257,27 @@ async fn store_all_skips_a_bad_item_but_fails_when_nothing_stored() {tinymemory::MemoryMeta::default(),);assert_eq!(- store_all(&bound, vec![bad.clone(), good], "src", &tinymemory::Namespace::ROOT)+ store_all(+ &bound,+ vec![bad.clone(), good],+ "src",+ &tinymemory::Namespace::ROOT+ )+ .await+ .unwrap(),+ 1+ );+ assert!(+ store_all(&bound, vec![bad], "src", &tinymemory::Namespace::ROOT)+ .await+ .is_err()+ );+ assert_eq!(+ store_all(&bound, Vec::new(), "src", &tinymemory::Namespace::ROOT).await.unwrap(),- 1+ 0);- assert!(store_all(&bound, vec![bad], "src", &tinymemory::Namespace::ROOT).await.is_err());- assert_eq!(store_all(&bound, Vec::new(), "src", &tinymemory::Namespace::ROOT).await.unwrap(), 0);}#[test]diff --git a/crates/openhuman-core/src/memory/tools.rs b/crates/openhuman-core/src/memory/tools.rsindex 3eef187c29..3b1e7ea6ac 100644--- a/crates/openhuman-core/src/memory/tools.rs+++ b/crates/openhuman-core/src/memory/tools.rs@@ -120,7 +120,9 @@ impl CallFacts {// parent context's agent, else the root.crate::agent::harness::fork_context::current_parent().map_or_else(super::scope::MemoryIdentity::root,- |parent| super::scope::MemoryIdentity::for_agent(config, &parent.agent_definition_id),+ |parent| {+ super::scope::MemoryIdentity::for_agent(config, &parent.agent_definition_id)+ },)});Self {@@ -216,9 +218,9 @@ pub async fn run_action(config: &Config, args: &Value, facts: &CallFacts) -> TooOk(mut params) => {confine(&mut params.filter, facts);ops::fetch(config, params)- .await- .map(|view| json!(view))- .map_err(render_error)+ .await+ .map(|view| json!(view))+ .map_err(render_error)}Err(error) => Err(error),},@@ -245,9 +247,9 @@ pub async fn run_action(config: &Config, args: &Value, facts: &CallFacts) -> TooOk(mut params) => {params.reach = Some(facts.reach.clone());ops::forget(config, params)- .await- .map(|view| json!(view))- .map_err(render_error)+ .await+ .map(|view| json!(view))+ .map_err(render_error)}Err(error) => Err(error),},diff --git a/crates/openhuman-core/src/memory/tools_tests.rs b/crates/openhuman-core/src/memory/tools_tests.rsindex fcd1be9328..9c7ad58ed1 100644--- a/crates/openhuman-core/src/memory/tools_tests.rs+++ b/crates/openhuman-core/src/memory/tools_tests.rs@@ -1,8 +1,8 @@use super::*;+use crate::memory::scope::MemoryIdentity;use crate::memory::test_fixtures::{bind_reference, config_in, stored};use std::collections::HashSet;use std::path::{Path, PathBuf};-use crate::memory::scope::MemoryIdentity;use tinymemory::{ItemKind, MetaFilter, Namespace};struct Ctx {@@ -359,8 +359,18 @@ async fn agents_keep_their_own_memory_and_share_on_request() {}};learn(facts(), "the main agent knows the deploy day", false).await;- learn(facts_of("researcher"), "the researcher prefers arxiv", false).await;- learn(facts_of("writer"), "the writer drafts in british english", false).await;+ learn(+ facts_of("researcher"),+ "the researcher prefers arxiv",+ false,+ )+ .await;+ learn(+ facts_of("writer"),+ "the writer drafts in british english",+ false,+ )+ .await;learn(facts_of("writer"), "the user is called Sam", true).await;let all = stored(&engine, MetaFilter::kinds([ItemKind::Learning])).await;@@ -370,12 +380,19 @@ async fn agents_keep_their_own_memory_and_share_on_request() {.map(|hit| (hit.meta.namespace.to_string(), hit.meta.agent_id.clone())).unwrap()};- assert_eq!(at("deploy day"), ("root".into(), Some("orchestrator".into())));+ assert_eq!(+ at("deploy day"),+ ("root".into(), Some("orchestrator".into()))+ );assert_eq!(at("arxiv"),("agent:researcher".into(), Some("researcher".into())));- assert_eq!(at("Sam"), ("root".into(), Some("writer".into())), "shared to the root");+ assert_eq!(+ at("Sam"),+ ("root".into(), Some("writer".into())),+ "shared to the root"+ );let fetched = run_action(&config,@@ -387,7 +404,10 @@ async fn agents_keep_their_own_memory_and_share_on_request() {assert!(body.contains("arxiv"), "{body}");assert!(body.contains("deploy day"), "root memory is inherited");assert!(body.contains("Sam"), "shared learnings are inherited");- assert!(!body.contains("british english"), "a sibling's memory is out of reach: {body}");+ assert!(+ !body.contains("british english"),+ "a sibling's memory is out of reach: {body}"+ );let writers = stored(&engine, MetaFilter::default()).await@@ -400,7 +420,11 @@ async fn agents_keep_their_own_memory_and_share_on_request() {&facts_of("researcher"),).await;- assert!(forgot.text().contains("\"forgotten\":0"), "{}", forgot.text());+ assert!(+ forgot.text().contains("\"forgotten\":0"),+ "{}",+ forgot.text()+ );assert_eq!(stored(&engine, MetaFilter::default()).await@@ -410,10 +434,8 @@ async fn agents_keep_their_own_memory_and_share_on_request() {1,"a sibling's item is not forgotten");- assert!(- stored(&engine, MetaFilter::default())- .await- .iter()- .all(|hit| hit.meta.namespace != Namespace::agent("nobody"))- );+ assert!(stored(&engine, MetaFilter::default())+ .await+ .iter()+ .all(|hit| hit.meta.namespace != Namespace::agent("nobody")));}diff --git a/tests/memory_v2_e2e.rs b/tests/memory_v2_e2e.rsindex 548c5aee1b..ad12c75071 100644--- a/tests/memory_v2_e2e.rs+++ b/tests/memory_v2_e2e.rs@@ -1378,8 +1378,14 @@ async fn agent_namespaces_keep_memory_apart_over_rpc() {).await;let ids = ids_of(&listed, "items");- assert!(ids.contains(&shared) && ids.contains(&researcher), "{listed}");- assert!(!ids.contains(&writer), "a sibling is out of reach: {listed}");+ assert!(+ ids.contains(&shared) && ids.contains(&researcher),+ "{listed}"+ );+ assert!(+ !ids.contains(&writer),+ "a sibling is out of reach: {listed}"+ );// `get` and `forget` within a reach leave the sibling's item alone.let got = f