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.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
fix(brain): make the shared turn planner actually match German umlaut verbs and common assistant actions
Ruben Lütke322feade20f6
diff --git a/jarvis/brain/turn_planner.py b/jarvis/brain/turn_planner.pyindex ab5edbc4aa..f26f8048a8 100644--- a/jarvis/brain/turn_planner.py+++ b/jarvis/brain/turn_planner.py@@ -108,23 +108,52 @@ _MISSION_RE = re.compile(_SKILL_RE = re.compile(r"\b(?:skill\w*|macro\w*|faehigkeit\w*|makro\w*|habilidad\w*)\b" # i18n-allow: speech input)+# Over-matching costs only latency (the orchestrator still answers+# conversationally); under-matching loses the user's action — so common+# assistant verbs (media, reminders/notes, settings switches, calendar,+# on/off) are included even where a noun reading exists ("playlist",+# "agenda", "activity"). Guarded stems exclude the frequent non-action+# words ("merkwürdig", "tragisch", "legal"). # i18n-allow: names the excluded German tokens_ACTION_FALLBACK_RE = re.compile(r"\b(?:open|close|start|stop|create|write|save|add|change|set|restart|"r"install|connect|delete|move|send|run|build|research|call|click|type|"- r"upload|download|book|buy|post|reply|"+ r"upload|download|book|buy|post|reply|switch\w*|turn\w*|play\w*|"+ r"paus\w*|resume|remember|notes?|schedule|remind\w*|cancel\w*|"+ r"update\w*|rename|enable|disable|mute|record|activ\w*|deactiv\w*|"r"oeffn\w*|schliess\w*|start\w*|stopp\w*|erstell\w*|schreib\w*|"r"speicher\w*|aender\w*|installier\w*|verbind\w*|loesch\w*|"r"verschieb\w*|schick\w*|send\w*|fuehr\w*|bau\w*|ruf\w*|klick\w*|"- r"tipp\w*|buch\w*|kauf\w*|antwort\w*|"+ r"tipp\w*|buch\w*|kauf\w*|antwort\w*|wechsel\w*|wechsl\w*|schalt\w*|"+ r"stell\w*|spiel\w*|merk(?!wuerdig)\w*|notier\w*|trag(?!isch|oedi)\w*|"+ r"leg(?:e|st|t|en)?\b|setz\w*|pausier\w*|aktivier\w*|deaktivier\w*|"+ r"erinner\w*|dreh\w*|"r"abre\w*|cierra\w*|inicia\w*|crea\w*|escrib\w*|guarda\w*|"r"cambia\w*|instala\w*|conecta\w*|elimina\w*|envia\w*|"- r"ejecuta\w*|llama\w*|haz\w*)\b" # i18n-allow: multilingual speech-input matching data+ r"ejecuta\w*|llama\w*|haz\w*|recuerd\w*|anot\w*|apunt\w*|pon\w*|"+ r"reproduc\w*|reanud\w*|apag\w*|enciend\w*|agend\w*|"+ r"reserv\w*)\b" # i18n-allow: multilingual speech-input matching data)+_FOLLOW_UP_REFERENCE_RE = re.compile(+ r"\b(?:that|there|those|them|inside|what else|"+ r"da|darin|drin|dort|dazu|davon|darueber|was noch|" # i18n-allow+ r"eso|esto|ahi|alli|dentro|que mas)\b|" # i18n-allow+ r"\b(?:what\s+does\s+it|what(?:'s|\s+is)\s+in\s+it|in\s+it)\b"+)+_CONTEXT_MAX_CHARS = 2_000+++# German umlauts must become their transliterated digraphs (ä→ae, ö→oe, # i18n-allow: names the mapped umlaut characters+# ü→ue; casefold already yields ß→ss) because every German vocabulary entry # i18n-allow: names the mapped umlaut characters+# above is written in that form. A plain NFKD combining-strip would produce+# the OTHER ascii form ("lösche"→"losche"), which silently disables the # i18n-allow: quotes the German token under test+# entire German action/lookup vocabulary against real STT output.+_UMLAUT_TRANSLITERATION = str.maketrans({"ä": "ae", "ö": "oe", "ü": "ue"}) # i18n-allow: speech-input matching datadef _normalize(text: str) -> str:- folded = unicodedata.normalize("NFKD", str(text or "").casefold())- return "".join(ch for ch in folded if not unicodedata.combining(ch))+ folded = str(text or "").casefold().translate(_UMLAUT_TRANSLITERATION)+ decomposed = unicodedata.normalize("NFKD", folded)+ return "".join(ch for ch in decomposed if not unicodedata.combining(ch))def _tokens_from_capability(capability: Any) -> set[str]:diff --git a/tests/unit/brain/test_turn_planner.py b/tests/unit/brain/test_turn_planner.pyindex 8b322c0faf..470a121e4a 100644--- a/tests/unit/brain/test_turn_planner.py+++ b/tests/unit/brain/test_turn_planner.py@@ -94,3 +94,90 @@ def test_evidence_domain_routes_even_without_loaded_tool() -> None:def test_empty_turn_stays_native() -> None:assert plan_turn(" ").path is TurnPath.NATIVE_REALTIME+++ ("utterance", "context"),+ [+ (+ "Was steht im Mainim drin?", # i18n-allow: exact German forensic STT+ ("We were talking about the user's private Wiki.",),+ ),+ (+ "What does it say?",+ ("The previous turn asked about the connected Gmail inbox.",),+ ),+ (+ "¿Y qué hay ahí?", # i18n-allow: Spanish speech-input fixture+ ("The previous turn asked about the user's calendar.",),+ ),+ ],+)+def test_elliptical_follow_up_inherits_evidence_domain(+ utterance: str,+ context: tuple[str, ...],+) -> None:+ plan = plan_turn(utterance, context=context)++ assert plan.path is TurnPath.ORCHESTRATOR+ assert TurnReason.UNCERTAIN in plan.reasons+ assert plan.requires_evidence is True+++def test_unrelated_lookup_does_not_inherit_old_evidence_domain() -> None:+ context = ("The previous turn asked about the user's private Wiki.",)++ assert plan_turn("Who wrote Hamlet?", context=context).path is TurnPath.NATIVE_REALTIME+ assert plan_turn("What time is it?", context=context).path is TurnPath.NATIVE_REALTIME+++ "utterance",+ [+ # Umlaut verbs: real STT emits "ö", the vocabulary is written "oe" — # i18n-allow: names the umlaut under test+ # these matched NOTHING before the transliterating _normalize fix.+ "Lösche die Datei vom Desktop.", # i18n-allow: German speech-input fixture+ "Ändere die Lautstärke.", # i18n-allow: German speech-input fixture+ "Führe den Befehl aus.", # i18n-allow: German speech-input fixture+ "Öffne Spotify.", # i18n-allow: German speech-input fixture+ "Prüfe meine Mails.", # i18n-allow: German speech-input fixture+ ],+)+def test_umlaut_action_verbs_route_to_orchestrator(utterance: str) -> None:+ plan = plan_turn(utterance)+ assert plan.path is TurnPath.ORCHESTRATOR+++ "utterance",+ [+ "Switch to the Gemini provider.",+ "Play some music.",+ "Remind me to buy milk tomorrow.",+ "Turn off the lights.",+ "Wechsle den Provider auf Gemini.", # i18n-allow: German speech-input fixture+ "Merk dir, dass ich morgen Zahnarzt habe.", # i18n-allow: German fixture+ "Notier dir das bitte.", # i18n-allow: German speech-input fixture+ "Leg einen Termin für Montag an.", # i18n-allow: German speech-input fixture+ "Stell den Wecker auf sieben Uhr.", # i18n-allow: German speech-input fixture+ "Pon música relajante.", # i18n-allow: Spanish speech-input fixture+ "Recuérdame comprar leche.", # i18n-allow: Spanish speech-input fixture+ "Apaga la luz.", # i18n-allow: Spanish speech-input fixture+ ],+)+def test_common_assistant_action_verbs_route_to_orchestrator(utterance: str) -> None:+ plan = plan_turn(utterance)+ assert plan.path is TurnPath.ORCHESTRATOR+ assert TurnReason.ACTION in plan.reasons+++ "utterance",+ [+ "Das ist wirklich merkwürdig.", # i18n-allow: German speech-input fixture+ "Das war eine Tragödie.", # i18n-allow: German speech-input fixture+ "Erzähl mir einen Witz.", # i18n-allow: German speech-input fixture+ ],+)+def test_guarded_non_action_words_stay_native(utterance: str) -> None:+ assert plan_turn(utterance).path is TurnPath.NATIVE_REALTIME