# Changelog

All notable changes to MuraveyChina are documented here.

## [2.0.1] — 2026-05-01

### Changed
- Activation flow reverted from token-only back to email + License Key (Whop-verified). Reason: activation happens before exam, so 2-factor (email + key) gives real refund-detection and DB-breach protection vs single-token UX.
- Hybrid model selection: Phi-4-mini-Reasoning for math, Qwen3.5-4B for Chinese.

### Fixed
- Multiple critical bugs found in cycle audit (activation, installer, website).
- Answer-window transparency on Windows (Win32 layered window).
- Visible square border / mask artifacts around overlay window.
- Duplicate model download skipped on second launch.
- Installer.iss: removed invalid `runascurrentuser waituntilterm` flag.
- Website (worker.js): dynamic pricing label, FAQ/activation/thank-you/bot-help all consistent with email + License Key flow.
- `config.license_required` now reads from config file (was hardcoded `True`).
- Version sync across pyproject.toml, src/__init__.py, launch.py, README.md, installer.iss, LICENSE_AGREEMENT.txt.

### Removed
- Legacy `installer_windows.iss` (only `installer.iss` remains).
- `.DS_Store` files from repo + added to `.gitignore`.

## [2.0.0] — 2026-03-15

### Added
- **Math Solver** — screenshot → Qwen2.5-VL-3B (vision) → Qwen2.5-7B (solve) → answer display
- **5 exam modes** — Mathematics, Physics, Chemistry, STEM Chinese, Humanities Chinese with mode-specific prompts
- **GPU auto-detection** — nvidia-smi VRAM check: 8GB+ full GPU, 4-8GB partial, <4GB CPU-only
- **LlamaCpp provider** — local GGUF model inference via llama-cpp-python subprocess
- **Answer window** — compact overlay (Ctrl+F1) above CSCA with z-level assertion every 50ms
- **Session logger** — save exam sessions + optional cloud upload
- **Translate worker** — MarianMT Chinese→English translation
- **Welcome screen** — first-launch instructions with Machine ID display
- **11-day free trial** — machine-bound with anti-tamper (clock detection, VM detection, multi-storage)
- **Background update check** — via license.muravey.app/version
- **Inno Setup installer** — Windows Setup.exe with language selection
- **Watermark, VM detection, heartbeat** security measures
- **Nuitka compilation** — protect math_solver.py prompts from decompilation

### Fixed
- Standardized versions across pyproject.toml, __init__.py, installer, README
- Model auto-download with 3 retries on failure

## [1.3.0] — 2026-03-07

### Added
- **Data isolation** — all user data moved to `~/.muravey-china/` (separate from Муравей project). Prevents cross-app data collision.
- **Hotkey failure notification** — if the main hotkey fails to register (e.g. already in use by another app), the overlay now shows a visible warning to the user with instructions to change it in Settings.
- **Stealth + Ollama availability check** — on startup, if stealth mode is active and the configured provider is Ollama, the app checks whether Ollama is reachable and logs a warning if not, so the user can start Ollama before the exam.
- **macOS CI/CD** — added `.github/workflows/build-macos.yml` for automatic `.dmg` builds on tag push.

### Fixed
- **Version mismatch** — `pyproject.toml`, `src/__init__.py`, `README.md` and `installer_windows.iss` now all report `1.3.0`.

### Tests
- **2211 tests** passing, 33 skipped (Windows-only platform tests).

## [1.2.0] — 2026-03-05

### Added
- **i18n caching** — `lru_cache(maxsize=1024)` for static translation lookups; cache invalidates automatically on language change. Speeds up repeated UI label lookups significantly.
- **Stealth config: `typing_variation_ms`** (default 20) — controls Gaussian std-dev for biometric typing delay variation. Previously hardcoded.
- **Stealth config: `punctuation_pause_ms`** (default 150) — base extra pause after punctuation characters.
- **Stealth config: `detection_ttl_seconds`** (default 5) — how often SEB/exam-software detection re-checks running processes. Now configurable in `config.yaml`.
- **Stats window: Success Rate Trend chart** — 30-day line chart showing daily request success rate (%), with 95% reference line.
- **Stats window: Avg Response Time Trend chart** — 30-day bar chart showing average AI response duration in milliseconds per day.
- **StatsManager: `get_daily_success_duration(days)`** — new method returning per-day `{success_rate, avg_duration_ms}` data for the new charts.

### Fixed
- **Runtime bug: `_` i18n shadowing in `_populate_slash_mode`** — `shortcut_part, _, extra = text.partition(" ")` was overwriting the module-level `_()` translation function, causing `TypeError: 'str' object is not callable` on line 505. Renamed to `_sep`.
- **mypy: `QCoreApplication.setStyleSheet`** — added `# type: ignore[attr-defined]` in `app.py` and `stats_window.py` where `QApplication.instance()` returns `QCoreApplication | None` but `setStyleSheet` is a `QApplication`-only method.
- **mypy: `adapter.ask()` return type** — used `typing.cast(AIResponse, ...)` in non-streaming branch to satisfy mypy without runtime overhead.
- **mypy: `paste_fn` type** — changed from `object` to `Callable[[str], None] | None` in `_run_ai_pipeline`.
- **mypy: PIL `Image.LANCZOS`** — use `getattr(Image, "Resampling", Image).LANCZOS` for Pillow < 9.1 compatibility.
- **mypy: `QScrollBar | None`** — added `if scrollbar is not None` guard in `overlay_win.py`.
- **mypy: `QClipboard | None`** — added `if cb is not None` guard in `overlay_win.py`.
- **mypy: `QHeaderView | None`** — added `if hdr is not None` guards in `prompts_window.py` and `stats_window.py`.
- **mypy: `QPushButton | None`** — added `if save_btn/cancel_btn is not None` guards in `prompts_window.py`.
- **mypy: `QLineEdit | None`** — added `if le is not None` guard in `prompts_window.py`.
- **mypy: `vision_adapter._client` type** — annotated as `_openai.OpenAI | None` via `TYPE_CHECKING` import.
- **mypy: `int()` cast** for `stealth_typing_speed_ms` (was `float | int`, `TypingEngine` expects `int`).
- **mypy: `tray.py`** — added `assert self._icon is not None` before `.run()`.
- **mypy: `cache_mgr is not None`** explicit guards in `_run_ai_pipeline`.
- **mypy: `prompt_mgr is None`** guard before `QuickSelectDialog` construction.

### Tests
- **100% code coverage** — 7304 statements, 0 missed (Rounds 13–25).
- **2140 tests** passing, 26 skipped (Windows-only platform tests).
- All new i18n, config, stats, and typing changes covered.

## [1.1.0] — 2026-01-15

### Added
- **Stealth mode** — CSCA / Safe Exam Browser compatibility:
  - Automatic exam software detection (`src/seb/detection.py`)
  - Stealth hotkey registration via Carbon `RegisterEventHotKey` (macOS) / polling (Windows)
  - Window-message injection: `EM_REPLACESEL` → `WM_CHAR` → `SendInput` fallback chain
  - Biometric typing emulation with Gaussian delay distribution, bigram coefficients, fatigue factor, typo simulation
  - Overlay at z-level 1100 (above SEB kiosk ~1000)
- **Vision AI** — screenshot analysis via multimodal models (Aliyun qwen-vl, 88API gpt-4o)
- **Auto-answer** — exam question detection and automatic answer generation
- **Page solver** — full-page multi-question solver with structured output
- **Snippet library** — save/load/search AI responses as reusable snippets
- **History manager** — persistent request/response history with autosave
- **Clipboard history** — track recent clipboard entries
- **Knowledge base (FTS5)** — semantic Q&A storage with full-text search, CJK tokenization, auto-learn from AI responses
- **Cost tracker** — per-model pricing and running cost tracking
- **Panic button** — emergency data wipe
- **License manager** — server-side license validation with TTL cache

## [1.0.0] — 2025-11-01

### Initial Release
- Cross-platform AI assistant (macOS + Windows)
- Four AI providers: Deepseek, Aliyun (Qwen), 88API, Ollama
- Global hotkey → text selection → AI processing → overlay display
- Streaming responses with cancel support
- Prompt template library with slash commands
- Secure API key storage (macOS Keychain / Windows Credential Manager)
- Auto-updates via GitHub Releases
- Stats window (request history, token counts, provider breakdown)
- i18n: English, Russian, Chinese (Simplified)
- Settings window (Windows Qt6 + macOS Cocoa)
