feat(android-agent): Meilenstein 2 — sehen (Screenshot + ui_dump)
Screenshot via MediaProjection (ScreenCapturer, gleicher {format,bytes,base64}-
Vertrag wie der Desktop-Agent -> host_screenshot, inkl. Vision). UI-Baum via
AriaAccessibilityService (nur lesend) -> neues Brain-Tool host_ui_dump. Freigabe
einmalig in der App: 'Bildschirm-Zugriff erlauben' + 'Bedienungshilfe oeffnen'.
caps = [info, screenshot, ui_dump]. targetSdk 33 -> keine mediaProjection-FGS-
Typpflicht.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+36
-2
@@ -1270,7 +1270,8 @@ META_TOOLS = [
|
||||
"description": (
|
||||
"Zeigt die ARIA-Host-Agenten (Rechner, auf denen ein Agent DIREKT "
|
||||
"laeuft und sich per RVS meldet) die ONLINE sind + was sie koennen "
|
||||
"(exec/read/write/info/screenshot). Ein Host-Agent gibt Dir vollen "
|
||||
"(exec/read/write/info/screenshot/ui_dump; Android-Agenten koennen "
|
||||
"screenshot+ui_dump). Ein Host-Agent gibt Dir vollen "
|
||||
"Zugriff auf GENAU DIESEN Rechner — auch wenn er hinter NAT/Firewall "
|
||||
"sitzt. Nutze das, wenn Stefan etwas 'auf meinem Laptop/PC/Server X' "
|
||||
"machen will, das kein Geraet im Netz ist."
|
||||
@@ -1364,6 +1365,25 @@ META_TOOLS = [
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"function": {
|
||||
"name": "host_ui_dump",
|
||||
"description": (
|
||||
"Liest die sichtbaren Bedienelemente eines Host-Agenten als strukturierte "
|
||||
"Liste (Text, Beschriftung, Klasse, Bildschirm-Position x/y, Rahmen, ob "
|
||||
"klickbar/editierbar). Vor allem fuer Android-Agenten: ergaenzt "
|
||||
"host_screenshot — der Screenshot zeigt Dir das Bild, ui_dump liefert die "
|
||||
"exakten Element-Texte und Koordinaten, um spaeter gezielt zu tippen. Setzt "
|
||||
"auf dem Geraet eine aktive Bedienungshilfe voraus."
|
||||
),
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": {"host": {"type": "string", "description": "Host-ID/Name."}},
|
||||
"required": ["host"],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"function": {
|
||||
@@ -2652,6 +2672,20 @@ class Agent:
|
||||
f"[FILE: {fp}] in deine Antwort — dann erscheint das Bild inline im Chat."
|
||||
)
|
||||
|
||||
if name == "host_ui_dump":
|
||||
result = _post("/internal/host", {"host": host, "action": "ui_dump",
|
||||
"params": {}}, 20)
|
||||
if not result.get("ok"):
|
||||
return f"FEHLER: {result.get('error')}"
|
||||
r = result.get("result") or {}
|
||||
nodes = r.get("nodes") or []
|
||||
return (
|
||||
f"UI-Baum von {host} (App: {r.get('package', '?')}, "
|
||||
f"{r.get('count', len(nodes))} Elemente). Jeder Eintrag hat x/y = "
|
||||
f"Mittelpunkt zum Antippen:\n"
|
||||
+ json.dumps(nodes, ensure_ascii=False, indent=2)
|
||||
)
|
||||
|
||||
return f"FEHLER: unbekanntes Host-Tool {name}"
|
||||
except Exception as exc:
|
||||
return f"FEHLER: Host/Bridge nicht erreichbar: {exc}"
|
||||
@@ -3449,7 +3483,7 @@ class Agent:
|
||||
if name in ("satellite_list", "satellite_devices", "satellite_command"):
|
||||
return self._dispatch_satellite(name, arguments)
|
||||
if name in ("host_list", "host_exec", "host_read", "host_write",
|
||||
"host_info", "host_screenshot"):
|
||||
"host_info", "host_screenshot", "host_ui_dump"):
|
||||
return self._dispatch_host(name, arguments)
|
||||
if name == "vm_register":
|
||||
pid = (project_id or "").strip()
|
||||
|
||||
Reference in New Issue
Block a user