feat: finish the host-metrics plugin, move host status into core (B16)

This commit is contained in:
LukeGus committed 2026-09-24 11:21:23 -05:00
1 parent 14eb558b85
commit 0a3f05d99d
308 files changed
+53073 -8985

No files matched your search

+21
View File
@@ -695,6 +695,16 @@ export interface PluginHostBridge {
id: string,
) => ComponentType<Record<string, unknown>> | undefined;
hostProtocols: (host: PluginHostRecord) => string[];
useHostStatus: (hostId: number | undefined) => HostStatusInfo | null;
}
/**
* Core's status for a host, the one behind the host list's dot. online: a
* login worked. reachable: the port answers. unknown: not checked yet.
*/
export interface HostStatusInfo {
status: "online" | "reachable" | "offline" | "unknown";
reason?: "host_key_changed";
}
let host: PluginHostBridge | null = null;
@@ -765,6 +775,17 @@ export function useHosts(): { hosts: PluginHostRecord[]; loaded: boolean } {
return requireHost().useHosts();
}
/**
* Core's status for one host, kept current by the shell's own polling. Null
* outside the app shell (a standalone window) and for hosts with status
* checks off.
*/
export function useHostStatus(
hostId: number | undefined,
): HostStatusInfo | null {
return requireHost().useHostStatus(hostId);
}
export function useCurrentUser(): CurrentUser | null {
return requireHost().useCurrentUser();
}