Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

refactor(settings): polish desktop ACP agent status bar layout and indicators

tianma-if2bbc4246741d
diff --git a/apps/web/src/components/settings/DesktopAcpAgentCard.tsx b/apps/web/src/components/settings/DesktopAcpAgentCard.tsx
index 4e84b3e9..a5769875 100644
--- a/apps/web/src/components/settings/DesktopAcpAgentCard.tsx
+++ b/apps/web/src/components/settings/DesktopAcpAgentCard.tsx
@@ -61,6 +61,24 @@ const statusKey = (adapter: DesktopAcpAdapter | undefined, probing: boolean) =>
return `aiAssistant.agentSource.states.${adapter.state}`;
};
+const getStatusTone = ({
+ probing,
+ installing,
+ installError,
+ state,
+}: {
+ probing: boolean;
+ installing: boolean;
+ installError: boolean;
+ state?: DesktopAcpAdapter["state"];
+}) => {
+ if (installing || probing) return "loading";
+ if (installError || state === "failed") return "error";
+ if (state === "available") return "success";
+ if (state === "needs_login" || state === "not_installed") return "warning";
+ return "neutral";
+};
+
const desktopBridgeAvailable = () => (
typeof window !== "undefined" && typeof window.edgeeverDesktop?.listAcpAdapters === "function"
);
@@ -111,6 +129,17 @@ const DesktopAcpAgentCardBody = ({ bridge }: { bridge: boolean }) => {
? listedCurrent
: probed?.id === adapterId ? probed : listedCurrent;
const status = t(statusKey(shown, probing));
+ const tone = getStatusTone({
+ probing,
+ installing,
+ installError,
+ state: shown?.state,
+ });
+ const hasDetails = Boolean(
+ shown?.state === "not_installed" ||
+ shown?.state === "needs_login" ||
+ shown?.updateError
+ );
const authMethods = shown?.authMethods?.filter((method) => (
adapterId === "workbuddyCn" ? method.id !== "external" : adapterId === "workbuddyIntl" ? method.id !== "internal" : true
)) ?? [];
@@ -288,47 +317,90 @@ const DesktopAcpAgentCardBody = ({ bridge }: { bridge: boolean }) => {
</label>
) : null}
- <div className="flex items-center justify-between gap-3">
- <p className="text-xs leading-5 text-slate-600" role="status">
- {installing ? t("aiAssistant.agentSource.installing") : installError ? t("aiAssistant.agentSource.installFailed") : status}
- {shown?.managed && shown.version ? ` · v${shown.version} · ${t("aiAssistant.agentSource.autoUpdated")}` : ""}
- </p>
- <div className="flex shrink-0 gap-2">
- {shown?.state === "not_installed" && (adapterId === "codex" || adapterId === "antigravity" || (adapterId === "piAgent" && shown?.detail === "adapter_missing")) ? (
- <Button type="button" variant="outline" size="sm" className="h-8 bg-card text-xs font-normal" disabled={installing || probing} onClick={() => void install()}>
- {installing ? t("aiAssistant.agentSource.installing") : t("aiAssistant.agentSource.install")}
- </Button>
- ) : null}
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <span><Button type="button" variant="outline" size="sm" className="h-8 bg-card text-xs font-normal" disabled={probing || installing} onClick={() => void probe()}>
- {probing ? t("aiAssistant.agentSource.probing") : t("aiAssistant.agentSource.probe")}
- </Button></span>
- </TooltipTrigger>
- <TooltipContent>{t("aiAssistant.agentSource.probeHint")}</TooltipContent>
- </Tooltip>
- </TooltipProvider>
+ <div className="rounded-lg border border-slate-200/80 bg-slate-50/70 p-3 sm:p-3.5 space-y-2.5">
+ <div className="flex flex-wrap items-center justify-between gap-3">
+ <div className="flex min-w-0 flex-wrap items-center gap-2">
+ <span
+ aria-hidden="true"
+ className={cn(
+ "inline-block h-2 w-2 shrink-0 rounded-full",
+ tone === "success" && "bg-emerald-500 shadow-[0_0_4px_rgba(16,185,129,0.5)]",
+ tone === "loading" && "bg-amber-500 animate-pulse",
+ tone === "warning" && "bg-amber-500",
+ tone === "error" && "bg-rose-500 shadow-[0_0_4px_rgba(244,63,94,0.5)]",
+ tone === "neutral" && "bg-slate-400"
+ )}
+ />
+ <span
+ role="status"
+ className={cn(
+ "text-xs font-medium leading-5",
+ tone === "error" ? "text-rose-700" : tone === "warning" ? "text-amber-800" : "text-slate-900"
+ )}
+ >
+ {installing ? t("aiAssistant.agentSource.installing") : installError ? t("aiAssistant.agentSource.installFailed") : status}
+ </span>
+ {shown?.version ? (
+ <span className="inline-flex items-center rounded bg-slate-200/60 px-1.5 py-0.5 font-mono text-[11px] font-medium text-slate-600">
+ v{shown.version}
+ </span>
+ ) : null}
+ {shown?.managed ? (
+ <span className="text-[11px] text-slate-400">
+ {t("aiAssistant.agentSource.autoUpdated")}
+ </span>
+ ) : null}
+ </div>
+ <div className="flex shrink-0 items-center gap-2">
+ {shown?.state === "not_installed" && (adapterId === "codex" || adapterId === "antigravity" || (adapterId === "piAgent" && shown?.detail === "adapter_missing")) ? (
+ <Button type="button" variant="outline" size="sm" className="h-8 bg-card text-xs font-normal" disabled={installing || probing} onClick={() => void install()}>
+ {installing ? t("aiAssistant.agentSource.installing") : t("aiAssistant.agentSource.install")}
+ </Button>
+ ) : null}
+ <TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <span><Button type="button" variant="outline" size="sm" className="h-8 bg-card text-xs font-normal" disabled={probing || installing} onClick={() => void probe()}>
+ {probing ? t("aiAssistant.agentSource.probing") : t("aiAssistant.agentSource.probe")}
+ </Button></span>
+ </TooltipTrigger>
+ <TooltipContent>{t("aiAssistant.agentSource.probeHint")}</TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ </div>
</div>
+
+ {hasDetails ? (
+ <div className="space-y-2 border-t border-slate-200/70 pt-2.5">
+ {shown?.state === "not_installed" ? (
+ <p className="text-xs leading-relaxed text-slate-600">
+ {t(adapterId === "grokBuild" ? "aiAssistant.agentSource.grokBuildMissingHint" : adapterId === "deepseekHarness" ? "aiAssistant.agentSource.deepseekHarnessMissingHint" : adapterId === "piAgent" ? shown.detail === "adapter_missing" ? "aiAssistant.agentSource.piAgentAdapterMissingHint" : "aiAssistant.agentSource.piAgentMissingHint" : adapterId === "workbuddyCn" || adapterId === "workbuddyIntl" ? "aiAssistant.agentSource.workbuddyMissingHint" : "aiAssistant.agentSource.installHint")}
+ </p>
+ ) : null}
+ {shown?.state === "needs_login" && adapterId === "piAgent" ? (
+ <p className="text-xs leading-relaxed text-slate-600">{t("aiAssistant.agentSource.piAgentLoginHint")}</p>
+ ) : null}
+ {shown?.state === "needs_login" && (adapterId === "workbuddyCn" || adapterId === "workbuddyIntl") ? (
+ <p className="text-xs leading-relaxed text-slate-600">{t(adapterId === "workbuddyCn" ? "aiAssistant.agentSource.workbuddyCnLoginHint" : "aiAssistant.agentSource.workbuddyIntlLoginHint")}</p>
+ ) : null}
+ {shown?.state === "needs_login" && authMethods.length ? (
+ <div className="flex flex-wrap gap-2 pt-0.5">
+ {authMethods.map((method) => (
+ <Button key={method.id} type="button" variant="outline" size="sm" className="h-8 bg-card text-xs font-normal" disabled={authenticating} onClick={() => void authenticate(method.id)}>
+ {authenticating ? t("aiAssistant.agentSource.authenticating") : t("aiAssistant.agentSource.authenticateWith", { method: method.name })}
+ </Button>
+ ))}
+ </div>
+ ) : null}
+ {shown?.state === "needs_login" && !authMethods.length && adapterId !== "piAgent" ? (
+ <p className="text-xs text-amber-700" role="status">{t("aiAssistant.agentSource.loginUnavailable")}</p>
+ ) : null}
+ {shown?.updateError ? (
+ <p className="text-xs text-amber-700" role="status">{t("aiAssistant.agentSource.updateFailed")}</p>
+ ) : null}
+ </div>
+ ) : null}
</div>
- {shown?.state === "not_installed" ? <p className="text-xs text-slate-500">{t(adapterId === "grokBuild" ? "aiAssistant.agentSource.grokBuildMissingHint" : adapterId === "deepseekHarness" ? "aiAssistant.agentSource.deepseekHarnessMissingHint" : adapterId === "piAgent" ? shown.detail === "adapter_missing" ? "aiAssistant.agentSource.piAgentAdapterMissingHint" : "aiAssistant.agentSource.piAgentMissingHint" : adapterId === "workbuddyCn" || adapterId === "workbuddyIntl" ? "aiAssistant.agentSource.workbuddyMissingHint" : "aiAssistant.agentSource.installHint")}</p> : null}
- {shown?.state === "needs_login" && adapterId === "piAgent" ? <p className="text-xs text-slate-600">{t("aiAssistant.agentSource.piAgentLoginHint")}</p> : null}
- {shown?.state === "needs_login" && (adapterId === "workbuddyCn" || adapterId === "workbuddyIntl") ? (
- <p className="text-xs text-slate-600">{t(adapterId === "workbuddyCn" ? "aiAssistant.agentSource.workbuddyCnLoginHint" : "aiAssistant.agentSource.workbuddyIntlLoginHint")}</p>
- ) : null}
- {shown?.state === "needs_login" && authMethods.length ? (
- <div className="flex flex-wrap gap-2">
- {authMethods.map((method) => (
- <Button key={method.id} type="button" variant="outline" size="sm" className="h-8 bg-card text-xs font-normal" disabled={authenticating} onClick={() => void authenticate(method.id)}>
- {authenticating ? t("aiAssistant.agentSource.authenticating") : t("aiAssistant.agentSource.authenticateWith", { method: method.name })}
- </Button>
- ))}
- </div>
- ) : null}
- {shown?.state === "needs_login" && !authMethods.length && adapterId !== "piAgent" ? (
- <p className="text-xs text-amber-700" role="status">{t("aiAssistant.agentSource.loginUnavailable")}</p>
- ) : null}
- {shown?.updateError ? <p className="text-xs text-amber-700" role="status">{t("aiAssistant.agentSource.updateFailed")}</p> : null}
</div>
) : null}
</CardContent>