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: apply rustfmt formatting across transcript and thread modules
Steven Enamakeldc168b77ae6d
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 a7a7e73dfc..cbb1404a99 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@@ -435,7 +435,8 @@ async fn runtime_adapter_passes_host_context_commits_before_finalize_and_emits_o[SessionTerminal::Completed(_)]));assert!(- locator.latest_for_agent("adapter-test").is_some() || locator.root_for_thread("thread-1").is_some(),+ locator.latest_for_agent("adapter-test").is_some()+ || locator.root_for_thread("thread-1").is_some(),"commit precedes finalization");}diff --git a/crates/openhuman-core/src/agent/session_host/transcript_compat_tests.rs b/crates/openhuman-core/src/agent/session_host/transcript_compat_tests.rsindex 0bae22d5fa..39dcbd26d3 100644--- a/crates/openhuman-core/src/agent/session_host/transcript_compat_tests.rs+++ b/crates/openhuman-core/src/agent/session_host/transcript_compat_tests.rs@@ -262,7 +262,10 @@ pub(super) fn store_tree(};for generation in locator.session_chain(session) {if let Some(read) = locator.read_session_transcript(&generation) {- put(tinyagents_session::transcript::session_stem(&generation), read);+ put(+ tinyagents_session::transcript::session_stem(&generation),+ read,+ );}}if let Some(found) = locator.thread_transcripts(thread, None) {@@ -287,7 +290,10 @@ pub(super) fn place_fixture(root: &Path, scenario: &Scenario, stem: &str, varian);}Layout::Chain => {- place(fixture(&format!("{name}.g0.jsonl")), classic_path(root, stem));+ place(+ fixture(&format!("{name}.g0.jsonl")),+ classic_path(root, stem),+ );place(fixture(&format!("{name}.g1.jsonl")),classic_path(root, &format!("{stem}.g1")),diff --git a/crates/openhuman-core/src/agent/session_host/transcript_resume_stable_tests.rs b/crates/openhuman-core/src/agent/session_host/transcript_resume_stable_tests.rsindex 32bc0bb36b..3eaf37f036 100644--- a/crates/openhuman-core/src/agent/session_host/transcript_resume_stable_tests.rs+++ b/crates/openhuman-core/src/agent/session_host/transcript_resume_stable_tests.rs@@ -13,7 +13,11 @@ use super::transcript_compat_tests::{SCENARIOS,};-fn tree(root: &Path, thread: &str, host: &crate::agent::OpenHumanSessionHost) -> BTreeMap<String, Value> {+fn tree(+ root: &Path,+ thread: &str,+ host: &crate::agent::OpenHumanSessionHost,+) -> BTreeMap<String, Value> {store_tree(root, thread, host.session.as_ref().expect("bound session"))}@@ -61,7 +65,10 @@ fn a_legacy_workspace_is_adopted_once_and_the_next_process_resumes_in_place() {.iter().map(|stem| {let history = locator- .open_stem(stem, crate::agent::session_store::splice_fixture::blank_meta())+ .open_stem(+ stem,+ crate::agent::session_store::splice_fixture::blank_meta(),+ ).expect("bind a legacy stem");serde_json::to_value(history.messages().expect("read a legacy root")).expect("rows")@@ -76,7 +83,9 @@ fn a_legacy_workspace_is_adopted_once_and_the_next_process_resumes_in_place() {let stem = host.session_id().expect("bound session id");place_fixture(root.path(), scenario, &stem, "");imported = legacy_rows(root.path());- assert!(imported.iter().all(|rows| !rows.as_array().unwrap().is_empty()));+ assert!(imported+ .iter()+ .all(|rows| !rows.as_array().unwrap().is_empty()));assert!(host.resume_bound_session().await.expect("first resume"));after_first = tree(root.path(), &thread, &host);}@@ -87,7 +96,9 @@ fn a_legacy_workspace_is_adopted_once_and_the_next_process_resumes_in_place() {"legacy roots must stay as imported");assert!(- after_first.keys().any(|stem| !legacy_stems.contains(&stem.as_str())),+ after_first+ .keys()+ .any(|stem| !legacy_stems.contains(&stem.as_str())),"adopted transcript written");diff --git a/crates/openhuman-core/src/agent/session_host/typed_transcript_compat_tests.rs b/crates/openhuman-core/src/agent/session_host/typed_transcript_compat_tests.rsindex 0c95afbc32..ded7073a80 100644--- a/crates/openhuman-core/src/agent/session_host/typed_transcript_compat_tests.rs+++ b/crates/openhuman-core/src/agent/session_host/typed_transcript_compat_tests.rs@@ -16,8 +16,8 @@//! The `.typed` files were derived once with the retired file writer; they are//! committed corpus now.-use serde_json::{json, Value};use crate::agent::session_store::splice_fixture::head_of;+use serde_json::{json, Value};use tinyagents_session::transcript::TranscriptLocator as _;use tinyinference_llm::message::ContentBlock;use tinyinference_llm::model::ModelResponse;diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_exec_tests.rs b/crates/openhuman-core/src/agent/tinyagents/turn_exec_tests.rsindex 230301a161..d8959d27f9 100644--- a/crates/openhuman-core/src/agent/tinyagents/turn_exec_tests.rs+++ b/crates/openhuman-core/src/agent/tinyagents/turn_exec_tests.rs@@ -591,7 +591,8 @@ async fn session_screens_the_new_input_but_not_a_replayed_tool_results_row() {// Splice a text-dialect `[Tool results]` round that scores Blocked into the// transcript the real writer produced, as an earlier admitted turn.- let head = crate::agent::session_store::splice_fixture::head_of(&locator, "thread-replayed-results");+ let head =+ crate::agent::session_store::splice_fixture::head_of(&locator, "thread-replayed-results");let mut messages = head.messages.clone();messages.extend([tinyagents_session::transcript::TranscriptMessage::user("look it up"),diff --git a/crates/openhuman-core/src/config/migrations/mod_tests.rs b/crates/openhuman-core/src/config/migrations/mod_tests.rsindex d43e024648..4234363c1c 100644--- a/crates/openhuman-core/src/config/migrations/mod_tests.rs+++ b/crates/openhuman-core/src/config/migrations/mod_tests.rs@@ -1,10 +1,10 @@use super::*;+use crate::util::classic_transcript_fixture::{read_classic_rows, write_classic};use std::fs;use std::path::Path;use tempfile::TempDir;use tinyagents_session::transcript::TranscriptMessage;use tinyagents_session::transcript::TranscriptMeta;-use crate::util::classic_transcript_fixture::{read_classic_rows, write_classic};fn durable_messages(messages: impl IntoIterator<Item = TranscriptMessage>,diff --git a/crates/openhuman-core/src/config/migrations/phase_out_profile_md_tests.rs b/crates/openhuman-core/src/config/migrations/phase_out_profile_md_tests.rsindex b344ae3cf1..8efc858527 100644--- a/crates/openhuman-core/src/config/migrations/phase_out_profile_md_tests.rs+++ b/crates/openhuman-core/src/config/migrations/phase_out_profile_md_tests.rs@@ -1,9 +1,9 @@use super::*;+use crate::util::classic_transcript_fixture::{read_classic_rows, write_classic};use std::fs;use tempfile::TempDir;use tinyagents_session::transcript::TranscriptMessage;use tinyagents_session::transcript::TranscriptMeta;-use crate::util::classic_transcript_fixture::{read_classic_rows, write_classic};fn durable_messages(messages: impl IntoIterator<Item = TranscriptMessage>,@@ -176,7 +176,10 @@ fn sanitize_only_touches_first_system_message() {);let rows = read_classic_rows(&path);- assert!(!rows[0]["content"].as_str().unwrap().contains("### PROFILE.md"));+ assert!(!rows[0]["content"]+ .as_str()+ .unwrap()+ .contains("### PROFILE.md"));assert!(rows.iter().any(|m| {m["role"] == "user" && m["content"].as_str().unwrap().contains("### PROFILE.md")}));diff --git a/crates/openhuman-core/src/storage/import/sessions_tests.rs b/crates/openhuman-core/src/storage/import/sessions_tests.rsindex 993cf7d503..0edb5b1d1b 100644--- a/crates/openhuman-core/src/storage/import/sessions_tests.rs+++ b/crates/openhuman-core/src/storage/import/sessions_tests.rs@@ -1,10 +1,10 @@use super::*;use crate::storage::rusqlite;use crate::storage::MemoryStorage;+use crate::util::classic_transcript_fixture::write_classic;use sha2::Digest as _;use std::collections::BTreeMap;use tempfile::TempDir;-use crate::util::classic_transcript_fixture::write_classic;use tinyagents_session::transcript::{TranscriptMessage, TranscriptMeta};use tinyagents_session::turn_state::TurnState;diff --git a/crates/openhuman-core/src/threads/ops/edit.rs b/crates/openhuman-core/src/threads/ops/edit.rsindex d2c0b70366..ba1386f75c 100644--- a/crates/openhuman-core/src/threads/ops/edit.rs+++ b/crates/openhuman-core/src/threads/ops/edit.rs@@ -90,7 +90,9 @@ pub async fn edit_message(let dir = workspace_dir().await.map_err(ThreadsError::Message)?;// The request's own tenant picks the store key, so a SaaS profile edits// the transcript its turns were written to.- let store = transcript_store(ctx, &thread_id).await.map_err(ThreadsError::Message)?;+ let store = transcript_store(ctx, &thread_id)+ .await+ .map_err(ThreadsError::Message)?;crate::web_chat::cancel_chat_scoped(ctx, &client_id, &thread_id, None).await@@ -157,7 +159,9 @@ pub async fn regenerate(let dir = workspace_dir().await.map_err(ThreadsError::Message)?;// The request's own tenant picks the store key, so a SaaS profile edits// the transcript its turns were written to.- let store = transcript_store(ctx, &thread_id).await.map_err(ThreadsError::Message)?;+ let store = transcript_store(ctx, &thread_id)+ .await+ .map_err(ThreadsError::Message)?;crate::web_chat::cancel_chat_scoped(ctx, &client_id, &thread_id, None).awaitdiff --git a/crates/openhuman-core/src/threads/ops/edit_tests.rs b/crates/openhuman-core/src/threads/ops/edit_tests.rsindex 55e5d2e226..778330c6c6 100644--- a/crates/openhuman-core/src/threads/ops/edit_tests.rs+++ b/crates/openhuman-core/src/threads/ops/edit_tests.rs@@ -380,7 +380,9 @@ async fn transcript_store_reads_the_profile_from_the_request_context() {.profile("profile-b");let ctx = DispatchCtx::new(CoreContext::for_test(DomainSet::full(), None).derive_with(overlay));- let store = transcript_store(&ctx, "any-thread").await.expect("resolve the store");+ let store = transcript_store(&ctx, "any-thread")+ .await+ .expect("resolve the store");assert_eq!(store.key, "profile-b~default");assert_eq!(store.workspace_dir, dir.path());}diff --git a/crates/openhuman-core/src/threads/ops/transcript_tests.rs b/crates/openhuman-core/src/threads/ops/transcript_tests.rsindex 5e811d2e90..49aaa6cd3c 100644--- a/crates/openhuman-core/src/threads/ops/transcript_tests.rs+++ b/crates/openhuman-core/src/threads/ops/transcript_tests.rs@@ -217,7 +217,10 @@ async fn changing_the_chat_agent_does_not_strand_an_existing_threads_turns() {.await.unwrap().key;- assert_ne!(rule_before, rule_after, "the chat agent flip changes the key");+ assert_ne!(+ rule_before, rule_after,+ "the chat agent flip changes the key"+ );// The first session on the thread records its key, then writes under it.let recorded = crate::threads::store::bind_transcript_key(diff --git a/crates/openhuman-core/src/threads/store/transcript_key.rs b/crates/openhuman-core/src/threads/store/transcript_key.rsindex f346130f16..12ad20b3eb 100644--- a/crates/openhuman-core/src/threads/store/transcript_key.rs+++ b/crates/openhuman-core/src/threads/store/transcript_key.rs@@ -53,10 +53,7 @@ impl ConversationStore {let recorded = repo.run(|docs| async move {let body: Value = json!({ "key": wanted });- match docs- .put(COLLECTION, &id, body, Precondition::Absent)- .await- {+ match docs.put(COLLECTION, &id, body, Precondition::Absent).await {Ok(_) => Ok(None),Err(error) if error.kind() == ErrorKind::Conflict => {let stored = docs.get(COLLECTION, &id).await?;@@ -84,11 +81,9 @@ impl ConversationStore {pub(super) fn forget_transcript_key(&self, thread_id: &str) {let outcome = self.key_repo().and_then(|repo| {let id = thread_id.to_string();- repo.run(|docs| async move {- docs.delete(COLLECTION, &id, Precondition::None).await- })- .map(|_| ())- .map_err(|e| format!("{e:#}"))+ repo.run(|docs| async move { docs.delete(COLLECTION, &id, Precondition::None).await })+ .map(|_| ())+ .map_err(|e| format!("{e:#}"))});if let Err(error) = outcome {log::warn!("{LOG_PREFIX} forget failed: {error}");diff --git a/crates/openhuman-core/src/threads/store/transcript_key_tests.rs b/crates/openhuman-core/src/threads/store/transcript_key_tests.rsindex 40c46475f1..2efe48664f 100644--- a/crates/openhuman-core/src/threads/store/transcript_key_tests.rs+++ b/crates/openhuman-core/src/threads/store/transcript_key_tests.rs@@ -16,12 +16,16 @@ fn the_first_recorded_key_wins() {let dir = tempfile::tempdir().unwrap();let store = store(&dir);assert_eq!(- store.record_transcript_key("thread-a", "orchestrator").unwrap(),+ store+ .record_transcript_key("thread-a", "orchestrator")+ .unwrap(),"orchestrator");// A later session under another chat agent keeps the original key.assert_eq!(- store.record_transcript_key("thread-a", "researcher").unwrap(),+ store+ .record_transcript_key("thread-a", "researcher")+ .unwrap(),"orchestrator");assert_eq!(@@ -47,10 +51,16 @@ fn deleting_a_thread_forgets_its_key() {working_dir: None,}).unwrap();- store.record_transcript_key("thread-a", "orchestrator").unwrap();- store.record_transcript_key("thread-b", "orchestrator").unwrap();+ store+ .record_transcript_key("thread-a", "orchestrator")+ .unwrap();+ store+ .record_transcript_key("thread-b", "orchestrator")+ .unwrap();- assert!(store.delete_thread("thread-a", "2026-01-02T00:00:00Z").unwrap());+ assert!(store+ .delete_thread("thread-a", "2026-01-02T00:00:00Z")+ .unwrap());assert_eq!(store.transcript_key("thread-a").unwrap(), None);assert!(store.transcript_key("thread-b").unwrap().is_some());@@ -58,7 +68,9 @@ fn deleting_a_thread_forgets_its_key() {assert_eq!(store.transcript_key("thread-b").unwrap(), None);// A recreated thread records afresh.assert_eq!(- store.record_transcript_key("thread-a", "researcher").unwrap(),+ store+ .record_transcript_key("thread-a", "researcher")+ .unwrap(),"researcher");}diff --git a/crates/openhuman-core/src/threads/transcript_host_tests.rs b/crates/openhuman-core/src/threads/transcript_host_tests.rsindex 826c5488f8..3eb4bcbedf 100644--- a/crates/openhuman-core/src/threads/transcript_host_tests.rs+++ b/crates/openhuman-core/src/threads/transcript_host_tests.rs@@ -17,7 +17,10 @@ use tinyagents_session::transcript::TranscriptMessage;use tinyagents_session::transcript::{self, TranscriptLocator};/// A thread's display records, read back through the store port.-fn display_of(locator: &Arc<dyn TranscriptLocator>, thread_id: &str) -> transcript::DisplaySessionTranscript {+fn display_of(+ locator: &Arc<dyn TranscriptLocator>,+ thread_id: &str,+) -> transcript::DisplaySessionTranscript {locator.root_for_thread(thread_id).expect("the thread has a root transcript")diff --git a/crates/openhuman-core/src/web_chat/session.rs b/crates/openhuman-core/src/web_chat/session.rsindex 3343c0b2c9..cbf4b406a4 100644--- a/crates/openhuman-core/src/web_chat/session.rs+++ b/crates/openhuman-core/src/web_chat/session.rs@@ -475,7 +475,14 @@ pub(crate) async fn checkout_session_agent(// reused agent may have been built under a different one, and `None`// (English, or no locale sent) must clear a stale instruction.let mut agent = agent;- bind_transcript_store(ctx, config, thread_id, &fingerprint.target_agent_id, &mut agent).await;+ bind_transcript_store(+ ctx,+ config,+ thread_id,+ &fingerprint.target_agent_id,+ &mut agent,+ )+ .await;let directive = match locale.and_then(locale_reply_directive) {Some(directive) => Some(directive),// Messages this session already sent carry another language'sdiff --git a/crates/openhuman-embed/src/agent/layout.rs b/crates/openhuman-embed/src/agent/layout.rsindex 88fa66e2f3..a7d7c8bc0c 100644--- a/crates/openhuman-embed/src/agent/layout.rs+++ b/crates/openhuman-embed/src/agent/layout.rs@@ -43,10 +43,7 @@ impl AgentLayout {Self {home: workspace_dir.join("agents").join(id),skills: workspace_dir.join("agents").join(id).join("skills"),- transcripts: workspace_dir- .join("agents")- .join(id)- .join("session_raw"),+ transcripts: workspace_dir.join("agents").join(id).join("session_raw"),action_dir,}}diff --git a/crates/openhuman-embed/tests/harness_embed.rs b/crates/openhuman-embed/tests/harness_embed.rsindex b159411624..68e89a402f 100644--- a/crates/openhuman-embed/tests/harness_embed.rs+++ b/crates/openhuman-embed/tests/harness_embed.rs@@ -211,12 +211,10 @@ fn a_harness_runs_a_turn_against_the_provider_it_was_given() {// The first session's transcript landed in the harness agent's// own store under the workspace (the path-based transcript files// are gone). A harness session id is its thread id.- let transcripts = tinyagents_session::port::WorkspaceStores::open(- &workspace_dir,- "harness",- )- .expect("the harness agent's workspace store")- .transcripts();+ let transcripts =+ tinyagents_session::port::WorkspaceStores::open(&workspace_dir, "harness")+ .expect("the harness agent's workspace store")+ .transcripts();assert!(transcripts.root_for_thread(&first.session_id).is_some(),"the first session's transcript was not persisted"diff --git a/tests/storage_desktop_upgrade_e2e.rs b/tests/storage_desktop_upgrade_e2e.rsindex 18836b1b09..ef3e8907f0 100644--- a/tests/storage_desktop_upgrade_e2e.rs+++ b/tests/storage_desktop_upgrade_e2e.rs@@ -27,9 +27,7 @@ use openhuman_core::config::Config;use openhuman_core::storage::import::{self, Outcome};use openhuman_core::storage::{rusqlite, DocumentStoreExt, Scope, ScopedStorage, StorageBackend};use sha2::Digest;-use tinyagents_session::transcript::{- session_stem, SessionRef, TranscriptMessage, TranscriptMeta,-};+use tinyagents_session::transcript::{session_stem, SessionRef, TranscriptMessage, TranscriptMeta};use tinyagents_session::turn_state::TurnState;use tinystoragedrivers_core::Query;