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
style: apply rustfmt formatting across core modules
Steven Enamakel433ecf73c7ab
diff --git a/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs b/crates/openhuman-core/src/agent/subagent_host/lifecycle.rsindex 059c6a89b5..0f0382036f 100644--- a/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs+++ b/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs@@ -595,9 +595,8 @@ impl OpenHumanPersistence {) -> Result<Option<(String, u64)>, SubagentError> {let record = self.store()?.record(key)?;if let Some(terminal) = record.terminal {- return Ok(- (!terminal.agent_id.is_empty()).then_some((terminal.agent_id, terminal.elapsed_ms))- );+ return Ok((!terminal.agent_id.is_empty())+ .then_some((terminal.agent_id, terminal.elapsed_ms)));}Ok(Self::pause_of(&record, key)?.and_then(|checkpoint| {(!checkpoint.agent_id.is_empty())diff --git a/crates/openhuman-core/src/agent/subagent_host/lifecycle_store.rs b/crates/openhuman-core/src/agent/subagent_host/lifecycle_store.rsindex 5b32a9b038..032e64cd34 100644--- a/crates/openhuman-core/src/agent/subagent_host/lifecycle_store.rs+++ b/crates/openhuman-core/src/agent/subagent_host/lifecycle_store.rs@@ -275,9 +275,7 @@ fn import_legacy(kv: &StateKv, dir: &Path) -> anyhow::Result<()> {let value: serde_json::Value = match serde_json::from_slice(&bytes) {Ok(value) => value,Err(error) => {- log::warn!(- "[subagent:lifecycle] legacy index {component} unparsable ({error})"- );+ log::warn!("[subagent:lifecycle] legacy index {component} unparsable ({error})");continue;}};diff --git a/crates/openhuman-core/src/agent/subagent_host/lifecycle_store_tests.rs b/crates/openhuman-core/src/agent/subagent_host/lifecycle_store_tests.rsindex ce12f33a56..fea2bdd60e 100644--- a/crates/openhuman-core/src/agent/subagent_host/lifecycle_store_tests.rs+++ b/crates/openhuman-core/src/agent/subagent_host/lifecycle_store_tests.rs@@ -48,7 +48,9 @@ fn a_legacy_lifecycle_directory_is_imported_once_and_left_in_place() {let record = store.record(&paused).unwrap();assert_eq!(record.pause.unwrap().question, "which one?");assert_eq!(store.index_keys("task-a").unwrap(), vec![paused.clone()]);- assert!(lifecycle.join(format!("{component}.pause.json")).exists());+ assert!(lifecycle+ .join(format!("{component}.pause.json"))+ .exists());// A later change is not undone by reopening, which does not import again.store@@ -76,10 +78,7 @@ fn a_legacy_bare_terminal_outcome_is_read_as_a_terminal_record() {.unwrap();std::fs::write(lifecycle.join("notes.txt"), "not a lifecycle file").unwrap();- let record = LifecycleStore::open(dir.path())- .unwrap()- .record(&done)- .unwrap();+ let record = LifecycleStore::open(dir.path()).unwrap().record(&done).unwrap();let terminal = record.terminal.unwrap();assert_eq!(terminal.outcome.output, "finished");assert!(terminal.agent_id.is_empty());@@ -92,10 +91,7 @@ fn the_default_checkpoint_directory_belongs_to_its_workspace() {workspace_of(&workspace.join(".openhuman/subagent_checkpoints")),workspace);- assert_eq!(- workspace_of(std::path::Path::new("/x/y")),- std::path::Path::new("/x/y")- );+ assert_eq!(workspace_of(std::path::Path::new("/x/y")), std::path::Path::new("/x/y"));}#[test]diff --git a/crates/openhuman-core/src/config/schema/load/dirs.rs b/crates/openhuman-core/src/config/schema/load/dirs.rsindex d756f1fb58..39ce8ae46d 100644--- a/crates/openhuman-core/src/config/schema/load/dirs.rs+++ b/crates/openhuman-core/src/config/schema/load/dirs.rs@@ -436,8 +436,7 @@ pub(super) async fn resolve_config_dirs_ignoring_env(if let Some(user_id) = read_active_user_id_checked_async(default_openhuman_dir).await? {// The shared profile layout (`users/<id>/{config.toml,workspace}`),// the same one a SaaS core lays its profiles out with.- let profile =- crate::config::schema::ProfileLayout::resolve(default_openhuman_dir, &user_id);+ let profile = crate::config::schema::ProfileLayout::resolve(default_openhuman_dir, &user_id);tracing::debug!(user_id = %user_id,user_dir = %profile.dir.display(),@@ -460,8 +459,9 @@ pub(super) async fn resolve_config_dirs_ignoring_env());}- let profile =- crate::config::schema::ProfileLayout::resolve_at(pre_login_user_dir(default_openhuman_dir));+ let profile = crate::config::schema::ProfileLayout::resolve_at(pre_login_user_dir(+ default_openhuman_dir,+ ));tracing::debug!(user_id = %PRE_LOGIN_USER_ID,user_dir = %profile.dir.display(),diff --git a/crates/openhuman-core/src/config/schema/load_profile_layout_parity_tests.rs b/crates/openhuman-core/src/config/schema/load_profile_layout_parity_tests.rsindex f75a7f3924..eae5490b69 100644--- a/crates/openhuman-core/src/config/schema/load_profile_layout_parity_tests.rs+++ b/crates/openhuman-core/src/config/schema/load_profile_layout_parity_tests.rs@@ -52,10 +52,7 @@ async fn a_fresh_pre_login_profile_resolves_to_the_v2_layout() {assert_eq!(config_dir, layout.dir);assert_eq!(workspace_dir, layout.workspace_dir);assert_eq!(config_dir, root.join("users").join("local"));- assert_eq!(- workspace_dir,- root.join("users").join("local").join("files")- );+ assert_eq!(workspace_dir, root.join("users").join("local").join("files"));assert!(config_dir.join(".layout").is_file());}diff --git a/crates/openhuman-core/src/memory/deletion_tests.rs b/crates/openhuman-core/src/memory/deletion_tests.rsindex 531023ad66..ed48c0d53b 100644--- a/crates/openhuman-core/src/memory/deletion_tests.rs+++ b/crates/openhuman-core/src/memory/deletion_tests.rs@@ -104,3 +104,4 @@ async fn a_blank_thread_id_queues_nothing() {assert_eq!(forget_thread(&config, " ").await, 0);assert!(pending(&config.workspace_dir).is_empty());}+diff --git a/crates/openhuman-core/src/memory/lifecycle/jobs_tests.rs b/crates/openhuman-core/src/memory/lifecycle/jobs_tests.rsindex 29d31f175d..9899ca1761 100644--- a/crates/openhuman-core/src/memory/lifecycle/jobs_tests.rs+++ b/crates/openhuman-core/src/memory/lifecycle/jobs_tests.rs@@ -27,11 +27,9 @@ async fn duplicates_merge_and_the_queue_survives_a_reload() {let queue = snapshot(&config).await;assert_eq!(queue.pending.len(), 3, "one per (root, job)");- assert!(- crate::memory::state_store::load::<JobQueue>(&config.workspace_dir, "jobs")- .unwrap()- .is_some()- );+ assert!(crate::memory::state_store::load::<JobQueue>(&config.workspace_dir, "jobs")+ .unwrap()+ .is_some());}#[tokio::test]@@ -105,11 +103,7 @@ async fn the_build_delay_comes_from_the_recall_config_and_the_file_store_is_the_let stored: JobQueue = crate::memory::state_store::load(&config.workspace_dir, "jobs").unwrap().unwrap();- assert_eq!(- stored.pending.len(),- 1,- "persisted in the memory state store"- );+ assert_eq!(stored.pending.len(), 1, "persisted in the memory state store");assert!(run(&config, Selection::Due).await.unwrap().is_empty());}diff --git a/crates/openhuman-core/src/memory/local_root_tests.rs b/crates/openhuman-core/src/memory/local_root_tests.rsindex 70508b0d18..1aea421ca0 100644--- a/crates/openhuman-core/src/memory/local_root_tests.rs+++ b/crates/openhuman-core/src/memory/local_root_tests.rs@@ -126,4 +126,4 @@ fn a_recorded_root_lives_in_the_state_store_not_a_file() {.unwrap().unwrap();assert_eq!(stored.root, root);-}+}\ No newline at end of filediff --git a/crates/openhuman-core/src/memory/tool_writes.rs b/crates/openhuman-core/src/memory/tool_writes.rsindex bd7609dddd..f74be01173 100644--- a/crates/openhuman-core/src/memory/tool_writes.rs+++ b/crates/openhuman-core/src/memory/tool_writes.rs@@ -267,11 +267,7 @@ fn read_file(path: &Path) -> std::io::Result<Vec<Entry>> {fn write_file(file: &Path, entries: &[Entry]) -> std::io::Result<()> {let (workspace, name) = coordinates(file)?;- if serde_json::to_vec(entries)- .map_err(std::io::Error::other)?- .len()- > MAX_BYTES- {+ if serde_json::to_vec(entries).map_err(std::io::Error::other)?.len() > MAX_BYTES {return Err(std::io::Error::other("queue too large"));}super::state_store::save(workspace, name, &entries).map_err(std::io::Error::other)@@ -354,8 +350,8 @@ fn owner_state(config: &Config) -> &'static OwnerState {fn partitions(config: &Config) -> MemoryResult<Vec<PathBuf>> {let prefix = format!("{}-", owner_prefix(config));- let names =- super::state_store::names(&config.workspace_dir, &prefix).map_err(|_| unavailable())?;+ let names = super::state_store::names(&config.workspace_dir, &prefix)+ .map_err(|_| unavailable())?;if names.len() > MAX_PENDING {return Err(unavailable());}diff --git a/crates/openhuman-core/src/memory/tool_writes_tests.rs b/crates/openhuman-core/src/memory/tool_writes_tests.rsindex 2d27a687fc..8eb208dd36 100644--- a/crates/openhuman-core/src/memory/tool_writes_tests.rs+++ b/crates/openhuman-core/src/memory/tool_writes_tests.rs@@ -89,11 +89,7 @@ fn persistence_failure_and_invalid_scope_never_acknowledge_a_write() {let args = json!({"action":"learn","text":"Prefers tea"});assert!(enqueue(&config, &args, &facts).is_err());assert!(!path(&config.workspace_dir).exists());- std::fs::write(- config.workspace_dir.join("storage"),- "blocks the storage directory",- )- .unwrap();+ std::fs::write(config.workspace_dir.join("storage"), "blocks the storage directory").unwrap();assert!(enqueue(&config, &args, &self::facts(&config)).is_err());}diff --git a/crates/openhuman-core/src/modules/site_memory_host.rs b/crates/openhuman-core/src/modules/site_memory_host.rsindex 3f3ee583d9..8e73fc2af2 100644--- a/crates/openhuman-core/src/modules/site_memory_host.rs+++ b/crates/openhuman-core/src/modules/site_memory_host.rs@@ -174,7 +174,10 @@ impl SiteStore {/// Copies the legacy `<site>.json` files of `dir`, dated by their last change/// so the 30-day sweep treats them as before. An existing record wins; a file/// that does not parse, or a copy set aside, is skipped.-fn import_legacy(kv: &crate::storage::state_kv::StateKv, dir: &Path) -> anyhow::Result<()> {+fn import_legacy(+ kv: &crate::storage::state_kv::StateKv,+ dir: &Path,+) -> anyhow::Result<()> {let entries = match std::fs::read_dir(dir) {Ok(entries) => entries,Err(error) if error.kind() == std::io::ErrorKind::NotFound => return Ok(()),diff --git a/crates/openhuman-core/src/modules/site_memory_host_tests.rs b/crates/openhuman-core/src/modules/site_memory_host_tests.rsindex c88ba44421..5bbe40b8e8 100644--- a/crates/openhuman-core/src/modules/site_memory_host_tests.rs+++ b/crates/openhuman-core/src/modules/site_memory_host_tests.rs@@ -79,10 +79,7 @@ async fn legacy_site_files_are_imported_once_dated_by_their_last_change_and_leftlet store = SiteStore::open(dir.path()).unwrap();assert_eq!(store.load("fresh.com").await.unwrap(), memory());assert!(store.load("broken.com").await.unwrap().is_empty());- assert!(- sites.join("fresh.com.json").exists(),- "the legacy file is not touched"- );+ assert!(sites.join("fresh.com.json").exists(), "the legacy file is not touched");// The imported old site is swept like any other that nothing changed.store.sweep();assert!(store.load("old.com").await.unwrap().is_empty());diff --git a/crates/openhuman-core/src/storage/state_kv_tests.rs b/crates/openhuman-core/src/storage/state_kv_tests.rsindex 917076c05c..6a5abbc977 100644--- a/crates/openhuman-core/src/storage/state_kv_tests.rs+++ b/crates/openhuman-core/src/storage/state_kv_tests.rs@@ -74,8 +74,7 @@ fn import_file_copies_a_legacy_file_once_and_leaves_it_in_place() {assert!(legacy.exists(), "the legacy file is not touched");// A later change is not overwritten by a re-import, nor resurrected after a delete.- kv.put("jobs", &BTreeMap::from([("a".to_string(), 9u32)]))- .unwrap();+ kv.put("jobs", &BTreeMap::from([("a".to_string(), 9u32)])).unwrap();std::fs::write(&legacy, r#"{"a": 5}"#).unwrap();kv.import_file("jobs", &legacy).unwrap();assert_eq!(@@ -102,15 +101,13 @@ fn import_file_does_not_replace_an_existing_value() {fn import_file_records_a_missing_or_corrupt_file_without_failing() {let dir = tempfile::tempdir().unwrap();let kv = state(&MemoryStorage::new(), "local");- kv.import_file("none", &dir.path().join("missing.json"))- .unwrap();+ kv.import_file("none", &dir.path().join("missing.json")).unwrap();let corrupt = dir.path().join("bad.json");std::fs::write(&corrupt, "{not json").unwrap();kv.import_file("bad", &corrupt).unwrap();assert!(kv.get::<serde_json::Value>("bad").unwrap().is_none());// A file that shows up after the import was recorded is not imported.std::fs::write(dir.path().join("missing.json"), "1").unwrap();- kv.import_file("none", &dir.path().join("missing.json"))- .unwrap();+ kv.import_file("none", &dir.path().join("missing.json")).unwrap();assert!(kv.get::<u32>("none").unwrap().is_none());}