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(apikeys): add the personal-recommendation panel to the voice-engine band

Ruben Lütke2f3b48674413
diff --git a/jarvis/ui/web/frontend/src/views/ApiKeysView.recommended-setup.test.tsx b/jarvis/ui/web/frontend/src/views/ApiKeysView.recommended-setup.test.tsx
new file mode 100644
index 0000000000..5b668d2c0f
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/views/ApiKeysView.recommended-setup.test.tsx
@@ -0,0 +1,116 @@
+/**
+ * Component tests for the "Personal recommendation" panel in the voice-engine
+ * header band (RecommendedSetupPanel).
+ *
+ * The panel is a presentation-only hint (AP-21): it lists the maintainer's
+ * pick for Realtime / Tool Model / Jarvis-Agents, and each row navigates to
+ * the tab it names. Navigation is VIEW-only — opening the Realtime tab set
+ * from a recommendation row must never persist `[voice].mode` (only the
+ * key-gated segmented switch does that).
+ */
+import { afterEach, describe, expect, it, vi } from "vitest";
+import { cleanup, fireEvent, render, screen, within } from "@testing-library/react";
+
+// Mock the data hooks so the view renders deterministically, without a
+// network round-trip (same pattern as ApiKeysView.two-mode.test.tsx).
+vi.mock("@/hooks/useProviders", () => ({
+ sectionHealthForSubject: (
+ health: { subject_id?: string } | undefined,
+ subjectId?: string,
+ ) => (subjectId && health?.subject_id === subjectId ? health : undefined),
+ useProviders: () => ({
+ providers: [],
+ loading: false,
+ error: null,
+ refetch: vi.fn(),
+ setActiveOptimistic: vi.fn(),
+ }),
+ useSectionHealth: () => ({ health: {} }),
+}));
+
+const putVoiceMode = vi.fn();
+vi.mock("@/hooks/useVoiceMode", () => ({
+ useVoiceMode: () => ({
+ mode: "pipeline",
+ realtimeAvailable: true,
+ statusKnown: true,
+ sessionActive: false,
+ activeSessionMode: null,
+ activeSessionProvider: "",
+ activeSessionModel: "",
+ transitioning: false,
+ setMode: putVoiceMode,
+ isLoading: false,
+ isSaving: false,
+ }),
+}));
+
+import { ApiKeysView } from "@/views/ApiKeysView";
+
+afterEach(() => {
+ cleanup();
+ vi.clearAllMocks();
+});
+
+function panel() {
+ return within(screen.getByTestId("recommended-setup-panel"));
+}
+
+describe("ApiKeysView recommended-setup panel", () => {
+ it("lists the three maintainer picks", () => {
+ render(<ApiKeysView />);
+ expect(panel().getByText("OpenAI Realtime")).toBeTruthy();
+ expect(panel().getByText("Gemini 3.5 Flash")).toBeTruthy();
+ expect(panel().getByText("ChatGPT or Claude Max subscription")).toBeTruthy();
+ });
+
+ it("keeps the segment buttons uniquely addressable (no /^realtime/i collision)", () => {
+ render(<ApiKeysView />);
+ // The two-mode tests select the engine segment via /^realtime/i; the
+ // recommendation rows must not shadow that accessible name.
+ expect(screen.getAllByRole("button", { name: /^realtime/i })).toHaveLength(1);
+ });
+
+ it("opens the Tool Model tab from its recommendation row", () => {
+ render(<ApiKeysView />);
+ fireEvent.click(
+ panel().getByRole("button", { name: /personal recommendation: tool model/i }),
+ );
+ expect(
+ (screen.getByRole("tab", { name: /tool model/i }) as HTMLElement).getAttribute(
+ "aria-selected",
+ ),
+ ).toBe("true");
+ });
+
+ it("opens the Jarvis-Agents tab from its recommendation row", () => {
+ render(<ApiKeysView />);
+ fireEvent.click(
+ panel().getByRole("button", { name: /personal recommendation: jarvis-agents/i }),
+ );
+ expect(
+ (screen.getByRole("tab", { name: /jarvis-agents/i }) as HTMLElement).getAttribute(
+ "aria-selected",
+ ),
+ ).toBe("true");
+ });
+
+ it("opens the Realtime tab set from its row WITHOUT persisting voice mode", () => {
+ render(<ApiKeysView />);
+ // Pipeline is the default view: no Realtime tab yet.
+ expect(screen.queryByRole("tab", { name: /realtime/i })).toBeNull();
+
+ fireEvent.click(
+ panel().getByRole("button", { name: /personal recommendation: realtime/i }),
+ );
+
+ // The view switched to the Realtime tab set with the Realtime tab selected…
+ expect(
+ (screen.getByRole("tab", { name: /realtime/i }) as HTMLElement).getAttribute(
+ "aria-selected",
+ ),
+ ).toBe("true");
+ // …but `[voice].mode` stays untouched — only the segmented switch persists.
+ expect(putVoiceMode).not.toHaveBeenCalled();
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/views/ApiKeysView.tsx b/jarvis/ui/web/frontend/src/views/ApiKeysView.tsx
index f2b487a9f6..68e8acd2c1 100644
--- a/jarvis/ui/web/frontend/src/views/ApiKeysView.tsx
+++ b/jarvis/ui/web/frontend/src/views/ApiKeysView.tsx
@@ -57,6 +57,12 @@ type CategoryKey = ProviderTier | "subagents" | "jarvis-key" | "advanced";
// unreachable engine. See `EngineModeSwitch` below for the exact rule.
type VoiceEngineMode = "pipeline" | "realtime";
+// The three provider slots the maintainer's setup recommendation speaks about
+// (RecommendedSetupPanel). All three are ordinary CategoryKeys; "realtime"
+// additionally requires the Realtime tab set, so opening it switches the VIEW
+// mode (never the persisted `[voice].mode`).
+type RecommendationTab = "realtime" | "computer-use" | "subagents";
+
// Realtime replaces STT+Brain+TTS with one full-duplex model, so those three
// tiers don't apply in Realtime mode — that's the whole reason for the split.
// "computer-use" is GLOBAL (not mode-specific — Computer-Use is one engine for
@@ -194,6 +200,14 @@ export function ApiKeysView() {
const modeTabs = engineMode === "realtime" ? REALTIME_TABS : PIPELINE_TABS;
+ // A recommendation row navigates to the tab it talks about. This is VIEW
+ // navigation only: opening the Realtime tab set here never persists
+ // `[voice].mode` (only the segmented switch does that, key-gated).
+ function openRecommendedTab(tab: RecommendationTab) {
+ if (tab === "realtime") setEngineMode("realtime");
+ setActive(tab);
+ }
+
return (
<div className="flex h-full flex-col">
<ViewHeader
@@ -214,6 +228,7 @@ export function ApiKeysView() {
transitioning={transitioning}
onSelect={setEngineMode}
onSetVoiceMode={setVoiceMode}
+ onOpenRecommendedTab={openRecommendedTab}
/>
<CategoryTabs active={active} onSelect={setActive} health={health} tabs={modeTabs} />
@@ -301,6 +316,7 @@ function EngineModeSwitch({
transitioning,
onSelect,
onSetVoiceMode,
+ onOpenRecommendedTab,
}: {
mode: VoiceEngineMode;
/** The live `[voice].mode` value — determines the filled/active segment. */
@@ -320,6 +336,8 @@ function EngineModeSwitch({
onSelect: (mode: VoiceEngineMode) => void;
/** Persists `[voice].mode` — gated per the rule above. */
onSetVoiceMode: (mode: string) => void;
+ /** Opens the tab a recommendation row names (view navigation only). */
+ onOpenRecommendedTab: (tab: RecommendationTab) => void;
}) {
const t = useT();
// Realtime leads as the recommended default. Pipeline follows with an
@@ -364,6 +382,8 @@ function EngineModeSwitch({
</p>
</div>
+ <RecommendedSetupPanel onOpenTab={onOpenRecommendedTab} />
+
<div className="shrink-0">
{/* Two equal segments over one sliding thumb: the thumb tracks the
LIVE engine, so its glide IS the switch feedback. */}
@@ -478,6 +498,90 @@ function EngineModeSwitch({
);
}
+/**
+ * The maintainer's personal pick for the three provider slots users ask about
+ * most, shown in the voice-engine header band where it is visible in BOTH tab
+ * sets. Same contract as the per-card "Recommended" badges fed by
+ * provider_spec.py: a presentation hint only — it never gates behavior and
+ * never branches a code path on a provider name (AP-21). Each row is a button
+ * that jumps straight to the tab it names, so the guidance sits one click
+ * from the place it applies. The rows carry an explicit aria-label starting
+ * with the panel title so their accessible names never collide with the
+ * Pipeline|Realtime segment buttons (tests match those via /^realtime/i).
+ */
+function RecommendedSetupPanel({
+ onOpenTab,
+}: {
+ onOpenTab: (tab: RecommendationTab) => void;
+}) {
+ const t = useT();
+ const rows: {
+ tab: RecommendationTab;
+ icon: LucideIcon;
+ label: string;
+ pick: string;
+ why: string;
+ }[] = [
+ {
+ tab: "realtime",
+ icon: Radio,
+ label: t("apikeys_view.tab_realtime"),
+ pick: t("apikeys_view.reco_realtime_pick"),
+ why: t("apikeys_view.reco_realtime_why"),
+ },
+ {
+ tab: "computer-use",
+ icon: Terminal,
+ label: t("apikeys_view.tab_computer_use"),
+ pick: t("apikeys_view.reco_computer_use_pick"),
+ why: t("apikeys_view.reco_computer_use_why"),
+ },
+ {
+ tab: "subagents",
+ icon: Bot,
+ label: t("apikeys_view.tab_subagents"),
+ pick: t("apikeys_view.reco_subagents_pick"),
+ why: t("apikeys_view.reco_subagents_why"),
+ },
+ ];
+ return (
+ <div
+ data-testid="recommended-setup-panel"
+ className="min-w-0 max-w-xl flex-1 basis-80 rounded-xl border border-primary/25 bg-primary/[0.05] px-4 py-2.5"
+ >
+ <p className="flex items-center gap-1.5 text-xs font-medium text-foreground">
+ <Sparkles aria-hidden="true" className="h-3.5 w-3.5 shrink-0 text-primary" />
+ {t("apikeys_view.reco_title")}
+ </p>
+ <ul className="mt-1.5 space-y-0.5">
+ {rows.map((row) => {
+ const Icon = row.icon;
+ return (
+ <li key={row.tab}>
+ <button
+ type="button"
+ onClick={() => onOpenTab(row.tab)}
+ aria-label={`${t("apikeys_view.reco_title")}: ${row.label} — ${row.pick}`}
+ className="flex w-full items-start gap-2 rounded-lg px-1.5 py-1 text-left text-xs leading-snug transition-colors hover:bg-primary/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
+ >
+ <Icon
+ aria-hidden="true"
+ className="mt-0.5 h-3.5 w-3.5 shrink-0 text-primary/80"
+ />
+ <span className="min-w-0">
+ <span className="text-muted-foreground">{row.label}: </span>
+ <span className="font-medium text-foreground">{row.pick}</span>
+ <span className="text-muted-foreground"> — {row.why}</span>
+ </span>
+ </button>
+ </li>
+ );
+ })}
+ </ul>
+ </div>
+ );
+}
+
/**
* The segmented category navigation. The four core categories are grouped in one
* pill container; the de-emphasized "Advanced" tab is set apart by a divider and