From 2486e43defb1c522b388405d7c509223a594e27e Mon Sep 17 00:00:00 2001 From: Dom Date: Sun, 5 Apr 2026 09:09:13 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20cropper=20la=20fen=C3=AAtre=20depuis=20l?= =?UTF-8?q?e=20screenshot=20live=20(pas=20chercher=20=5Fwindow.png)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Le resolve_target reçoit un screenshot temp de l'agent — le fichier _window.png n'existe pas à cet emplacement. Au lieu de chercher un fichier, on crop directement la fenêtre depuis le full screenshot en utilisant window_rect du target_spec. Fonctionne au replay (screenshot live) comme à l'enregistrement. Co-Authored-By: Claude Opus 4.6 (1M context) --- agent_v0/server_v1/api_stream.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/agent_v0/server_v1/api_stream.py b/agent_v0/server_v1/api_stream.py index c767ff063..76fc36776 100644 --- a/agent_v0/server_v1/api_stream.py +++ b/agent_v0/server_v1/api_stream.py @@ -4557,16 +4557,16 @@ def _resolve_by_grounding( from PIL import Image as PILImage from pathlib import Path - # Chercher le screenshot fenêtre (_window.png) - full_path = Path(screenshot_path) - win_path = full_path.parent / full_path.name.replace("_full.png", "_window.png") + # Utiliser la fenêtre active : cropper depuis le screenshot full + # via window_rect (fonctionne au replay comme à l'enregistrement) + img = PILImage.open(screenshot_path) - if win_path.is_file() and window_rect: - img = PILImage.open(str(win_path)) + if window_rect: + x1, y1, x2, y2 = window_rect + img = img.crop((x1, y1, x2, y2)) using_window = True - logger.debug("Grounding : image fenêtre %s (%dx%d)", win_path.name, *img.size) + logger.debug("Grounding : crop fenêtre (%d,%d,%d,%d) → %dx%d", x1, y1, x2, y2, *img.size) else: - img = PILImage.open(screenshot_path) using_window = False orig_w, orig_h = img.size