diff --git a/aria-brain/agent.py b/aria-brain/agent.py index 990c1d3..5353153 100644 --- a/aria-brain/agent.py +++ b/aria-brain/agent.py @@ -1351,8 +1351,9 @@ META_TOOLS = [ "name": "host_screenshot", "description": ( "Macht ein Bildschirmfoto auf einem Host-Agenten (nur wenn dort eine " - "grafische Session laeuft). Gibt an, dass ein Bild erstellt wurde; das " - "Bild wird der Konversation angehaengt." + "grafische Session laeuft). Das Tool liefert einen Datei-Pfad zurueck; " + "schreibe ihn danach als [FILE: ...]-Marker in deine Antwort, dann zeigt " + "die App das Bild inline im Chat (wie bei flux_generate)." ), "parameters": { "type": "object", @@ -2621,15 +2622,24 @@ class Agent: if not result.get("ok"): return f"FEHLER: {result.get('error')}" r = result.get("result") or {} + # Wie flux_generate: PNG nach /shared/uploads/ (nur dieser Pfad + # matcht den [FILE:]-Marker) -> Bridge broadcastet file_from_aria, + # App/Diagnostic zeigen es inline im Chat. try: - d = "/shared/host-screenshots" + d = "/shared/uploads" os.makedirs(d, exist_ok=True) - fp = os.path.join(d, f"{host}-{int(time.time())}.png") + safe = re.sub(r"[^a-zA-Z0-9_-]+", "-", host).strip("-") or "host" + fp = os.path.join(d, f"aria_screenshot_{safe}_{int(time.time())}.png") with open(fp, "wb") as f: f.write(_b64.b64decode(r.get("base64", ""))) - return f"Screenshot von {host} gespeichert: {fp} ({r.get('bytes')} Bytes)." except Exception as exc: return f"Screenshot erstellt ({r.get('bytes')} Bytes), Speichern fehlgeschlagen: {exc}" + return ( + f"OK — Screenshot von {host} erstellt ({r.get('bytes', 0) // 1024} KB).\n" + f"path: {fp}\n\n" + f"WICHTIG: Schreibe in deiner Antwort an Stefan den Pfad EXAKT als " + f"Marker: [FILE: {fp}] — dann zeigt die App das Bild inline im Chat." + ) return f"FEHLER: unbekanntes Host-Tool {name}" except Exception as exc: