fix: simplify host status to online/offline and keep it live without a refresh

This commit is contained in:
LukeGus committed 2026-10-04 14:18:50 -05:00
1 parent 2646b649d7
commit 0a436ab3d8
48 files changed
+549 -789

No files matched your search

+12 -4
View File
@@ -840,19 +840,24 @@ export interface PluginHosts {
status: PluginHostStatusApi;
}
/** online: a login worked. reachable: the port answers. offline: it does not. */
/**
* online: the port answers, a session is open or a login worked. offline: the
* port does not answer. "reachable" is no longer sent and stays only so older
* plugins still type check.
*/
export type PluginHostStatus = "online" | "reachable" | "offline";
export interface PluginHostStatusEntry {
status: PluginHostStatus;
lastChecked: string;
/** @deprecated No longer sent. */
reason?: "host_key_changed";
}
/**
* Core checks every host with status checks on by opening a TCP connection to
* it. A plugin that logs in to hosts tells core how that went, which is what
* turns "reachable" into "online".
* it. A plugin that logs in to hosts can report a working login, which marks
* the host online right away.
*/
export interface PluginHostStatusApi {
/**
@@ -862,7 +867,10 @@ export interface PluginHostStatusApi {
get: (hostId: number) => Promise<PluginHostStatusEntry | null>;
/** Checks the host now unless core checked it recently. */
check: (hostId: number) => Promise<PluginHostStatusEntry | null>;
/** Reports a login attempt. Not audited: pollers call it every sample. */
/**
* Reports a login attempt. Only a working login changes the status; a
* failed one is ignored. Not audited: pollers call it every sample.
*/
reportLogin: (
hostId: number,
outcome: { ok: boolean; hostKeyChanged?: boolean },
+5 -3
View File
@@ -76,7 +76,7 @@ export interface PluginHostRecord {
quickConnectSavable?: boolean;
/** Assigned when a host is opened in a tab; tells duplicate tabs apart. */
instanceId?: string;
/** Core's status: "online" once a login worked. */
/** Core's status: "online" when the host answers. */
status?: "online" | "reachable" | "offline" | "unknown";
online?: boolean;
/** Someone else owns this host and shared it with the user. */
@@ -1134,11 +1134,13 @@ export interface ActivityTargetInfo {
}
/**
* 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.
* Core's status for a host, the one behind the host list's dot. online: the
* port answers. offline: it does not. unknown: not checked yet. "reachable"
* is no longer sent and stays only so older plugins still type check.
*/
export interface HostStatusInfo {
status: "online" | "reachable" | "offline" | "unknown";
/** @deprecated No longer sent. */
reason?: "host_key_changed";
}