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(dictation): show which recognizer really answers the next press

rubenluetke10-beep182e70e17153
diff --git a/jarvis/speech/pipeline.py b/jarvis/speech/pipeline.py
index 10972964c8..96965b05d1 100644
--- a/jarvis/speech/pipeline.py
+++ b/jarvis/speech/pipeline.py
@@ -10262,6 +10262,67 @@ class SpeechPipeline:
and self._capture_permission_allowed()
)
+ def dictation_engine_status(self) -> dict[str, Any]:
+ """Which recognizer the dictation lane will really use, for the UI.
+
+ The settings name a provider; the lane in front of the microphone may
+ be a different one (an environment override, a keyless family crossed
+ to another, the on-device final pass ahead of them all — P-41). Four
+ days of dictations ran on a recognizer the settings did not name
+ before anyone could see it. This answers with what is actually armed:
+
+ ``local`` — whether the on-device pass is in front; ``provider`` /
+ ``model`` — the recognizer that answers the next press (the local
+ engine when it is up, else the first cloud family behind it);
+ ``fallback`` — the provider one step behind; ``detail`` — why the
+ local engine is NOT in front right now, when it is not (a full card,
+ a CPU-only host, a missing runtime), so the reason is a sentence on
+ the card instead of a log line. Never raises.
+ """
+ status: dict[str, Any] = {
+ "local": False,
+ "provider": "",
+ "model": "",
+ "fallback": "",
+ "detail": "",
+ }
+ try:
+ stt = self._dictation_stt()
+ except Exception as exc: # noqa: BLE001 — a status probe never breaks the view
+ log.debug("dictation engine status: provider unavailable (%s)", exc)
+ return status
+ if stt is None:
+ return status
+ # Walk down through the transparent wrappers (meter, dictionary) to the
+ # chain; each one delegates unknown attributes, so the private handles
+ # of FallbackSTT are reachable without naming the wrappers.
+ primary = getattr(stt, "_primary", None)
+ alternates = list(getattr(stt, "_alternate_names", ()) or ())
+ if primary is None:
+ status["provider"] = str(
+ getattr(stt, "provider_label", "") or getattr(stt, "name", "") or ""
+ )
+ status["model"] = str(getattr(stt, "last_used_model", "") or "")
+ return status
+ from jarvis.dictation.local_final import LocalFinalSTT
+
+ if isinstance(primary, LocalFinalSTT):
+ status["local"] = bool(primary.is_warm)
+ status["detail"] = "" if primary.is_warm else str(primary.unavailable_reason)
+ if primary.is_warm:
+ status["provider"] = primary.provider_label
+ status["model"] = primary.last_used_model
+ status["fallback"] = alternates[0] if alternates else ""
+ else:
+ status["provider"] = alternates[0] if alternates else ""
+ status["fallback"] = alternates[1] if len(alternates) > 1 else ""
+ status["model"] = ""
+ return status
+ status["provider"] = str(getattr(stt, "provider_label", "") or "")
+ status["model"] = str(getattr(stt, "last_used_model", "") or "")
+ status["fallback"] = alternates[0] if alternates else ""
+ return status
+
def start_dictation(self, *, target: str = "chat", source: str = "api") -> bool:
"""Begin a transcribe-only dictation session (idempotent-safe).
diff --git a/jarvis/ui/web/dictation_routes.py b/jarvis/ui/web/dictation_routes.py
index f7bd215aa7..a16b39e420 100644
--- a/jarvis/ui/web/dictation_routes.py
+++ b/jarvis/ui/web/dictation_routes.py
@@ -671,10 +671,28 @@ async def get_status(request: Request) -> dict[str, Any]:
except Exception as exc: # noqa: BLE001
log.debug("insertion probe failed: %s", exc)
+ # Which recognizer really answers the next press (P-41): the settings
+ # name one provider, an environment override or a keyless crossing may
+ # have put another in front, and the on-device pass sits ahead of both.
+ engine: dict[str, Any] = {
+ "local": False,
+ "provider": "",
+ "model": "",
+ "fallback": "",
+ "detail": "",
+ }
+ probe = getattr(pipeline, "dictation_engine_status", None)
+ if callable(probe):
+ try:
+ engine = dict(probe())
+ except Exception as exc: # noqa: BLE001 — never 500 a status probe
+ log.debug("dictation engine probe failed: %s", exc)
+
return {
"available": available,
"active": active,
"reason": reason,
+ "engine": engine,
"hotkey": str(getattr(trigger, "hotkey_dictate", "") or ""),
# The hands-free key is its own action, not a mode of the hold key, so
# both can be armed at once. Reported separately for the same reason:
diff --git a/jarvis/ui/web/frontend/src/hooks/useDictation.ts b/jarvis/ui/web/frontend/src/hooks/useDictation.ts
index bba1ac3cf7..f2e2a7ce3b 100644
--- a/jarvis/ui/web/frontend/src/hooks/useDictation.ts
+++ b/jarvis/ui/web/frontend/src/hooks/useDictation.ts
@@ -188,6 +188,19 @@ export interface DictationStatus {
reason: string;
detail: string;
};
+ /**
+ * Which recognizer really answers the next press (P-41). `local` is true
+ * while the on-device final pass is armed in front; `provider`/`model`
+ * name whatever answers next, `fallback` the one behind it, and `detail`
+ * says why the local engine is NOT in front when it is not.
+ */
+ engine?: {
+ local: boolean;
+ provider: string;
+ model: string;
+ fallback: string;
+ detail: string;
+ };
}
/** One recorded dictation — raw transcript alongside what was inserted. */
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index c9047a84d3..b442a3c00f 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -304,6 +304,9 @@
"state_unavailable": "Auf diesem Computer nicht verfügbar",
"shortcut_set": "Halte {0}, um zu diktieren.",
"shortcut_unset": "Noch keine Taste zugewiesen — Diktat geht auch über den Knopf unten.",
+ "engine_local": "Erkennt lokal auf diesem Rechner ({0}); Ausweichen: {1}.",
+ "engine_cloud": "Erkennt über {0}.",
+ "engine_local_off": "Lokal gerade nicht: {0}",
"assign_hint": "Weise unter Einstellungen → Sprach-Tastenkürzel eine Taste zu, um überall zu diktieren.",
"start": "Diktat starten",
"stop": "Stopp",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index 1ee1d166dc..29b3fb2d79 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -304,6 +304,9 @@
"state_unavailable": "Not available on this computer",
"shortcut_set": "Hold {0} to dictate.",
"shortcut_unset": "No key assigned yet — dictation still works from the button below.",
+ "engine_local": "Recognizes locally on this machine ({0}); fallback: {1}.",
+ "engine_cloud": "Recognizes via {0}.",
+ "engine_local_off": "Local engine not in front right now: {0}",
"assign_hint": "Assign a key in Settings → Voice Keybinds to dictate from anywhere.",
"start": "Start dictating",
"stop": "Stop",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index e378d352ce..4a07831c99 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -304,6 +304,9 @@
"state_unavailable": "No disponible en este ordenador",
"shortcut_set": "Mantén {0} para dictar.",
"shortcut_unset": "Aún no hay tecla asignada — el dictado también funciona con el botón de abajo.",
+ "engine_local": "Reconoce localmente en este equipo ({0}); alternativa: {1}.",
+ "engine_cloud": "Reconoce mediante {0}.",
+ "engine_local_off": "Motor local ahora no disponible: {0}",
"assign_hint": "Asigna una tecla en Ajustes → Atajos de voz para dictar desde cualquier sitio.",
"start": "Empezar a dictar",
"stop": "Detener",
diff --git a/jarvis/ui/web/frontend/src/views/DictationView.tsx b/jarvis/ui/web/frontend/src/views/DictationView.tsx
index 5e227a74de..fab536627d 100644
--- a/jarvis/ui/web/frontend/src/views/DictationView.tsx
+++ b/jarvis/ui/web/frontend/src/views/DictationView.tsx
@@ -249,6 +249,20 @@ export function DictationView({ hideHeader = false }: DictationViewProps = {}) {
: t("dictation.shortcut_unset")
: status?.reason || t("dictation.state_unavailable")}
</p>
+ {/* Which recognizer really answers the next press (P-41):
+ the settings name one, the lane may hold another. */}
+ {status?.available && status.engine?.provider && (
+ <p className="mt-1 text-meta text-muted-foreground">
+ {status.engine.local
+ ? t("dictation.engine_local")
+ .replace("{0}", status.engine.model || status.engine.provider)
+ .replace("{1}", status.engine.fallback || "—")
+ : t("dictation.engine_cloud").replace("{0}", status.engine.provider)}
+ {!status.engine.local && status.engine.detail
+ ? ` ${t("dictation.engine_local_off").replace("{0}", status.engine.detail)}`
+ : ""}
+ </p>
+ )}
</div>
<Button
className="gap-2"
diff --git a/tests/unit/dictation/test_local_final.py b/tests/unit/dictation/test_local_final.py
index 7ddee290c8..cb2cd7aba3 100644
--- a/tests/unit/dictation/test_local_final.py
+++ b/tests/unit/dictation/test_local_final.py
@@ -253,6 +253,78 @@ def test_the_lane_puts_the_local_engine_in_front_of_the_configured_provider(
assert built == []
+def test_the_engine_status_names_what_really_answers_the_next_press(
+ _local_ok: dict[str, Any], monkeypatch: pytest.MonkeyPatch
+) -> None:
+ """Four days of dictations ran on a recognizer the settings did not name;
+ the status card now says which one is armed and why the local one is not."""
+ import jarvis.plugins.stt as stt_plugins
+ import jarvis.speech.pipeline as pipeline_mod
+ import jarvis.speech.stt_dictionary as dictionary
+ from jarvis.core.config import DictationConfig, STTConfig
+ from jarvis.speech.pipeline import SpeechPipeline
+
+ monkeypatch.setattr(
+ stt_plugins, "build_stt_from_config", lambda cfg, **_k: SimpleNamespace(name="groq")
+ )
+ monkeypatch.setattr(
+ pipeline_mod, "_resolve_stt_fallback_chain", lambda *_a, **_k: ("openai-api",)
+ )
+ monkeypatch.setattr(dictionary, "wrap_stt_with_dictionary", lambda provider: provider)
+
+ pipe = SpeechPipeline.__new__(SpeechPipeline)
+ pipe._dictation_stt_instance = None
+ pipe._utterance_stt = object()
+ pipe._dictation_cfg = DictationConfig()
+ pipe._config = SimpleNamespace(stt=STTConfig(provider="groq-api"))
+
+ # Before the worker is up, the configured cloud provider answers.
+ before = pipe.dictation_engine_status()
+ assert before["local"] is False
+ assert before["provider"] == "groq-api"
+ assert before["fallback"] == "openai-api"
+
+ # After warm-up the local engine is in front and the cloud is one behind.
+ pipe._dictation_stt()._primary.warm_up()
+ after = pipe.dictation_engine_status()
+ assert after["local"] is True
+ assert after["provider"] == "faster-whisper"
+ assert after["model"] == local_final_mod.DEFAULT_FINAL_MODEL
+ assert after["fallback"] == "groq-api"
+ assert after["detail"] == ""
+
+
+def test_the_engine_status_explains_a_declined_local_engine(
+ _local_ok: dict[str, Any], monkeypatch: pytest.MonkeyPatch
+) -> None:
+ import jarvis.hardware.detection as detection
+ import jarvis.plugins.stt as stt_plugins
+ import jarvis.speech.pipeline as pipeline_mod
+ import jarvis.speech.stt_dictionary as dictionary
+ from jarvis.core.config import DictationConfig, STTConfig
+ from jarvis.speech.pipeline import SpeechPipeline
+
+ monkeypatch.setattr(detection, "free_accelerator_gb", lambda: (0.4, "nvml"))
+ monkeypatch.setattr(
+ stt_plugins, "build_stt_from_config", lambda cfg, **_k: SimpleNamespace(name="groq")
+ )
+ monkeypatch.setattr(pipeline_mod, "_resolve_stt_fallback_chain", lambda *_a, **_k: ())
+ monkeypatch.setattr(dictionary, "wrap_stt_with_dictionary", lambda provider: provider)
+
+ pipe = SpeechPipeline.__new__(SpeechPipeline)
+ pipe._dictation_stt_instance = None
+ pipe._utterance_stt = object()
+ pipe._dictation_cfg = DictationConfig()
+ pipe._config = SimpleNamespace(stt=STTConfig(provider="groq-api"))
+ pipe._dictation_stt()._primary.warm_up() # declined: 0.4 GB free
+
+ status = pipe.dictation_engine_status()
+
+ assert status["local"] is False
+ assert status["provider"] == "groq-api"
+ assert "0.4 GB" in status["detail"]
+
+
def test_the_switch_keeps_the_configured_provider_in_front(
monkeypatch: pytest.MonkeyPatch,
) -> None: