Bidirectional Instance Detection with DI
Any trcc instance (CLI, API) automatically detects if another instance (GUI or API) is already running and routes commands through it via proxy instead of touching USB directly. Uses dependency injection — composition roots inject find_active_fn and proxy_factory_fn into core LCDDevice/LEDDevice. Core decides when to proxy, adapters inject how.
Features
InstanceKindenum +find_active()— pure core module for instance detection (GUI IPC socket > API health > None)- Proxy factory functions —
create_lcd_proxy(kind)/create_led_proxy(kind)return correct proxy type @_forward_to_proxydecorator — transparent method forwarding on LEDDevice (13 public methods)- Eliminated
IPCClient.available()from all source code — replaced withfind_active()everywhere
Internal
- 4784 tests (+25 new), ruff clean, pyright 0 errors
- Composition root wiring in CLI
_display.py/_led.pyand APIdevices.py
Full changelog: https://github.com/Lexonight1/thermalright-trcc-linux/blob/main/doc/CHANGELOG.md