()
| 188 | } |
| 189 | |
| 190 | export async function checkVoiceDependencies(): Promise<{ |
| 191 | available: boolean |
| 192 | missing: string[] |
| 193 | installCommand: string | null |
| 194 | }> { |
| 195 | // Native audio module (cpal) handles everything on macOS, Linux, and Windows |
| 196 | const napi = await loadAudioNapi() |
| 197 | if (napi.isNativeAudioAvailable()) { |
| 198 | return { available: true, missing: [], installCommand: null } |
| 199 | } |
| 200 | |
| 201 | // Windows has no supported fallback — native module is required |
| 202 | if (process.platform === 'win32') { |
| 203 | return { |
| 204 | available: false, |
| 205 | missing: ['Voice mode requires the native audio module (not loaded)'], |
| 206 | installCommand: null, |
| 207 | } |
| 208 | } |
| 209 | |
| 210 | // On Linux, arecord (ALSA utils) is a valid fallback recording backend |
| 211 | if (process.platform === 'linux' && hasCommand('arecord')) { |
| 212 | return { available: true, missing: [], installCommand: null } |
| 213 | } |
| 214 | |
| 215 | const missing: string[] = [] |
| 216 | |
| 217 | if (!hasCommand('rec')) { |
| 218 | missing.push('sox (rec command)') |
| 219 | } |
| 220 | |
| 221 | const pm = missing.length > 0 ? detectPackageManager() : null |
| 222 | return { |
| 223 | available: missing.length === 0, |
| 224 | missing, |
| 225 | installCommand: pm?.displayCommand ?? null, |
| 226 | } |
| 227 | } |
| 228 | |
| 229 | // ─── Recording availability ────────────────────────────────────────── |
| 230 |
no test coverage detected