feat(cloud): report planner transport status

This commit is contained in:
2026-07-13 23:15:46 +08:00
parent 40efa53411
commit 5b64efab53
15 changed files with 71 additions and 6 deletions
+8 -1
View File
@@ -34,6 +34,7 @@ class HostRegistration:
host_id: str
address: str | None
last_seen_at: datetime
planner_transport: Literal["direct", "cloud"] = "direct"
@dataclass(frozen=True)
@@ -61,6 +62,7 @@ class DevicePool:
snapshot: list[Device],
*,
address: str | None = None,
planner_transport: Literal["direct", "cloud"] = "direct",
allow_device_takeover: bool = False,
) -> None:
"""Push a host's current device snapshot into the pool.
@@ -70,7 +72,12 @@ class DevicePool:
other hosts are untouched.
"""
now = utc_now()
self.store.upsert_host(host_id, address=address, last_seen_at=now)
self.store.upsert_host(
host_id,
address=address,
last_seen_at=now,
planner_transport=planner_transport,
)
devices = [self._to_pooled(device, host_id, now) for device in snapshot]
if allow_device_takeover:
self.store.replace_host_devices(