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(chat): rebuild the front-page composer row with labelled picks

rubenluetke10-beep8326ab384533
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/AgentComposer.tsx b/jarvis/ui/web/frontend/src/components/agentchat/AgentComposer.tsx
index 9d1c166563..4d0b81a2cf 100644
--- a/jarvis/ui/web/frontend/src/components/agentchat/AgentComposer.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentchat/AgentComposer.tsx
@@ -35,6 +35,11 @@ import { ChatAttachmentStrip } from "@/components/agentchat/ChatAttachmentStrip"
import { DictationButton } from "@/components/agentchat/DictationButton";
import { ComposerAddMenu } from "@/components/agentchat/ComposerAddMenu";
import { ComposerChipField, type ComposerChipFieldHandle } from "@/components/agentchat/ComposerChipField";
+import {
+ COMPOSER_CONTROL_CLASS,
+ ComposerBrainPicker,
+ type BrainSection,
+} from "@/components/agentchat/ComposerBrainPicker";
import type { ToolChoice } from "@/components/agentchat/toolChoices";
import { readComposerDraft, useComposerDraft, writeComposerDraft } from "./composerDrafts";
import { useAppshotClaim } from "@/components/agentchat/useAppshotClaim";
@@ -84,14 +89,15 @@ import { cn } from "@/lib/utils";
* A pick applies to the open session at once (the backend patches it and
* the next turn runs on it); with no session open it seeds the next one.
*
- * The front page (`jarvis` surface) draws the same controls the quiet way
- * (2026-10-01, judged against the Claude app's composer): the text on top,
- * and one row under it — a round "+" and the permission glyph on the left;
- * on the right ONE brain pick (provider and model in one list), the effort
- * as a muted word, dictation, and one round button that is voice mode while
- * the box is empty, Send once there is something to send, and Stop while a
- * turn runs. The IDE keeps the labelled pills: there a folder, a stance and
- * a model are things a person checks before every run.
+ * The front page (`jarvis` surface) draws the same controls as one quiet
+ * row under the text (2026-10-05): a round "+", then three labelled picks
+ * split by hairlines — the brain (provider mark and model, one menu with a
+ * provider rail and favourites), the effort word, the permission stance as
+ * glyph and word — and on the right dictation and one round blue button
+ * that is voice mode while the box is empty, Send once there is something
+ * to send, and Stop while a turn runs. The IDE keeps the labelled pills:
+ * there a folder, a stance and a model are things a person checks before
+ * every run.
*/
export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {
const t = useT();
@@ -317,6 +323,19 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {
// pick here is its own thing: what you choose here is what the chat runs.
// A provider's mark plus its live health dot — the same face in the IDE's
// provider list and in the front page's brain pick.
+ // A coding CLI installed on this machine wears its own mark; a catalog row
+ // wears its provider family's. Both are real brand files — the fallback
+ // either would otherwise take is a letter in a box, and a letter is not a
+ // logo.
+ const providerMark = useCallback(
+ (p: ProviderOption) =>
+ p.agentMark ? (
+ <AgentMark agent={p.agentMark} label={p.label} logoUrl={p.logoUrl} variant="plain" size="sm" />
+ ) : (
+ <ProviderLogo providerId={p.id} label={p.label} size="sm" />
+ ),
+ [],
+ );
const providerIcon = useCallback(
(p: ProviderOption) => {
const live = liveHealthFor(p, health[p.id]);
@@ -324,21 +343,7 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {
const working = p.connected && live?.status === "ok";
return (
<span className="relative inline-flex shrink-0">
- {/* A coding CLI installed on this machine wears its own mark; a
- catalog row wears its provider family's. Both are real brand
- files — the fallback either would otherwise take is a letter
- in a box, and a letter is not a logo. */}
- {p.agentMark ? (
- <AgentMark
- agent={p.agentMark}
- label={p.label}
- logoUrl={p.logoUrl}
- variant="plain"
- size="sm"
- />
- ) : (
- <ProviderLogo providerId={p.id} label={p.label} size="sm" />
- )}
+ {providerMark(p)}
{(broken || working) && (
<span
data-testid={`provider-health-${p.id}`}
@@ -358,7 +363,7 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {
</span>
);
},
- [health, t],
+ [health, providerMark, t],
);
const providerGroups = useMemo<ComboboxGroup[]>(() => {
@@ -411,46 +416,62 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {
// The front page's single brain pick: every offered provider as a group,
// its default first, then its models (live when loaded, else curated).
- const brainGroups = useMemo<ComboboxGroup[]>(() => {
+ // Each row says whose model it is on a quiet second line; the rail on the
+ // panel's left picks which provider's rows are listed.
+ const brainProviders = useMemo<ProviderOption[]>(() => {
if (!minimal) return [];
const anyConnected = providers.some((p) => p.connected);
- const shown = anyConnected ? providers.filter((p) => p.connected) : providers;
- return shown.map((p) => {
+ return anyConnected ? providers.filter((p) => p.connected) : providers;
+ }, [minimal, providers]);
+
+ const brainSections = useMemo<BrainSection[]>(
+ () => brainProviders.map((p) => ({ id: p.id, label: p.label, icon: providerIcon(p), muted: !p.connected })),
+ [brainProviders, providerIcon],
+ );
+
+ const brainGroups = useMemo<ComboboxGroup[]>(() => {
+ return brainProviders.map((p) => {
const live = liveModels[p.id];
const models = p.models_source === "live" && live && live.length ? live : (p.curated_models ?? []);
- const icon = providerIcon(p);
const disabled = !p.connected;
const hint = disabled
? p.cli_installed === false
? t("agent_chat.provider_not_installed")
: t("agent_chat.provider_connect")
: undefined;
+ const owner = (note?: string) => (
+ <span className="inline-flex min-w-0 items-center gap-1.5">
+ <span className="inline-flex shrink-0 scale-[0.86]">{providerMark(p)}</span>
+ <span className="truncate">{note ? `${p.label} · ${note}` : p.label}</span>
+ </span>
+ );
return {
id: p.id,
label: p.label,
options: [
{
value: brainValue(p.id, ""),
- label: p.label,
- hint: hint ?? t("agent_chat.model_default"),
- icon,
+ label: t("agent_chat.model_default"),
+ triggerLabel: p.label,
+ description: owner(),
+ hint,
disabled,
- searchText: p.family,
+ searchText: `${p.label} ${p.family}`,
},
...models
.filter((m) => m.id)
.map((m) => ({
value: brainValue(p.id, m.id),
label: m.label || m.id,
- hint: hint ?? m.note,
- icon,
+ description: owner(m.note),
+ hint,
disabled,
searchText: `${p.label} ${m.id}`,
})),
],
};
});
- }, [minimal, providers, liveModels, providerIcon, t]);
+ }, [brainProviders, liveModels, providerMark, t]);
const modelList = useMemo(() => {
if (!provider) return [];
@@ -499,6 +520,23 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {
const showEffort = Boolean(provider) && effortLevels.length > 1;
+ // The front page's effort menu: a heading over the ladder, and the
+ // provider's own default marked so a person can find their way back.
+ const effortMenuGroups = useMemo<ComboboxGroup[]>(
+ () => [
+ {
+ id: "effort",
+ label: t("agent_chat.effort_heading"),
+ options: effortLevels.map((lvl) => ({
+ value: lvl,
+ label: effortLabel(lvl, t),
+ badge: lvl === provider?.default_effort ? t("agent_chat.default_badge") : undefined,
+ })),
+ },
+ ],
+ [effortLevels, provider, t],
+ );
+
const effortGroups = useMemo<ComboboxGroup[]>(
() => [
{
@@ -539,6 +577,26 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {
],
[permissionModes],
);
+ // The front page's permission menu: each stance with its glyph, its name
+ // and one quiet line on what it lets through.
+ const permissionMenuGroups = useMemo<ComboboxGroup[]>(
+ () => [
+ {
+ id: "permission",
+ options: permissionModes.map((m) => {
+ const Icon = permissionModeIcon(m.id);
+ return {
+ value: m.id,
+ label: m.label,
+ description: m.description || undefined,
+ searchText: m.description,
+ icon: <Icon className="h-4 w-4 shrink-0 text-muted-foreground" aria-hidden />,
+ };
+ }),
+ },
+ ],
+ [permissionModes],
+ );
// While Plan is on, the permission pill shows the mode Build would return to.
const permissionValue = planOn ? draft.buildMode || provider?.default_permission_mode || "" : draft.permissionMode;
const permissionDescription =
@@ -576,7 +634,7 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {
className={cn(
"relative flex flex-col transition-[border-color,box-shadow]",
minimal
- ? "gap-2 rounded-[22px] border border-border bg-card px-3 pb-2.5 pt-3 shadow-rim focus-within:border-border-strong"
+ ? "gap-2 rounded-3xl border border-border bg-card px-3 pb-3 pt-3.5 shadow-rim focus-within:border-border-strong"
: "gap-2 rounded-2xl border border-border-strong bg-card p-3 shadow-rim focus-within:border-primary/40",
files.dragging && "border-primary/60",
)}
@@ -595,6 +653,7 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {
attachments={files.attachments}
analyzing={files.analyzing}
onRemove={files.remove}
+ previews={files.previews}
/>
<ComposerTypeahead
anchorRef={cardRef}
@@ -625,10 +684,10 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {
pasteRescue.onPaste();
files.onPaste(e);
}}
- className={cn("max-h-[50vh] scrollbar-jarvis", minimal ? "min-h-[48px] px-1.5 text-base" : "text-reading")}
+ className={cn("max-h-[50vh] scrollbar-jarvis", minimal ? "min-h-[64px] px-2 text-base" : "text-reading")}
/>
{minimal ? (
- <div className="flex items-center gap-1" data-testid="composer-row">
+ <div className="flex min-w-0 items-center gap-0.5" data-testid="composer-row">
<ComposerAddMenu
key={activeSessionId ?? "new"}
compact
@@ -649,33 +708,85 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {
}
disabled={!connected || busy}
/>
- {/* The stance as its glyph alone (maintainer, 2026-10-03): the
- front page runs on Bypass by default, and its shield in the
- warning hue already says "nothing asks" — spelling it out took
- half the row. The name stays in the tooltip and the list. */}
+ {/* Who answers, how hard it thinks, what it may do — three labelled
+ picks in one line, split by hairlines. Each opens its own menu:
+ the models with a provider rail, the effort ladder with the
+ provider's default marked, the stances with one line each. */}
+ <span className="flex min-w-0 items-center" data-testid="composer-brain">
+ <ComposerBrainPicker
+ value={brainValue(draft.provider, draft.model)}
+ groups={brainGroups}
+ sections={brainSections}
+ currentSection={draft.provider}
+ onChange={(v) => {
+ const [nextProvider, nextModel] = splitBrainValue(v);
+ void setDraft(
+ nextProvider !== draft.provider ? { provider: nextProvider, model: nextModel } : { model: nextModel },
+ );
+ }}
+ ariaLabel={t("agent_chat.pick_model")}
+ fallbackLabel={
+ catalogError
+ ? t("agent_chat.catalog_unavailable")
+ : provider
+ ? draft.model || provider.label
+ : t("agent_chat.pick_provider")
+ }
+ searchPlaceholder={t("agent_chat.search_models")}
+ triggerPrefix={provider ? providerIcon(provider) : undefined}
+ disabled={!catalog || (Boolean(locks?.provider) && Boolean(locks?.model))}
+ title={locks?.model ?? locks?.provider}
+ className="min-w-0"
+ />
+ {showEffort && (
+ <>
+ <ControlSeparator />
+ <span className="inline-flex shrink-0" title={locks?.effort}>
+ <Combobox
+ value={draft.effort}
+ groups={effortMenuGroups}
+ onChange={(v) => void setDraft({ effort: v })}
+ ariaLabel={t("agent_chat.pick_effort")}
+ fallbackLabel={effortLabel(draft.effort, t)}
+ disabled={Boolean(locks?.effort)}
+ testId="composer-effort"
+ triggerHint={false}
+ panelMinWidth={220}
+ className={COMPOSER_CONTROL_CLASS}
+ />
+ </span>
+ </>
+ )}
+ </span>
{provider && permissionModes.length > 0 && (
- <span
- title={locks?.permissionMode ?? [permissionLabel, permissionDescription].filter(Boolean).join(" — ")}
- className="inline-flex"
- >
- <Combobox
- value={permissionValue}
- groups={permissionGroups}
- onChange={(v) => void setDraft({ permissionMode: v })}
- ariaLabel={permissionLabel ? `${t("agent_chat.pick_permission")}: ${permissionLabel}` : t("agent_chat.pick_permission")}
- fallbackLabel={t("agent_chat.pick_permission")}
- disabled={Boolean(locks?.permissionMode)}
- testId="composer-permission"
- triggerHint={false}
- iconOnly
- className={cn(
- "h-8 w-8 justify-center gap-0 rounded-full bg-transparent p-0 shadow-none hover:bg-secondary focus-visible:ring-1 [&_svg]:h-4 [&_svg]:w-4",
- permissionModeIcon(permissionValue) === ShieldOff
- ? "text-warning [&_svg]:text-warning"
- : "text-muted-foreground",
- )}
- />
- </span>
+ <>
+ <ControlSeparator />
+ {/* The stance as glyph and word. Full access wears the warning
+ hue, so "nothing asks" reads before anyone opens the menu. */}
+ <span
+ title={locks?.permissionMode ?? [permissionLabel, permissionDescription].filter(Boolean).join(" — ")}
+ className="inline-flex min-w-0 shrink"
+ >
+ <Combobox
+ value={permissionValue}
+ groups={permissionMenuGroups}
+ onChange={(v) => void setDraft({ permissionMode: v })}
+ ariaLabel={permissionLabel ? `${t("agent_chat.pick_permission")}: ${permissionLabel}` : t("agent_chat.pick_permission")}
+ fallbackLabel={t("agent_chat.pick_permission")}
+ disabled={Boolean(locks?.permissionMode)}
+ testId="composer-permission"
+ triggerHint={false}
+ panelMinWidth={320}
+ className={cn(
+ COMPOSER_CONTROL_CLASS,
+ "max-w-[200px] max-md:[&>span.truncate]:sr-only",
+ permissionModeIcon(permissionValue) === ShieldOff
+ ? "text-warning hover:text-warning [&_svg]:text-warning"
+ : undefined,
+ )}
+ />
+ </span>
+ </>
)}
{hasPlan && (
<button
@@ -688,9 +799,9 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {
disabled={Boolean(locks?.permissionMode)}
title={locks?.permissionMode ?? (planOn ? t("agent_chat.plan_hint") : t("agent_chat.build_hint"))}
className={cn(
- "inline-flex h-8 items-center gap-1.5 rounded-full text-xs font-medium transition-colors disabled:opacity-50",
+ "inline-flex h-8 shrink-0 items-center gap-1.5 rounded-lg text-sm font-medium transition-colors disabled:opacity-50",
planOn
- ? "bg-accent-soft px-3 text-accent"
+ ? "bg-accent-soft px-2.5 text-accent"
: "w-8 justify-center text-muted-foreground hover:bg-secondary hover:text-foreground",
)}
>
@@ -698,54 +809,7 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {
{planOn && t("agent_chat.mode_plan")}
</button>
)}
- <span className="flex-1" />
- {/* Model and effort read as one label — "Sonnet 5.5 High ⌄" — the
- way the Codex app draws its brain pick; each half still opens
- its own list. */}
- <span className="inline-flex min-w-0 items-center" data-testid="composer-brain">
- <Pick
- testId="composer-model"
- ariaLabel={t("agent_chat.pick_model")}
- value={brainValue(draft.provider, draft.model)}
- groups={brainGroups}
- onChange={(v) => {
- const [nextProvider, nextModel] = splitBrainValue(v);
- void setDraft(
- nextProvider !== draft.provider ? { provider: nextProvider, model: nextModel } : { model: nextModel },
- );
- }}
- fallbackLabel={
- catalogError
- ? t("agent_chat.catalog_unavailable")
- : provider
- ? draft.model || provider.label
- : t("agent_chat.pick_provider")
- }
- searchPlaceholder={t("agent_chat.search_models")}
- disabled={!catalog || (Boolean(locks?.provider) && Boolean(locks?.model))}
- title={locks?.model ?? locks?.provider}
- className="max-w-[240px]"
- // The model reads as a word; the provider's mark (with its red
- // dot) only joins it when that seat is failing.
- triggerIcon={Boolean(provider?.connected && liveHealthFor(provider, health[provider.id])?.status === "error")}
- chevron={!showEffort}
- compact
- />
- {showEffort && (
- <Pick
- testId="composer-effort"
- ariaLabel={t("agent_chat.pick_effort")}
- value={draft.effort}
- groups={effortGroups}
- onChange={(v) => void setDraft({ effort: v })}
- fallbackLabel={effortLabel(draft.effort, t)}
- disabled={Boolean(locks?.effort)}
- title={locks?.effort}
- muted
- compact
- />
- )}
- </span>
+ <span className="min-w-2 flex-1" />
<input
ref={fileInputRef}
type="file"
@@ -766,6 +830,9 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {
stopLabel={t("chats_view.dictation_stop")}
shape="round"
/>
+ {/* One round action in the signal blue: voice mode while the box is
+ empty, Send once there is something to send, Stop while a turn
+ runs. */}
{live && !commands.isCommand && !(commands.canSteer && value.trim()) ? (
<button
type="button"
@@ -773,7 +840,7 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {
aria-label={t("agent_chat.stop")}
title={t("agent_chat.stop")}
data-testid="composer-stop"
- className="ml-0.5 inline-flex h-8 w-8 items-center justify-center rounded-full bg-foreground text-background transition-colors hover:bg-foreground/85"
+ className={cn(ROUND_ACTION_CLASS, "bg-accent text-accent-foreground hover:bg-accent/85")}
>
<Square className="h-3 w-3 fill-current" />
</button>
@@ -785,9 +852,9 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {
aria-label={t("agent_chat.send")}
data-testid="composer-send"
className={cn(
- "ml-0.5 inline-flex h-8 w-8 items-center justify-center rounded-full transition-colors",
+ ROUND_ACTION_CLASS,
canSend || canFinishDictation
- ? "bg-foreground text-background hover:bg-foreground/85"
+ ? "bg-accent text-accent-foreground hover:bg-accent/85"
: "bg-secondary text-muted-foreground",
)}
>
@@ -801,7 +868,7 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {
aria-label={t("assistant_chat.voice_enter")}
title={fill(t("assistant_chat.voice_enter_hint"), { name: assistantName })}
data-testid="composer-voice-mode"
- className="ml-0.5 inline-flex h-8 w-8 items-center justify-center rounded-full bg-foreground text-background transition-colors hover:bg-foreground/85 disabled:opacity-60"
+ className={cn(ROUND_ACTION_CLASS, "bg-accent text-accent-foreground hover:bg-accent/85 disabled:opacity-60")}
>
<AudioLines className="h-4 w-4" />
</button>
@@ -1141,7 +1208,7 @@ function liveHealthFor(
return live;
}
-/** One compact pick on the composer's bottom row — a pill-sized Combobox. */
+/** One pick on the IDE composer's bottom row — a pill-sized Combobox. */
function Pick({
testId,
ariaLabel,
@@ -1154,10 +1221,6 @@ function Pick({
disabled,
title,
className,
- muted = false,
- triggerIcon = true,
- chevron = true,
- compact = false,
}: {
testId: string;
ariaLabel: string;
@@ -1170,12 +1233,6 @@ function Pick({
disabled?: boolean;
title?: string;
className?: string;
- /** Muted ink — a secondary pick beside a primary one (the effort word). */
- muted?: boolean;
- triggerIcon?: boolean;
- chevron?: boolean;
- /** Half of a joined label (the front page's model + effort): no side padding between the halves. */
- compact?: boolean;
}) {
// The Combobox draws the selected option's own icon; the leading glyph here
// is the column's, shown when the option has none (model, effort, permission).
@@ -1197,22 +1254,26 @@ function Pick({
disabled={disabled}
testId={testId}
triggerHint={false}
- triggerIcon={triggerIcon}
- chevron={chevron}
className={cn(
- compact
- ? "h-8 w-auto max-w-[200px] gap-1 rounded-lg border-transparent bg-transparent px-1 py-0 text-sm font-medium shadow-none [&>svg:last-child]:h-3.5 [&>svg:last-child]:w-3.5"
- : "h-7 w-auto max-w-[200px] gap-1.5 rounded-lg border-transparent bg-transparent py-0 pr-1.5 text-xs font-medium shadow-none",
- muted ? "text-muted-foreground" : "text-foreground",
+ "h-7 w-auto max-w-[200px] gap-1.5 rounded-lg border-transparent bg-transparent py-0 pr-1.5 text-xs font-medium text-foreground shadow-none",
"hover:border-transparent hover:bg-secondary focus-visible:ring-1",
- compact ? undefined : icon && !selectedHasIcon ? "pl-7" : "pl-1.5",
+ icon && !selectedHasIcon ? "pl-7" : "pl-1.5",
)}
/>
</span>
);
}
-const BRAIN_SEP = "\u0001";
+/** The thin upright line between two picks on the front page's row. */
+function ControlSeparator() {
+ return <span aria-hidden className="mx-0.5 hidden h-4 w-px shrink-0 bg-border-strong sm:block" />;
+}
+
+/** The front page's one round action — voice mode, Send or Stop. */
+const ROUND_ACTION_CLASS =
+ "ml-1 inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-full transition-colors";
+
+const BRAIN_SEP ="\u0001";
/** One value for a provider + model pair in the front page's brain pick. */
export function brainValue(provider: string, model: string): string {
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/ChatAttachmentStrip.tsx b/jarvis/ui/web/frontend/src/components/agentchat/ChatAttachmentStrip.tsx
index 951bb63fa4..2861763e44 100644
--- a/jarvis/ui/web/frontend/src/components/agentchat/ChatAttachmentStrip.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentchat/ChatAttachmentStrip.tsx
@@ -2,16 +2,18 @@ import { FileText, ImageIcon, Loader2, X } from "lucide-react";
import type { ChatAttachment } from "@/lib/agentChatApi";
import { fill, useT } from "@/i18n";
+import { cn } from "@/lib/utils";
/**
* The files waiting to go in with the next message.
*
- * Each chip says what was actually LEARNED from the file, not merely that one
- * is attached. That distinction is the whole feature: "screenshot.png" tells
- * the person nothing about whether the model will be able to see it, while
- * "described" and "not described" are the two outcomes they need to tell apart
- * BEFORE pressing Send — and the second happens for real, on any install whose
- * providers cannot see images.
+ * Each card shows the picture itself when its bytes passed through this
+ * window, and says what was actually LEARNED from the file, not merely that
+ * one is attached. That distinction is the whole feature: "screenshot.png"
+ * tells the person nothing about whether the model will be able to see it,
+ * while "described" and "not described" are the two outcomes they need to
+ * tell apart BEFORE pressing Send — and the second happens for real, on any
+ * install whose providers cannot see images.
*
* A near-twin of the Agentic IDE's terminal strip
* (components/agentic/PromptAttachments) and deliberately not shared with it:
@@ -23,20 +25,25 @@ export function ChatAttachmentStrip({
attachments,
analyzing,
onRemove,
+ previews = {},
}: {
attachments: ChatAttachment[];
analyzing: number;
onRemove: (name: string) => void;
+ /** A local picture per image attachment, keyed by its name. */
+ previews?: Record<string, string>;
}) {
const t = useT();
if (attachments.length === 0 && analyzing === 0) return null;
return (
<div
data-testid="chat-attachments"
- className="flex max-h-20 shrink-0 flex-wrap items-center gap-1.5 overflow-y-auto px-1 scrollbar-jarvis"
+ className="flex max-h-32 shrink-0 flex-wrap items-center gap-2 overflow-y-auto px-1 scrollbar-jarvis"
>
{attachments.map((item) => {
const read = item.described_by !== "none" && item.detail.length > 0;
+ const preview = previews[item.name];
+ const Icon = item.kind === "image" ? ImageIcon : FileText;
return (
<span
key={item.name}
@@ -46,32 +53,40 @@ export function ChatAttachmentStrip({
? `${item.detail.slice(0, 400)}${item.detail.length > 400 ? "…" : ""}`
: item.note || item.name
}
- className={
- "flex items-center gap-1.5 rounded-md border px-2 py-1 text-micro " +
- (read
- ? "border-primary/40 bg-primary/10 text-foreground"
- : "border-border text-muted-foreground")
- }
+ className="group/attachment relative flex h-12 max-w-[15rem] items-center gap-2.5 rounded-xl border border-border bg-background/40 py-1 pl-1 pr-2"
>
- {item.kind === "image" ? (
- <ImageIcon className="h-3 w-3 shrink-0" aria-hidden />
- ) : (
- <FileText className="h-3 w-3 shrink-0" aria-hidden />
- )}
- <span className="max-w-[12rem] truncate font-mono">{item.name}</span>
- <span className="shrink-0 text-micro text-muted-foreground">
- {read
- ? item.described_by === "vision"
- ? t("agent_chat.attach_described")
- : t("agent_chat.attach_text_read")
- : t("agent_chat.attach_not_described")}
+ <span className="flex h-10 w-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-secondary text-muted-foreground">
+ {preview ? (
+ <img src={preview} alt="" className="h-full w-full object-cover" />
+ ) : (
+ <Icon className="h-4 w-4" aria-hidden />
+ )}
+ </span>
+ <span className="flex min-w-0 flex-col pr-4">
+ <span className="truncate text-xs font-medium text-foreground">{item.name}</span>
+ <span
+ className={cn(
+ "flex items-center gap-1 truncate text-micro",
+ read ? "text-muted-foreground" : "text-warning",
+ )}
+ >
+ <span
+ aria-hidden
+ className={cn("h-1.5 w-1.5 shrink-0 rounded-full", read ? "bg-success" : "bg-warning")}
+ />
+ {read
+ ? item.described_by === "vision"
+ ? t("agent_chat.attach_described")
+ : t("agent_chat.attach_text_read")
+ : t("agent_chat.attach_not_described")}
+ </span>
</span>
<button
type="button"
aria-label={fill(t("agent_chat.attach_remove"), { name: item.name })}
data-testid={`chat-attachment-remove-${item.name}`}
onClick={() => onRemove(item.name)}
- className="shrink-0 rounded text-muted-foreground transition-colors hover:text-destructive"
+ className="absolute right-1 top-1 inline-flex h-5 w-5 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground focus-visible:ring-1 focus-visible:ring-ring"
>
<X className="h-3 w-3" />
</button>
@@ -81,9 +96,9 @@ export function ChatAttachmentStrip({
{analyzing > 0 && (
<span
data-testid="chat-attachment-working"
- className="flex items-center gap-1.5 rounded-md border border-dashed border-border px-2 py-1 text-micro text-muted-foreground"
+ className="flex h-12 items-center gap-2 rounded-xl border border-dashed border-border px-3 text-xs text-muted-foreground"
>
- <Loader2 className="h-3 w-3 animate-spin" aria-hidden />
+ <Loader2 className="h-3.5 w-3.5 animate-spin" aria-hidden />
{t("agent_chat.attach_working")}
</span>
)}
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/ComposerBrainPicker.test.tsx b/jarvis/ui/web/frontend/src/components/agentchat/ComposerBrainPicker.test.tsx
new file mode 100644
index 0000000000..ab8648130c
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/agentchat/ComposerBrainPicker.test.tsx
@@ -0,0 +1,132 @@
+import { fireEvent, render, screen, within } from "@testing-library/react";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+
+import { ComposerBrainPicker } from "@/components/agentchat/ComposerBrainPicker";
+import { matchPreviews } from "@/components/agentchat/useChatAttachments";
+import type { ChatAttachment } from "@/lib/agentChatApi";
+
+const GROUPS = [
+ {
+ id: "claude",
+ label: "Claude",
+ options: [
+ { value: "claude\u0001", label: "Default model", triggerLabel: "Claude" },
+ { value: "claude\u0001opus", label: "Opus" },
+ ],
+ },
+ {
+ id: "grok",
+ label: "Grok",
+ options: [{ value: "grok\u0001grok-5", label: "Grok 5" }],
+ },
+];
+
+const SECTIONS = [
+ { id: "claude", label: "Claude", icon: <span>C</span> },
+ { id: "grok", label: "Grok", icon: <span>G</span> },
+];
+
+function renderPicker(onChange = vi.fn()) {
+ render(
+ <ComposerBrainPicker
+ value={"claude\u0001opus"}
+ groups={GROUPS}
+ sections={SECTIONS}
+ currentSection="claude"
+ onChange={onChange}
+ ariaLabel="Model"
+ fallbackLabel="Model"
+ searchPlaceholder="Search models…"
+ />,
+ );
+ return onChange;
+}
+
+function optionValues(panel: HTMLElement): (string | null)[] {
+ return within(panel).getAllByRole("option").map((el) => el.getAttribute("data-value"));
+}
+
+describe("ComposerBrainPicker", () => {
+ beforeEach(() => {
+ window.localStorage.clear();
+ Object.defineProperty(HTMLElement.prototype, "scrollIntoView", {
+ configurable: true,
+ writable: true,
+ value: vi.fn(),
+ });
+ });
+ afterEach(() => window.localStorage.clear());
+
+ it("opens on the answering provider and browses another from the rail", async () => {
+ const onChange = renderPicker();
+ expect(screen.getByTestId("composer-model").textContent).toContain("Opus");
+ fireEvent.click(screen.getByTestId("composer-model"));
+ const panel = await screen.findByTestId("composer-model-panel");
+ expect(optionValues(panel)).toEqual(["claude\u0001", "claude\u0001opus"]);
+
+ fireEvent.click(within(panel).getByTestId("composer-model-rail-grok"));
+ expect(optionValues(panel)).toEqual(["grok\u0001grok-5"]);
+ fireEvent.click(within(panel).getByText("Grok 5"));
+ expect(onChange).toHaveBeenCalledWith("grok\u0001grok-5");
+ });
+
+ it("searches every provider whatever the rail shows", async () => {
+ renderPicker();
+ fireEvent.click(screen.getByTestId("composer-model"));
+ const panel = await screen.findByTestId("composer-model-panel");
+ fireEvent.change(within(panel).getByTestId("composer-model-search"), { target: { value: "grok" } });
+ expect(optionValues(panel)).toEqual(["grok\u0001grok-5"]);
+ });
+
+ it("keeps starred models under the star and remembers them", async () => {
+ const onChange = renderPicker();
+ fireEvent.click(screen.getByTestId("composer-model"));
+ let panel = await screen.findByTestId("composer-model-panel");
+ fireEvent.click(within(panel).getByTestId("composer-model-rail-favorites"));
+ expect(within(panel).queryAllByRole("option")).toHaveLength(0);
+ expect(panel.textContent).toContain("Star a model to keep it here");
+
+ fireEvent.click(within(panel).getByTestId("composer-model-rail-claude"));
+ const stars = within(panel).getAllByTestId("composer-model-star");
+ fireEvent.click(stars[1]);
+ // Starring is not picking.
+ expect(onChange).not.toHaveBeenCalled();
+ expect(JSON.parse(window.localStorage.getItem("jarvis.chat.favoriteModels") ?? "[]")).toEqual([
+ "claude\u0001opus",
+ ]);
+
+ fireEvent.click(within(panel).getByTestId("composer-model-rail-favorites"));
+ panel = screen.getByTestId("composer-model-panel");
+ expect(optionValues(panel)).toEqual(["claude\u0001opus"]);
+ });
+});
+
+describe("matchPreviews", () => {
+ const image = (name: string): ChatAttachment => ({
+ name,
+ reference: `@${name}`,
+ kind: "image",
+ detail: "",
+ described_by: "none",
+ note: "",
+ });
+
+ beforeEach(() => {
+ let n = 0;
+ vi.stubGlobal("URL", Object.assign(URL, { createObjectURL: () => `blob:${++n}` }));
+ });
+ afterEach(() => vi.unstubAllGlobals());
+
+ it("pairs by name, and a lone image on both sides by being alone", () => {
+ const shot = new File(["x"], "shot.png", { type: "image/png" });
+ expect(matchPreviews([image("shot.png")], [shot])).toEqual({ "shot.png": "blob:1" });
+ expect(matchPreviews([image("chat-20261005.png")], [shot])).toEqual({ "chat-20261005.png": "blob:2" });
+ });
+
+ it("gives no picture when the pairing is ambiguous or there are no bytes", () => {
+ const a = new File(["a"], "a.png", { type: "image/png" });
+ const b = new File(["b"], "b.png", { type: "image/png" });
+ expect(matchPreviews([image("x.png"), image("y.png")], [a, b])).toEqual({});
+ expect(matchPreviews([image("x.png")], [])).toEqual({});
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/ComposerBrainPicker.tsx b/jarvis/ui/web/frontend/src/components/agentchat/ComposerBrainPicker.tsx
new file mode 100644
index 0000000000..3ee26721be
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/agentchat/ComposerBrainPicker.tsx
@@ -0,0 +1,271 @@
+import { useCallback, useMemo, useState, type ReactNode } from "react";
+import { Star } from "lucide-react";
+
+import { Combobox, type ComboboxGroup } from "@/components/ui/combobox";
+import { useT } from "@/i18n";
+import { cn } from "@/lib/utils";
+
+/**
+ * The front page's brain pick: which provider and which model answer.
+ *
+ * The open panel has two columns. On the left a rail with one mark per
+ * offered provider (plus a star for the models a person keeps reaching for);
+ * on the right a search box and the models of the provider picked in the
+ * rail, each row saying whose model it is under its name. Typing searches
+ * every provider at once, so the rail is for browsing and never hides a
+ * model from someone who knows its name.
+ *
+ * It opens on the provider that is answering now, so the current model is
+ * one glance away. Favourites live in this browser only — a convenience,
+ * not a setting, so a cleared storage just empties the star tab.
+ */
+
+export interface BrainSection {
+ id: string;
+ label: string;
+ icon: ReactNode;
+ /** Shown greyed: the provider is offered but not connected. */
+ muted?: boolean;
+}
+
+const FAVORITES = "favorites";
+const FAVORITES_KEY = "jarvis.chat.favoriteModels";
+
+function readFavorites(): string[] {
+ try {
+ const raw = window.localStorage.getItem(FAVORITES_KEY);
+ const parsed: unknown = raw ? JSON.parse(raw) : [];
+ return Array.isArray(parsed) ? parsed.filter((v): v is string => typeof v === "string") : [];
+ } catch {
+ // Blocked or corrupt storage: start without favourites rather than fail the picker.
+ return [];
+ }
+}
+
+function writeFavorites(values: string[]): void {
+ try {
+ window.localStorage.setItem(FAVORITES_KEY, JSON.stringify(values));
+ } catch {
+ // Storage refused the write (private window, quota): the star still
+ // toggles for this visit, it just will not be remembered.
+ }
+}
+
+export function useFavoriteModels(): [string[], (value: string) => void] {
+ const [favorites, setFavorites] = useState<string[]>(readFavorites);
+ const toggle = useCallback((value: string) => {
+ setFavorites((current) => {
+ const next = current.includes(value) ? current.filter((v) => v !== value) : [...current, value];
+ writeFavorites(next);
+ return next;
+ });
+ }, []);
+ return [favorites, toggle];
+}
+
+export function ComposerBrainPicker({
+ value,
+ groups,
+ sections,
+ currentSection,
+ onChange,
+ ariaLabel,
+ fallbackLabel,
+ searchPlaceholder,
+ triggerPrefix,
+ disabled,
+ title,
+ className,
+ chevron = true,
+}: {
+ value: string;
+ /** One group per provider, its id equal to that provider's section id. */
+ groups: ComboboxGroup[];
+ sections: BrainSection[];
+ /** The section the panel opens on — the provider answering now. */
+ currentSection: string;
+ onChange: (value: string) => void;
+ ariaLabel: string;
+ fallbackLabel: string;
+ searchPlaceholder: string;
+ triggerPrefix?: ReactNode;
+ disabled?: boolean;
+ title?: string;
+ className?: string;
+ chevron?: boolean;
+}) {
+ const t = useT();
+ const [favorites, toggleFavorite] = useFavoriteModels();
+ const [section, setSection] = useState(currentSection);
+
+ // Every row carries its star; the favourites tab lists the starred rows in
+ // the order they were starred.
+ const starred = useMemo<ComboboxGroup[]>(
+ () =>
+ groups.map((group) => ({
+ ...group,
+ options: group.options.map((option) => {
+ const on = favorites.includes(option.value);
+ const label = on ? t("agent_chat.favorite_remove") : t("agent_chat.favorite_add");
+ return {
+ ...option,
+ trailing: (
+ <button
+ type="button"
+ aria-label={label}
+ aria-pressed={on}
+ title={label}
+ data-testid="composer-model-star"
+ onClick={(event) => {
+ event.stopPropagation();
+ toggleFavorite(option.value);
+ }}
+ className={cn(
+ "-my-1 inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md transition-colors hover:bg-sheen/[0.08]",
+ on ? "text-warning" : "text-faint-foreground hover:text-foreground",
+ )}
+ >
+ <Star className={cn("h-3.5 w-3.5", on && "fill-current")} aria-hidden />
+ </button>
+ ),
+ };
+ }),
+ })),
+ [groups, favorites, toggleFavorite, t],
+ );
+
+ const browseGroups = useMemo<ComboboxGroup[]>(() => {
+ if (section === FAVORITES) {
+ const all = starred.flatMap((group) => group.options);
+ const options = favorites
+ .map((fav) => all.find((option) => option.value === fav))
+ .filter((option): option is NonNullable<typeof option> => Boolean(option));
+ return options.length ? [{ id: FAVORITES, options }] : [];
+ }
+ const own = starred.find((group) => group.id === section) ?? starred[0];
+ // The rail already names the provider, so its group needs no heading.
+ return own ? [{ ...own, label: undefined }] : [];
+ }, [section, starred, favorites]);
+
+ const onOpenChange = useCallback(
+ (open: boolean) => {
+ if (open) setSection(sections.some((s) => s.id === currentSection) ? currentSection : (sections[0]?.id ?? ""));
+ },
+ [sections, currentSection],
+ );
+
+ const rail = (
+ <div
+ role="toolbar"
+ aria-orientation="vertical"
+ aria-label={t("agent_chat.pick_provider")}
+ data-testid="composer-model-rail"
+ className="scrollbar-jarvis flex w-12 shrink-0 flex-col gap-1 overflow-y-auto border-r border-border bg-sheen/[0.03] p-1.5"
+ >
+ <RailButton
+ active={section === FAVORITES}
+ label={t("agent_chat.favorites")}
+ onSelect={() => setSection(FAVORITES)}
+ testId="composer-model-rail-favorites"
+ >
+ <Star className="h-4 w-4 fill-current" aria-hidden />
+ </RailButton>
+ <span className="mx-1 my-0.5 border-b border-border" aria-hidden />
+ {sections.map((s) => (
+ <RailButton
+ key={s.id}
+ active={section === s.id}
+ label={s.label}
+ muted={s.muted}
+ onSelect={() => setSection(s.id)}
+ testId={`composer-model-rail-${s.id}`}
+ >
+ <span className="inline-flex scale-[1.3]">{s.icon}</span>
+ </RailButton>
+ ))}
+ </div>
+ );
+
+ return (
+ <span className={cn("inline-flex min-w-0 items-center", className)} title={title}>
+ <Combobox
+ value={value}
+ groups={starred}
+ browseGroups={browseGroups}
+ aside={rail}
+ onOpenChange={onOpenChange}
+ onChange={onChange}
+ ariaLabel={ariaLabel}
+ fallbackLabel={fallbackLabel}
+ searchPlaceholder={searchPlaceholder}
+ emptyLabel={
+ section === FAVORITES && favorites.length === 0
+ ? t("agent_chat.favorites_empty")
+ : t("agent_chat.no_models")
+ }
+ disabled={disabled}
+ testId="composer-model"
+ triggerHint={false}
+ triggerIcon={false}
+ triggerPrefix={triggerPrefix}
+ chevron={chevron}
+ panelMinWidth={360}
+ className={COMPOSER_CONTROL_CLASS}
+ />
+ </span>
+ );
+}
+
+function RailButton({
+ active,
+ label,
+ muted = false,
+ onSelect,
+ testId,
+ children,
+}: {
+ active: boolean;
+ label: string;
+ muted?: boolean;
+ onSelect: () => void;
+ testId: string;
+ children: ReactNode;
+}) {
+ return (
+ <button
+ type="button"
+ aria-label={label}
+ aria-pressed={active}
+ title={label}
+ data-testid={testId}
+ onClick={(event) => {
+ onSelect();
+ // Back to the search box, so typing right after a rail click searches.
+ event.currentTarget
+ .closest("[data-combobox-panel]")
+ ?.querySelector<HTMLInputElement>("input")
+ ?.focus({ preventScroll: true });
+ }}
+ className={cn(
+ "relative flex aspect-square w-full shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-sheen/[0.08] hover:text-foreground",
+ active && "bg-sheen/[0.06] text-foreground",
+ muted && "opacity-50",
+ )}
+ >
+ {active && (
+ <span
+ aria-hidden
+ className="absolute -right-1.5 top-1/2 h-5 w-[3px] -translate-y-1/2 rounded-l-full bg-accent"
+ />
+ )}
+ {children}
+ </button>
+ );
+}
+
+/**
+ * The look every pick on the composer's bottom row shares: a borderless,
+ * medium-weight word with a quiet chevron that lifts on hover.
+ */
+export const COMPOSER_CONTROL_CLASS =
+ "h-8 w-auto max-w-[240px] gap-1.5 rounded-lg border-transparent bg-transparent px-2 py-0 text-sm font-medium text-foreground/80 shadow-none hover:border-transparent hover:bg-secondary hover:text-foreground focus-visible:ring-1 [&>svg:last-child]:h-3.5 [&>svg:last-child]:w-3.5";
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/useChatAttachments.ts b/jarvis/ui/web/frontend/src/components/agentchat/useChatAttachments.ts
index 822455c7be..0cd442c016 100644
--- a/jarvis/ui/web/frontend/src/components/agentchat/useChatAttachments.ts
+++ b/jarvis/ui/web/frontend/src/components/agentchat/useChatAttachments.ts
@@ -17,7 +17,7 @@
* differs: a chat has no pane to type a path into, so the files are HELD here
* and travel with the sentence when it is sent.
*/
-import { useCallback, useState } from "react";
+import { useCallback, useEffect, useRef, useState } from "react";
import {
extractPaneDrop,
@@ -33,6 +33,13 @@ import { attachChatFiles, type AgentChatSurface, type ChatAttachment } from "@/l
export interface ChatAttachments {
/** What will travel with the next message. */
attachments: ChatAttachment[];
+ /**
+ * A local picture for each held image whose bytes passed through this
+ * window (a paste, the file picker, a claimed appshot), keyed by the
+ * attachment's name. A file the desktop shell handed over by path has no
+ * bytes here and simply has no entry.
+ */
+ previews: Record<string, string>;
/** How many files are being read right now — 0 when nothing is in flight. */
analyzing: number;
/** True while a file drag hovers the composer; drives the drop styling. */
@@ -67,8 +74,18 @@ export function useChatAttachments(
): ChatAttachments {
const [attachments, setAttachments] = useState<ChatAttachment[]>([]);
const [analyzing, setAnalyzing] = useState(0);
+ const [previews, setPreviews] = useState<Record<string, string>>({});
+ const previewsRef = useRef(previews);
+ previewsRef.current = previews;
const { sessionId, cwd, provider, surface } = target;
+ // Object URLs hold the picture in memory until revoked; let them go with
+ // the composer.
+ useEffect(
+ () => () => Object.values(previewsRef.current).forEach((url) => URL.revokeObjectURL(url)),
+ [],
+ );
+
const attach = useCallback(
async (payload: PaneDropPayload) => {
if (isEmptyPayload(payload)) return;
@@ -92,6 +109,17 @@ export function useChatAttachments(
...prev,
...found.filter((item) => !prev.some((held) => held.name === item.name)),
]);
+ const pictures = matchPreviews(found, payload.files);
+ if (Object.keys(pictures).length > 0) {
+ setPreviews((prev) => {
+ const next = { ...prev };
+ for (const [name, url] of Object.entries(pictures)) {
+ if (next[name]) URL.revokeObjectURL(next[name]);
+ next[name] = url;
+ }
+ return next;
+ });
+ }
} catch (e) {
onProblem((e as Error).message, "error");
} finally {
@@ -149,12 +177,26 @@ export function useChatAttachments(
const remove = useCallback((name: string) => {
setAttachments((prev) => prev.filter((a) => a.name !== name));
+ setPreviews((prev) => {
+ if (!prev[name]) return prev;
+ URL.revokeObjectURL(prev[name]);
+ const rest = { ...prev };
+ delete rest[name];
+ return rest;
+ });
}, []);
- const clear = useCallback(() => setAttachments([]), []);
+ const clear = useCallback(() => {
+ setAttachments([]);
+ setPreviews((prev) => {
+ Object.values(prev).forEach((url) => URL.revokeObjectURL(url));
+ return {};
+ });
+ }, []);
return {
attachments,
+ previews,
analyzing,
dragging,
dragHandlers,
@@ -164,3 +206,29 @@ export function useChatAttachments(
clear,
};
}
+
+/**
+ * Pair the images the backend read with the bytes that went up, for a
+ * picture in the composer. The backend may store a file under another name
+ * (a clipboard image gets one, a clash gets a suffix), so an exact name match
+ * comes first and a lone image on both sides pairs by being alone. Anything
+ * still unpaired gets no picture rather than the wrong one.
+ */
+export function matchPreviews(found: ChatAttachment[], files: File[]): Record<string, string> {
+ if (typeof URL.createObjectURL !== "function") return {};
+ const images = files.filter((f) => f.type.startsWith("image/"));
+ const read = found.filter((item) => item.kind === "image");
+ const out: Record<string, string> = {};
+ const used = new Set<File>();
+ for (const item of read) {
+ const file = images.find((f) => f.name === item.name && !used.has(f));
+ if (file) {
+ used.add(file);
+ out[item.name] = URL.createObjectURL(file);
+ }
+ }
+ if (Object.keys(out).length === 0 && images.length === 1 && read.length === 1) {
+ out[read[0].name] = URL.createObjectURL(images[0]);
+ }
+ return out;
+}
diff --git a/jarvis/ui/web/frontend/src/components/home/ChatStage.test.tsx b/jarvis/ui/web/frontend/src/components/home/ChatStage.test.tsx
index 07cf074019..b10d33f277 100644
--- a/jarvis/ui/web/frontend/src/components/home/ChatStage.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/home/ChatStage.test.tsx
@@ -517,6 +517,29 @@ describe("ChatStage (agent chat)", () => {
expect(new Set(glyphs).size).toBe(glyphs.length);
});
+ it("marks the provider's default effort and explains each stance in its menu", async () => {
+ useAgentChatStore.setState({
+ catalog: {
+ ...CATALOG,
+ providers: CATALOG.providers.map((p) => ({
+ ...p,
+ permission_modes: p.permission_modes.map((m) => ({ ...m, description: `What ${m.label} lets through.` })),
+ })),
+ },
+ });
+ render(<ChatStage />);
+ fireEvent.click(screen.getByTestId("composer-effort"));
+ const effort = await screen.findByTestId("composer-effort-panel");
+ expect(effort.textContent).toContain("Reasoning");
+ const high = within(effort).getAllByRole("option").find((el) => el.getAttribute("data-value") === "high");
+ expect(high?.textContent).toContain("Default");
+ fireEvent.keyDown(effort, { key: "Escape" });
+
+ fireEvent.click(screen.getByTestId("composer-permission"));
+ const stances = await screen.findByTestId("composer-permission-panel");
+ expect(stances.textContent).toContain("What Auto-accept edits lets through.");
+ });
+
it("wears one glyph per stance on the unified ladder", async () => {
// The front page's catalog hands every provider the same four-step ladder
// (jarvis/agent_chat/permissions.py, surface=jarvis); the composer draws
diff --git a/jarvis/ui/web/frontend/src/components/ui/combobox.tsx b/jarvis/ui/web/frontend/src/components/ui/combobox.tsx
index 1edee2d934..7ae46dd7f0 100644
--- a/jarvis/ui/web/frontend/src/components/ui/combobox.tsx
+++ b/jarvis/ui/web/frontend/src/components/ui/combobox.tsx
@@ -56,6 +56,14 @@ export interface ComboboxOption {
icon?: ReactNode;
/** Listed for context, but cannot be selected. */
disabled?: boolean;
+ /** A second, quieter line under the label — what the option does. Not searched. */
+ description?: ReactNode;
+ /** A small outlined word beside the label ("Default"). */
+ badge?: string;
+ /** Drawn at the row's end, before the check — a per-row action such as a star. */
+ trailing?: ReactNode;
+ /** What the closed trigger says when this option is picked, if not the label. */
+ triggerLabel?: string;
}
export interface ComboboxGroup {
@@ -101,6 +109,20 @@ export interface ComboboxProps {
triggerIcon?: boolean;
/** Draw the open/close chevron on the trigger (default). */
chevron?: boolean;
+ /** Drawn on the trigger before the label, whatever is picked (a provider mark). */
+ triggerPrefix?: ReactNode;
+ /**
+ * What the list shows while the search box is empty. Searching always runs
+ * over every `groups` entry, so a picker can browse one section at a time
+ * and still find anything by typing.
+ */
+ browseGroups?: ComboboxGroup[];
+ /** A column drawn left of the search and the list (a rail of sections). */
+ aside?: ReactNode;
+ /** Told whenever the panel opens or closes. */
+ onOpenChange?: (open: boolean) => void;
+ /** The panel's narrowest width; defaults to 288 px. */
+ panelMinWidth?: number;
}
/** Panel height cap — roughly nine rows, enough to show that more exist. */
@@ -224,6 +246,11 @@ export function Combobox({
iconOnly = false,
triggerIcon = true,
chevron = true,
+ triggerPrefix,
+ browseGroups,
+ aside,
+ onOpenChange,
+ panelMinWidth = MIN_PANEL_WIDTH,
}: ComboboxProps) {
const [open, setOpen] = useState(false);
const [query, setQuery] = useState("");
@@ -249,7 +276,7 @@ export function Combobox({
}, [groups, value]);
const visibleGroups = useMemo(() => {
- if (!query.trim()) return groups;
+ if (!query.trim()) return browseGroups ?? groups;
// Searching collapses the bands into one flat result list. Groups are a
// browsing aid, and a shortlist band deliberately repeats entries that are
// also in the full list below it — which is fine while browsing and reads
@@ -266,7 +293,7 @@ export function Combobox({
}
}
return hits.length ? [{ id: "results", options: hits }] : [];
- }, [groups, matches, query]);
+ }, [groups, browseGroups, matches, query]);
// Flat order of concrete rendered occurrences — arrow keys walk this, not
// merely option values. A shortlist may repeat the same logical value in the
@@ -309,7 +336,7 @@ export function Combobox({
};
const rect = trigger.getBoundingClientRect();
const maxWidth = Math.max(MIN_PANEL_WIDTH, box.width - 2 * VIEWPORT_MARGIN);
- const width = Math.min(Math.max(rect.width, MIN_PANEL_WIDTH), maxWidth);
+ const width = Math.min(Math.max(rect.width, panelMinWidth), maxWidth);
const spaceBelow = box.bottom - rect.bottom - VIEWPORT_MARGIN;
const spaceAbove = rect.top - box.top - VIEWPORT_MARGIN;
// Flip upwards only when below is genuinely too cramped AND above is
@@ -338,7 +365,7 @@ export function Combobox({
maxHeight,
},
);
- }, []);
+ }, [panelMinWidth]);
useLayoutEffect(() => {
if (!open) return;
@@ -398,6 +425,25 @@ export function Combobox({
setActiveIndex(0);
}, [query, open]);
+ // Another section picked in the aside: start on the current value when that
+ // section holds it, else on its first row.
+ useEffect(() => {
+ if (!open || !browseGroups) return;
+ const index = enabled.findIndex(({ option }) => option.value === value);
+ setActiveIndex(index >= 0 ? index : 0);
+ // Keyed on the section only; `enabled` and `value` are read as they are now.
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [browseGroups]);
+
+ const openChangeRef = useRef(onOpenChange);
+ openChangeRef.current = onOpenChange;
+ const wasOpen = useRef(false);
+ useEffect(() => {
+ if (wasOpen.current === open) return;
+ wasOpen.current = open;
+ openChangeRef.current?.(open);
+ }, [open]);
+
useEffect(() => {
if (!open) return;
const active = listRef.current?.querySelector<HTMLElement>(
@@ -473,7 +519,7 @@ export function Combobox({
}
}
- const triggerLabel = selected?.label ?? fallbackLabel ?? value;
+ const triggerLabel = selected?.triggerLabel ?? selected?.label ?? fallbackLabel ?? value;
const activeOption = enabled[activeIndex];
const trapped = trapsPanel(panelHost(triggerRef.current));
@@ -508,6 +554,7 @@ export function Combobox({
className,
)}
>
+ {triggerPrefix}
{triggerIcon && selected?.icon}
<span className={iconOnly ? "sr-only" : "min-w-0 flex-1 truncate"}>{triggerLabel}</span>
{!iconOnly && triggerHint && selected?.hint && (
@@ -550,10 +597,12 @@ export function Combobox({
// absolute inside a transformed/fixed dialog: that dialog is the
// containing block, and the measured left/top are in its box.
className={cn(
- "pointer-events-auto z-[70] flex flex-col overflow-hidden rounded-lg border border-border-strong bg-popover shadow-float",
+ "pointer-events-auto z-[70] flex overflow-hidden rounded-lg border border-border-strong bg-popover shadow-float",
trapped ? "absolute" : "fixed",
)}
>
+ {aside}
+ <div className="flex min-h-0 min-w-0 flex-1 flex-col">
{searchable && (
<div className="flex items-center gap-2 border-b border-border px-3 py-2">
<Search
@@ -645,33 +694,46 @@ export function Combobox({
// overlay on a floating layer lifts on black and
// deepens on paper, which is right in both themes.
className={cn(
- "relative flex cursor-pointer items-center gap-2 rounded-md px-3 py-1.5 text-sm transition-colors",
+ "relative flex cursor-pointer flex-col rounded-md px-3 py-1.5 text-sm transition-colors",
isActive && "bg-sheen/[0.08] text-foreground",
isSelected && "font-medium text-foreground-strong",
option.disabled && "cursor-not-allowed text-faint-foreground",
)}
>
- {option.icon}
- <span className="min-w-0 flex-1 truncate">
- {option.label}
+ <span className="flex min-w-0 items-center gap-2">
+ {option.icon}
+ <span className="min-w-0 truncate">{option.label}</span>
+ {option.badge && (
+ <span className="shrink-0 rounded-md border border-border-strong px-1.5 text-micro font-medium leading-5 text-muted-foreground">
+ {option.badge}
+ </span>
+ )}
+ <span className="flex-1" />
+ {option.hint && (
+ <span className="shrink-0 truncate text-sm font-normal text-muted-foreground">
+ {option.hint}
+ </span>
+ )}
+ {option.trailing}
+ {isSelected && (
+ <Check
+ aria-hidden="true"
+ className="h-3.5 w-3.5 shrink-0 text-foreground-strong"
+ />
+ )}
</span>
- {option.hint && (
- <span className="shrink-0 truncate text-sm text-muted-foreground">
- {option.hint}
+ {option.description && (
+ <span className="mt-0.5 line-clamp-2 text-xs font-normal text-muted-foreground">
+ {option.description}
</span>
)}
- {isSelected && (
- <Check
- aria-hidden="true"
- className="h-3.5 w-3.5 shrink-0 text-foreground-strong"
- />
- )}
</div>
);
})}
</div>
))}
</div>
+ </div>
</div>,
panelHost(triggerRef.current),
)}
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index 2b17715436..b4b690120d 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -828,6 +828,13 @@
"pick_permission": "Berechtigungen",
"search_providers": "Anbieter suchen …",
"search_models": "Modelle suchen …",
+ "no_models": "Keine Modelle gefunden",
+ "favorites": "Favoriten",
+ "favorites_empty": "Markiere ein Modell mit dem Stern, um es hier zu behalten",
+ "favorite_add": "Zu Favoriten hinzufügen",
+ "favorite_remove": "Aus Favoriten entfernen",
+ "effort_heading": "Denktiefe",
+ "default_badge": "Standard",
"catalog_unavailable": "Agent-Chat nicht verfügbar",
"group_clis": "Coding-CLIs",
"group_api_keys": "API-Keys",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index c9e0721b51..a358caf0d2 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -828,6 +828,13 @@
"pick_permission": "Permissions",
"search_providers": "Search providers…",
"search_models": "Search models…",
+ "no_models": "No models found",
+ "favorites": "Favorites",
+ "favorites_empty": "Star a model to keep it here",
+ "favorite_add": "Add to favorites",
+ "favorite_remove": "Remove from favorites",
+ "effort_heading": "Reasoning",
+ "default_badge": "Default",
"catalog_unavailable": "Agent chat unavailable",
"group_clis": "Coding CLIs",
"group_api_keys": "API keys",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index 7a51e8f440..1c439776c2 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -828,6 +828,13 @@
"pick_permission": "Permisos",
"search_providers": "Buscar proveedores…",
"search_models": "Buscar modelos…",
+ "no_models": "No se encontraron modelos",
+ "favorites": "Favoritos",
+ "favorites_empty": "Marca un modelo con la estrella para tenerlo aquí",
+ "favorite_add": "Añadir a favoritos",
+ "favorite_remove": "Quitar de favoritos",
+ "effort_heading": "Razonamiento",
+ "default_badge": "Predeterminado",
"catalog_unavailable": "Chat de agente no disponible",
"group_clis": "CLIs de programación",
"group_api_keys": "Claves de API",