Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

feat(composer): two-pane model picker with a source rail

vastsa747f5efe6280
diff --git a/apps/desktop/src/features/chat/composer/ComposerModelList.tsx b/apps/desktop/src/features/chat/composer/ComposerModelList.tsx
index 9a6ab5762..60869610e 100644
--- a/apps/desktop/src/features/chat/composer/ComposerModelList.tsx
+++ b/apps/desktop/src/features/chat/composer/ComposerModelList.tsx
@@ -1,7 +1,7 @@
import { formatTokenCount, type ModelInfo, type ProviderPublic } from "@pi-desktop/shared";
import type { TFunction } from "i18next";
-import type { RefObject } from "react";
-import { IconCheck, IconChevronDown, IconChevronRight, IconEye, IconSearch, IconSparkles } from "../../../components/icons";
+import type { CSSProperties, RefObject } from "react";
+import { IconCheck, IconClock, IconEye, IconSearch, IconSparkles } from "../../../components/icons";
import {
composerModelBadges,
composerModelBinding,
@@ -9,6 +9,7 @@ import {
sameComposerModelId,
} from "../../../lib/composer-models";
import { providerDisplayName } from "../../../lib/provider-display";
+import type { ComposerModelSection } from "./hooks/useComposerModelMenu";
export type ComposerModelGroup = {
provider: ProviderPublic;
@@ -16,16 +17,109 @@ export type ComposerModelGroup = {
models: ModelInfo[];
};
-/** Shared model list. Selection is owned by the caller, never by this view. */
+/** First visible character of the source name; the rail's only glyph. */
+export function providerMonogram(name: string): string {
+ return Array.from(name.trim())[0]?.toUpperCase() ?? "?";
+}
+
+/** Stable per-source hue so a provider keeps its colour across sessions. */
+export function providerHue(providerId: string): number {
+ let hash = 0;
+ for (const char of providerId) hash = (hash * 31 + char.charCodeAt(0)) >>> 0;
+ return hash % 360;
+}
+
+type ModelRowProps = {
+ t: TFunction;
+ provider: ProviderPublic;
+ model: ModelInfo;
+ index: number;
+ highlighted: boolean;
+ active: boolean;
+ /** Rows outside a provider section name their source instead of capabilities. */
+ showProvider: boolean;
+ selectModel: (provider: ProviderPublic, modelId: string) => void | Promise<void>;
+};
+
+function ModelRow({ t, provider, model, index, highlighted, active, showProvider, selectModel }: ModelRowProps) {
+ const optionTitle = model.modelId;
+ const alias = composerModelBinding(provider, model.modelId)?.alias?.trim();
+ const optionDisplayName = composerModelDisplayName(provider, model.modelId);
+ return (
+ <button
+ type="button"
+ data-model-index={index}
+ title={optionTitle}
+ className={`composer-plus-item composer-model-option ${active ? "active" : ""} ${highlighted ? "kb-active" : ""}`}
+ role="menuitemradio"
+ aria-checked={active}
+ onClick={() => void selectModel(provider, model.modelId)}
+ >
+ <span className="composer-model-option-main">
+ {/*
+ One label per row, never both: the name the user set wins over the
+ catalog's, and an alias carries its own tone so which one is on
+ screen stays visible. The wire id remains the row's title.
+ */}
+ <span className={`composer-model-label ${alias ? "is-alias" : ""}`}>
+ {alias || optionDisplayName}
+ </span>
+ <span className="composer-model-option-meta">
+ {showProvider ? (
+ <span className="composer-model-option-provider">{providerDisplayName(provider)}</span>
+ ) : (
+ <>
+ {composerModelBadges(model, provider).map((badge) => {
+ const badgeLabel = t(
+ badge === "reasoning" ? "chat.modelBadgeReasoning" : "chat.modelBadgeVision",
+ );
+ return (
+ <span
+ key={badge}
+ className="composer-model-option-badge"
+ title={badgeLabel}
+ aria-label={badgeLabel}
+ role="img"
+ >
+ {badge === "reasoning" ? (
+ <IconSparkles size={12} aria-hidden="true" />
+ ) : (
+ <IconEye size={12} aria-hidden="true" />
+ )}
+ </span>
+ );
+ })}
+ {model.contextWindow ? (
+ <span className="composer-model-option-ctx">{formatTokenCount(model.contextWindow)}</span>
+ ) : null}
+ </>
+ )}
+ </span>
+ </span>
+ <span className="composer-model-check-slot" aria-hidden="true">
+ {active ? <IconCheck size={14} className="composer-model-check" /> : null}
+ </span>
+ </button>
+ );
+}
+
+/**
+ * Source rail + model list. Every configured model is at most one click away:
+ * the rail picks a source (recent or a provider), search spans all sources.
+ * Selection is owned by the caller, never by this view.
+ */
export function ComposerModelList({
t, query, setQuery, modelSearchRef, modelListRef, modelGroups,
modelHighlight, setModelHighlight, selectedProviderId, selectedModelId, selectModel,
- recentEntries, hasOtherModels, otherModelsExpanded, setOtherModelsExpanded,
+ recentEntries, sections, activeSection, selectSection, showSectionRail, searching, paneRows,
}: {
+ paneRows: number;
recentEntries: Array<{ provider: ProviderPublic; model: ModelInfo }>;
- hasOtherModels: boolean;
- otherModelsExpanded: boolean;
- setOtherModelsExpanded: (expanded: boolean) => void;
+ sections: ComposerModelSection[];
+ activeSection: string | null;
+ selectSection: (id: string) => void;
+ showSectionRail: boolean;
+ searching: boolean;
t: TFunction;
query: string;
setQuery: (query: string) => void;
@@ -38,147 +132,112 @@ export function ComposerModelList({
selectedModelId?: string;
selectModel: (provider: ProviderPublic, modelId: string) => void | Promise<void>;
}) {
- const flatModels = modelGroups.flatMap(group => group.models);
+ const isActive = (provider: ProviderPublic, model: ModelInfo) =>
+ selectedProviderId === provider.id && sameComposerModelId(selectedModelId ?? "", model.modelId);
+ const flatCount = recentEntries.length + modelGroups.reduce((sum, group) => sum + group.models.length, 0);
+ let flatIndex = recentEntries.length;
return <>
- <label className="composer-model-search">
- <IconSearch size={13} aria-hidden="true" />
- <span className="sr-only">{t("chat.searchModels")}</span>
- <input
- ref={modelSearchRef}
- type="text"
- value={query}
- placeholder={t("chat.searchModels")}
- aria-label={t("chat.searchModels")}
- spellCheck={false}
- autoCorrect="off"
- autoCapitalize="off"
- onChange={(event) => setQuery(event.target.value)}
- onBlur={() => setModelHighlight(-1)}
- />
- </label>
- <div className="composer-model-list" ref={modelListRef}>
- {recentEntries.length > 0 ? (
- <div className="composer-model-group" role="group" aria-label={t("chat.recentModels")}>
- <div className="composer-model-group-label">{t("chat.recentModels")}</div>
- {recentEntries.map(({ provider, model }, index) => {
- const active = provider.id === selectedProviderId && sameComposerModelId(model.modelId, selectedModelId ?? "");
- return (
- <button
- key={`${provider.id}:${model.modelId}`}
- type="button" role="menuitemradio" aria-checked={active}
- data-model-index={index}
- className={`composer-plus-item composer-model-option ${modelHighlight === index ? "kb-active" : ""}`}
- title={`${providerDisplayName(provider)} · ${model.modelId}`}
- onClick={() => void selectModel(provider, model.modelId)}
- >
- <span className="composer-model-option-main">
- <span className="composer-model-label">{composerModelDisplayName(provider, model.modelId)}</span>
- <span className="composer-model-option-meta" title={providerDisplayName(provider)}>
- {providerDisplayName(provider)}
- </span>
- </span>
- {active ? <IconCheck size={14} aria-hidden="true" /> : null}
- </button>
- );
- })}
- </div>
+ <label className="composer-model-search">
+ <IconSearch size={14} aria-hidden="true" />
+ <span className="sr-only">{t("chat.searchModels")}</span>
+ <input
+ ref={modelSearchRef}
+ type="text"
+ value={query}
+ placeholder={t("chat.searchModels")}
+ aria-label={t("chat.searchModels")}
+ spellCheck={false}
+ autoCorrect="off"
+ autoCapitalize="off"
+ onChange={(event) => setQuery(event.target.value)}
+ onBlur={() => setModelHighlight(-1)}
+ />
+ </label>
+ <div
+ className="composer-model-body"
+ data-rail={showSectionRail ? "true" : undefined}
+ style={{ "--model-pane-rows": paneRows } as CSSProperties}
+ >
+ {showSectionRail ? (
+ <div className="composer-model-rail" role="group" aria-label={t("chat.modelSources")}>
+ {sections.map((section) => {
+ const label = section.kind === "recent" ? t("chat.recentModels") : section.label;
+ const current = section.id === activeSection;
+ return (
+ <button
+ key={section.id}
+ type="button"
+ role="menuitemradio"
+ aria-checked={current}
+ title={label}
+ data-empty={searching && (section.kind === "recent" || section.count === 0) ? "true" : undefined}
+ className={`composer-model-rail-item ${current ? "active" : ""}`}
+ onClick={() => selectSection(section.id)}
+ >
+ {section.kind === "recent" ? (
+ <span className="composer-model-rail-avatar is-recent" aria-hidden="true">
+ <IconClock size={12} />
+ </span>
+ ) : (
+ <span
+ className="composer-model-rail-avatar"
+ aria-hidden="true"
+ style={{ "--provider-hue": providerHue(section.provider.id) } as CSSProperties}
+ >
+ {providerMonogram(section.label)}
+ </span>
+ )}
+ <span className="composer-model-rail-label">{label}</span>
+ {section.kind === "provider" ? (
+ <span className="composer-model-rail-count">{section.count}</span>
) : null}
- {hasOtherModels ? (
- <button type="button" className="composer-menu-entry" role="menuitem"
- aria-expanded={otherModelsExpanded}
- onClick={() => setOtherModelsExpanded(!otherModelsExpanded)}>
- {otherModelsExpanded ? <IconChevronDown size={14} aria-hidden="true" /> : <IconChevronRight size={14} aria-hidden="true" />}
- <span className="composer-menu-entry-label">{t("chat.otherModels")}</span>
- </button>
- ) : null}
- {(() => {
- let flatIndex = recentEntries.length;
- return modelGroups.map((group) => (
- <div
- key={group.provider.id}
- className="composer-model-group"
- role="group"
- aria-label={group.providerDisplayName}
- >
- <div className="composer-model-group-label">{group.providerDisplayName}</div>
- {group.models.map((model) => {
- const index = flatIndex++;
- const active =
- selectedProviderId === group.provider.id &&
- sameComposerModelId(selectedModelId ?? "", model.modelId);
- const optionTitle = model.modelId;
- const alias = composerModelBinding(
- group.provider,
- model.modelId,
- )?.alias?.trim();
- const optionDisplayName = composerModelDisplayName(
- group.provider,
- model.modelId,
- );
- return (
- <button
- key={`${group.provider.id}:${model.modelId}`}
- type="button"
- data-model-index={index}
- title={optionTitle}
- className={`composer-plus-item composer-model-option ${active ? "active" : ""} ${modelHighlight === index ? "kb-active" : ""}`}
- role="menuitemradio"
- aria-checked={active}
- onClick={() => void selectModel(group.provider, model.modelId)}
- >
- <span className="composer-model-option-main">
- {/*
- One label per row, never both: the name the user
- set wins over the catalog's, and an alias carries
- its own tone so which one is on screen stays
- visible. The wire id remains the row's title, so
- identity is still one hover away.
- */}
- <span
- className={`composer-model-label ${alias ? "is-alias" : ""}`}
- >
- {alias || optionDisplayName}
- </span>
- <span className="composer-model-option-meta" title={optionTitle}>
- {composerModelBadges(model, group.provider).map((badge) => {
- const badgeLabel = t(
- badge === "reasoning"
- ? "chat.modelBadgeReasoning"
- : "chat.modelBadgeVision",
- );
- return (
- <span
- key={badge}
- className="composer-model-option-badge"
- title={badgeLabel}
- aria-label={badgeLabel}
- role="img"
- >
- {badge === "reasoning" ? (
- <IconSparkles size={12} aria-hidden="true" />
- ) : (
- <IconEye size={12} aria-hidden="true" />
- )}
- </span>
- );
- })}
- {model.contextWindow ? (
- <span className="composer-model-option-ctx">
- {formatTokenCount(model.contextWindow)}
- </span>
- ) : null}
- </span>
- </span>
- {active ? <IconCheck size={14} className="composer-model-check" aria-hidden="true" /> : null}
- </button>
- );
- })}
- </div>
- ));
- })()}
- {flatModels.length === 0 && recentEntries.length === 0 ? (
- <div className="composer-model-empty">{t("chat.noModelResults")}</div>
- ) : null}
- </div>
+ </button>
+ );
+ })}
+ </div>
+ ) : null}
+ <div className="composer-model-list" ref={modelListRef}>
+ {recentEntries.length > 0 ? (
+ <div className="composer-model-group" role="group" aria-label={t("chat.recentModels")}>
+ {recentEntries.map(({ provider, model }, index) => (
+ <ModelRow
+ key={`${provider.id}:${model.modelId}`}
+ t={t} provider={provider} model={model} index={index}
+ highlighted={modelHighlight === index}
+ active={isActive(provider, model)}
+ showProvider selectModel={selectModel}
+ />
+ ))}
+ </div>
+ ) : null}
+ {modelGroups.map((group) => (
+ <div
+ key={group.provider.id}
+ className="composer-model-group"
+ role="group"
+ aria-label={group.providerDisplayName}
+ >
+ {searching ? (
+ <div className="composer-model-group-label">{group.providerDisplayName}</div>
+ ) : null}
+ {group.models.map((model) => {
+ const index = flatIndex++;
+ return (
+ <ModelRow
+ key={`${group.provider.id}:${model.modelId}`}
+ t={t} provider={group.provider} model={model} index={index}
+ highlighted={modelHighlight === index}
+ active={isActive(group.provider, model)}
+ showProvider={false} selectModel={selectModel}
+ />
+ );
+ })}
+ </div>
+ ))}
+ {flatCount === 0 ? (
+ <div className="composer-model-empty">{t("chat.noModelResults")}</div>
+ ) : null}
+ </div>
+ </div>
</>;
}
diff --git a/apps/desktop/src/features/chat/composer/ComposerModelPicker.tsx b/apps/desktop/src/features/chat/composer/ComposerModelPicker.tsx
index 28e0a6956..11c24b396 100644
--- a/apps/desktop/src/features/chat/composer/ComposerModelPicker.tsx
+++ b/apps/desktop/src/features/chat/composer/ComposerModelPicker.tsx
@@ -41,9 +41,12 @@ export function ComposerModelPicker({
const {
open,
setOpen,
- otherModelsExpanded,
- setOtherModelsExpanded,
- hasOtherModels,
+ sections,
+ activeSection,
+ selectSection,
+ showSectionRail,
+ paneRows,
+ searching,
query,
setQuery,
modelHighlight,
@@ -64,7 +67,7 @@ export function ComposerModelPicker({
className="composer-model-thinking"
open={open}
onClose={() => setOpen(false)}
- menuClassName="composer-model-menu composer-model-thinking-menu"
+ menuClassName={`composer-model-menu composer-model-thinking-menu ${showSectionRail ? "has-rail" : ""}`}
label={`${t("chat.model")} ${t("chat.reasoningLevel")}`}
role="menu"
align="end"
@@ -84,7 +87,6 @@ export function ComposerModelPicker({
onClick={() => {
onCloseOtherMenus();
if (!open) {
- setOtherModelsExpanded(false);
setQuery("");
setModelHighlight(-1);
}
@@ -113,20 +115,22 @@ export function ComposerModelPicker({
t={t} query={query} setQuery={setQuery}
modelSearchRef={modelSearchRef} modelListRef={modelListRef}
modelGroups={modelGroups} modelHighlight={modelHighlight}
- recentEntries={recentEntries} hasOtherModels={hasOtherModels}
- otherModelsExpanded={otherModelsExpanded}
- setOtherModelsExpanded={setOtherModelsExpanded}
+ recentEntries={recentEntries} sections={sections}
+ activeSection={activeSection} selectSection={selectSection}
+ showSectionRail={showSectionRail} searching={searching} paneRows={paneRows}
setModelHighlight={setModelHighlight} selectModel={selectModel}
selectedProviderId={selectedProviderId} selectedModelId={selectedModelId}
/>
{thinkingMenuLevels.length > 1 ? (
- <ThinkingLevelSlider
- key={`${selectedProviderId}:${selectedModelId}:${thinkingMenuLevels.join("|")}`}
- levels={thinkingMenuLevels}
- level={thinkingLevel}
- label={t("chat.reasoningLevel")}
- commit={commitThinkingLevel}
- />
+ <div className="composer-model-reasoning">
+ <ThinkingLevelSlider
+ key={`${selectedProviderId}:${selectedModelId}:${thinkingMenuLevels.join("|")}`}
+ levels={thinkingMenuLevels}
+ level={thinkingLevel}
+ label={t("chat.reasoningLevel")}
+ commit={commitThinkingLevel}
+ />
+ </div>
) : null}
</div>
</AnchoredMenu>
diff --git a/apps/desktop/src/features/chat/composer/hooks/useComposerModelMenu.ts b/apps/desktop/src/features/chat/composer/hooks/useComposerModelMenu.ts
index bc4386966..bfa85a4ae 100644
--- a/apps/desktop/src/features/chat/composer/hooks/useComposerModelMenu.ts
+++ b/apps/desktop/src/features/chat/composer/hooks/useComposerModelMenu.ts
@@ -30,6 +30,19 @@ import {
} from "../model";
import { createLatestCommitQueue } from "../thinking-commit-queue";
+/** Rail section that lists the most recently used models. */
+export const RECENT_MODEL_SECTION = "recent";
+/** Recent rows get their own rail section, so a few more than one screen fits. */
+const RECENT_MODEL_LIMIT = 6;
+
+export function providerModelSection(providerId: string): string {
+ return `provider:${providerId}`;
+}
+
+export type ComposerModelSection =
+ | { id: string; kind: "recent"; count: number }
+ | { id: string; kind: "provider"; provider: ProviderPublic; label: string; count: number };
+
type UseComposerModelMenuOptions = {
mode: Mode;
activeSessionId: string | null | undefined;
@@ -65,7 +78,8 @@ export function useComposerModelMenu({
const loadProviderModels = useAppStore((s) => s.loadProviderModels);
const showToast = useAppStore((s) => s.showToast);
const [open, setOpen] = useState(false);
- const [otherModelsExpanded, setOtherModelsExpanded] = useState(false);
+ // null follows the default section; a rail click pins one until close.
+ const [section, setSection] = useState<string | null>(null);
const [query, setQuery] = useState("");
const [modelHighlight, setModelHighlight] = useState(-1);
const modelSearchRef = useRef<HTMLInputElement>(null);
@@ -147,7 +161,7 @@ export function useComposerModelMenu({
providerId: entry.provider.id, modelId: entry.model.modelId,
}));
return entry ? [entry] : [];
- }).slice(0, 3);
+ }).slice(0, RECENT_MODEL_LIMIT);
}, [modelGroups, recentModels]);
const queryNeedle = query.trim().toLowerCase();
const filteredModelGroups = useMemo(
@@ -169,19 +183,54 @@ export function useComposerModelMenu({
: modelGroups,
[modelGroups, queryNeedle],
);
- const showRecents = !queryNeedle && recentEntries.length > 0;
- const remainingGroups = showRecents ? filteredModelGroups.map(group => ({
- ...group,
- models: group.models.filter(model => !recentEntries.some(entry =>
- entry.provider.id === group.provider.id && sameComposerModelId(entry.model.modelId, model.modelId))),
- })).filter(group => group.models.length > 0) : filteredModelGroups;
- const visibleGroups = !showRecents || otherModelsExpanded ? remainingGroups : [];
+ const searching = queryNeedle.length > 0;
+ // While searching, provider counts become match counts so the rail shows
+ // where the results live; the recent section has no separate result set.
+ const sections = useMemo<ComposerModelSection[]>(() => [
+ ...(recentEntries.length > 0
+ ? [{ id: RECENT_MODEL_SECTION, kind: "recent" as const, count: recentEntries.length }]
+ : []),
+ ...modelGroups.map((group) => ({
+ id: providerModelSection(group.provider.id),
+ kind: "provider" as const,
+ provider: group.provider,
+ label: group.providerDisplayName,
+ count: searching
+ ? (filteredModelGroups.find((candidate) => candidate.provider.id === group.provider.id)?.models.length ?? 0)
+ : group.models.length,
+ })),
+ ], [filteredModelGroups, modelGroups, recentEntries.length, searching]);
+ // One pane height for every source: the tallest source (or the rail itself)
+ // decides it, so switching sources or typing never resizes the menu.
+ const paneRows = Math.max(
+ sections.length,
+ recentEntries.length,
+ ...modelGroups.map((group) => group.models.length),
+ );
+ const selectedProviderSection =
+ provider && modelGroups.some((group) => group.provider.id === provider.id)
+ ? providerModelSection(provider.id)
+ : null;
+ const defaultSection =
+ recentEntries.length > 0 ? RECENT_MODEL_SECTION : (selectedProviderSection ?? sections[0]?.id ?? null);
+ const activeSection =
+ section && sections.some((candidate) => candidate.id === section) ? section : defaultSection;
+ const visibleRecents = useMemo(
+ () => (!searching && activeSection === RECENT_MODEL_SECTION ? recentEntries : []),
+ [activeSection, recentEntries, searching],
+ );
+ const visibleGroups = useMemo(
+ () => searching
+ ? filteredModelGroups
+ : modelGroups.filter((group) => providerModelSection(group.provider.id) === activeSection),
+ [activeSection, filteredModelGroups, modelGroups, searching],
+ );
const flatModels = useMemo(
() =>
- [...(showRecents ? recentEntries : []), ...visibleGroups.flatMap((group) =>
+ [...visibleRecents, ...visibleGroups.flatMap((group) =>
group.models.map((model) => ({ provider: group.provider, model })),
)],
- [visibleGroups, showRecents, recentEntries],
+ [visibleGroups, visibleRecents],
);
const flatModelsKey = useMemo(
() => flatModels.map((entry) => `${entry.provider.id}:${entry.model.modelId}`).join("|"),
@@ -213,7 +262,7 @@ export function useComposerModelMenu({
useEffect(() => {
if (open) return;
- setOtherModelsExpanded(false);
+ setSection(null);
setQuery("");
setModelHighlight(-1);
}, [open]);
@@ -279,7 +328,6 @@ export function useComposerModelMenu({
thinkingLevel: nextThinkingLevel,
});
setQuery("");
- setOtherModelsExpanded(false);
setModelHighlight(-1);
} catch (error) {
showToast(error instanceof Error ? error.message : String(error), {
@@ -288,6 +336,14 @@ export function useComposerModelMenu({
}
};
+ /** Show one rail section. Picking a source ends any search in progress. */
+ const selectSection = (id: string) => {
+ setSection(id);
+ setQuery("");
+ setModelHighlight(-1);
+ modelListRef.current?.scrollTo({ top: 0 });
+ };
+
/**
* Commit a reasoning level without leaving the menu surface. Latest-wins:
* a drag that crosses several stops only persists the last pending level
@@ -330,8 +386,12 @@ export function useComposerModelMenu({
return {
open,
setOpen,
- otherModelsExpanded,
- setOtherModelsExpanded,
+ sections,
+ activeSection: searching ? null : activeSection,
+ selectSection,
+ showSectionRail: sections.length > 1,
+ paneRows,
+ searching,
query,
setQuery,
modelHighlight,
@@ -339,8 +399,7 @@ export function useComposerModelMenu({
modelSearchRef,
modelListRef,
modelGroups: visibleGroups,
- recentEntries: showRecents ? recentEntries : [],
- hasOtherModels: showRecents && remainingGroups.length > 0,
+ recentEntries: visibleRecents,
flatModels,
thinkingMenuLevels,
selectModel,
diff --git a/apps/desktop/src/styles/composer-menus.css b/apps/desktop/src/styles/composer-menus.css
index 2c67aec38..9cd16b2b8 100644
--- a/apps/desktop/src/styles/composer-menus.css
+++ b/apps/desktop/src/styles/composer-menus.css
@@ -110,6 +110,13 @@
narrower values ellipsized the "medium" label into "medi…".
*/
width: min(320px, calc(100vw - 24px));
+ padding: 6px;
+}
+
+/* With several sources the menu becomes two panes: a source rail on the
+ left and the selected source's models on the right. */
+.composer-model-thinking-menu.has-rail {
+ width: min(460px, calc(100vw - 24px));
}
.composer-model-thinking-menu.is-open {
@@ -211,7 +218,7 @@
.composer-model-thinking-menu .composer-menu-root {
display: flex;
flex-direction: column;
- gap: 2px;
+ gap: 4px;
}
.composer-menu-entry,
@@ -274,14 +281,157 @@
}
.composer-model-thinking-menu .composer-model-search {
- margin: 3px 3px 5px;
+ margin: 0 0 2px;
}
.composer-model-thinking-menu .composer-plus-item {
- min-height: 28px;
- padding: 5px 8px;
+ min-height: 32px;
+ padding: 6px 8px;
+}
+
+/* Two-pane body: rail | models. One hairline separates the panes; the list
+ keeps a fixed height so switching sources never resizes the menu. */
+.composer-model-body {
+ display: flex;
+ min-height: 0;
+}
+
+.composer-model-body[data-rail] {
+ display: grid;
+ grid-template-columns: 148px minmax(0, 1fr);
+ gap: 6px;
}
+.composer-model-body[data-rail] .composer-model-list,
+.composer-model-body[data-rail] .composer-model-rail {
+ height: min(280px, calc(var(--model-pane-rows, 8) * 33px + 2px));
+ max-height: none;
+}
+
+.composer-model-rail {
+ display: flex;
+ flex-direction: column;
+ gap: 1px;
+ overflow-y: auto;
+ padding-right: 6px;
+ border-right: 1px solid var(--ds-border-subtle);
+}
+
+.composer-model-rail-item {
+ display: flex;
+ min-width: 0;
+ min-height: 32px;
+ align-items: center;
+ gap: 8px;
+ padding: 0 8px 0 6px;
+ border-radius: var(--radius-sm);
+ color: var(--ds-text-secondary);
+ font-size: var(--text-sm);
+ text-align: left;
+ cursor: pointer;
+ transition:
+ background var(--motion-duration-fast) var(--motion-ease-out),
+ color var(--motion-duration-fast) var(--motion-ease-out),
+ opacity var(--motion-duration-fast) var(--motion-ease-out);
+}
+
+.composer-model-rail-item:hover,
+.composer-model-rail-item:focus-visible {
+ background: var(--ds-bg-hover);
+ color: var(--ds-text-primary);
+}
+
+.composer-model-rail-item.active {
+ background: var(--ds-bg-active);
+ color: var(--ds-text-primary);
+}
+
+/* While searching, sources without a match step back instead of vanishing,
+ so the rail never reflows under the pointer. */
+.composer-model-rail-item[data-empty] {
+ opacity: 0.4;
+}
+
+/* Monogram tile: a stable per-source hue keeps sources recognisable at a
+ glance without shipping vendor artwork. */
+.composer-model-rail-avatar {
+ /* The hue arrives per element; mixing it with theme tokens keeps one rule
+ legible on both light and dark surfaces. */
+ --source-tile-tint: oklch(0.62 0.15 var(--provider-hue, 250));
+ display: inline-flex;
+ flex: 0 0 auto;
+ width: 20px;
+ height: 20px;
+ align-items: center;
+ justify-content: center;
+ border-radius: var(--radius-xs);
+ background: color-mix(in oklab, var(--source-tile-tint) 18%, transparent);
+ color: color-mix(in oklab, var(--source-tile-tint) 72%, var(--ds-text-primary));
+ font-size: var(--text-2xs);
+ font-weight: var(--font-weight-strong);
+ line-height: var(--leading-none);
+}
+
+.composer-model-rail-avatar.is-recent {
+ background: var(--ds-tile-deep);
+ color: var(--ds-text-secondary);
+}
+
+.composer-model-rail-label {
+ min-width: 0;
+ flex: 1;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.composer-model-rail-count {
+ flex: 0 0 auto;
+ color: var(--ds-text-faint);
+ font-size: var(--text-2xs);
+ font-variant-numeric: tabular-nums;
+}
+
+/* Narrow windows keep both panes: the rail folds to its monograms and the
+ full source name stays the item's title. */
+@media (max-width: 520px) {
+ .composer-model-body[data-rail] {
+ grid-template-columns: 40px minmax(0, 1fr);
+ }
+
+ .composer-model-rail-item {
+ justify-content: center;
+ padding: 0;
+ }
+
+ .composer-model-rail-label,
+ .composer-model-rail-count {
+ display: none;
+ }
+}
+
+.composer-model-check-slot {
+ display: inline-flex;
+ flex: 0 0 14px;
+ justify-content: center;
+}
+
+.composer-model-option-provider {
+ color: var(--ds-text-faint);
+ font-size: var(--text-xs);
+}
+
+/* Reasoning lives in its own footer under a hairline: it configures the
+ selected model, so it reads as a setting rather than another list row. */
+.composer-model-reasoning {
+ display: flex;
+ flex-direction: column;
+ margin: 2px -6px -6px;
+ padding: 10px 6px 4px;
+ border-top: 1px solid var(--ds-border-subtle);
+}
+
+
/* Reasoning slider (issue #417): the menu root carries the slider itself, so a
level is one drag instead of opening a list of levels.
@@ -535,6 +685,8 @@
/* Provider→models groups: the list scrolls on its own so the search field and
provider headings stay reachable with many discovered models. */
.composer-model-list {
+ min-width: 0;
+ flex: 1;
max-height: 280px;
overflow-y: auto;
}
@@ -674,13 +826,18 @@
.composer-model-search {
display: flex;
align-items: center;
- gap: 6px;
- height: 28px;
+ gap: 8px;
+ height: 34px;
margin: 4px 3px 5px;
- padding: 0 8px;
- border-radius: var(--radius-sm);
+ padding: 0 10px;
+ border-radius: var(--radius-md);
background: var(--ds-bg-inset);
color: var(--ds-text-muted);
+ transition: box-shadow var(--motion-duration-fast) var(--motion-ease-out);
+}
+
+.composer-model-search:focus-within {
+ box-shadow: 0 0 0 1px var(--ds-border-strong);
}
.composer-model-search svg {
diff --git a/apps/desktop/test/composer-model-thinking-menu.test.mjs b/apps/desktop/test/composer-model-thinking-menu.test.mjs
index 3806f9bab..5781ca8cd 100644
--- a/apps/desktop/test/composer-model-thinking-menu.test.mjs
+++ b/apps/desktop/test/composer-model-thinking-menu.test.mjs
@@ -13,16 +13,26 @@ const listSource = await readComposerModule("ComposerModelList.tsx");
const composerSource = `${modelMenuSource}\n${pickerSource}\n${sliderSource}\n${listSource}`;
const stylesSource = await loadStyles();
-test("Composer uses one searchable model menu with an inline disclosure", () => {
- assert.doesNotMatch(composerSource, /ComposerMenuView|composer-menu-back|showView/);
- assert.match(composerSource, /aria-expanded=\{otherModelsExpanded\}/);
+test("Composer uses one searchable model menu with a source rail", () => {
+ assert.doesNotMatch(composerSource, /ComposerMenuView|composer-menu-back|showView|otherModelsExpanded/);
assert.match(pickerSource, /<ComposerModelList/);
- assert.match(composerSource, /menuClassName="composer-model-menu composer-model-thinking-menu"/);
+ assert.match(pickerSource, /composer-model-menu composer-model-thinking-menu \$\{showSectionRail \? "has-rail" : ""\}/);
+ // Every source is one click away: the rail lists recent + each provider,
+ // its items are radios, and search spans every source at once.
+ assert.match(listSource, /className="composer-model-rail" role="group" aria-label=\{t\("chat\.modelSources"\)\}/);
+ assert.match(listSource, /aria-checked=\{current\}/);
+ assert.match(listSource, /onClick=\{\(\) => selectSection\(section\.id\)\}/);
+ assert.match(modelMenuSource, /showSectionRail: sections\.length > 1/);
+ assert.match(modelMenuSource, /searching\s*\? filteredModelGroups/);
+ assert.match(stylesSource, /\.composer-model-body\[data-rail\] \{[^}]*grid-template-columns: 148px minmax\(0, 1fr\)/);
+ // Switching sources never resizes the menu under the pointer.
+ assert.match(modelMenuSource, /const paneRows = Math\.max\(/);
+ assert.match(stylesSource, /\.composer-model-body\[data-rail\] \.composer-model-list,[\s\S]*?height: min\(280px, calc\(var\(--model-pane-rows, 8\) \* 33px \+ 2px\)\)/);
});
test("model selection does not itself record usage", () => {
assert.doesNotMatch(modelMenuSource, /rememberModel/);
- assert.match(modelMenuSource, /setOtherModelsExpanded\(false\)/);
+ assert.match(modelMenuSource, /setSection\(null\)/);
});
test("switching models adopts the target default without resetting same-model overrides", () => {
assert.match(modelMenuSource, /const selectedSameModel =\s*activeSessionId &&\s*candidate\.id === provider\?\.id &&\s*sameComposerModelId\(modelId \?\? "", nextModelId\);/);
diff --git a/apps/desktop/test/helpers/composer-toolbar.mjs b/apps/desktop/test/helpers/composer-toolbar.mjs
index ba05fa743..f8fdc2aa0 100644
--- a/apps/desktop/test/helpers/composer-toolbar.mjs
+++ b/apps/desktop/test/helpers/composer-toolbar.mjs
@@ -31,7 +31,7 @@ export const TOOLBAR_PROPS = {
modelMenu: {
open: false,
setOpen: noop,
- otherModelsExpanded: false, setOtherModelsExpanded: noop, hasOtherModels: false,
+ sections: [], activeSection: null, selectSection: noop, showSectionRail: false, paneRows: 0, searching: false,
query: "",
setQuery: noop,
modelHighlight: -1,
diff --git a/apps/desktop/test/model-advanced-capabilities.test.mjs b/apps/desktop/test/model-advanced-capabilities.test.mjs
index 476595f68..f7b457b0c 100644
--- a/apps/desktop/test/model-advanced-capabilities.test.mjs
+++ b/apps/desktop/test/model-advanced-capabilities.test.mjs
@@ -107,7 +107,7 @@ test("image generation selection hides the summary when nothing can be chosen",
});
test("the Composer model rows use the provider binding for vision badges", () => {
- assert.match(composerSource, /composerModelBadges\(model, group\.provider\)/);
+ assert.match(composerSource, /composerModelBadges\(model, provider\)/);
});
test("capability overrides reach the transport modality arrays", () => {
diff --git a/docs/spec/03-runtime/13-model-catalog-and-selection.md b/docs/spec/03-runtime/13-model-catalog-and-selection.md
index 13000b67a..13f39ea43 100644
--- a/docs/spec/03-runtime/13-model-catalog-and-selection.md
+++ b/docs/spec/03-runtime/13-model-catalog-and-selection.md
@@ -470,12 +470,16 @@ fields remain readable for scheduled jobs and older consumers; no database or
IPC migration is required. Settings has no fixed chat-default picker or service
"Make default" action. Image-generation selection remains independent.
-The combined Composer model menu shows the three most recent available bindings
-first. Each row identifies the provider as well as the model or alias. Search is
-always visible and searches all configured models. Other models expand inline,
-grouped by provider, without duplicating recent entries. With no history, all
-models are visible immediately. The current model is checked; reasoning controls
-remain below the list. Discovery enriches exact
+The combined Composer model menu is two panes under an always-visible search.
+A source rail lists Recent (up to six available bindings, newest first) and each
+provider with its model count; the pane beside it lists the chosen source's
+models, so every configured model is one click away. Recent rows identify the
+provider as well as the model or alias. Search spans all providers, shows grouped
+results, and dims rail sources without matches. With a single source (for
+example no history and one provider) the rail is hidden and all models are
+visible immediately. The pane height is fixed by the tallest source so switching
+sources never resizes the menu. The current model is checked; reasoning controls
+sit in a footer below the list. Discovery enriches exact
configured IDs without adding unconfigured choices. Model and reasoning changes
retain the existing session configuration and permission boundaries.
diff --git a/docs/spec/04-ux/08-component-spec.md b/docs/spec/04-ux/08-component-spec.md
index 1ddd71640..5872c0f36 100644
--- a/docs/spec/04-ux/08-component-spec.md
+++ b/docs/spec/04-ux/08-component-spec.md
@@ -4180,8 +4180,9 @@ responses cannot restore an earlier order. Composer All models groups follow the
default nor provider configuration. OAuth accounts remain in their separate section.
1. **Model selection** — chat models are selected in the Composer. Its first
- menu has persistent search, up to three recent available provider/model pairs,
- and an inline Other models disclosure. Without history, it shows all models.
+ menu has persistent search over a source rail (Recent, then each provider)
+ and the chosen source's models. With a single source the rail is hidden and
+ all models show directly.
New chats inherit the last actually used available model. Only accepted
message submission updates that preference; selection and reasoning changes
alone do not count as usage.
diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.md
index f8f645084..dda93f84e 100644
--- a/docs/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/spec/06-delivery/04-e2e-test-plan.md
@@ -19186,14 +19186,15 @@ host-created files. The full app's file-preview viewer is covered separately.
## Composer recent chat models
- Send accepted messages using four distinct configured chat models across providers. Open the combined
- model menu: exactly the latest three available pairs appear in recency order,
- with provider labels. Select an older recent row: order stays unchanged until
+ model menu: the Recent source is selected and lists the latest available pairs
+ (up to six) in recency order, with provider labels. Select an older recent row: order stays unchanged until
a message is accepted, at which point that model moves first.
-- Search immediately without expanding Other models; choose using keyboard
- navigation. Expand Other models inline and verify no duplicate recent rows.
- Move from the third recent row to Other models, and tab out of search after
- arrow navigation: no stale keyboard highlight remains on a model row.
- Without history, all configured models are directly visible. Verify thinking
+- Search immediately; results span every provider and the rail selection is
+ released; choose using keyboard navigation. Choose a provider in the source
+ rail and verify each of its models appears once. Move from a recent row to the
+ rail, and tab out of search after arrow navigation: no stale keyboard
+ highlight remains on a model row. Without history and with one provider, the
+ rail is hidden and all configured models are directly visible. Verify thinking
defaults still follow the selected binding and manual same-model levels survive.
- Create a new chat: it inherits the last actually used model. Reload local preferences
and create another chat: the same binding is restored. An existing chat keeps
diff --git a/packages/i18n/src/locales/de/index.ts b/packages/i18n/src/locales/de/index.ts
index cadb0f5b7..3ab638206 100644
--- a/packages/i18n/src/locales/de/index.ts
+++ b/packages/i18n/src/locales/de/index.ts
@@ -719,7 +719,7 @@ export const de = {
},
"model": "Modell",
recentModels: "Zuletzt verwendet",
- otherModels: "Weitere Modelle",
+ modelSources: "Modellquellen",
"searchModels": "Modelle suchen",
"noModelResults": "Keine passenden Modelle",
"modelBadgeReasoning": "Begründung",
diff --git a/packages/i18n/src/locales/en/index.ts b/packages/i18n/src/locales/en/index.ts
index b2b50cfea..b22293822 100644
--- a/packages/i18n/src/locales/en/index.ts
+++ b/packages/i18n/src/locales/en/index.ts
@@ -731,7 +731,7 @@ export const en = {
},
model: "Model",
recentModels: "Recently used",
- otherModels: "Other models",
+ modelSources: "Model sources",
searchModels: "Search models",
noModelResults: "No matching models",
modelBadgeReasoning: "reasoning",
diff --git a/packages/i18n/src/locales/es/index.ts b/packages/i18n/src/locales/es/index.ts
index 61e67697b..0696652cc 100644
--- a/packages/i18n/src/locales/es/index.ts
+++ b/packages/i18n/src/locales/es/index.ts
@@ -719,7 +719,7 @@ export const es = {
},
"model": "Modelo",
recentModels: "Usados recientemente",
- otherModels: "Otros modelos",
+ modelSources: "Fuentes de modelos",
"searchModels": "Buscar modelos",
"noModelResults": "No hay modelos coincidentes",
"modelBadgeReasoning": "razonamiento",
diff --git a/packages/i18n/src/locales/fr/index.ts b/packages/i18n/src/locales/fr/index.ts
index 80a20969c..70aa807e4 100644
--- a/packages/i18n/src/locales/fr/index.ts
+++ b/packages/i18n/src/locales/fr/index.ts
@@ -719,7 +719,7 @@ export const fr = {
},
"model": "Modèle",
recentModels: "Récemment utilisés",
- otherModels: "Autres modèles",
+ modelSources: "Sources de modèles",
"searchModels": "Rechercher des modèles",
"noModelResults": "Aucun modèle correspondant",
"modelBadgeReasoning": "raisonnement",
diff --git a/packages/i18n/src/locales/ko/index.ts b/packages/i18n/src/locales/ko/index.ts
index cd651e12b..d450cf7fc 100644
--- a/packages/i18n/src/locales/ko/index.ts
+++ b/packages/i18n/src/locales/ko/index.ts
@@ -728,7 +728,7 @@ export const ko = {
},
model: "모델",
recentModels: "최근 사용",
- otherModels: "다른 모델",
+ modelSources: "모델 소스",
searchModels: "모델 검색",
noModelResults: "일치하는 모델 없음",
modelBadgeReasoning: "추론",
diff --git a/packages/i18n/src/locales/pt-BR/index.ts b/packages/i18n/src/locales/pt-BR/index.ts
index 66a8d3686..03a4ba9bc 100644
--- a/packages/i18n/src/locales/pt-BR/index.ts
+++ b/packages/i18n/src/locales/pt-BR/index.ts
@@ -718,7 +718,7 @@ export const ptBR = {
},
model: "Modelo",
recentModels: "Usados recentemente",
- otherModels: "Outros modelos",
+ modelSources: "Fontes de modelos",
searchModels: "Pesquisar modelos…",
noModelResults: "Nenhum modelo encontrado",
modelBadgeReasoning: "Raciocínio",
diff --git a/packages/i18n/src/locales/tr/index.ts b/packages/i18n/src/locales/tr/index.ts
index a27b6fb26..ae2078e1d 100644
--- a/packages/i18n/src/locales/tr/index.ts
+++ b/packages/i18n/src/locales/tr/index.ts
@@ -728,7 +728,7 @@ export const tr = {
},
model: "Model",
recentModels: "Son kullanılanlar",
- otherModels: "Diğer modeller",
+ modelSources: "Model kaynakları",
searchModels: "Model ara",
noModelResults: "Eşleşen model yok",
modelBadgeReasoning: "akıl yürütme",
diff --git a/packages/i18n/src/locales/zh-CN/index.ts b/packages/i18n/src/locales/zh-CN/index.ts
index 513fc3ea6..a5bb95d2b 100644
--- a/packages/i18n/src/locales/zh-CN/index.ts
+++ b/packages/i18n/src/locales/zh-CN/index.ts
@@ -724,7 +724,7 @@ export const zhCN = {
},
model: "模型",
recentModels: "最近使用",
- otherModels: "其他模型",
+ modelSources: "模型来源",
searchModels: "搜索模型",
noModelResults: "没有匹配的模型",
modelBadgeReasoning: "推理",
diff --git a/packages/i18n/src/locales/zh-TW/index.ts b/packages/i18n/src/locales/zh-TW/index.ts
index 98fbb1f72..77700b447 100644
--- a/packages/i18n/src/locales/zh-TW/index.ts
+++ b/packages/i18n/src/locales/zh-TW/index.ts
@@ -724,7 +724,7 @@ export const zhTW = {
},
model: "模型",
recentModels: "最近使用",
- otherModels: "其他模型",
+ modelSources: "模型來源",
searchModels: "搜尋模型",
noModelResults: "沒有匹配的模型",
modelBadgeReasoning: "推理",
diff --git a/scripts/e2e/composer-model-selection.tsx b/scripts/e2e/composer-model-selection.tsx
index da85fd21a..3fbcca042 100644
--- a/scripts/e2e/composer-model-selection.tsx
+++ b/scripts/e2e/composer-model-selection.tsx
@@ -104,62 +104,73 @@ globalThis.composerModelSelectionProbe = async () => {
await settle();
document.querySelector<HTMLButtonElement>(".composer-model-thinking-chip")!.click();
await settle();
- const recentRows = Array.from(document.querySelectorAll<HTMLButtonElement>(".composer-menu-root [role=menuitemradio]"));
- if (recentRows.length !== 3 || !recentRows[0].textContent?.includes("model-d") || !recentRows[2].textContent?.includes("model-b")) {
- throw new Error("The first model menu must show exactly the three most recent models in order");
+ const modelRows = () => Array.from(document.querySelectorAll<HTMLButtonElement>(".composer-model-list [role=menuitemradio]"));
+ const railItems = () => Array.from(document.querySelectorAll<HTMLButtonElement>(".composer-model-rail [role=menuitemradio]"));
+ const recentRows = modelRows();
+ if (recentRows.length !== 4 || !recentRows[0].textContent?.includes("model-d") || !recentRows[2].textContent?.includes("model-b")) {
+ throw new Error("The recent source must list recent models in usage order");
+ }
+ if (railItems().length !== 2 || railItems()[0].getAttribute("aria-checked") !== "true") {
+ throw new Error("The rail must offer recent plus each provider, with recent selected first");
}
recentRows[2].dispatchEvent(new MouseEvent("mousemove", { bubbles: true }));
await settle();
- const otherModels = document.querySelector<HTMLButtonElement>(".composer-menu-root [aria-expanded]")!;
- otherModels.dispatchEvent(new MouseEvent("mousemove", { bubbles: true }));
- otherModels.focus();
+ const providerSource = railItems()[1];
+ providerSource.dispatchEvent(new MouseEvent("mousemove", { bubbles: true }));
+ providerSource.focus();
await settle();
if (document.querySelector(".composer-model-list .kb-active")) {
- throw new Error("Moving from a recent model to Other models must clear stale keyboard highlight");
+ throw new Error("Moving from a recent model to the rail must clear stale keyboard highlight");
}
const keyboardSearch = document.querySelector<HTMLInputElement>(".composer-model-search input")!;
keyboardSearch.focus();
keyboardSearch.dispatchEvent(new KeyboardEvent("keydown", { key: "ArrowDown", bubbles: true }));
await settle();
if (!document.querySelector(".composer-model-list .kb-active")) throw new Error("Arrow navigation must highlight a model");
- otherModels.focus();
+ providerSource.focus();
// The offscreen window does not own OS focus; deliver the native focusout edge.
- keyboardSearch.dispatchEvent(new FocusEvent("focusout", { bubbles: true, relatedTarget: otherModels }));
+ keyboardSearch.dispatchEvent(new FocusEvent("focusout", { bubbles: true, relatedTarget: providerSource }));
await settle();
if (document.querySelector(".composer-model-list .kb-active")) throw new Error("Leaving search must clear keyboard highlight");
recentRows[2].click();
await settle();
- if (!document.querySelector(".composer-menu-root [role=menuitemradio]")?.textContent?.includes("model-d")) {
+ if (!modelRows()[0]?.textContent?.includes("model-d")) {
throw new Error("Selecting without sending must preserve actual usage order");
}
const switchedLevel = document.querySelector(".selected-thinking-level")?.textContent?.trim() ?? "";
await globalThis.composerModelSelectionController!.commitThinkingLevel("low");
await settle();
- const disclosure = document.querySelector<HTMLButtonElement>(".composer-menu-root [aria-expanded]")!;
- disclosure.click();
+ const recentStyle = getComputedStyle(modelRows()[0]);
+ const recentType = `${recentStyle.fontSize}/${recentStyle.fontWeight}`;
+ railItems()[1].click();
await settle();
- const expandedRows = document.querySelectorAll(".composer-model-list [role=menuitemradio]");
- if (expandedRows.length !== 4) throw new Error("Expanded models must appear once in the same list");
- const recentStyle = getComputedStyle(expandedRows[0]);
- const otherStyle = getComputedStyle(expandedRows[3]);
- if (recentStyle.fontSize !== otherStyle.fontSize || recentStyle.fontWeight !== otherStyle.fontWeight) {
- throw new Error(`Model typography differs: recent ${recentStyle.fontSize}/${recentStyle.fontWeight}, other ${otherStyle.fontSize}/${otherStyle.fontWeight}`);
+ const providerRows = modelRows();
+ if (providerRows.length !== 4 || railItems()[1].getAttribute("aria-checked") !== "true") {
+ throw new Error("Choosing a provider source must list each of its models once");
+ }
+ const otherStyle = getComputedStyle(providerRows[3]);
+ const otherType = `${otherStyle.fontSize}/${otherStyle.fontWeight}`;
+ if (recentType !== otherType) {
+ throw new Error(`Model typography differs: recent ${recentType}, other ${otherType}`);
}
- disclosure.click();
+ railItems()[0].click();
await settle();
const search = document.querySelector<HTMLInputElement>(".composer-model-search input")!;
Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")!.set!.call(search, "model-b");
search.dispatchEvent(new Event("input", { bubbles: true }));
await settle();
+ if (modelRows().length !== 1 || railItems().some((item) => item.getAttribute("aria-checked") === "true")) {
+ throw new Error("Search must span every source and release the rail selection");
+ }
search.dispatchEvent(new KeyboardEvent("keydown", { key: "Enter", bubbles: true }));
await settle();
const restored = useAppStore.getState().recentModels;
if (restored[0]?.modelId !== "model-d") throw new Error("Menu interactions alone must not record usage");
useAppStore.setState({ recentModels: [] });
await settle();
- if (document.querySelectorAll(".composer-model-list [role=menuitemradio]").length !== 4) {
- throw new Error("Without history all configured models must be directly visible");
+ if (railItems().length !== 0 || modelRows().length !== 4) {
+ throw new Error("Without history a single source shows all configured models without a rail");
}
useAppStore.setState({ recentModels: restored });
await settle();
diff --git a/scripts/e2e/composer-thinking-layout.tsx b/scripts/e2e/composer-thinking-layout.tsx
index b952e0ef5..8f214d9cf 100644
--- a/scripts/e2e/composer-thinking-layout.tsx
+++ b/scripts/e2e/composer-thinking-layout.tsx
@@ -20,7 +20,7 @@ function Fixture({ width, crowded, model }: { width: number; crowded: boolean; m
const listRef = useRef<HTMLDivElement>(null);
const searchRef = useRef<HTMLInputElement>(null);
const controller: ReturnType<typeof useComposerModelMenu> = {
- open, setOpen, otherModelsExpanded: false, setOtherModelsExpanded: noop, hasOtherModels: false, query: "", setQuery: noop,
+ open, setOpen, sections: [], activeSection: null, selectSection: noop, showSectionRail: false, paneRows: 0, searching: false, query: "", setQuery: noop,
modelHighlight: -1, setModelHighlight: noop,
thinkingHighlight: -1, setThinkingHighlight: noop,
modelSearchRef: searchRef, modelListRef: listRef,