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.

feat(ui): double-click a provider row to make it the active one

rubenluetke10-beepcec93666fddc
diff --git a/jarvis/ui/web/frontend/src/components/JarvisAgentSection.model.test.tsx b/jarvis/ui/web/frontend/src/components/JarvisAgentSection.model.test.tsx
index d3e11feeac..59d5a2594a 100644
--- a/jarvis/ui/web/frontend/src/components/JarvisAgentSection.model.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/JarvisAgentSection.model.test.tsx
@@ -119,6 +119,36 @@ describe("JarvisAgentSection — dedicated subagent LLM dropdown", () => {
});
});
+ it("makes a worker the active one on a double click of its row", async () => {
+ const status = {
+ ...STATUS,
+ mapping: [{ ...OPENAI_AGENT_ROW, key_set: true, dedicated_key_set: true }],
+ };
+ const fetchMock = vi.fn().mockImplementation(async (url: string, init?: RequestInit) => {
+ const u = String(url);
+ if (u.includes("/api/jarvis-agent/status")) return { ok: true, json: async () => status };
+ if (u.includes("/api/jarvis-agent/switch")) {
+ return { ok: true, json: async () => ({ ok: true, provider: "openai", restart_required: false }) };
+ }
+ void init;
+ return { ok: true, json: async () => ({}) };
+ });
+ vi.stubGlobal("fetch", fetchMock);
+
+ render(<JarvisAgentSection />);
+ const title = await screen.findByText("OpenAI");
+ // A real double click is click, click, dblclick — exactly one switch.
+ fireEvent.click(title);
+ fireEvent.click(title, { detail: 2 });
+ fireEvent.doubleClick(title);
+
+ await waitFor(() =>
+ expect(
+ fetchMock.mock.calls.filter((c) => String(c[0]).includes("/api/jarvis-agent/switch")),
+ ).toHaveLength(1),
+ );
+ });
+
it("renders a dedicated API-key input on the Jarvis-Agents card", async () => {
const status = { ...STATUS, mapping: [OPENAI_AGENT_ROW] };
vi.stubGlobal(
diff --git a/jarvis/ui/web/frontend/src/components/JarvisAgentSection.tsx b/jarvis/ui/web/frontend/src/components/JarvisAgentSection.tsx
index 70bbfa48a0..fe2834ae11 100644
--- a/jarvis/ui/web/frontend/src/components/JarvisAgentSection.tsx
+++ b/jarvis/ui/web/frontend/src/components/JarvisAgentSection.tsx
@@ -30,6 +30,7 @@ import { ApiKeyForm } from "@/components/ApiKeyForm";
import { AgentAccountsPanel } from "@/components/AgentAccountsPanel";
import { Button } from "@/components/ui/button";
import { ProviderLogo } from "@/components/providers/ProviderLogo";
+import { useRowGestures } from "@/components/providers/rowGestures";
import {
LocalModeNotice,
LocalModelDownloadPanel,
@@ -680,6 +681,7 @@ function AgentRow({
active = false,
expanded = false,
onToggle,
+ onActivate,
tooltip,
testId,
}: {
@@ -698,24 +700,19 @@ function AgentRow({
active?: boolean;
expanded?: boolean;
onToggle?: () => void;
+ /** Double-click action: make this the worker (the Use control's path). */
+ onActivate?: () => void;
/** Native hover tooltip for the row header. */
tooltip?: string;
testId?: string;
}) {
const collapsible = Boolean(body && onToggle);
-
- function handleRowClick(e: React.MouseEvent<HTMLDivElement>) {
- if (!collapsible) return;
- const target = e.target as HTMLElement | null;
- if (
- target?.closest(
- "input, label, button, a, select, textarea, [data-agent-card-control]",
- )
- ) {
- return;
- }
- onToggle?.();
- }
+ // One click opens the body, a double click makes this the worker — the
+ // same path as the Use control (see rowGestures.ts).
+ const rowGestures = useRowGestures({
+ onToggle: collapsible ? onToggle : undefined,
+ onActivate,
+ });
return (
<li
@@ -733,7 +730,8 @@ function AgentRow({
role={collapsible ? "button" : undefined}
tabIndex={collapsible ? 0 : undefined}
aria-expanded={collapsible ? expanded : undefined}
- onClick={handleRowClick}
+ onClick={rowGestures.onClick}
+ onDoubleClick={rowGestures.onDoubleClick}
onKeyDown={(e) => {
if (!collapsible || e.target !== e.currentTarget) return;
if (e.key === "Enter" || e.key === " ") {
@@ -1045,6 +1043,7 @@ function CodexConnectionCard({
return (
<AgentRow
testId="agent-row-openai-codex"
+ onActivate={() => void activate()}
label="OpenAI Codex"
slug={row?.jarvis}
title="OpenAI Codex"
@@ -1176,6 +1175,7 @@ function AntigravityConnectionCard({
return (
<AgentRow
testId="agent-row-antigravity"
+ onActivate={() => void activate()}
label="Antigravity"
slug={row?.jarvis}
title="Antigravity"
@@ -1285,6 +1285,7 @@ function GrokBuildConnectionCard({
return (
<AgentRow
testId="agent-row-grok-build"
+ onActivate={() => void activate()}
label="Grok Build"
slug={row?.jarvis}
title="Grok Build"
@@ -1399,6 +1400,7 @@ function ClaudeConnectionCard({
return (
<AgentRow
testId="agent-row-claude-subscription"
+ onActivate={() => void activate()}
label="Anthropic Claude"
slug={row?.jarvis}
title="Anthropic Claude"
@@ -1479,6 +1481,7 @@ function ClaudeApiCard({
return (
<AgentRow
testId="agent-row-claude-api"
+ onActivate={() => void activate()}
label="Anthropic Claude"
slug={row?.jarvis}
title="Anthropic Claude"
@@ -1489,7 +1492,7 @@ function ClaudeApiCard({
isActive
? `This ${brand} provider is active`
: keySet
- ? `Activate this ${brand} provider`
+ ? `Double-click to make this the ${brand} provider`
: `Save a dedicated Claude ${brand} key first`
}
state={isActive ? "active" : keySet ? STATE_KEY_SAVED : STATE_NO_KEY}
@@ -1601,6 +1604,7 @@ function SubagentProviderCard({
return (
<AgentRow
testId={`agent-row-${row.jarvis}`}
+ onActivate={() => void activate()}
label={label}
slug={row.jarvis}
title={label}
@@ -1611,7 +1615,7 @@ function SubagentProviderCard({
row.is_active_brain
? `This ${brand} provider is active`
: row.key_set
- ? `Activate this ${brand} provider`
+ ? `Double-click to make this the ${brand} provider`
: "Set an API key first"
}
// A keyless row has no key to wait for: it is ready as soon as it is
@@ -1704,7 +1708,7 @@ function SubagentActiveControl({
const labelTitle = isActive
? `This ${brand} provider is active`
: row.key_set
- ? `Activate this ${brand} provider`
+ ? `Double-click to make this the ${brand} provider`
: "Set an API key first";
return (
diff --git a/jarvis/ui/web/frontend/src/components/providers/ProviderTierSection.test.tsx b/jarvis/ui/web/frontend/src/components/providers/ProviderTierSection.test.tsx
index d722778250..1e30dac958 100644
--- a/jarvis/ui/web/frontend/src/components/providers/ProviderTierSection.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/providers/ProviderTierSection.test.tsx
@@ -187,6 +187,22 @@ describe("ProviderCard — dictation polish activation", () => {
cleanup();
});
+ it("activates on a double click of the row, never on a single click", async () => {
+ const calls = installFetchMock();
+
+ renderCard(dictationCard());
+ const title = screen.getByText("OpenAI: dictation polish");
+ // A real double click: click, click, dblclick — one activation.
+ fireEvent.click(title);
+ fireEvent.click(title, { detail: 2 });
+ fireEvent.doubleClick(title);
+
+ await waitFor(() => expect(polishPin(calls).polish_provider).toBe("openai"));
+ expect(
+ calls.filter((c) => c.method === "PUT" && c.url.startsWith("/api/dictation/settings")),
+ ).toHaveLength(1);
+ });
+
it("pins the polish FAMILY, not the card id", async () => {
const calls = installFetchMock();
diff --git a/jarvis/ui/web/frontend/src/components/providers/ProviderTierSection.tsx b/jarvis/ui/web/frontend/src/components/providers/ProviderTierSection.tsx
index 5212e7ce10..b081e8b6a4 100644
--- a/jarvis/ui/web/frontend/src/components/providers/ProviderTierSection.tsx
+++ b/jarvis/ui/web/frontend/src/components/providers/ProviderTierSection.tsx
@@ -7,6 +7,7 @@ import { OpenRouterTtsControls } from "@/components/OpenRouterTtsVoicePicker";
import { CuModelSelector } from "@/components/CuModelSelector";
import { RealtimeOptionsControl } from "@/components/RealtimeOptionsControl";
import { ProviderLogo } from "@/components/providers/ProviderLogo";
+import { useRowGestures } from "@/components/providers/rowGestures";
import { Button } from "@/components/ui/button";
import { BrandedSelect } from "@/components/ui/select";
import {
@@ -1243,26 +1244,17 @@ export function ProviderCard({
}
}
- // A click on the row opens or closes the editor body. Activation is the job
- // of the "Use" control on the row — not of the row itself, which used to
- // switch providers on any click, including a double click that fired
- // activate() three times and stacked three identical warnings. Clicks on
- // the row's own controls (the Use radio, a tag's tooltip target) are left to
- // those controls.
- function handleRowClick(e: React.MouseEvent<HTMLDivElement>) {
- if (!onToggleExpanded) return;
- const target = e.target as HTMLElement | null;
- if (
- target &&
- (target.closest("input") ||
- target.closest("button") ||
- target.closest("a") ||
- target.closest("label"))
- ) {
- return;
- }
- onToggleExpanded();
- }
+ // One click on the row opens or closes the editor body; a double click
+ // activates the provider — the same path as the Use control, with the same
+ // guards and the same warning when a key is missing. A card that cannot be
+ // switched (an agents-only brain, a Codex login that is not a brain) has no
+ // double-click action. See rowGestures.ts for why a single click waits out
+ // the double-click window.
+ const canSwitch = isBrainSwitchable && !isCodexBrain;
+ const rowGestures = useRowGestures({
+ onToggle: onToggleExpanded,
+ onActivate: canSwitch ? () => void activate() : undefined,
+ });
// Called by ApiKeyForm as soon as a key has been saved for a previously
// unconfigured provider. If no one else is active in this tier, the
@@ -1333,7 +1325,7 @@ export function ProviderCard({
: !isBrainSwitchable
? t("apikeys_view.agents_only_short").replace("{0}", agentsBrand(assistantName))
: descriptor.configured
- ? t("apikeys_view.click_to_activate")
+ ? t("apikeys_view.double_click_to_activate")
: descriptor.auth_mode === "codex"
? t("apikeys_view.needs_codex")
: descriptor.auth_mode === "antigravity"
@@ -1365,7 +1357,8 @@ export function ProviderCard({
aria-expanded={collapsible ? expanded : undefined}
aria-controls={collapsible ? `provider-body-${descriptor.id}` : undefined}
data-testid={`provider-row-${descriptor.id}`}
- onClick={handleRowClick}
+ onClick={rowGestures.onClick}
+ onDoubleClick={rowGestures.onDoubleClick}
onKeyDown={(e) => {
if (!collapsible) return;
if (e.target !== e.currentTarget) return;
diff --git a/jarvis/ui/web/frontend/src/components/providers/rowGestures.ts b/jarvis/ui/web/frontend/src/components/providers/rowGestures.ts
new file mode 100644
index 0000000000..c3ccfcdf30
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/providers/rowGestures.ts
@@ -0,0 +1,83 @@
+import { useCallback, useEffect, useRef } from "react";
+import type React from "react";
+
+/**
+ * The two pointer gestures a provider row understands.
+ *
+ * One click opens or closes the editor body; a double click activates the
+ * provider (maintainer request 2026-08-23: "double-click a block anywhere —
+ * Realtime, Tool Model, Voice, the agents — and it is selected"). The two
+ * have to be told apart, because a double click is delivered as click, click,
+ * dblclick: toggling on each click would flash the body open and shut (and
+ * mount its panels, which poll) before the activation even fires.
+ *
+ * So a single click waits out the double-click window before it toggles, and
+ * the second click of a double cancels it. The window is short enough to
+ * read as immediate and long enough for a normal double click; keyboard
+ * activation (Enter/Space) never waits — it is unambiguous.
+ *
+ * Clicks on the row's own controls — the Use radio, a button, a link, an
+ * input, or anything marked `data-agent-card-control` — belong to those
+ * controls and are ignored here.
+ */
+const DOUBLE_CLICK_WINDOW_MS = 220;
+
+const CONTROL_SELECTOR =
+ "input, label, button, a, select, textarea, summary, [data-agent-card-control]";
+
+export function isRowControlTarget(target: EventTarget | null): boolean {
+ return Boolean(target && (target as HTMLElement).closest?.(CONTROL_SELECTOR));
+}
+
+export function useRowGestures({
+ onToggle,
+ onActivate,
+}: {
+ /** Open/close the body; absent when the row has nothing to open. */
+ onToggle?: () => void;
+ /** Make this provider the active one; absent when the row cannot switch. */
+ onActivate?: () => void;
+}) {
+ const pending = useRef<ReturnType<typeof setTimeout> | null>(null);
+
+ const cancelPending = useCallback(() => {
+ if (pending.current !== null) {
+ clearTimeout(pending.current);
+ pending.current = null;
+ }
+ }, []);
+
+ // A row that unmounts mid-window (a refetch re-keyed the list) must not
+ // toggle a component that no longer exists.
+ useEffect(() => cancelPending, [cancelPending]);
+
+ const onClick = useCallback(
+ (e: React.MouseEvent) => {
+ if (isRowControlTarget(e.target)) return;
+ // The second click of a double: the first one is still waiting — drop
+ // it, the dblclick handler takes over.
+ if (e.detail >= 2) {
+ cancelPending();
+ return;
+ }
+ if (!onToggle) return;
+ cancelPending();
+ pending.current = setTimeout(() => {
+ pending.current = null;
+ onToggle();
+ }, DOUBLE_CLICK_WINDOW_MS);
+ },
+ [onToggle, cancelPending],
+ );
+
+ const onDoubleClick = useCallback(
+ (e: React.MouseEvent) => {
+ if (isRowControlTarget(e.target)) return;
+ cancelPending();
+ onActivate?.();
+ },
+ [onActivate, cancelPending],
+ );
+
+ return { onClick, onDoubleClick };
+}
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index 275936bc94..36e1c0af6f 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -1536,6 +1536,7 @@
"model_picker_activate_hint": "Aktiviere diesen Provider, um seine Stimme oder sein Modell zu wählen.",
"active_tooltip": "Bereits aktiv",
"click_to_activate": "Klick aktiviert diesen Provider",
+ "double_click_to_activate": "Doppelklick aktiviert diesen Provider · Klick öffnet die Einstellungen",
"provider_active": "Aktiv",
"provider_set_active": "Aktivieren",
"provider_activating": "Wird aktiviert…",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index e949f38209..b8bc45c459 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -1536,6 +1536,7 @@
"model_picker_activate_hint": "Activate this provider to choose its voice or model.",
"active_tooltip": "Already active",
"click_to_activate": "Click to activate this provider",
+ "double_click_to_activate": "Double-click to activate this provider · click to open its settings",
"provider_active": "Active",
"provider_set_active": "Set active",
"provider_activating": "Activating…",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index be764c7554..1a7196a973 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -1536,6 +1536,7 @@
"model_picker_activate_hint": "Activa este proveedor para elegir su voz o modelo.",
"active_tooltip": "Ya activo",
"click_to_activate": "Clic para activar este proveedor",
+ "double_click_to_activate": "Doble clic para activar este proveedor · clic para abrir sus ajustes",
"provider_active": "Activo",
"provider_set_active": "Activar",
"provider_activating": "Activando…",
diff --git a/jarvis/ui/web/frontend/src/views/ApiKeysView.antigravity.test.tsx b/jarvis/ui/web/frontend/src/views/ApiKeysView.antigravity.test.tsx
index 2507fc3898..91cf58cdd8 100644
--- a/jarvis/ui/web/frontend/src/views/ApiKeysView.antigravity.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/ApiKeysView.antigravity.test.tsx
@@ -296,10 +296,12 @@ describe("ApiKeysView — Antigravity (Google subscription) OAuth card", () => {
screen.getByText("Connect"),
);
expect((connectBtn.closest("button") as HTMLButtonElement).disabled).toBe(true);
- // The install hint sits in the row body; open the row first.
+ // The install hint sits in the row body; open the row first. A single
+ // click waits out the double-click window before it opens (a double click
+ // activates), so the hint arrives a beat later.
fireEvent.click(screen.getByText("Antigravity"));
expect(
- screen.getByText("Install Antigravity or the Gemini CLI before connecting."),
+ await screen.findByText("Install Antigravity or the Gemini CLI before connecting."),
).toBeTruthy();
});