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.

chore(i18n): translate tts/__init__.py, mark DE lang-detection vocab in cartesia_tts.py (batch 05_3_jarvis, part 12)

Ruben Lütke54bcc73dd6f7
diff --git a/jarvis/missions/safety/destructive_confirm.py b/jarvis/missions/safety/destructive_confirm.py
index 5b6d99c244..e695c8ca90 100644
--- a/jarvis/missions/safety/destructive_confirm.py
+++ b/jarvis/missions/safety/destructive_confirm.py
@@ -108,7 +108,7 @@ DESTRUCTIVE_PATTERNS: Final[list[tuple[str, re.Pattern[str], str]]] = [
),
(
"drop_database_de",
- # German variant: "datenbank loeschen", "tabelle dropp(en)"
+ # German variant: "datenbank loeschen", "tabelle dropp(en)" # i18n-allow
re.compile(
r"\b(?:datenbank|tabelle|schema)\s+(?P<target>\w+)\s+" # i18n-allow
r"(?:loeschen|droppen|loesche)", # i18n-allow
@@ -120,14 +120,14 @@ DESTRUCTIVE_PATTERNS: Final[list[tuple[str, re.Pattern[str], str]]] = [
def is_destructive(prompt: str) -> tuple[bool, DestructiveDetection | None]:
- """Returns (True, DestructiveDetection) wenn der Prompt destruktiv aussieht.
+ """Returns (True, DestructiveDetection) if the prompt looks destructive.
Args:
- prompt: User-Mission-Prompt.
+ prompt: The user's mission prompt.
Returns:
- Tuple `(found, detection)`. Bei mehreren Treffern: erster (severity-
- ordering haben wir nicht — alle sind gleichermassen blockend).
+ Tuple `(found, detection)`. On multiple matches: the first one (we
+ have no severity ordering — all are equally blocking).
"""
if not prompt:
return (False, None)
diff --git a/jarvis/missions/voice/__init__.py b/jarvis/missions/voice/__init__.py
index 0bf6e7f055..528b427e41 100644
--- a/jarvis/missions/voice/__init__.py
+++ b/jarvis/missions/voice/__init__.py
@@ -1,9 +1,9 @@
-"""Phase-6 Voice-Layer fuer Mission-Status-Readback.
+"""Phase-6 voice layer for mission-status readback.
-Re-Exports der Public-API.
+Re-exports of the public API.
-Foundation: ADR-0009 §"Offen" — Voice-Readback bei MissionApproved/Failed
-nutzt PhrasePicker-Pattern (anti-repeat-window). Tone aus
+Foundation: ADR-0009 §"Open" — voice readback on MissionApproved/Failed
+uses the PhrasePicker pattern (anti-repeat window). Tone from
`jarvis/brain/JARVIS_PERSONA.md`: butler register, never "Sir". The
mission-status templates are name-neutral (they carry no hardcoded owner
name) so a fresh clone never speaks the maintainer's name.
diff --git a/jarvis/missions/voice/announcer.py b/jarvis/missions/voice/announcer.py
index 872e8adea4..e10ff59a32 100644
--- a/jarvis/missions/voice/announcer.py
+++ b/jarvis/missions/voice/announcer.py
@@ -217,13 +217,13 @@ class MissionAnnouncer:
def _render(
self, env: EventEnvelope, lang: _Lang,
) -> tuple[str, Literal["normal", "interrupt"]]:
- """Mapped Mission-Event-Typ -> (Voice-Text, Prio).
+ """Maps a mission-event type -> (voice text, priority).
- Pflicht: NUR Runtime-signierte ``summary_de``/``summary_en`` aus
- ``MissionApproved`` werden voll genommen — siehe ADR-0009 Action/
- Observation-Invariant. Worker-LLM-Output gelangt NIE als Free-Text
- in den Voice-Pfad. Failure-/Cancel-/Timeout-Texte sind statisch
- in dieser Funktion.
+ Mandatory: ONLY runtime-signed ``summary_de``/``summary_en`` from
+ ``MissionApproved`` are taken verbatim — see the ADR-0009 Action/
+ Observation invariant. Worker-LLM output NEVER reaches the voice
+ path as free text. Failure/cancel/timeout texts are static in
+ this function.
"""
payload = env.payload
@@ -235,7 +235,7 @@ class MissionAnnouncer:
# BUG-LIVE-03 (Recon-Agent 3, 2026-05-16): the announcer used
# to swallow MissionFailed.reason and emit one nacked German
# phrase for seven distinct failure modes — user heard the
- # same "fehlgeschlagen" whether the worker timed out, the
+ # same "fehlgeschlagen" whether the worker timed out, the # i18n-allow: quoted literal historical TTS output
# critic ran out of loops, or a stale mission was swept on
# boot. Map the reason to a short human cue so the user
# knows what to do next.
@@ -266,8 +266,8 @@ class MissionAnnouncer:
de_map = FAILURE_REASON_PHRASES["de"]
en_map = FAILURE_REASON_PHRASES["en"]
if lang == "de":
- tail = de_map.get(short_reason, f"Grund: {reason}" if reason else "")
- text = f"Die Mission ist fehlgeschlagen. {tail}".rstrip()
+ tail = de_map.get(short_reason, f"Grund: {reason}" if reason else "") # i18n-allow
+ text = f"Die Mission ist fehlgeschlagen. {tail}".rstrip() # i18n-allow: real German TTS voice output
else:
tail = en_map.get(short_reason, f"Reason: {reason}" if reason else "")
text = f"The mission failed. {tail}".rstrip()
@@ -289,7 +289,7 @@ class MissionAnnouncer:
if isinstance(payload, MissionTimedOut):
text = (
- "Die Mission lief in das Zeitlimit."
+ "Die Mission lief in das Zeitlimit." # i18n-allow: real German TTS voice output
if lang == "de"
else "The mission timed out."
)
@@ -300,12 +300,12 @@ class MissionAnnouncer:
return ("", "normal")
async def _resolve_voice_meta(self, mission_id: str) -> tuple[bool, _Lang]:
- """Cache-Lookup: ist die Mission voice-getriggert? Welche Sprache?
+ """Cache lookup: is the mission voice-triggered? Which language?
- Replikat aus ``MissionVoiceListener._resolve_voice_meta``. Bewusst
- keine gemeinsame Helper-Klasse, weil die beiden Listener komplett
- unabhaengige Lifecycles haben — wir wollen eine kaputte Cache-
- Stufe nicht doppelt austragen.
+ Replicated from ``MissionVoiceListener._resolve_voice_meta``.
+ Deliberately no shared helper class, because the two listeners
+ have completely independent lifecycles — we don't want to record
+ a broken cache tier twice.
"""
if mission_id in self._mission_voice_cache:
return self._mission_voice_cache[mission_id]
diff --git a/jarvis/plugins/tts/__init__.py b/jarvis/plugins/tts/__init__.py
index ceaa413510..8bfe94c77c 100644
--- a/jarvis/plugins/tts/__init__.py
+++ b/jarvis/plugins/tts/__init__.py
@@ -173,16 +173,16 @@ def _resolve_keyed_tts_provider(primary_name: str, tts_cfg: Any) -> tuple[str, A
def _resolve_voice_for_provider(
requested: str, provider: str, default: str, allowed: frozenset[str]
) -> str:
- """Liefert einen fuer den Provider gueltigen Voice-Namen.
+ """Returns a voice name valid for the provider.
- Wenn der Config-Voice nicht zur aktuellen Provider-Whitelist gehoert
- (typischer Fall: User wechselt provider, vergisst voice anzupassen),
- fallen wir auf den Provider-Default zurueck und loggen den Override.
+ When the config voice doesn't belong to the current provider whitelist
+ (typical case: the user switches provider, forgets to adjust the voice),
+ we fall back to the provider default and log the override.
"""
if not requested or requested not in allowed:
if requested:
log.info(
- "Voice %r passt nicht zu Provider %r (gueltig: %s) — nutze %r.",
+ "Voice %r does not match provider %r (valid: %s) — using %r.",
requested, provider, ", ".join(sorted(allowed)), default,
)
return default
@@ -190,7 +190,7 @@ def _resolve_voice_for_provider(
def build_tts_from_config(tts_cfg: Any) -> Any:
- """Erzeugt den TTS-Provider entsprechend `config.tts.provider`.
+ """Builds the TTS provider according to `config.tts.provider`.
Honors `[tts].fallback`: when a fallback provider is configured (and differs
from the primary), the primary is wrapped in a ``FallbackTTS`` so a
@@ -200,19 +200,19 @@ def build_tts_from_config(tts_cfg: Any) -> Any:
legacy call-sites / test doubles see identical behaviour.
Args:
- tts_cfg: `TTSConfig`-Instanz aus `jarvis.core.config`.
+ tts_cfg: `TTSConfig` instance from `jarvis.core.config`.
Returns:
- Instanz des gewaehlten TTS-Plugins (implementiert `TTSProvider`), oder
- ein `FallbackTTS` der primär + fallback umschliesst.
+ Instance of the chosen TTS plugin (implements `TTSProvider`), or
+ a `FallbackTTS` that wraps primary + fallback.
Raises:
- RuntimeError: wenn das primaere Plugin nicht importierbar ist
- (z.B. weil das Modul gar nicht installiert wurde). Frueher
- knallte hier ein nackter ImportError, den `desktop_app.py`
- via blanket-except verschluckte → ganze Speech-Pipeline weg.
- Ein nicht-baubarer *Fallback* degradiert dagegen nur (Warnung +
- primary-only), damit eine Fallback-Fehlkonfig den Ton nicht killt.
+ RuntimeError: when the primary plugin is not importable
+ (e.g. because the module was never installed). Previously
+ this raised a bare ImportError that `desktop_app.py`
+ swallowed via a blanket except → the entire speech pipeline gone.
+ An un-buildable *fallback*, by contrast, only degrades (warning +
+ primary-only), so a fallback misconfiguration doesn't kill the audio.
"""
requested_name = (tts_cfg.provider or "gemini-flash-tts").lower()
# Open-source AP-22: if the configured TTS provider has no usable key, cross
@@ -253,11 +253,11 @@ def _build_provider(tts_cfg: Any, provider: str) -> Any:
)
except ImportError as exc:
raise RuntimeError(
- f"TTS-Provider 'elevenlabs' konfiguriert, aber Plugin nicht "
- f"importierbar: {exc}",
+ f"TTS provider 'elevenlabs' configured, but the plugin is not "
+ f"importable: {exc}",
) from exc
- # ElevenLabs nutzt Voice-IDs (kryptische Hashes), keine Provider-
- # Whitelist — wir nehmen den Config-Wert wie er ist.
+ # ElevenLabs uses voice IDs (cryptic hashes), no provider
+ # whitelist — we take the config value as-is.
return ElevenLabsTTS(
model=tts_cfg.model or "eleven_flash_v2_5",
default_voice=tts_cfg.voice_de or JARVIS_VOICE_DANIEL,
@@ -307,10 +307,10 @@ def _build_provider(tts_cfg: Any, provider: str) -> Any:
from jarvis.plugins.tts.grok_voice_tts import GROK_VOICE_LEO, GrokVoiceTTS
except ImportError as exc:
raise RuntimeError(
- f"TTS-Provider 'grok-voice' konfiguriert, aber Plugin nicht "
- f"importierbar: {exc}. Pruefe, ob die Datei "
- f"jarvis/plugins/tts/grok_voice_tts.py existiert und httpx "
- f"installiert ist.",
+ f"TTS provider 'grok-voice' configured, but the plugin is not "
+ f"importable: {exc}. Check whether the file "
+ f"jarvis/plugins/tts/grok_voice_tts.py exists and httpx "
+ f"is installed.",
) from exc
voice = _resolve_voice_for_provider(
tts_cfg.voice_de, "grok-voice", GROK_VOICE_LEO, _GROK_VOICES,
@@ -324,21 +324,21 @@ def _build_provider(tts_cfg: Any, provider: str) -> Any:
if provider not in ("gemini-flash-tts", "gemini-flash", "gemini"):
log.warning(
- "Unbekannter TTS-Provider %r — falle auf gemini-flash-tts zurueck.",
+ "Unknown TTS provider %r — falling back to gemini-flash-tts.",
tts_cfg.provider,
)
- # Default / Fallback: Gemini-Flash-TTS (bisheriges Verhalten).
+ # Default / fallback: Gemini Flash TTS (previous behavior).
try:
from jarvis.plugins.tts.gemini_flash_tts import GeminiFlashTTS
except ImportError as exc:
raise RuntimeError(
- f"Gemini-TTS-Plugin nicht importierbar: {exc}",
+ f"Gemini TTS plugin not importable: {exc}",
) from exc
voice = _resolve_voice_for_provider(
tts_cfg.voice_de, "gemini-flash-tts", "Charon", _GEMINI_VOICES,
)
- # Backwards-compat: alte Configs mit ElevenLabs-Voice-ID auf Gemini-Default.
+ # Backwards compat: old configs with an ElevenLabs voice ID map to the Gemini default.
if voice == "onwK4e9ZLuTAKqWW03F9":
voice = "Charon"
return GeminiFlashTTS(
diff --git a/jarvis/plugins/tts/cartesia_tts.py b/jarvis/plugins/tts/cartesia_tts.py
index 28831f8dbc..dc9f8e5a04 100644
--- a/jarvis/plugins/tts/cartesia_tts.py
+++ b/jarvis/plugins/tts/cartesia_tts.py
@@ -45,12 +45,12 @@ DEFAULT_VOICE_ID_ES = "15d0c2e2-8d29-44c3-be23-d585d5f154a1" # Pedro — Formal
# so a missing language hint behaves like the previous single-voice plugin.
DEFAULT_VOICE_ID = DEFAULT_VOICE_ID_EN
-_SENTENCE_END = re.compile(r"(?<=[.!?…])\s+(?=[A-ZÄÖÜ])")
+_SENTENCE_END = re.compile(r"(?<=[.!?…])\s+(?=[A-ZÄÖÜ])") # i18n-allow (DE letters are part of the sentence-boundary match set)
# Text-detection heuristic: when the caller does not pass a language_code,
# we look at the transcript to pick the right voice. Cheap, no LLM call,
# no library dependency. False positives fall back to the generic voice.
-_DE_HINTS = re.compile(r"[äöüÄÖÜß]|\b(ich|nicht|und|der|die|das|ist|mit|für|werde|machen|gerne|bitte)\b", re.IGNORECASE)
+_DE_HINTS = re.compile(r"[äöüÄÖÜß]|\b(ich|nicht|und|der|die|das|ist|mit|für|werde|machen|gerne|bitte)\b", re.IGNORECASE) # i18n-allow (DE word list a language-detection classifier must match)
_ES_HINTS = re.compile(r"[ñáéíóúÑÁÉÍÓÚ¿¡]|\b(que|para|con|por|esto|esta|hola|gracias|señor|cómo)\b", re.IGNORECASE)