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(ui): draw the coding CLIs the backend actually has, not a list kept in the UI

Ruben Lütke97be3d4eaa1b
diff --git a/jarvis/ui/web/agent_accounts_routes.py b/jarvis/ui/web/agent_accounts_routes.py
index 076bb47e04..e6a6abfdfa 100644
--- a/jarvis/ui/web/agent_accounts_routes.py
+++ b/jarvis/ui/web/agent_accounts_routes.py
@@ -72,12 +72,26 @@ def _platform(value: str) -> str:
return value
+def _display_name(platform: str) -> str:
+ """What this CLI is called on screen, from the one registry that knows."""
+ from jarvis.workspace.agents import get_agent
+
+ entry = get_agent(platform)
+ return entry.display_name if entry is not None else platform
+
+
def _collect() -> dict[str, Any]:
"""Every account of every platform, described, plus who is active."""
return {
"platforms": [
{
"platform": platform,
+ # Sent so the UI renders whatever platforms this build has,
+ # rather than keeping its own id-to-label map — a second list of
+ # product names is a second place for a new CLI to be missing,
+ # and the way it goes missing is invisible: the backend answers
+ # correctly and the section simply is not drawn.
+ "display_name": _display_name(platform),
"active_account": agent_accounts.active_account(platform).id,
"accounts": [s.to_dict() for s in agent_accounts.snapshots(platform)],
}
diff --git a/jarvis/ui/web/frontend/src/components/AgentAccountsPanel.test.tsx b/jarvis/ui/web/frontend/src/components/AgentAccountsPanel.test.tsx
index f70caa5222..814eb00e0f 100644
--- a/jarvis/ui/web/frontend/src/components/AgentAccountsPanel.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/AgentAccountsPanel.test.tsx
@@ -223,4 +223,52 @@ describe("AgentAccountsPanel", () => {
expect(screen.getByRole("alert").textContent).toContain("backend is warming up");
});
});
+
+ it("renders a CLI this file has never heard of, using the name the API sent", async () => {
+ /*
+ * The regression this whole panel needed a guard for. It used to map over a
+ * list of platform ids written here, so a CLI the BACKEND supports was
+ * simply not drawn — and nothing failed: the payload was right, the fetch
+ * succeeded, and the section was absent. A test that only ever feeds it the
+ * two ids it already knows would pass with the feature invisible.
+ */
+ vi.mocked(fetchAgentAccounts).mockResolvedValue({
+ platforms: [
+ {
+ platform: "acme",
+ display_name: "Acme Coder",
+ active_account: "acme:default",
+ accounts: [
+ account({
+ id: "acme:default",
+ platform: "acme",
+ label: "Default Acme login",
+ config_dir: "/home/u/.acme",
+ }),
+ ],
+ },
+ ],
+ } as never);
+ render(<AgentAccountsPanel />);
+
+ // The heading comes from the payload, not from a label map here.
+ await waitFor(() => expect(screen.getByText("Acme Coder")).toBeTruthy());
+ expect(screen.getByText("Default Acme login")).toBeTruthy();
+ });
+
+ it("falls back to the platform id when an older backend sends no name", async () => {
+ vi.mocked(fetchAgentAccounts).mockResolvedValue({
+ platforms: [
+ {
+ platform: "acme",
+ active_account: "acme:default",
+ accounts: [
+ account({ id: "acme:default", platform: "acme", label: "Only seat" }),
+ ],
+ },
+ ],
+ } as never);
+ render(<AgentAccountsPanel />);
+ await waitFor(() => expect(screen.getByText("acme")).toBeTruthy());
+ });
});
diff --git a/jarvis/ui/web/frontend/src/components/AgentAccountsPanel.tsx b/jarvis/ui/web/frontend/src/components/AgentAccountsPanel.tsx
index 2f2cc31fd1..73806619bc 100644
--- a/jarvis/ui/web/frontend/src/components/AgentAccountsPanel.tsx
+++ b/jarvis/ui/web/frontend/src/components/AgentAccountsPanel.tsx
@@ -47,13 +47,6 @@ import {
import { useEventStore } from "@/store/events";
import { cn } from "@/lib/utils";
-const PLATFORM_LABEL: Record<AccountPlatform, string> = {
- claude: "Claude Code",
- codex: "Codex",
-};
-
-const PLATFORMS: AccountPlatform[] = ["claude", "codex"];
-
/** How the switch is applied — see `onActivate`. */
type Activate = (
platform: AccountPlatform,
@@ -140,11 +133,17 @@ export function AgentAccountsPanel({ onActivate, note }: AgentAccountsPanelProps
)}
<div className="grid gap-4 md:grid-cols-2 md:items-start">
- {PLATFORMS.map((platform) => (
+ {/*
+ * Rendered from what the API returned, never from a list kept here.
+ * The backend decides which CLIs can hold several subscriptions, and a
+ * hardcoded list fails in the one way nobody catches: the payload is
+ * right, the card is simply absent, and the feature looks unbuilt.
+ */}
+ {(data?.platforms ?? []).map((group) => (
<PlatformCard
- key={platform}
- platform={platform}
- group={groupFor(data, platform)}
+ key={group.platform}
+ platform={group.platform}
+ group={group}
busy={busy}
run={run}
activate={onActivate ?? setActiveAgentAccount}
@@ -190,7 +189,7 @@ function PlatformCard({
className="absolute bottom-4 left-0 top-4 w-[3px] rounded-r-full bg-violet-400/60"
/>
<div className="flex items-center justify-between gap-2">
- <h4 className="text-sm font-semibold">{PLATFORM_LABEL[platform]}</h4>
+ <h4 className="text-sm font-semibold">{group?.display_name || platform}</h4>
<span className="text-[11px] text-muted-foreground">
{accounts.length} {t("agent_accounts.accounts")}
</span>
diff --git a/jarvis/ui/web/frontend/src/lib/agentAccountsApi.ts b/jarvis/ui/web/frontend/src/lib/agentAccountsApi.ts
index b0a9fd2ad6..51de916e8c 100644
--- a/jarvis/ui/web/frontend/src/lib/agentAccountsApi.ts
+++ b/jarvis/ui/web/frontend/src/lib/agentAccountsApi.ts
@@ -4,8 +4,16 @@
// stale one here is worse than elsewhere: it would show the wrong plan as the
// active one right after the user switched.
-/** Which coding CLI a subscription belongs to. */
-export type AccountPlatform = "claude" | "codex";
+/**
+ * Which coding CLI a subscription belongs to — the backend's registry id.
+ *
+ * Deliberately an open `string` and not a union of the two ids that happened to
+ * exist when this was written. Which CLIs can hold several subscriptions is
+ * decided by the backend registry and can grow; a closed union here would not
+ * merely be out of date, it would make the compiler reject correct code that
+ * renders a platform the API actually returned.
+ */
+export type AccountPlatform = string;
/**
* One registered subscription.
@@ -35,6 +43,14 @@ export interface AgentAccount {
export interface AccountPlatformGroup {
platform: AccountPlatform;
+ /**
+ * What to show as the section heading. Sent by the backend so the UI needs no
+ * id-to-label map of its own: a second list of product names is a second
+ * place for a new CLI to go missing, and it goes missing invisibly — the API
+ * answers correctly and the section is simply never drawn. Optional because
+ * an older backend does not send it; fall back to the id.
+ */
+ display_name?: string;
active_account: string;
accounts: AgentAccount[];
}
diff --git a/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx b/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx
index bcfbcbda36..5f9743317d 100644
--- a/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx
+++ b/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx
@@ -237,10 +237,12 @@ export function AgenticIdeView() {
/** The registered subscriptions of one CLI, for the wizard's per-pane picker. */
const accountsFor = useCallback(
+ // No id guard: the backend already answers only for the CLIs that HAVE
+ // switchable subscriptions, so a list here could only ever disagree with
+ // it — and it would disagree silently, by hiding a picker for a CLI whose
+ // seats the API just returned.
(platform: string): AgentAccount[] =>
- platform === "claude" || platform === "codex"
- ? (groupFor(accounts, platform)?.accounts ?? [])
- : [],
+ groupFor(accounts, platform)?.accounts ?? [],
[accounts],
);
@@ -769,9 +771,9 @@ export function AgenticIdeView() {
{meta && installed.length === 0 && (
<Callout tone="warn">
- Neither Claude Code nor Codex was found on this machine’s PATH.
- Install one from the CLIs page, then come back — the wizard picks
- it up automatically.
+ No coding-agent CLI was found on this machine’s PATH. Install
+ one from the CLIs page, then come back — the wizard picks it up
+ automatically.
<button
type="button"
className="btn-ghost mt-2"