Skip to content

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

refactor(voice): remove always-on listening module

Steven Enamakel7b0d47ce59b9
diff --git a/crates/openhuman-core/src/security/credentials/ops/gated_services.rs b/crates/openhuman-core/src/security/credentials/ops/gated_services.rs
index 8d71d235bf..8f2e33c97a 100644
--- a/crates/openhuman-core/src/security/credentials/ops/gated_services.rs
+++ b/crates/openhuman-core/src/security/credentials/ops/gated_services.rs
@@ -147,28 +147,6 @@ pub async fn start_credential_gated_services(
));
}
- // 3b. Always-on listening (Phase 2): continuous mic + VAD → STT → agent.
- // Its cold WASAPI init (`always_on::spawn_capture_thread`) is the
- // Windows-specific blocker; it now runs the blocking capture-readiness
- // handshake on the blocking pool (see `always_on::start_if_enabled`), so
- // on its own task it neither stalls an async worker nor the hotkey /
- // command registration above.
- {
- let config = config.clone();
- let ctx = ctx.clone();
- tasks.push((
- "always_on",
- tokio::spawn(async move {
- let step = std::time::Instant::now();
- crate::voice::always_on::start_if_enabled(&ctx, &config).await;
- log::debug!(
- "[services] always-on listening started ({} ms)",
- step.elapsed().as_millis()
- );
- }),
- ));
- }
-
let total = tasks.len();
let mut failed = 0usize;
for (name, task) in tasks {
@@ -217,7 +195,6 @@ pub async fn stop_credential_gated_services(
crate::voice::dictation_listener::stop().await;
// 6. Disable delivery and release module-owned microphone/output leases.
- crate::voice::always_on::shutdown().await;
#[cfg(feature = "voice")]
if let Err(error) = crate::voice::capture_lease::close_all().await {
log::warn!("[services] voice capture cleanup pending: {error}");
diff --git a/crates/openhuman-core/src/voice/capture_lease.rs b/crates/openhuman-core/src/voice/capture_lease.rs
index 8c8d6ab059..ea8f544341 100644
--- a/crates/openhuman-core/src/voice/capture_lease.rs
+++ b/crates/openhuman-core/src/voice/capture_lease.rs
@@ -22,7 +22,6 @@ const MODULE: &str = "tinyvoice";
const READ_BYTES: usize = 256 * 1024;
const MAX_OUTPUT_BYTES: usize = 32 * 1024 * 1024;
static RECORDING_GENERATION: AtomicU64 = AtomicU64::new(0);
-static STREAM_GENERATION: AtomicU64 = AtomicU64::new(0);
static NEXT_ID: AtomicU64 = AtomicU64::new(1);
static LEASES: LazyLock<Mutex<HashMap<u64, Arc<State>>>> =
LazyLock::new(|| Mutex::new(HashMap::new()));
@@ -30,13 +29,11 @@ static HOOK: AtomicBool = AtomicBool::new(false);
#[derive(Clone, Copy, PartialEq, Eq)]
pub(super) enum Kind {
Recording,
- Stream,
}
impl Kind {
fn generation(self) -> &'static AtomicU64 {
match self {
Self::Recording => &RECORDING_GENERATION,
- Self::Stream => &STREAM_GENERATION,
}
}
}
@@ -346,15 +343,8 @@ fn cleanup_result(result: CaptureResult<()>) -> Result<(), String> {
pub(crate) async fn close_all() -> Result<(), String> {
close_kind(None).await
}
-pub(super) async fn close_streams() -> Result<(), String> {
- close_kind(Some(Kind::Stream)).await
-}
async fn close_kind(kind: Option<Kind>) -> Result<(), String> {
- for candidate in [Kind::Recording, Kind::Stream] {
- if kind.is_none_or(|kind| kind == candidate) {
- candidate.generation().fetch_add(1, Ordering::SeqCst);
- }
- }
+ RECORDING_GENERATION.fetch_add(1, Ordering::SeqCst);
let states: Vec<_> = LEASES
.lock()
.expect("capture lease registry poisoned")
diff --git a/crates/openhuman-core/src/voice/mod.rs b/crates/openhuman-core/src/voice/mod.rs
index 9673b7f7c9..ca47ff2298 100644
--- a/crates/openhuman-core/src/voice/mod.rs
+++ b/crates/openhuman-core/src/voice/mod.rs
@@ -28,8 +28,6 @@
pub mod compile_status;
pub use compile_status::VOICE_COMPILED_IN;
-#[cfg(feature = "voice")]
-pub mod always_on;
#[cfg(feature = "voice")]
pub mod audio_capture;
#[cfg(feature = "voice")]
diff --git a/crates/openhuman-core/src/voice/stub.rs b/crates/openhuman-core/src/voice/stub.rs
index 04ef8650b8..9de03965ff 100644
--- a/crates/openhuman-core/src/voice/stub.rs
+++ b/crates/openhuman-core/src/voice/stub.rs
@@ -174,23 +174,6 @@ pub mod dictation_listener {
pub async fn stop() {}
}
-// ---------------------------------------------------------------------------
-// always_on::{start_if_enabled, stop}
-// ---------------------------------------------------------------------------
-
-pub mod always_on {
- use crate::config::Config;
-
- /// No-op: always-on listening does not exist when voice is disabled.
- pub async fn start_if_enabled(_ctx: &crate::core::runtime::DispatchCtx, _config: &Config) {}
-
- /// No-op: nothing to stop.
- pub fn stop() {}
-
- /// No-op: no module capture leases exist when voice is disabled.
- pub async fn shutdown() {}
-}
-
// ---------------------------------------------------------------------------
// streaming::handle_dictation_ws (provided by the real voice host adapter)
// ---------------------------------------------------------------------------