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(cu): report dropped non-ASCII characters honestly on Linux instead of false success
Ruben Lütkecab355ff7305
diff --git a/jarvis/cu/actuate/posix.py b/jarvis/cu/actuate/posix.pyindex 0c1786c749..4f518f91e1 100644--- a/jarvis/cu/actuate/posix.py+++ b/jarvis/cu/actuate/posix.py@@ -396,7 +396,17 @@ class PosixActuator(Actuator):release = Quartz.CGEventCreateMouseEvent(None, up, end, button_id)Quartz.CGEventPost(Quartz.kCGHIDEventTap, release)- def type_text(self, text: str, *, delay_s: float = 0.02) -> None:+ def type_text(self, text: str, *, delay_s: float = 0.02) -> int: # type: ignore[override]+ """Type Unicode text into the focused control.++ Returns the number of requested characters that could NOT actually be+ typed on this backend (0 on full success). The pyautogui fallback —+ always used on Linux, where the desktop extras skip pynput — silently+ DROPS every non-ASCII character; when those cannot be routed through+ ``xdotool`` either, they are counted and reported here so the caller+ can stay honest about a partial/failed type instead of claiming a full+ success (the base contract widens ``None`` -> dropped-count).+ """if self._keyboard is None:# pyautogui.typewrite silently DROPS every non-ASCII character# (umlauts, eszett, accents, CJK), and Linux always runs on this fallback (the@@ -405,21 +415,27 @@ class PosixActuator(Actuator):# synthesizes arbitrary Unicode on X11 and is provisioned by the# installer since deep-dive 2026-07-15 H-01.if not text.isascii() and self._xdotool_type(text, delay_s=delay_s):- return+ return 0+ dropped = 0if not text.isascii():+ # Only non-ASCII codepoints are lost; pyautogui still types the+ # ASCII portion of a mixed string, so count exactly the losses.+ dropped = sum(1 for char in text if not char.isascii())logger.warning(- "[cu] typing non-ASCII text via pyautogui — characters "+ "[cu] typing non-ASCII text via pyautogui — %d character(s) ""outside ASCII will be dropped (install xdotool or pynput ""for Unicode input).",+ dropped,)self._pyautogui.typewrite(text, interval=delay_s)- return+ return droppedif delay_s <= 0:self._keyboard.type(text)- return+ return 0for char in text:self._keyboard.type(char)time.sleep(delay_s)+ return 0@staticmethoddef _xdotool_type(text: str, *, delay_s: float) -> bool:diff --git a/jarvis/plugins/tool/type_text.py b/jarvis/plugins/tool/type_text.pyindex a6f1a6024b..6a0c6a97a7 100644--- a/jarvis/plugins/tool/type_text.py+++ b/jarvis/plugins/tool/type_text.py@@ -32,7 +32,7 @@ def _type_for_expected_window(text: str,delay_s: float,expected_signature: tuple[Any, ...] | None,-) -> None:+) -> Any:if expected_signature is not None:from jarvis.cu.target_guard import ( # noqa: PLC0415foreground_matches_or_same_app,@@ -42,7 +42,10 @@ def _type_for_expected_window(raise _ForegroundTargetChanged("foreground window changed after the screenshot")- sender(text, delay_s=delay_s)+ # The POSIX backend returns a dropped-character count (0 on full success)+ # so a caller can be honest when a Unicode type is only partial; Windows+ # senders return None and their callers ignore it.+ return sender(text, delay_s=delay_s)def _build_windows_input_types() -> Any:@@ -229,13 +232,38 @@ class TypeTextTool:try:actuator = get_actuator()- await asyncio.to_thread(+ dropped_raw = await asyncio.to_thread(_type_for_expected_window,actuator.type_text,text,delay_s,expected_signature,)+ # POSIX backends report how many characters could not be typed+ # (Linux pyautogui fallback drops non-ASCII when `xdotool` is+ # absent). Be honest instead of always claiming full success.+ dropped = int(dropped_raw or 0)+ if dropped >= len(text):+ return ToolResult(+ success=False,+ output=None,+ error=(+ "Could not type the text: its non-ASCII characters "+ "(umlauts/accents/CJK) need the 'xdotool' system "+ "package on Linux, which pip cannot install. Install "+ "xdotool, or use ASCII text."+ ),+ )+ if dropped > 0:+ return ToolResult(+ success=True,+ output=(+ f"Typed {len(text) - dropped} of {len(text)} chars "+ f"({actuator.name}); dropped {dropped} non-ASCII "+ "character(s) — install the 'xdotool' system package "+ "on Linux for full Unicode input."+ ),+ )return ToolResult(success=True,output=f"Typed {len(text)} chars ({actuator.name})",