fix: count plugin ssh logins toward host status and stop showing reachable as a warning

This commit is contained in:
LukeGus committed 2026-09-30 17:49:09 -05:00
1 parent 69b1b9805b
commit f97f35de1f
12 files changed
+143 -25

No files matched your search

+13
View File
@@ -164,6 +164,18 @@ export function createPluginSsh({ manifest, bag, audit }: Deps): PluginSsh {
return { ...(host as unknown as SshConnectHost), userId };
};
/** A login to a saved host core resolved counts toward its status dot. */
const reportLogin = (host: number | PluginSshHost) => {
const hostId =
typeof host === "number" ? host : resolvedHosts.get(host)?.host.id;
if (!Number.isInteger(hostId) || hostId <= 0) return;
void import("../hosts/status/host-status-service.js")
.then(({ hostStatusService }) =>
hostStatusService.reportLogin(hostId, { ok: true }),
)
.catch(() => {});
};
/** Checks, connects and audits one new connection. */
const connectOnce = async (
host: number | PluginSshHost,
@@ -201,6 +213,7 @@ export function createPluginSsh({ manifest, bag, audit }: Deps): PluginSsh {
sock: options?.sock as MutableConnectConfig["sock"],
});
await audit("ssh_connect", describeHost(host), { success: true });
reportLogin(host);
const dispose = () => {
open.delete(dispose);