feat(navigation): replace hardcoded button guards with autonomous state-toggle penalty learning

This commit is contained in:
2026-04-27 11:35:05 +02:00
parent 294403d590
commit 714c914432
2 changed files with 5 additions and 8 deletions

View File

@@ -91,7 +91,11 @@ class ActionMemory:
# State toggles (like, save, follow) rarely change XML length by > 50 chars
state_toggles = ["like", "save", "follow", "heart"]
if any(t in intent.lower() for t in state_toggles):
if pre_click_xml != post_click_xml:
diff = abs(len(pre_click_xml) - len(post_click_xml))
if diff > 1000:
logger.warning(f"⚠️ [ActionMemory] Massive structural shift ({diff} chars) for state-toggle '{intent}'. Navigated away by mistake? Verification FAIL.")
return False
if diff > 0:
logger.debug(f"🧠 [ActionMemory] State toggle detected for '{intent}'. Verification PASS.")
return True

View File

@@ -284,13 +284,6 @@ class TelepathicEngine:
# Not a grid item
return False
# 5.5 Strict Button Guards
if "follow" in intent or "like" in intent or "save" in intent or "comment" in intent:
# It must be an action button/element, not a username or layout container.
res_id = node.get("id", "").lower()
if "profile_name" in res_id or "username" in res_id or "title" in res_id:
return False
# 6. Block massive layout containers UNLESS specifically looking for feed/post
MAX_CONTAINER_AREA = 500000
area = node.get("area", 0)