Improve local agent chat and device health detection
This commit is contained in:
@@ -122,6 +122,20 @@ class DeviceManager:
|
||||
self._drivers.pop(device_id, None)
|
||||
self._set_status(device_id, "offline" if offline else "error")
|
||||
|
||||
def probe(self, device_id: str) -> bool:
|
||||
"""Check whether an established driver is still reachable."""
|
||||
with self._lock:
|
||||
self._device(device_id)
|
||||
driver = self._drivers.get(device_id)
|
||||
if driver is None:
|
||||
return False
|
||||
try:
|
||||
driver.screenshot()
|
||||
except Exception:
|
||||
self.mark_error(device_id, offline=True)
|
||||
return False
|
||||
return True
|
||||
|
||||
def active_driver(self, device_id: str | None = None) -> Driver:
|
||||
with self._lock:
|
||||
if device_id is None:
|
||||
|
||||
Reference in New Issue
Block a user