Improve local agent chat and device health detection

This commit is contained in:
showtan001
2026-08-29 16:03:15 +08:00
parent 050d1329c4
commit a315c62f3a
11 changed files with 289 additions and 4 deletions
+14
View File
@@ -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: