feat(core): retain online device snapshots
Store the latest online-device snapshot for each Bridge lifecycle and expose it through the bridge contract as an immutable, owned value. Distinguish a snapshot that has not yet been observed from a valid empty snapshot, replace state atomically on each QQ update, clear it during disposal, and cover lifecycle, immutability, and cleanup behavior with focused tests.
This commit is contained in:
3 files changed
+92
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import type { OnlineDeviceInfo } from '@snowluma/protocol/events';
|
||||
import type { BridgeContext } from './bridge-context';
|
||||
|
||||
export interface BridgeInterface extends BridgeContext {
|
||||
@@ -5,4 +6,7 @@ export interface BridgeInterface extends BridgeContext {
|
||||
/** False only when every attached QQ process is confirmed stale.
|
||||
* An unarmed watchdog remains true for compatibility. */
|
||||
readonly receiveHealthy: boolean;
|
||||
/** Latest device snapshot observed on this Bridge lifecycle. `null` means
|
||||
* QQ has not emitted its cache notification since SnowLuma attached. */
|
||||
getOnlineClients(): readonly Readonly<OnlineDeviceInfo>[] | null;
|
||||
}
|
||||
Reference in new issue
Block a user