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
refactor(ui): streamline sidebar header and flatten chat history
rubenluetke10-beep3a13840dbf65
diff --git a/jarvis/ui/web/frontend/src/components/home/RecentChats.test.tsx b/jarvis/ui/web/frontend/src/components/home/RecentChats.test.tsxindex aea8e593b3..82ba154ed7 100644--- a/jarvis/ui/web/frontend/src/components/home/RecentChats.test.tsx+++ b/jarvis/ui/web/frontend/src/components/home/RecentChats.test.tsx@@ -32,6 +32,7 @@ async function flush() {describe("RecentChats", () => {beforeEach(() => {+ localStorage.removeItem("jarvis.sidebar.pinned-chats.v1");vi.stubGlobal("fetch",vi.fn(async (url: string) =>@@ -78,6 +79,20 @@ describe("RecentChats", () => {vi.unstubAllGlobals();});+ it("pins a chat without duplicating it and remembers the pin", async () => {+ const view = render(<RecentChats />);+ fireEvent.click(screen.getByRole("button", { name: "Pin chat: Agent chat" }));+ expect(screen.getByTestId("pinned-chats").textContent).toContain("Agent chat");+ expect(screen.getAllByTitle("Agent chat")).toHaveLength(1);+ view.unmount();+ render(<RecentChats />);+ expect(screen.getByTestId("pinned-chats").textContent).toContain("Agent chat");+ fireEvent.click(screen.getByRole("button", { name: "Unpin chat: Agent chat" }));+ expect(screen.queryByTestId("pinned-chats")).toBeNull();+ expect(screen.getAllByTitle("Agent chat")).toHaveLength(1);+ await flush();+ });+it("keeps a voice session on the voice surface and loads its words into the lane", async () => {render(<RecentChats />);fireEvent.click(screen.getByTitle("Spoken thread"));diff --git a/jarvis/ui/web/frontend/src/components/home/RecentChats.tsx b/jarvis/ui/web/frontend/src/components/home/RecentChats.tsxindex 3bb03ebaea..aca9e64cdb 100644--- a/jarvis/ui/web/frontend/src/components/home/RecentChats.tsx+++ b/jarvis/ui/web/frontend/src/components/home/RecentChats.tsx@@ -1,54 +1,42 @@import { useEffect, useState } from "react";-import { Archive, ChevronDown, MessageSquare, Mic, Trash2 } from "lucide-react";+import { Archive, ChevronDown, MessageSquare, Pin, PinOff, Trash2 } from "lucide-react";import { useAgentChatStore } from "@/store/agentChat";import { useT } from "@/i18n";import { cn } from "@/lib/utils";import { AllChatsDialog } from "@/components/home/AllChatsDialog";-import { formatChatWhen, useChatRows, type ChatRow } from "@/components/home/chatRows";+import { useChatRows, type ChatRow } from "@/components/home/chatRows";import { CONVERSATIONS_REFRESH_MS } from "@/hooks/useConversations";-export const RECENT_CHATS_FOLDED = 5;-export const RECENT_CHATS_UNFOLDED = 15;+export const RECENT_CHATS_FOLDED = 15;+export const RECENT_CHATS_UNFOLDED = 50;-/**- * The last conversations — agent chats and voice sessions in one list —- * folded under the sidebar's "Chat" row. This block is the one long-lived- * poller of both histories (`useConversations({ poll: true })` for the voice- * sessions, the agent-chat store's session list for the typed ones).- *- * It hangs off the nav row rather than standing above the navigation as its- * own titled group. Standing free it was one more list in a column that, in- * the Agentic IDE's chat mode, already opened with the workspaces and their- * sessions — three lists of rows in a row, no edge between them (maintainer- * report 2026-08-27). Under the row it is what it is: the Chat section's own- * history, shown when the chevron on that row is opened and folded away- * otherwise. The row itself still opens the chat; only the chevron opens the- * list, so reaching the section never unfolds thirty rows nobody asked for.- *- * It is a shortcut, not the archive: it shows the handful you touched last- * and hands everything else to "All chats" (components/home/AllChatsDialog),- * where the whole history is searchable. Both open a row through the same- * `useChatRows().open`, so a click behaves identically in either place.- *- * Opening a row resumes it and lands on the surface that fits (maintainer,- * 2026-08-23): a VOICE session opened while the voice stage is up stays- * there, its words loaded into the transcript lane, so you just keep- * talking. Opened from the chat surface it is read there as an archive.- * An agent chat goes to the chat surface, where the session is read and- * continued by typing — on the provider and model it was using.- *- * The typed rows are the front page's Jarvis chats (agent-chat sessions on- * the `jarvis` surface) — the same assistant as the voice rows, reached by- * keyboard. The Agentic IDE's coding sessions live on their own surface and- * are listed there, never here. The classic brain's text threads are no- * longer listed either: since the chat surface became the agent chat there- * is nowhere to open them; the data stays on disk.- */+/** Flat sidebar history: pinned conversations first, then the latest chats. */+const PINNED_KEY = "jarvis.sidebar.pinned-chats.v1";+function readPins(): string[] {+ try {+ const value: unknown = JSON.parse(localStorage.getItem(PINNED_KEY) ?? "[]");+ return Array.isArray(value) ? value.filter((item): item is string => typeof item === "string") : [];+ } catch {+ // Unavailable or invalid storage leaves the history usable without pins.+ return [];+ }+}+const rowKey = (row: ChatRow) => `${row.kind}:${row.id}`;export function RecentChats() {const t = useT();const { rows, isActive, open: openRow, remove } = useChatRows({ poll: true });const loadSessions = useAgentChatStore((s) => s.loadSessions);+ const [pins, setPins] = useState(readPins);+ const togglePin = (row: ChatRow) => {+ const key = rowKey(row);+ const next = pins.includes(key) ? pins.filter((id) => id !== key) : [...pins, key];+ setPins(next);+ try { localStorage.setItem(PINNED_KEY, JSON.stringify(next)); }+ catch { /* Storage denied: keep the pin for this visit. */ }+ };+ const pinnedRows = rows.filter((row) => pins.includes(rowKey(row)));+ const recentRows = rows.filter((row) => !pins.includes(rowKey(row)));const [open, setOpen] = useState(false);const [archiveOpen, setArchiveOpen] = useState(false);@@ -58,25 +46,33 @@ export function RecentChats() {return () => window.clearInterval(id);}, [loadSessions]);- const shown = rows.slice(0, open ? RECENT_CHATS_UNFOLDED : RECENT_CHATS_FOLDED);- const canExpand = rows.length > RECENT_CHATS_FOLDED;+ const shown = recentRows.slice(0, open ? RECENT_CHATS_UNFOLDED : RECENT_CHATS_FOLDED);+ const canExpand = recentRows.length > RECENT_CHATS_FOLDED;// The archive earns its place only once the sidebar cannot show everything.- const hidden = rows.length - shown.length;+ const hidden = recentRows.length - shown.length;return (<><div data-testid="recent-chats" className="pb-1 pt-0.5">+ {pinnedRows.length > 0 && <section data-testid="pinned-chats" className="mb-6">+ <h2 className="px-3 pb-2 text-sm font-medium text-muted-foreground">{t("sidebar.pinned")}</h2>+ <ul className="space-y-1">{pinnedRows.map((row) => <ChatRowItem key={rowKey(row)} row={row}+ active={isActive(row)} pinned onPin={() => togglePin(row)} onOpen={() => openRow(row)}+ onDelete={row.kind === "agent" ? () => remove(row) : undefined} />)}</ul>+ </section>}+ <h2 className="px-3 pb-2 text-sm font-medium text-muted-foreground">{t("sidebar.recent")}</h2>{shown.length === 0 ? (- <p className="py-1 pl-9 pr-2 text-sm text-foreground-faint">+ <p className="py-1 px-3 text-sm text-foreground-faint">{t("sidebar.no_chats")}</p>) : (- <ul className={cn("relative space-y-px", TREE_GUIDE)}>+ <ul className="space-y-1">{shown.map((row) => (<ChatRowItemkey={`${row.kind}-${row.id}`}row={row}active={isActive(row)}+ onPin={() => togglePin(row)}onOpen={() => openRow(row)}onDelete={row.kind === "agent" ? () => remove(row) : undefined}/>@@ -119,18 +115,9 @@ export function RecentChats() {);}-/**- * The thin line that ties the rows to the row they hang under — drawn at the- * centre of the nav row's icon (12 px padding + half of 16 px), so the list- * reads as the Chat row's branch and not as a second list that happens to- * follow it.- */-const TREE_GUIDE =- "before:pointer-events-none before:absolute before:bottom-1 before:left-5 before:top-1 before:w-px before:bg-border/70 before:content-['']";-/** "Show all" and "See all chats": the two quiet rows that close the list. */const TAIL_ROW = cn(- "flex h-8 w-full items-center gap-2 rounded-md pl-9 pr-2 text-left transition-colors",+ "flex h-10 w-full items-center gap-2 rounded-md px-3 text-left transition-colors","text-muted-foreground hover:bg-secondary hover:text-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",);@@ -148,15 +135,17 @@ function ChatRowItem({active,onOpen,onDelete,+ pinned = false,+ onPin,}: {row: ChatRow;active: boolean;onOpen: () => void;onDelete?: () => void;+ pinned?: boolean;+ onPin: () => void;}) {const t = useT();- const isVoice = row.kind === "voice";- const Icon = isVoice ? Mic : MessageSquare;const title = row.title || t("chats_view.new_chat");return (<li className="group relative">@@ -167,21 +156,21 @@ function ChatRowItem({data-testid="recent-chat-row"data-kind={row.kind}className={cn(- "flex h-8 w-full items-center gap-2 rounded-md pl-9 pr-2 text-left transition-colors",+ "flex h-10 w-full items-center gap-2 rounded-md px-3 text-left transition-colors group-hover:pr-16 group-focus-within:pr-16","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",// The open one wears the same accent edge as the active nav row, so// "where am I" is said in one voice all the way down the column.active ? "jarvis-nav-active bg-secondary text-foreground" : "hover:bg-secondary",)}>- <Icon- aria-hidden- className={cn("h-3.5 w-3.5 shrink-0", active ? "text-foreground" : "text-muted-foreground")}- />+ {pinned && <MessageSquare aria-hidden className="h-4 w-4 shrink-0 text-muted-foreground" />}<span className="min-w-0 flex-1 truncate text-base text-foreground">{title}</span>- <span className="shrink-0 text-sm tabular-nums text-foreground-faint">- {formatChatWhen(row.updatedMs)}- </span>++ </button>+ <button type="button" onClick={onPin} title={t(pinned ? "sidebar.unpin_chat" : "sidebar.pin_chat")}+ aria-label={`${t(pinned ? "sidebar.unpin_chat" : "sidebar.pin_chat")}: ${title}`}+ className="absolute right-7 top-1/2 -translate-y-1/2 rounded-md bg-card p-1.5 text-muted-foreground opacity-0 hover:text-foreground focus:opacity-100 group-hover:opacity-100 group-focus-within:opacity-100">+ {pinned ? <PinOff className="h-3.5 w-3.5" /> : <Pin className="h-3.5 w-3.5" />}</button>{onDelete && (<button@@ -192,7 +181,7 @@ function ChatRowItem({}}title={t("chats_view.delete")}aria-label={t("chats_view.delete")}- className="absolute right-1 top-1/2 hidden -translate-y-1/2 rounded-md bg-card p-1 text-muted-foreground transition-colors hover:bg-destructive/15 hover:text-destructive group-hover:block"+ className="absolute right-1 top-1/2 -translate-y-1/2 opacity-0 rounded-md bg-card p-1 text-muted-foreground transition-colors hover:bg-destructive/15 hover:text-destructive focus:opacity-100 group-hover:opacity-100 group-focus-within:opacity-100"><Trash2 className="h-3 w-3" /></button>diff --git a/jarvis/ui/web/frontend/src/components/layout/Sidebar.test.tsx b/jarvis/ui/web/frontend/src/components/layout/Sidebar.test.tsxindex 44fa25ea80..c128ccc1a4 100644--- a/jarvis/ui/web/frontend/src/components/layout/Sidebar.test.tsx+++ b/jarvis/ui/web/frontend/src/components/layout/Sidebar.test.tsx@@ -133,9 +133,9 @@ describe("Sidebar voice header", () => {expect(screen.queryByText("auflegen")).toBeNull();});- test("carries the Voice | Chat switch and a New chat button", () => {+ test("starts with New chat without duplicate voice controls", () => {renderSidebar();- expect(screen.getByTestId("home-surface-switch")).toBeTruthy();+ expect(screen.queryByTestId("home-surface-switch")).toBeNull();expect(screen.getByTestId("sidebar-new-chat")).toBeTruthy();});});@@ -175,27 +175,14 @@ describe("Sidebar new-conversation button", () => {useEventStore.setState({ conversations: [], messages: [], activeThreadId: null });});- test("on the voice stage it starts a voice run and stays on Voice", async () => {- useHomeStore.setState({- surface: "voice",- transcript: [{ id: "l1", who: "user", text: "hello", ts: 1 }],- });-+ test("New chat opens typed chat even from the voice stage", async () => {+ useHomeStore.setState({ surface: "voice", transcript: [] });renderSidebar();const button = screen.getByTestId("sidebar-new-chat");- expect(button.textContent).toContain("New voice chat");-- await act(async () => {- button.click();- await Promise.resolve();- });-- expect(useHomeStore.getState().surface).toBe("voice");- expect(useHomeStore.getState().transcript).toEqual([]);- // The open voice thread is dropped so the next spoken turn is its own.- expect(useEventStore.getState().activeThreadId).toBeNull();- const calls = (globalThis.fetch as unknown as { mock: { calls: unknown[][] } }).mock.calls;- expect(calls.some((c) => String(c[0]) === "/api/chats/voice/new")).toBe(true);+ expect(button.textContent).toContain("New chat");+ await act(async () => { button.click(); await Promise.resolve(); });+ expect(useHomeStore.getState().surface).toBe("chat");+ expect(useEventStore.getState().activeSection).toBe("chats");});test("on the chat surface it still opens an empty chat", async () => {@@ -618,9 +605,7 @@ describe("Sidebar icon rail", () => {const sidebar = screen.getByTestId("sidebar");expect(sidebar.querySelector(".jarvis-shell-surface")).toBeNull();- expect(screen.getByTestId("nav-row-chats").classList).toContain(- "jarvis-nav-active",- );+ expect(screen.getByTestId("sidebar-new-chat")).toBeTruthy();});test("keeps the wake-word hint and realtime control off the rail", () => {@@ -636,7 +621,7 @@ describe("Sidebar icon rail", () => {expect(screen.queryByText("auflegen")).toBeNull();// …and the navigation, which is the reason the rail exists, is still there.- expect(screen.getByTestId("nav-row-chats")).toBeTruthy();+ expect(screen.getByTestId("sidebar-new-chat")).toBeTruthy();});});@@ -783,7 +768,7 @@ describe("compact sidebar navigation", () => {fireEvent.click(screen.getByTestId("sidebar-more-toggle"));fireEvent.click(screen.getByTestId("sidebar-profile-toggle"));for (const item of [...NAV_GROUPS.flat(), ...NAV_FOOTER_ITEMS]) {- expect(screen.getByTestId(`nav-row-${item.id}`)).toBeTruthy();+ expect(screen.getByTestId(item.id === "chats" ? "sidebar-new-chat" : `nav-row-${item.id}`)).toBeTruthy();}});});diff --git a/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsx b/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsxindex d27b6c696a..71b6e287e0 100644--- a/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsx+++ b/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsx@@ -27,8 +27,6 @@ import { clsx } from "clsx";import { cn } from "@/lib/utils";import { useEffect, useMemo, useRef, useState, type ReactNode } from "react";import { useT } from "@/i18n";-import { BrowserRealtimeControl } from "@/components/voice/BrowserRealtimeControl";-import { SurfaceSwitch } from "@/components/home/SurfaceSwitch";import { RecentChats } from "@/components/home/RecentChats";import { useConversations } from "@/hooks/useConversations";import { useHomeStore } from "@/store/home";@@ -185,7 +183,7 @@ export function Sidebar({// chat surface an empty agent chat, on the voice stage a fresh voice run.// Sending someone standing in Voice to the chat page is what the one button// used to do, and it read as the button being broken.- const { newChat, newVoiceRun } = useConversations();+ const { newChat } = useConversations();const newAgentChat = useAgentChatStore((s) => s.newChat);const setSurface = useHomeStore((s) => s.setSurface);// The front page's nav row names the face the switch picked (Voice / Chat),@@ -255,24 +253,12 @@ export function Sidebar({document.removeEventListener("keydown", escape);};}, [profileOpen]);- const resetTranscript = useHomeStore((s) => s.resetTranscript);- // On the voice stage: clear the lane, drop the open voice thread and let the- // backend forget the one it was seeded with. We stay on Voice and the mic- // stays shut — the next wake word (or orb click) opens the new session.- const startNewVoice = () => {- resetTranscript();- void newVoiceRun();- setActive("chats");- };- // On the chat surface: an empty agent chat. The voice thread is cleared as- // well so a reopened voice session does not linger behind the fresh page.const startNewChat = () => {newChat();newAgentChat();setSurface("chat");setActive("chats");};- const onVoiceSurface = surface === "voice";// Shared readiness derivation (same source the banner + chat empty-state use).const { connected, voiceWarming, bootWarming, warming } = useVoiceReadiness();@@ -516,33 +502,17 @@ export function Sidebar({</button>)}</div>- {!railed && !chatFace && (- <>- {/* The front page's one switch (maintainer sketch, 2026-08-23):- Voice or Chat. The live transcript that used to sit here moved- onto the voice stage itself, where it has the room to be read.- Hidden while the IDE's chats own the column: two switches with- "Chat" on both halves are two questions nobody asked. */}- <SurfaceSwitch className="mt-3" />- {/* A full-width outline button: the one action this column offers. */}- <button- type="button"- onClick={onVoiceSurface ? startNewVoice : startNewChat}- data-testid="sidebar-new-chat"- className="mt-2 flex h-9 w-full items-center justify-center gap-2 rounded-md border border-border-strong px-3 text-base font-medium text-foreground transition-colors hover:bg-secondary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-sidebar"- >- <Plus aria-hidden className="h-4 w-4 shrink-0" />- {onVoiceSurface ? t("sidebar.new_voice_chat") : t("sidebar.new_chat")}- </button>- <BrowserRealtimeControl />- </>- )}+</div><div className="flex min-h-0 flex-1 flex-col overflow-y-auto scrollbar-jarvis"><nav aria-label={t("sidebar.sections")} className="space-y-1 px-2 py-2"><ul className="space-y-1">- {renderRow(findItem("chats"))}+ <li><button type="button" onClick={startNewChat} data-testid="sidebar-new-chat"+ aria-label={t("sidebar.new_chat")} title={t("sidebar.new_chat")} className={rowClass}>+ <Plus aria-hidden className="h-4 w-4 shrink-0" />+ {!railed && <span>{t("sidebar.new_chat")}</span>}+ </button></li>{renderRow(findItem("agents"))}{renderRow(findItem("visualization"))}</ul>@@ -557,7 +527,7 @@ export function Sidebar({</ul>}<ul className="space-y-1">{renderRow({ ...findItem("tasks"), labelKey: "sidebar.scheduled" })}- {renderRow({ ...findItem("plugins"), labelKey: "nav.plugins" })}+ {renderRow({ ...findItem("plugins"), labelKey: "sidebar.extensions_label" })}</ul><button type="button" onClick={() => { setMoreOpen(!moreOpen); setToolsOpen(false); }} aria-expanded={moreOpen}aria-controls="sidebar-more" title={t("sidebar.more")} data-testid="sidebar-more-toggle" className={rowClass}>@@ -567,7 +537,6 @@ export function Sidebar({{moreOpen && <ul id="sidebar-more" className="space-y-1">{moreItems.map((item) => renderRow(item))}</ul>}</nav>{!railed && <section className="mt-4 px-2 pb-3" aria-label={t("sidebar.recent_chats")}>- <h2 className="px-3 pb-2 text-sm font-medium text-muted-foreground">{t("sidebar.recent_chats")}</h2>{chatFace ? <WorkspaceChats /> : <RecentChats />}</section>}</div>diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.jsonindex e440b2a511..be064cc000 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json@@ -479,6 +479,12 @@"indicator_label": "Sprachstatus"},"sidebar": {+ "extensions_label": "Plugins / Skills / MCP",+ "pinned": "Angeheftet",+ "recent": "Letzte",+ "pin_chat": "Chat anheften",+ "unpin_chat": "Chat lösen",+"jarvis_tools": "Jarvis Tools","scheduled": "Geplant","more": "Mehr",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.jsonindex 42c132181f..5e6f20c263 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json@@ -479,6 +479,12 @@"indicator_label": "Voice state"},"sidebar": {+ "extensions_label": "Plugins / Skills / MCP",+ "pinned": "Pinned",+ "recent": "Recent",+ "pin_chat": "Pin chat",+ "unpin_chat": "Unpin chat",+"jarvis_tools": "Jarvis Tools","scheduled": "Scheduled","more": "More",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.jsonindex e80a79b265..6f7e88c4a6 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json@@ -479,6 +479,12 @@"indicator_label": "Estado de voz"},"sidebar": {+ "extensions_label": "Plugins / Skills / MCP",+ "pinned": "Fijados",+ "recent": "Recientes",+ "pin_chat": "Fijar chat",+ "unpin_chat": "Desfijar chat",+"jarvis_tools": "Herramientas Jarvis","scheduled": "Programado","more": "Más",