Skip to content

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

style(voice): apply rustfmt formatting

Steven Enamakel647ddaa36e39
diff --git a/crates/openhuman-tinyhumans/src/voice/cloud_transcribe.rs b/crates/openhuman-tinyhumans/src/voice/cloud_transcribe.rs
index 878263cf95..c6e302ec33 100644
--- a/crates/openhuman-tinyhumans/src/voice/cloud_transcribe.rs
+++ b/crates/openhuman-tinyhumans/src/voice/cloud_transcribe.rs
@@ -36,9 +36,7 @@ pub async fn transcribe_cloud(
.to_string(),
);
}
- let http = client
- .raw_client()
- .map_err(flatten_authed_error)?;
+ let http = client.raw_client().map_err(flatten_authed_error)?;
let result = tinyinference_voice::cloud::transcribe(
&http,
url,
diff --git a/crates/openhuman-tinyhumans/src/voice/cloud_transcribe_tests.rs b/crates/openhuman-tinyhumans/src/voice/cloud_transcribe_tests.rs
index 23e9250281..acfa2d3e33 100644
--- a/crates/openhuman-tinyhumans/src/voice/cloud_transcribe_tests.rs
+++ b/crates/openhuman-tinyhumans/src/voice/cloud_transcribe_tests.rs
@@ -16,9 +16,7 @@ fn backend_401_is_tagged_as_session_expiry() {
false,
);
assert!(tagged.starts_with("SESSION_EXPIRED: "));
- assert!(is_session_expired_message(
- &tagged
- ));
+ assert!(is_session_expired_message(&tagged));
}
#[test]
@@ -34,9 +32,7 @@ fn backend_401_with_api_key_does_not_expire_session() {
true,
);
assert!(tagged.starts_with("API_KEY_REJECTED: "));
- assert!(!is_session_expired_message(
- &tagged
- ));
+ assert!(!is_session_expired_message(&tagged));
}
#[tokio::test]
diff --git a/crates/openhuman-tinyhumans/src/voice/live.rs b/crates/openhuman-tinyhumans/src/voice/live.rs
index 6887c3fb4d..8afe01b803 100644
--- a/crates/openhuman-tinyhumans/src/voice/live.rs
+++ b/crates/openhuman-tinyhumans/src/voice/live.rs
@@ -52,7 +52,11 @@ pub(crate) fn configure_gemini(config: &Config, system_instruction: &str, live:
}
/// Shapes the session configuration for `elevenlabs-hosted`.
-pub(crate) fn configure_elevenlabs(config: &Config, _system_instruction: &str, live: &mut LiveConfig) {
+pub(crate) fn configure_elevenlabs(
+ config: &Config,
+ _system_instruction: &str,
+ live: &mut LiveConfig,
+) {
// The hosted agent owns its prompt and its brain (OpenHuman over the
// Custom-LLM relay); only the voice may be overridden.
live.voice = non_empty(config.voice_live.elevenlabs.voice_id.clone());
diff --git a/crates/openhuman-tinyhumans/src/voice/live_tests.rs b/crates/openhuman-tinyhumans/src/voice/live_tests.rs
index 9ea382187a..acb5dcec35 100644
--- a/crates/openhuman-tinyhumans/src/voice/live_tests.rs
+++ b/crates/openhuman-tinyhumans/src/voice/live_tests.rs
@@ -42,7 +42,10 @@ fn elevenlabs_hosted_config_owns_its_prompt_and_ignores_blank_voices() {
config.voice_live.elevenlabs.voice_id = Some(" ".into());
let mut live = LiveConfig::new();
configure_elevenlabs(&config, "prompt", &mut live);
- assert_eq!(live.system_instruction, None, "the hosted agent owns its prompt");
+ assert_eq!(
+ live.system_instruction, None,
+ "the hosted agent owns its prompt"
+ );
assert_eq!(live.voice, None, "blank voice ids are ignored");
config.voice_live.elevenlabs.voice_id = Some("v1".into());
configure_elevenlabs(&config, "prompt", &mut live);
@@ -63,6 +66,9 @@ async fn hosted_providers_report_not_configured_without_a_backend_credential() {
config.workspace_dir = dir.path().to_path_buf();
config.config_path = dir.path().join("config.toml");
assert!(!backend_ready(&config));
- let err = prepare_gemini(config, LiveConfig::new()).await.err().unwrap();
+ let err = prepare_gemini(config, LiveConfig::new())
+ .await
+ .err()
+ .unwrap();
assert_eq!(err.code, "not_configured");
}
diff --git a/crates/openhuman-tinyhumans/src/voice/realtime_tests.rs b/crates/openhuman-tinyhumans/src/voice/realtime_tests.rs
index 04922442de..01361a687e 100644
--- a/crates/openhuman-tinyhumans/src/voice/realtime_tests.rs
+++ b/crates/openhuman-tinyhumans/src/voice/realtime_tests.rs
@@ -103,7 +103,11 @@ async fn mint_signed_url_authenticates_with_the_api_key() {
config.workspace_dir = dir.path().join("workspace");
config.config_path = dir.path().join("config.toml");
config.api_url = Some(format!("http://{addr}"));
- openhuman_embed::__host::security::credentials::api_key::store_api_key(&config, "tiny_test_voice").unwrap();
+ openhuman_embed::__host::security::credentials::api_key::store_api_key(
+ &config,
+ "tiny_test_voice",
+ )
+ .unwrap();
let out = mint_voice_agent_signed_url(&config)
.await
diff --git a/crates/openhuman-tinyhumans/src/voice/schemas.rs b/crates/openhuman-tinyhumans/src/voice/schemas.rs
index c31ca8d796..f1988eb436 100644
--- a/crates/openhuman-tinyhumans/src/voice/schemas.rs
+++ b/crates/openhuman-tinyhumans/src/voice/schemas.rs
@@ -129,7 +129,10 @@ async fn load_config(ctx: &DispatchCtx) -> Result<Config, String> {
/// Mint a realtime voice-agent signed WebSocket URL (#5399). Takes no params -
/// the agent is server-configured; the desktop only asks for a fresh signed URL.
-fn handle_voice_agent_signed_url(ctx: DispatchCtx, _params: Map<String, Value>) -> ControllerFuture {
+fn handle_voice_agent_signed_url(
+ ctx: DispatchCtx,
+ _params: Map<String, Value>,
+) -> ControllerFuture {
Box::pin(async move {
log::debug!("{LOG_PREFIX} voice.agent_signed_url");
let config = load_config(&ctx).await?;
diff --git a/crates/openhuman-tinyhumans/src/voice/schemas_tests.rs b/crates/openhuman-tinyhumans/src/voice/schemas_tests.rs
new file mode 100644
index 0000000000..3fb8157882
--- /dev/null
+++ b/crates/openhuman-tinyhumans/src/voice/schemas_tests.rs
@@ -0,0 +1,36 @@
+use super::*;
+
+#[test]
+fn hosted_voice_controllers_keep_their_exact_rpc_names() {
+ let names: Vec<String> = hosted_voice_controllers()
+ .iter()
+ .map(|c| format!("{}.{}", c.schema.namespace, c.schema.function))
+ .collect();
+ assert_eq!(names, ["voice.agent_signed_url", "voice.cloud_transcribe"]);
+}
+
+#[test]
+fn cloud_transcribe_schema_requires_only_the_audio() {
+ let schema = hosted_voice_schemas("voice_cloud_transcribe");
+ let required: Vec<_> = schema
+ .inputs
+ .iter()
+ .filter(|f| f.required)
+ .map(|f| f.name)
+ .collect();
+ assert_eq!(required, ["audio_base64"]);
+ assert!(schema.inputs.iter().any(|f| f.name == "language"));
+}
+
+#[test]
+fn agent_signed_url_takes_no_params() {
+ assert!(hosted_voice_schemas("voice_agent_signed_url")
+ .inputs
+ .is_empty());
+}
+
+#[test]
+fn registration_is_idempotent() {
+ register();
+ register();
+}