feat: finish the fleets plugin, add ctx.hosts and host-commands SDK (B4)

This commit is contained in:
LukeGus committed 2026-09-23 13:10:18 -05:00
1 parent 37c015a760
commit c381955ed0
43 files changed
+835 -1999

No files matched your search

+2 -2
View File
@@ -27,8 +27,8 @@ function sshHostToMinimalHost(h: SSHHost): Host {
authType: h.authType,
enableTerminal: h.enableTerminal ?? false,
enableCommandHistory: h.enableCommandHistory ?? false,
enableProxmox: h.enableProxmox ?? false,
enableProxmoxStats: h.enableProxmoxStats ?? false,
enableProxmox: !!h.pluginSettings?.proxmox?.enableProxmox,
enableProxmoxStats: !!h.pluginSettings?.proxmox?.enableProxmoxStats,
enableTmuxMonitor: h.enableTmuxMonitor ?? false,
enableTerminalToolbar: h.enableTerminalToolbar ?? true,
enableAiAssistant: h.enableAiAssistant ?? false,
+23 -16
View File
@@ -127,6 +127,10 @@ export function createHostEditorForm(
...(remoteDefaults ?? {}),
...(host?.guacamoleConfig ?? {}),
};
const proxmoxSettings = (host?.pluginSettings?.proxmox ?? {}) as Record<
string,
unknown
>;
const rawTheme = terminalConfig.theme ?? d?.theme;
const normalizedTheme =
!rawTheme ||
@@ -198,22 +202,25 @@ export function createHostEditorForm(
enableTerminalToolbar: host?.enableTerminalToolbar ?? true,
enableAiAssistant: host?.enableAiAssistant ?? false,
allowSessionSharing: host?.allowSessionSharing ?? true,
enableProxmox: host?.enableProxmox ?? false,
proxmoxConfig: host?.proxmoxConfig ?? {
defaultCredentialId: null as number | null,
defaultAuthType: "password" as string,
windowsPatterns: "win, windows",
dockerPatterns: "docker",
preferredPrefixes: "10., 192.168.",
autoSyncEnabled: false,
syncIntervalMinutes: 15,
markMissingGuests: true,
},
enableProxmoxStats: host?.enableProxmoxStats ?? false,
proxmoxStatsConfig: host?.proxmoxStatsConfig ?? {
pollInterval: 60,
nodeName: null as string | null,
},
enableProxmox: (proxmoxSettings.enableProxmox as boolean) ?? false,
proxmoxConfig:
((proxmoxSettings.proxmoxConfig as Host["proxmoxConfig"]) ?? {
defaultCredentialId: null,
defaultAuthType: "password",
windowsPatterns: "win, windows",
dockerPatterns: "docker",
preferredPrefixes: "10., 192.168.",
autoSyncEnabled: false,
syncIntervalMinutes: 15,
markMissingGuests: true,
}) as Host["proxmoxConfig"],
enableProxmoxStats:
(proxmoxSettings.enableProxmoxStats as boolean) ?? false,
proxmoxStatsConfig:
((proxmoxSettings.proxmoxStatsConfig as Host["proxmoxStatsConfig"]) ?? {
pollInterval: 60,
nodeName: null,
}) as Host["proxmoxStatsConfig"],
enableTunnel: host?.enableTunnel ?? false,
defaultPath: host?.defaultPath ?? "/",
forceKeyboardInteractive: host?.forceKeyboardInteractive ?? false,
+12 -4
View File
@@ -46,6 +46,10 @@ export function sshHostToHost(h: SSHHostWithStatus): Host {
const isSshHost = h.connectionType === "ssh" || !h.connectionType;
const parsedTerminalConfig = parseJson(h.terminalConfig) as
(Host["terminalConfig"] & { sudoPassword?: string }) | undefined;
const proxmoxSettings = (h.pluginSettings?.proxmox ?? {}) as Record<
string,
unknown
>;
return {
id: String(h.id),
name: h.name,
@@ -95,13 +99,17 @@ export function sshHostToHost(h: SSHHostWithStatus): Host {
dockerConfig: h.dockerConfig ?? null,
enableWebUi: h.enableWebUi ?? false,
webUiConfig: h.webUiConfig ?? { endpoints: [] },
enableProxmox: h.enableProxmox ?? false,
enableProxmoxStats: h.enableProxmoxStats ?? false,
enableProxmox: (proxmoxSettings.enableProxmox as boolean) ?? false,
enableProxmoxStats:
(proxmoxSettings.enableProxmoxStats as boolean) ?? false,
enableTmuxMonitor: h.enableTmuxMonitor ?? false,
enableTerminalToolbar: h.enableTerminalToolbar ?? true,
enableAiAssistant: h.enableAiAssistant ?? false,
proxmoxConfig: h.proxmoxConfig ?? null,
proxmoxStatsConfig: h.proxmoxStatsConfig ?? null,
proxmoxConfig:
(proxmoxSettings.proxmoxConfig as Host["proxmoxConfig"]) ?? null,
proxmoxStatsConfig:
(proxmoxSettings.proxmoxStatsConfig as Host["proxmoxStatsConfig"]) ??
null,
enableRdp: h.enableRdp != null ? h.enableRdp : h.connectionType === "rdp",
enableVnc: h.enableVnc != null ? h.enableVnc : h.connectionType === "vnc",
enableTelnet:
+14 -6
View File
@@ -375,10 +375,14 @@ describe("Proxmox / Proxmox Stats independent toggles", () => {
it("seeds both configs independently from an existing host", () => {
const host = {
enableProxmox: true,
proxmoxConfig: { windowsPatterns: "win", dockerPatterns: "docker" },
enableProxmoxStats: true,
proxmoxStatsConfig: { pollInterval: 30, nodeName: "pve-custom" },
pluginSettings: {
proxmox: {
enableProxmox: true,
proxmoxConfig: { windowsPatterns: "win", dockerPatterns: "docker" },
enableProxmoxStats: true,
proxmoxStatsConfig: { pollInterval: 30, nodeName: "pve-custom" },
},
},
} as unknown as Host;
const form = createHostEditorForm(host);
@@ -446,8 +450,12 @@ describe("Proxmox / Proxmox Stats independent toggles", () => {
};
const form = {
...createHostEditorForm({
enableProxmox: false,
proxmoxConfig: { source },
pluginSettings: {
proxmox: {
enableProxmox: false,
proxmoxConfig: { source },
},
},
} as unknown as Host),
name: "Edited guest",
};
@@ -51,8 +51,6 @@ function sshHost(
enableTunnel: false,
enableFileManager: false,
enableDocker: false,
enableProxmox: false,
enableProxmoxStats: false,
enableTmuxMonitor: false,
enableTerminalToolbar: true,
enableAiAssistant: false,