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(threads): reorder imports and reformat assertions
Steven Enamakel508f6da216bd
diff --git a/crates/openhuman-core/src/agent/message_convert.rs b/crates/openhuman-core/src/agent/message_convert.rsindex 042c758e84..5c5b9aa778 100644--- a/crates/openhuman-core/src/agent/message_convert.rs+++ b/crates/openhuman-core/src/agent/message_convert.rs@@ -26,8 +26,8 @@ use crate::inference::provider::ChatResponse;use tinyagents_runtime::transcript::reasoning_from_content;#[cfg(test)]use tinyagents_runtime::transcript::{- REASONING_EXT_KEY, message_to_display_transcript as message_to_chat_message,- message_to_native_transcript as message_to_native_chat_message,+ message_to_display_transcript as message_to_chat_message,+ message_to_native_transcript as message_to_native_chat_message, REASONING_EXT_KEY,};use tinyagents_session::transcript::TranscriptMessage;diff --git a/crates/openhuman-core/src/agent/message_convert_tests.rs b/crates/openhuman-core/src/agent/message_convert_tests.rsindex b2829a0d93..3466bdfb32 100644--- a/crates/openhuman-core/src/agent/message_convert_tests.rs+++ b/crates/openhuman-core/src/agent/message_convert_tests.rs@@ -61,21 +61,18 @@ fn durable_upload_parts_survive_message_row_replay_without_inline_payloads() {let Message::User(user) = replay else {panic!("user row expected")};- assert!(- user.content- .iter()- .any(|part| matches!(part, ContentBlock::Audio(MediaRef::Path { .. })))- );- assert!(- user.content- .iter()- .any(|part| matches!(part, ContentBlock::Video(MediaRef::Path { .. })))- );- assert!(- user.content- .iter()- .any(|part| matches!(part, ContentBlock::Document(MediaRef::Path { .. })))- );+ assert!(user+ .content+ .iter()+ .any(|part| matches!(part, ContentBlock::Audio(MediaRef::Path { .. }))));+ assert!(user+ .content+ .iter()+ .any(|part| matches!(part, ContentBlock::Video(MediaRef::Path { .. }))));+ assert!(user+ .content+ .iter()+ .any(|part| matches!(part, ContentBlock::Document(MediaRef::Path { .. }))));assert!(!serde_json::to_string(&row).unwrap().contains("base64"));}use tinyinference_llm::model::ModelRequest;@@ -342,12 +339,10 @@ fn reasoning_content_uses_typed_thinking_block_and_round_trips_metadata() {ContentBlock::Thinking { text, signature: None } if text == "private thoughts")}));- assert!(- !assistant- .content- .iter()- .any(|block| matches!(block, ContentBlock::ProviderExtension(_)))- );+ assert!(!assistant+ .content+ .iter()+ .any(|block| matches!(block, ContentBlock::ProviderExtension(_))));let back = message_to_chat_message(&msg).expect("assistant converts");assert_eq!(back.content, "visible answer");diff --git a/crates/openhuman-core/src/agent/session_host/runtime/run_loop.rs b/crates/openhuman-core/src/agent/session_host/runtime/run_loop.rsindex 9646e3d6ac..45662d31af 100644--- a/crates/openhuman-core/src/agent/session_host/runtime/run_loop.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime/run_loop.rs@@ -130,13 +130,8 @@ impl OpenHumanSessionHost {let turn = async {match input {Some(input) => {- self.turn_with_approval_and_message(- message,- input,- origin.as_ref(),- approval,- )- .await+ self.turn_with_approval_and_message(message, input, origin.as_ref(), approval)+ .await}None => {self.turn_with_approval(message, origin.as_ref(), approval)diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session_turn.rs b/crates/openhuman-core/src/agent/session_host/runtime_session_turn.rsindex 6dd1497ee0..2b92031fea 100644--- a/crates/openhuman-core/src/agent/session_host/runtime_session_turn.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime_session_turn.rs@@ -66,7 +66,9 @@ impl OpenHumanSessionHost {let input = match input {Some(input) => input,None => user_message_from_text(- super::attachment_input::stage_turn(self, user_message, origin).await?.as_str(),+ super::attachment_input::stage_turn(self, user_message, origin)+ .await?+ .as_str(),),};let mut context = OpenHumanRunContext::new().with_host_env(&self.host_env);@@ -164,10 +166,7 @@ impl OpenHumanSessionHost {.runtime_session.as_mut().expect("runtime session initialized")- .turn(- SessionTurnRequest::new(input),- options,- );+ .turn(SessionTurnRequest::new(input), options);let outcome = Box::pin(turn).await.map_err(|error| anyhow::anyhow!(error.to_string()))?;diff --git a/crates/openhuman-core/src/threads/artifact_rows_tests.rs b/crates/openhuman-core/src/threads/artifact_rows_tests.rsindex 71e370a47d..569192e1cf 100644--- a/crates/openhuman-core/src/threads/artifact_rows_tests.rs+++ b/crates/openhuman-core/src/threads/artifact_rows_tests.rs@@ -150,31 +150,27 @@ async fn recording_an_artifact_twice_writes_one_row() {let ws = temp_ws();seed_thread(&ws, "t-1");- assert!(- record_artifact_row(- &DispatchCtx::unbound(),- ws.clone(),- "t-1",- "a",- "A",- Some("req-1")- )- .await- .unwrap()- );+ assert!(record_artifact_row(+ &DispatchCtx::unbound(),+ ws.clone(),+ "t-1",+ "a",+ "A",+ Some("req-1")+ )+ .await+ .unwrap());// A new version, a retry or a re-delivered ready event.- assert!(- !record_artifact_row(- &DispatchCtx::unbound(),- ws.clone(),- "t-1",- "a",- "A v2",- Some("req-2")- )- .await- .unwrap()- );+ assert!(!record_artifact_row(+ &DispatchCtx::unbound(),+ ws.clone(),+ "t-1",+ "a",+ "A v2",+ Some("req-2")+ )+ .await+ .unwrap());let rows: Vec<_> =conversations::blocking::get_messages_with_artifact_rows(DispatchCtx::unbound(), ws, "t-1")diff --git a/crates/openhuman-core/src/threads/attachments.rs b/crates/openhuman-core/src/threads/attachments.rsindex afeb4de9c4..3ba4867255 100644--- a/crates/openhuman-core/src/threads/attachments.rs+++ b/crates/openhuman-core/src/threads/attachments.rs@@ -6,7 +6,7 @@//! when a turn is about to execute.use serde::{Deserialize, Serialize};-use serde_json::{Value, json};+use serde_json::{json, Value};use tinychannels_bus::{ContentPart, MediaReference};use crate::agent::attachments::Attachment;@@ -193,7 +193,9 @@ fn stored(metadata: &Value) -> Result<Vec<StoredAttachment>, String> {.map_err(|error| format!("stored attachment metadata is invalid: {error}"))}-fn tenant_for(ctx: &crate::core::runtime::DispatchCtx) -> Result<crate::core::runtime::Tenant, String> {+fn tenant_for(+ ctx: &crate::core::runtime::DispatchCtx,+) -> Result<crate::core::runtime::Tenant, String> {crate::core::runtime::tenant::tenant_in(crate::core::runtime::is_saas(),ctx.resolved().as_deref(),@@ -201,7 +203,10 @@ fn tenant_for(ctx: &crate::core::runtime::DispatchCtx) -> Result<crate::core::ru.map_err(|error| error.to_string())}-fn staged_manifest_path(workspace: &std::path::Path, opaque_id: &str) -> Result<std::path::PathBuf, String> {+fn staged_manifest_path(+ workspace: &std::path::Path,+ opaque_id: &str,+) -> Result<std::path::PathBuf, String> {let uuid = uuid::Uuid::parse_str(opaque_id).map_err(|_| "staged attachment reference is invalid".to_string())?;Ok(workspace@@ -270,7 +275,7 @@ pub(crate) async fn stage_queued_parts(for part in input {if let Some(media) = opaque_media(part) {if media.opaque_id.is_some() {- return Err("queued attachment input must not contain existing opaque refs".into());+ return Err("queued attachment input must not contain existing opaque refs".into());}}}@@ -413,8 +418,7 @@ async fn validate_staged_files(.ok_or_else(|| "staged attachment MIME type is missing".to_string())?;if (is_image && !mime.starts_with("image/"))|| !metadata.is_file()- || metadata.len()- > (if is_image { image_mb } else { file_mb } * 1024 * 1024) as u64+ || metadata.len() > (if is_image { image_mb } else { file_mb } * 1024 * 1024) as u64{return Err("staged attachment exceeds configured type or size limit".into());}@@ -564,11 +568,8 @@ pub(crate) async fn resolve_persisted_parts().await.map_err(|error| format!("stored attachment workspace unavailable: {error}"))?;- let messages = crate::threads::store::get_messages(- ctx,- config.workspace_dir.clone(),- thread_id,- )?;+ let messages =+ crate::threads::store::get_messages(ctx, config.workspace_dir.clone(), thread_id)?;let row = messages.iter().find(|message| message.id == persisted_message_id && message.sender == "user")diff --git a/crates/openhuman-core/src/threads/attachments_tests.rs b/crates/openhuman-core/src/threads/attachments_tests.rsindex cff77adc16..a07e4dd780 100644--- a/crates/openhuman-core/src/threads/attachments_tests.rs+++ b/crates/openhuman-core/src/threads/attachments_tests.rs@@ -48,12 +48,10 @@ fn public_projection_hides_paths_but_keeps_opaque_attachment_refs() {vec![(part.clone(), "uploads/thread/a.png".into())],);assert_eq!(public, vec![part]);- assert!(- metadata[STORAGE_KEY][0]["path"]- .as_str()- .unwrap()- .contains("uploads/")- );+ assert!(metadata[STORAGE_KEY][0]["path"]+ .as_str()+ .unwrap()+ .contains("uploads/"));let projected = public_refs(&metadata);assert_eq!(projected, public);diff --git a/crates/openhuman-core/src/threads/channel_projection.rs b/crates/openhuman-core/src/threads/channel_projection.rsindex c01c3a0ad3..f6e7c48c36 100644--- a/crates/openhuman-core/src/threads/channel_projection.rs+++ b/crates/openhuman-core/src/threads/channel_projection.rs@@ -7,17 +7,17 @@//! guesses from a sender, recent message, or equality between provider and row//! identifiers.-use anyhow::{Context, Result, anyhow};+use anyhow::{anyhow, Context, Result};use serde::{Deserialize, Serialize};-use serde_json::{Value, json};+use serde_json::{json, Value};use sha2::{Digest, Sha256};use tinychannels_bus::{ChannelRef, ConversationRef};use tinystoragedrivers::{CollectionSpec, ErrorKind, Precondition};-use crate::core::runtime::{DispatchCtx, Tenant, tenant::tenant_key};+use crate::core::runtime::{tenant::tenant_key, DispatchCtx, Tenant};use crate::storage::{self,- documents::{Repo, compare_and_swap},+ documents::{compare_and_swap, Repo},};const DOMAIN: &str = "threads::channel_projection";diff --git a/crates/openhuman-core/src/threads/mod.rs b/crates/openhuman-core/src/threads/mod.rsindex 6d7dad583e..b23909aff7 100644--- a/crates/openhuman-core/src/threads/mod.rs+++ b/crates/openhuman-core/src/threads/mod.rs@@ -18,13 +18,13 @@ pub mod turn_state;pub mod welcome_migration;pub mod wire_schema;-pub use error::{THREAD_NOT_FOUND_KIND, ThreadsError};+pub use error::{ThreadsError, THREAD_NOT_FOUND_KIND};pub use rpc_models::*;pub use schemas::{all_controller_schemas as all_threads_controller_schemas,all_registered_controllers as all_threads_registered_controllers,};-pub use welcome_migration::{WelcomeMigrationResult, migrate_welcome_agent_artifacts};+pub use welcome_migration::{migrate_welcome_agent_artifacts, WelcomeMigrationResult};/// Log prefix for thread-title generation (grep-friendly).pub(crate) const THREAD_TITLE_LOG_PREFIX: &str = "[threads:title]";diff --git a/crates/openhuman-core/src/threads/ops.rs b/crates/openhuman-core/src/threads/ops.rsindex 577add69d3..acdbe92188 100644--- a/crates/openhuman-core/src/threads/ops.rs+++ b/crates/openhuman-core/src/threads/ops.rs@@ -21,29 +21,29 @@ pub use crud::{thread_update_labels, thread_update_title, thread_upsert, threads_list, transcript_search,};pub use edit::{- EditMessageRequest, EditOrRegenerateResponse, RegenerateRequest, edit_message, regenerate,+ edit_message, regenerate, EditMessageRequest, EditOrRegenerateResponse, RegenerateRequest,};pub use live_state::{- ThreadGoalGetResponse, ThreadLiveStateRequest, ThreadTodosGetResponse, goal_get, todos_get,+ goal_get, todos_get, ThreadGoalGetResponse, ThreadLiveStateRequest, ThreadTodosGetResponse,};pub use purge::threads_purge;-pub use search::{ThreadSearchHit, ThreadSearchRequest, ThreadSearchResponse, thread_search};+pub use search::{thread_search, ThreadSearchHit, ThreadSearchRequest, ThreadSearchResponse};pub use title_generation::thread_generate_title;-pub use transcript::{TranscriptGetRequest, transcript_get};+pub use transcript::{transcript_get, TranscriptGetRequest};pub use turn_state_ops::{turn_state_clear, turn_state_get, turn_state_get_turn, turn_state_history, turn_state_list,};-pub use usage::{SubagentUsageDto, ThreadTokenUsageRequest, ThreadTokenUsageResponse, token_usage};+pub use usage::{token_usage, SubagentUsageDto, ThreadTokenUsageRequest, ThreadTokenUsageResponse};pub use working_dir::thread_update_working_dir;pub(crate) use working_dir::thread_working_dir;// Test-only re-exports so `use super::*;` in the split-out test modules below// keeps resolving the shared helpers that now live in `support`.#[cfg(test)]-use crate::threads::THREAD_TITLE_LOG_PREFIX;-#[cfg(test)]use crate::threads::store::{ConversationMessage, ConversationThread, CreateConversationThread};#[cfg(test)]+use crate::threads::THREAD_TITLE_LOG_PREFIX;+#[cfg(test)]use crate::threads::{AppendConversationMessageRequest, ConversationMessageRecord, DeleteConversationThreadRequest,EmptyRequest, GenerateConversationThreadTitleRequest,diff --git a/crates/openhuman-core/src/threads/ops/crud.rs b/crates/openhuman-core/src/threads/ops/crud.rsindex 70ec062b8a..63fae7d01c 100644--- a/crates/openhuman-core/src/threads/ops/crud.rs+++ b/crates/openhuman-core/src/threads/ops/crud.rs@@ -5,11 +5,11 @@ use super::support::{counts, envelope, message_to_record, record_to_message, run_to_completion, thread_to_summary,workspace_dir,};-use crate::core::Outcome;use crate::core::runtime::DispatchCtx;-use crate::threads::ThreadsError;+use crate::core::Outcome;use crate::threads::store as conversations;use crate::threads::store::{ConversationMessagePatch, CrossThreadHit};+use crate::threads::ThreadsError;use crate::threads::{ApiEnvelope, AppendConversationMessageRequest, ConversationMessageRecord,ConversationMessagesRequest, ConversationMessagesResponse, ConversationThreadSummary,diff --git a/crates/openhuman-core/src/threads/ops/crud_message_append_tests.rs b/crates/openhuman-core/src/threads/ops/crud_message_append_tests.rsindex c7bd5eb000..1138e537e3 100644--- a/crates/openhuman-core/src/threads/ops/crud_message_append_tests.rs+++ b/crates/openhuman-core/src/threads/ops/crud_message_append_tests.rs@@ -118,55 +118,47 @@ async fn user_append_stages_original_strips_upload_bytes_and_reuses_returned_con.await.unwrap();assert_eq!(persisted.len(), 2);- assert!(- !serde_json::to_string(&persisted)- .unwrap()- .contains("base64,")- );+ assert!(!serde_json::to_string(&persisted)+ .unwrap()+ .contains("base64,"));}#[tokio::test]async fn rejected_upload_never_appends_a_message() {let (_temp, mut config) = setup().await;config.multimodal_files.max_files = 0;- assert!(- append_with_test_config(- request(- "disabled",- "[IMAGE:data:image/png;base64,iVBORw0KGgo=]",- "user"- ),- &config,- None,- )- .await- .is_err()- );+ assert!(append_with_test_config(+ request(+ "disabled",+ "[IMAGE:data:image/png;base64,iVBORw0KGgo=]",+ "user"+ ),+ &config,+ None,+ )+ .await+ .is_err());config.multimodal_files.max_files = 3;- assert!(- append_with_test_config(- request("bad", "[FILE:data:application/zip;base64,!]", "user"),- &config,- None,- )- .await- .is_err()- );+ assert!(append_with_test_config(+ request("bad", "[FILE:data:application/zip;base64,!]", "user"),+ &config,+ None,+ )+ .await+ .is_err());assert!(append_with_test_config(request("missing", "image.png", "user"), &config, None).await.is_err());- assert!(- conversations::blocking::get_messages(- crate::core::runtime::DispatchCtx::ambient(),- config.workspace_dir.clone(),- "uploads".into()- )- .await- .unwrap()- .is_empty()- );+ assert!(conversations::blocking::get_messages(+ crate::core::runtime::DispatchCtx::ambient(),+ config.workspace_dir.clone(),+ "uploads".into()+ )+ .await+ .unwrap()+ .is_empty());}#[tokio::test]@@ -194,16 +186,14 @@ async fn external_origin_cannot_reuse_an_existing_attachment_marker() {.await.is_err());- assert!(- conversations::blocking::get_messages(- crate::core::runtime::DispatchCtx::ambient(),- config.workspace_dir,- "uploads".into()- )- .await- .unwrap()- .is_empty()- );+ assert!(conversations::blocking::get_messages(+ crate::core::runtime::DispatchCtx::ambient(),+ config.workspace_dir,+ "uploads".into()+ )+ .await+ .unwrap()+ .is_empty());}#[tokio::test]@@ -272,16 +262,14 @@ async fn append_uses_host_persistence_workspace_separate_from_rpc_config() {.await.unwrap();assert_eq!(persisted.len(), 1);- assert!(- conversations::blocking::get_messages(- crate::core::runtime::DispatchCtx::ambient(),- config.workspace_dir,- "uploads".into()- )- .await- .unwrap()- .is_empty()- );+ assert!(conversations::blocking::get_messages(+ crate::core::runtime::DispatchCtx::ambient(),+ config.workspace_dir,+ "uploads".into()+ )+ .await+ .unwrap()+ .is_empty());}#[tokio::test]@@ -292,21 +280,17 @@ async fn poster_only_user_metadata_is_rejected_before_persistence() {"attachmentNames": ["video.mp4"],"attachmentPosters": ["data:image/png;base64,iVBORw0KGgo="]});- assert!(- append_with_test_config(upload, &config, None)- .await- .is_err()- );- assert!(- conversations::blocking::get_messages(- crate::core::runtime::DispatchCtx::ambient(),- config.workspace_dir.clone(),- "uploads".into()- )+ assert!(append_with_test_config(upload, &config, None).await- .unwrap()- .is_empty()- );+ .is_err());+ assert!(conversations::blocking::get_messages(+ crate::core::runtime::DispatchCtx::ambient(),+ config.workspace_dir.clone(),+ "uploads".into()+ )+ .await+ .unwrap()+ .is_empty());}#[tokio::test]@@ -360,14 +344,20 @@ async fn append_cannot_forge_private_attachment_storage_metadata() {.data.unwrap();assert!(saved.attachments.is_empty());- assert!(saved.extra_metadata.get("__openhumanStoredAttachments").is_none());+ assert!(saved+ .extra_metadata+ .get("__openhumanStoredAttachments")+ .is_none());let stored = crate::threads::store::get_messages(&crate::core::runtime::DispatchCtx::ambient(),config.workspace_dir.clone(),"uploads",).unwrap();- assert!(stored[0].extra_metadata.get("__openhumanStoredAttachments").is_none());+ assert!(stored[0]+ .extra_metadata+ .get("__openhumanStoredAttachments")+ .is_none());let update = UpdateConversationMessageRequest {thread_id: "uploads".into(),@@ -411,12 +401,10 @@ async fn typed_attachment_is_staged_like_a_marker_and_leaves_the_text_clean() {);assert_eq!(saved.content, "look");assert_eq!(saved.attachments.len(), 1);- assert!(- saved- .extra_metadata- .get("__openhumanStoredAttachments")- .is_none()- );+ assert!(saved+ .extra_metadata+ .get("__openhumanStoredAttachments")+ .is_none());let opaque_id = match &saved.attachments[0] {ContentPart::Image { media, .. } => {assert!(media.path.is_none());diff --git a/crates/openhuman-core/src/threads/ops/edit.rs b/crates/openhuman-core/src/threads/ops/edit.rsindex ae52c268bb..924d67996b 100644--- a/crates/openhuman-core/src/threads/ops/edit.rs+++ b/crates/openhuman-core/src/threads/ops/edit.rs@@ -39,19 +39,19 @@//! turn.use serde::{Deserialize, Serialize};-use serde_json::{Value, json};+use serde_json::{json, Value};use tinyagents_session::transcript::{SessionRef, SessionTranscript, TranscriptLocator, TranscriptMessage, TranscriptMeta,TruncateCut,};-use crate::core::Outcome;use crate::core::runtime::DispatchCtx;-use crate::threads::ThreadsError;+use crate::core::Outcome;use crate::threads::store::{self as conversations, reply_run_id, run_reply_message_id};+use crate::threads::ThreadsError;-use super::support::{TranscriptStore, transcript_store, workspace_dir};+use super::support::{transcript_store, workspace_dir, TranscriptStore};#[derive(Debug, Clone, Deserialize)]#[serde(deny_unknown_fields)]diff --git a/crates/openhuman-core/src/threads/ops/edit_turn_state_tests.rs b/crates/openhuman-core/src/threads/ops/edit_turn_state_tests.rsindex 57adf0631f..64eb56a87e 100644--- a/crates/openhuman-core/src/threads/ops/edit_turn_state_tests.rs+++ b/crates/openhuman-core/src/threads/ops/edit_turn_state_tests.rs@@ -6,7 +6,7 @@//! truncation tests do.use super::*;-use crate::threads::store::{self as conversations, ConversationMessage, run_reply_message_id};+use crate::threads::store::{self as conversations, run_reply_message_id, ConversationMessage};use serde_json::json;use std::sync::Arc;use tempfile::TempDir;diff --git a/crates/openhuman-core/src/threads/ops/purge.rs b/crates/openhuman-core/src/threads/ops/purge.rsindex f2799c0b88..550ea415b5 100644--- a/crates/openhuman-core/src/threads/ops/purge.rs+++ b/crates/openhuman-core/src/threads/ops/purge.rs@@ -1,8 +1,8 @@//! Workspace-wide conversation purge.use super::support::{envelope, run_to_completion, workspace_dir};-use crate::core::Outcome;use crate::core::runtime::DispatchCtx;+use crate::core::Outcome;use crate::threads::store as conversations;use crate::threads::{ApiEnvelope, EmptyRequest, PurgeConversationThreadsResponse};use std::path::PathBuf;diff --git a/crates/openhuman-core/src/threads/ops/search.rs b/crates/openhuman-core/src/threads/ops/search.rsindex 1e6e5fe5b8..cd98401ef8 100644--- a/crates/openhuman-core/src/threads/ops/search.rs+++ b/crates/openhuman-core/src/threads/ops/search.rs@@ -7,8 +7,8 @@use super::crud::transcript_search;use super::support::envelope;-use crate::core::Outcome;use crate::core::runtime::DispatchCtx;+use crate::core::Outcome;use crate::threads::ApiEnvelope;/// Hits returned when the caller does not ask for a number.diff --git a/crates/openhuman-core/src/threads/ops/support.rs b/crates/openhuman-core/src/threads/ops/support.rsindex c201b37aaa..1a97668cd1 100644--- a/crates/openhuman-core/src/threads/ops/support.rs+++ b/crates/openhuman-core/src/threads/ops/support.rs@@ -3,11 +3,11 @@//! store-type <-> wire-type conversions every handler needs.use crate::config::Config;-use crate::core::runtime::DispatchCtx;use crate::core::runtime::context::CoreContext;-use crate::threads::THREAD_TITLE_LOG_PREFIX;+use crate::core::runtime::DispatchCtx;use crate::threads::store as conversations;use crate::threads::store::{ConversationMessage, ConversationThread};+use crate::threads::THREAD_TITLE_LOG_PREFIX;use crate::threads::{ConversationMessageRecord, ConversationThreadSummary};use std::path::PathBuf;use tinyagents_harness::title::{title_from_user_message, title_log_fingerprint};diff --git a/crates/openhuman-core/src/threads/ops/title_generation.rs b/crates/openhuman-core/src/threads/ops/title_generation.rsindex f1cd662b6c..136f523a28 100644--- a/crates/openhuman-core/src/threads/ops/title_generation.rs+++ b/crates/openhuman-core/src/threads/ops/title_generation.rs@@ -3,12 +3,12 @@use super::support::{counts, envelope, thread_to_summary, update_thread_with_fallback_title};use crate::config::Config;-use crate::core::Outcome;use crate::core::runtime::DispatchCtx;+use crate::core::Outcome;use crate::inference::provider;-use crate::threads::THREAD_TITLE_LOG_PREFIX;-use crate::threads::ThreadsError;use crate::threads::store as conversations;+use crate::threads::ThreadsError;+use crate::threads::THREAD_TITLE_LOG_PREFIX;use crate::threads::{ApiEnvelope, ConversationThreadSummary, GenerateConversationThreadTitleRequest,};diff --git a/crates/openhuman-core/src/threads/ops/transcript.rs b/crates/openhuman-core/src/threads/ops/transcript.rsindex 228a4528f1..52253ec857 100644--- a/crates/openhuman-core/src/threads/ops/transcript.rs+++ b/crates/openhuman-core/src/threads/ops/transcript.rs@@ -1,9 +1,9 @@//! Paginated projection of a thread's settled transcript.use super::support::{counts, envelope, transcript_store};-use crate::core::Outcome;use crate::core::runtime::DispatchCtx;-use crate::threads::{ApiEnvelope, PaginationMeta, store as conversations};+use crate::core::Outcome;+use crate::threads::{store as conversations, ApiEnvelope, PaginationMeta};use tinyagents_session::transcript::view::DisplayItem;/// Request for [`transcript_get`]: the thread to project, plus newest-firstdiff --git a/crates/openhuman-core/src/threads/ops/transcript_tests.rs b/crates/openhuman-core/src/threads/ops/transcript_tests.rsindex f71b7b1cea..4aee62e855 100644--- a/crates/openhuman-core/src/threads/ops/transcript_tests.rs+++ b/crates/openhuman-core/src/threads/ops/transcript_tests.rs@@ -125,7 +125,7 @@ async fn write_thread(ctx: &DispatchCtx) {#[tokio::test]async fn transcript_projection_includes_voice_metadata_from_persisted_thread_rows() {- use crate::threads::store::{ConversationMessage, CreateConversationThread, blocking};+ use crate::threads::store::{blocking, ConversationMessage, CreateConversationThread};use serde_json::json;let dir = tempfile::tempdir().unwrap();diff --git a/crates/openhuman-core/src/threads/ops/usage.rs b/crates/openhuman-core/src/threads/ops/usage.rsindex c19f6d8623..42183542f1 100644--- a/crates/openhuman-core/src/threads/ops/usage.rs+++ b/crates/openhuman-core/src/threads/ops/usage.rs@@ -1,8 +1,8 @@//! Aggregated token/cost usage for a thread, re-audited at current pricing.use super::support::{counts, envelope, transcript_store};-use crate::core::Outcome;use crate::core::runtime::DispatchCtx;+use crate::core::Outcome;use crate::threads::ApiEnvelope;use tinyagents_session::transcript::spend::thread_spend_in;diff --git a/crates/openhuman-core/src/threads/ops/usage_tests.rs b/crates/openhuman-core/src/threads/ops/usage_tests.rsindex db8f2212f9..1024ff8ce6 100644--- a/crates/openhuman-core/src/threads/ops/usage_tests.rs+++ b/crates/openhuman-core/src/threads/ops/usage_tests.rs@@ -1,7 +1,7 @@use super::*;use tinyagents_harness::cost::CostSource;-use tinyagents_session::transcript::UsageCostSource;use tinyagents_session::transcript::spend::CostSplit;+use tinyagents_session::transcript::UsageCostSource;const UNCATALOGUED: &str = "openrouter/z-ai/glm-5.3-flash";const CATALOGUED: &str = "claude-sonnet-4-6";diff --git a/crates/openhuman-core/src/threads/ops/working_dir.rs b/crates/openhuman-core/src/threads/ops/working_dir.rsindex fe097fd374..725784f57e 100644--- a/crates/openhuman-core/src/threads/ops/working_dir.rs+++ b/crates/openhuman-core/src/threads/ops/working_dir.rs@@ -8,11 +8,11 @@//! in another.use super::support::{counts, envelope, thread_to_summary, workspace_dir};-use crate::core::Outcome;use crate::core::runtime::DispatchCtx;+use crate::core::Outcome;use crate::security::SecurityPolicy;-use crate::threads::ThreadsError;use crate::threads::store as conversations;+use crate::threads::ThreadsError;use crate::threads::{ApiEnvelope, ConversationThreadSummary, UpdateConversationThreadWorkingDirRequest,};diff --git a/crates/openhuman-core/src/threads/ops_tests.rs b/crates/openhuman-core/src/threads/ops_tests.rsindex 9fc9b9d778..b5a70cb205 100644--- a/crates/openhuman-core/src/threads/ops_tests.rs+++ b/crates/openhuman-core/src/threads/ops_tests.rs@@ -6,11 +6,11 @@ use super::*;// Re-imported here rather than through `ops`: `ops` itself no longer names// these, so importing them there would be an unused import in a non-test build.use crate::config::test_env::EnvVarGuard;-use crate::threads::ThreadsError;use crate::threads::store as conversations_store;use crate::threads::turn_state::{ClearTurnStateRequest, GetTurnStateRequest};-use serde_json::{Value, json};-use tinyagents_harness::title::{THREAD_TITLE_SYSTEM_PROMPT, build_title_prompt};+use crate::threads::ThreadsError;+use serde_json::{json, Value};+use tinyagents_harness::title::{build_title_prompt, THREAD_TITLE_SYSTEM_PROMPT};use tinyagents_session::turn_state::TurnState;// ── thread_to_summary / message_to_record / record_to_message ─diff --git a/crates/openhuman-core/src/threads/ops_title_and_cancellation_tests.rs b/crates/openhuman-core/src/threads/ops_title_and_cancellation_tests.rsindex bb0b76da78..59656f869d 100644--- a/crates/openhuman-core/src/threads/ops_title_and_cancellation_tests.rs+++ b/crates/openhuman-core/src/threads/ops_title_and_cancellation_tests.rs@@ -61,8 +61,8 @@ async fn thread_update_title_returns_error_for_missing_thread() {/// cleanup in one spawned task, so the tail runs regardless of the caller.#[tokio::test]async fn run_to_completion_runs_the_tail_after_the_caller_is_dropped() {- use std::sync::Arc;use std::sync::atomic::{AtomicBool, Ordering};+ use std::sync::Arc;let tail_ran = Arc::new(AtomicBool::new(false));let flag = Arc::clone(&tail_ran);diff --git a/crates/openhuman-core/src/threads/schemas/registry.rs b/crates/openhuman-core/src/threads/schemas/registry.rsindex a25494af25..ac62edb74c 100644--- a/crates/openhuman-core/src/threads/schemas/registry.rs+++ b/crates/openhuman-core/src/threads/schemas/registry.rs@@ -1,8 +1,8 @@//! Controller schema and registered-controller lists for the `threads`//! namespace.-use crate::core::ControllerSchema;use crate::core::all::RegisteredController;+use crate::core::ControllerSchema;use super::handlers::{handle_create_new, handle_delete, handle_edit_message, handle_generate_title, handle_goal_get,diff --git a/crates/openhuman-core/src/threads/store/blocking_tests.rs b/crates/openhuman-core/src/threads/store/blocking_tests.rsindex 8408bb9367..45e3cd5ff9 100644--- a/crates/openhuman-core/src/threads/store/blocking_tests.rs+++ b/crates/openhuman-core/src/threads/store/blocking_tests.rs@@ -118,8 +118,8 @@ async fn store_errors_surface_unchanged() {/// recovers far enough to report the failure.#[tokio::test(flavor = "multi_thread", worker_threads = 1)]async fn concurrent_operations_complete_without_stalling_the_single_async_worker() {- use std::sync::Arc;use std::sync::atomic::{AtomicBool, AtomicU32, Ordering};+ use std::sync::Arc;use std::time::{Duration, Instant};const TICK_TARGET: u32 = 64;diff --git a/crates/openhuman-core/src/threads/store/bus.rs b/crates/openhuman-core/src/threads/store/bus.rsindex 78f144cc25..474845b173 100644--- a/crates/openhuman-core/src/threads/store/bus.rs+++ b/crates/openhuman-core/src/threads/store/bus.rs@@ -36,7 +36,7 @@ use tinychannels_bus::ChannelMessage;use tinychannels_runtime::context::conversation_history_key;use super::{- ConversationMessage, CreateConversationThread, append_message, ensure_thread, get_messages,+ append_message, ensure_thread, get_messages, ConversationMessage, CreateConversationThread,};static CONVERSATION_PERSISTENCE_HANDLE: OnceLock<SubscriptionHandle> = OnceLock::new();diff --git a/crates/openhuman-core/src/threads/store/legacy_import.rs b/crates/openhuman-core/src/threads/store/legacy_import.rsindex 89ee6d89df..d2d27de34e 100644--- a/crates/openhuman-core/src/threads/store/legacy_import.rs+++ b/crates/openhuman-core/src/threads/store/legacy_import.rs@@ -11,7 +11,7 @@use std::collections::BTreeMap;use std::path::Path;-use anyhow::{Context, Result, anyhow};+use anyhow::{anyhow, Context, Result};use serde::Deserialize;use sha2::{Digest, Sha256};use tinyagents_session::threads::{diff --git a/crates/openhuman-core/src/threads/store/legacy_import_tests.rs b/crates/openhuman-core/src/threads/store/legacy_import_tests.rsindex 842e0543dc..2917965f4b 100644--- a/crates/openhuman-core/src/threads/store/legacy_import_tests.rs+++ b/crates/openhuman-core/src/threads/store/legacy_import_tests.rs@@ -157,12 +157,10 @@ fn threads_round_trip_through_the_backend_store() {.unwrap();assert_eq!(appended.id, "a");assert_eq!(store.get_messages("t").unwrap().len(), 1);- assert!(- !store- .search_cross_thread_messages("needle", 5, None)- .unwrap()- .is_empty()- );+ assert!(!store+ .search_cross_thread_messages("needle", 5, None)+ .unwrap()+ .is_empty());assert!(store.delete_thread("t", "2026-01-02T00:00:00Z").unwrap());assert!(store.list_threads().unwrap().is_empty());}diff --git a/crates/openhuman-core/src/threads/store/mod.rs b/crates/openhuman-core/src/threads/store/mod.rsindex fcc8586e5a..58af866392 100644--- a/crates/openhuman-core/src/threads/store/mod.rs+++ b/crates/openhuman-core/src/threads/store/mod.rs@@ -72,15 +72,15 @@ pub(crate) use bus::claim_channel_turn;pub(crate) use bus::persist_channel_message;pub use bus::register_conversation_persistence_subscriber;pub use store::{- ConversationStore, append_message, delete_messages_from, delete_thread, ensure_thread,- list_threads, purge_threads, update_message, update_thread_labels, update_thread_title,- update_thread_working_dir,+ append_message, delete_messages_from, delete_thread, ensure_thread, list_threads,+ purge_threads, update_message, update_thread_labels, update_thread_title,+ update_thread_working_dir, ConversationStore,};pub(crate) use transcript_key::bind_transcript_key;pub use types::{- ConversationThread, CreateConversationThread, CrossThreadHit,- ThreadMessage as ConversationMessage, ThreadMessagePatch as ConversationMessagePatch,- is_deterministic_message_id, reply_run_id, run_reply_message_id,+ is_deterministic_message_id, reply_run_id, run_reply_message_id, ConversationThread,+ CreateConversationThread, CrossThreadHit, ThreadMessage as ConversationMessage,+ ThreadMessagePatch as ConversationMessagePatch,};/// A thread's messages without artifact rows. Artifact rows place artifactdiff --git a/crates/openhuman-core/src/threads/store/transcript_key.rs b/crates/openhuman-core/src/threads/store/transcript_key.rsindex 2ed3cd7c1b..12ad20b3eb 100644--- a/crates/openhuman-core/src/threads/store/transcript_key.rs+++ b/crates/openhuman-core/src/threads/store/transcript_key.rs@@ -12,7 +12,7 @@//! recorded key. A thread with no record falls back to the current rule.use anyhow::Result;-use serde_json::{Value, json};+use serde_json::{json, Value};use tinystoragedrivers::{CollectionSpec, ErrorKind, Filter, Precondition};use super::backend::ConversationStore;diff --git a/crates/openhuman-core/src/threads/store/transcript_key_tests.rs b/crates/openhuman-core/src/threads/store/transcript_key_tests.rsindex 3544115b61..2efe48664f 100644--- a/crates/openhuman-core/src/threads/store/transcript_key_tests.rs+++ b/crates/openhuman-core/src/threads/store/transcript_key_tests.rs@@ -58,11 +58,9 @@ fn deleting_a_thread_forgets_its_key() {.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());diff --git a/crates/openhuman-core/src/threads/transcript_host_tests.rs b/crates/openhuman-core/src/threads/transcript_host_tests.rsindex fe3ce006c3..58ba544734 100644--- a/crates/openhuman-core/src/threads/transcript_host_tests.rs+++ b/crates/openhuman-core/src/threads/transcript_host_tests.rs@@ -10,10 +10,10 @@ use std::sync::Arc;use crate::agent::session_store::splice_fixture::memory_locator;use tempfile::TempDir;-use tinyagents_session::transcript::TranscriptMessage;use tinyagents_session::transcript::view::{- DisplayItem, ToolCallStatus, project_records, project_thread_in,+ project_records, project_thread_in, DisplayItem, ToolCallStatus,};+use tinyagents_session::transcript::TranscriptMessage;use tinyagents_session::transcript::{self, TranscriptLocator};/// A thread's display records, read back through the store port.diff --git a/crates/openhuman-core/src/threads/turn_state/mirror.rs b/crates/openhuman-core/src/threads/turn_state/mirror.rsindex 79db4f5d3d..e804ac30ef 100644--- a/crates/openhuman-core/src/threads/turn_state/mirror.rs+++ b/crates/openhuman-core/src/threads/turn_state/mirror.rs@@ -27,11 +27,11 @@ pub use observe::ObserveProgress;#[cfg(test)]use tinyagents_session::port::{InMemoryTurnStates, TurnStates};#[cfg(test)]-use tinyagents_session::turn_state::TurnStateMirror;-#[cfg(test)]use tinyagents_session::turn_state::mirror::MAX_PERSISTED_TRANSCRIPT_ITEM;#[cfg(test)]use tinyagents_session::turn_state::types::{SubagentToolCall, SubagentTranscriptItem, ToolTimelineStatus, TranscriptItem, TurnLifecycle,TurnPhase,};+#[cfg(test)]+use tinyagents_session::turn_state::TurnStateMirror;diff --git a/crates/openhuman-core/src/threads/turn_state/mirror/observe.rs b/crates/openhuman-core/src/threads/turn_state/mirror/observe.rsindex 40ef5dd813..20fd51c4be 100644--- a/crates/openhuman-core/src/threads/turn_state/mirror/observe.rs+++ b/crates/openhuman-core/src/threads/turn_state/mirror/observe.rs@@ -8,12 +8,12 @@use crate::threads::turn_state::rpc_types::persisted_tool_failure;use tinyagents_harness::progress::AgentProgress;-use tinyagents_session::turn_state::TurnStateMirror;use tinyagents_session::turn_state::mirror::caps::{cap_persisted_args, cap_persisted_output};use tinyagents_session::turn_state::types::{SubagentActivity, SubagentToolCall, SubagentTranscriptItem, ToolTimelineEntry,ToolTimelineStatus, TurnLifecycle, TurnPhase,};+use tinyagents_session::turn_state::TurnStateMirror;/// Host extension of the upstream mirror: fold one [`AgentProgress`] event into/// the snapshot.diff --git a/crates/openhuman-core/src/threads/welcome_migration.rs b/crates/openhuman-core/src/threads/welcome_migration.rsindex 13dcca3723..87a7e3a207 100644--- a/crates/openhuman-core/src/threads/welcome_migration.rs+++ b/crates/openhuman-core/src/threads/welcome_migration.rs@@ -20,7 +20,7 @@ use std::fs;use std::path::Path;use crate::threads::store as conversations;-use serde_json::{Value, json};+use serde_json::{json, Value};const MIGRATION_MARKER: &str = "state/migrations/welcome_to_orchestrator_v1.done";const WELCOME_THREAD_LABEL: &str = "onboarding";diff --git a/crates/openhuman-core/src/threads/welcome_migration_tests.rs b/crates/openhuman-core/src/threads/welcome_migration_tests.rsindex 09a3928c62..d83cee7236 100644--- a/crates/openhuman-core/src/threads/welcome_migration_tests.rs+++ b/crates/openhuman-core/src/threads/welcome_migration_tests.rs@@ -1,5 +1,5 @@use super::*;-use crate::threads::store::{CreateConversationThread, ensure_thread, list_threads};+use crate::threads::store::{ensure_thread, list_threads, CreateConversationThread};use tempfile::TempDir;fn make_thread(id: &str, labels: Vec<String>) -> CreateConversationThread {diff --git a/crates/openhuman-core/src/web_chat/schemas.rs b/crates/openhuman-core/src/web_chat/schemas.rsindex f31e1ce00e..d8255d5204 100644--- a/crates/openhuman-core/src/web_chat/schemas.rs+++ b/crates/openhuman-core/src/web_chat/schemas.rs@@ -5,8 +5,8 @@use crate::core::runtime::DispatchCtx;use serde_json::{Map, Value};-use crate::core::Outcome;use crate::core::all::{ControllerFuture, RegisteredController};+use crate::core::Outcome;use crate::core::{ControllerSchema, FieldSchema, TypeSchema};use super::ops::{