Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

chore(voice): reorder imports and collapse formatting

Steven Enamakelf0f732742e1b
diff --git a/crates/openhuman-core/src/core/events_tests.rs b/crates/openhuman-core/src/core/events_tests.rs
index 026b78469b..a9de36216e 100644
--- a/crates/openhuman-core/src/core/events_tests.rs
+++ b/crates/openhuman-core/src/core/events_tests.rs
@@ -781,23 +781,19 @@ fn a_long_error_is_clipped_on_a_character_boundary() {
/// Every other variant is unchanged: no detail, so its row renders as before.
#[test]
fn events_outside_the_supervisor_have_no_event_log_detail() {
- assert!(
- DomainEvent::CronJobCompleted {
- job_id: "job-1".into(),
- success: true,
- output: "done".into(),
- }
- .log_detail()
- .is_none()
- );
- assert!(
- DomainEvent::McpServerConnected {
- server_id: "srv-1".into(),
- tool_count: 25,
- }
- .log_detail()
- .is_none()
- );
+ assert!(DomainEvent::CronJobCompleted {
+ job_id: "job-1".into(),
+ success: true,
+ output: "done".into(),
+ }
+ .log_detail()
+ .is_none());
+ assert!(DomainEvent::McpServerConnected {
+ server_id: "srv-1".into(),
+ tool_count: 25,
+ }
+ .log_detail()
+ .is_none());
}
// ── workspace_dir ────────────────────────────────────────────────────────
diff --git a/crates/openhuman-core/src/voice/capture_lease.rs b/crates/openhuman-core/src/voice/capture_lease.rs
index b8d232cb3d..2cfad0e89f 100644
--- a/crates/openhuman-core/src/voice/capture_lease.rs
+++ b/crates/openhuman-core/src/voice/capture_lease.rs
@@ -2,11 +2,11 @@
use super::audio_capture::{RecordingResult, TARGET_SAMPLE_RATE};
use crate::config::Config;
use base64::Engine as _;
-use serde::{Serialize, de::DeserializeOwned};
+use serde::{de::DeserializeOwned, Serialize};
use std::collections::HashMap;
use std::sync::{
- Arc, LazyLock, Mutex,
atomic::{AtomicBool, AtomicU64, Ordering},
+ Arc, LazyLock, Mutex,
};
use tinybus::module::ModuleClient;
use tinyvoice_bus::{
diff --git a/crates/openhuman-core/src/voice/capture_lease_tests.rs b/crates/openhuman-core/src/voice/capture_lease_tests.rs
index 20c40dd4a8..3cd5a28f41 100644
--- a/crates/openhuman-core/src/voice/capture_lease_tests.rs
+++ b/crates/openhuman-core/src/voice/capture_lease_tests.rs
@@ -142,7 +142,7 @@ fn fixture_lease(port: Arc<Fixture>) -> CaptureLease {
#[cfg(feature = "modules")]
#[tokio::test]
async fn capture_never_retries_through_an_unattested_bus() {
- use tinybus::{Connection, ObjectPath, broker::Broker, transport::memory::MemoryBus};
+ use tinybus::{broker::Broker, transport::memory::MemoryBus, Connection, ObjectPath};
#[derive(Clone)]
struct Unattested(Arc<AtomicU64>);
#[tinybus::interface(name = "test.Capture")]
diff --git a/crates/openhuman-core/src/voice/cli.rs b/crates/openhuman-core/src/voice/cli.rs
index 1c5e81ac63..5a7a6620e3 100644
--- a/crates/openhuman-core/src/voice/cli.rs
+++ b/crates/openhuman-core/src/voice/cli.rs
@@ -6,10 +6,10 @@
//! registry pattern because it blocks forever on the hotkey listener, so the
//! adapter lives here inside the voice domain rather than in `crates/openhuman-core/src/core/cli.rs`.
-use anyhow::{Result, anyhow};
+use anyhow::{anyhow, Result};
-use crate::core::logging::{CliLogDefault, init_for_cli_run};
-use crate::voice::server::{VoiceServerConfig, run_standalone};
+use crate::core::logging::{init_for_cli_run, CliLogDefault};
+use crate::voice::server::{run_standalone, VoiceServerConfig};
use tinyvoice_bus::hotkey::ActivationMode;
/// Parse and execute the `openhuman voice` / `openhuman dictate` subcommand.
diff --git a/crates/openhuman-core/src/voice/factory/entry.rs b/crates/openhuman-core/src/voice/factory/entry.rs
index 55f4d59db3..a23c671e5c 100644
--- a/crates/openhuman-core/src/voice/factory/entry.rs
+++ b/crates/openhuman-core/src/voice/factory/entry.rs
@@ -3,7 +3,7 @@
use log::debug;
use super::helpers::{
- LOG_PREFIX, create_stt_provider_by_slug, create_tts_provider_by_slug, split_slug_model,
+ create_stt_provider_by_slug, create_tts_provider_by_slug, split_slug_model, LOG_PREFIX,
};
use super::registry::{stt_factory, tts_factory};
use super::traits::{SttProvider, TtsProvider};
diff --git a/crates/openhuman-core/src/voice/factory/factory_tests.rs b/crates/openhuman-core/src/voice/factory/factory_tests.rs
index cba764c353..ace2584fa2 100644
--- a/crates/openhuman-core/src/voice/factory/factory_tests.rs
+++ b/crates/openhuman-core/src/voice/factory/factory_tests.rs
@@ -1,12 +1,12 @@
//! Unit tests for the voice factory.
use super::entry::{
- DEFAULT_PIPER_VOICE, create_stt_provider, create_tts_provider, resolve_tts_voice,
+ create_stt_provider, create_tts_provider, resolve_tts_voice, DEFAULT_PIPER_VOICE,
};
use super::helpers::{effective_stt_provider, effective_tts_provider, split_slug_model};
-use crate::config::Config;
-use crate::config::schema::SttEngine;
use crate::config::schema::voice_providers::VoiceCapability;
+use crate::config::schema::SttEngine;
+use crate::config::Config;
use tinyinference_voice::external_stt::SttApiStyle;
fn cfg() -> Config {
diff --git a/crates/openhuman-core/src/voice/factory/mod.rs b/crates/openhuman-core/src/voice/factory/mod.rs
index 546bf4486c..23c0da8de6 100644
--- a/crates/openhuman-core/src/voice/factory/mod.rs
+++ b/crates/openhuman-core/src/voice/factory/mod.rs
@@ -54,7 +54,7 @@ mod tts_providers;
mod tests;
// Re-export the public API — exact visibility preserved from the original file.
-pub use entry::{DEFAULT_PIPER_VOICE, DEFAULT_STT_MODEL, create_stt_provider, create_tts_provider};
+pub use entry::{create_stt_provider, create_tts_provider, DEFAULT_PIPER_VOICE, DEFAULT_STT_MODEL};
pub use helpers::{effective_stt_provider, effective_tts_provider};
pub use stt_providers::ExternalSttProvider;
pub use traits::{SttProvider, SttResult, TtsProvider};
diff --git a/crates/openhuman-core/src/voice/factory/tts_providers.rs b/crates/openhuman-core/src/voice/factory/tts_providers.rs
index 86abea7a60..3a817aaab9 100644
--- a/crates/openhuman-core/src/voice/factory/tts_providers.rs
+++ b/crates/openhuman-core/src/voice/factory/tts_providers.rs
@@ -4,7 +4,7 @@
use async_trait::async_trait;
use log::debug;
-use super::super::local_speech::{PiperOptions, synthesize_piper};
+use super::super::local_speech::{synthesize_piper, PiperOptions};
use super::traits::TtsProvider;
use crate::config::Config;
use crate::core::Outcome;
diff --git a/crates/openhuman-core/src/voice/live/mod.rs b/crates/openhuman-core/src/voice/live/mod.rs
index 5e3fd84a9f..88257b6bde 100644
--- a/crates/openhuman-core/src/voice/live/mod.rs
+++ b/crates/openhuman-core/src/voice/live/mod.rs
@@ -28,5 +28,5 @@ pub mod types;
pub mod ws;
pub use error::LiveVoiceError;
-pub use providers::{GEMINI_LANGUAGES, GEMINI_VOICES, PreparedProvider};
+pub use providers::{PreparedProvider, GEMINI_LANGUAGES, GEMINI_VOICES};
pub use schemas::{live_controller_schemas, live_registered_controllers, live_schemas};
diff --git a/crates/openhuman-core/src/voice/live/ops.rs b/crates/openhuman-core/src/voice/live/ops.rs
index eb98203966..8e041620cf 100644
--- a/crates/openhuman-core/src/voice/live/ops.rs
+++ b/crates/openhuman-core/src/voice/live/ops.rs
@@ -11,8 +11,8 @@ use super::types::{
GeminiLiveSettingsPatch, LiveProvidersResponse, LiveSettingsPatch, LiveTestResult,
LiveVoiceConfig, SarvamLiveSettingsPatch,
};
-use crate::config::Config;
use crate::config::schema::voice_live::is_live_provider;
+use crate::config::Config;
use crate::core::Outcome;
/// How long a provider test waits for the session to become ready.
diff --git a/crates/openhuman-core/src/voice/live/providers.rs b/crates/openhuman-core/src/voice/live/providers.rs
index 9166100135..7804cf9bed 100644
--- a/crates/openhuman-core/src/voice/live/providers.rs
+++ b/crates/openhuman-core/src/voice/live/providers.rs
@@ -20,10 +20,10 @@ use tinyagents_live::tinyliveagents::{AudioFormat, LiveConfig, LiveProvider};
use super::error::LiveVoiceError;
use super::types::{LiveProviderInfo, LiveProviderKind};
-use crate::config::Config;
use crate::config::schema::voice_live::{
- LIVE_PROVIDER_GEMINI, LIVE_PROVIDER_SARVAM, LIVE_PROVIDERS,
+ LIVE_PROVIDERS, LIVE_PROVIDER_GEMINI, LIVE_PROVIDER_SARVAM,
};
+use crate::config::Config;
const LOG_PREFIX: &str = "[voice-live]";
diff --git a/crates/openhuman-core/src/voice/live/providers_tests.rs b/crates/openhuman-core/src/voice/live/providers_tests.rs
index f3af03fe0c..68eb5dee7e 100644
--- a/crates/openhuman-core/src/voice/live/providers_tests.rs
+++ b/crates/openhuman-core/src/voice/live/providers_tests.rs
@@ -1,6 +1,6 @@
use super::*;
use crate::config::schema::voice_live::{
- LIVE_PROVIDER_ELEVENLABS_HOSTED, LIVE_PROVIDER_GEMINI_HOSTED, LIVE_PROVIDERS,
+ LIVE_PROVIDERS, LIVE_PROVIDER_ELEVENLABS_HOSTED, LIVE_PROVIDER_GEMINI_HOSTED,
};
#[test]
@@ -41,12 +41,10 @@ fn live_config_follows_the_settings_per_provider() {
assert_eq!(gemini.system_instruction.as_deref(), Some("prompt"));
assert_eq!(gemini.voice.as_deref(), Some("Kore"));
assert_eq!(gemini.model.as_deref(), Some("gemini-x"));
- assert!(
- gemini
- .provider_options
- .get("context_window_compression")
- .is_some()
- );
+ assert!(gemini
+ .provider_options
+ .get("context_window_compression")
+ .is_some());
let sarvam = live_config(&config, LIVE_PROVIDER_SARVAM, "prompt", 8_000);
assert_eq!(sarvam.voice.as_deref(), Some("priya"));
diff --git a/crates/openhuman-core/src/voice/live/schemas.rs b/crates/openhuman-core/src/voice/live/schemas.rs
index 118c794191..385ff181cc 100644
--- a/crates/openhuman-core/src/voice/live/schemas.rs
+++ b/crates/openhuman-core/src/voice/live/schemas.rs
@@ -36,7 +36,8 @@ pub fn live_schemas(function: &str) -> ControllerSchema {
"voice_live_providers" => ControllerSchema {
namespace: "voice",
function: "live_providers",
- description: "List live voice agent providers, whether each is usable, and the default.",
+ description:
+ "List live voice agent providers, whether each is usable, and the default.",
inputs: vec![],
outputs: vec![
json_output("default_provider", "The provider Tiny uses by default."),
@@ -87,7 +88,8 @@ pub fn live_schemas(function: &str) -> ControllerSchema {
"voice_live_test_provider" => ControllerSchema {
namespace: "voice",
function: "live_test_provider",
- description: "Open a live session on a provider, wait until it is ready, then close it.",
+ description:
+ "Open a live session on a provider, wait until it is ready, then close it.",
inputs: vec![FieldSchema {
name: "provider",
ty: TypeSchema::String,
diff --git a/crates/openhuman-core/src/voice/live/schemas_tests.rs b/crates/openhuman-core/src/voice/live/schemas_tests.rs
index ada9b2b674..8f8650ea09 100644
--- a/crates/openhuman-core/src/voice/live/schemas_tests.rs
+++ b/crates/openhuman-core/src/voice/live/schemas_tests.rs
@@ -18,11 +18,10 @@ fn registers_four_live_controllers_in_the_voice_namespace() {
assert_eq!(live_controller_schemas().len(), 4);
assert_eq!(live_schemas("missing").function, "unknown");
let test = live_schemas("voice_live_test_provider");
- assert!(
- test.inputs
- .iter()
- .any(|f| f.name == "provider" && f.required)
- );
+ assert!(test
+ .inputs
+ .iter()
+ .any(|f| f.name == "provider" && f.required));
}
#[tokio::test]
@@ -33,12 +32,10 @@ async fn handlers_reject_bad_params() {
.await
.is_err()
);
- assert!(
- handle_live_settings_set(
- DispatchCtx::process_default(),
- bad(serde_json::json!({"gemini": 5}))
- )
- .await
- .is_err()
- );
+ assert!(handle_live_settings_set(
+ DispatchCtx::process_default(),
+ bad(serde_json::json!({"gemini": 5}))
+ )
+ .await
+ .is_err());
}
diff --git a/crates/openhuman-core/src/voice/live/session.rs b/crates/openhuman-core/src/voice/live/session.rs
index a6b23300b2..f050ffd536 100644
--- a/crates/openhuman-core/src/voice/live/session.rs
+++ b/crates/openhuman-core/src/voice/live/session.rs
@@ -17,11 +17,11 @@ use super::error::LiveVoiceError;
use super::providers;
use crate::agent::session_host::OpenHumanSessionHost;
use crate::agent::tinyagents::host::OpenHumanRunContext;
-use crate::agent::tinyagents::live_harness::{LIVE_MAX_TOOL_CALLS, assemble_live_tool_harness};
-use crate::config::Config;
+use crate::agent::tinyagents::live_harness::{assemble_live_tool_harness, LIVE_MAX_TOOL_CALLS};
use crate::config::schema::voice_live::is_live_provider;
+use crate::config::Config;
use crate::security::approval::{ApprovalChatContext, ApprovalTurnContext};
-use crate::security::turn_origin::{AgentTurnOrigin, with_origin};
+use crate::security::turn_origin::{with_origin, AgentTurnOrigin};
use crate::threads::store::{ConversationMessage, CreateConversationThread};
/// The agent a live session borrows its tools from.
diff --git a/crates/openhuman-core/src/voice/live/ws.rs b/crates/openhuman-core/src/voice/live/ws.rs
index 484b0b6a18..539473ef51 100644
--- a/crates/openhuman-core/src/voice/live/ws.rs
+++ b/crates/openhuman-core/src/voice/live/ws.rs
@@ -15,8 +15,8 @@ use std::time::Duration;
use axum::extract::ws::{Message, WebSocket};
use bytes::Bytes;
use futures::{SinkExt, StreamExt};
-use tinyagents_live::LiveAgentEvent;
use tinyagents_live::tinyliveagents::{CloseReason, LiveEvent};
+use tinyagents_live::LiveAgentEvent;
use super::error::LiveVoiceError;
use super::persist::TranscriptPersister;
diff --git a/crates/openhuman-core/src/voice/live/ws_tests.rs b/crates/openhuman-core/src/voice/live/ws_tests.rs
index 5c014249bc..a25b5a5fbc 100644
--- a/crates/openhuman-core/src/voice/live/ws_tests.rs
+++ b/crates/openhuman-core/src/voice/live/ws_tests.rs
@@ -112,14 +112,12 @@ fn maps_audio_turns_errors_and_closes() {
matches!(&out[0], Outbound::Json(ServerFrame::Error { code, fatal: true, .. }) if code == "unauthorized")
);
// Tool calls surface through ToolStarted/ToolFinished instead.
- assert!(
- map(LiveEvent::ToolCall(ToolCall {
- call_id: "c".into(),
- name: "n".into(),
- args: serde_json::json!({})
- }))
- .is_empty()
- );
+ assert!(map(LiveEvent::ToolCall(ToolCall {
+ call_id: "c".into(),
+ name: "n".into(),
+ args: serde_json::json!({})
+ }))
+ .is_empty());
}
#[test]
diff --git a/crates/openhuman-core/src/voice/local_speech.rs b/crates/openhuman-core/src/voice/local_speech.rs
index 0382362821..6ce7e3117b 100644
--- a/crates/openhuman-core/src/voice/local_speech.rs
+++ b/crates/openhuman-core/src/voice/local_speech.rs
@@ -2,10 +2,10 @@
use crate::config::Config;
use crate::core::Outcome;
-use tinyinference_voice::VisemeFrame;
#[cfg(test)]
use tinyinference_voice::piper::synthetic_viseme_timeline;
use tinyinference_voice::reply::ReplySpeech as ReplySpeechResult;
+use tinyinference_voice::VisemeFrame;
/// Default Piper voice id.
pub const DEFAULT_PIPER_VOICE: &str = "en_US-lessac-medium";
diff --git a/crates/openhuman-core/src/voice/ops.rs b/crates/openhuman-core/src/voice/ops.rs
index cf48e3e4a7..506ac35e65 100644
--- a/crates/openhuman-core/src/voice/ops.rs
+++ b/crates/openhuman-core/src/voice/ops.rs
@@ -15,7 +15,7 @@ use tinyinference_local::models as model_ids;
use super::factory::{create_stt_provider, effective_stt_provider};
use super::postprocess;
use super::types::{VoiceSpeechResult, VoiceStatus, VoiceTtsResult};
-use crate::modules::voice::{HallucinationMode, is_hallucinated};
+use crate::modules::voice::{is_hallucinated, HallucinationMode};
const LOG_PREFIX: &str = "[voice]";
diff --git a/crates/openhuman-core/src/voice/ops_tests.rs b/crates/openhuman-core/src/voice/ops_tests.rs
index 7396ffccd8..bbdc30dbda 100644
--- a/crates/openhuman-core/src/voice/ops_tests.rs
+++ b/crates/openhuman-core/src/voice/ops_tests.rs
@@ -128,12 +128,10 @@ async fn voice_status_reports_external_engine_without_credentials_as_unavailable
let status = voice_status(&config).await.unwrap().value;
assert!(!status.stt_available);
- assert!(
- status
- .stt_error
- .as_deref()
- .is_some_and(|error| error.contains("no API credential"))
- );
+ assert!(status
+ .stt_error
+ .as_deref()
+ .is_some_and(|error| error.contains("no API credential")));
}
#[test]
diff --git a/crates/openhuman-core/src/voice/realtime_harness.rs b/crates/openhuman-core/src/voice/realtime_harness.rs
index 46aeb7b911..1a70f29c2a 100644
--- a/crates/openhuman-core/src/voice/realtime_harness.rs
+++ b/crates/openhuman-core/src/voice/realtime_harness.rs
@@ -32,11 +32,11 @@ pub use turn_handler::handle_voice_harness_turn;
use crate::progress::AgentProgress;
#[cfg(test)]
use prompt::{
- VOICE_READBACK_PREFIX, is_answerable_prompt, is_content_free, messages_to_history_pairs,
- readback_payload, should_arm_speak_back, spoken_delta,
+ is_answerable_prompt, is_content_free, messages_to_history_pairs, readback_payload,
+ should_arm_speak_back, spoken_delta, VOICE_READBACK_PREFIX,
};
#[cfg(test)]
-use turn_handler::{VOICE_HANDOFF_LINES, next_handoff_line};
+use turn_handler::{next_handoff_line, VOICE_HANDOFF_LINES};
#[cfg(test)]
#[path = "realtime_harness_tests.rs"]
diff --git a/crates/openhuman-core/src/voice/realtime_harness/agent.rs b/crates/openhuman-core/src/voice/realtime_harness/agent.rs
index 9a6811dd14..2aee6f6749 100644
--- a/crates/openhuman-core/src/voice/realtime_harness/agent.rs
+++ b/crates/openhuman-core/src/voice/realtime_harness/agent.rs
@@ -10,7 +10,7 @@ use serde_json::Value;
use crate::agent::session_host::OpenHumanSessionHost;
use crate::progress::AgentProgress;
-use crate::security::turn_origin::{AgentTurnOrigin, with_origin};
+use crate::security::turn_origin::{with_origin, AgentTurnOrigin};
use super::chat_delivery::{VOICE_CHAT_CLIENT_ID, VOICE_CHAT_THREAD_ID};
use super::prompt::messages_to_history_pairs;
diff --git a/crates/openhuman-core/src/voice/realtime_harness/chat_delivery.rs b/crates/openhuman-core/src/voice/realtime_harness/chat_delivery.rs
index 385e376ceb..69954b3c8e 100644
--- a/crates/openhuman-core/src/voice/realtime_harness/chat_delivery.rs
+++ b/crates/openhuman-core/src/voice/realtime_harness/chat_delivery.rs
@@ -3,7 +3,7 @@
//! relay.
use log::{info, warn};
-use serde_json::{Value, json};
+use serde_json::{json, Value};
use crate::platform::socket::manager::global_socket_manager;
diff --git a/crates/openhuman-core/src/voice/realtime_harness/turn_handler.rs b/crates/openhuman-core/src/voice/realtime_harness/turn_handler.rs
index 8212899873..bcccddeac9 100644
--- a/crates/openhuman-core/src/voice/realtime_harness/turn_handler.rs
+++ b/crates/openhuman-core/src/voice/realtime_harness/turn_handler.rs
@@ -8,7 +8,7 @@ use std::sync::{Arc, LazyLock, Mutex};
use std::time::Duration;
use log::{info, warn};
-use serde_json::{Value, json};
+use serde_json::{json, Value};
use tokio::sync::Semaphore;
use crate::progress::AgentProgress;
@@ -175,9 +175,7 @@ pub async fn handle_voice_harness_turn(
// answer nothing — and its empty reply surfaced in chat as a failure notice
// the user never asked for.
if is_content_free(&prompt) {
- info!(
- "[voice-harness] ignoring content-free turn correlation={correlation_id} prompt={prompt:?}"
- );
+ info!("[voice-harness] ignoring content-free turn correlation={correlation_id} prompt={prompt:?}");
emit_event(
"voice:harness:delta",
json!({ "correlationId": correlation_id, "text": VOICE_SILENT_REPLY }),
@@ -194,9 +192,7 @@ pub async fn handle_voice_harness_turn(
// Deduplicate a re-delivered turn (relay retry) before doing any work. Owned
// so it can move into the background continuation and track the real turn.
let Some(in_flight) = InFlightGuard::claim(&correlation_id) else {
- warn!(
- "[voice-harness] duplicate turn correlation={correlation_id} already in flight — dropping"
- );
+ warn!("[voice-harness] duplicate turn correlation={correlation_id} already in flight — dropping");
return;
};
@@ -256,9 +252,7 @@ pub async fn handle_voice_harness_turn(
if should_arm_speak_back(&turn_prompt) {
deliver_voice_result_to_chat(&turn_cid, reply, true);
} else {
- info!(
- "[voice-harness] deferred read-back turn carries no new content; skipping chat delivery correlation={turn_cid}"
- );
+ info!("[voice-harness] deferred read-back turn carries no new content; skipping chat delivery correlation={turn_cid}");
}
}
Err(err) => {
@@ -350,9 +344,7 @@ pub async fn handle_voice_harness_turn(
// takes the chat-delivery path. The forwarder is left running to keep
// draining progress — any late deltas reach a settled relay turn and
// are dropped harmlessly.
- info!(
- "[voice-harness] ack deadline reached, handing off to chat correlation={correlation_id}"
- );
+ info!("[voice-harness] ack deadline reached, handing off to chat correlation={correlation_id}");
// If the turn never said anything of its own, the caller has heard only
// the relay's filler. Ending there sounds like the assistant lost the
// thread, so say the answer is still coming — it is, on both delivery
diff --git a/crates/openhuman-core/src/voice/schemas/handlers/provider_server.rs b/crates/openhuman-core/src/voice/schemas/handlers/provider_server.rs
index da1b86d9ec..41bca07ded 100644
--- a/crates/openhuman-core/src/voice/schemas/handlers/provider_server.rs
+++ b/crates/openhuman-core/src/voice/schemas/handlers/provider_server.rs
@@ -87,7 +87,7 @@ pub(crate) fn handle_voice_update_provider_settings(
) -> ControllerFuture {
Box::pin(async move {
use crate::config::schema::voice_providers::{
- VoiceCapability, VoiceProviderCreds, generate_voice_provider_id, is_voice_slug_reserved,
+ generate_voice_provider_id, is_voice_slug_reserved, VoiceCapability, VoiceProviderCreds,
};
use tinyinference_voice::external_stt::SttApiStyle;
use tinyinference_voice::external_tts::TtsApiStyle;
@@ -113,7 +113,7 @@ pub(crate) fn handle_voice_update_provider_settings(
Some(other) => {
return Err(format!(
"invalid capability '{other}' (valid: 'stt', 'tts', 'both')"
- ));
+ ))
}
};
@@ -122,8 +122,8 @@ pub(crate) fn handle_voice_update_provider_settings(
Some("none") => crate::config::schema::AuthStyle::None,
Some(other) => {
return Err(format!(
- "invalid auth_style '{other}' for voice provider (valid: 'bearer', 'none')"
- ));
+ "invalid auth_style '{other}' for voice provider (valid: 'bearer', 'none')"
+ ))
}
};
@@ -134,7 +134,7 @@ pub(crate) fn handle_voice_update_provider_settings(
Some(other) => {
return Err(format!(
"invalid stt_api_style '{other}' (valid: 'openai_audio', 'deepgram', 'elevenlabs')"
- ));
+ ))
}
};
@@ -144,7 +144,7 @@ pub(crate) fn handle_voice_update_provider_settings(
Some(other) => {
return Err(format!(
"invalid tts_api_style '{other}' (valid: 'openai_audio', 'elevenlabs')"
- ));
+ ))
}
};
@@ -428,7 +428,7 @@ pub(crate) fn handle_voice_server_start(
params: Map<String, Value>,
) -> ControllerFuture {
Box::pin(async move {
- use crate::voice::server::{VoiceServerConfig, global_server};
+ use crate::voice::server::{global_server, VoiceServerConfig};
use tinyvoice_bus::hotkey::ActivationMode;
let config = ctx.load_config().await?;
@@ -576,7 +576,7 @@ pub(crate) fn handle_overlay_stt_notify(
);
use crate::voice::dictation_listener::{
- DictationEvent, publish_dictation_event, publish_transcription,
+ publish_dictation_event, publish_transcription, DictationEvent,
};
match p.state {
diff --git a/crates/openhuman-core/src/voice/schemas/registry.rs b/crates/openhuman-core/src/voice/schemas/registry.rs
index 7f1401589f..5e4fe0090f 100644
--- a/crates/openhuman-core/src/voice/schemas/registry.rs
+++ b/crates/openhuman-core/src/voice/schemas/registry.rs
@@ -115,7 +115,8 @@ pub fn voice_schemas(function: &str) -> ControllerSchema {
"voice_transcribe" => ControllerSchema {
namespace: "voice",
function: "transcribe",
- description: "Transcribe audio from a file path through the configured STT engine, with optional LLM cleanup.",
+ description:
+ "Transcribe audio from a file path through the configured STT engine, with optional LLM cleanup.",
inputs: vec![
required_string("audio_path", "Path to the audio file."),
optional_string("context", "Conversation context for LLM post-processing."),
@@ -132,7 +133,8 @@ pub fn voice_schemas(function: &str) -> ControllerSchema {
"voice_transcribe_bytes" => ControllerSchema {
namespace: "voice",
function: "transcribe_bytes",
- description: "Transcribe audio from raw bytes through the configured STT engine, with optional LLM cleanup.",
+ description:
+ "Transcribe audio from raw bytes through the configured STT engine, with optional LLM cleanup.",
inputs: vec![
FieldSchema {
name: "audio_bytes",
@@ -165,7 +167,8 @@ pub fn voice_schemas(function: &str) -> ControllerSchema {
"voice_reply_synthesize" => ControllerSchema {
namespace: "voice",
function: "reply_synthesize",
- description: "Synthesize an agent reply via the hosted backend (ElevenLabs) and return \
+ description:
+ "Synthesize an agent reply via the hosted backend (ElevenLabs) and return \
base64 audio plus an Oculus-15 viseme alignment for mascot lip-sync.",
inputs: vec![
required_string("text", "Text to synthesize."),
@@ -184,7 +187,8 @@ pub fn voice_schemas(function: &str) -> ControllerSchema {
"voice_stt_dispatch" => ControllerSchema {
namespace: "voice",
function: "stt_dispatch",
- description: "Factory-dispatched speech-to-text. Routes to the OpenHuman backend proxy or a \
+ description:
+ "Factory-dispatched speech-to-text. Routes to the OpenHuman backend proxy or a \
third-party provider based on `provider` (or, when unspecified, the resolved \
`voice_server.stt_engine`). Returns the same `{ text }` payload either way.",
inputs: vec![
@@ -196,20 +200,21 @@ pub fn voice_schemas(function: &str) -> ControllerSchema {
"provider",
"Override provider: 'cloud' or '<slug>[:<model>]'. Defaults to the resolved voice_server.stt_engine.",
),
- optional_string(
- "model",
- "Model id for the selected engine (e.g. 'scribe_v1', 'whisper-1').",
- ),
+ optional_string("model", "Model id for the selected engine (e.g. 'scribe_v1', 'whisper-1')."),
optional_string("mime_type", "Audio MIME type (default: audio/webm)."),
optional_string("file_name", "Filename hint (default: audio.webm)."),
optional_string("language", "BCP-47 language hint, e.g. 'en'."),
],
- outputs: vec![json_output("result", "SttResult: { text, provider }.")],
+ outputs: vec![json_output(
+ "result",
+ "SttResult: { text, provider }.",
+ )],
},
"voice_tts_dispatch" => ControllerSchema {
namespace: "voice",
function: "tts_dispatch",
- description: "Factory-dispatched text-to-speech. Routes to the cloud ElevenLabs proxy \
+ description:
+ "Factory-dispatched text-to-speech. Routes to the cloud ElevenLabs proxy \
(returns rich viseme alignment) or local Piper (returns audio + a synthetic \
viseme timeline) based on `provider` (or `config.local_ai.tts_provider`).",
inputs: vec![
@@ -231,7 +236,8 @@ pub fn voice_schemas(function: &str) -> ControllerSchema {
"voice_set_providers" => ControllerSchema {
namespace: "voice",
function: "set_providers",
- description: "Persist the STT / TTS provider selection (and optional model/voice id) into \
+ description:
+ "Persist the STT / TTS provider selection (and optional model/voice id) into \
`config.local_ai.{stt,tts}_provider` so subsequent voice_stt_dispatch / \
voice_tts_dispatch calls resolve without an explicit provider param.",
inputs: vec![
@@ -254,7 +260,8 @@ pub fn voice_schemas(function: &str) -> ControllerSchema {
"voice_update_provider_settings" => ControllerSchema {
namespace: "voice",
function: "update_provider_settings",
- description: "Persist the voice provider registry and STT/TTS routing strings. \
+ description:
+ "Persist the voice provider registry and STT/TTS routing strings. \
Mirrors openhuman.inference_update_model_settings for the voice domain.",
inputs: vec![
FieldSchema {
@@ -280,7 +287,8 @@ pub fn voice_schemas(function: &str) -> ControllerSchema {
"voice_list_models" => ControllerSchema {
namespace: "voice",
function: "list_models",
- description: "List available models or voices for a voice provider. Returns static \
+ description:
+ "List available models or voices for a voice provider. Returns static \
presets for built-in slugs; probes /models for custom providers.",
inputs: vec![
required_string("provider_id", "Provider id or slug."),
@@ -289,12 +297,16 @@ pub fn voice_schemas(function: &str) -> ControllerSchema {
"Filter by capability: 'stt' or 'tts'. Defaults to both.",
),
],
- outputs: vec![json_output("models", "{ models: [{ id, label? }] }")],
+ outputs: vec![json_output(
+ "models",
+ "{ models: [{ id, label? }] }",
+ )],
},
"voice_test_provider" => ControllerSchema {
namespace: "voice",
function: "test_provider",
- description: "Test a voice provider endpoint without saving. STT transcribes a \
+ description:
+ "Test a voice provider endpoint without saving. STT transcribes a \
silent audio clip; TTS synthesizes 'Hello' and discards. With \
`validate_only` it is a dry run: a lightweight authenticated GET, \
no inference call and nothing persisted.",
@@ -324,7 +336,8 @@ pub fn voice_schemas(function: &str) -> ControllerSchema {
"voice_server_start" => ControllerSchema {
namespace: "voice",
function: "server_start",
- description: "Start the voice dictation server (hotkey → record → transcribe → insert text).",
+ description:
+ "Start the voice dictation server (hotkey → record → transcribe → insert text).",
inputs: vec![
optional_string("hotkey", "Hotkey combination (default: Fn)."),
optional_string(
@@ -352,7 +365,8 @@ pub fn voice_schemas(function: &str) -> ControllerSchema {
"overlay_stt_notify" => ControllerSchema {
namespace: "voice",
function: "overlay_stt_notify",
- description: "Notify the overlay of a voice/STT state change from the chat prompt button.",
+ description:
+ "Notify the overlay of a voice/STT state change from the chat prompt button.",
inputs: vec![
required_string(
"state",
diff --git a/crates/openhuman-core/src/voice/schemas_tests.rs b/crates/openhuman-core/src/voice/schemas_tests.rs
index 04baeb9607..0f93e1eb32 100644
--- a/crates/openhuman-core/src/voice/schemas_tests.rs
+++ b/crates/openhuman-core/src/voice/schemas_tests.rs
@@ -75,21 +75,19 @@ fn status_schema_has_no_inputs() {
#[test]
fn transcribe_schema_requires_audio_path() {
let s = voice_schemas("voice_transcribe");
- assert!(
- s.inputs
- .iter()
- .any(|i| i.name == "audio_path" && i.required)
- );
+ assert!(s
+ .inputs
+ .iter()
+ .any(|i| i.name == "audio_path" && i.required));
}
#[test]
fn transcribe_bytes_schema_requires_audio_bytes() {
let s = voice_schemas("voice_transcribe_bytes");
- assert!(
- s.inputs
- .iter()
- .any(|i| i.name == "audio_bytes" && i.required)
- );
+ assert!(s
+ .inputs
+ .iter()
+ .any(|i| i.name == "audio_bytes" && i.required));
}
#[test]
@@ -143,7 +141,7 @@ fn to_json_returns_inner_value() {
#[tokio::test]
async fn overlay_notify_recording_started_publishes_pressed_event() {
use crate::voice::dictation_listener::subscribe_dictation_events;
- use tokio::time::{Duration, timeout};
+ use tokio::time::{timeout, Duration};
let mut rx = subscribe_dictation_events();
let params = Map::from_iter([("state".to_string(), json!("recording_started"))]);
@@ -433,11 +431,10 @@ fn update_provider_settings_schema_has_correct_inputs() {
#[test]
fn list_models_schema_requires_provider_id() {
let s = voice_schemas("voice_list_models");
- assert!(
- s.inputs
- .iter()
- .any(|i| i.name == "provider_id" && i.required)
- );
+ assert!(s
+ .inputs
+ .iter()
+ .any(|i| i.name == "provider_id" && i.required));
}
#[test]
diff --git a/crates/openhuman-core/src/voice/server/hotkey_listener.rs b/crates/openhuman-core/src/voice/server/hotkey_listener.rs
index 049f4f26e6..4a4f69b6ba 100644
--- a/crates/openhuman-core/src/voice/server/hotkey_listener.rs
+++ b/crates/openhuman-core/src/voice/server/hotkey_listener.rs
@@ -473,7 +473,7 @@ async fn close_globe(
Err(crate::modules::accessibility::AccessibilityError::Operation(error))
if error.code == "UNKNOWN_LISTENER" =>
{
- return;
+ return
}
Err(error) => warn!("{LOG_PREFIX} Globe cleanup pending: {error}"),
}
diff --git a/crates/openhuman-core/src/voice/server/hotkey_listener_tests.rs b/crates/openhuman-core/src/voice/server/hotkey_listener_tests.rs
index 07cd89deea..873c809b4e 100644
--- a/crates/openhuman-core/src/voice/server/hotkey_listener_tests.rs
+++ b/crates/openhuman-core/src/voice/server/hotkey_listener_tests.rs
@@ -198,7 +198,7 @@ async fn listener_fixture() -> (
ListenerFixture,
tinybus::Connection,
) {
- use tinybus::{Connection, ObjectPath, broker::Broker, transport::memory::MemoryBus};
+ use tinybus::{broker::Broker, transport::memory::MemoryBus, Connection, ObjectPath};
let bus = MemoryBus::new();
Broker::new().spawn(bus.clone());
let service = Connection::connect(bus.connect().await.unwrap())
@@ -271,16 +271,14 @@ async fn lost_start_reply_recovers_the_lease_before_releasing_admission_fixture(
.lose_start_reply
.store(true, std::sync::atomic::Ordering::SeqCst);
fixture.allow_start.notify_one();
- assert!(
- start_globe_with_client(
- &crate::core::runtime::DispatchCtx::default(),
- client,
- Push,
- &CancellationToken::new()
- )
- .await
- .is_err()
- );
+ assert!(start_globe_with_client(
+ &crate::core::runtime::DispatchCtx::default(),
+ client,
+ Push,
+ &CancellationToken::new()
+ )
+ .await
+ .is_err());
tokio::time::timeout(
std::time::Duration::from_secs(5),
fixture.stopped.notified(),
diff --git a/crates/openhuman-core/src/voice/server/pipeline.rs b/crates/openhuman-core/src/voice/server/pipeline.rs
index ba18bc2140..011b5e2505 100644
--- a/crates/openhuman-core/src/voice/server/pipeline.rs
+++ b/crates/openhuman-core/src/voice/server/pipeline.rs
@@ -3,8 +3,8 @@
//! (min duration, silence, hallucination) and the initial-prompt / recent
//! transcript bookkeeping that improves STT continuity.
-use std::sync::Arc;
use std::sync::atomic::Ordering;
+use std::sync::Arc;
use std::time::Instant;
use log::{debug, info, warn};
@@ -13,13 +13,13 @@ use tokio::sync::Mutex;
use crate::config::Config;
use crate::modules::accessibility::{AccessibilityClient, FocusTarget, PasteRequest};
use crate::modules::voice::{
- GateVerdict, HallucinationMode, RecordingGates, SessionInput, gate_recording, is_hallucinated,
+ gate_recording, is_hallucinated, GateVerdict, HallucinationMode, RecordingGates, SessionInput,
};
use crate::voice::audio_capture::RecordingHandle;
-use super::LOG_PREFIX;
use super::recorder::Recorder;
-use super::types::{MAX_INITIAL_PROMPT_CHARS, MAX_RECENT_TRANSCRIPTS, VoiceServerConfig};
+use super::types::{VoiceServerConfig, MAX_INITIAL_PROMPT_CHARS, MAX_RECENT_TRANSCRIPTS};
+use super::LOG_PREFIX;
/// Capture the frontmost app name at hotkey press so insertion can be validated later.
#[cfg(target_os = "macos")]
@@ -206,22 +206,17 @@ pub(super) async fn process_recording_bg(
// inserts into the user's active text field, so a stray
// "Thank you." is visible and undoable, while a filter that
// failed closed would swallow real dictation with no trace.
- let hallucinated = match is_hallucinated(
- config,
- text,
- HallucinationMode::Dictation,
- )
- .await
- {
- Ok(verdict) => verdict,
- Err(error) => {
- warn!(
+ let hallucinated =
+ match is_hallucinated(config, text, HallucinationMode::Dictation).await {
+ Ok(verdict) => verdict,
+ Err(error) => {
+ warn!(
"{LOG_PREFIX} [pipeline={pipeline_id}] stage=gate_hallucination \
UNAVAILABLE ({error}); passing text through"
);
- false
- }
- };
+ false
+ }
+ };
if hallucinated {
warn!(
"{LOG_PREFIX} [pipeline={pipeline_id}] stage=gate_hallucination DROPPED text='{}'",
@@ -266,9 +261,7 @@ pub(super) async fn process_recording_bg(
})
.await
{
- warn!(
- "{LOG_PREFIX} [pipeline={pipeline_id}] stage=deliver_paste FAILED: {e}"
- );
+ warn!("{LOG_PREFIX} [pipeline={pipeline_id}] stage=deliver_paste FAILED: {e}");
*last_error.lock().await = Some(e.to_string());
} else {
let insert_elapsed = insert_started.elapsed();
@@ -281,9 +274,7 @@ pub(super) async fn process_recording_bg(
}
}
} else {
- warn!(
- "{LOG_PREFIX} [pipeline={pipeline_id}] stage=gate_empty DROPPED (transcription was blank)"
- );
+ warn!("{LOG_PREFIX} [pipeline={pipeline_id}] stage=gate_empty DROPPED (transcription was blank)");
}
}
Err(e) => {
@@ -291,9 +282,7 @@ pub(super) async fn process_recording_bg(
// subprocess layer and logged with a 5-minute backoff.
// Demote to warn! so they don't flood Sentry (issue #5168).
if e.contains("STATUS_DLL_NOT_FOUND") {
- warn!(
- "{LOG_PREFIX} [pipeline={pipeline_id}] stage=transcribe DLL_UNAVAILABLE: {e}"
- );
+ warn!("{LOG_PREFIX} [pipeline={pipeline_id}] stage=transcribe DLL_UNAVAILABLE: {e}");
} else {
warn!("{LOG_PREFIX} [pipeline={pipeline_id}] stage=transcribe FAILED: {e}");
}
diff --git a/crates/openhuman-core/src/voice/server/recorder.rs b/crates/openhuman-core/src/voice/server/recorder.rs
index 4c689960a1..5efdfb1e9f 100644
--- a/crates/openhuman-core/src/voice/server/recorder.rs
+++ b/crates/openhuman-core/src/voice/server/recorder.rs
@@ -14,8 +14,8 @@ use tokio::sync::Mutex;
use crate::config::Config;
use crate::modules::voice::{RecorderSession, SessionAdvance, SessionInput};
-use super::LOG_PREFIX;
use super::types::ServerState;
+use super::LOG_PREFIX;
/// A recording session plus the phase mirror it keeps current.
#[derive(Clone)]
diff --git a/crates/openhuman-core/src/voice/server/runtime.rs b/crates/openhuman-core/src/voice/server/runtime.rs
index ddb9de586a..3a5ae91898 100644
--- a/crates/openhuman-core/src/voice/server/runtime.rs
+++ b/crates/openhuman-core/src/voice/server/runtime.rs
@@ -4,8 +4,8 @@
//! means lives in the `tinyvoice` module; this loop reports facts to it
//! (`SessionAdvance`) and performs the action it answers with.
-use std::sync::Arc;
use std::sync::atomic::Ordering;
+use std::sync::Arc;
use log::{debug, info, warn};
use tokio::sync::Mutex;
@@ -17,11 +17,11 @@ use crate::modules::voice::{RecorderSession, SessionAction, SessionInput};
use crate::voice::audio_capture::{self, RecordingHandle};
use tinyvoice_bus::hotkey::{ActivationMode, HotkeyEvent};
-use super::LOG_PREFIX;
use super::hotkey_listener::start_hotkey_listener;
use super::pipeline::{capture_expected_app_name, process_recording_bg};
use super::recorder::Recorder;
use super::types::{ServerState, VoiceServerConfig, VoiceServerStatus};
+use super::LOG_PREFIX;
type RecordingSetupReceiver =
tokio::sync::oneshot::Receiver<Result<(RecordingHandle, Option<String>), String>>;
diff --git a/crates/openhuman-core/src/voice/server/singleton.rs b/crates/openhuman-core/src/voice/server/singleton.rs
index 710f5e0520..86f3261084 100644
--- a/crates/openhuman-core/src/voice/server/singleton.rs
+++ b/crates/openhuman-core/src/voice/server/singleton.rs
@@ -8,9 +8,9 @@ use log::{info, warn};
use crate::config::Config;
use tinyvoice_bus::hotkey::ActivationMode;
-use super::LOG_PREFIX;
use super::runtime::VoiceServer;
use super::types::{ServerState, VoiceServerConfig};
+use super::LOG_PREFIX;
/// Global voice server instance, lazily initialized.
static VOICE_SERVER: once_cell::sync::OnceCell<Arc<VoiceServer>> = once_cell::sync::OnceCell::new();