Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
fix(webui): polish remote setup and simplify connection dialogs
Xubin Ren0ffdf866197a
diff --git a/webui/src/App.tsx b/webui/src/App.tsxindex 7ef310c24..306d05f91 100644--- a/webui/src/App.tsx+++ b/webui/src/App.tsx@@ -1113,11 +1113,26 @@ function Shell({const { t, i18n } = useTranslation();const remoteConnections = useRemoteConnections();const localActive = remoteConnections?.localActive !== false;- const managingConnections = remoteConnections?.managing === true;+ const managingConnections = remoteConnections?.managing === true && !remoteConnections?.activeHostId;+ const { theme, toggle } = useTheme();+ const managementMain = useRef<HTMLElement>(null);+ const reportManagementSurface = remoteConnections?.reportManagementSurface;+ useEffect(() => {+ const main = managementMain.current;+ if (!main || !reportManagementSurface) return;+ const report = () => {+ const rect = main.getBoundingClientRect();+ reportManagementSurface({ left: rect.left, top: rect.top, width: rect.width, height: rect.height }, theme);+ };+ const observer = new ResizeObserver(report);+ observer.observe(main);+ window.addEventListener("resize", report);+ report();+ return () => { observer.disconnect(); window.removeEventListener("resize", report); };+ }, [reportManagementSurface, theme]);const remoteConnectionsRef = useRef(remoteConnections);remoteConnectionsRef.current = remoteConnections;const { client, getToken } = useClient();- const { theme, toggle } = useTheme();const {sessions,loading,@@ -1277,9 +1292,9 @@ function Shell({const navigate = useCallback((route: ShellRoute, options?: { replace?: boolean }) => {const leave = () => {- // Navigating the local sidebar is an explicit choice of a local view.- // Merely opening global connection management does not switch hosts.- if (remoteConnectionsRef.current?.managing) remoteConnectionsRef.current.selectLocal();+ // The visible sidebar always belongs to its existing host. Navigation+ // dismisses global management without switching to a different host.+ if (remoteConnectionsRef.current?.managing) remoteConnectionsRef.current.closeManagement();setActiveKey(route.activeKey);setView(route.view);setSettingsInitialSection(route.settingsSection);@@ -2887,7 +2902,9 @@ function Shell({/></Suspense>) : null}- <main+ <main ref={managementMain}+ aria-hidden={managingConnections && remoteConnections?.embeddedManagement || undefined}+ {...(managingConnections && remoteConnections?.embeddedManagement ? { inert: "" } : {})}className={cn("relative flex h-full min-w-0 flex-1 flex-col overflow-hidden bg-background",)}@@ -3077,7 +3094,7 @@ function Shell({</div>)}</div>- {managingConnections && <div className="absolute inset-0 flex flex-col">+ {managingConnections && !remoteConnections?.embeddedManagement && <div className="absolute inset-0 flex flex-col"><RemoteConnectionsPagemainNavigationExpanded={showMainSidebar && hostSidebarOpen}hostChromeInset={showHostChrome}diff --git a/webui/src/components/remote/HostCompatibilityDialog.tsx b/webui/src/components/remote/HostCompatibilityDialog.tsxnew file mode 100644index 000000000..a62155be3--- /dev/null+++ b/webui/src/components/remote/HostCompatibilityDialog.tsx@@ -0,0 +1,60 @@+import { useEffect, useRef } from "react";+import { Check, CircleAlert, ExternalLink } from "lucide-react";+import { useTranslation } from "react-i18next";+import { Button } from "@/components/ui/button";+import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "@/components/ui/dialog";+import { SettingsGroup } from "@/components/settings/shared/SettingsControls";+import type { RemoteProfile } from "@/lib/remote-instances";+import "./remote-layout.css";++/** Informational only: installing packages and restarting a host need explicit consent. */+export function HostCompatibilityDialog({ profile, clientVersion, onClose }: {+ profile: RemoteProfile | undefined;+ clientVersion?: string;+ onClose: () => void;+}) {+ const { t } = useTranslation();+ // Radix keeps closed content mounted until its exit animation finishes.+ const lastProfile = useRef(profile);+ useEffect(() => { if (profile) lastProfile.current = profile; }, [profile]);+ const displayedProfile = profile || lastProfile.current;+ const report = displayedProfile?.compatibility;+ const status = report?.status || "unchecked";+ const compatible = status === "compatible";+ return <Dialog open={!!profile} onOpenChange={(open) => { if (!open) onClose(); }}>+ <DialogContent className="remote-dialog max-w-md overflow-y-auto outline-none">+ <DialogHeader className="pr-5 text-left">+ <DialogTitle className="text-balance leading-snug">{t("remote.compatibility.title")}</DialogTitle>+ <DialogDescription className="text-pretty [overflow-wrap:anywhere]">{displayedProfile?.name} · {displayedProfile?.host}</DialogDescription>+ </DialogHeader>+ <SettingsGroup>+ <dl className="space-y-3 px-4 py-3 text-[13px] leading-5">+ {[{ label: t("remote.compatibility.client"), version: report?.client_version || clientVersion },+ { label: t("remote.compatibility.host"), version: report?.host_version }].map(({ label, version }) =>+ <div key={label} className="grid grid-cols-[minmax(0,1fr)_fit-content(45%)] items-baseline gap-x-4">+ <dt className="min-w-0 text-pretty text-muted-foreground">{label}</dt>+ <dd className="min-w-0 text-pretty text-right tabular-nums [overflow-wrap:anywhere]">{version || t("remote.compatibility.unreported")}</dd>+ </div>)}+ </dl>+ </SettingsGroup>+ <div role="status" className="flex items-start gap-2 text-[13px] leading-5">+ {compatible ? <Check aria-hidden className="mt-0.5 h-4 w-4 shrink-0 text-emerald-600 dark:text-emerald-400" />+ : <CircleAlert aria-hidden className="mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" />}+ <div className="min-w-0"><p className="text-pretty font-medium">{t(`remote.compatibility.${status}`)}</p>+ <p className="mt-1 text-pretty text-muted-foreground">{t(`remote.compatibility.${status}Hint`)}</p></div>+ </div>+ {report && !compatible && <details className="text-xs leading-5 text-muted-foreground">+ <summary className="cursor-pointer py-1">{t("remote.compatibility.preparation")}</summary>+ <p className="mt-2 text-pretty">{t(status === "update_client" ? "remote.compatibility.localUpdateHint" : "remote.compatibility.serverUpdateHint")}</p>+ </details>}+ <div className={report && !compatible ? "remote-dialog-actions" : "flex justify-end"}>+ <Button className="remote-action" variant="ghost" onClick={onClose}>{t("common.close")}</Button>+ {report && !compatible && <Button asChild className="remote-action gap-2">+ <a href="https://github.com/HKUDS/nanobot/blob/main/docs/quick-start.md#updating" target="_blank" rel="noopener noreferrer">+ {t("remote.compatibility.guide")}<ExternalLink aria-hidden className="h-3.5 w-3.5" />+ </a>+ </Button>}+ </div>+ </DialogContent>+ </Dialog>;+}diff --git a/webui/src/components/remote/HostSwitcher.tsx b/webui/src/components/remote/HostSwitcher.tsxindex d37c9e954..ea5baba7d 100644--- a/webui/src/components/remote/HostSwitcher.tsx+++ b/webui/src/components/remote/HostSwitcher.tsx@@ -21,6 +21,7 @@ export interface HostPicker {pending: { id: string; name: string } | null;error: string;offline: boolean;+ offlineLabel?: string;select: (id: string | null) => void;manage: () => void;cancel: () => void;@@ -133,13 +134,18 @@ export function HostSwitcher({ collapsed = false, portalContainer }: { collapsedconst shell = picker.kind === "shell" ? picker : null;const remote = picker.kind === "embedded" || !!shell?.currentId;const pendingName = picker.kind === "shell" ? picker.pending?.name : picker.pendingName;+ const currentStatus = shell?.currentId+ ? (shell.pending?.id === shell.currentId || shell.profiles.find((profile) => profile.id === shell.currentId)?.state === "connecting" ? "connecting" : shell.offline ? "closed" : "open")+ : status;// A failed switch describes the destination, not the still-active connection.- const failed = !!shell?.offline || status === "error" || status === "closed";- const waiting = !!pendingName || status === "connecting" || status === "reconnecting";+ const failed = !!shell?.offline || currentStatus === "error" || currentStatus === "closed";+ const waiting = !!pendingName || currentStatus === "connecting" || currentStatus === "reconnecting";// The old host stays interactive until the new one is ready. Keep its identity// visible; progress belongs to the target's row and the accessible status.const label = picker.name;- const current = `${picker.name} · ${picker.hostname} · ${t(failed ? "remote.offline" : `connection.${status}`)}`;+ const currentLabel = failed ? shell?.offlineLabel || t("remote.offline") : t(`connection.${currentStatus}`);+ const identity = picker.name === picker.hostname ? picker.name : `${picker.name} · ${picker.hostname}`;+ const current = `${identity} · ${currentLabel}`;const detail = pendingName ? `${current} · ${t("remote.preparing", { name: pendingName })}` : current;const title = picker.error ? `${detail} — ${picker.error}` : detail;const button = <Button ref={buttonRef} variant="ghost" size="sm" aria-label={t("remote.switchHost")} title={title}@@ -152,7 +158,7 @@ export function HostSwitcher({ collapsed = false, portalContainer }: { collapsed<span className="relative flex shrink-0 items-center justify-center">{waiting ? <Loader2 className="h-4 w-4 animate-spin motion-reduce:animate-none" /> : failed ? <CircleAlert className="h-4 w-4" />: remote ? <Server className="h-4 w-4" /> : <Laptop className="h-4 w-4" />}- {!waiting && !failed && <span aria-hidden className={cn("absolute -bottom-0.5 -right-0.5 h-1.5 w-1.5 rounded-full ring-2 ring-sidebar", status === "open" ? "bg-emerald-500" : "bg-muted-foreground")} />}+ {!waiting && !failed && <span aria-hidden className={cn("absolute -bottom-0.5 -right-0.5 h-1.5 w-1.5 rounded-full ring-2 ring-sidebar", currentStatus === "open" ? "bg-emerald-500" : "bg-muted-foreground")} />}</span>{!collapsed && <><span className="truncate">{label}</span><ChevronUp className="ml-auto h-3 w-3 shrink-0 opacity-60" /></>}<span className="sr-only" role="status">{detail}</span>diff --git a/webui/src/components/remote/PairRouteSettings.tsx b/webui/src/components/remote/PairRouteSettings.tsxindex 758a500dc..9c8fea706 100644--- a/webui/src/components/remote/PairRouteSettings.tsx+++ b/webui/src/components/remote/PairRouteSettings.tsx@@ -8,7 +8,7 @@ import { remoteAction } from "@/lib/remote-instances";import { useRemoteConnections } from "./RemoteInstances";/** An explicit escape hatch for a VPN/bound-interface route, not a new SSH form. */-export function PairRouteSettings({ id, onSaved }: { id: string; onSaved?: () => void }) {+export function PairRouteSettings({ id, onSaved, showHint = true }: { id: string; onSaved?: () => void; showHint?: boolean }) {const { t } = useTranslation();const { client } = useClient();const connections = useRemoteConnections();@@ -39,18 +39,18 @@ export function PairRouteSettings({ id, onSaved }: { id: string; onSaved?: () =>} finally { if (alive.current) setBusy(false); }};return <div className="space-y-3">- <p className="text-xs leading-5 text-muted-foreground">{t("remote.pair.routeHint")}</p>- <Select value={route} onValueChange={(value) => { setRoute(value); setError(""); setSaved(false); }} disabled={busy}><SelectTrigger aria-label={t("remote.pair.route")}><SelectValue /></SelectTrigger>+ {showHint && <p className="text-xs leading-5 text-muted-foreground">{t("remote.pair.routeHint")}</p>}+ <Select value={route} onValueChange={(value) => { setRoute(value); setError(""); setSaved(false); }} disabled={busy}><SelectTrigger className="w-full min-w-0" aria-label={t("remote.pair.route")}><SelectValue /></SelectTrigger><SelectContent>{hasSavedRoute && <SelectItem value="saved">{t("remote.pair.savedRoute")}</SelectItem>}<SelectItem value="direct">{t("remote.pair.direct")}</SelectItem>- {connections?.directory?.profiles.filter((profile) => !profile.paired).map((profile) => <SelectItem key={profile.id} value={profile.id}>{profile.name}</SelectItem>)}+ {connections?.directory?.profiles.filter((profile) => !profile.paired).map((profile) => <SelectItem key={profile.id} value={profile.id} className="h-auto min-h-9 max-w-[calc(100vw-3rem)] py-2 [overflow-wrap:anywhere]">{profile.name}</SelectItem>)}</SelectContent></Select>- {error && <p role="alert" className="flex items-start gap-2 text-[13px] leading-5 text-foreground"><AlertCircle aria-hidden="true" className="mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" />{error}</p>}- <div className="flex items-center justify-end gap-3">+ {error && <p role="alert" className="remote-alert items-start gap-2 text-[13px] leading-5 text-foreground"><AlertCircle aria-hidden="true" className="mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" /><span>{error}</span></p>}+ <div className="flex flex-wrap items-center justify-end gap-3">{saved && <p role="status" className="mr-auto flex items-center gap-1.5 text-xs text-muted-foreground"><Check aria-hidden className="h-3.5 w-3.5" />{t("remote.saved")}</p>}- <Button size="sm" disabled={busy || route === original || route === "saved"} aria-busy={busy} onClick={() => { void save(); }}>+ <Button className="remote-action" size="sm" disabled={busy || route === original || route === "saved"} aria-busy={busy} onClick={() => { void save(); }}>{busy && <Loader2 aria-hidden className="mr-2 h-4 w-4 animate-spin motion-reduce:animate-none" />}{t(busy ? "remote.saving" : "remote.save")}</Button></div>diff --git a/webui/src/components/remote/QuickPairSetup.tsx b/webui/src/components/remote/QuickPairSetup.tsxindex 455735f9c..33424a225 100644--- a/webui/src/components/remote/QuickPairSetup.tsx+++ b/webui/src/components/remote/QuickPairSetup.tsx@@ -14,13 +14,14 @@ import { pairingReturnOrigin, type PairReturn } from "@/lib/remote-pair-return";import type { ConnectionStatus } from "@/lib/types";import { useRemoteConnections } from "./RemoteInstances";import { PairRouteSettings } from "./PairRouteSettings";+import "./remote-layout.css";type Request = { id: string; command: string; expires: number };type Preview = { id: string; host: string; hostname: string; fingerprint: string; authorized_until: number; revoke_command: string;existing_connection?: { id: string; name: string; connected: boolean } };/** Public invitation → encrypted receipt → explicit confirmation. No private key inputs. */-export function QuickPairSetup({ returned, onSSH, onClose }: { returned?: PairReturn | null; onSSH: () => void; onClose: () => void }) {+export function QuickPairSetup({ returned, active = true, onSSH, onClose }: { returned?: PairReturn | null; active?: boolean; onSSH: () => void; onClose: () => void }) {const { t } = useTranslation();const { client } = useClient();const connections = useRemoteConnections();@@ -56,14 +57,14 @@ export function QuickPairSetup({ returned, onSSH, onClose }: { returned?: PairRe}, [pending]);useEffect(() => {- alive.current = true;+ alive.current = active;return () => {alive.current = false;// A link opens in a new tab. Closing/reloading the originating page must// not destroy its key before the new page can validate the receipt.// Pending invitations are bounded and expire in PairStore.};- }, [client]);+ }, [client, active]);useEffect(() => {if (!request?.expires || saved) return;const timer = window.setTimeout(() => setExpired(true), Math.max(0, request.expires * 1000 - Date.now()));@@ -75,7 +76,10 @@ export function QuickPairSetup({ returned, onSSH, onClose }: { returned?: PairRetry { await action(); }catch (reason) {const localFailure = reason instanceof Error && "status" in reason && [503, 504].includes(Number(reason.status));- if (alive.current) setError(`remote.errors.${localFailure ? "local_connection_unavailable" : reason instanceof Error ? reason.message : "unknown"}`);+ if (alive.current) {+ const code = localFailure ? "local_connection_unavailable" : reason instanceof Error ? reason.message : "unknown";+ setError(`remote.errors.${code}`);+ }} finally { if (alive.current) setBusy(false); }};const start = () => run(async () => {@@ -106,7 +110,7 @@ export function QuickPairSetup({ returned, onSSH, onClose }: { returned?: PairRe});useEffect(() => {- if (initialized.current) return;+ if (!active || initialized.current) return;// A return link mounts immediately after bootstrap, before the local socket// opens. Wait for it; rejecting here would mislabel a valid link as invalid.if (status !== "open") {@@ -118,7 +122,7 @@ export function QuickPairSetup({ returned, onSSH, onClose }: { returned?: PairReelse void start();// One invitation per mounted dialog, never one per re-render. The returned// receipt is reviewed only; saving/connecting still requires a user click.- }, [status]);+ }, [status, active]);const copyCommand = () => {if (!request) return;void copyTextToClipboard(request.command).then((ok) => {@@ -128,44 +132,46 @@ export function QuickPairSetup({ returned, onSSH, onClose }: { returned?: PairRe});};const invalidReturn = ["pair_invalid", "pair_expired", "pair_used"].some((code) => error === `remote.errors.${code}`);- const restartAvailable = !saved && (expired || (!!error && !request?.command && !preview && (!returned || invalidReturn)));- const reviewingReturn = !!returned && !request?.command && !preview && !manual && !restartAvailable;- const title = preview ? preview.existing_connection ? "remote.sameInstance.title" : "remote.pair.confirmTitle" : reviewingReturn ? "remote.pair.review" : restartAvailable ? "remote.add"+ const requestUnavailable = error === "remote.errors.pair_expired" || error === "remote.errors.pair_used";+ const restartAvailable = !saved && (expired || requestUnavailable || (!!error && !request?.command && !preview && (!returned || invalidReturn)));+ const visiblePreview = restartAvailable ? null : preview;+ const reviewingReturn = !!returned && !request?.command && !visiblePreview && !manual && !restartAvailable;+ const title = visiblePreview ? visiblePreview.existing_connection ? "remote.sameInstance.title" : "remote.pair.confirmTitle" : reviewingReturn ? "remote.pair.review" : restartAvailable ? "remote.add": manual ? "remote.pair.code" : copied ? "remote.pair.copiedTitle" : "remote.add";- const description = preview || reviewingReturn ? "remote.pair.confirmLinkDescription" : restartAvailable ? "remote.pair.introHint"+ const description = visiblePreview || reviewingReturn ? "remote.pair.confirmLinkDescription" : restartAvailable ? "remote.pair.introHint": manual ? "remote.pair.codeHint" : copied ? "remote.pair.afterCopyHint" : "remote.pair.introHint";- const showCopied = copied && !manual && !preview && !restartAvailable;- const showIllustration = !preview && !manual && !reviewingReturn && !restartAvailable;+ const showCopied = copied && !manual && !visiblePreview && !restartAvailable;+ const showIllustration = !visiblePreview && !manual && !reviewingReturn && !restartAvailable;const showBusy = pending && busyVisible;- const actionLabel = restartAvailable ? "remote.pair.restart" : reviewingReturn ? error ? "remote.retry" : "remote.pair.review" : preview ? saved ? "remote.retry" : preview.existing_connection ? "remote.sameInstance.saveAndOpen" : "remote.connect"+ const actionLabel = restartAvailable ? "remote.pair.restart" : reviewingReturn ? error ? "remote.retry" : "remote.pair.review" : visiblePreview ? saved ? "remote.retry" : visiblePreview.existing_connection ? "remote.sameInstance.saveAndOpen" : "remote.connect": manual ? "remote.pair.review" : copied ? "remote.pair.copyAgain" : "remote.pair.copy";- const busyLabel = waitingForLocal ? "remote.pair.waitingForLocal" : preview ? "remote.connecting" : !restartAvailable && (manual || returned)+ const busyLabel = waitingForLocal ? "remote.pair.waitingForLocal" : visiblePreview ? "remote.connecting" : !restartAvailable && (manual || returned)? "remote.pair.checkingLink" : "remote.pair.preparing";- return <div className="flex min-h-0 flex-col">+ return <div className="remote-pair flex min-h-0 flex-col"><div className="-mx-1 min-h-0 overflow-y-auto overscroll-contain px-1"><DialogHeader className={showIllustration ? "space-y-0 text-center sm:text-center" : "pr-5 text-left"}>{showIllustration && <RemoteConnectionIllustration />}<div aria-live="polite" aria-atomic="true" className="space-y-1.5"><DialogTitle className={showIllustration ? "flex min-h-5 items-center justify-center gap-2 text-xl leading-snug tracking-normal" : "flex min-h-5 items-center gap-2"}>{showCopied && <Check aria-hidden="true" className="h-5 w-5 shrink-0 motion-safe:animate-in motion-safe:fade-in duration-150" />}- {t(title)}+ <span className="min-w-0 [overflow-wrap:anywhere]">{t(title)}</span></DialogTitle><DialogDescription>{t(description)}</DialogDescription></div></DialogHeader>- {preview ? <div className="space-y-4 pt-4">+ {visiblePreview ? <div className="space-y-4 pt-4"><div className="rounded-2xl bg-muted/50 p-4">- <p className="font-medium">{preview.existing_connection?.name || preview.hostname}</p>- <p className="mt-1 break-all text-xs text-muted-foreground">{preview.host}</p>+ <p className="font-medium [overflow-wrap:anywhere]">{visiblePreview.existing_connection?.name || visiblePreview.hostname}</p>+ <p className="mt-1 break-all text-xs text-muted-foreground">{visiblePreview.host}</p></div>- {preview.existing_connection && <p role="status" className="text-xs leading-5 text-muted-foreground">{t("remote.sameInstance.pairHint")}</p>}+ {visiblePreview.existing_connection && <p role="status" className="text-xs leading-5 text-muted-foreground">{t("remote.sameInstance.pairHint")}</p>}<p className="text-[13px] leading-5">{t("remote.pair.access")}</p>- <p className="text-xs leading-5 text-muted-foreground">{t("remote.pair.expiry", { date: new Date(preview.authorized_until * 1000).toLocaleDateString() })}</p>+ <p className="text-xs leading-5 text-muted-foreground">{t("remote.pair.expiry", { date: new Date(visiblePreview.authorized_until * 1000).toLocaleDateString() })}</p><Disclosure className="text-xs text-muted-foreground" summaryClassName="flex min-h-9 items-center gap-2 rounded-xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"summary={<><ChevronDown aria-hidden className="h-3.5 w-3.5 shrink-0 transition-transform group-data-[state=open]/disclosure:rotate-180 motion-reduce:transition-none" />{t("remote.pair.security")}</>}>- <p className="my-2 leading-5">{t("remote.pair.fingerprint")}</p><code className="block break-all">{preview.fingerprint}</code>- <p className="mb-2 mt-4 leading-5">{t("remote.pair.revoke")}</p><CodeBlock language="bash" code={preview.revoke_command} highlight={false} className="min-w-0 [&_pre]:[overflow-wrap:anywhere]" />+ <p className="my-2 leading-5">{t("remote.pair.fingerprint")}</p><code className="block break-all">{visiblePreview.fingerprint}</code>+ <p className="mb-2 mt-4 leading-5">{t("remote.pair.revoke")}</p><CodeBlock language="bash" code={visiblePreview.revoke_command} highlight={false} className="min-w-0 [&_pre]:[overflow-wrap:anywhere]" /></Disclosure>{saved && error && <div className="space-y-2"><p className="text-xs leading-5 text-muted-foreground">{t("remote.pair.retryHint")}</p><Disclosure summaryClassName="flex min-h-9 items-center gap-2 rounded-xl text-xs text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring" contentClassName="pt-2"@@ -178,7 +184,7 @@ export function QuickPairSetup({ returned, onSSH, onClose }: { returned?: PairRe<div><DisclosureContent id={panelId} open={panel === "command" && !!request?.command} className="pt-4"><div className="rounded-2xl bg-muted/50 p-3">- <code className="block max-h-32 select-text overflow-y-auto break-all text-[11px] leading-5" aria-label={t("remote.pair.command")}>{request?.command}</code>+ <code className="block max-h-32 select-text overflow-y-auto text-[11px] leading-5 [overflow-wrap:anywhere]" aria-label={t("remote.pair.command")}>{request?.command}</code></div></DisclosureContent><DisclosureContent open={panel === "help"} className="pt-4">@@ -192,21 +198,21 @@ export function QuickPairSetup({ returned, onSSH, onClose }: { returned?: PairRe</div></>}{expired && !saved && <p role="status" className="mt-4 text-xs leading-5 text-muted-foreground">{t("remote.pair.expired")}</p>}- {error && <p role="alert" className="mt-4 flex items-start gap-2 text-[13px] leading-5 text-foreground"><AlertCircle aria-hidden="true" className="mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" />{t(error, { defaultValue: t("remote.errors.unknown") })}</p>}+ {error && <p role="alert" className="remote-alert mt-4 items-start gap-2 text-[13px] leading-5 text-foreground"><AlertCircle aria-hidden="true" className="mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" /><span>{t(error, { defaultValue: t("remote.errors.unknown") })}</span></p>}</div>- <div className={preview ? "flex shrink-0 flex-col-reverse gap-2 pt-5 sm:flex-row sm:items-center sm:justify-between" : "flex shrink-0 flex-col gap-2 pt-5"}>- {preview && (!saved ? <Button variant="ghost" disabled={busy} onClick={() => { setPreview(null); setError(""); if (!request?.command) setManual(true); }}><ArrowLeft className="mr-1 h-4 w-4" />{t("remote.back")}</Button>- : <Button variant="ghost" onClick={() => { connections?.cancel(); onClose(); }}>{t("common.cancel")}</Button>+ <div className={visiblePreview ? "remote-dialog-actions shrink-0 pt-5" : "flex shrink-0 flex-col gap-2 pt-5"}>+ {visiblePreview && (!saved ? <Button className="remote-action" variant="ghost" disabled={busy} onClick={() => { setPreview(null); setError(""); if (!request?.command) setManual(true); }}><ArrowLeft className="mr-1 h-4 w-4" />{t("remote.back")}</Button>+ : <Button className="remote-action" variant="ghost" onClick={() => { connections?.cancel(); onClose(); }}>{t("common.cancel")}</Button>)}- <Button variant={showCopied ? "outline" : "default"} className={showCopied ? "bg-transparent" : undefined} aria-label={t(showBusy ? busyLabel : actionLabel)} aria-busy={pending} disabled={busy || waitingForLocal || (!restartAvailable && (!request || (!preview && (manual || reviewingReturn ? !code.trim() : !request.command))))} onClick={() => { if (restartAvailable) void start(); else if (preview) void connect(); else if (manual || reviewingReturn) void review(); else copyCommand(); }}>- {showBusy ? <Loader2 aria-hidden="true" className="mr-2 h-4 w-4 shrink-0 animate-spin motion-reduce:animate-none" /> : !restartAvailable && !preview && !manual && !reviewingReturn ? <Copy aria-hidden="true" className="mr-2 h-4 w-4 shrink-0" /> : null}- <span role="status" className="min-w-0 truncate">{t(showBusy ? busyLabel : actionLabel)}</span>+ <Button variant={showCopied ? "outline" : "default"} className={showCopied ? "remote-action bg-transparent" : "remote-action"} aria-label={t(showBusy ? busyLabel : actionLabel)} aria-busy={pending} disabled={busy || waitingForLocal || (!restartAvailable && (!request || (!visiblePreview && (manual || reviewingReturn ? !code.trim() : !request.command))))} onClick={() => { if (restartAvailable) void start(); else if (visiblePreview) void connect(); else if (manual || reviewingReturn) void review(); else copyCommand(); }}>+ {showBusy ? <Loader2 aria-hidden="true" className="mr-2 h-4 w-4 shrink-0 animate-spin motion-reduce:animate-none" /> : !restartAvailable && !visiblePreview && !manual && !reviewingReturn ? <Copy aria-hidden="true" className="mr-2 h-4 w-4 shrink-0" /> : null}+ <span role="status" className="min-w-0">{t(showBusy ? busyLabel : actionLabel)}</span></Button>- {!preview && <div className="-mx-3 flex items-center justify-between gap-1">- {request?.command ? manual ? <Button variant="ghost" size="sm" disabled={busy} onClick={() => { setManual(false); setPanel(null); setError(""); }}>{t("remote.back")}</Button>- : <Button variant="ghost" size="sm" className="text-xs text-muted-foreground" disabled={expired} aria-expanded={panel === "command"} aria-controls={panelId} onClick={() => setPanel(panel === "command" ? null : "command")}>{t("remote.pair.showCommand")}</Button> : <span />}+ {!visiblePreview && <div className="remote-pair-alternatives -mx-3 gap-1">+ {!restartAvailable && request?.command ? manual ? <Button className="remote-action" variant="ghost" size="sm" disabled={busy} onClick={() => { setManual(false); setPanel(null); setError(""); }}>{t("remote.back")}</Button>+ : <Button variant="ghost" size="sm" className="remote-action justify-start text-left text-xs text-muted-foreground" disabled={expired} aria-expanded={panel === "command"} aria-controls={panelId} onClick={() => setPanel(panel === "command" ? null : "command")}>{t("remote.pair.showCommand")}</Button> : <span />}<DropdownMenu>- <DropdownMenuTrigger asChild><Button variant="ghost" size="sm" className="text-xs text-muted-foreground">{t("remote.pair.otherWays")}<ChevronDown aria-hidden="true" className="ml-1 h-3.5 w-3.5" /></Button></DropdownMenuTrigger>+ <DropdownMenuTrigger asChild><Button variant="ghost" size="sm" className="remote-action justify-end text-right text-xs text-muted-foreground">{t("remote.pair.otherWays")}<ChevronDown aria-hidden="true" className="ml-1 h-3.5 w-3.5 shrink-0" /></Button></DropdownMenuTrigger><DropdownMenuContent align="end" onCloseAutoFocus={(event) => {if (focusManual.current) { event.preventDefault(); focusManual.current = false; manualInput.current?.focus(); }}}>diff --git a/webui/src/components/remote/RemoteConnectionsPage.tsx b/webui/src/components/remote/RemoteConnectionsPage.tsxindex 46308932f..05126b8d2 100644--- a/webui/src/components/remote/RemoteConnectionsPage.tsx+++ b/webui/src/components/remote/RemoteConnectionsPage.tsx@@ -9,7 +9,7 @@ import { DisclosureContent } from "@/components/ui/disclosure";import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "@/components/ui/dialog";import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";import { useClient } from "@/providers/ClientProvider";-import { groupRemoteProfiles, remoteAction, type RemoteInspection, type RemoteProfile } from "@/lib/remote-instances";+import { groupRemoteProfiles, isCompatibilityError, remoteAction, type RemoteInspection, type RemoteProfile } from "@/lib/remote-instances";import { cn } from "@/lib/utils";import { parseSSHAddress } from "@/lib/ssh-address";import { clearPairReturn, readPairReturn, subscribePairReturn } from "@/lib/remote-pair-return";@@ -18,6 +18,8 @@ import { SSHHostPicker } from "./SSHHostPicker";import { QuickPairSetup } from "./QuickPairSetup";import { PairRouteSettings } from "./PairRouteSettings";import { HostConnectionStatus } from "./HostConnectionStatus";+import { HostCompatibilityDialog } from "./HostCompatibilityDialog";+import "./remote-layout.css";const emptyProfile = (): Omit<RemoteProfile, "id" | "connected"> => ({name: "", host: "", port: null, ssh_config: "", identity_file: "",@@ -37,8 +39,12 @@ export function RemoteConnectionsPage({ mainNavigationExpanded = false, hostChroconst [editorOpen, setEditorOpen] = useState(false);const returnedPair = useSyncExternalStore(subscribePairReturn, readPairReturn);const [quickOpen, setQuickOpen] = useState(!!returnedPair);+ const [quickReturn, setQuickReturn] = useState(returnedPair);const [pairRoute, setPairRoute] = useState("");const [details, setDetails] = useState("");+ const [detailsOpen, setDetailsOpen] = useState(false);+ const [routeOpen, setRouteOpen] = useState(false);+ const [versionId, setVersionId] = useState("");const [renaming, setRenaming] = useState<RemoteProfile | null>(null);const [name, setName] = useState("");const [renameError, setRenameError] = useState("");@@ -73,7 +79,7 @@ export function RemoteConnectionsPage({ mainNavigationExpanded = false, hostChrouseEffect(() => { if (removing) lastRemoval.current = removing; }, [removing]);useEffect(() => { if (disconnecting) lastDisconnect.current = disconnecting; }, [disconnecting]);- useEffect(() => { if (returnedPair) setQuickOpen(true); }, [returnedPair]);+ useEffect(() => { if (returnedPair) { setQuickReturn(returnedPair); setQuickOpen(true); } }, [returnedPair]);useEffect(() => {mounted.current = true;@@ -168,6 +174,15 @@ export function RemoteConnectionsPage({ mainNavigationExpanded = false, hostChroif (wanted(attempt)) { setEditorOpen(false); setFingerprint(null); }} catch (reason) {if (!wanted(attempt)) return;+ if (reason instanceof Error && reason.message === "local_webui_unavailable") {+ showError(reason);+ return;+ }+ if (reason instanceof Error && isCompatibilityError(reason.message)) {+ await refresh?.().catch(() => {});+ if (wanted(attempt)) { setEditorOpen(false); setVersionId(id); showError(reason); }+ return;+ }if (reason instanceof Error && reason.message === "host_key_unknown") {try {const result = await remoteAction<{ fingerprint: string; challenge: string }>(client, "fingerprint", { id });@@ -269,10 +284,10 @@ export function RemoteConnectionsPage({ mainNavigationExpanded = false, hostChroconst detailConnection = detailGroup?.connections.find((profile) => profile.connected || connections.openHostIds.includes(profile.id));const removalIsShared = groups.some((group) => group.connections.length > 1 && group.connections.some((profile) => profile.id === removalProfile?.id));const connectionActions = (profile: RemoteProfile, grouped = false) => <>- {!profile.paired && <DropdownMenuItem disabled={profile.connected || connections.openHostIds.includes(profile.id)} onSelect={() => { setDetails(""); beginEditor(profile); }}>{t("remote.edit")}</DropdownMenuItem>}- {profile.paired && <DropdownMenuItem disabled={profile.connected || connections.openHostIds.includes(profile.id)} onSelect={() => { setDetails(""); setPairRoute(profile.id); }}>{t("remote.pair.route")}</DropdownMenuItem>}- {(profile.connected || connections.openHostIds.includes(profile.id)) && <DropdownMenuItem onSelect={() => { setDetails(""); setError(""); setDisconnecting(profile); }}>{t("remote.disconnect")}</DropdownMenuItem>}- <DropdownMenuItem tone="destructive" onSelect={() => { setDetails(""); setError(""); setRemoving(profile); }}>{t(grouped ? "remote.sameInstance.forgetConnection" : "remote.forget")}</DropdownMenuItem>+ {!profile.paired && <DropdownMenuItem disabled={profile.connected || connections.openHostIds.includes(profile.id)} onSelect={() => { setDetailsOpen(false); beginEditor(profile); }}>{t("remote.edit")}</DropdownMenuItem>}+ {profile.paired && <DropdownMenuItem disabled={profile.connected || connections.openHostIds.includes(profile.id)} onSelect={() => { setDetailsOpen(false); setPairRoute(profile.id); setRouteOpen(true); }}>{t("remote.pair.route")}</DropdownMenuItem>}+ {(profile.connected || connections.openHostIds.includes(profile.id)) && <DropdownMenuItem onSelect={() => { setDetailsOpen(false); setError(""); setDisconnecting(profile); }}>{t("remote.disconnect")}</DropdownMenuItem>}+ <DropdownMenuItem tone="destructive" onSelect={() => { setDetailsOpen(false); setError(""); setRemoving(profile); }}>{t(grouped ? "remote.sameInstance.forgetConnection" : "remote.forget")}</DropdownMenuItem></>;return <div ref={page} tabIndex={-1} role="region" aria-label={t("remote.title")} className="flex min-h-0 flex-1 flex-col overflow-hidden bg-settings-canvas outline-none">@@ -309,6 +324,9 @@ export function RemoteConnectionsPage({ mainNavigationExpanded = false, hostChro<span className="min-w-0 flex-1"><span className="block truncate text-[14px] font-medium">{profile.name}</span><span className="mt-0.5 block truncate text-xs text-muted-foreground">{profile.host}</span>{groups.some((other) => other.id !== groupId && other.profile.name === profile.name && other.profile.host === profile.host) && <span className="mt-0.5 block truncate text-xs text-muted-foreground" title={profile.config_path}>{profile.port ? `:${profile.port} · ` : ""}{profile.config_path}</span>}<span id={`${statusId}-${profile.id}`} className="mt-1 block"><HostConnectionStatus state={connections.hostStates[profile.id] || "closed"} /></span>+ {profile.compatibility && profile.compatibility.status !== "compatible" && <span className="mt-1 block text-xs text-muted-foreground">+ {t(`remote.compatibility.${profile.compatibility.status}`)}+ </span>}{profile.paired && typeof profile.authorized_until === "number" && Number.isFinite(profile.authorized_until)&& profile.authorized_until * 1000 <= Date.now() + 7 * 86_400_000 && <span className="mt-1 block text-xs leading-5 text-muted-foreground">{t(profile.authorized_until * 1000 <= Date.now() ? "remote.pair.expiredDevice" : "remote.pair.expiringDevice", {@@ -324,7 +342,8 @@ export function RemoteConnectionsPage({ mainNavigationExpanded = false, hostChroaria-label={t("remote.manage", { name: profile.name })}><MoreHorizontal className="h-4 w-4" /></Button></DropdownMenuTrigger><DropdownMenuContent align="end"><DropdownMenuItem onSelect={() => { setRenaming(profile); setName(profile.name); setRenameError(""); }}>{t("remote.rename.action")}</DropdownMenuItem>- {entries.length > 1 ? <DropdownMenuItem onSelect={() => setDetails(groupId)}>{t("remote.sameInstance.details")}</DropdownMenuItem> : connectionActions(profile)}+ <DropdownMenuItem onSelect={() => setVersionId(profile.id)}>{t("remote.compatibility.title")}</DropdownMenuItem>+ {entries.length > 1 ? <DropdownMenuItem onSelect={() => { setDetails(groupId); setDetailsOpen(true); }}>{t("remote.sameInstance.details")}</DropdownMenuItem> : connectionActions(profile)}</DropdownMenuContent></DropdownMenu></div>)}@@ -333,14 +352,14 @@ export function RemoteConnectionsPage({ mainNavigationExpanded = false, hostChro<p role="status" className="min-w-0 truncate text-xs text-muted-foreground">{t("remote.preparing", { name: openingProfile.name })}</p><Button variant="ghost" size="sm" className="shrink-0" onClick={closeEditor}>{t("remote.cancelSwitch")}</Button></div>}- <div className="settings-list-inset"><Button variant="ghost" className="gap-2" disabled={!!busy} onClick={(event) => {- editorTrigger.current = event.currentTarget; setQuickOpen(true);+ <div className="settings-list-inset"><Button variant="ghost" className="remote-action gap-2" disabled={!!busy} onClick={(event) => {+ editorTrigger.current = event.currentTarget; setQuickReturn(null); setQuickOpen(true);}}><Plus className="h-4 w-4" />{t("remote.add")}</Button></div></>}{!directory && !directoryError && <div role="status" className="settings-list-inset flex items-center gap-2 text-sm text-muted-foreground"><Loader2 className="h-4 w-4 animate-spin" />{t("remote.loading")}</div>}{directory && !directory.available && <p className="settings-list-inset text-sm text-muted-foreground">{t("remote.unavailable")}</p>}{pageError && !editorOpen && !fingerprint && !removing && !disconnecting && <div className="settings-list-inset space-y-2">- <p role="alert" className="flex items-start gap-2 text-[13px] leading-5 text-foreground"><AlertCircle aria-hidden="true" className="mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" />{pageError}</p>+ <p role="alert" className="remote-alert items-start gap-2 text-[13px] leading-5 text-foreground"><AlertCircle aria-hidden="true" className="mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" />{pageError}</p>{directoryError && <Button variant="ghost" size="sm" disabled={!!busy} onClick={() => {setBusy("refresh"); setError(""); void refresh?.().catch((reason: unknown) => { if (mounted.current) showError(reason); }).finally(() => { if (mounted.current) setBusy(""); });}}>{t("remote.retry")}</Button>}@@ -349,8 +368,10 @@ export function RemoteConnectionsPage({ mainNavigationExpanded = false, hostChro</div></div>+ <HostCompatibilityDialog profile={directory?.profiles.find((profile) => profile.id === versionId)}+ clientVersion={directory?.client_version} onClose={() => setVersionId("")} /><Dialog open={!!renaming} onOpenChange={(open) => { if (!open && !busy) setRenaming(null); }}>- <DialogContent className="max-h-[85dvh] max-w-sm overflow-y-auto" onOpenAutoFocus={(event) => {+ <DialogContent className="remote-dialog max-h-[85dvh] max-w-sm overflow-y-auto" onOpenAutoFocus={(event) => {event.preventDefault(); nameInput.current?.focus(); nameInput.current?.select();}} onCloseAutoFocus={(event) => { event.preventDefault(); editorTrigger.current?.focus({ preventScroll: true }); }}><DialogHeader className="pr-5 text-left">@@ -358,14 +379,12 @@ export function RemoteConnectionsPage({ mainNavigationExpanded = false, hostChro<DialogDescription>{t("remote.rename.hint")}</DialogDescription></DialogHeader><form className="space-y-4" onSubmit={(event) => { event.preventDefault(); void rename(); }}>- <div className="space-y-2">- <label htmlFor={nameId} className="text-[13px] font-medium">{t("remote.rename.name")}</label>- <Input ref={nameInput} id={nameId} value={name} maxLength={64} required disabled={!!busy}- aria-invalid={!!renameError} aria-describedby={renameError ? `${nameId}-error` : undefined}- onChange={(event) => { setName(event.target.value); setRenameError(""); }} />- </div>+ <Input ref={nameInput} id={nameId} value={name} maxLength={64} required disabled={!!busy}+ aria-label={t("remote.rename.name")}+ aria-invalid={!!renameError} aria-describedby={renameError ? `${nameId}-error` : undefined}+ onChange={(event) => { setName(event.target.value); setRenameError(""); }} />{renameError && <p id={`${nameId}-error`} role="alert" className="text-[13px] leading-5 text-foreground">{renameError}</p>}- <div className="flex justify-end gap-2">+ <div className="remote-dialog-actions"><Button type="button" variant="ghost" disabled={!!busy} onClick={() => setRenaming(null)}>{t("common.cancel")}</Button><Button type="submit" disabled={!!busy || !name.trim() || name.trim() === renaming?.name} aria-busy={!!busy}>{busy && <Loader2 aria-hidden className="mr-2 h-4 w-4 animate-spin motion-reduce:animate-none" />}{t(busy ? "remote.saving" : "remote.save")}@@ -374,14 +393,14 @@ export function RemoteConnectionsPage({ mainNavigationExpanded = false, hostChro</form></DialogContent></Dialog>- <Dialog open={!!detailGroup} onOpenChange={(open) => { if (!open) setDetails(""); }}>- <DialogContent className="flex max-h-[85dvh] max-w-md flex-col overflow-hidden">+ <Dialog open={detailsOpen && !!detailGroup} onOpenChange={(open) => { if (!open) setDetailsOpen(false); }}>+ <DialogContent className="remote-dialog flex max-h-[85dvh] max-w-md flex-col overflow-hidden"><DialogHeader className="pr-5 text-left"><DialogTitle>{t("remote.sameInstance.details")}</DialogTitle><DialogDescription>{t("remote.sameInstance.detailsHint")}</DialogDescription></DialogHeader><div className="min-h-0 space-y-2 overflow-y-auto">{detailGroup?.connections.map((profile, index) => <div key={profile.id} className="flex items-center gap-2 rounded-2xl bg-muted/40 p-3"><button type="button" disabled={!!busy || (!!detailConnection && detailConnection.id !== profile.id)} aria-current={connections.activeHostId === profile.id || undefined}className="min-w-0 flex-1 rounded-xl text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"- onClick={() => { setDetails(""); void connect(profile.id); }}>+ onClick={() => { setDetailsOpen(false); void connect(profile.id); }}><span className="flex items-center gap-2 text-[13px] font-medium">{t("remote.sameInstance.connection", { count: index + 1 })}{connections.activeHostId === profile.id && <Check aria-label={t("remote.current")} className="h-3.5 w-3.5" />}</span><span className="mt-1 block truncate text-xs text-muted-foreground">{profile.host}</span><HostConnectionStatus state={connections.hostStates[profile.id] || "closed"} />@@ -397,17 +416,17 @@ export function RemoteConnectionsPage({ mainNavigationExpanded = false, hostChro</Dialog><Dialog open={quickOpen} onOpenChange={(open) => { setQuickOpen(open); if (!open) clearPairReturn(); }}>- <DialogContent className="flex max-h-[85dvh] max-w-md flex-col overflow-hidden">- {quickOpen && <QuickPairSetup key={returnedPair?.code || "new"} returned={returnedPair} onSSH={() => { clearPairReturn(); setQuickOpen(false); beginEditor(); }} onClose={() => { clearPairReturn(); setQuickOpen(false); }} />}+ <DialogContent className="remote-dialog flex max-h-[85dvh] max-w-md flex-col overflow-hidden">+ <QuickPairSetup key={quickReturn?.code || "new"} returned={quickReturn} active={quickOpen} onSSH={() => { clearPairReturn(); setQuickOpen(false); beginEditor(); }} onClose={() => { clearPairReturn(); setQuickOpen(false); }} /></DialogContent></Dialog>- <Dialog open={!!pairRoute} onOpenChange={(open) => { if (!open) setPairRoute(""); }}>- <DialogContent className="max-w-md"><DialogHeader><DialogTitle>{t("remote.pair.route")}</DialogTitle><DialogDescription>{t("remote.pair.routeDescription")}</DialogDescription></DialogHeader>- {pairRoute && <PairRouteSettings id={pairRoute} onSaved={() => setPairRoute("")} />}+ <Dialog open={routeOpen} onOpenChange={setRouteOpen}>+ <DialogContent className="remote-dialog max-w-md overflow-y-auto"><DialogHeader className="pr-5 text-left"><DialogTitle>{t("remote.pair.route")}</DialogTitle><DialogDescription>{t("remote.pair.routeHint")}</DialogDescription></DialogHeader>+ {pairRoute && <PairRouteSettings key={pairRoute} id={pairRoute} showHint={false} onSaved={() => setRouteOpen(false)} />}</DialogContent></Dialog><Dialog open={editorOpen || !!fingerprint} onOpenChange={(open) => { if (!open) closeEditor(); }}>- <DialogContent className="flex max-h-[85dvh] max-w-md flex-col overflow-hidden" onOpenAutoFocus={(event) => {+ <DialogContent className="remote-dialog flex max-h-[85dvh] max-w-md flex-col overflow-hidden" onOpenAutoFocus={(event) => {if (!fingerprint) { event.preventDefault(); hostInput.current?.focus(); }}} onCloseAutoFocus={(event) => {event.preventDefault();@@ -423,15 +442,15 @@ export function RemoteConnectionsPage({ mainNavigationExpanded = false, hostChro<code className="block select-text break-all text-xs text-muted-foreground">{fingerprint.fingerprint}</code></div><p className="text-xs leading-5 text-muted-foreground">{t("remote.verifyHint")}</p>- {error && <p role="alert" className="flex items-start gap-2 text-[13px] leading-5 text-foreground"><AlertCircle aria-hidden="true" className="mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" />{error}</p>}- <div className="grid grid-cols-2 gap-2 sm:flex sm:flex-wrap sm:items-center sm:justify-end">- {editorOpen && <Button variant="ghost" disabled={!!busy} className="mr-auto gap-1" onClick={() => { setFingerprint(null); setError(""); setErrorCode(""); setInspection(null); setInspectBeforeConnect(true); }}><ChevronLeft className="h-4 w-4" />{t("remote.back")}</Button>}+ {error && <p role="alert" className="remote-alert items-start gap-2 text-[13px] leading-5 text-foreground"><AlertCircle aria-hidden="true" className="mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" /><span>{error}</span></p>}+ <div className="remote-dialog-actions">+ {editorOpen && <Button variant="ghost" disabled={!!busy} className="gap-1" onClick={() => { setFingerprint(null); setError(""); setErrorCode(""); setInspection(null); setInspectBeforeConnect(true); }}><ChevronLeft className="h-4 w-4" />{t("remote.back")}</Button>}<Button variant="ghost" onClick={closeEditor}>{t("common.cancel")}</Button><Button className="col-span-2 h-auto min-h-10 whitespace-normal" disabled={!!busy} aria-busy={!!busy} onClick={() => { void trustHost(); }}>{busy && <Loader2 aria-hidden className="mr-2 h-4 w-4 shrink-0 animate-spin motion-reduce:animate-none" />}{t("remote.verifyConnect")}</Button></div></> : <form onSubmit={(event) => { event.preventDefault(); if (!busy && form.host.trim() && (!locationStep || form.config_path.trim())) void save(); }} className="flex min-h-0 flex-col gap-4"><div className="-mx-1 min-h-0 space-y-4 overflow-y-auto overscroll-contain px-1">- {!editing && <ol aria-label={t("remote.setup.progress")} className="flex items-center gap-3 text-xs text-muted-foreground">+ {!editing && <ol aria-label={t("remote.setup.progress")} className="flex flex-wrap items-center gap-3 text-xs text-muted-foreground"><li aria-current={!locationStep ? "step" : undefined} className={cn("flex items-center gap-1.5", !locationStep && "text-foreground")}>{locationStep ? <Check className="h-3.5 w-3.5" /> : <span>1</span>}{t("remote.setup.server")}</li><li aria-hidden="true" className="h-px w-5 bg-border" />@@ -440,7 +459,7 @@ export function RemoteConnectionsPage({ mainNavigationExpanded = false, hostChro{locationStep && !editing ? <div className="space-y-4"><div className="flex items-center justify-between gap-3 rounded-2xl bg-muted/40 px-3 py-2.5"><span className="min-w-0 text-[13px]"><span className="block font-medium">{t("remote.setup.signedIn")}</span><span className="block truncate text-xs text-muted-foreground">{form.host}</span></span>- <Button type="button" size="sm" variant="ghost" disabled={!!busy} onClick={editSSH}>{t("remote.setup.changeServer")}</Button>+ <Button type="button" size="sm" variant="ghost" className="remote-action" disabled={!!busy} onClick={editSSH}>{t("remote.setup.changeServer")}</Button></div>{!!inspection?.candidates.length && <fieldset className="space-y-2"><legend className="mb-2 text-[13px] font-medium">{t("remote.setup.chooseNanobot")}</legend>@@ -448,7 +467,7 @@ export function RemoteConnectionsPage({ mainNavigationExpanded = false, hostChro<input type="radio" name="nanobot-location" className="mt-1 accent-foreground" disabled={!!busy}checked={!manualLocation && form.config_path === candidate.config_path && form.runtime_user === candidate.runtime_user}onChange={() => { setManualLocation(false); setForm({ ...form, config_path: candidate.config_path, runtime_user: candidate.runtime_user }); setError(""); setErrorCode(""); }} />- <span className="min-w-0 text-[13px]"><span className="block font-medium">{candidate.service || t("remote.setup.yourNanobot")}</span>+ <span className="min-w-0 text-[13px]"><span className="block font-medium [overflow-wrap:anywhere]">{candidate.service || t("remote.setup.yourNanobot")}</span><span className="block break-all text-xs leading-5 text-muted-foreground">{candidate.config_path}</span>{candidate.runtime_user && <span className="mt-1 block text-xs leading-5 text-muted-foreground">{t("remote.setup.serviceAccount", { user: candidate.runtime_user })}</span>}</span>@@ -459,7 +478,7 @@ export function RemoteConnectionsPage({ mainNavigationExpanded = false, hostChro<p className="text-xs leading-5 text-muted-foreground">{t("remote.setup.notFoundHint")}</p></div>}{inspection?.incomplete && <p className="text-xs leading-5 text-muted-foreground">{t("remote.setup.limitedSearch")}</p>}- {!manualLocation && <Button type="button" variant="ghost" size="sm" disabled={!!busy} onClick={() => setManualLocation(true)}>{t("remote.setup.manualLocation")}</Button>}+ {!manualLocation && <Button type="button" variant="ghost" size="sm" className="remote-action" disabled={!!busy} onClick={() => setManualLocation(true)}>{t("remote.setup.manualLocation")}</Button>}</div> : <><SSHHostPicker inputRef={hostInput} disabled={!!busy} value={form.host} configFile={form.ssh_config} imported={commandImported}suggestions={!editingProfile || form.host !== editingProfile.host || form.ssh_config !== editingProfile.ssh_config}@@ -488,15 +507,15 @@ export function RemoteConnectionsPage({ mainNavigationExpanded = false, hostChro</div><div className="shrink-0 space-y-3 pt-1">{error && <div className="space-y-1">- <p role="alert" className="flex items-start gap-2 text-[13px] leading-5 text-foreground"><AlertCircle aria-hidden="true" className="mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" />{error}</p>+ <p role="alert" className="remote-alert items-start gap-2 text-[13px] leading-5 text-foreground"><AlertCircle aria-hidden="true" className="mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" /><span>{error}</span></p>{!sshOptions && /^(ssh_|local_file_not_found)/.test(errorCode) && <Button type="button" variant="ghost" size="sm" disabled={!!busy} onClick={editSSH}>{t("remote.setup.sshSettings")}</Button>}</div>}{busy.startsWith("pick-") && <p role="status" className="text-xs text-muted-foreground">{t("remote.setup.pickingFile")}</p>}- <div className="grid grid-cols-[auto_minmax(0,1fr)] items-center gap-2">+ <div className="remote-dialog-actions"><Button type="button" variant="ghost" onClick={closeEditor}>{t("common.cancel")}</Button><Button type="submit" className="min-w-0" title={t(editorLabel)} aria-label={t(editorLabel)} aria-busy={!!busy} disabled={!!busy || !form.host.trim() || (locationStep && !form.config_path.trim())}>{busy && !busy.startsWith("pick-") && <Loader2 aria-hidden className="mr-2 h-4 w-4 shrink-0 animate-spin motion-reduce:animate-none" />}- <span role={busy && !busy.startsWith("pick-") ? "status" : undefined} className="truncate">{t(editorLabel)}</span>+ <span role={busy && !busy.startsWith("pick-") ? "status" : undefined} className="min-w-0">{t(editorLabel)}</span></Button></div></div>@@ -504,17 +523,17 @@ export function RemoteConnectionsPage({ mainNavigationExpanded = false, hostChro</DialogContent></Dialog><Dialog open={!!disconnecting} onOpenChange={(value) => { if (!value && !busy) setDisconnecting(null); }}>- <DialogContent className="max-h-[85dvh] max-w-sm overflow-y-auto"><DialogHeader className="pr-5 text-left"><DialogTitle className="break-words leading-snug">{t("remote.disconnectTitle", { name: disconnectProfile?.name })}</DialogTitle><DialogDescription>{t("remote.disconnectDescription")}</DialogDescription></DialogHeader>- {error && <p role="alert" className="flex items-start gap-2 text-[13px] leading-5 text-foreground"><AlertCircle aria-hidden="true" className="mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" />{error}</p>}- <div className="grid grid-cols-2 gap-2"><Button variant="ghost" disabled={!!busy} onClick={() => setDisconnecting(null)}>{t("common.cancel")}</Button><Button variant="outline" className="min-w-0" disabled={!!busy} aria-busy={!!busy} onClick={() => { if (disconnecting) void disconnect(disconnecting.id); }}>{busy && <Loader2 aria-hidden className="mr-2 h-4 w-4 shrink-0 animate-spin motion-reduce:animate-none" />}<span className="truncate">{t("remote.disconnect")}</span></Button></div>+ <DialogContent className="remote-dialog max-h-[85dvh] max-w-sm overflow-y-auto"><DialogHeader className="pr-5 text-left"><DialogTitle className="leading-snug [overflow-wrap:anywhere]">{t("remote.disconnectTitle", { name: disconnectProfile?.name })}</DialogTitle><DialogDescription>{t("remote.disconnectDescription")}</DialogDescription></DialogHeader>+ {error && <p role="alert" className="remote-alert items-start gap-2 text-[13px] leading-5 text-foreground"><AlertCircle aria-hidden="true" className="mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" /><span>{error}</span></p>}+ <div className="remote-dialog-actions"><Button variant="ghost" disabled={!!busy} onClick={() => setDisconnecting(null)}>{t("common.cancel")}</Button><Button variant="outline" className="min-w-0" disabled={!!busy} aria-busy={!!busy} onClick={() => { if (disconnecting) void disconnect(disconnecting.id); }}>{busy && <Loader2 aria-hidden className="mr-2 h-4 w-4 shrink-0 animate-spin motion-reduce:animate-none" />}<span>{t("remote.disconnect")}</span></Button></div></DialogContent></Dialog><Dialog open={!!removing} onOpenChange={(value) => { if (!value && !busy) setRemoving(null); }}>- <DialogContent className="max-h-[85dvh] max-w-sm overflow-y-auto"><DialogHeader className="pr-5 text-left"><DialogTitle className="break-words leading-snug">{t(removalIsShared ? "remote.sameInstance.forgetTitle" : "remote.forgetTitle", { name: removalProfile?.name })}</DialogTitle><DialogDescription>{t(removalIsShared ? "remote.sameInstance.forgetHint" : "remote.forgetDescription")}</DialogDescription></DialogHeader>+ <DialogContent className="remote-dialog max-h-[85dvh] max-w-sm overflow-y-auto"><DialogHeader className="pr-5 text-left"><DialogTitle className="leading-snug [overflow-wrap:anywhere]">{t(removalIsShared ? "remote.sameInstance.forgetTitle" : "remote.forgetTitle", { name: removalProfile?.name })}</DialogTitle><DialogDescription>{t(removalIsShared ? "remote.sameInstance.forgetHint" : "remote.forgetDescription")}</DialogDescription></DialogHeader>{removalProfile && (removalProfile.connected || connections.openHostIds.includes(removalProfile.id)) && <p role="note" className="rounded-xl bg-muted/40 p-3 text-xs leading-5">{t("remote.activeForgetWarning")}</p>}- {removalProfile?.paired && <div className="space-y-2 text-xs text-muted-foreground"><p>{t("remote.pair.forgetHint")}</p>{removalProfile.revoke_command && <CodeBlock language="bash" code={removalProfile.revoke_command} highlight={false} className="min-w-0 [&_pre]:[overflow-wrap:anywhere]" />}</div>}- {error && <p role="alert" className="flex items-start gap-2 text-[13px] leading-5 text-foreground"><AlertCircle aria-hidden="true" className="mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" />{error}</p>}- <div className="grid grid-cols-2 gap-2"><Button variant="ghost" disabled={!!busy} onClick={() => setRemoving(null)}>{t("common.cancel")}</Button><Button variant="destructive" className="h-auto min-h-10 min-w-0" disabled={!!busy} aria-busy={!!busy} onClick={() => { void remove(); }}>{busy && <Loader2 aria-hidden className="mr-2 h-4 w-4 shrink-0 animate-spin motion-reduce:animate-none" />}<span className="whitespace-normal break-words">{t(removalIsShared ? "remote.sameInstance.forgetAction" : "remote.forget")}</span></Button></div>+ {removalProfile?.paired && <div className="space-y-2 text-xs leading-5 text-muted-foreground"><p>{t("remote.pair.forgetHint")}</p>{removalProfile.revoke_command && <CodeBlock language="bash" code={removalProfile.revoke_command} highlight={false} className="min-w-0 [&_pre]:[overflow-wrap:anywhere]" />}</div>}+ {error && <p role="alert" className="remote-alert items-start gap-2 text-[13px] leading-5 text-foreground"><AlertCircle aria-hidden="true" className="mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" /><span>{error}</span></p>}+ <div className="remote-dialog-actions"><Button variant="ghost" disabled={!!busy} onClick={() => setRemoving(null)}>{t("common.cancel")}</Button><Button variant="destructive" className="h-auto min-h-10 min-w-0" disabled={!!busy} aria-busy={!!busy} onClick={() => { void remove(); }}>{busy && <Loader2 aria-hidden className="mr-2 h-4 w-4 shrink-0 animate-spin motion-reduce:animate-none" />}<span className="whitespace-normal break-words">{t(removalIsShared ? "remote.sameInstance.forgetAction" : "remote.forget")}</span></Button></div></DialogContent></Dialog></div>;diff --git a/webui/src/components/remote/RemoteInstances.tsx b/webui/src/components/remote/RemoteInstances.tsxindex a161073ae..4e4525b90 100644--- a/webui/src/components/remote/RemoteInstances.tsx+++ b/webui/src/components/remote/RemoteInstances.tsx@@ -2,7 +2,11 @@ import { createContext, useContext, useEffect, useLayoutEffect, useRef, useStateimport { Loader2, PlugZap } from "lucide-react";import { useTranslation } from "react-i18next";import { Button } from "@/components/ui/button";-import { groupRemoteProfiles, needsRemoteSetup, type RemoteDirectory } from "@/lib/remote-instances";+import { groupRemoteProfiles, isCompatibilityError, needsRemoteSetup, type RemoteDirectory } from "@/lib/remote-instances";+import { HostCompatibilityDialog } from "./HostCompatibilityDialog";+import { RemoteConnectionsPage } from "./RemoteConnectionsPage";+import type { HostAnchor } from "./host-bridge";+import { ThemeProvider } from "@/hooks/useTheme";import { useHostSessions } from "./useHostSessions";import { HostNavigationContext, HostSwitcher, RemoteHostMenu, type HostPicker } from "./HostSwitcher";import { useSidebarHostBridge } from "./useSidebarHostBridge";@@ -15,6 +19,8 @@ const RemoteContext = createContext<{activeHostId: string | null;hostStates: Record<string, HostConnectionState>;managing: boolean;+ embeddedManagement?: boolean;+ reportManagementSurface?: (rect: HostAnchor, theme: "light" | "dark") => void;closeManagement: () => void;selectLocal: () => void;openHostIds: string[];@@ -33,6 +39,7 @@ export function RemoteInstances({ children }: { children: ReactNode }) {const { t } = useTranslation();const hosts = useHostSessions();const [managing, setManaging] = useState(false);+ const [versionOpen, setVersionOpen] = useState(false);const managementOpen = useRef(false);const managementConnect = useRef(false);const legacyFooter = useRef<HTMLDivElement>(null);@@ -49,7 +56,16 @@ export function RemoteInstances({ children }: { children: ReactNode }) {if (lastLocalFocus.current?.isConnected) lastLocalFocus.current.focus({ preventScroll: true });};const message = error ? t(`remote.errors.${error}`, { defaultValue: t("remote.errors.unknown") }) : "";- const bridge = useSidebarHostBridge(frames, selected?.id, frameNodes, restoreLocalFocus, { pendingName: pending?.name, error: message });+ const bridge = useSidebarHostBridge(frames, selected?.id, frameNodes, restoreLocalFocus, { pendingName: pending?.name, error: message }, managing, () => changeManagement(false));+ useEffect(() => {+ if (!managing || !selected || !bridge.surface?.theme) return;+ // Management is drawn by the local shell, beside this host's sidebar.+ // Match its appearance temporarily without changing either saved preference.+ const root = document.documentElement;+ const wasDark = root.classList.contains("dark");+ root.classList.toggle("dark", bridge.surface.theme === "dark");+ return () => { root.classList.toggle("dark", wasDark); };+ }, [managing, selected?.id, bridge.surface?.theme]);useEffect(() => {// A verified remote app can be interactive before optional images/fonts// finish loading. Older bundles still use the iframe load fallback.@@ -68,6 +84,10 @@ export function RemoteInstances({ children }: { children: ReactNode }) {const activeFrame = frames.find((frame) => frame.connection.id === selected?.id);const offline = !!selected && (activeFrame?.offline || (!activeFrame && pending?.id !== selected.id));const recoveryCode = (hosts.errorId === selected?.id ? error : "") || activeFrame?.error || "";+ const compatibilityFailure = isCompatibilityError(recoveryCode);+ const recoveryTitle = compatibilityFailure+ ? `remote.compatibility.${recoveryCode === "host_update_required" ? "update_host" : recoveryCode === "client_update_required" ? "update_client" : "unknown"}`+ : "remote.offline";const recoveryMessage = recoveryCode ? t(`remote.errors.${recoveryCode}`, { defaultValue: t("remote.errors.unknown") }) : t("remote.noFallback");const changeManagement = (open: boolean) => {managementOpen.current = open;@@ -104,7 +124,7 @@ export function RemoteInstances({ children }: { children: ReactNode }) {localName: directory?.machine_name || "nanobot", currentId: selected?.id || null, recentIds: hosts.recentIds,profiles: groupRemoteProfiles(directory?.profiles || [], selected?.id || null).map(({ profile: { id, name, host } }) => ({ id, name, host, state: hostStates[id] })),- pending, error: message, offline: !!offline,+ pending, error: message, offline: !!offline, offlineLabel: compatibilityFailure ? t(recoveryTitle) : undefined,select: (id) => {if (!id) selectLocal();else if (managing) void connect(id).catch(() => {});@@ -137,19 +157,21 @@ export function RemoteInstances({ children }: { children: ReactNode }) {}, [selected]);return <RemoteContext.Provider value={{ available, localActive: !selected, directory,- activeHostId: selected?.id || null, hostStates, managing, closeManagement: () => changeManagement(false), selectLocal,+ activeHostId: selected?.id || null, hostStates, managing: bridge.embedded ? bridge.hostedManagement : managing,+ embeddedManagement: !!bridge.embedded, reportManagementSurface: bridge.embedded ? bridge.reportSurface : undefined,+ closeManagement: bridge.embedded ? bridge.leaveManagement : () => changeManagement(false), selectLocal,openHostIds: frames.map((frame) => frame.connection.id),directoryError: hosts.directoryError, refresh: hosts.refresh, rename: hosts.rename, connect, disconnect: hosts.disconnect, cancel: hosts.cancel }}><HostNavigationContext.Provider value={bridge.embedded || (available || selected ? picker : null)}><div className="flex h-full min-h-0 flex-col bg-background"><div className="relative min-h-0 flex-1 overflow-hidden">- <div ref={localPanel} data-host-view="local" aria-hidden={!!selected && !managing} {...(selected && !managing ? { inert: "" } : {})}- style={{ visibility: selected && !managing ? "hidden" : "visible" }}- className={`absolute inset-0 transition-opacity duration-150 motion-reduce:transition-none ${selected && !managing ? "invisible pointer-events-none opacity-0" : "visible opacity-100"}`}>+ <div ref={localPanel} data-host-view="local" aria-hidden={!!selected} {...(selected ? { inert: "" } : {})}+ style={{ visibility: selected ? "hidden" : "visible" }}+ className={`absolute inset-0 transition-opacity duration-150 motion-reduce:transition-none ${selected ? "invisible pointer-events-none opacity-0" : "visible opacity-100"}`}>{children}</div>{frames.map((frame) => {- const active = !managing && selected?.id === frame.connection.id;+ const active = (!managing || !!bridge.surface) && selected?.id === frame.connection.id;return <div key={`${frame.connection.id}:${frame.connection.gateway_id}:${frame.connection.view_id || ""}`} data-host-view={frame.connection.id} aria-hidden={!active || offline}{...(!active || offline ? { inert: "" } : {})} style={{ visibility: active ? "visible" : "hidden" }}className={`absolute inset-0 transition-opacity duration-150 motion-reduce:transition-none ${active ? "visible opacity-100" : "invisible pointer-events-none opacity-0"}`}>@@ -160,18 +182,26 @@ export function RemoteInstances({ children }: { children: ReactNode }) {onLoad={() => { bridge.initialize(frame.connection.id); hosts.loaded(frame.connection.id); }} /></div>;})}- {!managing && selected && (offline || !activeFrame?.loaded) && <div className="absolute inset-0 flex flex-col items-center justify-center gap-3 bg-background px-6 text-center">+ {managing && selected && <main data-testid="remote-management-surface"+ className="absolute bottom-0 right-0 flex min-h-0 flex-col bg-background"+ style={{ left: offline ? 0 : Math.min(bridge.surface?.left || 0, Math.max(0, window.innerWidth - 280)), top: offline ? 0 : Math.min(bridge.surface?.top || 0, Math.max(0, window.innerHeight - 280)) }}>+ <ThemeProvider theme={bridge.surface?.theme || "light"}>+ <RemoteConnectionsPage onBackToChat={() => changeManagement(false)} mainNavigationExpanded={!!bridge.surface?.left} />+ </ThemeProvider>+ </main>}+ {!managing && selected && (offline || !activeFrame?.loaded) && <div className="absolute inset-0 overflow-y-auto bg-background p-6 text-center"><div className="flex min-h-full flex-col items-center justify-center gap-3">{offline ? <PlugZap className="h-7 w-7 text-muted-foreground" /> : <Loader2 className="h-6 w-6 animate-spin text-muted-foreground" />}- <p className="max-w-full break-words text-xs text-muted-foreground">{selected.name} · {selected.hostname}</p>- <p className="font-medium">{t(offline ? "remote.offline" : "remote.opening")}</p>- <p className="max-w-sm text-sm text-muted-foreground">{recoveryMessage}</p>- <div className="flex flex-wrap items-center justify-center gap-2">- {offline && (needsRemoteSetup(recoveryCode) ? <Button onClick={manage}>{t("remote.manageConnections")}</Button> : <Button disabled={!!pending} aria-busy={!!pending} onClick={() => switchHost(selected.id)}>+ <p className="max-w-full text-pretty text-xs text-muted-foreground [overflow-wrap:anywhere]">{selected.name} · {selected.hostname}</p>+ <p className="font-medium">{t(offline ? recoveryTitle : "remote.opening")}</p>+ <p className="max-w-sm text-pretty text-sm text-muted-foreground">{recoveryMessage}</p>+ <div className="flex max-w-full flex-wrap items-stretch justify-center gap-2 [&>button]:h-auto [&>button]:min-h-10 [&>button]:min-w-0 [&>button]:max-w-full [&>button]:whitespace-normal">+ {offline && compatibilityFailure && <Button onClick={() => setVersionOpen(true)}>{t("remote.compatibility.title")}</Button>}+ {offline && (needsRemoteSetup(recoveryCode) && !compatibilityFailure ? <Button onClick={manage}>{t("remote.manageConnections")}</Button> : <Button variant={compatibilityFailure ? "ghost" : "default"} disabled={!!pending} aria-busy={!!pending} onClick={() => switchHost(selected.id)}>{pending && <Loader2 aria-hidden className="mr-2 h-4 w-4 animate-spin motion-reduce:animate-none" />}{t(pending ? "remote.connecting" : "remote.reconnect")}</Button>)}<Button variant="ghost" onClick={hosts.local}>{t("remote.returnLocal")}</Button></div>- </div>}+ </div></div>}</div>{/* Older remote bundles cannot host the control. Keep an explicit exitin a compact bottom strip, never cover their sidebar controls. */}@@ -179,6 +209,8 @@ export function RemoteInstances({ children }: { children: ReactNode }) {<div className="flex w-52 min-w-0"><HostSwitcher /></div></div>}<RemoteHostMenu picker={picker} anchor={bridge.anchor} onClose={bridge.close} />+ <HostCompatibilityDialog profile={versionOpen ? directory?.profiles.find((profile) => profile.id === selected?.id) : undefined}+ clientVersion={directory?.client_version} onClose={() => setVersionOpen(false)} /></div></HostNavigationContext.Provider></RemoteContext.Provider>;diff --git a/webui/src/components/remote/SSHHostPicker.tsx b/webui/src/components/remote/SSHHostPicker.tsxindex 58e55fcac..02f0050c5 100644--- a/webui/src/components/remote/SSHHostPicker.tsx+++ b/webui/src/components/remote/SSHHostPicker.tsx@@ -82,9 +82,9 @@ export function SSHHostPicker({ disabled, value, configFile, imported, suggestio}} /><p id={`${id}-hint`} role={imported ? "status" : undefined} className="text-xs leading-5 text-muted-foreground">{t(imported ? "remote.commandImported" : suggestions ? "remote.commandHint" : "remote.addressHint")}</p>{suggestions && (!!hosts.length || !!error) && <div className="rounded-2xl bg-muted/40 p-1.5">- <div className="flex h-8 items-center justify-between gap-2 px-2">+ <div className="flex min-h-8 items-center justify-between gap-2 px-2"><span className="text-xs text-muted-foreground">{t("remote.sshHosts")}</span>- <Button type="button" variant="ghost" size="icon" className="h-7 w-7" aria-label={t("remote.refreshHosts")}+ <Button type="button" variant="ghost" size="icon" className="h-7 w-7 shrink-0" aria-label={t("remote.refreshHosts")}disabled={busy || disabled} onClick={() => { void load(file); }}><RefreshCw className={`h-3.5 w-3.5 ${busy ? "animate-spin" : ""}`} /></Button>@@ -102,8 +102,8 @@ export function SSHHostPicker({ disabled, value, configFile, imported, suggestio}}}onClick={() => { onChange(host.host); inputRef.current?.focus(); }}>- <Server className="h-4 w-4 shrink-0 text-muted-foreground" /><span className="flex-1 truncate">{host.host}</span>- {value === host.host && <Check className="h-3.5 w-3.5 text-muted-foreground" />}+ <Server className="h-4 w-4 shrink-0 text-muted-foreground" /><span className="min-w-0 flex-1 truncate">{host.host}</span>+ {value === host.host && <Check className="h-3.5 w-3.5 shrink-0 text-muted-foreground" />}</button>)}</div>{error && <p role="alert" className="px-2 py-1 text-xs leading-5 text-muted-foreground">{error}</p>}diff --git a/webui/src/components/remote/remote-layout.css b/webui/src/components/remote/remote-layout.cssnew file mode 100644index 000000000..c4d038503--- /dev/null+++ b/webui/src/components/remote/remote-layout.css@@ -0,0 +1,70 @@+/* Remote dialogs share typography and action sizing without changing app-wide controls. */+.remote-dialog {+ min-inline-size: 0;+ max-block-size: min(85dvh, calc(100dvh - 2rem));+ overscroll-behavior: contain;+ overflow-wrap: anywhere;+ outline: none;+}++.remote-dialog h2 {+ line-height: 1.35;+ text-wrap: balance;+}++.remote-dialog :is(p, label, summary) {+ text-wrap: pretty;+}++.remote-action:is(button, a),+.remote-dialog-actions > :is(button, a) {+ min-inline-size: 0;+ max-inline-size: 100%;+ block-size: auto;+ min-block-size: 2.5rem;+ padding-block: 0.5rem;+ white-space: normal;+ overflow-wrap: anywhere;+ text-wrap: pretty;+ line-height: 1.4;+}++.remote-action svg,+.remote-dialog-actions > :is(button, a) svg {+ flex-shrink: 0;+}++.remote-dialog-actions {+ display: grid;+ grid-template-columns: repeat(2, minmax(0, 1fr));+ align-items: stretch;+ gap: 0.5rem;+}++.remote-alert {+ display: grid;+ grid-template-columns: auto minmax(0, 1fr);+}++/* Keep secondary actions readable when translations need a second line. */+.remote-pair-alternatives {+ display: grid;+ grid-template-columns: repeat(2, minmax(0, 1fr));+ align-items: stretch;+}++@media (max-width: 380px) {+ .remote-dialog-actions > :is(button, a) {+ padding-inline: 0.75rem;+ }+}++@media (max-height: 540px) {+ .remote-dialog[role="dialog"] {+ overflow-y: auto;+ }+ .remote-dialog form,+ .remote-dialog .remote-pair {+ flex-shrink: 0;+ }+}diff --git a/webui/src/components/remote/useSidebarHostBridge.ts b/webui/src/components/remote/useSidebarHostBridge.tsindex 3c1fe44ac..7cd682d32 100644--- a/webui/src/components/remote/useSidebarHostBridge.ts+++ b/webui/src/components/remote/useSidebarHostBridge.ts@@ -5,14 +5,16 @@ import type { HostFrame } from "./useHostSessions";interface Peer { source: Window; origin: string; nonce: string }export function useSidebarHostBridge(frames: HostFrame[], selectedId: string | undefined,nodes: RefObject<Map<string, HTMLIFrameElement>>, restoreLocalFocus: () => void,- activity: { pendingName?: string; error?: string }) {+ activity: { pendingName?: string; error?: string }, managing = false, onLeaveManagement?: () => void) {const [embedded, setEmbedded] = useState<EmbeddedHost | null>(null);const [readyIds, setReadyIds] = useState<string[]>([]);const [anchor, setAnchor] = useState<HostAnchor | null>(null);+ const [surfaces, setSurfaces] = useState<Record<string, HostAnchor & { theme?: "light" | "dark" }>>({});+ const [hostedManagement, setHostedManagement] = useState(false);const parent = useRef<Peer | null>(null);const peers = useRef(new Map<string, Peer>());- const latest = useRef({ frames, selectedId, restoreLocalFocus, activity });- latest.current = { frames, selectedId, restoreLocalFocus, activity };+ const latest = useRef({ frames, selectedId, restoreLocalFocus, activity, managing, onLeaveManagement });+ latest.current = { frames, selectedId, restoreLocalFocus, activity, managing, onLeaveManagement };const initialize = useCallback((id: string) => {const frame = latest.current.frames.find((item) => item.connection.id === id);const source = nodes.current?.get(id)?.contentWindow;@@ -27,6 +29,7 @@ export function useSidebarHostBridge(frames: HostFrame[], selectedId: string | u// Deliberately only public display identity, never SSH metadata or secrets.source.postMessage({ channel: HOST_BRIDGE, type: "init", nonce: peer.nonce,name: frame.connection.name, hostname: frame.connection.hostname,+ managing: latest.current.selectedId === id && latest.current.managing,...(latest.current.selectedId === id ? latest.current.activity : {}) }, origin);}, [nodes]);useEffect(() => {@@ -42,6 +45,7 @@ export function useSidebarHostBridge(frames: HostFrame[], selectedId: string | uif (!host || typeof message.nonce !== "string" || !/^[a-f0-9-]{36}$/.test(message.nonce)) return;parent.current = { source: window.parent, origin: event.origin, nonce: message.nonce };setEmbedded(host);+ setHostedManagement(message.managing === true);window.parent.postMessage({ channel: HOST_BRIDGE, type: "ready", nonce: message.nonce }, event.origin);} else if (message.type === "focus" && current) latest.current.restoreLocalFocus();return;@@ -60,6 +64,12 @@ export function useSidebarHostBridge(frames: HostFrame[], selectedId: string | uconst rect = readHostAnchor(message.anchor);const outer = nodes.current?.get(id)?.getBoundingClientRect();if (rect && outer) setAnchor({ ...rect, left: outer.left + rect.left, top: outer.top + rect.top });+ } else if (message.type === "surface" && !frame.offline) {+ const rect = readHostAnchor(message.rect);+ const theme = message.theme === "light" || message.theme === "dark" ? message.theme : undefined;+ if (rect && rect.left >= 0 && rect.top >= 0) setSurfaces((previous) => ({ ...previous, [id]: { ...rect, theme } }));+ } else if (message.type === "leave-management" && latest.current.selectedId === id) {+ latest.current.onLeaveManagement?.();}// No select/connect/disconnect action is accepted from an embedded page.};@@ -72,16 +82,29 @@ export function useSidebarHostBridge(frames: HostFrame[], selectedId: string | uconst selectedName = frames.find((frame) => frame.connection.id === selectedId)?.connection.name;useEffect(() => {if (selectedId && peers.current.has(selectedId)) initialize(selectedId);- }, [initialize, selectedId, selectedName, activity.pendingName, activity.error]);+ }, [initialize, selectedId, selectedName, activity.pendingName, activity.error, managing]);useEffect(() => {for (const id of peers.current.keys()) if (!frames.some((frame) => frame.connection.id === id)) peers.current.delete(id);+ setSurfaces((previous) => {+ const entries = Object.entries(previous).filter(([id]) => frames.some((frame) => frame.connection.id === id));+ return entries.length === Object.keys(previous).length ? previous : Object.fromEntries(entries);+ });}, [frames]);const focus = (id: string) => {const peer = peers.current.get(id);if (peer && readyIds.includes(id)) peer.source.postMessage({ channel: HOST_BRIDGE, type: "focus", nonce: peer.nonce }, peer.origin);else nodes.current?.get(id)?.focus({ preventScroll: true });};- return { anchor, close: () => setAnchor(null), readyIds, initialize, focus,+ const reportSurface = useCallback((rect: HostAnchor, theme: "light" | "dark") => {+ const peer = parent.current;+ peer?.source.postMessage({ channel: HOST_BRIDGE, type: "surface", nonce: peer.nonce, rect, theme }, peer.origin);+ }, []);+ const leaveManagement = () => {+ const peer = parent.current;+ peer?.source.postMessage({ channel: HOST_BRIDGE, type: "leave-management", nonce: peer.nonce }, peer.origin);+ };+ return { anchor, close: () => setAnchor(null), readyIds, initialize, focus, hostedManagement, reportSurface, leaveManagement,+ surface: selectedId ? surfaces[selectedId] || null : null,embedded: embedded ? { ...embedded, kind: "embedded" as const, open: (position: HostAnchor) => {const peer = parent.current;peer?.source.postMessage({ channel: HOST_BRIDGE, type: "open", nonce: peer.nonce, anchor: position }, peer.origin);diff --git a/webui/src/components/settings/shared/SettingsTextEditor.tsx b/webui/src/components/settings/shared/SettingsTextEditor.tsxindex d5598f7e4..b0ee1c6ae 100644--- a/webui/src/components/settings/shared/SettingsTextEditor.tsx+++ b/webui/src/components/settings/shared/SettingsTextEditor.tsx@@ -21,6 +21,8 @@ export function SettingsTextEditor({ id, title, description, value, placeholder,const [saving, setSaving] = useState(false);const [error, setError] = useState("");const editor = useRef<HTMLTextAreaElement>(null);+ const help = description?.trim();+ const hasDescription = !!help && help !== title.trim();const save = async () => {setSaving(true);setError("");@@ -49,12 +51,13 @@ export function SettingsTextEditor({ id, title, description, value, placeholder,<TooltipContent>{t("settings.actions.edit")}</TooltipContent></Tooltip></TooltipProvider><DialogContent className="max-w-xl" showCloseButton={!saving}+ {...(hasDescription ? {} : { "aria-describedby": undefined })}onOpenAutoFocus={(event) => { event.preventDefault(); editor.current?.focus(); }}onEscapeKeyDown={(event) => { if (saving) event.preventDefault(); }}onPointerDownOutside={(event) => { if (saving) event.preventDefault(); }}><DialogHeader><DialogTitle className="pr-6 text-base">{title}</DialogTitle>- <DialogDescription>{description || title}</DialogDescription>+ {hasDescription && <DialogDescription>{help}</DialogDescription>}</DialogHeader><Textarea ref={editor} aria-label={title} value={draft} placeholder={placeholder} disabled={saving}aria-invalid={Boolean(error)} spellCheck={false}diff --git a/webui/src/i18n/locales/en/common.json b/webui/src/i18n/locales/en/common.jsonindex ac41cf0a1..6757d38e0 100644--- a/webui/src/i18n/locales/en/common.json+++ b/webui/src/i18n/locales/en/common.json@@ -1,10 +1,30 @@{"remote": {+ "compatibility": {+ "title": "Version & compatibility",+ "client": "On this computer",+ "host": "On this server",+ "unreported": "Not reported",+ "compatible": "Compatible",+ "compatibleHint": "No update needed to connect.",+ "unknown": "Compatibility not confirmed",+ "unknownHint": "We couldn’t verify that this server supports your local interface. Update nanobot on this server, then reconnect.",+ "update_host": "Update this server",+ "update_hostHint": "Your local interface needs features this server doesn’t support. Update nanobot on this server, then reconnect.",+ "update_client": "Update this computer",+ "update_clientHint": "This server needs a newer local interface. Update nanobot on this computer; leave the server as it is.",+ "unchecked": "Not checked yet",+ "uncheckedHint": "Connect to this server to check compatibility. An unknown version does not mean it is outdated.",+ "localUpdateHint": "Update your local nanobot installation, then reopen the WebUI. The remote server will not be changed.",+ "serverUpdateHint": "Update the installation running on this server. Back up its configuration and data, and finish active tasks before restarting. Updating this computer does not update the server.",+ "guide": "Update guide",+ "preparation": "Before updating"+ },"rename": {"action": "Rename","title": "Rename server","name": "Name",- "hint": "A name for this connection. Your server and SSH settings won’t change."+ "hint": "Only the name shown here changes."},"sameInstance": {"forgetAction": "Forget",@@ -76,7 +96,7 @@"fingerprint": "The SSH server must match this fingerprint from the server console:","revoke": "To revoke new connections, run this on the server and close any open remote sessions:","retryHint": "Pairing is saved. You can retry without running the server command again. If SSH is blocked by your network or VPN, pairing cannot bypass it.",- "forgetHint": "Forgetting removes this connection from the list, not its server authorization. To revoke the device, run this on the server:"+ "forgetHint": "To also revoke this device’s server authorization, run on the server:"},"setup": {"progress": "Connection setup",@@ -166,6 +186,10 @@"forgetTitle": "Forget {{name}}?","forgetDescription": "Only this saved connection will be removed. nanobot, its keys and conversations on the server will stay untouched.","errors": {+ "webui_compatibility_unknown": "We couldn’t verify that this server supports your local interface. Update nanobot on this server, then reconnect.",+ "host_update_required": "Your local interface needs features this server doesn’t support. Update nanobot on this server, then reconnect.",+ "client_update_required": "This server needs a newer local interface. Update nanobot on this computer; leave the server as it is.",+ "local_webui_unavailable": "The local WebUI bundle is missing. Repair or rebuild nanobot on this computer; the server does not need a frontend bundle.","invalid_name": "Enter a name between 1 and 64 characters, without line breaks.","local_connection_unavailable": "Couldn't reach local nanobot on this computer. Keep it running and try again.","disconnected": "This shared connection was closed. Reconnect when you’re ready.",diff --git a/webui/src/i18n/locales/es/common.json b/webui/src/i18n/locales/es/common.jsonindex 78eedadd6..8cd0fad72 100644--- a/webui/src/i18n/locales/es/common.json+++ b/webui/src/i18n/locales/es/common.json@@ -1,10 +1,30 @@{"remote": {+ "compatibility": {+ "title": "Versión y compatibilidad",+ "client": "En este equipo",+ "host": "En este servidor",+ "unreported": "Sin informar",+ "compatible": "Compatible",+ "compatibleHint": "No hace falta actualizar para conectar.",+ "unknown": "Compatibilidad sin confirmar",+ "unknownHint": "Este servidor no ha proporcionado un contrato WebUI compatible. Actualiza nanobot en este servidor y vuelve a conectar.",+ "update_host": "Actualizar este servidor",+ "update_hostHint": "Este servidor no admite las funciones requeridas por el cliente. Actualiza nanobot en este servidor.",+ "update_client": "Actualizar este equipo",+ "update_clientHint": "Este servidor requiere un protocolo de cliente más reciente. Actualiza nanobot en este equipo; no hace falta bajar la versión del servidor.",+ "unchecked": "Sin comprobar",+ "uncheckedHint": "Conecta con este servidor para comprobar la compatibilidad. Una versión desconocida no significa que esté desactualizada.",+ "localUpdateHint": "Actualiza la instalación local de nanobot y vuelve a abrir WebUI. El servidor remoto no se modificará.",+ "serverUpdateHint": "Actualiza en el entorno que ejecuta nanobot en este servidor. Haz una copia de la configuración y los datos y termina las tareas activas antes de reiniciar. Actualizar este equipo no actualiza este servidor.",+ "guide": "Guía de actualización",+ "preparation": "Antes de actualizar"+ },"rename": {"action": "Cambiar nombre","title": "Cambiar nombre del servidor","name": "Nombre",- "hint": "Un nombre para esta conexión. El servidor y la configuración SSH no cambiarán."+ "hint": "Solo cambia el nombre que se muestra aquí."},"sameInstance": {"forgetAction": "Forget",@@ -76,7 +96,7 @@"fingerprint": "El servidor SSH debe coincidir con esta huella de la consola:","revoke": "Para revocar conexiones nuevas, ejecuta esto en el servidor y cierra las sesiones remotas abiertas:","retryHint": "El emparejamiento está guardado. Puedes reintentar sin ejecutar el comando otra vez. No evita bloqueos de SSH por la red o VPN.",- "forgetHint": "Olvidar elimina la conexión de la lista, no la autorización del servidor. Para revocarla, ejecuta:"+ "forgetHint": "Para revocar también la autorización de este dispositivo, ejecuta en el servidor:"},"setup": {"progress": "Configuración de conexión",@@ -166,6 +186,10 @@"forgetTitle": "Forget {{name}}?","forgetDescription": "Only this saved connection will be removed. nanobot, its keys and conversations on the server will stay untouched.","errors": {+ "webui_compatibility_unknown": "Este servidor no ha proporcionado un contrato WebUI compatible. Actualiza nanobot en este servidor y vuelve a conectar.",+ "host_update_required": "Este servidor no admite las funciones requeridas por el cliente. Actualiza nanobot en este servidor.",+ "client_update_required": "Este servidor requiere un protocolo de cliente más reciente. Actualiza nanobot en este equipo; no hace falta bajar la versión del servidor.",+ "local_webui_unavailable": "Faltan los archivos locales de WebUI. Repara o recompila nanobot en este equipo; el servidor no necesita archivos de interfaz.","invalid_name": "Introduce un nombre de 1 a 64 caracteres, sin saltos de línea.","local_connection_unavailable": "No se pudo conectar con nanobot en este equipo. Comprueba que esté en ejecución e inténtalo de nuevo.","disconnected": "Esta conexión compartida se cerró. Reconecta cuando quieras.",diff --git a/webui/src/i18n/locales/fr/common.json b/webui/src/i18n/locales/fr/common.jsonindex b20ba0ba7..925561c77 100644--- a/webui/src/i18n/locales/fr/common.json+++ b/webui/src/i18n/locales/fr/common.json@@ -1,10 +1,30 @@{"remote": {+ "compatibility": {+ "title": "Version et compatibilité",+ "client": "Sur cet ordinateur",+ "host": "Sur ce serveur",+ "unreported": "Non indiquée",+ "compatible": "Compatible",+ "compatibleHint": "Aucune mise à jour nécessaire pour se connecter.",+ "unknown": "Compatibilité non confirmée",+ "unknownHint": "Ce serveur n’a pas fourni de contrat WebUI pris en charge. Mettez à jour nanobot sur ce serveur, puis reconnectez-vous.",+ "update_host": "Mettre à jour ce serveur",+ "update_hostHint": "Ce serveur ne prend pas en charge les fonctions requises par le client. Mettez à jour nanobot sur ce serveur.",+ "update_client": "Mettre à jour cet ordinateur",+ "update_clientHint": "Ce serveur exige un protocole client plus récent. Mettez à jour nanobot sur cet ordinateur, sans rétrograder le serveur.",+ "unchecked": "Pas encore vérifiée",+ "uncheckedHint": "Connectez-vous à ce serveur pour vérifier la compatibilité. Une version inconnue n’est pas forcément obsolète.",+ "localUpdateHint": "Mettez à jour votre installation locale de nanobot, puis rouvrez WebUI. Le serveur distant ne sera pas modifié.",+ "serverUpdateHint": "Utilisez l’environnement qui exécute nanobot sur ce serveur. Sauvegardez la configuration et les données, puis terminez les tâches avant tout redémarrage nécessaire. Mettre à jour cet ordinateur ne met pas à jour ce serveur.",+ "guide": "Guide de mise à jour",+ "preparation": "Avant la mise à jour"+ },"rename": {"action": "Renommer","title": "Renommer le serveur","name": "Nom",- "hint": "Un nom pour cette connexion. Le serveur et les paramètres SSH restent inchangés."+ "hint": "Seul le nom affiché ici change."},"sameInstance": {"forgetAction": "Forget",@@ -76,7 +96,7 @@"fingerprint": "Le serveur SSH doit correspondre à cette empreinte affichée dans sa console :","revoke": "Pour révoquer les nouvelles connexions, exécutez ceci sur le serveur et fermez les sessions distantes ouvertes :","retryHint": "L’association est enregistrée. Réessayez sans relancer la commande serveur. Elle ne contourne pas un blocage SSH par le réseau ou le VPN.",- "forgetHint": "Oublier retire la connexion de la liste, mais pas l’autorisation du serveur. Pour la révoquer, exécutez :"+ "forgetHint": "Pour révoquer aussi l’autorisation de cet appareil, exécutez sur le serveur :"},"setup": {"progress": "Configuration de la connexion",@@ -166,6 +186,10 @@"forgetTitle": "Forget {{name}}?","forgetDescription": "Only this saved connection will be removed. nanobot, its keys and conversations on the server will stay untouched.","errors": {+ "webui_compatibility_unknown": "Ce serveur n’a pas fourni de contrat WebUI pris en charge. Mettez à jour nanobot sur ce serveur, puis reconnectez-vous.",+ "host_update_required": "Ce serveur ne prend pas en charge les fonctions requises par le client. Mettez à jour nanobot sur ce serveur.",+ "client_update_required": "Ce serveur exige un protocole client plus récent. Mettez à jour nanobot sur cet ordinateur, sans rétrograder le serveur.",+ "local_webui_unavailable": "Les fichiers WebUI locaux sont absents. Réparez ou recompilez nanobot sur cet ordinateur ; le serveur n’a pas besoin des fichiers d’interface.","invalid_name": "Saisissez un nom de 1 à 64 caractères, sans saut de ligne.","local_connection_unavailable": "Impossible de joindre nanobot sur cet ordinateur. Vérifiez qu’il est en cours d’exécution, puis réessayez.","disconnected": "Cette connexion partagée a été fermée. Reconnectez-vous quand vous le souhaitez.",diff --git a/webui/src/i18n/locales/id/common.json b/webui/src/i18n/locales/id/common.jsonindex c420fc7f3..f530eb33d 100644--- a/webui/src/i18n/locales/id/common.json+++ b/webui/src/i18n/locales/id/common.json@@ -1,10 +1,30 @@{"remote": {+ "compatibility": {+ "title": "Versi dan kompatibilitas",+ "client": "Di komputer ini",+ "host": "Di server ini",+ "unreported": "Tidak dilaporkan",+ "compatible": "Kompatibel",+ "compatibleHint": "Tidak perlu memperbarui untuk terhubung.",+ "unknown": "Kompatibilitas belum dipastikan",+ "unknownHint": "Server ini belum menyediakan kontrak WebUI yang didukung. Perbarui nanobot di server ini, lalu hubungkan kembali.",+ "update_host": "Perbarui server ini",+ "update_hostHint": "Server ini tidak mendukung fitur yang diperlukan klien. Perbarui nanobot di server ini.",+ "update_client": "Perbarui komputer ini",+ "update_clientHint": "Server ini memerlukan protokol klien yang lebih baru. Perbarui nanobot di komputer ini; versi server tidak perlu diturunkan.",+ "unchecked": "Belum diperiksa",+ "uncheckedHint": "Hubungkan ke server ini untuk memeriksa kompatibilitas. Versi yang tidak diketahui bukan berarti sudah usang.",+ "localUpdateHint": "Perbarui instalasi nanobot lokal, lalu buka kembali WebUI. Server jarak jauh tidak akan diubah.",+ "serverUpdateHint": "Gunakan lingkungan instalasi yang menjalankan nanobot di server ini. Cadangkan konfigurasi dan data, lalu selesaikan tugas aktif sebelum memulai ulang. Memperbarui komputer ini tidak memperbarui server ini.",+ "guide": "Panduan pembaruan",+ "preparation": "Sebelum memperbarui"+ },"rename": {"action": "Ubah nama","title": "Ubah nama server","name": "Nama",- "hint": "Nama untuk koneksi ini. Server dan pengaturan SSH tidak berubah."+ "hint": "Hanya nama yang ditampilkan di sini yang berubah."},"sameInstance": {"forgetAction": "Forget",@@ -76,7 +96,7 @@"fingerprint": "Server SSH harus cocok dengan sidik jari dari konsol server ini:","revoke": "Untuk mencabut koneksi baru, jalankan ini di server dan tutup sesi jarak jauh yang terbuka:","retryHint": "Pemasangan tersimpan. Coba lagi tanpa menjalankan ulang perintah server. Pemasangan tidak dapat melewati pemblokiran SSH oleh jaringan atau VPN.",- "forgetHint": "Melupakan hanya menghapus koneksi dari daftar, bukan izin server. Untuk mencabutnya, jalankan di server:"+ "forgetHint": "Untuk juga mencabut izin perangkat ini, jalankan di server:"},"setup": {"progress": "Pengaturan koneksi",@@ -166,6 +186,10 @@"forgetTitle": "Forget {{name}}?","forgetDescription": "Only this saved connection will be removed. nanobot, its keys and conversations on the server will stay untouched.","errors": {+ "webui_compatibility_unknown": "Server ini belum menyediakan kontrak WebUI yang didukung. Perbarui nanobot di server ini, lalu hubungkan kembali.",+ "host_update_required": "Server ini tidak mendukung fitur yang diperlukan klien. Perbarui nanobot di server ini.",+ "client_update_required": "Server ini memerlukan protokol klien yang lebih baru. Perbarui nanobot di komputer ini; versi server tidak perlu diturunkan.",+ "local_webui_unavailable": "Berkas WebUI lokal tidak ditemukan. Perbaiki atau bangun ulang nanobot di komputer ini; server tidak memerlukan berkas antarmuka.","invalid_name": "Masukkan nama sepanjang 1–64 karakter, tanpa baris baru.","local_connection_unavailable": "Tidak dapat terhubung ke nanobot di komputer ini. Pastikan nanobot berjalan, lalu coba lagi.","disconnected": "Koneksi bersama ini telah ditutup. Sambungkan kembali saat Anda siap.",diff --git a/webui/src/i18n/locales/ja/common.json b/webui/src/i18n/locales/ja/common.jsonindex 12c06c961..a3ae48202 100644--- a/webui/src/i18n/locales/ja/common.json+++ b/webui/src/i18n/locales/ja/common.json@@ -1,10 +1,30 @@{"remote": {+ "compatibility": {+ "title": "バージョンと互換性",+ "client": "このコンピューター",+ "host": "このサーバー",+ "unreported": "未報告",+ "compatible": "互換性あり",+ "compatibleHint": "更新せずに接続できます。",+ "unknown": "互換性を確認できません",+ "unknownHint": "このサーバーから対応する WebUI プロトコル情報が提供されていません。サーバー上の nanobot を更新して再接続してください。",+ "update_host": "サーバーの更新が必要",+ "update_hostHint": "このサーバーはクライアントが必要とする機能に対応していません。サーバー上の nanobot を更新してください。",+ "update_client": "このコンピューターの更新が必要",+ "update_clientHint": "このサーバーはより新しいクライアントプロトコルを要求します。このコンピューターの nanobot を更新してください。サーバーのダウングレードは不要です。",+ "unchecked": "未確認",+ "uncheckedHint": "このサーバーに接続すると互換性を確認できます。バージョン不明は古いバージョンという意味ではありません。",+ "localUpdateHint": "ローカルの nanobot を更新し、WebUI を開き直してください。リモートサーバーは変更されません。",+ "serverUpdateHint": "サーバーで nanobot を実行している環境で更新してください。設定とデータをバックアップし、再起動が必要な場合は実行中のタスクを終了してください。このコンピューターの更新ではサーバーは更新されません。",+ "guide": "更新ガイド",+ "preparation": "更新前の確認"+ },"rename": {"action": "名前を変更","title": "サーバー名を変更","name": "名前",- "hint": "接続の表示名です。サーバーや SSH 設定は変更されません。"+ "hint": "ここに表示する名前だけを変更します。"},"sameInstance": {"forgetAction": "Forget",@@ -76,7 +96,7 @@"fingerprint": "接続先の SSH サーバーは、サーバー端末のこの指紋と一致する必要があります:","revoke": "新規接続の認可を取り消すには、サーバーで次を実行し、開いているリモートセッションも閉じてください:","retryHint": "ペアリングは保存済みです。サーバーのコマンドを再実行せずに再試行できます。ネットワークや VPN による SSH の遮断は回避できません。",- "forgetHint": "削除するのはローカル一覧の接続だけで、サーバーの認可は残ります。取消にはサーバーで次を実行してください:"+ "forgetHint": "この端末のサーバー認可も取り消すには、サーバーで次を実行してください:"},"setup": {"progress": "接続設定",@@ -166,6 +186,10 @@"forgetTitle": "Forget {{name}}?","forgetDescription": "Only this saved connection will be removed. nanobot, its keys and conversations on the server will stay untouched.","errors": {+ "webui_compatibility_unknown": "このサーバーから対応する WebUI プロトコル情報が提供されていません。サーバー上の nanobot を更新して再接続してください。",+ "host_update_required": "このサーバーはクライアントが必要とする機能に対応していません。サーバー上の nanobot を更新してください。",+ "client_update_required": "このサーバーはより新しいクライアントプロトコルを要求します。このコンピューターの nanobot を更新してください。サーバーのダウングレードは不要です。",+ "local_webui_unavailable": "ローカル WebUI ファイルがありません。このコンピューターの nanobot を修復または再ビルドしてください。サーバー側の画面ファイルは不要です。","invalid_name": "改行を含まない1~64文字の名前を入力してください。","local_connection_unavailable": "このコンピューターの nanobot に接続できませんでした。起動していることを確認して、もう一度お試しください。","disconnected": "この共有接続は閉じられました。必要なときに再接続できます。",diff --git a/webui/src/i18n/locales/ko/common.json b/webui/src/i18n/locales/ko/common.jsonindex 3a1e80087..fc02707a3 100644--- a/webui/src/i18n/locales/ko/common.json+++ b/webui/src/i18n/locales/ko/common.json@@ -1,10 +1,30 @@{"remote": {+ "compatibility": {+ "title": "버전 및 호환성",+ "client": "이 컴퓨터",+ "host": "이 서버",+ "unreported": "보고되지 않음",+ "compatible": "호환됨",+ "compatibleHint": "업데이트 없이 연결할 수 있습니다.",+ "unknown": "호환성을 확인할 수 없음",+ "unknownHint": "이 서버가 지원되는 WebUI 프로토콜 정보를 제공하지 않았습니다. 서버의 nanobot을 업데이트한 후 다시 연결하세요.",+ "update_host": "이 서버 업데이트 필요",+ "update_hostHint": "이 서버는 클라이언트에 필요한 기능을 지원하지 않습니다. 이 서버의 nanobot을 업데이트하세요.",+ "update_client": "이 컴퓨터 업데이트 필요",+ "update_clientHint": "이 서버에는 더 최신 클라이언트 프로토콜이 필요합니다. 이 컴퓨터의 nanobot을 업데이트하세요. 서버를 다운그레이드할 필요는 없습니다.",+ "unchecked": "아직 확인하지 않음",+ "uncheckedHint": "이 서버에 연결하여 호환성을 확인하세요. 버전을 알 수 없다고 오래된 버전인 것은 아닙니다.",+ "localUpdateHint": "로컬 nanobot을 업데이트한 다음 WebUI를 다시 여세요. 원격 서버는 변경되지 않습니다.",+ "serverUpdateHint": "서버에서 nanobot이 실행되는 설치 환경에서 업데이트하세요. 설정과 데이터를 백업하고 재시작이 필요하면 실행 중인 작업을 먼저 마치세요. 이 컴퓨터의 업데이트는 서버를 업데이트하지 않습니다.",+ "guide": "업데이트 안내",+ "preparation": "업데이트 전 확인"+ },"rename": {"action": "이름 변경","title": "서버 이름 변경","name": "이름",- "hint": "연결의 표시 이름입니다. 서버나 SSH 설정은 변경되지 않습니다."+ "hint": "여기에 표시되는 이름만 변경됩니다."},"sameInstance": {"forgetAction": "Forget",@@ -76,7 +96,7 @@"fingerprint": "SSH 서버는 서버 콘솔의 다음 지문과 일치해야 합니다:","revoke": "새 연결의 승인을 취소하려면 서버에서 다음 명령을 실행하고 열린 원격 세션도 닫으세요:","retryHint": "페어링이 저장되었습니다. 서버 명령을 다시 실행하지 않고 재시도할 수 있습니다. 네트워크나 VPN의 SSH 차단은 우회할 수 없습니다.",- "forgetHint": "잊기는 로컬 목록에서 연결만 제거하며 서버 승인은 남습니다. 취소하려면 서버에서 실행하세요:"+ "forgetHint": "이 기기의 서버 승인도 취소하려면 서버에서 실행하세요:"},"setup": {"progress": "연결 설정",@@ -166,6 +186,10 @@"forgetTitle": "Forget {{name}}?","forgetDescription": "Only this saved connection will be removed. nanobot, its keys and conversations on the server will stay untouched.","errors": {+ "webui_compatibility_unknown": "이 서버가 지원되는 WebUI 프로토콜 정보를 제공하지 않았습니다. 서버의 nanobot을 업데이트한 후 다시 연결하세요.",+ "host_update_required": "이 서버는 클라이언트에 필요한 기능을 지원하지 않습니다. 이 서버의 nanobot을 업데이트하세요.",+ "client_update_required": "이 서버에는 더 최신 클라이언트 프로토콜이 필요합니다. 이 컴퓨터의 nanobot을 업데이트하세요. 서버를 다운그레이드할 필요는 없습니다.",+ "local_webui_unavailable": "로컬 WebUI 파일이 없습니다. 이 컴퓨터의 nanobot을 복구하거나 다시 빌드하세요. 서버에는 프런트엔드 파일이 필요하지 않습니다.","invalid_name": "줄 바꿈 없이 1~64자의 이름을 입력하세요.","local_connection_unavailable": "이 컴퓨터의 nanobot에 연결하지 못했습니다. 실행 중인지 확인한 후 다시 시도하세요.","disconnected": "공유 연결이 종료되었습니다. 준비되면 다시 연결하세요.",diff --git a/webui/src/i18n/locales/pt-BR/common.json b/webui/src/i18n/locales/pt-BR/common.jsonindex 52a418664..e892181bc 100644--- a/webui/src/i18n/locales/pt-BR/common.json+++ b/webui/src/i18n/locales/pt-BR/common.json@@ -1,10 +1,30 @@{"remote": {+ "compatibility": {+ "title": "Versão e compatibilidade",+ "client": "Neste computador",+ "host": "Neste servidor",+ "unreported": "Não informada",+ "compatible": "Compatível",+ "compatibleHint": "Não é preciso atualizar para conectar.",+ "unknown": "Compatibilidade não confirmada",+ "unknownHint": "Este servidor não forneceu um contrato WebUI compatível. Atualize o nanobot neste servidor e reconecte.",+ "update_host": "Atualize este servidor",+ "update_hostHint": "Este servidor não suporta os recursos exigidos pelo cliente. Atualize o nanobot neste servidor.",+ "update_client": "Atualize este computador",+ "update_clientHint": "Este servidor exige um protocolo de cliente mais recente. Atualize o nanobot neste computador; não é preciso rebaixar o servidor.",+ "unchecked": "Ainda não verificada",+ "uncheckedHint": "Conecte a este servidor para verificar a compatibilidade. Uma versão desconhecida não significa que está desatualizada.",+ "localUpdateHint": "Atualize a instalação local do nanobot e reabra a WebUI. O servidor remoto não será alterado.",+ "serverUpdateHint": "Use o ambiente de instalação que executa o nanobot neste servidor. Faça backup da configuração e dos dados e conclua tarefas ativas antes de reiniciar. Atualizar este computador não atualiza este servidor.",+ "guide": "Guia de atualização",+ "preparation": "Antes de atualizar"+ },"rename": {"action": "Renomear","title": "Renomear servidor","name": "Nome",- "hint": "Um nome para esta conexão. O servidor e as configurações SSH não serão alterados."+ "hint": "Só o nome exibido aqui muda."},"sameInstance": {"forgetAction": "Forget",@@ -76,7 +96,7 @@"fingerprint": "O servidor SSH deve corresponder a esta impressão digital do console:","revoke": "Para revogar novas conexões, execute isto no servidor e feche as sessões remotas abertas:","retryHint": "O pareamento foi salvo. Tente novamente sem executar o comando outra vez. Ele não contorna bloqueios de SSH pela rede ou VPN.",- "forgetHint": "Esquecer remove a conexão da lista, não a autorização do servidor. Para revogar, execute no servidor:"+ "forgetHint": "Para também revogar a autorização deste dispositivo, execute no servidor:"},"setup": {"progress": "Configuração da conexão",@@ -166,6 +186,10 @@"forgetTitle": "Forget {{name}}?","forgetDescription": "Only this saved connection will be removed. nanobot, its keys and conversations on the server will stay untouched.","errors": {+ "webui_compatibility_unknown": "Este servidor não forneceu um contrato WebUI compatível. Atualize o nanobot neste servidor e reconecte.",+ "host_update_required": "Este servidor não suporta os recursos exigidos pelo cliente. Atualize o nanobot neste servidor.",+ "client_update_required": "Este servidor exige um protocolo de cliente mais recente. Atualize o nanobot neste computador; não é preciso rebaixar o servidor.",+ "local_webui_unavailable": "Os arquivos locais da WebUI estão ausentes. Repare ou recompile o nanobot neste computador; o servidor não precisa dos arquivos de interface.","invalid_name": "Insira um nome de 1 a 64 caracteres, sem quebras de linha.","local_connection_unavailable": "Não foi possível acessar o nanobot neste computador. Verifique se ele está em execução e tente novamente.","disconnected": "Esta conexão compartilhada foi fechada. Reconecte quando quiser.",diff --git a/webui/src/i18n/locales/vi/common.json b/webui/src/i18n/locales/vi/common.jsonindex 6e3fe5dc9..f8145935b 100644--- a/webui/src/i18n/locales/vi/common.json+++ b/webui/src/i18n/locales/vi/common.json@@ -1,10 +1,30 @@{"remote": {+ "compatibility": {+ "title": "Phiên bản và tương thích",+ "client": "Trên máy tính này",+ "host": "Trên máy chủ này",+ "unreported": "Chưa báo cáo",+ "compatible": "Tương thích",+ "compatibleHint": "Không cần cập nhật để kết nối.",+ "unknown": "Chưa xác nhận tương thích",+ "unknownHint": "Máy chủ này chưa cung cấp thông tin giao thức WebUI được hỗ trợ. Hãy cập nhật nanobot trên máy chủ này rồi kết nối lại.",+ "update_host": "Cần cập nhật máy chủ này",+ "update_hostHint": "Máy chủ này không hỗ trợ các chức năng mà máy khách yêu cầu. Hãy cập nhật nanobot trên máy chủ này.",+ "update_client": "Cần cập nhật máy tính này",+ "update_clientHint": "Máy chủ này yêu cầu giao thức máy khách mới hơn. Hãy cập nhật nanobot trên máy tính này; không cần hạ phiên bản máy chủ.",+ "unchecked": "Chưa kiểm tra",+ "uncheckedHint": "Kết nối với máy chủ này để kiểm tra tương thích. Không biết phiên bản không có nghĩa là phiên bản đã cũ.",+ "localUpdateHint": "Cập nhật nanobot cục bộ rồi mở lại WebUI. Máy chủ từ xa sẽ không bị thay đổi.",+ "serverUpdateHint": "Cập nhật trong môi trường đang chạy nanobot trên máy chủ này. Sao lưu cấu hình và dữ liệu, hoàn tất tác vụ đang chạy trước khi khởi động lại nếu cần. Cập nhật máy tính này không cập nhật máy chủ này.",+ "guide": "Hướng dẫn cập nhật",+ "preparation": "Trước khi cập nhật"+ },"rename": {"action": "Đổi tên","title": "Đổi tên máy chủ","name": "Tên",- "hint": "Tên cho kết nối này. Máy chủ và cài đặt SSH không thay đổi."+ "hint": "Chỉ thay đổi tên hiển thị tại đây."},"sameInstance": {"forgetAction": "Forget",@@ -76,7 +96,7 @@"fingerprint": "Máy chủ SSH phải khớp với dấu vân tay từ bảng điều khiển này:","revoke": "Để thu hồi kết nối mới, chạy lệnh này trên máy chủ và đóng các phiên từ xa đang mở:","retryHint": "Đã lưu ghép nối. Bạn có thể thử lại mà không chạy lại lệnh trên máy chủ. Ghép nối không vượt qua việc chặn SSH của mạng hoặc VPN.",- "forgetHint": "Quên chỉ xóa kết nối khỏi danh sách, không thu hồi quyền trên máy chủ. Để thu hồi, chạy trên máy chủ:"+ "forgetHint": "Để thu hồi cả quyền của thiết bị này, hãy chạy trên máy chủ:"},"setup": {"progress": "Thiết lập kết nối",@@ -166,6 +186,10 @@"forgetTitle": "Forget {{name}}?","forgetDescription": "Only this saved connection will be removed. nanobot, its keys and conversations on the server will stay untouched.","errors": {+ "webui_compatibility_unknown": "Máy chủ này chưa cung cấp thông tin giao thức WebUI được hỗ trợ. Hãy cập nhật nanobot trên máy chủ này rồi kết nối lại.",+ "host_update_required": "Máy chủ này không hỗ trợ các chức năng mà máy khách yêu cầu. Hãy cập nhật nanobot trên máy chủ này.",+ "client_update_required": "Máy chủ này yêu cầu giao thức máy khách mới hơn. Hãy cập nhật nanobot trên máy tính này; không cần hạ phiên bản máy chủ.",+ "local_webui_unavailable": "Thiếu tệp WebUI cục bộ. Hãy sửa hoặc dựng lại nanobot trên máy tính này; máy chủ không cần tệp giao diện.","invalid_name": "Nhập tên từ 1–64 ký tự, không chứa dấu xuống dòng.","local_connection_unavailable": "Không thể kết nối với nanobot trên máy tính này. Hãy đảm bảo nanobot đang chạy rồi thử lại.","disconnected": "Kết nối dùng chung này đã đóng. Bạn có thể kết nối lại khi sẵn sàng.",diff --git a/webui/src/i18n/locales/zh-CN/common.json b/webui/src/i18n/locales/zh-CN/common.jsonindex f346e65f0..f033e8663 100644--- a/webui/src/i18n/locales/zh-CN/common.json+++ b/webui/src/i18n/locales/zh-CN/common.json@@ -1,10 +1,30 @@{"remote": {+ "compatibility": {+ "title": "版本与兼容性",+ "client": "这台电脑",+ "host": "这台服务器",+ "unreported": "未报告",+ "compatible": "兼容",+ "compatibleHint": "可直接连接,无需更新。",+ "unknown": "尚无法确认兼容性",+ "unknownHint": "还无法确认这台服务器是否支持本地界面。请更新服务器上的 nanobot,然后重新连接。",+ "update_host": "需要更新服务器",+ "update_hostHint": "本地界面需要的功能在这台服务器上还不可用。请更新服务器上的 nanobot,然后重新连接。",+ "update_client": "需要更新本地",+ "update_clientHint": "这台服务器需要更新的本地界面。请更新这台电脑上的 nanobot,服务器无需改动。",+ "unchecked": "尚未检查",+ "uncheckedHint": "连接这台服务器后检查兼容性。无法获取版本不代表版本过旧。",+ "localUpdateHint": "更新这台电脑上安装的 nanobot,然后重新打开 WebUI。不会更改远程服务器。",+ "serverUpdateHint": "请更新服务器上实际运行的那份 nanobot。先备份配置和数据,重启前结束正在运行的任务。更新这台电脑不会更新服务器。",+ "guide": "查看更新说明",+ "preparation": "更新前须知"+ },"rename": {"action": "重命名","title": "重命名服务器","name": "名称",- "hint": "给连接起个好认的名字,不会更改服务器或 SSH 设置。"+ "hint": "只修改这里显示的名称。"},"sameInstance": {"forgetAction": "忘记",@@ -76,7 +96,7 @@"fingerprint": "连接时会核对服务器终端提供的 SSH 指纹:","revoke": "如需撤销新连接,在服务器运行以下命令,并关闭已打开的远程会话:","retryHint": "配对已保存,无需重复运行服务器命令。若网络或 VPN 阻断 SSH,配对无法绕过该限制。",- "forgetHint": "忘记连接只会从本地列表移除,不会撤销服务器授权。撤销设备请在服务器运行:"+ "forgetHint": "若还要撤销此设备的服务器授权,请在服务器运行:"},"setup": {"progress": "连接设置",@@ -166,6 +186,10 @@"forgetTitle": "忘记 {{name}}?","forgetDescription": "只移除本机保存的连接。服务器上的 nanobot、密钥和会话都不会被删除。","errors": {+ "webui_compatibility_unknown": "还无法确认这台服务器是否支持本地界面。请更新服务器上的 nanobot,然后重新连接。",+ "host_update_required": "本地界面需要的功能在这台服务器上还不可用。请更新服务器上的 nanobot,然后重新连接。",+ "client_update_required": "这台服务器需要更新的本地界面。请更新这台电脑上的 nanobot,服务器无需改动。",+ "local_webui_unavailable": "本地 WebUI 文件缺失。请修复或重新构建这台电脑上的 nanobot;服务器不需要安装前端文件。","invalid_name": "请输入 1–64 个字符的名称,不能包含换行。","local_connection_unavailable": "暂时无法连接这台电脑上的 nanobot,请确保它正在运行后重试。","disconnected": "此共享连接已断开,需要时可重新连接。",diff --git a/webui/src/i18n/locales/zh-TW/common.json b/webui/src/i18n/locales/zh-TW/common.jsonindex e9b89ec51..c823c2256 100644--- a/webui/src/i18n/locales/zh-TW/common.json+++ b/webui/src/i18n/locales/zh-TW/common.json@@ -1,10 +1,30 @@{"remote": {+ "compatibility": {+ "title": "版本與相容性",+ "client": "這台電腦",+ "host": "這台伺服器",+ "unreported": "未回報",+ "compatible": "相容",+ "compatibleHint": "可直接連線,無需更新。",+ "unknown": "尚無法確認相容性",+ "unknownHint": "這台伺服器尚未提供受支援的 WebUI 通訊協定資訊。請更新伺服器上的 nanobot,然後重新連線。",+ "update_host": "需要更新伺服器",+ "update_hostHint": "這台伺服器不支援本機介面所需的能力。請更新這台伺服器上的 nanobot。",+ "update_client": "需要更新本機",+ "update_clientHint": "這台伺服器要求更新的用戶端協定。請更新這台電腦上的 nanobot,無需降級伺服器。",+ "unchecked": "尚未檢查",+ "uncheckedHint": "連線至這台伺服器後檢查相容性。無法取得版本不代表版本過舊。",+ "localUpdateHint": "更新這台電腦上安裝的 nanobot,然後重新開啟 WebUI。不會更改遠端伺服器。",+ "serverUpdateHint": "請在執行該伺服器 nanobot 的安裝環境中更新。先備份設定和資料;如需重新啟動,請先結束正在執行的任務。更新這台電腦 不會更新這台伺服器。",+ "guide": "查看更新說明",+ "preparation": "更新前須知"+ },"rename": {"action": "重新命名","title": "重新命名伺服器","name": "名稱",- "hint": "為連線取個好認的名字,不會更改伺服器或 SSH 設定。"+ "hint": "只修改這裡顯示的名稱。"},"sameInstance": {"forgetAction": "忘記",@@ -76,7 +96,7 @@"fingerprint": "連線時會核對伺服器終端提供的 SSH 指紋:","revoke": "若要撤銷新連線,請在伺服器執行以下指令,並關閉已開啟的遠端工作階段:","retryHint": "配對已儲存,無需重複執行伺服器指令。若網路或 VPN 阻擋 SSH,配對無法繞過該限制。",- "forgetHint": "忘記連線只會移除本機列表項目,不會撤銷伺服器授權。撤銷裝置請在伺服器執行:"+ "forgetHint": "若還要撤銷此裝置的伺服器授權,請在伺服器執行:"},"setup": {"progress": "連線設定",@@ -166,6 +186,10 @@"forgetTitle": "Forget {{name}}?","forgetDescription": "Only this saved connection will be removed. nanobot, its keys and conversations on the server will stay untouched.","errors": {+ "webui_compatibility_unknown": "這台伺服器尚未提供受支援的 WebUI 通訊協定資訊。請更新伺服器上的 nanobot,然後重新連線。",+ "host_update_required": "這台伺服器不支援本機介面所需的能力。請更新這台伺服器上的 nanobot。",+ "client_update_required": "這台伺服器要求更新的用戶端協定。請更新這台電腦上的 nanobot,無需降級伺服器。",+ "local_webui_unavailable": "本機 WebUI 檔案遺失。請修復或重新建置這台電腦上的 nanobot;伺服器不需要安裝前端檔案。","invalid_name": "請輸入 1–64 個字元的名稱,不能包含換行。","local_connection_unavailable": "暫時無法連線到這台電腦上的 nanobot,請確認它正在執行後重試。","disconnected": "此共用連線已中斷,需要時可重新連線。",diff --git a/webui/src/lib/remote-instances.ts b/webui/src/lib/remote-instances.tsindex 4ad4097ff..3d6f580d6 100644--- a/webui/src/lib/remote-instances.ts+++ b/webui/src/lib/remote-instances.ts@@ -1,6 +1,16 @@import type { WebUIMutationTransport } from "./api";import { fetchWithTimeout } from "./http";+export interface HostCompatibility {+ status: "compatible" | "unknown" | "update_host" | "update_client";+ client_version: string;+ host_version: string;+}++export function isCompatibilityError(code: string): boolean {+ return ["webui_compatibility_unknown", "host_update_required", "client_update_required"].includes(code);+}+export interface RemoteProfile {id: string;name: string;@@ -19,6 +29,7 @@ export interface RemoteProfile {instance_id?: string;revoke_command?: string;authorized_until?: number;+ compatibility?: HostCompatibility;}export interface RemoteProfileGroup {@@ -47,12 +58,13 @@ export function groupRemoteProfiles(profiles: RemoteProfile[], currentId: string/** Persistent setup problems need a repair path, not an endless Retry button. */export function needsRemoteSetup(code: string): boolean {- return /^(pair_|host_key_|ssh_auth_failed$|ssh_agent_refused$|ssh_key_permissions$|ssh_config_|local_file_not_found$|remote_auth_failed$|incompatible_gateway$|webui_disabled$|profile_not_found$)/.test(code);+ return isCompatibilityError(code) || /^(pair_|host_key_|ssh_auth_failed$|ssh_agent_refused$|ssh_key_permissions$|ssh_config_|local_file_not_found$|local_webui_unavailable$|remote_auth_failed$|incompatible_gateway$|webui_disabled$|profile_not_found$)/.test(code);}export interface RemoteDirectory {available: boolean;machine_name?: string;+ client_version?: string;profiles: RemoteProfile[];}diff --git a/webui/src/tests/host-compatibility.test.tsx b/webui/src/tests/host-compatibility.test.tsxnew file mode 100644index 000000000..dec616dfe--- /dev/null+++ b/webui/src/tests/host-compatibility.test.tsx@@ -0,0 +1,93 @@+import { cleanup, fireEvent, render, screen, waitFor, within } from "@testing-library/react";+import { afterEach, describe, expect, it, vi } from "vitest";+import { HostCompatibilityDialog } from "@/components/remote/HostCompatibilityDialog";+import i18n from "@/i18n";+import type { RemoteProfile } from "@/lib/remote-instances";++afterEach(async () => {+ cleanup();+ vi.restoreAllMocks();+ await i18n.changeLanguage("en");+});++describe("host compatibility facts", () => {+ it.each(["en", "zh-CN", "zh-TW", "es", "fr", "pt-BR", "id", "ja", "ko", "vi"])(+ "distinguishes update precautions from the external guide (%s)", async (language) => {+ await i18n.changeLanguage(language);+ const profile: RemoteProfile = {+ id: "host", name: "Team server", host: "[email protected]", port: 22,+ config_path: "", ssh_config: "", identity_file: "", runtime_user: "", connected: false,+ compatibility: { status: "update_host", client_version: "0.3.5", host_version: "0.3.4" },+ };+ render(<HostCompatibilityDialog profile={profile} onClose={vi.fn()} />);+ const dialog = screen.getByRole("dialog");+ const guide = i18n.t("remote.compatibility.guide");+ const preparation = i18n.t("remote.compatibility.preparation");+ expect(preparation).not.toBe("remote.compatibility.preparation");+ expect(preparation).not.toBe(guide);+ expect(within(dialog).getAllByText(guide)).toHaveLength(1);+ expect(within(dialog).getByRole("link", { name: guide })).toBeVisible();+ expect(dialog.querySelector("summary")).toHaveTextContent(preparation);+ expect(dialog.querySelector("details")).toHaveTextContent(i18n.t("remote.compatibility.serverUpdateHint"));+ },+ );++ it("keeps the last host report during exit, but never reuses it for a new host", async () => {+ const getStyle = window.getComputedStyle.bind(window);+ vi.spyOn(window, "getComputedStyle").mockImplementation((node) => {+ const style = getStyle(node);+ if (node.getAttribute("role") !== "dialog") return style;+ return new Proxy(style, { get(target, property) {+ if (property === "animationName") return node.getAttribute("data-state") === "closed" ? "exit" : "enter";+ const value = Reflect.get(target, property, target);+ return typeof value === "function" ? value.bind(target) : value;+ } });+ });+ const profile: RemoteProfile = {+ id: "host", name: "Team server", host: "[email protected]", port: 22,+ config_path: "", ssh_config: "", identity_file: "", runtime_user: "", connected: true,+ compatibility: { status: "compatible", client_version: "0.3.5", host_version: "0.3.5" },+ };+ const onClose = vi.fn();+ const { rerender } = render(<HostCompatibilityDialog profile={profile} onClose={onClose} />);+ const dialog = screen.getByRole("dialog");+ rerender(<HostCompatibilityDialog profile={undefined} onClose={onClose} />);+ expect(dialog).toHaveAttribute("data-state", "closed");+ expect(dialog).toHaveTextContent("Team server");+ expect(dialog).toHaveTextContent("No update needed to connect.");+ expect(dialog).not.toHaveTextContent("Not checked yet");+ const exit = new Event("animationend", { bubbles: true });+ Object.defineProperty(exit, "animationName", { value: "exit" });+ fireEvent(dialog, exit);+ await waitFor(() => expect(dialog).not.toBeInTheDocument());+ rerender(<HostCompatibilityDialog profile={{ ...profile, id: "another", name: "Another server", compatibility: undefined }} onClose={onClose} />);+ expect(screen.getByRole("dialog")).toHaveTextContent("Another server");+ expect(screen.getByRole("status")).toHaveTextContent("Not checked yet");+ });+ it.each(["en", "zh-CN", "zh-TW", "es", "fr", "pt-BR", "id", "ja", "ko", "vi"])(+ "keeps full version values and their labels in a compact read-only group (%s)",+ async (language) => {+ await i18n.changeLanguage(language);+ const version = "0.3.5-dev+long-build-identifier-0123456789abcdef";+ const profile: RemoteProfile = {+ id: "host", name: "Team server", host: "[email protected]",+ port: 22, config_path: "", ssh_config: "", identity_file: "", runtime_user: "",+ connected: true,+ compatibility: { status: "compatible", client_version: version, host_version: version },+ };+ render(<HostCompatibilityDialog profile={profile} onClose={vi.fn()} />);+ const dialog = screen.getByRole("dialog");+ const terms = within(dialog).getAllByRole("term");+ expect(terms.map((term) => term.textContent)).toEqual([+ i18n.t("remote.compatibility.client"), i18n.t("remote.compatibility.host"),+ ]);+ const values = within(dialog).getAllByRole("definition");+ expect(values.map((value) => value.textContent)).toEqual([version, version]);+ // Read-only facts must not inherit the settings controls' 60px row floor.+ expect(dialog.querySelector(".settings-list-row")).toBeNull();+ expect(dialog.querySelector(".break-all, .truncate")).toBeNull();+ expect(within(dialog).getByRole("status")).toHaveTextContent(i18n.t("remote.compatibility.compatibleHint"));+ expect(within(dialog).queryByRole("link")).not.toBeInTheDocument();+ },+ );+});diff --git a/webui/src/tests/host-switcher.test.tsx b/webui/src/tests/host-switcher.test.tsxindex 1cd60bf25..9652c6c5c 100644--- a/webui/src/tests/host-switcher.test.tsx+++ b/webui/src/tests/host-switcher.test.tsx@@ -32,6 +32,24 @@ beforeEach(() => window.localStorage.clear());afterEach(() => { cleanup(); vi.restoreAllMocks(); });describe("host switcher", () => {+ it("announces the host only once when its display name is the hostname", () => {+ const value = { ...picker(1), name: "team-host", hostname: "team-host" };+ render(<HostNavigationContext.Provider value={value}><HostSwitcher /></HostNavigationContext.Provider>);+ expect(screen.getByRole("status").textContent).toBe("team-host · Connected");+ expect(screen.getByRole("button", { name: "Switch host" })).toHaveAttribute("title", "team-host · Connected");+ });++ it("does not borrow the local socket's Connected status while restoring a remote", () => {+ const value = picker(1);+ value.currentId = value.profiles[0].id;+ value.name = value.profiles[0].name;+ value.profiles[0].state = "connecting";+ value.pending = value.profiles[0];+ render(<HostNavigationContext.Provider value={value}><HostSwitcher /></HostNavigationContext.Provider>);+ expect(screen.getByRole("status")).not.toHaveTextContent("Connected");+ expect(screen.getByRole("status")).toHaveTextContent("Connecting");+ });+it("keeps the current host identity visible until a pending switch is ready", async () => {const value = picker(2);value.pending = value.profiles[0];diff --git a/webui/src/tests/pair-route.test.tsx b/webui/src/tests/pair-route.test.tsxindex 3571d066b..c9a3f00b2 100644--- a/webui/src/tests/pair-route.test.tsx+++ b/webui/src/tests/pair-route.test.tsx@@ -27,6 +27,7 @@ describe("paired network route", () => {it("shows direct only when no saved route is configured", () => {render(<PairRouteSettings id="paired" />);expect(screen.getByRole("combobox")).toHaveTextContent("Direct connection");+ expect(screen.getByText(i18n.t("remote.pair.routeHint"))).toBeVisible();expect(screen.getByRole("button", { name: "Save changes" })).toBeDisabled();});it("shows saving, then confirms the saved route without connecting", async () => {diff --git a/webui/src/tests/quick-pair.test.tsx b/webui/src/tests/quick-pair.test.tsxindex 0afe9ddb9..01081b490 100644--- a/webui/src/tests/quick-pair.test.tsx+++ b/webui/src/tests/quick-pair.test.tsx@@ -65,6 +65,76 @@ async function reviewed() {}describe("quick pairing", () => {+ it("keeps retry available if saving finishes as the invitation expires", async () => {+ const timer = vi.spyOn(window, "setTimeout");+ view(); await reviewed();+ const expiry = timer.mock.calls.find(([, delay]) => typeof delay === "number" && delay > 599_000)?.[0];+ expect(typeof expiry).toBe("function");+ let finish!: (value: { id: string }) => void;+ mocks.action.mockImplementation(() => new Promise((resolve) => { finish = resolve; }));+ mocks.connect.mockRejectedValueOnce(new Error("ssh_connection_closed"));+ fireEvent.click(screen.getByRole("button", { name: "Connect", exact: true }));+ act(() => { if (typeof expiry === "function") expiry(); });+ await act(async () => finish({ id: "paired-server" }));+ expect(await screen.findByRole("button", { name: "Retry", exact: true })).toBeEnabled();+ expect(screen.getByRole("heading", { name: "Open this nanobot?" })).toBeVisible();+ expect(screen.queryByRole("button", { name: "Get a new command" })).not.toBeInTheDocument();+ });+ it("replaces an expired confirmation with a new-command action", async () => {+ const timer = vi.spyOn(window, "setTimeout");+ view(); await reviewed();+ const expiry = timer.mock.calls.find(([, delay]) => typeof delay === "number" && delay > 599_000)?.[0];+ expect(typeof expiry).toBe("function");+ act(() => { if (typeof expiry === "function") expiry(); });+ expect(screen.getByRole("button", { name: "Get a new command" })).toBeEnabled();+ expect(screen.queryByRole("heading", { name: "Open this nanobot?" })).not.toBeInTheDocument();+ expect(mocks.connect).not.toHaveBeenCalled();+ });+ it.each(["pair_expired", "pair_used"])("offers a new command when manual review reports %s", async (code) => {+ mocks.action.mockImplementation(async (action: string) => {+ if (action === "remote.pair_start") return request();+ if (action === "remote.pair_preview") throw new Error(code);+ return {};+ });+ view();+ await waitFor(() => expect(screen.getByRole("button", { name: "Copy command" })).toBeEnabled());+ chooseOtherWay("Use a connection code instead");+ fireEvent.change(screen.getByRole("textbox", { name: "Connection code" }), { target: { value: "nbpc1.expired" } });+ fireEvent.click(screen.getByRole("button", { name: "Review connection" }));+ const restart = await screen.findByRole("button", { name: "Get a new command" });+ expect(screen.queryByRole("textbox", { name: "Connection code" })).not.toBeInTheDocument();+ expect(screen.queryByRole("button", { name: "Back" })).not.toBeInTheDocument();+ fireEvent.click(restart);+ await waitFor(() => expect(screen.getByRole("button", { name: "Copy command" })).toBeEnabled());+ expect(screen.queryByRole("alert")).not.toBeInTheDocument();+ expect(mocks.action.mock.calls.filter(([action]) => action === "remote.pair_start")).toHaveLength(2);+ expect(mocks.connect).not.toHaveBeenCalled();+ });+ it("does not start work when mounted only for the closing animation", () => {+ render(<Dialog open><DialogContent><QuickPairSetup active={false} onSSH={vi.fn()} onClose={vi.fn()} /></DialogContent></Dialog>);+ expect(mocks.action).not.toHaveBeenCalled();+ });+ it("ignores a preview arriving during the closing animation", async () => {+ let resolve!: (value: typeof preview) => void;+ mocks.action.mockImplementation(() => new Promise((done) => { resolve = done; }));+ const returned = { id: "request-1", code: "nbpc1.encrypted" };+ const content = (active: boolean) => <Dialog open><DialogContent><QuickPairSetup active={active} returned={returned} onSSH={vi.fn()} onClose={vi.fn()} /></DialogContent></Dialog>;+ const result = render(content(true));+ result.rerender(content(false));+ await act(async () => resolve(preview));+ expect(screen.queryByRole("heading", { name: "Open this nanobot?" })).not.toBeInTheDocument();+ expect(mocks.connect).not.toHaveBeenCalled();+ expect(mocks.action).toHaveBeenCalledTimes(1);+ });+ it("cleans up an invitation arriving during the closing animation", async () => {+ let resolve!: (value: ReturnType<typeof request>) => void;+ mocks.action.mockImplementation((action: string) => action === "remote.pair_start" ? new Promise((done) => { resolve = done; }) : Promise.resolve({}));+ const content = (active: boolean) => <Dialog open><DialogContent><QuickPairSetup active={active} onSSH={vi.fn()} onClose={vi.fn()} /></DialogContent></Dialog>;+ const result = render(content(true));+ result.rerender(content(false));+ await act(async () => resolve(request()));+ expect(mocks.action).toHaveBeenCalledWith("remote.pair_cancel", { id: "request-1" }, 65000);+ });it("uses the same copyable revocation code block in pairing details", async () => {returnedView();await screen.findByRole("heading", { name: "Open this nanobot?" });diff --git a/webui/src/tests/remote-instances.test.tsx b/webui/src/tests/remote-instances.test.tsxindex 17df5dd3e..350583781 100644--- a/webui/src/tests/remote-instances.test.tsx+++ b/webui/src/tests/remote-instances.test.tsx@@ -92,6 +92,63 @@ function chooseExistingSSH() {}describe("remote instance UX", () => {+ it.each([+ ["webui_compatibility_unknown", "unknown"],+ ["host_update_required", "update_host"],+ ["client_update_required", "update_client"],+ ])("a restored host with %s offers version guidance, not a network diagnosis", async (code, status) => {+ rememberSelectedRemote(connection);+ mocks.read.mockResolvedValue({ available: true, client_version: "1.0.0", profiles: [{ ...profile,+ compatibility: { status, client_version: "1.0.0", host_version: "2.0.0" } }] });+ mocks.request.mockRejectedValue(new Error(code));+ view();+ await screen.findByText(i18n.t(`remote.compatibility.${status}`));+ expect(screen.queryByText("Server connection lost", { exact: true })).not.toBeInTheDocument();+ fireEvent.click(screen.getByRole("button", { name: "Version & compatibility" }));+ expect(within(await screen.findByRole("dialog")).getByRole("status")).toHaveTextContent(i18n.t(`remote.compatibility.${status}`));+ expect(screen.queryByRole("textbox", { name: "SSH address" })).not.toBeInTheDocument();+ expect(readSelectedRemote()?.id).toBe(profile.id);+ });++ it.each(["compatible", "unknown", "update_host", "update_client"] as const)("explains %s compatibility without updating either machine", async (status) => {+ mocks.read.mockResolvedValue({ available: true, client_version: "1.0.0", profiles: [{ ...profile,+ compatibility: { status, client_version: "1.0.0", host_version: "2.0.0" } }] });+ view(); await openDirectory();+ fireEvent.pointerDown(screen.getByRole("button", { name: "Manage Team server" }), { button: 0, ctrlKey: false });+ fireEvent.click(screen.getByRole("menuitem", { name: "Version & compatibility" }));+ const dialog = await screen.findByRole("dialog");+ expect(within(dialog).getByText("1.0.0")).toBeVisible();+ expect(within(dialog).getByText("2.0.0")).toBeVisible();+ expect(within(dialog).getByRole("status")).toHaveTextContent(i18n.t(`remote.compatibility.${status}`));+ if (status === "compatible") expect(within(dialog).queryByRole("link")).not.toBeInTheDocument();+ else expect(within(dialog).getByRole("link", { name: "Update guide" })).toHaveAttribute("rel", "noopener noreferrer");+ expect(mocks.request).not.toHaveBeenCalled();+ });++ it("keeps an unchecked host distinct from an incompatible host", async () => {+ view(); await openDirectory();+ fireEvent.pointerDown(screen.getByRole("button", { name: "Manage Team server" }), { button: 0, ctrlKey: false });+ fireEvent.click(screen.getByRole("menuitem", { name: "Version & compatibility" }));+ const dialog = await screen.findByRole("dialog");+ expect(within(dialog).getByRole("status")).toHaveTextContent("Not checked yet");+ expect(within(dialog).queryByRole("link")).not.toBeInTheDocument();+ expect(mocks.request).not.toHaveBeenCalled();+ });++ it("opens version guidance after an incompatible connection without opening SSH configuration", async () => {+ mocks.read.mockResolvedValue({ available: true, profiles: [{ ...profile, compatibility: {+ status: "update_client", client_version: "1.0.0", host_version: "2.0.0",+ } }] });+ mocks.request.mockRejectedValueOnce(new Error("client_update_required"));+ view(false, true);+ fireEvent.click(await screen.findByRole("button", { name: "Team server [email protected]" }));+ const dialog = await screen.findByRole("dialog");+ expect(within(dialog).getByRole("status")).toHaveTextContent("Update this computer");+ expect(within(dialog).queryByRole("textbox", { name: "SSH address" })).not.toBeInTheDocument();+ expect(readSelectedRemote()).toBeNull();+ expect(mocks.request).toHaveBeenCalledTimes(1);+ });+it.each([false, true])("renames an open server without reloading its view (paired: %s)", async (paired) => {let saved = { ...profile, paired, connected: true };mocks.read.mockImplementation(async () => ({ available: true, profiles: [saved] }));@@ -112,6 +169,8 @@ describe("remote instance UX", () => {fireEvent.click(screen.getByRole("menuitem", { name: "Rename", exact: true }));const input = await screen.findByRole("textbox", { name: "Name", exact: true });expect(input).toHaveValue("Team server");+ expect(input).toHaveAccessibleName("Name");+ expect(within(screen.getByRole("dialog")).queryByText("Name", { exact: true })).not.toBeInTheDocument();expect(input).toHaveFocus();expect(input).toHaveAttribute("maxlength", "64");expect(screen.getByRole("button", { name: "Save changes" })).toBeDisabled();@@ -125,11 +184,24 @@ describe("remote instance UX", () => {expect(document.title).toBe("腾讯云 nanobot · nanobot");expect(source.postMessage).toHaveBeenLastCalledWith(expect.objectContaining({ type: "init", name: "腾讯云 nanobot" }), "http://127.0.0.1:23456");expect(mocks.request.mock.calls.map(([action]) => action)).toEqual(["remote.connect", "remote.rename"]);- await chooseHost("腾讯云 nanobot [email protected]");+ fireEvent.click(screen.getByRole("button", { name: "腾讯云 nanobot [email protected]" }));expect(screen.getByTitle("nanobot on 腾讯云 nanobot")).toBe(frame);expect(mocks.request).toHaveBeenCalledTimes(2);});+ it("explains a paired route once while preserving its credentials boundary", async () => {+ mocks.read.mockResolvedValue({ available: true, profiles: [{ ...profile, paired: true }] });+ view(); await openDirectory();+ fireEvent.pointerDown(screen.getByRole("button", { name: "Manage Team server" }), { button: 0, ctrlKey: false });+ fireEvent.click(screen.getByRole("menuitem", { name: i18n.t("remote.pair.route") }));+ const dialog = await screen.findByRole("dialog", { name: i18n.t("remote.pair.route") });+ expect(within(dialog).getAllByText(i18n.t("remote.pair.routeHint"))).toHaveLength(1);+ expect(dialog).toHaveAccessibleDescription(i18n.t("remote.pair.routeHint"));+ expect(within(dialog).queryByText(i18n.t("remote.pair.routeDescription"))).not.toBeInTheDocument();+ expect(within(dialog).getByRole("combobox", { name: i18n.t("remote.pair.route") })).toBeEnabled();+ expect(mocks.request).not.toHaveBeenCalled();+ });+it("rejects a blank name, preserves input on failure and lets the user retry or cancel", async () => {view(); await openDirectory();fireEvent.pointerDown(screen.getByRole("button", { name: "Manage Team server" }), { button: 0, ctrlKey: false });@@ -143,6 +215,7 @@ describe("remote instance UX", () => {fireEvent.change(input, { target: { value: "Cloud" } });fireEvent.click(screen.getByRole("button", { name: "Save changes" }));expect(await screen.findByRole("alert")).toHaveTextContent(i18n.t("remote.errors.local_io_error"));+ expect(input).toHaveAccessibleDescription(i18n.t("remote.errors.local_io_error"));expect(input).toHaveValue("Cloud");expect(screen.getByRole("button", { name: "Save changes" })).toBeEnabled();fireEvent.click(screen.getByRole("button", { name: "Cancel", exact: true }));@@ -311,15 +384,15 @@ describe("remote instance UX", () => {expect(readSelectedRemote()?.id).toBe(profile.id);});- it("treats local sidebar navigation as an explicit host choice without disconnecting the server", async () => {+ it("does not expose local sidebar actions while managing a remote", async () => {view();await chooseHost("Team server [email protected]");const frame = await readyRemote();await openDirectory();- fireEvent.click(screen.getByRole("button", { name: "New topic" }));- expect(screen.queryByRole("region", { name: "Remote connections" })).not.toBeInTheDocument();- expect(screen.getByText("Local conversations")).toBeVisible();- expect(readSelectedRemote()).toBeNull();+ expect(screen.queryByRole("button", { name: "New topic" })).not.toBeInTheDocument();+ expect(screen.getByRole("region", { name: "Remote connections" })).toBeVisible();+ expect(screen.getByText("Local conversations")).not.toBeVisible();+ expect(readSelectedRemote()?.id).toBe(profile.id);expect(frame).toBeInTheDocument();expect(mocks.request.mock.calls.some(([action]) => action === "remote.disconnect")).toBe(false);});@@ -665,6 +738,46 @@ describe("remote instance UX", () => {expect(mocks.request.mock.calls.some(([action]) => action === "remote.disconnect")).toBe(false);});+ it("keeps the remote sidebar and scopes management layout messages to its verified frame", async () => {+ view();+ await chooseHost("Team server [email protected]");+ const frame = await readyRemote();+ const source = { postMessage: vi.fn() };+ Object.defineProperty(frame, "contentWindow", { value: source });+ act(() => fireEvent.load(frame));+ const nonce = source.postMessage.mock.calls[0][0].nonce;+ const message = (data: Record<string, unknown>, origin = "http://127.0.0.1:23456") => act(() => {+ window.dispatchEvent(new MessageEvent("message", { source: source as unknown as Window,+ origin, data: { channel: HOST_BRIDGE, nonce, ...data } }));+ });+ message({ type: "ready" });+ document.documentElement.classList.remove("dark");+ message({ type: "surface", theme: "dark", rect: { left: 272, top: 0, width: 900, height: 800 } });+ expect(document.documentElement).not.toHaveClass("dark");+ message({ type: "open", anchor: { left: 40, top: 500, width: 150, height: 32 } });+ fireEvent.click(await screen.findByRole("menuitem", { name: "Manage connections…" }));+ const panel = screen.getByTestId("remote-management-surface");+ expect(panel).toHaveStyle({ left: "272px" });+ expect(document.documentElement).toHaveClass("dark");+ expect(frame).toBeVisible();+ expect(screen.getByText("Local conversations")).not.toBeVisible();+ expect(source.postMessage).toHaveBeenLastCalledWith(expect.objectContaining({ managing: true }), "http://127.0.0.1:23456");+ message({ type: "surface", rect: { left: 500, top: 0, width: 900, height: 800 } }, "https://untrusted.example");+ message({ type: "surface", nonce: "wrong", rect: { left: 500, top: 0, width: 900, height: 800 } });+ message({ type: "surface", rect: { left: -20, top: 0, width: 900, height: 800 } });+ expect(panel).toHaveStyle({ left: "272px" });+ message({ type: "surface", theme: "dark", rect: { left: 64, top: 0, width: 1100, height: 800 } });+ expect(panel).toHaveStyle({ left: "64px" });+ message({ type: "leave-management", nonce: "wrong" });+ expect(panel).toBeInTheDocument();+ message({ type: "leave-management" });+ expect(panel).not.toBeInTheDocument();+ expect(document.documentElement).not.toHaveClass("dark");+ expect(frame).toBeVisible();+ expect(readSelectedRemote()?.id).toBe(profile.id);+ expect(mocks.request.mock.calls.map(([action]) => action)).toEqual(["remote.connect"]);+ });+it("uses clear Chinese navigation and returns from the connection form without saving", async () => {await i18n.changeLanguage("zh-CN");view();diff --git a/webui/src/tests/settings-text-editor.test.tsx b/webui/src/tests/settings-text-editor.test.tsxnew file mode 100644index 000000000..29ad7d19a--- /dev/null+++ b/webui/src/tests/settings-text-editor.test.tsx@@ -0,0 +1,40 @@+import { cleanup, fireEvent, render, screen, waitFor, within } from "@testing-library/react";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";+import { SettingsTextEditor } from "@/components/settings/shared/SettingsTextEditor";+import i18n from "@/i18n";++beforeEach(async () => { await i18n.changeLanguage("en"); });+afterEach(() => { cleanup(); vi.restoreAllMocks(); });++describe("settings text editor copy", () => {+ it.each([undefined, "", " ", "Headers", " Headers "])(+ "does not repeat its title as a description (%s)", async (description) => {+ const warning = vi.spyOn(console, "warn");+ render(<SettingsTextEditor title="Headers" description={description} value="{}" onSave={vi.fn()} />);+ fireEvent.click(screen.getByRole("button", { name: "Headers" }));+ const dialog = await screen.findByRole("dialog", { name: "Headers" });+ expect(within(dialog).getAllByText("Headers")).toHaveLength(1);+ expect(dialog).not.toHaveAttribute("aria-describedby");+ expect(dialog).toHaveAccessibleDescription("");+ expect(within(dialog).getByRole("textbox", { name: "Headers" })).toHaveValue("{}");+ expect(within(dialog).getByRole("textbox", { name: "Headers" })).toHaveFocus();+ expect(warning).not.toHaveBeenCalled();+ },+ );++ it("keeps meaningful help associated with the dialog and saves edited values", async () => {+ const warning = vi.spyOn(console, "warn");+ const save = vi.fn();+ const help = "Use a JSON object for additional request headers.";+ render(<SettingsTextEditor title="Headers" description={help} value="{}" onSave={save} />);+ fireEvent.click(screen.getByRole("button", { name: "Headers" }));+ const dialog = await screen.findByRole("dialog", { name: "Headers" });+ expect(dialog).toHaveAccessibleDescription(help);+ expect(within(dialog).getAllByText(help)).toHaveLength(1);+ fireEvent.change(within(dialog).getByRole("textbox", { name: "Headers" }), { target: { value: '{"Accept":"application/json"}' } });+ fireEvent.click(within(dialog).getByRole("button", { name: i18n.t("settings.actions.save"), exact: true }));+ expect(save).toHaveBeenCalledWith('{"Accept":"application/json"}');+ await waitFor(() => expect(dialog).not.toBeInTheDocument());+ expect(warning).not.toHaveBeenCalled();+ });+});