feat(host-agent): GUI-Steuerung fuer Desktop (capability-gated)

Desktop-Agenten (Win/Linux/Mac) koennen jetzt bedienen, nicht nur sehen — mit
DENSELBEN Actions/Brain-Tools wie Android (ui_tap/ui_text/ui_key/ui_swipe/
app_launch), ein Werkzeugset fuer Handy und Rechner.

- host_agent.py: _gui_input_method() erkennt X11(xdotool)/Wayland(ydotool)/
  macOS(osascript+cliclick)/Windows(PowerShell). CAPS werden dynamisch erweitert
  -> reiner Terminal-Server (kein DISPLAY) meldet KEINE ui_*-Caps. _do_ui_tap/
  text/key/swipe + _do_app_launch je Methode; info liefert 'gui'.
- Brain: Tool-Beschreibungen decken Desktop ab (Koordinaten aus dem Screenshot,
  kein ui_dump; button/double bei tap; command bei app_launch); _UI_ACTIONS
  reicht die neuen Params durch.
- README: Fähigkeiten/Plattform-Tabelle + Helfer je OS + HiDPI-Hinweis.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-09-25 14:30:38 +02:00
co-authored by Claude Opus 4.8
parent 5b7e205ede
commit 176997a800
3 changed files with 264 additions and 26 deletions
+24 -18
View File
@@ -1389,17 +1389,20 @@ META_TOOLS = [
"function": {
"name": "host_ui_tap",
"description": (
"Tippt auf einem Host-Agenten (v.a. Android) auf eine Bildschirm-Position. "
"Nutze die x/y-Koordinaten AUS host_ui_dump (Element-Mittelpunkt, echte "
"Bildschirm-Pixel) — NICHT aus dem Screenshot (der ist skaliert). Ablauf: "
"erst host_ui_dump/host_screenshot (sehen), dann host_ui_tap (steuern)."
"Klickt/tippt auf einem Host-Agenten auf eine Bildschirm-Position (x,y). "
"ANDROID: nimm die Koordinaten aus host_ui_dump (echte Pixel) — NICHT aus "
"dem Screenshot (der ist skaliert). DESKTOP (Windows/Linux/Mac): es gibt "
"kein ui_dump; nimm die Koordinaten DIREKT aus dem host_screenshot (voller "
"Auflösung = echte Pixel). button/double optional (Rechtsklick/Doppelklick)."
),
"parameters": {
"type": "object",
"properties": {
"host": {"type": "string", "description": "Host-ID/Name."},
"x": {"type": "integer", "description": "X (Pixel, aus ui_dump)."},
"y": {"type": "integer", "description": "Y (Pixel, aus ui_dump)."},
"x": {"type": "integer", "description": "X (Pixel)."},
"y": {"type": "integer", "description": "Y (Pixel)."},
"button": {"type": "string", "description": "left (Default) | right | middle."},
"double": {"type": "boolean", "description": "Doppelklick."},
},
"required": ["host", "x", "y"],
},
@@ -1410,9 +1413,9 @@ META_TOOLS = [
"function": {
"name": "host_ui_text",
"description": (
"Schreibt Text in ein Eingabefeld an Position x/y (aus host_ui_dump, "
"editable=true). Tippe ggf. vorher mit host_ui_tap ins Feld, damit es "
"fokussiert ist."
"Schreibt Text auf einem Host-Agenten. ANDROID: in das Feld an x/y (aus "
"host_ui_dump, editable=true). DESKTOP: tippt in das AKTUELL fokussierte "
"Feld (x/y optional) — ggf. vorher mit host_ui_tap ins Feld klicken."
),
"parameters": {
"type": "object",
@@ -1451,15 +1454,16 @@ META_TOOLS = [
"function": {
"name": "host_ui_key",
"description": (
"Drueckt eine globale Taste auf einem Host-Agenten (Android): "
"back, home, recents, notifications."
"Drueckt eine Taste auf einem Host-Agenten. ANDROID: back | home | recents "
"| notifications. DESKTOP (Win/Linux/Mac): Tastennamen/Kombis wie Return, "
"Escape, Tab, Delete, Up/Down, ctrl+c, alt+F4 (Linux/xdotool-Syntax)."
),
"parameters": {
"type": "object",
"properties": {
"host": {"type": "string", "description": "Host-ID/Name."},
"key": {"type": "string",
"description": "back | home | recents | notifications"},
"description": "Android: back/home/recents/notifications. Desktop: Return, Escape, ctrl+c, …"},
},
"required": ["host", "key"],
},
@@ -1470,16 +1474,18 @@ META_TOOLS = [
"function": {
"name": "host_app_launch",
"description": (
"Startet eine App auf einem Host-Agenten (Android) — per Paketname "
"(package, z.B. 'com.google.android.gm') ODER Namens-Suche (query, z.B. "
"'Einstellungen'). Danach mit host_screenshot/host_ui_dump weiterarbeiten."
"Startet eine App auf einem Host-Agenten. ANDROID: per Paketname (package, "
"z.B. 'com.google.android.gm') ODER Namens-Suche (query). DESKTOP "
"(Win/Linux/Mac): per App-Name (query, z.B. 'firefox'/'Safari') ODER "
"beliebigem Startbefehl (command). Danach mit host_screenshot weiterarbeiten."
),
"parameters": {
"type": "object",
"properties": {
"host": {"type": "string", "description": "Host-ID/Name."},
"package": {"type": "string", "description": "Paketname (optional)."},
"package": {"type": "string", "description": "Android-Paketname (optional)."},
"query": {"type": "string", "description": "App-Name/Teilstring (optional)."},
"command": {"type": "string", "description": "Desktop: Startbefehl (optional)."},
},
"required": ["host"],
},
@@ -2835,11 +2841,11 @@ class Agent:
# ── Steuern (Meilenstein 3) ──────────────────────────────
_UI_ACTIONS = {
"host_ui_tap": ("ui_tap", ["x", "y"]),
"host_ui_tap": ("ui_tap", ["x", "y", "button", "double"]),
"host_ui_text": ("ui_text", ["x", "y", "text"]),
"host_ui_swipe": ("ui_swipe", ["x1", "y1", "x2", "y2", "duration_ms"]),
"host_ui_key": ("ui_key", ["key"]),
"host_app_launch": ("app_launch", ["package", "query"]),
"host_app_launch": ("app_launch", ["package", "query", "command"]),
}
if name in _UI_ACTIONS:
action, keys = _UI_ACTIONS[name]