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
feat(voice): add live voice registry
Steven Enamakele3b9ef98bcba
diff --git a/crates/openhuman-core/src/voice/live/registry.rs b/crates/openhuman-core/src/voice/live/registry.rsindex d39b4a2655..7eb206b14f 100644--- a/crates/openhuman-core/src/voice/live/registry.rs+++ b/crates/openhuman-core/src/voice/live/registry.rs@@ -35,6 +35,16 @@ pub type PrepareFn = Arc<+ Sync,>;+/// Where a registered provider is listed relative to the built-in ones.+#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]+pub enum LiveProviderPlacement {+ /// After every built-in provider (the default).+ #[default]+ AfterBuiltIn,+ /// Before every built-in provider.+ BeforeBuiltIn,+}+/// One registered live provider.#[derive(Clone)]pub struct LiveProviderEntry {@@ -54,6 +64,9 @@ pub struct LiveProviderEntry {pub configure: Option<ConfigureFn>,/// Connects the provider.pub prepare: PrepareFn,+ /// Where the provider is listed relative to the built-in ones. Providers+ /// sharing a placement keep registration order.+ pub placement: LiveProviderPlacement,}static LIVE_PROVIDERS: HookSlot<LiveProviderEntry> = HookSlot::new("voice::live::providers");@@ -77,9 +90,11 @@ pub fn unregister_live_provider(slug: &str) -> bool {LIVE_PROVIDERS.unregister(slug)}-/// Lists registered providers after the built-in ones; a registered slug that-/// is also built in replaces the built-in row in place.+/// Lists registered providers before or after the built-in ones according to+/// their [`LiveProviderPlacement`]; a registered slug that is also built in+/// replaces the built-in row in place.pub(super) fn merge_provider_infos(infos: &mut Vec<LiveProviderInfo>, config: &Config) {+ let mut leading = Vec::new();for (slug, entry) in LIVE_PROVIDERS.entries() {let info = LiveProviderInfo {id: slug.clone(),@@ -92,9 +107,16 @@ pub(super) fn merge_provider_infos(infos: &mut Vec<LiveProviderInfo>, config: &C};match infos.iter_mut().find(|existing| existing.id == slug) {Some(existing) => *existing = info,- None => infos.push(info),+ None => match entry.placement {+ LiveProviderPlacement::AfterBuiltIn => infos.push(info),+ LiveProviderPlacement::BeforeBuiltIn => leading.push(info),+ },}}+ if !leading.is_empty() {+ leading.append(infos);+ *infos = leading;+ }}/// Applies a registered provider's [`LiveConfig`] shaping, if it has any.diff --git a/crates/openhuman-core/src/voice/live/registry_tests.rs b/crates/openhuman-core/src/voice/live/registry_tests.rsindex 02ba564ab1..073ee4c8f3 100644--- a/crates/openhuman-core/src/voice/live/registry_tests.rs+++ b/crates/openhuman-core/src/voice/live/registry_tests.rs@@ -21,9 +21,30 @@ fn entry(label: &str) -> LiveProviderEntry {})})}),+ placement: LiveProviderPlacement::AfterBuiltIn,}}+#[test]+fn before_built_in_providers_lead_the_listing_in_registration_order() {+ let leading = |label: &str| LiveProviderEntry {+ placement: LiveProviderPlacement::BeforeBuiltIn,+ ..entry(label)+ };+ register_live_provider("test-first", leading("First"));+ register_live_provider("test-second", leading("Second"));+ register_live_provider("test-last", entry("Last"));+ let infos = provider_infos(&Config::default());+ for slug in ["test-first", "test-second", "test-last"] {+ unregister_live_provider(slug);+ }+ let ids: Vec<_> = infos.iter().map(|i| i.id.as_str()).collect();+ assert_eq!(+ ids,+ ["test-first", "test-second", "gemini", "sarvam", "test-last"]+ );+}+#[test]fn nothing_registered_lists_only_the_built_in_providers() {let infos = provider_infos(&Config::default());diff --git a/crates/openhuman-embed/src/host_internals.rs b/crates/openhuman-embed/src/host_internals.rsindex 2efb799629..a97382c2d8 100644--- a/crates/openhuman-embed/src/host_internals.rs+++ b/crates/openhuman-embed/src/host_internals.rs@@ -395,7 +395,7 @@ pub mod voice_registry {};pub use openhuman_core::voice::live::registry::{register_live_provider, register_live_provider_in, unregister_live_provider, ConfigureFn,- ConfiguredFn, LiveFuture, LiveProviderEntry, PrepareFn,+ ConfiguredFn, LiveFuture, LiveProviderEntry, LiveProviderPlacement, PrepareFn,};pub use openhuman_core::voice::live::types::{LiveProviderInfo, LiveProviderKind};pub use openhuman_core::voice::live::{diff --git a/crates/openhuman-tinyhumans/src/voice/live.rs b/crates/openhuman-tinyhumans/src/voice/live.rsindex 8afe01b803..db6a99e24a 100644--- a/crates/openhuman-tinyhumans/src/voice/live.rs+++ b/crates/openhuman-tinyhumans/src/voice/live.rs@@ -9,7 +9,7 @@use openhuman_embed::__host::config::Config;use openhuman_embed::__host::security::credentials::session_support::resolve_backend_credential;use openhuman_embed::__host::voice_registry::{- register_live_provider, LiveProviderEntry, LiveProviderKind, LiveVoiceError, PreparedProvider,+ register_live_provider, LiveProviderEntry, LiveProviderKind, LiveProviderPlacement, LiveVoiceError, PreparedProvider,GEMINI_LANGUAGES, GEMINI_VOICES, LIVE_PROVIDER_ELEVENLABS_HOSTED, LIVE_PROVIDER_GEMINI_HOSTED,};use reqwest::Method;@@ -150,7 +150,8 @@ pub(crate) async fn prepare_elevenlabs(})}-/// Registers both hosted live providers under their configured ids.+/// Registers both hosted live providers under their configured ids, listed+/// ahead of the built-in providers as the catalogue has always shown them.pub(super) fn register() {register_live_provider(LIVE_PROVIDER_GEMINI_HOSTED,@@ -163,6 +164,7 @@ pub(super) fn register() {configured: Arc::new(backend_ready),configure: Some(Arc::new(configure_gemini)),prepare: Arc::new(|config, live| Box::pin(prepare_gemini(config, live))),+ placement: LiveProviderPlacement::BeforeBuiltIn,},);register_live_provider(@@ -176,6 +178,7 @@ pub(super) fn register() {configured: Arc::new(backend_ready),configure: Some(Arc::new(configure_elevenlabs)),prepare: Arc::new(|config, live| Box::pin(prepare_elevenlabs(config, live))),+ placement: LiveProviderPlacement::BeforeBuiltIn,},);log::debug!("{LOG_PREFIX} registered hosted live providers");diff --git a/package.json b/package.jsonindex 951a4e743c..5c85d54302 100644--- a/package.json+++ b/package.json@@ -58,7 +58,7 @@"rust:clippy": "cargo clippy -p openhuman -p openhuman-cli -p openhuman-tinyhumans -- -D warnings && pnpm --filter openhuman-app rust:clippy","rust:module-boundaries": "node scripts/ci/check-module-boundaries.mjs","rust:module-boundaries:complete": "node scripts/ci/check-module-boundaries.mjs --require-complete",- "rust:layout": "node scripts/ci/check-openhuman-rust-layout.mjs && node scripts/ci/check-crate-chain.mjs && node scripts/ci/check-storage-bypass.mjs && node scripts/ci/check-storage-owner.mjs",+ "rust:layout": "node scripts/ci/check-openhuman-rust-layout.mjs && node scripts/ci/check-crate-chain.mjs && node scripts/ci/check-core-hosted-free.mjs && node scripts/ci/check-storage-bypass.mjs && node scripts/ci/check-storage-owner.mjs","ci:module-source": "node scripts/ci/check-ci-module-source.mjs","rust:process-statics": "node scripts/ci/check-process-statics.mjs","rust:ignored-tests": "node scripts/ci/check-ignored-tests.mjs",