feat: host lock api so a plugin can load hosts from a config file (#1581)

This commit is contained in:
LukeGus committed 2026-10-19 12:02:05 -05:00
1 parent 1cdbfc674c
commit 2c785fe35b
34 files changed
+1388 -52

No files matched your search

@@ -5,6 +5,7 @@ import {
} from "../../hosts/ssh-options.js";
import { listHostProtocols } from "../../hosts/protocol-auth/registry.js";
import { sanitizeProtocolAuthForRecipient } from "../../hosts/protocol-auth/summary.js";
import { hostLock } from "../../hosts/locks.js";
export function isNonEmptyString(value: unknown): value is string {
return typeof value === "string" && value.trim().length > 0;
@@ -337,6 +338,7 @@ const CONNECT_LEVEL_FIELDS = new Set([
"sshPort",
"protocolAuth",
"jumpHosts",
"lock",
"createdAt",
"updatedAt",
]);
@@ -439,8 +441,10 @@ export function transformHostResponse(
host: Record<string, unknown>,
): Record<string, unknown> {
const shared = parseSharedSource(host.sharedSource);
const lock = typeof host.id === "number" ? hostLock(host.id) : null;
return {
...host,
...(lock ? { lock } : {}),
sharedSource: undefined,
localOnly: !!host.localOnly,
sharedCopy: !!shared,