Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 8 additions & 10 deletions crates/app/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ pub async fn start(

// Text injection channel
#[cfg(feature = "text-injection")]
let (text_injection_tx, text_injection_rx) = mpsc::channel::<TranscriptionEvent>(100);
let (_text_injection_tx, text_injection_rx) = mpsc::channel::<TranscriptionEvent>(100);
#[cfg(not(feature = "text-injection"))]
let (_text_injection_tx, _text_injection_rx) = mpsc::channel::<TranscriptionEvent>(100);

Expand All @@ -521,10 +521,10 @@ pub async fn start(
let mut stt_forward_handle: Option<JoinHandle<()>> = None;
#[allow(unused_variables)]
let (stt_handle, vad_fanout_handle) = if let Some(pm) = plugin_manager.clone() {
// This is the single, unified path for STT processing.
#[cfg(feature = "whisper")]
let (session_tx, session_rx) = mpsc::channel::<SessionEvent>(100);
let stt_audio_rx = audio_tx.subscribe();
// This is the single, unified path for STT processing.
#[cfg(feature = "whisper")]
let (session_tx, session_rx) = mpsc::channel::<SessionEvent>(100);
let stt_audio_rx = audio_tx.subscribe();

#[cfg(feature = "whisper")]
let (stt_pipeline_tx, stt_pipeline_rx) = mpsc::channel::<TranscriptionEvent>(100);
Expand All @@ -550,8 +550,8 @@ pub async fn start(
Settings::default(), // Use default settings for now
);

let vad_bcast_tx_clone = vad_bcast_tx.clone();
let activation_mode = opts.activation_mode;
let vad_bcast_tx_clone = vad_bcast_tx.clone();
let activation_mode = opts.activation_mode;

// This task is the new "translator" from VAD/Hotkey events to generic SessionEvents.
let vad_fanout_handle = tokio::spawn(async move {
Expand Down Expand Up @@ -770,11 +770,9 @@ pub async fn start(
#[cfg(test)]
mod tests {
use super::*;



use coldvox_stt::plugin::{FailoverConfig, GcPolicy, PluginSelectionConfig};
use coldvox_stt::TranscriptionEvent;


/// Helper to create default runtime options for testing.
fn test_opts(activation_mode: ActivationMode) -> AppRuntimeOptions {
Expand Down
28 changes: 22 additions & 6 deletions crates/app/tests/golden_master.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,20 +117,36 @@ pub mod harness {
(Value::Object(ao), Value::Object(bo)) => {
let kind_a = ao.get("kind").and_then(|v| v.as_str()).unwrap_or("");
let kind_b = bo.get("kind").and_then(|v| v.as_str()).unwrap_or("");
if kind_a != kind_b { all_ok = false; break; }
if kind_a != kind_b {
all_ok = false;
break;
}
if kind_a == "SpeechEnd" {
let da = ao.get("duration_ms").and_then(|v| v.as_u64()).unwrap_or(0);
let db = bo.get("duration_ms").and_then(|v| v.as_u64()).unwrap_or(0);
let da =
ao.get("duration_ms").and_then(|v| v.as_u64()).unwrap_or(0);
let db =
bo.get("duration_ms").and_then(|v| v.as_u64()).unwrap_or(0);
let diff = da.abs_diff(db);
if diff > 128 { all_ok = false; break; }
if diff > 128 {
all_ok = false;
break;
}
} else if kind_a == "SpeechStart" {
// SpeechStart has no duration, ignore
} else {
// Unknown kind fallback to strict equality
if av != bv { all_ok = false; break; }
if av != bv {
all_ok = false;
break;
}
}
}
_ => {
if av != bv {
all_ok = false;
break;
}
}
_ => { if av != bv { all_ok = false; break; } }
}
}
all_ok
Expand Down
3 changes: 3 additions & 0 deletions crates/coldvox-foundation/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ pub enum SttError {

#[error("Invalid configuration: {0}")]
InvalidConfig(String),

#[error("Checksum validation failed: {0}")]
ChecksumFailed(String),
}

#[derive(Debug, thiserror::Error)]
Expand Down
10 changes: 8 additions & 2 deletions crates/coldvox-stt/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,19 @@ thiserror = "2.0"
dirs = "5.0"
serde = { version = "1.0", features = ["derive"] }
coldvox-foundation = { path = "../coldvox-foundation" }
## Removed Python-dependent faster-whisper backend; will replace with pure Rust implementation
sha2 = "0.10"
serde_json = "1.0"
pyo3 = { version = "0.20", features = ["auto-initialize"], optional = true }
faster-whisper-rs = { git = "https://github.com/gmt-happy/faster-whisper-rs", rev = "319e719", optional = true }

[dev-dependencies]
tempfile = "3.8"
hound = "3.5"

[features]
default = []
parakeet = []
whisper = [] # Placeholder until new backend is implemented
whisper = ["dep:pyo3", "dep:faster-whisper-rs"]
coqui = []
leopard = []
silero-stt = []
1 change: 1 addition & 0 deletions crates/coldvox-stt/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub use coldvox_foundation::error::ColdVoxError;
pub use plugin::SttPlugin;
pub use plugin_adapter::PluginAdapter; // adapter for plugin → StreamingStt
pub use types::{TranscriptionConfig, TranscriptionEvent, WordInfo};
pub mod validation;

/// Generates unique utterance IDs
static UTTERANCE_ID_COUNTER: AtomicU64 = AtomicU64::new(1);
Expand Down
Loading