Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

fix(plugins): say on the card when a connected CLI is used first (#1091)

Ruben Lütke97814482e406
diff --git a/dodaios/clis/capability_provider.py b/dodaios/clis/capability_provider.py
index b37435d26b..99b54a748c 100644
--- a/dodaios/clis/capability_provider.py
+++ b/dodaios/clis/capability_provider.py
@@ -201,6 +201,33 @@ PLUGIN_CLI_OVERLAP: dict[str, str] = {
}
+def connected_overlap_clis(cli_registry: Any) -> dict[str, dict[str, str]]:
+ """Plugin id -> the connected CLI that takes precedence over it.
+
+ The same rule ``suppress_plugin_tools_covered_by_cli`` applies per turn
+ (a ``cli_<name>`` tool is active), read once for the plugins page so a
+ connected plugin's card can say its tools stand back behind the CLI
+ (#601). Each value is ``{"name": "gh", "label": "GitHub CLI"}``.
+ Defensive: an absent or failing registry yields ``{}``.
+ """
+ if cli_registry is None:
+ return {}
+ try:
+ active = {t.name for t in cli_registry.active_tools()}
+ specs = cli_registry.catalog().all()
+ out: dict[str, dict[str, str]] = {}
+ for plugin_id, cli_name in PLUGIN_CLI_OVERLAP.items():
+ if f"{TOOL_NAME_PREFIX}{cli_name}" not in active:
+ continue
+ spec = specs.get(cli_name)
+ label = str(getattr(spec, "display_name", "") or cli_name)
+ out[plugin_id] = {"name": cli_name, "label": label}
+ return out
+ except Exception: # noqa: BLE001 — a hint must never break the plugin list
+ log.debug("plugin/CLI overlap lookup failed", exc_info=True)
+ return {}
+
+
def equivalent_grants(grants: Iterable[str]) -> tuple[str, ...]:
"""A plugin grant also names the CLI for the same service.
diff --git a/dodaios/ui/web/frontend/src/i18n/locales/de.json b/dodaios/ui/web/frontend/src/i18n/locales/de.json
index 4f678c1b7e..c29a113e67 100644
--- a/dodaios/ui/web/frontend/src/i18n/locales/de.json
+++ b/dodaios/ui/web/frontend/src/i18n/locales/de.json
@@ -1550,6 +1550,7 @@
"err_pending_publisher": "Diese Verbindung wartet noch auf die Einrichtung durch den Herausgeber. Versuche es erneut, sobald die Browser-Anmeldung verfügbar ist.",
"connection_unavailable": "Verbindung nicht verfügbar",
"unsupported_device": "Auf diesem Gerät nicht unterstützt",
+ "cli_precedence": "{cli} ist verbunden und wird zuerst genutzt; nenne das {plugin}-Plugin, um es zu verwenden.",
"installed_count": "{count} installiert",
"attention_one": "{plugin} muss neu verbunden werden",
"attention_many": "{count} Verbindungen müssen neu verbunden werden",
diff --git a/dodaios/ui/web/frontend/src/i18n/locales/en.json b/dodaios/ui/web/frontend/src/i18n/locales/en.json
index 8b51adf074..ee37101bb2 100644
--- a/dodaios/ui/web/frontend/src/i18n/locales/en.json
+++ b/dodaios/ui/web/frontend/src/i18n/locales/en.json
@@ -1550,6 +1550,7 @@
"err_pending_publisher": "This connection is pending publisher setup. Please try again when browser sign-in is available.",
"connection_unavailable": "Connection unavailable",
"unsupported_device": "Unsupported on this device",
+ "cli_precedence": "{cli} is connected and is used first; name the {plugin} plugin to use it.",
"installed_count": "{count} installed",
"attention_one": "{plugin} needs reconnecting",
"attention_many": "{count} connections need reconnecting",
diff --git a/dodaios/ui/web/frontend/src/i18n/locales/es.json b/dodaios/ui/web/frontend/src/i18n/locales/es.json
index 9eda6b0b00..c55324f152 100644
--- a/dodaios/ui/web/frontend/src/i18n/locales/es.json
+++ b/dodaios/ui/web/frontend/src/i18n/locales/es.json
@@ -1550,6 +1550,7 @@
"err_pending_publisher": "Esta conexión está pendiente de configuración por parte del editor. Vuelve a intentarlo cuando el inicio de sesión en el navegador esté disponible.",
"connection_unavailable": "Conexión no disponible",
"unsupported_device": "No compatible con este dispositivo",
+ "cli_precedence": "{cli} está conectado y se usa primero; menciona el plugin de {plugin} para usarlo.",
"installed_count": "{count} instalados",
"attention_one": "Hay que reconectar {plugin}",
"attention_many": "Hay que reconectar {count} conexiones",
diff --git a/dodaios/ui/web/frontend/src/i18n/locales/pt.json b/dodaios/ui/web/frontend/src/i18n/locales/pt.json
index 48510d3ad8..dd4c288b70 100644
--- a/dodaios/ui/web/frontend/src/i18n/locales/pt.json
+++ b/dodaios/ui/web/frontend/src/i18n/locales/pt.json
@@ -1550,6 +1550,7 @@
"err_pending_publisher": "Esta ligação aguarda configuração por parte do editor. Tenta novamente quando o início de sessão no browser estiver disponível.",
"connection_unavailable": "Ligação indisponível",
"unsupported_device": "Não suportado neste dispositivo",
+ "cli_precedence": "{cli} está ligado e é usado primeiro; menciona o plugin de {plugin} para o usar.",
"installed_count": "{count} instalados",
"attention_one": "É preciso voltar a ligar {plugin}",
"attention_many": "É preciso voltar a ligar {count} ligações",
diff --git a/dodaios/ui/web/frontend/src/i18n/locales/zh.json b/dodaios/ui/web/frontend/src/i18n/locales/zh.json
index 2507996787..084535bf49 100644
--- a/dodaios/ui/web/frontend/src/i18n/locales/zh.json
+++ b/dodaios/ui/web/frontend/src/i18n/locales/zh.json
@@ -1550,6 +1550,7 @@
"err_pending_publisher": "此连接正等待发布方完成设置。浏览器登录可用后请重试。",
"connection_unavailable": "连接不可用",
"unsupported_device": "此设备不支持",
+ "cli_precedence": "{cli} 已连接并会优先使用;如需使用 {plugin} 插件,请在请求中点名该插件。",
"installed_count": "已安装 {count} 个",
"attention_one": "{plugin} 需要重新连接",
"attention_many": "{count} 个连接需要重新连接",
diff --git a/dodaios/ui/web/frontend/src/views/PluginsView.cliPrecedence.test.tsx b/dodaios/ui/web/frontend/src/views/PluginsView.cliPrecedence.test.tsx
new file mode 100644
index 0000000000..c3f3548691
--- /dev/null
+++ b/dodaios/ui/web/frontend/src/views/PluginsView.cliPrecedence.test.tsx
@@ -0,0 +1,73 @@
+/**
+ * A connected plugin whose CLI counterpart is connected too says so (#601):
+ * the CLI is used first and the plugin's tools only appear when the user
+ * names the plugin. Before, the card said only "Connected · Live".
+ *
+ * No jest-dom in this repo — assertions use plain values.
+ */
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { cleanup, render, screen } from "@testing-library/react";
+import { afterEach, describe, expect, it, vi } from "vitest";
+
+import { cliPrecedenceText, type Plugin, PluginsView } from "@/views/PluginsView";
+
+const CATALOG = {
+ version: 1,
+ schema_version: "2026-05-09",
+ total: 2,
+ connected: 2,
+ plugins: [
+ {
+ id: "github", display_name: "GitHub", description: "Repos and issues", category: "Developer",
+ logo_slug: "github", auth: { mode: "pat_paste" }, status: "connected", live_callable: true,
+ covered_by_cli: "gh", covered_by_cli_label: "GitHub CLI",
+ },
+ {
+ id: "vercel", display_name: "Vercel", description: "Deployments", category: "Developer",
+ logo_slug: "vercel", auth: { mode: "pat_paste" }, status: "connected", live_callable: true,
+ covered_by_cli: null, covered_by_cli_label: null,
+ },
+ ],
+};
+
+function plugin(over: Partial<Plugin> = {}): Plugin {
+ return {
+ id: "github", name: "GitHub", description: "d", category: "Developer", logoSlug: "github",
+ authMode: "pat_paste", authConfig: { mode: "pat_paste" }, status: "connected",
+ longevity: "permanent", oauthClientConfigured: false, fromMarketplace: false, selfUploaded: false,
+ ...over,
+ };
+}
+
+afterEach(() => {
+ cleanup();
+ vi.restoreAllMocks();
+});
+
+describe("CLI precedence hint", () => {
+ it("names the CLI and the plugin on a connected plugin row", async () => {
+ (globalThis as unknown as { fetch: typeof fetch }).fetch = vi.fn(async () => ({
+ ok: true, status: 200, json: async () => CATALOG,
+ }) as Response) as unknown as typeof fetch;
+ const client = new QueryClient({ defaultOptions: { queries: { retry: false } } });
+ render(
+ <QueryClientProvider client={client}>
+ <PluginsView />
+ </QueryClientProvider>,
+ );
+ await screen.findByRole("button", { name: "GitHub" });
+ const hints = screen.getAllByTestId("plugin-cli-precedence");
+ expect(hints.map((hint) => hint.textContent)).toEqual([
+ "GitHub CLI is connected and is used first; name the GitHub plugin to use it.",
+ ]);
+ });
+
+ it("stays silent unless the plugin is connected and a CLI covers it", () => {
+ expect(cliPrecedenceText(plugin({ coveredByCli: "GitHub CLI" }))).toBe(
+ "GitHub CLI is connected and is used first; name the GitHub plugin to use it.",
+ );
+ expect(cliPrecedenceText(plugin())).toBeUndefined();
+ expect(cliPrecedenceText(plugin({ coveredByCli: "GitHub CLI", status: "not_connected" }))).toBeUndefined();
+ expect(cliPrecedenceText(plugin({ coveredByCli: "GitHub CLI", status: "needs_reauth" }))).toBeUndefined();
+ });
+});
diff --git a/dodaios/ui/web/frontend/src/views/PluginsView.tsx b/dodaios/ui/web/frontend/src/views/PluginsView.tsx
index 2250479d6e..7a9822f6e4 100644
--- a/dodaios/ui/web/frontend/src/views/PluginsView.tsx
+++ b/dodaios/ui/web/frontend/src/views/PluginsView.tsx
@@ -137,6 +137,11 @@ interface CatalogPlugin {
auth_standard?: { ready: boolean; source: string; fallback: boolean } | null;
status: PluginStatus;
live_callable?: boolean;
+ /** The connected CLI that is used before this plugin (e.g. "gh"); the brain
+ * hides the plugin's tools unless the user names the plugin. Set only while
+ * the plugin is connected. */
+ covered_by_cli?: string | null;
+ covered_by_cli_label?: string | null;
unavailable_reason?: string | null;
/** Stable code for `unavailable_reason` (dodaios/marketplace/amd_mcp.py
* AMD_UNAVAILABLE_REASONS); translated at render, else the English text. */
@@ -239,6 +244,8 @@ export interface Plugin {
status: PluginStatus;
featured?: boolean;
liveCallable?: boolean;
+ /** Display name of the connected CLI that is used before this plugin. */
+ coveredByCli?: string;
unavailableReason?: string;
unavailableReasonCode?: string;
longevity: Longevity;
@@ -280,6 +287,17 @@ export function unavailableReasonText(plugin: Plugin): string | undefined {
);
}
+/** The quiet line on a connected plugin whose CLI counterpart is connected
+ * too: the CLI is used first, so the plugin's tools only appear when the
+ * user names the plugin (#601). Undefined when no CLI stands in front. */
+export function cliPrecedenceText(plugin: Plugin): string | undefined {
+ if (plugin.status !== "connected" || !plugin.coveredByCli) return undefined;
+ return fill(translate("plugins_view.cli_precedence"), {
+ cli: plugin.coveredByCli,
+ plugin: plugin.name,
+ });
+}
+
/** A shipped plugin's longevity note in the UI language (keyed by plugin id);
* a marketplace or uploaded plugin's own note is shown as published. */
function longevityNoteText(plugin: Plugin): string | undefined {
@@ -308,6 +326,7 @@ function adapt(p: CatalogPlugin): Plugin {
status: p.status,
featured: p.featured ?? false,
liveCallable: p.live_callable ?? false,
+ coveredByCli: p.covered_by_cli ? (p.covered_by_cli_label || p.covered_by_cli) : undefined,
unavailableReason: p.unavailable_reason ?? undefined,
unavailableReasonCode: p.unavailable_reason_code ?? undefined,
longevity: p.longevity ?? "self_renewing",
@@ -1458,11 +1477,16 @@ function PluginDetail({
</div>
</header>
- {(plugin.unavailableReason || plugin.status === "needs_reauth" || plugin.description) && (
+ {(plugin.unavailableReason || plugin.status === "needs_reauth" || plugin.description || cliPrecedenceText(plugin)) && (
<div className="flex flex-col gap-3">
{plugin.unavailableReason && (
<p className="text-base text-muted-foreground">{unavailableReasonText(plugin)}</p>
)}
+ {cliPrecedenceText(plugin) && (
+ <p data-testid="plugin-cli-precedence" className="text-xs text-muted-foreground">
+ {cliPrecedenceText(plugin)}
+ </p>
+ )}
{plugin.status === "needs_reauth" ? (
<div className="rounded-lg bg-secondary px-3 py-2.5 text-xs">
<ReauthExplanation plugin={plugin} />
diff --git a/dodaios/ui/web/frontend/src/views/plugins/PluginBrowse.tsx b/dodaios/ui/web/frontend/src/views/plugins/PluginBrowse.tsx
index 0b06855e26..03c00cb865 100644
--- a/dodaios/ui/web/frontend/src/views/plugins/PluginBrowse.tsx
+++ b/dodaios/ui/web/frontend/src/views/plugins/PluginBrowse.tsx
@@ -40,6 +40,7 @@ import type { AddPluginMode } from "@/views/AddConnectorDialog";
import {
BrandTile,
categoryLabel,
+ cliPrecedenceText,
GrantExpiry,
type Plugin,
pluginStatusLabel,
@@ -279,6 +280,11 @@ export function PluginRow({
{plugin.status === "needs_reauth" && (
<span className="block truncate text-xs text-warning"><ReauthExplanation plugin={plugin} inline /></span>
)}
+ {cliPrecedenceText(plugin) && (
+ <span data-testid="plugin-cli-precedence" className="block truncate text-xs text-muted-foreground" title={cliPrecedenceText(plugin)}>
+ {cliPrecedenceText(plugin)}
+ </span>
+ )}
<GrantExpiry plugin={plugin} />
</span>
</span>
diff --git a/dodaios/ui/web/marketplace_routes.py b/dodaios/ui/web/marketplace_routes.py
index cb6cc8ef9f..52ab9be014 100644
--- a/dodaios/ui/web/marketplace_routes.py
+++ b/dodaios/ui/web/marketplace_routes.py
@@ -397,7 +397,10 @@ def _mcp_live(
@router.get("/plugins")
-async def list_plugins(response: Response) -> dict[str, Any]:
+async def list_plugins(
+ response: Response,
+ request: Request = None, # type: ignore[assignment] # direct calls in tests pass none
+) -> dict[str, Any]:
# Never let an embedded webview (pywebview/WebView2) serve a stale cached
# plugin list: WebView2 heuristically caches this GET, so after a catalog
# change the desktop window kept showing the old/empty list while a fresh
@@ -408,6 +411,13 @@ async def list_plugins(response: Response) -> dict[str, Any]:
store = TokenStore()
enriched: list[dict[str, Any]] = []
connected = 0
+ # A connected CLI for the same service takes precedence: the brain hides
+ # this plugin's tools unless the user names the plugin (#601). The card
+ # says so instead of a bare "Connected · Live".
+ from dodaios.clis.capability_provider import connected_overlap_clis
+
+ cli_registry = getattr(request.app.state, "cli_registry", None) if request is not None else None
+ covering_clis = connected_overlap_clis(cli_registry)
for spec in catalog.plugins:
item = spec.model_dump(mode="json")
meta = _plugin_status_meta(spec.id, store)
@@ -471,6 +481,9 @@ async def list_plugins(response: Response) -> dict[str, Any]:
except Exception: # noqa: BLE001
native_live = False
item["live_callable"] = mcp_live or native_live
+ covering = covering_clis.get(spec.id) if status == "connected" else None
+ item["covered_by_cli"] = covering["name"] if covering else None
+ item["covered_by_cli_label"] = covering["label"] if covering else None
if status == "connected":
connected += 1
enriched.append(item)
diff --git a/tests/unit/marketplace/test_plugin_cli_overlap_hint.py b/tests/unit/marketplace/test_plugin_cli_overlap_hint.py
new file mode 100644
index 0000000000..f03e5439a7
--- /dev/null
+++ b/tests/unit/marketplace/test_plugin_cli_overlap_hint.py
@@ -0,0 +1,95 @@
+"""The plugins list says when a connected CLI takes precedence (#601).
+
+With the GitHub CLI connected, the brain hides the GitHub plugin's tools
+unless the user names the plugin (``suppress_plugin_tools_covered_by_cli``).
+The card used to say only "Connected · Live"; the list now carries
+``covered_by_cli`` so the card can explain it.
+"""
+
+from types import SimpleNamespace
+
+from fastapi import FastAPI
+from fastapi.testclient import TestClient
+
+from dodaios.marketplace.catalog import PluginCatalog, PluginSpec
+from dodaios.marketplace.token_store import InMemoryBackend, Tokens, TokenStore
+from dodaios.ui.web import marketplace_routes
+
+
+def _catalog() -> PluginCatalog:
+ def spec(plugin_id: str, name: str) -> PluginSpec:
+ return PluginSpec(
+ id=plugin_id,
+ display_name=name,
+ description=name,
+ category="Developer",
+ logo_slug=plugin_id,
+ auth={
+ "mode": "pat_paste",
+ "token_creation_url": "https://example.test/tokens",
+ "token_prefix": "tok",
+ "validation_endpoint": "https://example.test/user",
+ "instruction_md": "Paste a token.",
+ },
+ )
+
+ return PluginCatalog(
+ version=1,
+ schema_version="test",
+ plugins=[spec("github", "GitHub"), spec("vercel", "Vercel")],
+ )
+
+
+class _FakeCliRegistry:
+ """Only the two calls the overlap lookup makes."""
+
+ def __init__(self, active: list[str]) -> None:
+ self._active = active
+
+ def active_tools(self) -> list[SimpleNamespace]:
+ return [SimpleNamespace(name=f"cli_{name}") for name in self._active]
+
+ def catalog(self) -> SimpleNamespace:
+ specs = {
+ "gh": SimpleNamespace(display_name="GitHub CLI"),
+ "vercel": SimpleNamespace(display_name="Vercel CLI"),
+ }
+ return SimpleNamespace(all=lambda: specs)
+
+
+def _client(monkeypatch, *, active_clis: list[str] | None, connected: list[str]) -> TestClient:
+ store = TokenStore(InMemoryBackend())
+ for plugin_id in connected:
+ store.save(plugin_id, Tokens(access="tok"))
+ monkeypatch.setattr(marketplace_routes, "load_catalog", _catalog)
+ monkeypatch.setattr(marketplace_routes, "TokenStore", lambda: store)
+ app = FastAPI()
+ app.include_router(marketplace_routes.router)
+ if active_clis is not None:
+ app.state.cli_registry = _FakeCliRegistry(active_clis)
+ return TestClient(app)
+
+
+def _items(client: TestClient) -> dict[str, dict]:
+ resp = client.get("/api/marketplace/plugins")
+ assert resp.status_code == 200
+ return {item["id"]: item for item in resp.json()["plugins"]}
+
+
+def test_connected_plugin_names_the_cli_that_takes_precedence(monkeypatch):
+ items = _items(_client(monkeypatch, active_clis=["gh"], connected=["github", "vercel"]))
+ assert items["github"]["covered_by_cli"] == "gh"
+ assert items["github"]["covered_by_cli_label"] == "GitHub CLI"
+ # The Vercel CLI is not connected, so the Vercel plugin is used as usual.
+ assert items["vercel"]["covered_by_cli"] is None
+
+
+def test_no_hint_while_the_plugin_itself_is_not_connected(monkeypatch):
+ items = _items(_client(monkeypatch, active_clis=["gh"], connected=[]))
+ assert items["github"]["covered_by_cli"] is None
+
+
+def test_no_hint_without_a_cli_registry(monkeypatch):
+ items = _items(_client(monkeypatch, active_clis=None, connected=["github"]))
+ assert items["github"]["covered_by_cli"] is None
+ assert items["github"]["covered_by_cli_label"] is None