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
refactor(web_chat): clean up imports and simplify function calls
Steven Enamakel08e1da967707
diff --git a/crates/openhuman-core/src/web_chat/reply_persistence.rs b/crates/openhuman-core/src/web_chat/reply_persistence.rsindex 8f0dc3175a..a96860cb78 100644--- a/crates/openhuman-core/src/web_chat/reply_persistence.rs+++ b/crates/openhuman-core/src/web_chat/reply_persistence.rs@@ -24,7 +24,7 @@ use std::path::Path;use serde_json::json;use crate::memory::types::TurnCitation;-use crate::threads::store::{self as conversations, run_reply_message_id, ConversationMessage};+use crate::threads::store::{self as conversations, ConversationMessage, run_reply_message_id};/// Metadata scope stamped on a reply persisted by the web-channel delivery path.///diff --git a/crates/openhuman-core/src/web_chat/reply_persistence_tests.rs b/crates/openhuman-core/src/web_chat/reply_persistence_tests.rsindex 797bdb1c60..615ec2baba 100644--- a/crates/openhuman-core/src/web_chat/reply_persistence_tests.rs+++ b/crates/openhuman-core/src/web_chat/reply_persistence_tests.rs@@ -111,13 +111,15 @@ fn an_empty_reply_is_not_stored() {).expect("no error");assert!(!stored, "an empty reply reports that nothing was stored");- assert!(conversations::get_messages(- &crate::core::runtime::DispatchCtx::ambient(),- ws.clone(),- "t-3"- )- .expect("messages")- .is_empty());+ assert!(+ conversations::get_messages(+ &crate::core::runtime::DispatchCtx::ambient(),+ ws.clone(),+ "t-3"+ )+ .expect("messages")+ .is_empty()+ );}#[test]@@ -232,12 +234,7 @@ fn a_spoken_reply_row_points_at_its_stored_audio() {seed_thread(&ws, "t-voice");let ctx = crate::core::runtime::DispatchCtx::ambient();- crate::web_chat::voice_notes::store_synthesized_reply(- &ws,- "req-v",- "YWJj",- "audio/mpeg",- );+ crate::web_chat::voice_notes::store_synthesized_reply(&ws, "req-v", "YWJj", "audio/mpeg");persist_delivered_reply(&ctx, &ws, "t-voice", "req-v", "Hello", &[]).expect("append");persist_delivered_reply(&ctx, &ws, "t-no-audio", "req-w", "Hi", &[]).ok();diff --git a/crates/openhuman-core/src/web_chat/turn_host.rs b/crates/openhuman-core/src/web_chat/turn_host.rsindex 161410a5d2..6ab96c137a 100644--- a/crates/openhuman-core/src/web_chat/turn_host.rs+++ b/crates/openhuman-core/src/web_chat/turn_host.rs@@ -16,19 +16,19 @@ use std::sync::Arc;use std::time::Duration;use async_trait::async_trait;+use tinyagents_harness::CancellationToken;use tinyagents_harness::run_queue::RunQueue;use tinyagents_harness::turn_runner::{QueueDisposition, TurnHost, TurnRequest, TurnResult, TurnSession, TurnSignal, WorkTracker,};-use tinyagents_harness::CancellationToken;use tinyinference_llm::failure::is_empty_provider_response_text;-use tokio::sync::{mpsc, watch, Mutex as AsyncMutex};+use tokio::sync::{Mutex as AsyncMutex, mpsc, watch};use super::ops::{self, BudgetCorrelation};-use super::progress::{ProgressProjection, INFERENCE_HEARTBEAT_SECS};+use super::progress::{INFERENCE_HEARTBEAT_SECS, ProgressProjection};use super::runner::{Admission, Shared};use super::session::{- checkin_session_agent, checkout_session_agent, normalize_model_override, CheckoutPolicy,+ CheckoutPolicy, checkin_session_agent, checkout_session_agent, normalize_model_override,};use super::surface::TurnIds;use super::turn_activity::TurnActivity;@@ -37,7 +37,7 @@ use super::web_errors::{inference_budget_exceeded_user_message, is_inference_budget_exceeded_error,};use crate::agent::queued_turn::QueuedPayload;-use crate::agent::turn_origin::{with_origin, AgentTurnOrigin};+use crate::agent::turn_origin::{AgentTurnOrigin, with_origin};use crate::core::events::DomainEvent;use crate::core::runtime::DispatchCtx;use tinyagents_harness::progress::AgentProgress;diff --git a/crates/openhuman-core/src/web_chat/voice_notes.rs b/crates/openhuman-core/src/web_chat/voice_notes.rsindex 4997a28f03..cfdc956875 100644--- a/crates/openhuman-core/src/web_chat/voice_notes.rs+++ b/crates/openhuman-core/src/web_chat/voice_notes.rs@@ -13,7 +13,7 @@use std::path::{Path, PathBuf};use serde::{Deserialize, Serialize};-use serde_json::{json, Value};+use serde_json::{Value, json};use tinystoragedrivers::{CollectionSpec, Precondition};use crate::storage::{self, documents::Repo};@@ -30,10 +30,7 @@ struct ReplyVisemeTimeline {frames: Vec<Value>,}-fn viseme_repo(- ctx: &crate::core::runtime::DispatchCtx,- workspace: &Path,-) -> Result<Repo, String> {+fn viseme_repo(ctx: &crate::core::runtime::DispatchCtx, workspace: &Path) -> Result<Repo, String> {let tenant = crate::core::runtime::tenant::tenant_in(crate::core::runtime::is_saas(),ctx.resolved().as_deref(),@@ -225,7 +222,8 @@ pub(crate) fn persist_reply_visemes(let body = serde_json::to_value(ReplyVisemeTimeline { tenant, frames }).map_err(|error| format!("serialize voice-note timeline record: {error}"))?;repo.run(|docs| async move {- docs.put(VISEME_COLLECTION, &id, body, Precondition::None).await?;+ docs.put(VISEME_COLLECTION, &id, body, Precondition::None)+ .await?;Ok(())}).map_err(|error| format!("persist voice-note timeline: {error}"))diff --git a/crates/openhuman-core/src/web_chat/voice_notes_tests.rs b/crates/openhuman-core/src/web_chat/voice_notes_tests.rsindex 6ff9780eb4..2691c19b57 100644--- a/crates/openhuman-core/src/web_chat/voice_notes_tests.rs+++ b/crates/openhuman-core/src/web_chat/voice_notes_tests.rs@@ -72,15 +72,16 @@ fn synthesized_reply_metadata_preserves_its_viseme_timeline() {tinyinference_voice::VisemeFrame {viseme: "aa".into(),start_ms: 0,- end_ms: 120+ end_ms: 120,},tinyinference_voice::VisemeFrame {viseme: "PP".into(),start_ms: 120,- end_ms: 220+ end_ms: 220,},- ]- ).unwrap();+ ],+ )+ .unwrap();let meta = reply_note_metadata(&ctx, tmp.path(), "request-1").unwrap();assert_eq!(@@ -130,12 +131,7 @@ fn typed_voice_media_must_match_its_durable_note_reference() {#[test]fn synthesized_reply_is_stored_only_with_decodable_audio() {let tmp = tempfile::tempdir().unwrap();- assert!(!store_synthesized_reply(- tmp.path(),- "r1",- "",- "audio/mpeg"- ));+ assert!(!store_synthesized_reply(tmp.path(), "r1", "", "audio/mpeg"));assert!(!store_synthesized_reply(tmp.path(),"r1",@@ -148,7 +144,8 @@ fn synthesized_reply_is_stored_only_with_decodable_audio() {"YWJj","audio/mpeg"));- assert!(reply_note_metadata(tmp.path(), "r1").is_some());+ let ctx = crate::core::runtime::DispatchCtx::ambient();+ assert!(reply_note_metadata(&ctx, tmp.path(), "r1").is_some());}#[test]