- Added `simple_bubble_dedup.py` module using perceptual hashing (pHash) to detect duplicate chat bubbles based on visual similarity.
- System keeps recent N (default 5) hashes and skips bubbles with Hamming distance below threshold (default 5).
- Integrated into `run_ui_monitoring_loop()`:
- Hash is computed upon bubble snapshot capture.
- Duplicate check occurs before message enqueue.
- Sender info is optionally attached to matching hash entries after successful processing.
- Deduplication state is persisted in `simple_bubble_dedup.json`.
- F7 (`clear_history`) and F8 (`reset_state`) now also clear image-based hash history.
- Removed or commented out legacy `recent_texts` text-based deduplication logic.
This visual deduplication system reduces false negatives caused by slight text variations and ensures higher confidence in skipping repeated bubble interactions.
- Replaced legacy `game_monitor.py` with a new modular `game_manager.py`.
- Introduced `GameMonitor` class to encapsulate:
- Game window detection, focus enforcement, and resize enforcement.
- Timed game restarts based on configuration interval.
- Callback system to notify Setup.py on restart completion.
- Cross-platform game launching (Windows/Unix).
- Process termination using `psutil` if available.
- `Setup.py` now acts as the control hub:
- Instantiates and manages `GameMonitor`.
- Provides live configuration updates (e.g., window title, restart timing).
- Coordinates bot lifecycle with game restarts.
- Maintains standalone execution mode for `game_manager.py` (for testing or CLI use).
- Replaces older “always-on-top” logic with foreground window activation.
- Dramatically improves control, flexibility, and automation reliability for game-based workflows.
- Migrated to ChromaDB v1.0.6+ with PersistentClient for memory backend.
- Added chroma_client.py for collection access and memory/query utilities.
- Integrated configurable memory preload system with Setup.py support.
- Refactored keyword detection with dual-template (grayscale + CLAHE + invert) and absolute coordinate correction.
- Added island-based color detection for chat bubbles using HSV masks and connected components.
- Reordered LLM structured JSON output to prioritize 'commands', improving tool use parsing and consistency.
- Enhanced canned reply handling for empty LLM outputs and personalized user name input in debug mode.
- Updated Wolf to consistently speak in British English.
- Improved reply-type detection and removed redundant logic.
- Augmented Setup.py with persistent window behavior and script control buttons (run/stop).
- Introduced Game Monitor to track game window visibility and trigger restarts.
- Injected ESC fallback logic to close unresponsive homepage ads.
- Switched MCP server to stdio_client context with AsyncExitStack for safe shutdown on Windows.
- Retained CTRL event handler to support graceful exits via console close or interruptions.
Refactor keyword detection with dual-template matching and coordinate correction
- Overhauled `find_keyword_in_region` in `DetectionModule` to act as a wrapper for a new dual-method detection system.
- Introduced `find_keyword_dual_method`, now the default detection method (enabled via `use_dual_method=True`):
- Performs template matching (`cv2.matchTemplate`) on both grayscale and CLAHE-enhanced versions of screenshots and templates.
- Handles inverted images (`cv2.bitwise_not`) for robustness under dark/light themes.
- Coordinates returned by matching are corrected from relative region space to absolute screen coordinates to match `pyautogui`.
- Combines matching results using a tiered fallback system:
1. Prefer overlapping results from both methods within a pixel threshold.
2. Fallback to high-confidence single-method results.
- Maintains `_find_keyword_legacy` for backward compatibility using `pyautogui.locateAllOnScreen`.
- Simplified keyword template set to focus on three core types: `keyword_wolf_lower`, `keyword_Wolf_upper`, and `keyword_wolf_reply`.
- Integrated runtime performance tracking via counters and `print_detection_stats()` for debugging and optimization.
- Adds debug visualization at `DEBUG_LEVEL >= 3` to save processed images and detected points for analysis.
- Improves detection robustness across varying lighting, contrast, and UI themes while maintaining precise click alignment.
This upgrade significantly strengthens keyword recognition reliability and unifies coordinate handling across all detection phases.
- Introduced a new bubble detection method based on color-based connected components ("island detection").
- Operates in a predefined region (150, 330, 600, 880) using HSV color masks.
- Mask settings and area thresholds per bubble type (user, bot, etc.) are configurable via `bubble_colors.json`.
- Supports optional image downscaling for performance; thresholds scale accordingly.
- Default setting remains off (`self.use_color_detection = False`), can be enabled manually in `DetectionModule`.
- Added keyword image matching for "wolf"/"Wolf" within detected bubbles.
- Improved precision in reply content extraction and sender identification by relocating based on snapshot offsets.
- Removed redundant portions of the system prompt to reduce token usage and improve response clarity.
- Modularized and simplified configuration for bubble type addition and detection tuning.