Skip to content

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

fix(voice): convert opaque errors to strings in capture and hotkey paths

Steven Enamakel23c40b15f49e
diff --git a/crates/openhuman-core/src/voice/always_on/capture.rs b/crates/openhuman-core/src/voice/always_on/capture.rs
index 8131fb0cbf..6b82609ed3 100644
--- a/crates/openhuman-core/src/voice/always_on/capture.rs
+++ b/crates/openhuman-core/src/voice/always_on/capture.rs
@@ -14,7 +14,7 @@ pub(super) use tinyvoice::capture::{CaptureFormat, RawChunk};
pub(super) fn spawn_capture_thread(
tx: tokio::sync::mpsc::Sender<RawChunk>,
) -> Result<CaptureFormat, String> {
- tinyvoice::capture::spawn_capture_thread(tx, microphone_permission)
+ tinyvoice::capture::spawn_capture_thread(tx, microphone_permission).map_err(|e| e.to_string())
}
/// Surface the mic permission state explicitly — a denied/Unknown state is the
diff --git a/crates/openhuman-core/src/voice/audio_capture.rs b/crates/openhuman-core/src/voice/audio_capture.rs
index 3542021eaa..89ad4074b4 100644
--- a/crates/openhuman-core/src/voice/audio_capture.rs
+++ b/crates/openhuman-core/src/voice/audio_capture.rs
@@ -84,7 +84,7 @@ impl RecordingHandle {
let Some(inner) = self.inner.take() else {
return Err("recording already stopped".to_string());
};
- let raw = inner.stop().await?;
+ let raw = inner.stop().await.map_err(|e| e.to_string())?;
finalize(config, &raw).await
}
@@ -167,7 +167,10 @@ async fn finalize(config: &Config, raw: &RawRecording) -> Result<RecordingResult
/// and dropped on the same thread).
pub fn start_recording() -> Result<RecordingHandle, String> {
Ok(RecordingHandle {
- inner: Some(tinyvoice::capture::start_recording(microphone_permission)?),
+ inner: Some(
+ tinyvoice::capture::start_recording(microphone_permission)
+ .map_err(|e| e.to_string())?,
+ ),
#[cfg(test)]
finalized: None,
})
@@ -175,7 +178,7 @@ pub fn start_recording() -> Result<RecordingHandle, String> {
/// List available input devices.
pub fn list_input_devices() -> Result<Vec<String>, String> {
- tinyvoice::capture::list_input_devices()
+ tinyvoice::capture::list_input_devices().map_err(|e| e.to_string())
}
/// The host's microphone-permission policy for a one-shot recording.
diff --git a/crates/openhuman-core/src/voice/server/hotkey_listener.rs b/crates/openhuman-core/src/voice/server/hotkey_listener.rs
index 729c24d529..3829622620 100644
--- a/crates/openhuman-core/src/voice/server/hotkey_listener.rs
+++ b/crates/openhuman-core/src/voice/server/hotkey_listener.rs
@@ -75,8 +75,8 @@ pub(super) fn start_hotkey_listener(
// branch above; the rdev listener manages its own lifecycle, so bind it
// here to keep the shared signature warning-free on non-macOS.
let _ = server_cancel;
- let combo = hotkey::parse_hotkey(hotkey_str)?;
- let (handle, rx) = hotkey::start_listener(combo, mode)?;
+ let combo = hotkey::parse_hotkey(hotkey_str).map_err(|e| e.to_string())?;
+ let (handle, rx) = hotkey::start_listener(combo, mode).map_err(|e| e.to_string())?;
Ok((HotkeyListenerKind::Rdev(handle), rx))
}
}