From b09a3df054f446b249eeb983090a619d34931041 Mon Sep 17 00:00:00 2001 From: Dom Date: Sun, 5 Apr 2026 11:29:51 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20=5Fapp=5Fname=20d=C3=A9plac=C3=A9=20hors?= =?UTF-8?q?=20du=20bloc=20if=20(scope=20error)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- agent_v0/agent_v1/core/executor.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/agent_v0/agent_v1/core/executor.py b/agent_v0/agent_v1/core/executor.py index d89c2c229..2dc8f3c76 100644 --- a/agent_v0/agent_v1/core/executor.py +++ b/agent_v0/agent_v1/core/executor.py @@ -228,6 +228,13 @@ class ActionExecutorV1: x_pct = action.get("x_pct", 0.0) y_pct = action.get("y_pct", 0.0) + # Extraire le nom de l'application depuis un titre de fenêtre + def _app_name(title): + for sep in [" – ", " - ", " — "]: + if sep in title: + return title.split(sep)[-1].strip().lower() + return title.strip().lower() + # ── Pré-vérification : titre fenêtre ── # Vérifier que l'écran est dans l'état attendu AVANT de cliquer. if visual_mode and target_spec: @@ -236,14 +243,6 @@ class ActionExecutorV1: from ..window_info_crossplatform import get_active_window_info current_info = get_active_window_info() current_title = current_info.get("title", "") - # Comparer sur le nom de l'APPLICATION (après le –/-) - # "blocnote.txt – Bloc-notes" et "voiture.txt – Bloc-notes" - # sont la même app, seul le fichier change - def _app_name(title): - for sep in [" – ", " - ", " — "]: - if sep in title: - return title.split(sep)[-1].strip().lower() - return title.strip().lower() current_app = _app_name(current_title) expected_app = _app_name(expected_title)