Spaces:
Paused
Paused
Commit History
-
refactor(core): 🔨 centralize path management for PyInstaller compatibility
MirrowelIntroduce a new `paths.py` utility module that provides centralized path resolution for all data files (logs, cache, OAuth credentials, usage data) with support for both PyInstaller EXE and script/library runtime modes. - Add `get_default_root()` to auto-detect EXE directory when frozen, otherwise uses CWD - Add `get_logs_dir()`, `get_cache_dir()`, `get_oauth_dir()`, and `get_data_file()` helpers - Update `RotatingClient` to accept optional `data_dir` parameter for override capability - Refactor all hardcoded path calculations to use centralized utilities - Update `CredentialManager` to accept `oauth_dir` parameter - Convert `failure_logger` to lazy initialization with configurable logs directory - Migrate `UsageManager` to accept optional `file_path` with automatic defaults - Update all provider-specific logging directories to use centralized helpers - Refactor credential tool and settings tool to use path utilities - Update main.py to load .env files from correct root directory in b…467f294
-
feat(io): ✨ add shutdown flush mechanism for buffered writes
MirrowelThis commit introduces a global buffered write registry with automatic shutdown flush, ensuring critical data (auth tokens, usage stats) is saved even when disk writes fail temporarily. - Add `BufferedWriteRegistry` singleton for centralized buffered write management - Implement periodic retry (30s interval) and atexit shutdown flush for pending writes - Enable `buffer_on_failure` parameter in `safe_write_json()` for credential files - Integrate buffering with `ResilientStateWriter` for automatic registry registration - Update OAuth providers (Google, Qwen, iFlow) to use buffered credential writes - Change provider cache `_save_to_disk()` to return success status for better tracking - Reduce log noise by changing missing thoughtSignature warnings to debug level - Export `BufferedWriteRegistry` from utils module for monitoring access The new architecture ensures data is never lost on graceful shutdown (Ctrl+C), with console output showing flush progress and results. All buffered write…ea1e9f1 -
feat(io): ✨ add fault-tolerant file operations with automatic recovery
MirrowelEnhances application reliability by introducing a comprehensive I/O abstraction layer that eliminates crashes from filesystem issues. The system distinguishes between critical state files (credentials, usage data) that require memory buffering with retry logic, and disposable logs that can be safely dropped on failure. Key improvements: - New `ResilientStateWriter` class maintains in-memory state for critical files with background retry mechanism on disk failure - Introduced `safe_write_json`, `safe_log_write`, and `safe_mkdir` utility functions for one-shot operations with graceful degradation - Logging subsystems (`DetailedLogger`, `failure_logger`) now drop data on disk failure to prevent memory exhaustion during streaming - Authentication providers (`GoogleOAuthBase`, `IFlowAuthBase`, `QwenAuthBase`) preserve credentials in memory when filesystem becomes unavailable - `UsageManager` delegates persistence to `ResilientStateWriter` for automatic recovery from transient failures - `…7f148b3 -
Fix to satisfy pylint
Mirrowel0af8a39 -
feat(auth): ✨ implement global reauth coordinator to serialize interactive OAuth flows
MirrowelThis commit introduces a centralized ReauthCoordinator singleton that ensures only one interactive OAuth flow (across all providers: Google, iFlow, Qwen) executes at a time. This prevents port conflicts, reduces user confusion, and improves credential state management reliability. Key changes: - Add new `ReauthCoordinator` class with global semaphore-based serialization - Extract interactive OAuth logic into separate `_perform_interactive_oauth()` methods for each provider - Update `initialize_token()` methods to delegate to coordinator instead of running OAuth inline - Change `_unavailable_credentials` from set to dict with timestamps for TTL-based stale entry cleanup - Add comprehensive logging and statistics tracking for reauth operations - Update all providers (GoogleOAuthBase, IFlowAuthBase, QwenAuthBase) to use the coordinator - Add 300-second timeout for interactive flows with automatic cleanup on timeout/cancellation - Implement defense-in-depth with TTL-based cleanup (5 minut…219a7a9
-
fix(oauth): 🐛 escape rich markup in oauth authorization urls
MirrowelPrevent Rich markup interpretation issues when displaying OAuth authorization URLs in terminal output. - Import `rich.markup.escape` to properly escape special characters (=, &, etc.) in URLs - Add extensive inline documentation explaining the escaping rationale and known terminal compatibility issues - Apply URL escaping to authorization URLs in Google OAuth, iFlow, and Qwen Code providers - Refine headless environment detection to exclude macOS from DISPLAY checks (macOS uses Quartz, not X11) - Improve code formatting consistency (string quotes, line wrapping) across OAuth providers The escaped URLs display correctly in all terminal configurations while remaining clickable in supported terminals (iTerm2, Windows Terminal, etc.).81e9ff5
-
feat(auth): improve credential tool startup UX and lazy-load providers
Mirrowel- Defer heavy provider imports via a new _ensure_providers_loaded() helper to avoid the 6-7s blank startup wait and load providers lazily. - Enhance launcher TUI to show a full loading UI with spinner, header, elapsed time and provider count; call run_credential_tool(from_launcher=True) to avoid duplicate loading screens. - Add from_launcher flag to run_credential_tool and clear_on_start parameter to main() so standalone vs launcher flows behave correctly. - Swap direct provider_factory and PROVIDER_PLUGINS usage to go through the lazy loader in credential tool and callers. - Improve interactive UX: preserve/clear screen appropriately, add short pauses and prompts after flows, and keep console status messages during initialization. - Fix output formatting in qwen/iflow providers (replace escaped newlines with actual newlines) and enhance headless detection to log and print user-visible guidance when running without a GUI.2b065a1 -
feat(auth): ✨ add headless detection, re-auth on invalid refresh tokens, and persist gemini project/tier metadata
Mirrowel- add src/rotator_library/utils/headless_detection.py and export via utils __init__ to detect CI/SSH/container/headless sessions - use headless detection in Gemini/Qwen/iFlow auth flows to present appropriate instructions and avoid attempting to open a browser when no GUI is available - handle 401/403 refresh errors by triggering re-authentication flow (set needs_reauth, call initialize_token) instead of silently failing; improve logging around invalid grants - add GEMINI_CLI_TIER support: read/write tier into _proxy_metadata, include tier when exporting .env, cache tier info and persist project_id/tier to credential files via _persist_project_metadata - add mixed-tier detection and warning (_check_mixed_tier_warning) to surface potential free/paid credential conflicts - non-fatal persistence failures are logged to avoid startup regressions9756075