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
import {
Building2,
Loader2,
Mic,
ChevronDown,
MoreHorizontal,
Plus,
} from "lucide-react";
import {
NAV_GROUPS,
SETTINGS_HUB_IDS,
presentNavItem,
resolveNavLabel,
type NavItem,
} from "@/components/layout/navGroups";
import { useEventStore } from "@/store/events";
import { useTilingStore } from "@/store/tiling";
import { useVerseModeStore } from "@/store/verseMode";
import { useSelfBuildWaiting } from "@/hooks/useSelfBuild";
import { useSectionPrefetch } from "@/hooks/useSectionPrefetch";
import { useVoiceReadiness } from "@/hooks/useVoiceReadiness";
import { useVoiceMode } from "@/hooks/useVoiceMode";
import { useSectionHealth } from "@/hooks/useProviders";
import { usePluginAttention } from "@/hooks/usePluginAttention";
import { clsx } from "clsx";
import { cn } from "@/lib/utils";
import { lazy, Suspense, useMemo, type MouseEvent as ReactMouseEvent, type ReactNode } from "react";
import { useT } from "@/i18n";
import { RecentChats } from "@/components/home/RecentChats";
import { useHomeStore } from "@/store/home";
import { LazyIdeProjectTree } from "@/components/agentic/LazyIdeProjectTree";
import { IDE_SECTIONS } from "@/lib/ideSections";
import { useIdeProjectsStore } from "@/store/ideProjects";
import { SidebarSearchBar } from "@/components/layout/SidebarSearchBar";
import { SidebarMoreFlyout } from "@/components/layout/SidebarMoreFlyout";
import { useQuickSwitchSettings } from "@/store/quickSwitchSettings";
import { useAppInstance } from "@/hooks/useAppInstance";
import { usePublishIdentity } from "@/hooks/usePublishIdentity";
import { PetMark } from "@/components/pets/PetMark";
import { MarketplaceIcon } from "@/components/icons/sectionIcons";
import { startNewTextChat } from "@/lib/newChat";
import { useUserName } from "@/hooks/useUserName";
import { useAgentChatStore } from "@/store/agentChat";
import { apiKeysHealthError } from "@/lib/apiKeysTab";
// The person's most-used agents. The roster query and the agent faces live in
// the society code, so they load on their own chunk, not in the sidebar's.
const SidebarAgents = lazy(() => import("@/components/layout/SidebarAgents"));
// The update button renders nothing on most launches; loaded on its own so
// the title-strip module it lives in stays out of the sidebar's chunk.
const UpdateButton = lazy(() =>
import("@/components/layout/TopBar").then((m) => ({ default: m.UpdateButton })),
);
/*
* Why `clsx` and not `cn` on the rows below.
*
* `cn` runs tailwind-merge, which decides that anything matching `text-*` that
* is not one of ITS known size names is a text COLOUR. The design system's
* scale — `text-body`, `text-meta`, `text-title`, `text-micro` — is not in that
* list, so a class list holding both a size and a colour ends up with only the
* colour: `cn("text-body", "text-muted-foreground")` returns
* `"text-muted-foreground"` and the row silently falls back to the inherited
* 16 px. Font size and colour are different CSS properties and never conflict
* in the stylesheet, so plain concatenation is the correct behaviour here.
*
* The real fix is one line in `lib/utils.ts` — teach tailwind-merge the scale
* via `extendTailwindMerge({ extend: { classGroups: { "font-size": [{ text:
* ["display","page","title","reading","body","meta","micro"] }] } } })`. That
* file is outside this change; once it lands these can go back to `cn`.
*/
/**
* The voice status dot, in the three colours a status is allowed to have.
*
* It used to run on four shades of grey — `bg-muted-foreground/50`,
* `bg-muted-foreground`, `bg-foreground/70`, `bg-foreground` — which is a ramp
* nobody can read: "listening" and "idle" differed by an opacity, and the
* loudest value on the ramp was "paused". Colour carries exactly three
* meanings in this product, so the dot carries them too: green while the voice
* path is actually doing something, red when it broke, amber while it is only
* half up, and neutral ink when it is simply at rest.
*/
const VOICE_STATE_STYLE: Record<string, { dot: string; pulse: boolean }> = {
// "Ready" IS a life state: the stack is up and waiting for the wake word.
// A grey dot beside the word "Ready" told the reader "off".
idle: { dot: "bg-success", pulse: false },
listening: { dot: "bg-success", pulse: true },
thinking: { dot: "bg-success", pulse: true },
speaking: { dot: "bg-success", pulse: true },
// The user muted or suspended the pipeline: neither working nor broken.
paused: { dot: "bg-muted-foreground", pulse: false },
error: { dot: "bg-destructive", pulse: false },
// Not a supervisor state — the surface's own "a realtime transport is
// negotiating" phase, which no backend state covers. Half up, so amber.
connecting: { dot: "bg-warning", pulse: true },
};
export interface SidebarProps {
/**
* Rendered width in px. Owned by the app shell, because the seam that changes
* it lives BETWEEN the sidebar and the main area — see `PaneResizer`. Left
* optional so the sidebar still renders standalone (tests, storybook-style
* one-offs) at its designed width.
*/
width?: number;
/**
* Is the sidebar deliberately collapsed to its icon rail?
*
* Separate from `width` because the two answer different questions. The width
* is a drag preference and survives a collapse — expanding restores the
* column the user sized, not the designed default. Collapsing is a STATE, and
* the app opens in it: the sidebar is navigation, and navigation is not what
* the window is for. Left optional so the sidebar still renders standalone.
*/
collapsed?: boolean;
}
/** Width the sidebar was designed at, and the one a double-click restores.
* 240 since 2026-09-02 (v4 redesign): the Cursor / Grok column. The
* navigation is a single 14 px list now, so it fits; the Agentic IDE's
* chat list, which drove the older 400, is still one drag away and the
* dragged width is remembered. */
export const SIDEBAR_DEFAULT_WIDTH = 240;
/**
* localStorage key the dragged width is remembered under.
*
* `v2` since 2026-08-27. The seam used to stop at 200 px, and a column dragged
* to that floor back then stayed there through every default since — on the
* maintainer's desktop the Agentic IDE's session list was still 200 px wide
* when its rows were redesigned around a two-line title that holds a whole
* 48-character recap at the designed 320 (`WorkspaceChats`). At 200 the same
* row holds twelve characters a line, so nothing about the redesign reached
* the one box it was asked for. A new key seeds every column at the designed
* width once; a dragged width is remembered again from there.
*
* `v3` with the 400 px default (same day): the wider column is the point of
* the change, so every existing column is re-seeded at it once more.
*
* `v4` with the 240 px default (2026-09-02): the redesign's column.
*/
export const SIDEBAR_WIDTH_STORAGE_KEY = "jarvis.sidebar.width.v4";
/**
* Narrowest the sidebar goes: the nav icons, and nothing else.
*
* The seam used to stop at 200 px, which is wide enough to still read every
* label — so in the Agentic IDE, where a workspace of a dozen terminals wants
* every pixel, a fifth of the window stayed spent on a list nobody was reading.
* The rail keeps navigation one click away (the icons are still there, each
* with its label on hover) while giving that space back to the panes. The
* rail IS the deck's dock (`DockRail`) — same icons, same magnification, same
* signals — so leaving the deck never drops the navigation back to a plainer
* list.
*/
export const SIDEBAR_RAIL_WIDTH = 64;
/**
* Below this dragged width the sidebar SNAPS to the rail rather than clipping.
*
* Between the two there is no useful layout: a 120 px sidebar shows half a word
* per row, which reads as a broken column rather than a deliberate one. So the
* band is skipped — pull past it and you get icons, pull back and you get text.
*/
export const SIDEBAR_RAIL_AT_WIDTH = 168;
export function Sidebar({
width = SIDEBAR_DEFAULT_WIDTH,
collapsed = false,
}: SidebarProps = {}) {
const t = useT();
const profilePrefetch = useSectionPrefetch("profile");
const marketplacePrefetch = useSectionPrefetch("marketplace");
const active = useEventStore((s) => s.activeSection);
const openVoiceThread = useEventStore((s) => s.activeKind === "voice" && Boolean(s.activeThreadId));
const agentChatOpen = useHomeStore((s) => s.agentChatId !== null);
const setActive = useEventStore((s) => s.setActiveSection);
const activeIdeWorkspaceId = useIdeProjectsStore((s) => s.activeWorkspaceId);
const openIdeWorkspaceOptions = useIdeProjectsStore((s) => s.openWorkspaceOptions);
const toggleIdeVoice = useIdeProjectsStore((s) => s.toggleVoice);
const voiceState = useEventStore((s) => s.voiceState);
const assistantName = useEventStore((s) => s.assistantName);
// The search bar takes the identity row's place while the quick
// switcher is on; switched off, the row comes back as it was.
const searchBarOn = useQuickSwitchSettings((s) => s.enabled);
// The dev instance (a second, restartable app beside the live one — see
// dodaios.core.instance) shows a small tag so the two windows are never
// confused; the default app shows nothing here.
const appInstance = useAppInstance();
const devTag = appInstance?.isDev ? appInstance.name.toUpperCase() : null;
// The front page's nav row names the face the switch picked (Voice / Chat),
// see `presentNavItem`.
const surface = useHomeStore((s) => s.surface);
/*
* The Agentic IDE in chat mode puts ITS chats at the top of this column.
*
* Chat mode is a surface, not a layout — the conversations you are having in
* the workspace you opened, grouped by folder — and a chat surface with its
* history two clicks away is a chat surface nobody uses. So while it is on,
* `WorkspaceChats` leads the column and the sections follow underneath.
*
* It used to TAKE the column instead, with a "Sections" button swapping the
* two faces. That made the two halves of the navigation mutually exclusive:
* asking for a section threw the sessions away, and there was no state that
* showed both (maintainer report 2026-08-27). Stacked, nothing is ever a
* click away from being lost — the sessions stay put while a section is
* picked, and the sections stay reachable while the sessions are read.
* Only while the IDE is the section on screen: every other section gets the
* plain navigation, with no workspace list bolted on top of it.
*/
/*
* Is there anything for this column to list?
*
* Measured on the OPEN WORKSPACES, not on the active one. The two differ in
* exactly one state and it is a state the user reaches on purpose: opening
* one more workspace deactivates the front tab while the launcher asks for
* a folder. Gated on the active workspace, the whole chat navigation
* vanished at that moment and came back when the new workspace started —
* so asking for a second project threw away the list of the first, which
* reads as the sidebar breaking rather than a wizard opening.
*
* The old reading ("no workspace open means the wizard, not a chat") was
* written when this column was headed "This workspace". It lists every open
* workspace as its own band now, so it has something true to say for as
* long as any of them is running.
*/
const onIdeSection = IDE_SECTIONS.includes(active);
// An empty chat on the front page: nothing open, nothing being read.
const onEmptyChat = useAgentChatStore(
(st) => active === "chats" && !st.activeSessionId && st.timeline.items.length === 0,
) && !openVoiceThread && !agentChatOpen;
const identity = usePublishIdentity();
const userName = useUserName();
// The person by first name once the Profile knows it, else their
// marketplace login, else the plain word — never an invented name.
const footerName =
userName?.split(/\s+/)[0] ||
(identity.data?.signed_in && identity.data.login) ||
t("nav.profile");
// Shared readiness derivation (same source the banner + chat empty-state use).
const { connected, voiceWarming, bootWarming, warming } = useVoiceReadiness();
// Per-section provider health (same source as the API-Keys tab dots). The
// sidebar surfaces only a hard "error" — a provider that is set up but failing
// — so a broken key is visible from anywhere without opening the page. The
// amber "needs setup" state is intentionally NOT shown here: on a fresh install
// every unconfigured section would light up and the bar would never be calm.
const { health: sectionHealth } = useSectionHealth();
const apikeysHasError = useMemo(() => apiKeysHealthError(sectionHealth), [sectionHealth]);
// The footer card IS the button that opens API Keys, so its dot carries that
// page's verdict rather than a decorative grey mark. Three honest states:
// something is failing, something has answered, or nothing has reported yet
// — a fresh install must not claim green before a single provider replied.
// A connected marketplace plugin whose token was revoked/expired (needs_reauth)
// — surfaced as an amber dot on the row that fronts Plugins ("Skills & Tools"),
// so a dead connection is visible app-wide, not only on the Plugins page. The
// names let the tooltip say WHICH plugin, not just "something is off".
const pluginAttention = usePluginAttention();
const pluginsNeedReconnect = pluginAttention.count > 0;
// The Local models health monitor (D7) writes a `local_models` record; a
// failing or half-configured local setup marks the profile button, the
// hub's entry point — badge only, never a toast.
const localModelsHealth = sectionHealth.local_models;
const localModelsNeedAttention =
localModelsHealth?.status === "error" || localModelsHealth?.status === "needs_setup";
// Name the culprit(s) in the hover text so the dot stops being cryptic; the
// full plain-language banner + jump button live in the Plugins view itself.
const pluginWarnTitle = pluginAttention.names.length
? `${t("sidebar.plugins_reconnect_alert")}: ${pluginAttention.names.join(", ")}`
: t("sidebar.plugins_reconnect_alert");
const agentsCount = useEventStore((s) =>
s.events.filter((e) => e.name === "AgentStateChange").length > 0 ? undefined : 0,
);
// Proposals that wait for the person's yes or no — a quiet number, never a
// toast or a sound (the self-building loop does not interrupt).
const selfBuildWaiting = useSelfBuildWaiting();
// Read for the status line's connecting phase. Same resolver as the
// mission-deck header and orb (`useVoiceMode`): a negotiating realtime
// transport outranks the pipeline's own state.
const voiceMode = useVoiceMode();
// The window connects in ~1s but the voice feature warms up ~20s in the
// background. During that gap show a "Voice starting…" spinner instead of the
// normal idle "Ready" dot (which would falsely imply the mic already works).
// Disconnected outranks warmup — "Offline" is the honest state with no socket.
// voiceWarming / bootWarming / warming come from the shared useVoiceReadiness
// hook so the sidebar dot, the banner and the chat empty-state never disagree.
const showSpinner = warming || voiceMode.connecting;
const vs = voiceMode.connecting
? VOICE_STATE_STYLE.connecting
: VOICE_STATE_STYLE[voiceState] ?? VOICE_STATE_STYLE.idle;
// A negotiating realtime transport outranks the pipeline's own state: the
// subscription route needs 15-45 s before it can hear anything, and showing
// the stale pre-call state there is what made a live handshake look frozen.
const voiceLabel = !connected
? bootWarming
? t("voice_state.booting")
: t("voice_state.offline")
: voiceWarming
? t("voice_state.starting")
: voiceMode.connecting
? t("voice_state.connecting")
: t(`voice_state.${voiceState}`);
// The header spells the state out only when it is news — anything but a
// connected, warmed-up pipeline at rest. See the header row below.
const voiceHasNews = !connected || showSpinner || voiceState !== "idle";
// Dragged past the snap point the sidebar becomes a rail of icons. Everything
// that only makes sense with a label beside it steps aside; the
// navigation itself never does, because losing it would make the rail a dead
// end rather than a narrow sidebar.
// Two independent ways into the rail: the explicit toggle, and dragging the
// seam past the snap point. Either one alone is enough — a user who dragged
// the column narrow gets icons without having to also find the button.
const railed = collapsed || width < SIDEBAR_RAIL_AT_WIDTH;
const allItems = NAV_GROUPS.flat();
const findItem = (id: string) => allItems.find((item) => item.id === id)!;
const toolIds = ["memory", "board", "docs", "sessions", "clis"];
const toolItems = toolIds.map(findItem);
// Artifacts ("visualization") sits directly in the main list where the
// retired "Jarvis Tools" folder used to be — it was the only entry hiding
// behind "Show more" that users reached for daily, while the tools folder
// duplicated exactly what "Show more" already lists.
// "Built for you" moved behind "More" (2026-11-02): the main list is the
// agents, the IDE, the Verse, the voice, the extensions and the artifacts.
const primaryIds = ["chats", "agents", "dictation", "visualization", "agentic-ide", "plugins", "marketplace"];
// The Settings hub owns its entries — they live in the hub's left
// navigation now, so "Show more" must not list them a second time. The set
// itself is named once in `navGroups` (`SETTINGS_HUB_IDS`).
const assignedIds = new Set([...primaryIds, ...toolIds, ...SETTINGS_HUB_IDS]);
const moreItems = [...toolItems, ...allItems.filter((item) => !assignedIds.has(item.id))];
// Lit while any hub section is on screen — the profile button IS the hub's
// entry point now, so it carries the "you are here" state for all of them.
const hubActive = (SETTINGS_HUB_IDS as readonly string[]).includes(active);
// Rows read quietly: regular weight, light ink at
// rest (muted grey made every entry look disabled), the icon in the same
// ink, a lift on hover. Section labels and tail rows stay muted.
// The Verse is not a section of its own: it is the Agents section's
// full-window "Verse" face (the playable ship). Its row opens Agents and
// switches that face on; Escape or the caption switch leads back.
const verseOn = useVerseModeStore((s) => s.open);
const verseItem: NavItem = {
...findItem("agents"),
labelKey: "nav.verse",
fallbackLabel: "Verse",
icon: Building2,
matchIds: undefined,
};
const openVerse = () => {
useVerseModeStore.getState().request();
setActive("agents");
};
const rowClass = "flex min-h-8 w-full items-center gap-3 rounded-lg px-3 text-base text-foreground transition-colors hover:bg-secondary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring";
const renderRow = (raw: NavItem, compact = railed) => {
const item = presentNavItem(raw, surface);
const isActive = item.matchIds ? item.matchIds.includes(active) : item.id === active;
return <NavRow key={item.id} item={item} label={resolveNavLabel(t, item)} compact={compact}
// While the Verse covers the Agents section, its own row is the lit one.
active={isActive && !(item.id === "agents" && verseOn)}
badge={item.id === "agents" ? agentsCount : item.id === "self-build" ? selfBuildWaiting : undefined}
betaLabel={item.beta ? t("nav.agentic_ide_beta") : undefined}
alert={item.id === "apikeys" && apikeysHasError} alertTitle={t("sidebar.apikeys_alert")}
warn={item.id === "plugins" && pluginsNeedReconnect}
warnTitle={pluginWarnTitle}
// Shift+click opens the section in a tile beside the focused one.
onClick={(event?: ReactMouseEvent) => {
if (event?.shiftKey) useTilingStore.getState().openBeside(item.id);
else setActive(item.id);
}} />;
};
return (
// No right border: the draggable seam beside it draws that line now, and
// two 1px lines three pixels apart read as a rendering fault.
// z-20: above the stage column, which carries no z-index of its own so
// that the overlays inside it are not trapped below this one (App.tsx).
// That same open stage means a section's own z-20 layer (the IDE's pane
// chat, say) ties with this column and wins on DOM order — so the rail's
// hover label, which flies out past the sidebar's edge, does NOT rely on
// this z-index: `DockRail` portals it to <body> at the tooltip level. The
// app-wide layers (toasts, docks, dialogs) all sit at z-40 and above and
// really do cover this column.
<aside
style={{ width: railed ? SIDEBAR_RAIL_WIDTH : width }}
data-testid="sidebar"
data-railed={railed ? "true" : "false"}
className="jarvis-nav-surface relative isolate z-20 flex h-full shrink-0 flex-col pt-8"
>
{/* One 8px gutter down the whole column — header, navigation and footer
share it, so the rows, the "+ New" button and the brain card all line
up on the same left edge. */}
<div className={cn(railed ? "px-3 py-2.5" : "flex h-10 items-center px-4")}>
<div
className={cn(
"flex items-center",
railed ? "flex-col justify-center gap-1.5" : "w-full gap-2",
)}
>
{(railed || !searchBarOn) && <span
data-testid="sidebar-style-avatar"
data-variant="logo"
title={railed ? `${assistantName} — ${voiceLabel}` : undefined}
className={cn("relative shrink-0", railed ? "h-9 w-9" : "h-5 w-5")}
>
{railed && devTag && (
<span
data-testid="sidebar-instance-tag"
title={t("sidebar.instance_dev_hint")}
className="absolute -bottom-1 -right-1 z-10 rounded-sm bg-primary px-1 text-xs font-medium leading-none text-primary-foreground"
>
{devTag}
</span>
)}
<PetMark size={railed ? 36 : 20} reactive />
</span>}
{/* One quiet row, like the workspace switcher in Linear or Cursor:
mark, name, status dot. It used to be a two-line identity card
whose second line said "Ready" for as long as nothing was wrong,
which is almost always — the one word that carries no news took
the loudest spot in the column. The dot says "fine" on its own
(its hover and accessible name still carry the word); the word
only appears when there IS news: starting, offline, error. */}
{!railed && searchBarOn && (
<SidebarSearchBar
assistantName={assistantName}
status={
<>
{voiceHasNews && (
<span className="max-w-[7rem] shrink-0 truncate text-xs text-muted-foreground">
{voiceLabel}
</span>
)}
{devTag && (
<span
data-testid="sidebar-instance-tag"
title={t("sidebar.instance_dev_hint")}
className="shrink-0 rounded-sm bg-primary px-1.5 text-xs font-medium leading-none text-primary-foreground"
>
{devTag}
</span>
)}
{showSpinner ? (
<Loader2
className="h-3 w-3 shrink-0 animate-spin text-muted-foreground"
data-testid="voice-starting-spinner"
aria-hidden
/>
) : (
<span
data-testid="sidebar-voice-dot"
role="img"
aria-label={voiceLabel}
title={voiceLabel}
className={cn(
"h-1.5 w-1.5 shrink-0 rounded-full",
vs.dot,
vs.pulse && "animate-jarvis-pulse",
)}
/>
)}
</>
}
/>
)}
{!railed && !searchBarOn && (
<div
className="flex min-w-0 flex-1 items-center gap-2 text-sm"
title={voiceLabel}
>
<span className="truncate font-medium text-foreground-strong">{assistantName}</span>
{devTag && (
// A mark, not a status: the fill is the neutral accent, so it
// never competes with the green/amber/red the voice dot
// beside it uses to mean something.
<span
data-testid="sidebar-instance-tag"
title={t("sidebar.instance_dev_hint")}
className="shrink-0 rounded-sm bg-primary px-1.5 text-xs font-medium leading-none text-primary-foreground"
>
{devTag}
</span>
)}
{showSpinner ? (
<Loader2
className="h-3 w-3 shrink-0 animate-spin text-muted-foreground"
data-testid="voice-starting-spinner"
aria-hidden
/>
) : (
<span
data-testid="sidebar-voice-dot"
role="img"
aria-label={voiceLabel}
className={cn(
"h-1.5 w-1.5 shrink-0 rounded-full",
vs.dot,
vs.pulse && "animate-jarvis-pulse",
)}
/>
)}
{voiceHasNews && (
<span className="truncate text-xs text-muted-foreground">{voiceLabel}</span>
)}
</div>
)}
{railed &&
(showSpinner ? (
<Loader2
className="h-3.5 w-3.5 shrink-0 animate-spin text-muted-foreground"
data-testid="voice-starting-spinner"
aria-hidden
/>
) : (
<span
className={cn(
"h-2 w-2 rounded-full",
vs.dot,
vs.pulse && "animate-jarvis-pulse",
)}
aria-hidden
/>
))}
</div>
</div>
<div className="flex min-h-0 flex-1 flex-col overflow-y-auto scrollbar-jarvis">
{/* The IDE has no "back" row: the caption's back arrow leaves it, so
the workspace tree starts right under the sidebar header. */}
{onIdeSection ? (railed && <nav aria-label={t("sidebar.ide_navigation")} className="px-2 pt-2">
<div className="flex flex-col items-center gap-1">
<button type="button" aria-label={t("sidebar.workspace_options")} title={t("sidebar.workspace_options")}
disabled={!activeIdeWorkspaceId}
onClick={() => { if (activeIdeWorkspaceId) openIdeWorkspaceOptions(activeIdeWorkspaceId); }}
className="flex h-9 w-9 items-center justify-center rounded-lg text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-35">
<MoreHorizontal aria-hidden className="h-4 w-4" />
</button>
<button type="button" aria-label="Dodaios Live" title="Dodaios Live" onClick={toggleIdeVoice}
className="flex h-9 w-9 items-center justify-center rounded-lg text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">
<Mic aria-hidden className="h-4 w-4" />
</button>
</div>
</nav>) : <nav aria-label={t("sidebar.sections")} className="space-y-px px-2 py-2">
<ul className="space-y-px">
{/* One door: a fresh typed chat. Voice is a mode INSIDE the chat
now (its top bar's button), so there is nothing to choose
between here (2026-10-01). */}
<li><button type="button" data-testid="sidebar-new-chat" data-tour="new-chat"
aria-label={t("sidebar.new_chat")} title={t("sidebar.new_chat")}
className={cn(rowClass, onEmptyChat && "bg-secondary text-foreground-strong")}
onClick={() => { useHomeStore.getState().setSurface("chat"); startNewTextChat(); }}>
<Plus aria-hidden strokeWidth={1.75} className="h-[18px] w-[18px] shrink-0" />
{!railed && <span>{t("sidebar.new_chat")}</span>}
</button></li>
{/* The order the maintainer chose (2026-11-02): the agents, where
they code, the Verse, the voice, then the extensions and the
artifacts.
Everything else sits behind "More". */}
{renderRow(findItem("agents"))}
{renderRow(findItem("agentic-ide"))}
<NavRow key="verse" rowId="verse" item={verseItem} label={resolveNavLabel(t, verseItem)}
compact={railed} active={active === "agents" && verseOn} onClick={openVerse} />
{renderRow(findItem("dictation"))}
</ul>
<ul className="space-y-px">
{renderRow({ ...findItem("plugins"), labelKey: "sidebar.extensions_label" })}
{renderRow(findItem("visualization"))}
</ul>
<SidebarMoreFlyout
items={moreItems}
railed={railed}
rowClass={rowClass}
label={t("sidebar.more")}
renderRow={(item) => renderRow(item, false)}
/>
</nav>}
{!railed && (onIdeSection
? <LazyIdeProjectTree />
: <><Suspense fallback={null}><SidebarAgents /></Suspense><section className="mt-5 px-2 pb-3" aria-label={t("sidebar.recent_chats")}><RecentChats /></section></>)}
</div>
{/* The footer is one button now, not a popup: it opens the Settings hub
on the Profile tab. The hub carries every former popup entry
(Profile, {name}.md, Contacts, Spend, Socials, API Keys, Local
models, Settings, Feedback) in its own left navigation.
The attention dot stays — a failing provider, or a local setup that
needs care, must be visible without opening anything. */}
<div className="shrink-0 border-t border-border px-2 py-1.5">
<div className={cn("flex items-center gap-0.5", railed && "flex-col")}>
<button type="button" {...profilePrefetch} onClick={() => setActive("profile")} title={t("nav.profile")}
data-testid="sidebar-profile-toggle"
data-tour="settings"
className={cn(rowClass, "min-w-0 flex-1", hubActive && "jarvis-nav-active bg-secondary text-foreground")}>
<span className="relative shrink-0">
<span aria-hidden data-testid="sidebar-profile-initial"
className="flex h-6 w-6 items-center justify-center rounded-full bg-secondary text-xs font-medium uppercase text-muted-foreground">
{footerName.trim().charAt(0) || "?"}
</span>
{(apikeysHasError || localModelsNeedAttention) && <span data-testid="sidebar-profile-attention"
role="status" aria-label={t("sidebar.apikeys_alert")}
className={cn("absolute -bottom-0.5 -right-0.5 h-2 w-2 rounded-full ring-2 ring-sidebar", apikeysHasError ? "bg-destructive" : "bg-warning")} />}
</span>
{!railed && <span data-testid="sidebar-profile-name" className="min-w-0 flex-1 truncate text-left">{footerName}</span>}
</button>
{/* The update lives here now, where Claude keeps its download icon:
in sight on every screen, not among the window buttons. */}
<Suspense fallback={null}><UpdateButton placement="sidebar" /></Suspense>
<button type="button" {...marketplacePrefetch} onClick={() => setActive("marketplace")} title={t("nav.marketplace")}
aria-label={t("nav.marketplace")} data-testid="nav-row-marketplace"
className="flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-secondary hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">
<MarketplaceIcon aria-hidden strokeWidth={1.75} className="h-4 w-4" />
</button>
</div>
</div>
</aside>
);
}
function NavRow({
compact = false,
item,
label,
active,
badge,
betaLabel,
alert = false,
alertTitle,
warn = false,
warnTitle,
expand,
rowId,
onClick,
children,
}: {
compact?: boolean;
item: NavItem;
label: string;
active: boolean;
badge?: number;
/** A chevron at the row's end that folds `children` out under the row.
* It is a second button beside the row, not a part of it: the row keeps
* opening its section, the chevron only opens the list. */
expand?: { open: boolean; onToggle: () => void; label: string };
/** What hangs under the row while `expand.open` — the Chat row's history. */
children?: ReactNode;
/** Small pill rendered right after the label (e.g. "Beta") — set from
* `item.beta`, translated by the caller so this component stays i18n-free. */
betaLabel?: string;
/** Draw a red status dot on the row — a section this row fronts has a provider
* that is set up but failing, so the problem is visible app-wide. */
alert?: boolean;
/** Plain-language hover text for the alert dot. */
alertTitle?: string;
/** Draw an amber status dot — a softer "needs attention" than `alert` (e.g. a
* connected plugin whose token was revoked and needs a one-click reconnect). */
warn?: boolean;
/** Plain-language hover text for the warn dot. */
warnTitle?: string;
/** Test id when the row is not a section of its own (the Verse). */
rowId?: string;
onClick: () => void;
}) {
const prefetch = useSectionPrefetch(item.id);
const id = rowId ?? item.id;
const Icon = item.icon;
const hint = alert ? alertTitle : warn ? warnTitle : undefined;
/*
* Selection is drawn on the WHOLE ROW.
*
* It used to be a `bg-foreground/10` fill on the 24×24 icon box while the
* ~200×40 row it belongs to stayed at the rail's own ground — a correct lift
* spent on 3.5 % of the thing it was meant to mark, which is why "you are
* here" was the hardest question to answer in this app. The row takes the
* fill now (one step up the ladder, inset from the column edge by the nav's
* own padding) plus the strong ink, and the icon box is gone entirely: it
* existed only to hold that fill.
*
* Hover stops one rung BELOW selection — `bg-card`, not `bg-secondary` — so
* a hovered row and the selected row never look alike. That difference is
* the whole point of a fill-based selection; matching them would give the
* fill with one hand and take the meaning away with the other.
*/
return (
<li>
{/* The chevron is positioned against THIS box, not the <li>. If the
open list lived in the same relative parent, `top-1/2` walked to
the middle of the chats and the rows painted over the only control
that folds them away (maintainer, 2026-09-02). */}
<div className={expand ? "relative" : undefined}>
<button
type="button"
data-testid={`nav-row-${id}`}
{...prefetch}
data-tour={`nav-${item.id}`}
onClick={onClick}
title={compact ? `${label}${hint ? ` — ${hint}` : ""}` : hint}
aria-label={compact ? label : undefined}
className={clsx(
"group relative flex h-8 w-full items-center gap-3 rounded-lg px-3 text-base transition-colors",
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
// Leave the chevron its own column so the two buttons never overlap.
expand && "pr-9",
// Rest is muted ink; hover AND active are the same lift with body
// ink, and only the active row carries the 2 px accent bar at the
// left edge (`.jarvis-nav-active`).
active
? "jarvis-nav-active bg-secondary text-foreground-strong"
: "text-foreground hover:bg-secondary",
)}
>
<Icon
aria-hidden
strokeWidth={1.75}
className={cn(
"h-[18px] w-[18px] shrink-0 transition-colors",
active ? "text-foreground-strong" : "text-foreground",
)}
/>
<span className={cn("flex min-w-0 flex-1 items-center gap-2 text-left", compact && "hidden")}>
{/* The row is a fixed 40px now, so a long label has to be cut rather
than allowed to wrap out of it. */}
<span className="truncate">{label}</span>
{betaLabel && (
<span
data-testid={`nav-beta-${item.id}`}
className="shrink-0 rounded-sm border border-border bg-secondary px-1 text-xs font-medium text-muted-foreground"
>
{betaLabel}
</span>
)}
</span>
{/* No ring around these: they sit in clear space at the row's end, and
a rim on something that already has a fill is one device too many. */}
{alert && (
<span
data-testid={`nav-alert-${item.id}`}
role="status"
aria-label={alertTitle}
className="h-2 w-2 shrink-0 rounded-full bg-destructive"
/>
)}
{!alert && warn && (
<span
data-testid={`nav-warn-${item.id}`}
role="status"
aria-label={warnTitle}
className="h-2 w-2 shrink-0 rounded-full bg-warning"
/>
)}
{badge !== undefined && badge > 0 && (
<span className="shrink-0 rounded-sm bg-secondary px-1 text-xs tabular-nums text-muted-foreground">
{badge}
</span>
)}
</button>
{expand && (
<button
type="button"
onClick={expand.onToggle}
aria-expanded={expand.open}
aria-label={expand.label}
title={expand.label}
data-testid={`nav-expand-${item.id}`}
className={cn(
"absolute right-2 top-1/2 z-10 flex h-6 w-6 -translate-y-1/2 items-center justify-center rounded-md transition-colors",
// `hover:bg-background/60` painted the PAGE over the rail here,
// i.e. it went darker under the pointer. Up the ladder instead.
"text-muted-foreground hover:bg-surface-raised hover:text-foreground",
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
)}
>
<ChevronDown
aria-hidden
className={cn("h-3.5 w-3.5 transition-transform", expand.open && "rotate-180")}
/>
</button>
)}
</div>
{expand?.open && children}
</li>
);
}