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 German dev-strings to English in hotkey/move_mouse tools (batch 05_3_jarvis, part 8)

Ruben Lütkeb2ed91f9a78b
diff --git a/jarvis/plugins/tool/hotkey.py b/jarvis/plugins/tool/hotkey.py
index 98fc65f12b..cfeafdfd90 100644
--- a/jarvis/plugins/tool/hotkey.py
+++ b/jarvis/plugins/tool/hotkey.py
@@ -96,14 +96,14 @@ def _expand_combo_keys(keys: list[str]) -> list[str]:
def _send_hotkey_windows(keys: list[str]) -> None:
- """Sendet eine Tastenkombination als Win32-SendInput-Sequenz.
+ """Sends a key combination as a Win32 SendInput sequence.
- Reihenfolge: alle Keys nacheinander DOWN, dann in umgekehrter Reihenfolge UP.
- Das ist die kanonische Hotkey-Choreographie — moderne Apps interpretieren
- das als gleichzeitiges Druecken.
+ Order: all keys DOWN one after another, then UP in reverse order.
+ This is the canonical hotkey choreography — modern apps interpret
+ it as being pressed simultaneously.
"""
if os.name != "nt":
- raise RuntimeError("Native Hotkey-Eingabe ist nur auf Windows verfuegbar")
+ raise RuntimeError("Native hotkey input is only available on Windows")
import ctypes
from ctypes import wintypes
@@ -148,7 +148,8 @@ def _send_hotkey_windows(keys: list[str]) -> None:
# ``ctypes.sizeof(INPUT)`` equals the real Win32 ``INPUT`` size (40 bytes on
# x64). The previous version declared only ``ki``, giving sizeof(INPUT)=32;
# ``SendInput`` then received cbSize=32, rejected every event (returned 0),
- # and surfaced as a misleading "WinError 0 / Falscher Parameter". This made
+ # and surfaced as a misleading "WinError 0 / Falscher Parameter" (the # i18n-allow (quotes the literal Win32 error text on a German-locale machine)
+ # German-locale Windows text for "incorrect parameter"). This made
# the native hotkey path fail for EVERY key (enter, win, ctrl+...) on x64.
class INPUT_UNION(ctypes.Union):
_fields_ = (("mi", MOUSEINPUT), ("ki", KEYBDINPUT))
@@ -167,7 +168,7 @@ def _send_hotkey_windows(keys: list[str]) -> None:
for k in keys:
vk = _resolve_vk(k)
if vk is None:
- raise ValueError(f"Unbekannte Taste: {k!r}")
+ raise ValueError(f"Unknown key: {k!r}")
vk_codes.append(vk)
def _flags(vk: int, *, keyup: bool) -> int:
@@ -176,7 +177,7 @@ def _send_hotkey_windows(keys: list[str]) -> None:
flags |= KEYEVENTF_EXTENDEDKEY
return flags
- # DOWN-Events: in der angegebenen Reihenfolge
+ # DOWN events: in the given order
down_events = [
INPUT(
type=INPUT_KEYBOARD,
@@ -184,7 +185,7 @@ def _send_hotkey_windows(keys: list[str]) -> None:
)
for vk in vk_codes
]
- # UP-Events: in umgekehrter Reihenfolge
+ # UP events: in reverse order
up_events = [
INPUT(
type=INPUT_KEYBOARD,
@@ -205,9 +206,9 @@ class HotkeyTool:
name: str = "hotkey"
risk_tier: str = "monitor"
description: str = (
- "Sendet eine Tastenkombination an das aktive Fenster (z.B. ['ctrl','t'] "
- "fuer neuen Tab, ['alt','tab'] fuer Window-Switch, ['ctrl','shift','t'] "
- "fuer geschlossenen Tab wiederherstellen)."
+ "Sends a key combination to the active window (e.g. ['ctrl','t'] "
+ "for a new tab, ['alt','tab'] for window switch, ['ctrl','shift','t'] "
+ "to restore a closed tab)."
)
schema: dict[str, Any] = {
"type": "object",
@@ -216,9 +217,9 @@ class HotkeyTool:
"type": "array",
"items": {"type": "string"},
"description": (
- "Liste der Tasten in Druck-Reihenfolge. Modifier (ctrl, shift, "
- "alt, win) zuerst, dann die Aktionstaste. Buchstaben einzeln, "
- "Sondertasten als Name (enter, tab, esc, f1-f12, left, right, "
+ "List of keys in press order. Modifiers (ctrl, shift, "
+ "alt, win) first, then the action key. Letters individually, "
+ "special keys by name (enter, tab, esc, f1-f12, left, right, "
"up, down, home, end, pageup, pagedown, delete, backspace)."
),
},
@@ -232,44 +233,44 @@ class HotkeyTool:
return ToolResult(
success=False,
output=None,
- error="keys fehlt oder ist keine Liste (Beispiel: ['ctrl', 't'])",
+ error="keys is missing or not a list (example: ['ctrl', 't'])",
)
keys_str = [str(k) for k in keys]
# Tolerate a combined shortcut string ("ctrl+v") in place of the
# documented list form (["ctrl", "v"]) — LLM callers emit it constantly.
keys_str = _expand_combo_keys(keys_str)
- # Vorab-Validierung fuer bessere Fehlermeldung — sonst kommt
- # nur "Unbekannte Taste 'X'" aus dem ctypes-Pfad.
+ # Pre-validation for a better error message — otherwise only
+ # "Unknown key 'X'" comes out of the ctypes path.
for k in keys_str:
if _resolve_vk(k) is None:
return ToolResult(
success=False,
output=None,
error=(
- f"Unbekannte Taste: {k!r}. Bekannte Modifier: ctrl, shift, "
- f"alt, win. Bekannte Tasten: a-z, 0-9, f1-f12, enter, tab, "
+ f"Unknown key: {k!r}. Known modifiers: ctrl, shift, "
+ f"alt, win. Known keys: a-z, 0-9, f1-f12, enter, tab, "
f"esc, space, backspace, delete, home, end, pageup, "
f"pagedown, left, right, up, down."
),
)
- # pyautogui-Pfad als plattform-unabhaengiger Fallback (Tests/CI auf
- # Linux). Auf Windows bevorzugen wir den nativen Pfad — pyautogui
- # ist langsamer und braucht zusaetzliche Setup-Arbeit beim Hotkey-
- # Mapping (z.B. 'win' heisst dort 'winleft').
+ # pyautogui path as a platform-independent fallback (tests/CI on
+ # Linux). On Windows we prefer the native path — pyautogui
+ # is slower and needs extra setup work for hotkey
+ # mapping (e.g. 'win' is called 'winleft' there).
if os.name == "nt":
try:
await asyncio.to_thread(_send_hotkey_windows, keys_str)
return ToolResult(
success=True,
- output=f"Hotkey gesendet: {'+'.join(keys_str)}",
+ output=f"Hotkey sent: {'+'.join(keys_str)}",
)
except (ValueError, OSError) as exc:
return ToolResult(
success=False,
output=None,
- error=f"Hotkey '{'+'.join(keys_str)}' fehlgeschlagen: {exc}",
+ error=f"Hotkey '{'+'.join(keys_str)}' failed: {exc}",
)
try:
@@ -279,16 +280,16 @@ class HotkeyTool:
success=False,
output=None,
error=(
- f"Plattform nicht Windows ({os.name}) und pyautogui fehlt: {exc}. "
+ f"Platform is not Windows ({os.name}) and pyautogui is missing: {exc}. "
"pip install pyautogui"
),
)
try:
- # pyautogui.hotkey nimmt einzelne string-Args, nicht eine Liste
+ # pyautogui.hotkey takes individual string args, not a list
pyautogui.hotkey(*keys_str)
return ToolResult(
success=True,
- output=f"Hotkey gesendet (pyautogui): {'+'.join(keys_str)}",
+ output=f"Hotkey sent (pyautogui): {'+'.join(keys_str)}",
)
except Exception as exc: # noqa: BLE001
return ToolResult(success=False, output=None, error=str(exc))
diff --git a/jarvis/plugins/tool/move_mouse.py b/jarvis/plugins/tool/move_mouse.py
index 2b7c64901b..198d9a03ea 100644
--- a/jarvis/plugins/tool/move_mouse.py
+++ b/jarvis/plugins/tool/move_mouse.py
@@ -1,7 +1,7 @@
-"""move_mouse-Tool: bewegt den Mauszeiger ohne zu klicken.
+"""move_mouse tool: moves the mouse cursor without clicking.
-Risk-Tier: ``safe`` — die Bewegung selbst loest keinen App-State-Change
-aus. Erst ein Klick wuerde das tun.
+Risk tier: ``safe`` — the movement itself does not trigger an
+app state change. Only a click would do that.
"""
from __future__ import annotations
@@ -21,7 +21,7 @@ def _move_windows(x: int, y: int) -> None:
user can see the mouse travel; the virtual-cursor overlay tracks it.
"""
if os.name != "nt":
- raise RuntimeError("Native Mausbewegung nur auf Windows verfuegbar")
+ raise RuntimeError("Native mouse movement is only available on Windows")
glide_os_cursor(int(x), int(y))
try:
@@ -33,12 +33,12 @@ def _move_windows(x: int, y: int) -> None:
class MoveMouseTool:
name: str = "move_mouse"
risk_tier: str = "safe"
- description: str = "Bewegt den Mauszeiger an absolute Bildschirm-Koordinaten ohne zu klicken."
+ description: str = "Moves the mouse cursor to absolute screen coordinates without clicking."
schema: dict[str, Any] = {
"type": "object",
"properties": {
- "x": {"type": "integer", "description": "X-Koordinate (Pixel)"},
- "y": {"type": "integer", "description": "Y-Koordinate (Pixel)"},
+ "x": {"type": "integer", "description": "X coordinate (pixels)"},
+ "y": {"type": "integer", "description": "Y coordinate (pixels)"},
},
"required": ["x", "y"],
}
@@ -50,24 +50,24 @@ class MoveMouseTool:
except (KeyError, TypeError, ValueError):
return ToolResult(
success=False, output=None,
- error="x und y muessen Integer-Koordinaten sein",
+ error="x and y must be integer coordinates",
)
if os.name == "nt":
try:
await asyncio.to_thread(_move_windows, x, y)
- return ToolResult(success=True, output=f"Maus an ({x}, {y})")
+ return ToolResult(success=True, output=f"Mouse at ({x}, {y})")
except OSError as exc:
return ToolResult(success=False, output=None, error=str(exc))
try:
import pyautogui
pyautogui.moveTo(x, y)
- return ToolResult(success=True, output=f"Maus (pyautogui) an ({x},{y})")
+ return ToolResult(success=True, output=f"Mouse (pyautogui) at ({x},{y})")
except ImportError as exc:
return ToolResult(
success=False, output=None,
- error=f"Plattform nicht Windows und pyautogui fehlt: {exc}",
+ error=f"Platform is not Windows and pyautogui is missing: {exc}",
)
except Exception as exc: # noqa: BLE001
return ToolResult(success=False, output=None, error=str(exc))
diff --git a/tests/missions/test_path_guard.py b/tests/missions/test_path_guard.py
index 60624e9752..6e444a0fbd 100644
--- a/tests/missions/test_path_guard.py
+++ b/tests/missions/test_path_guard.py
@@ -1,4 +1,4 @@
-"""Tests fuer path_guard — Block-Liste fuer geschuetzte Pfade."""
+"""Tests for path_guard — blocklist for protected paths."""
from __future__ import annotations
import pytest
@@ -57,7 +57,7 @@ def test_dotenv_production_blocked() -> None:
def test_env_substring_in_filename_not_blocked() -> None:
- """`environments.py` darf nicht matchen — wir wollen nur `.env*` files."""
+ """`environments.py` must not match — we only want `.env*` files."""
assert is_blocked("/project/environments.py") is False
@@ -88,7 +88,7 @@ def test_readme_not_blocked() -> None:
def test_envvar_in_path_not_blocked() -> None:
- """`environment-config.yaml` darf NICHT matchen — nur exact `.env*` files."""
+ """`environment-config.yaml` must NOT match — only exact `.env*` files."""
assert is_blocked("config/environment-config.yaml") is False
@@ -193,21 +193,21 @@ def test_prompt_with_explicit_ssh_path() -> None:
def test_prompt_with_dotenv_path() -> None:
found = check_prompt_for_blocked_paths("Lies das .env file im /project/ Ordner")
- # `.env` allein matcht NICHT (kein Slash/Dot-Prefix als Token-Start) —
- # wir wollen False-Positives bei "die env-Variable" vermeiden.
- # Falls jemand explizit "/project/.env" schreibt, soll das matchen.
+ # `.env` alone does NOT match (no slash/dot prefix as token start) —
+ # we want to avoid false positives on phrases like "the env variable".
+ # If someone explicitly writes "/project/.env", that should match.
found2 = check_prompt_for_blocked_paths("zeig /project/.env")
assert any(".env" in p for p in found2)
def test_prompt_without_paths_no_match() -> None:
- """Harmloser Prompt darf KEINE Treffer liefern."""
+ """A harmless prompt must produce NO matches."""
found = check_prompt_for_blocked_paths("Schreibe eine Funktion is_palindrome")
assert found == []
def test_prompt_mentioning_env_word_not_match() -> None:
- """`die env Variable` darf NICHT als Pfad matchen — nur echte Pfade."""
+ """`die env Variable` must NOT match as a path — only real paths."""
found = check_prompt_for_blocked_paths("Setze die env Variable auf foo")
assert found == []
@@ -220,7 +220,7 @@ def test_empty_prompt_returns_empty() -> None:
def test_default_globs_include_critical_paths() -> None:
- """Verifiziert dass die Top-Risiken in DEFAULT_BLOCKED_GLOBS sind."""
+ """Verifies that the top risks are in DEFAULT_BLOCKED_GLOBS."""
blob = " ".join(DEFAULT_BLOCKED_GLOBS)
assert ".ssh" in blob
assert ".aws" in blob