diff --git a/GramAddict/core/behaviors/rabbit_hole.py b/GramAddict/core/behaviors/rabbit_hole.py index 1d6a5a6..09bddf8 100644 --- a/GramAddict/core/behaviors/rabbit_hole.py +++ b/GramAddict/core/behaviors/rabbit_hole.py @@ -34,6 +34,16 @@ class RabbitHolePlugin(BehaviorPlugin): if res_score < 0.8: return False + screen_type = ctx.shared_state.get("current_screen_type") + if not screen_type and ctx.context_xml: + from GramAddict.core.perception.screen_identity import ScreenIdentity + screen_type = ScreenIdentity(getattr(ctx, "username", "")).identify(ctx.context_xml).get("screen_type") + + from GramAddict.core.perception.screen_identity import ScreenType + valid_screens = [ScreenType.HOME_FEED, ScreenType.EXPLORE_GRID, ScreenType.REELS_FEED] + if screen_type not in valid_screens: + return False + config = self.get_config(ctx) percentage = float(config.get("percentage", 15)) return random.random() < (percentage / 100.0) diff --git a/GramAddict/core/perception/context_gate.py b/GramAddict/core/perception/context_gate.py index 710285d..1efd4fa 100644 --- a/GramAddict/core/perception/context_gate.py +++ b/GramAddict/core/perception/context_gate.py @@ -67,6 +67,14 @@ ALLOWED_SCREENS: Dict[str, FrozenSet[ScreenType]] = { ScreenType.STORY_VIEW, # toolbar_reshare_button exists on stories } ), + "tap post username": frozenset( + { + ScreenType.HOME_FEED, + ScreenType.POST_DETAIL, + ScreenType.REELS_FEED, + ScreenType.EXPLORE_GRID, + } + ), } # Intent keywords that trigger the categorical ban check