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.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
feat(apikeys): add Computer-Use panel to Realtime mode (Feature B)
Ruben Lütkecca79b6282bc
diff --git a/jarvis/ui/web/frontend/src/components/RealtimeComputerUsePanel.test.tsx b/jarvis/ui/web/frontend/src/components/RealtimeComputerUsePanel.test.tsxnew file mode 100644index 0000000000..164b68d5fa--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/RealtimeComputerUsePanel.test.tsx@@ -0,0 +1,113 @@+/**+ * Component tests for `RealtimeComputerUsePanel` (Feature B — the Computer-Use+ * panel embedded in Realtime mode on the API-Keys screen).+ *+ * Realtime speech-to-speech models can't see the screen, so Computer-Use+ * during a realtime turn falls back to the ACTIVE Brain provider — exactly+ * what CU already runs on today. These tests pin: (1) the panel names the+ * active Brain provider and forwards its id (never a realtime id) to+ * `CuModelSelector`, (2) an active REALTIME provider is ignored when+ * resolving "the active Brain provider", and (3) with no active Brain+ * provider the panel shows a hint instead of the selector.+ */+import { afterEach, describe, expect, it, vi } from "vitest";+import { cleanup, render, screen } from "@testing-library/react";++// Stub CuModelSelector so this test asserts exactly what the panel passes it+// (providerId / recommendedModel), without pulling in its own network calls —+// that component has its own tests.+vi.mock("@/components/CuModelSelector", () => ({+ CuModelSelector: ({+ providerId,+ recommendedModel,+ }: {+ providerId: string;+ recommendedModel?: string | null;+ }) => (+ <div+ data-testid="cu-model-selector-stub"+ data-provider-id={providerId}+ data-recommended-model={recommendedModel ?? ""}+ />+ ),+}));++let mockProviders: Array<Record<string, unknown>> = [];+vi.mock("@/hooks/useProviders", () => ({+ useProviders: () => ({+ providers: mockProviders,+ loading: false,+ error: null,+ refetch: vi.fn(),+ setActiveOptimistic: vi.fn(),+ }),+}));++import { RealtimeComputerUsePanel } from "@/components/RealtimeComputerUsePanel";++afterEach(() => {+ cleanup();+ mockProviders = [];+});++function brainProvider(overrides: Record<string, unknown> = {}) {+ return {+ id: "openrouter",+ label: "OpenRouter",+ tier: "brain",+ active: true,+ recommended_model: "some-model",+ ...overrides,+ };+}++function realtimeProvider(overrides: Record<string, unknown> = {}) {+ return {+ id: "openai-realtime",+ label: "OpenAI Realtime",+ tier: "realtime",+ active: true,+ ...overrides,+ };+}++describe("RealtimeComputerUsePanel", () => {+ it("names the active Brain provider and passes the BRAIN id + recommended model to CuModelSelector", () => {+ mockProviders = [brainProvider(), realtimeProvider()];+ render(<RealtimeComputerUsePanel />);++ expect(screen.getByTestId("realtime-cu-panel").textContent).toMatch(/OpenRouter/);+ const stub = screen.getByTestId("cu-model-selector-stub");+ expect(stub.getAttribute("data-provider-id")).toBe("openrouter");+ expect(stub.getAttribute("data-recommended-model")).toBe("some-model");+ });++ it("ignores an active REALTIME provider — only the active BRAIN provider resolves", () => {+ mockProviders = [+ brainProvider({ id: "gemini", label: "Gemini", active: true }),+ realtimeProvider({ active: true }),+ ];+ render(<RealtimeComputerUsePanel />);++ const stub = screen.getByTestId("cu-model-selector-stub");+ expect(stub.getAttribute("data-provider-id")).toBe("gemini");+ expect(stub.getAttribute("data-provider-id")).not.toBe("openai-realtime");+ });++ it("shows a hint pointing back to Pipeline -> Brain instead of CuModelSelector when no Brain provider is active", () => {+ mockProviders = [brainProvider({ active: false }), realtimeProvider()];+ render(<RealtimeComputerUsePanel />);++ expect(screen.queryByTestId("cu-model-selector-stub")).toBeNull();+ const hint = screen.getByTestId("realtime-cu-no-brain-hint");+ expect(hint.textContent).toMatch(/Brain/i);+ });++ it("shows the hint when there are no providers at all", () => {+ mockProviders = [];+ render(<RealtimeComputerUsePanel />);++ expect(screen.queryByTestId("cu-model-selector-stub")).toBeNull();+ expect(screen.getByTestId("realtime-cu-no-brain-hint")).toBeTruthy();+ });+});diff --git a/jarvis/ui/web/frontend/src/components/RealtimeComputerUsePanel.tsx b/jarvis/ui/web/frontend/src/components/RealtimeComputerUsePanel.tsxnew file mode 100644index 0000000000..723a045c8b--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/RealtimeComputerUsePanel.tsx@@ -0,0 +1,62 @@+import { CuModelSelector } from "@/components/CuModelSelector";+import { useProviders } from "@/hooks/useProviders";+import { useT } from "@/i18n";++/**+ * Realtime mode's Computer-Use delegation panel (Feature B).+ *+ * Realtime speech-to-speech models (`openai-realtime`, `gemini-live`) are pure+ * audio — they have no vision/screen and no tool-call event+ * (`jarvis/realtime/protocol.py`), so they can never run Computer-Use+ * themselves. Computer-Use already runs on the ACTIVE Brain provider today+ * (`jarvis/brain/brain_call.py` → `_build_fallback_chain("fast")` leads with+ * `brain.primary`), so this panel just makes that delegation visible inside+ * the Realtime tab and lets the user pin a Computer-Use model for it — no new+ * "CU provider" concept, no backend change. It reuses the existing+ * `CuModelSelector`, which already talks to `GET/PUT+ * /api/providers/{id}/cu-model` and is vision-filtered; that endpoint 400s for+ * non-brain ids, so this always passes the resolved BRAIN provider id, never a+ * realtime id.+ *+ * Reads providers via its own `useProviders()` call (read-through, like+ * `SubagentCategory`'s `JarvisAgentSection` owns `/api/openclaw/status`)+ * rather than a prop, so it never depends on ApiKeysView passing the right+ * slice down.+ */+export function RealtimeComputerUsePanel() {+ const t = useT();+ const { providers } = useProviders();+ const activeBrain = providers.find((p) => p.tier === "brain" && p.active);++ return (+ <section+ data-testid="realtime-cu-panel"+ className="mt-6 border-t border-border pt-6"+ >+ <h3 className="font-display text-sm font-semibold tracking-tight">+ {t("apikeys_realtime_cu.title")}+ </h3>+ <p className="mt-0.5 text-xs text-muted-foreground">+ {activeBrain+ ? t("apikeys_realtime_cu.description").replace("{0}", activeBrain.label)+ : t("apikeys_realtime_cu.description_generic")}+ </p>++ <div className="mt-3">+ {activeBrain ? (+ <CuModelSelector+ providerId={activeBrain.id}+ recommendedModel={activeBrain.recommended_model}+ />+ ) : (+ <p+ data-testid="realtime-cu-no-brain-hint"+ className="rounded-md border border-amber-500/25 bg-amber-500/10 px-3 py-2 text-[11px] leading-relaxed text-amber-700"+ >+ {t("apikeys_realtime_cu.no_active_brain_hint")}+ </p>+ )}+ </div>+ </section>+ );+}diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.jsonindex 3a8d4f497d..ce59c49293 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json@@ -969,6 +969,12 @@"cleared": "Computer-Use-Modell auf dein Hauptmodell zurückgesetzt","vision_note": "Es werden nur Modelle angezeigt, die Bilder verstehen - Computer-Use liest den Bildschirm über Screenshots, ein reines Text-Modell kann es nicht steuern."},+ "apikeys_realtime_cu": {+ "title": "Computer-Use",+ "description": "Realtime-Modelle können deinen Bildschirm nicht sehen. Wenn ein Realtime-Gespräch Computer-Use braucht, nutzt Jarvis deinen aktiven Brain-Provider: {0}.",+ "description_generic": "Realtime-Modelle können deinen Bildschirm nicht sehen. Computer-Use braucht einen aktiven Brain-Provider als Rückfalloption.",+ "no_active_brain_hint": "Es ist noch kein aktiver Brain-Provider eingerichtet. Wechsle zu Pipeline → Brain und aktiviere einen, um Computer-Use in Realtime-Gesprächen zu ermöglichen."+ },"settings_view": {"silence_window": {"title": "Denkpause",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.jsonindex 0c6e0328d8..3409da6eb8 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json@@ -970,6 +970,12 @@"cleared": "Computer-Use model reset to your main model","vision_note": "Only models that can see images are listed - Computer-Use reads the screen from screenshots, so a text-only model cannot run it."},+ "apikeys_realtime_cu": {+ "title": "Computer-Use",+ "description": "Realtime models can't see your screen. When a realtime conversation needs Computer-Use, Jarvis uses your active Brain provider: {0}.",+ "description_generic": "Realtime models can't see your screen. Computer-Use needs an active Brain provider to fall back to.",+ "no_active_brain_hint": "No active Brain provider is configured yet. Switch to Pipeline → Brain and activate one to enable Computer-Use during Realtime conversations."+ },"settings_view": {"silence_window": {"title": "Thinking pause",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.jsonindex 3ac846f1a8..540eb4e3f7 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json@@ -969,6 +969,12 @@"cleared": "Modelo de Computer-Use restablecido a tu modelo principal","vision_note": "Solo se muestran modelos que entienden imágenes: Computer-Use lee la pantalla mediante capturas, un modelo de solo texto no puede controlarlo."},+ "apikeys_realtime_cu": {+ "title": "Computer-Use",+ "description": "Los modelos Realtime no pueden ver tu pantalla. Cuando una conversación Realtime necesita Computer-Use, Jarvis usa tu proveedor Brain activo: {0}.",+ "description_generic": "Los modelos Realtime no pueden ver tu pantalla. Computer-Use necesita un proveedor Brain activo como alternativa.",+ "no_active_brain_hint": "Todavía no hay un proveedor Brain activo configurado. Cambia a Pipeline → Brain y activa uno para habilitar Computer-Use en las conversaciones Realtime."+ },"settings_view": {"silence_window": {"title": "Pausa para pensar",diff --git a/jarvis/ui/web/frontend/src/views/ApiKeysView.realtime-cu.test.tsx b/jarvis/ui/web/frontend/src/views/ApiKeysView.realtime-cu.test.tsxnew file mode 100644index 0000000000..2760622d3e--- /dev/null+++ b/jarvis/ui/web/frontend/src/views/ApiKeysView.realtime-cu.test.tsx@@ -0,0 +1,165 @@+/**+ * Integration test for Feature B: the Computer-Use panel embedded in Realtime+ * mode on the API-Keys screen.+ *+ * Confirms the wiring end-to-end inside `ApiKeysView` — the `active ===+ * "realtime"` branch renders `RealtimeCategory`, which renders the existing+ * `ProviderCategory` (the realtime cards, unchanged) followed by+ * `RealtimeComputerUsePanel` — and that Pipeline tabs (brain/tts/stt) are+ * completely unaffected by the Realtime-only change (the plan's binding+ * constraint: Pipeline stays byte-for-byte unaffected).+ */+import { afterEach, describe, expect, it, vi } from "vitest";+import { cleanup, fireEvent, render, screen } from "@testing-library/react";++// ApiKeysView reads the live `[voice].mode` (for the Pipeline|Realtime mode+// switch) via useVoiceMode, which needs a QueryClientProvider — mocked here+// exactly like the other ApiKeysView.*.test.tsx files. realtimeAvailable=true+// so clicking the Realtime segment actually switches (mirrors+// ApiKeysView.two-mode.test.tsx).+vi.mock("@/hooks/useVoiceMode", () => ({+ useVoiceMode: () => ({+ mode: "pipeline",+ realtimeAvailable: true,+ setMode: vi.fn(),+ isLoading: false,+ isSaving: false,+ }),+}));++// Stub CuModelSelector so this test asserts exactly what+// RealtimeComputerUsePanel forwards to it, without pulling in its own model+// catalog network calls (covered by CuModelSelector's own tests).+vi.mock("@/components/CuModelSelector", () => ({+ CuModelSelector: ({ providerId }: { providerId: string }) => (+ <div data-testid="cu-model-selector-stub" data-provider-id={providerId} />+ ),+}));++const PROVIDERS = [+ {+ id: "openrouter",+ label: "OpenRouter",+ tier: "brain",+ auth_mode: "api_key",+ secret_keys: ["OPENROUTER_API_KEY"],+ secrets_set: { OPENROUTER_API_KEY: true },+ dashboard_url: null,+ login_cli: null,+ install_hint: null,+ credential_path_hint: null,+ configured: true,+ active: true,+ brain_switchable: true,+ cli_installed: null,+ credential_help: null,+ signup_url: null,+ billing: "api",+ recommended_model: "some-model",+ alt_credential: null,+ },+ {+ id: "openai-realtime",+ label: "OpenAI Realtime",+ tier: "realtime",+ auth_mode: "api_key",+ secret_keys: ["OPENAI_API_KEY"],+ secrets_set: { OPENAI_API_KEY: true },+ dashboard_url: null,+ login_cli: null,+ install_hint: null,+ credential_path_hint: null,+ configured: true,+ active: true,+ brain_switchable: true,+ cli_installed: null,+ credential_help: null,+ signup_url: null,+ billing: "api",+ alt_credential: null,+ },+];++function jsonResponse(body: unknown): Response {+ return {+ ok: true,+ status: 200,+ statusText: "OK",+ json: async () => body,+ text: async () => JSON.stringify(body),+ } as Response;+}++function installFetchMock() {+ const fetchMock = vi.fn(async (input: RequestInfo | URL) => {+ const url = String(input);+ if (url.startsWith("/api/providers/section-health")) {+ return jsonResponse({+ sections: {+ brain: { status: "ok", reason: "ok", detail: "" },+ tts: { status: "ok", reason: "ok", detail: "" },+ stt: { status: "ok", reason: "ok", detail: "" },+ realtime: { status: "ok", reason: "ok", detail: "" },+ subagents: { status: "unknown", reason: "unknown", detail: "" },+ advanced: { status: "unknown", reason: "unknown", detail: "" },+ },+ checked_at: 0,+ cached: false,+ });+ }+ if (url.startsWith("/api/providers")) {+ return jsonResponse({ providers: PROVIDERS });+ }+ if (url.startsWith("/api/openclaw/status")) {+ return jsonResponse({ mapping: [], brain_primary: "" });+ }+ throw new Error(`unexpected fetch ${url}`);+ });+ (globalThis as unknown as { fetch: typeof fetch }).fetch =+ fetchMock as unknown as typeof fetch;+}++import { ApiKeysView } from "@/views/ApiKeysView";++afterEach(() => {+ cleanup();+ vi.restoreAllMocks();+});++describe("ApiKeysView — Realtime Computer-Use panel (Feature B)", () => {+ it("shows the Computer-Use panel naming the active Brain provider once Realtime is selected", async () => {+ installFetchMock();+ render(<ApiKeysView />);++ // Pipeline tabs are the default view — no realtime panel yet.+ expect(screen.getByRole("tab", { name: /^Brain$/i })).toBeTruthy();+ expect(screen.queryByTestId("realtime-cu-panel")).toBeNull();++ fireEvent.click(screen.getByRole("button", { name: /^realtime$/i }));++ const panel = await screen.findByTestId("realtime-cu-panel");+ expect(panel.textContent).toMatch(/OpenRouter/);++ // The BRAIN id ("openrouter"), never the realtime id ("openai-realtime").+ const stub = await screen.findByTestId("cu-model-selector-stub");+ expect(stub.getAttribute("data-provider-id")).toBe("openrouter");+ });++ it("switching back to Pipeline removes the Realtime Computer-Use panel, and Pipeline tabs are untouched", async () => {+ installFetchMock();+ render(<ApiKeysView />);+ fireEvent.click(screen.getByRole("button", { name: /^realtime$/i }));+ await screen.findByTestId("realtime-cu-panel");++ fireEvent.click(screen.getByRole("button", { name: /pipeline/i }));++ expect(screen.queryByTestId("realtime-cu-panel")).toBeNull();+ // The five Pipeline tabs render exactly as before Feature B.+ expect(screen.getByRole("tab", { name: /^Brain$/i })).toBeTruthy();+ expect(screen.getByRole("tab", { name: /voice output/i })).toBeTruthy();+ expect(screen.getByRole("tab", { name: /voice input/i })).toBeTruthy();+ expect(screen.getByRole("tab", { name: /jarvis-agents/i })).toBeTruthy();+ expect(screen.getByRole("tab", { name: /advanced/i })).toBeTruthy();+ expect(screen.queryByRole("tab", { name: /realtime/i })).toBeNull();+ });+});diff --git a/jarvis/ui/web/frontend/src/views/ApiKeysView.tsx b/jarvis/ui/web/frontend/src/views/ApiKeysView.tsxindex ef48b43aa2..fbbfbacd63 100644--- a/jarvis/ui/web/frontend/src/views/ApiKeysView.tsx+++ b/jarvis/ui/web/frontend/src/views/ApiKeysView.tsx@@ -8,6 +8,7 @@ import { OpenRouterTtsControls } from "@/components/OpenRouterTtsVoicePicker";import { CuModelSelector } from "@/components/CuModelSelector";import { ProviderBillingBadge } from "@/components/ProviderBillingBadge";import { JarvisAgentSection } from "@/components/JarvisAgentSection";+import { RealtimeComputerUsePanel } from "@/components/RealtimeComputerUsePanel";import { TelephonyPanel } from "@/views/TelephonyView";import { WikiProviderCard } from "@/views/settings/WikiProviderCard";import { JarvisApiGroup } from "@/views/settings/JarvisApiGroup";@@ -143,10 +144,7 @@ export function ApiKeysView() {<CategoryTabs active={active} onSelect={setActive} health={health} tabs={modeTabs} /><div className="flex-1 overflow-y-auto scrollbar-jarvis p-6">- {(active === "brain" ||- active === "tts" ||- active === "stt" ||- active === "realtime") && (+ {(active === "brain" || active === "tts" || active === "stt") && (<ProviderCategorymeta={categories[active]}tier={active}@@ -158,6 +156,17 @@ export function ApiKeysView() {health={health[active]}/>)}+ {active === "realtime" && (+ <RealtimeCategory+ meta={categories.realtime}+ providers={providers}+ loading={loading}+ error={error}+ onChanged={refetch}+ onActivateOptimistic={setActiveOptimistic}+ health={health.realtime}+ />+ )}{active === "subagents" && <SubagentCategory />}{active === "advanced" && <AdvancedCategory />}</div>@@ -479,6 +488,49 @@ function ProviderCategory({);}+/**+ * The Realtime category (Feature B): the two realtime provider cards, via the+ * SAME `ProviderCategory` used for brain/tts/stt (unchanged), followed by the+ * Computer-Use delegation panel. Realtime speech-to-speech models can't see+ * the screen, so Computer-Use during a realtime turn falls back to the ACTIVE+ * Brain provider — exactly what CU already runs on today. This wrapper mirrors+ * `SubagentCategory` below: it owns nothing itself, it just composes the+ * existing tier section with the new read-through panel.+ */+function RealtimeCategory({+ meta,+ providers,+ loading,+ error,+ onChanged,+ onActivateOptimistic,+ health,+}: {+ meta: CategoryMeta;+ providers: ProviderDescriptor[];+ loading: boolean;+ error: string | null;+ onChanged: () => void;+ onActivateOptimistic: (tier: ProviderTier, id: string) => void;+ health?: SectionHealth;+}) {+ return (+ <>+ <ProviderCategory+ meta={meta}+ tier="realtime"+ providers={providers}+ loading={loading}+ error={error}+ onChanged={onChanged}+ onActivateOptimistic={onActivateOptimistic}+ health={health}+ />+ <RealtimeComputerUsePanel />+ </>+ );+}+/*** The Subagents category — the heavy-task worker selection. `SubagentSection`* owns its own data source (/api/openclaw/status) and card system; the hero band