Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

feat(onboarding): verify mic level before acknowledging the wake word

Ruben Lütke5fb535f8276e
diff --git a/jarvis/ui/web/frontend/src/components/onboarding/steps/WakeWordStep.test.tsx b/jarvis/ui/web/frontend/src/components/onboarding/steps/WakeWordStep.test.tsx
index 58205485a7..e5053c2335 100644
--- a/jarvis/ui/web/frontend/src/components/onboarding/steps/WakeWordStep.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/onboarding/steps/WakeWordStep.test.tsx
@@ -115,3 +115,68 @@ it("wake-word path: a degraded save does NOT advance and offers the local-speech
await waitFor(() => expect(setWakeActivation).toHaveBeenCalledWith(true));
expect(goNext).toHaveBeenCalled();
});
+
+it("wake-word path: renders a mic-check control that reports a good level", async () => {
+ const fetchSpy = vi.fn(() =>
+ Promise.resolve({
+ ok: true,
+ status: 200,
+ json: () => Promise.resolve({ max_dbfs: -15.0, no_device: false, too_quiet: false }),
+ }),
+ );
+ vi.stubGlobal("fetch", fetchSpy);
+ renderStep();
+ selectWakeMode();
+
+ expect(screen.getByText("onboarding.wake_word.mic_check.title")).toBeDefined();
+ const testButton = screen.getByRole("button", { name: "onboarding.wake_word.mic_check.test_button" });
+ expect(screen.getByRole("button", { name: "onboarding.wake_word.mic_check.say_once_button" })).toBeDefined();
+
+ fireEvent.click(testButton);
+ await waitFor(() =>
+ expect(fetchSpy).toHaveBeenCalledWith("/api/settings/wake-word/mic-level"),
+ );
+ await waitFor(() => expect(screen.getByText("onboarding.wake_word.mic_check.good")).toBeDefined());
+});
+
+it("wake-word path: mic-check shows the amber too-quiet warning without blocking the save CTA", async () => {
+ const fetchSpy = vi.fn(() =>
+ Promise.resolve({
+ ok: true,
+ status: 200,
+ json: () => Promise.resolve({ max_dbfs: -55.0, no_device: false, too_quiet: true }),
+ }),
+ );
+ vi.stubGlobal("fetch", fetchSpy);
+ renderStep();
+ selectWakeMode();
+
+ fireEvent.click(screen.getByRole("button", { name: "onboarding.wake_word.mic_check.test_button" }));
+ const warning = await screen.findByText("onboarding.wake_word.mic_check.too_quiet");
+ expect(warning).toBeDefined();
+
+ // Acknowledgment must never be blocked by a failed/quiet mic check — the
+ // save CTA is only gated on word length + the ack checkbox.
+ fireEvent.change(screen.getByRole("textbox"), { target: { value: "Nova" } });
+ fireEvent.click(screen.getByRole("checkbox"));
+ const cta = screen.getByRole("button", { name: "onboarding.wake_word.cta" });
+ expect((cta as HTMLButtonElement).disabled).toBe(false);
+});
+
+it("wake-word path: mic-check reports a neutral no-device state on a headless host", async () => {
+ const fetchSpy = vi.fn(() =>
+ Promise.resolve({
+ ok: true,
+ status: 200,
+ json: () => Promise.resolve({ max_dbfs: -120.0, no_device: true, too_quiet: false }),
+ }),
+ );
+ vi.stubGlobal("fetch", fetchSpy);
+ renderStep();
+ selectWakeMode();
+
+ fireEvent.click(screen.getByRole("button", { name: "onboarding.wake_word.mic_check.say_once_button" }));
+ await waitFor(() =>
+ expect(screen.getByText("onboarding.wake_word.mic_check.no_device")).toBeDefined(),
+ );
+});
diff --git a/jarvis/ui/web/frontend/src/components/onboarding/steps/WakeWordStep.tsx b/jarvis/ui/web/frontend/src/components/onboarding/steps/WakeWordStep.tsx
index 4fe7236fe4..8890e2b303 100644
--- a/jarvis/ui/web/frontend/src/components/onboarding/steps/WakeWordStep.tsx
+++ b/jarvis/ui/web/frontend/src/components/onboarding/steps/WakeWordStep.tsx
@@ -7,6 +7,15 @@ import type { StepProps } from "../OnboardingFlow";
type Mode = "choice" | "wake" | "shortcut";
+/** GET /api/settings/wake-word/mic-level response shape. */
+interface MicLevelResult {
+ max_dbfs: number;
+ no_device: boolean;
+ too_quiet: boolean;
+}
+
+type MicCheckState = "idle" | "checking" | "done";
+
/**
* Two honest activation paths — no branded default (Marvel owns "Jarvis" as a
* trademark, so recommending "Hey Jarvis" out of the box is off the table):
@@ -32,6 +41,15 @@ export function WakeWordStep({ onb, goNext }: StepProps) {
// user and offer the one-click local-speech install, or an honest opt-out.
const [degraded, setDegraded] = useState(false);
const { status: install, install: startInstall } = useLocalSpeechInstall();
+ // Mic verification (Task 7): a live dBFS read from the desktop app's own
+ // capture path (the same one the wake-word detector listens on) — never
+ // blocks the save/acknowledge below, it just surfaces an honest signal so a
+ // quiet mic or a headless/no-mic host is visible before the user commits.
+ const [micCheck, setMicCheck] = useState<{
+ state: MicCheckState;
+ result: MicLevelResult | null;
+ error: string | null;
+ }>({ state: "idle", result: null, error: null });
const trimmed = word.trim();
const canSave = trimmed.length >= 2 && ack && !busy;
@@ -45,6 +63,23 @@ export function WakeWordStep({ onb, goNext }: StepProps) {
if (err) setErr(null);
}
+ // Shared by both the "Test your microphone" and "Say your wake word once"
+ // affordances — both hit the same live dBFS read; the second just prompts
+ // the user to say their word during the ~3s window instead of just any
+ // sound. Never throws: a fetch failure is shown as its own honest state,
+ // never blocks the save/acknowledge CTA below.
+ async function runMicCheck() {
+ setMicCheck({ state: "checking", result: null, error: null });
+ try {
+ const res = await fetch("/api/settings/wake-word/mic-level");
+ if (!res.ok) throw new Error(`HTTP ${res.status}`);
+ const data: MicLevelResult = await res.json();
+ setMicCheck({ state: "done", result: data, error: null });
+ } catch (e) {
+ setMicCheck({ state: "done", result: null, error: (e as Error).message });
+ }
+ }
+
async function onSaveWake() {
if (!canSave) return;
setBusy(true);
@@ -180,6 +215,47 @@ export function WakeWordStep({ onb, goNext }: StepProps) {
</p>
) : null}
+ <div className="flex flex-col gap-2 rounded-md border border-muted-foreground/25 p-3">
+ <div className="flex flex-wrap items-center justify-between gap-2">
+ <span className="text-xs font-medium">{t("onboarding.wake_word.mic_check.title")}</span>
+ <div className="flex flex-wrap gap-2">
+ <Button
+ variant="outline"
+ size="sm"
+ disabled={micCheck.state === "checking"}
+ onClick={() => void runMicCheck()}
+ >
+ {micCheck.state === "checking"
+ ? t("onboarding.wake_word.mic_check.checking")
+ : t("onboarding.wake_word.mic_check.test_button")}
+ </Button>
+ <Button
+ variant="outline"
+ size="sm"
+ disabled={micCheck.state === "checking"}
+ onClick={() => void runMicCheck()}
+ >
+ {t("onboarding.wake_word.mic_check.say_once_button")}
+ </Button>
+ </div>
+ </div>
+ {micCheck.state === "checking" && (
+ <p className="text-xs text-muted-foreground">{t("onboarding.wake_word.mic_check.listening")}</p>
+ )}
+ {micCheck.state === "done" && micCheck.error && (
+ <p className="text-xs text-amber-500">{t("onboarding.wake_word.mic_check.error")}</p>
+ )}
+ {micCheck.state === "done" && micCheck.result && (
+ micCheck.result.no_device ? (
+ <p className="text-xs text-muted-foreground">{t("onboarding.wake_word.mic_check.no_device")}</p>
+ ) : micCheck.result.too_quiet ? (
+ <p className="text-xs text-amber-500">{t("onboarding.wake_word.mic_check.too_quiet")}</p>
+ ) : (
+ <p className="text-xs text-emerald-500">{t("onboarding.wake_word.mic_check.good")}</p>
+ )
+ )}
+ </div>
+
<p className="text-xs text-muted-foreground">
{t("onboarding.wake_word.notice")}{" "}
<button
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index 3c237f1523..f33d9eae8c 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -874,6 +874,9 @@
"tab_realtime": "Realtime",
"tab_subagents": "Jarvis-Agents",
"tab_advanced": "Erweitert",
+ "mode_pipeline": "Pipeline",
+ "mode_realtime": "Realtime",
+ "mode_active_badge": "Aktiv",
"cat_brain_desc": "Das Modell, das Chat, Routing und Computer-Use antreibt.",
"cat_tts_desc": "Die Stimme, mit der Jarvis spricht.",
"cat_stt_desc": "Wie Jarvis deine Sprache in Text umwandelt.",
@@ -1520,7 +1523,18 @@
"cta": "Aktivierungswort speichern",
"saving": "Speichern…",
"derived_name": "Dein Assistent heißt dann: {0}",
- "continue_anyway": "Trotzdem fortfahren"
+ "continue_anyway": "Trotzdem fortfahren",
+ "mic_check": {
+ "title": "Mikrofon-Check",
+ "test_button": "Mikrofon testen",
+ "say_once_button": "Aktivierungswort einmal sagen",
+ "checking": "Höre zu…",
+ "listening": "Höre zu — sprich jetzt…",
+ "good": "Klingt gut — dein Mikrofon hat deine Stimme klar aufgenommen.",
+ "too_quiet": "Das war sehr leise. Erhöhe die Mikrofonlautstärke oder rücke näher heran und versuche es erneut.",
+ "no_device": "Kein Mikrofon erkannt — du kannst die Einrichtung trotzdem abschließen und das später in den Einstellungen beheben.",
+ "error": "Das Mikrofon konnte gerade nicht geprüft werden."
+ }
},
"api_keys": {
"title": "Verbinde deine KI-Dienste (optional)",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index f9abaee0c6..738fdf6492 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -874,6 +874,9 @@
"tab_realtime": "Realtime",
"tab_subagents": "Jarvis-Agents",
"tab_advanced": "Advanced",
+ "mode_pipeline": "Pipeline",
+ "mode_realtime": "Realtime",
+ "mode_active_badge": "Active",
"cat_brain_desc": "The model that powers chat, routing, and Computer-Use.",
"cat_tts_desc": "The voice Jarvis speaks with.",
"cat_stt_desc": "How Jarvis turns your speech into text.",
@@ -1521,7 +1524,18 @@
"cta": "Save wake word",
"saving": "Saving…",
"derived_name": "Your assistant will be called: {0}",
- "continue_anyway": "Continue anyway"
+ "continue_anyway": "Continue anyway",
+ "mic_check": {
+ "title": "Microphone check",
+ "test_button": "Test your microphone",
+ "say_once_button": "Say your wake word once",
+ "checking": "Listening…",
+ "listening": "Listening — speak now…",
+ "good": "Sounds good — your microphone picked up your voice clearly.",
+ "too_quiet": "That was very quiet. Turn up your microphone volume or move closer, then try again.",
+ "no_device": "No microphone detected — you can still finish setup and fix this later in Settings.",
+ "error": "Could not check the microphone right now."
+ }
},
"api_keys": {
"title": "Connect your AI services (optional)",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index 0dc3de9567..3b1b974d67 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -874,6 +874,9 @@
"tab_realtime": "Tiempo real",
"tab_subagents": "Jarvis-Agents",
"tab_advanced": "Avanzado",
+ "mode_pipeline": "Pipeline",
+ "mode_realtime": "Realtime",
+ "mode_active_badge": "Activo",
"cat_brain_desc": "El modelo que impulsa el chat, el enrutamiento y Computer-Use.",
"cat_tts_desc": "La voz con la que habla Jarvis.",
"cat_stt_desc": "Cómo convierte Jarvis tu voz en texto.",
@@ -1520,7 +1523,18 @@
"cta": "Guardar palabra de activación",
"saving": "Guardando…",
"derived_name": "Tu asistente se llamará: {0}",
- "continue_anyway": "Continuar de todos modos"
+ "continue_anyway": "Continuar de todos modos",
+ "mic_check": {
+ "title": "Comprobación del micrófono",
+ "test_button": "Probar micrófono",
+ "say_once_button": "Di tu palabra de activación una vez",
+ "checking": "Escuchando…",
+ "listening": "Escuchando — habla ahora…",
+ "good": "Suena bien — tu micrófono captó tu voz con claridad.",
+ "too_quiet": "Eso sonó muy bajo. Sube el volumen del micrófono o acércate y vuelve a intentarlo.",
+ "no_device": "No se detectó ningún micrófono — puedes terminar la configuración igualmente y solucionarlo más tarde en Ajustes.",
+ "error": "No se pudo comprobar el micrófono en este momento."
+ }
},
"api_keys": {
"title": "Conecta tus servicios de IA (opcional)",