Skip to content

A self-improving RLM agent for coding workflows and long-running autonomous tasks.

Rust

make configuration tabs clear (#402)

kta2ce9f1fcad1
diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md
index 9b6bd688ea..4896bdb246 100644
--- a/packages/coding-agent/CHANGELOG.md
+++ b/packages/coding-agent/CHANGELOG.md
@@ -6,6 +6,7 @@
- Changed tool expansion hints to appear only on the latest tool row instead of every tool call ([ENG-4583](https://linear.app/primeintellect/issue/ENG-4583/too-many-ctrlo-alerts)).
- Changed IPython kernels to set `NO_COLOR=1`, preventing ANSI color escapes from inflating `%%bash` output.
- Changed provider, model, and MCP setup to use one tabbed configuration menu ([ENG-4539](https://linear.app/primeintellect/issue/ENG-4539/unify-providers-models-and-mcp-connections-menu)).
+- Changed the shared configuration menu to show prominent, responsive tabs with configurable navigation shortcuts ([ENG-4534](https://linear.app/primeintellect/issue/ENG-4534/make-login-tabs-more-obvious)).
- Fixed Prime Inference login leaving new sessions without a persisted model selection ([ENG-4573](https://linear.app/primeintellect/issue/ENG-4573/prompt-for-model-selection-after-prime-inference-login)).
- Fixed empty prompt placeholders hiding the input caret.
- Fixed missing ripgrep blocking subagents and added actionable installation guidance for the optional search helper ([ENG-4572](https://linear.app/primeintellect/issue/ENG-4572/ripgrep-not-installed)).
diff --git a/packages/coding-agent/README.md b/packages/coding-agent/README.md
index 87ea5a9486..d96966466d 100644
--- a/packages/coding-agent/README.md
+++ b/packages/coding-agent/README.md
@@ -304,7 +304,7 @@ Skills can also be Python-backed. A Python skill is a normal skill directory wit
Place in `~/.prime/agent/skills/`, `~/.agents/skills/`, `.prime/agent/skills/`, or `.agents/skills/` (from `cwd` up through parent directories) or a [Prime Agent package](#prime-agent-packages) to share with others. See [docs/skills.md](docs/skills.md).
-Prime Agent ships with a built-in `websearch` skill (Google search via the [Serper](https://serper.dev) API). It loads by default; run `/login` and choose "Serper (web search)" to add your key, disable it with `bundledSkills.websearch: false`, or override it with your own `websearch` skill in any location above. See [docs/skills.md#built-in-skills](docs/skills.md#built-in-skills).
+Prime Agent ships with a built-in `websearch` skill (Google search via the [Serper](https://serper.dev) API). It loads by default; run `/login`, switch to **MCP Connections**, and choose "Serper (web search)" to add your key. Disable it with `bundledSkills.websearch: false`, or override it with your own `websearch` skill in any location above. See [docs/skills.md#built-in-skills](docs/skills.md#built-in-skills).
### MCP Integrations
@@ -316,7 +316,7 @@ issues = await linear.list_issues(team="Engineering") # tools auto-discovered
help(linear.list_issues) # description + argument schema
```
-Built-in integrations for Linear and Notion ship disabled. **Logging in enables them**: open `/login`, switch to the **Services** tab, pick the integration, and complete OAuth in the browser. The integration's skill then becomes visible and is auto-imported into the kernel. `/mcp` offers the same from the command line:
+Built-in integrations for Linear and Notion ship disabled. **Logging in enables them**: open `/login`, switch to **MCP Connections**, pick the integration, and complete OAuth in the browser. The integration's skill then becomes visible and is auto-imported into the kernel. `/mcp` opens the same tab, while its subcommands support direct management:
```
/mcp list integrations and connection status
diff --git a/packages/coding-agent/docs/keybindings.md b/packages/coding-agent/docs/keybindings.md
index 505e4520bd..2294cdc140 100644
--- a/packages/coding-agent/docs/keybindings.md
+++ b/packages/coding-agent/docs/keybindings.md
@@ -113,6 +113,15 @@ Modifier combinations: `ctrl+shift+x`, `alt+ctrl+x`, `ctrl+shift+alt+x`, `ctrl+1
| `app.provider.add` | `ctrl+p` | Add provider from the model selector |
| `app.thinking.toggle` | `ctrl+t` | Collapse or expand thinking blocks |
+### Configuration Menu
+
+Used inside the shared Providers, Models, and MCP Connections menu. When a search field contains text, its cursor movement takes precedence over these default arrow bindings.
+
+| Keybinding id | Default | Description |
+|--------|---------|-------------|
+| `app.configuration.previousTab` | `left` | Open the previous configuration tab |
+| `app.configuration.nextTab` | `right` | Open the next configuration tab |
+
### Display and Message Queue
| Keybinding id | Default | Description |
diff --git a/packages/coding-agent/docs/mcp-integrations.md b/packages/coding-agent/docs/mcp-integrations.md
index 037bc5dca9..a25c23f01c 100644
--- a/packages/coding-agent/docs/mcp-integrations.md
+++ b/packages/coding-agent/docs/mcp-integrations.md
@@ -32,7 +32,7 @@ credentials in `auth.json`.
Built-in integrations (Linear, Notion) ship **disabled**. Logging in enables them:
-- Open `/login`, switch to the **Services** tab, pick the integration, and
+- Open `/login`, switch to **MCP Connections**, pick the integration, and
complete OAuth in the browser. `/mcp login <name>` does the same from the CLI.
- Once connected, the integration's skill becomes visible to the model and is
auto-imported into the kernel.
@@ -167,7 +167,7 @@ is a few lines — the package above is the whole integration.
### Authentication
-- **OAuth** (`"oauth": true`): the user runs `/login` → Services → your server (or
+- **OAuth** (`"oauth": true`): the user runs `/login` → MCP Connections → your server (or
`/mcp login acme`). Works when the server supports OAuth 2.1 dynamic client
registration (RFC 7591); login discovers the auth server, registers a client,
and runs PKCE. Servers requiring a pre-registered client id are not yet
@@ -224,7 +224,7 @@ at call time with `NotEnabled` until credentials exist. So make the skill's
the auth mode you configured:
- **OAuth** (`"oauth": true`): instruct the user to run `/mcp login <server>` (or
- `/login` → Services). `/mcp login` only works for OAuth servers.
+ `/login` → MCP Connections). `/mcp login` only works for OAuth servers.
- **Bearer token** (`bearerTokenEnvVar`): instruct the user to set that env var —
do *not* point them at `/mcp login`, which has no provider for a bearer-only
server and reports "Unknown MCP integration".
diff --git a/packages/coding-agent/docs/skills.md b/packages/coding-agent/docs/skills.md
index 893c980d36..d926c93045 100644
--- a/packages/coding-agent/docs/skills.md
+++ b/packages/coding-agent/docs/skills.md
@@ -56,10 +56,10 @@ Built-in skills behave like any other skill but have the lowest precedence: a us
### websearch
Setup: get a free API key at [serper.dev](https://serper.dev), then run `/login`,
-switch to the **Services** tab (left/right arrows), and choose **Serper (web
-search)** to paste it. The key is stored alongside your other credentials (in
-`auth.json`) and read by the skill on each call — no environment variables
-required, and it works even if you add the key mid-session.
+switch to **MCP Connections** using the displayed tab shortcuts, and choose
+**Serper (web search)** to paste it. The key is stored alongside your other
+credentials (in `auth.json`) and read by the skill on each call — no environment
+variables required, and it works even if you add the key mid-session.
Optional overrides (environment variables):
diff --git a/packages/coding-agent/src/core/keybindings.ts b/packages/coding-agent/src/core/keybindings.ts
index 99d35c552a..0de5087145 100644
--- a/packages/coding-agent/src/core/keybindings.ts
+++ b/packages/coding-agent/src/core/keybindings.ts
@@ -19,6 +19,8 @@ export interface AppKeybindings {
"app.suspend": true;
"app.model.select": true;
"app.provider.add": true;
+ "app.configuration.previousTab": true;
+ "app.configuration.nextTab": true;
"app.tools.expand": true;
"app.thinking.toggle": true;
"app.subagents.focus": true;
@@ -82,6 +84,8 @@ export const KEYBINDINGS = {
},
"app.model.select": { defaultKeys: "ctrl+l", description: "Open model selector" },
"app.provider.add": { defaultKeys: "ctrl+p", description: "Add provider" },
+ "app.configuration.previousTab": { defaultKeys: "left", description: "Open previous configuration tab" },
+ "app.configuration.nextTab": { defaultKeys: "right", description: "Open next configuration tab" },
"app.tools.expand": { defaultKeys: "ctrl+o", description: "Toggle tool output" },
"app.thinking.toggle": {
defaultKeys: "ctrl+t",
diff --git a/packages/coding-agent/src/modes/interactive/components/configuration-menu.ts b/packages/coding-agent/src/modes/interactive/components/configuration-menu.ts
index 31a43d1309..3144176ba9 100644
--- a/packages/coding-agent/src/modes/interactive/components/configuration-menu.ts
+++ b/packages/coding-agent/src/modes/interactive/components/configuration-menu.ts
@@ -5,11 +5,14 @@ import {
type Focusable,
getKeybindings,
type TUI,
- truncateToWidth,
+ visibleWidth,
+ wrapTextWithAnsi,
} from "@earendil-works/pi-tui";
import type { AuthStorage } from "../../../core/auth-storage.js";
import type { ModelRegistry } from "../../../core/model-registry.js";
import { theme } from "../theme/theme.js";
+import { keyText } from "./keybinding-hints.js";
+import { getMenuPanelInnerWidth } from "./menu-panel.js";
import { type ModelSelectorAction, ModelSelectorComponent } from "./model-selector.js";
import { type AuthSelectorProvider, OAuthSelectorComponent } from "./oauth-selector.js";
@@ -55,11 +58,52 @@ class ConfigurationMenuTabBar implements Component {
constructor(private readonly getActiveTab: () => ConfigurationMenuTab) {}
render(width: number): string[] {
+ return this.getLines(width);
+ }
+
+ getRowCount(width: number): number {
+ return this.getLines(width).length;
+ }
+
+ private getLines(width: number): string[] {
+ const safeWidth = Math.max(1, width);
const activeTab = this.getActiveTab();
- const labels = CONFIGURATION_MENU_TABS.map((tab) =>
- tab === activeTab ? theme.bold(theme.fg("accent", TAB_LABELS[tab])) : theme.fg("muted", TAB_LABELS[tab]),
- ).join(theme.fg("muted", " · "));
- return [truncateToWidth(`${labels} ${theme.fg("muted", "←/→ switch")}`, Math.max(1, width), "")];
+ const labels = CONFIGURATION_MENU_TABS.map((tab) => {
+ const label = `[${tab === activeTab ? "▶" : " "} ${TAB_LABELS[tab]}]`;
+ return tab === activeTab ? theme.bold(theme.fg("accent", label)) : theme.fg("text", label);
+ });
+ const lines = this.wrapItems(
+ [theme.bold(theme.fg("muted", "Tabs:")), ...labels],
+ theme.fg("muted", " "),
+ safeWidth,
+ );
+ const previousKey = keyText("app.configuration.previousTab", { primaryOnly: true });
+ const nextKey = keyText("app.configuration.nextTab", { primaryOnly: true });
+ const hint = `${theme.fg("dim", `${previousKey}/${nextKey}`)}${theme.fg("muted", " switch tabs")}`;
+ const lastLine = lines.at(-1);
+ if (lastLine && visibleWidth(`${lastLine} ${hint}`) <= safeWidth) {
+ lines[lines.length - 1] = `${lastLine} ${hint}`;
+ return lines;
+ }
+ return [...lines, ...wrapTextWithAnsi(hint, safeWidth)];
+ }
+
+ private wrapItems(items: string[], separator: string, width: number): string[] {
+ const lines: string[] = [];
+ let line = "";
+ for (const item of items) {
+ const candidate = line ? `${line}${separator}${item}` : item;
+ if (line && visibleWidth(candidate) > width) {
+ lines.push(...wrapTextWithAnsi(line, width));
+ line = item;
+ } else {
+ line = candidate;
+ }
+ }
+ if (line) {
+ lines.push(...wrapTextWithAnsi(line, width));
+ }
+ return lines;
}
invalidate(): void {}
@@ -73,11 +117,13 @@ export class ConfigurationMenuComponent extends Container implements Focusable {
};
private activeTab: ConfigurationMenuTab;
private _focused = false;
+ private renderWidth = 78;
constructor(private readonly options: ConfigurationMenuOptions) {
super();
this.activeTab = options.initialTab;
const tabBar = new ConfigurationMenuTabBar(() => this.activeTab);
+ const getHeaderRows = () => tabBar.getRowCount(getMenuPanelInnerWidth(this.renderWidth)) + 1;
const providerOptions = options.providerOptions.filter(
(provider) => (provider.category ?? "provider") === "provider",
);
@@ -93,6 +139,7 @@ export class ConfigurationMenuComponent extends Container implements Focusable {
{
getRows: options.getRows,
header: tabBar,
+ getHeaderRows,
title: "Providers",
subtitle: "Connect with a subscription or API key.",
searchPlaceholder: "Search providers",
@@ -110,6 +157,7 @@ export class ConfigurationMenuComponent extends Container implements Focusable {
actions: MODEL_SELECTOR_ACTIONS,
availableModels: options.availableModels,
header: tabBar,
+ getHeaderRows,
onAction: () => this.setActiveTab("providers"),
getRows: options.getRows,
recentModels: options.recentModels,
@@ -125,6 +173,7 @@ export class ConfigurationMenuComponent extends Container implements Focusable {
{
getRows: options.getRows,
header: tabBar,
+ getHeaderRows,
title: "MCP Connections",
subtitle: "Connect MCP integrations and service credentials.",
searchPlaceholder: "Search MCP connections",
@@ -148,6 +197,11 @@ export class ConfigurationMenuComponent extends Container implements Focusable {
this.activeBody.focused = value;
}
+ override render(width: number): string[] {
+ this.renderWidth = width;
+ return super.render(width);
+ }
+
getActiveTab(): ConfigurationMenuTab {
return this.activeTab;
}
@@ -178,11 +232,17 @@ export class ConfigurationMenuComponent extends Container implements Focusable {
handleInput(keyData: string): void {
const kb = getKeybindings();
- if (this.activeSearchIsEmpty() && kb.matches(keyData, "tui.editor.cursorLeft")) {
+ if (
+ kb.matches(keyData, "app.configuration.previousTab") &&
+ (this.activeSearchIsEmpty() || !kb.matches(keyData, "tui.editor.cursorLeft"))
+ ) {
this.switchTab(-1);
return;
}
- if (this.activeSearchIsEmpty() && kb.matches(keyData, "tui.editor.cursorRight")) {
+ if (
+ kb.matches(keyData, "app.configuration.nextTab") &&
+ (this.activeSearchIsEmpty() || !kb.matches(keyData, "tui.editor.cursorRight"))
+ ) {
this.switchTab(1);
return;
}
diff --git a/packages/coding-agent/src/modes/interactive/components/menu-panel.ts b/packages/coding-agent/src/modes/interactive/components/menu-panel.ts
index a75db104be..926b60111d 100644
--- a/packages/coding-agent/src/modes/interactive/components/menu-panel.ts
+++ b/packages/coding-agent/src/modes/interactive/components/menu-panel.ts
@@ -45,6 +45,11 @@ const FIELD_PADDING_X = 2;
const ROW_PADDING_X = 2;
const ROW_PADDING_Y = 1;
+export function getMenuPanelInnerWidth(width: number): number {
+ const safeWidth = Math.max(PANEL_PADDING_X * 2 + 1, width);
+ return Math.max(1, safeWidth - PANEL_PADDING_X * 2);
+}
+
interface FullWidthMenuComponent {
readonly fillsMenuPanel: true;
}
@@ -223,7 +228,7 @@ export class MenuPanel extends Container {
override render(width: number): string[] {
const safeWidth = Math.max(PANEL_PADDING_X * 2 + 1, width);
- const innerWidth = Math.max(1, safeWidth - PANEL_PADDING_X * 2);
+ const innerWidth = getMenuPanelInnerWidth(width);
const lines: string[] = [];
for (let i = 0; i < PANEL_PADDING_Y; i++) {
diff --git a/packages/coding-agent/src/modes/interactive/components/model-selector.ts b/packages/coding-agent/src/modes/interactive/components/model-selector.ts
index 41de92b280..5563c96336 100644
--- a/packages/coding-agent/src/modes/interactive/components/model-selector.ts
+++ b/packages/coding-agent/src/modes/interactive/components/model-selector.ts
@@ -43,6 +43,7 @@ export interface ModelSelectorOptions {
actions?: ReadonlyArray<ModelSelectorAction>;
availableModels?: ReadonlyArray<Model<any>>;
header?: Component;
+ getHeaderRows?: () => number;
onAction?: (actionId: string) => void;
subtitle?: string;
getRows?: () => number;
@@ -106,7 +107,7 @@ export class ModelSelectorComponent extends Container implements Focusable {
});
private responsiveLayoutKey = "";
private readonly viewport: MenuViewportProvider;
- private readonly headerRows: number;
+ private readonly getHeaderRows: () => number;
constructor(
tui: TUI,
@@ -132,7 +133,7 @@ export class ModelSelectorComponent extends Container implements Focusable {
this.onActionCallback = options.onAction;
this.recentRank = new Map((options.recentModels ?? []).map((key, i) => [key, i]));
this.viewport = { getRows: options.getRows };
- this.headerRows = options.header ? 2 : 0;
+ this.getHeaderRows = options.header ? (options.getHeaderRows ?? (() => 2)) : () => 0;
this.panel = new MenuPanel({
title: "Models",
@@ -481,9 +482,10 @@ export class ModelSelectorComponent extends Container implements Focusable {
headerHelpRows += 1;
}
+ const headerRows = this.getHeaderRows();
const reservedRows =
MODEL_LIST_RESERVED_ROWS.base +
- this.headerRows +
+ headerRows +
headerHelpRows +
(this.shouldShowSelectedDetails() ? MODEL_LIST_RESERVED_ROWS.detail : 0);
this.listLayout = getMenuListLayout({
@@ -496,6 +498,7 @@ export class ModelSelectorComponent extends Container implements Focusable {
scrollIndicatorRows: MODEL_SCROLL_INDICATOR_ROWS,
});
this.responsiveLayoutKey = [
+ headerRows,
showHeaderHelp ? "help" : "no-help",
headerHelpRows,
this.shouldShowSelectedDetails() ? "detail" : "no-detail",
diff --git a/packages/coding-agent/src/modes/interactive/components/oauth-selector.ts b/packages/coding-agent/src/modes/interactive/components/oauth-selector.ts
index c874bce8d6..b38401877e 100644
--- a/packages/coding-agent/src/modes/interactive/components/oauth-selector.ts
+++ b/packages/coding-agent/src/modes/interactive/components/oauth-selector.ts
@@ -32,6 +32,7 @@ export type AuthSelectorProvider = {
export interface OAuthSelectorOptions extends MenuViewportProvider {
initialCategory?: AuthSelectorCategory;
header?: Component;
+ getHeaderRows?: () => number;
title?: string;
subtitle?: string;
searchPlaceholder?: string;
@@ -86,7 +87,7 @@ export class OAuthSelectorComponent extends Container implements Focusable {
compactItemRows: 2,
});
private readonly viewport: MenuViewportProvider;
- private readonly headerRows: number;
+ private readonly getHeaderRows: () => number;
constructor(
mode: "login" | "logout",
@@ -103,7 +104,7 @@ export class OAuthSelectorComponent extends Container implements Focusable {
this.authStorage = authStorage;
this.getAuthStatus = getAuthStatus ?? ((providerId) => this.authStorage.getAuthStatus(providerId));
this.viewport = options;
- this.headerRows = options.header ? TAB_BAR_RESERVED_ROWS : 0;
+ this.getHeaderRows = options.header ? (options.getHeaderRows ?? (() => TAB_BAR_RESERVED_ROWS)) : () => 0;
this.allProviders = this.sortProviders(providers);
this.filteredProviders = this.allProviders;
this.onSelectCallback = onSelect;
@@ -408,7 +409,7 @@ export class OAuthSelectorComponent extends Container implements Focusable {
}
private get reservedRows(): number {
- return PROVIDER_LIST_RESERVED_ROWS + this.headerRows + (this.tabBar ? TAB_BAR_RESERVED_ROWS : 0);
+ return PROVIDER_LIST_RESERVED_ROWS + this.getHeaderRows() + (this.tabBar ? TAB_BAR_RESERVED_ROWS : 0);
}
private updateLayout(): void {
diff --git a/packages/coding-agent/test/configuration-menu.test.ts b/packages/coding-agent/test/configuration-menu.test.ts
index 70bfecc2d3..8bb765fe6b 100644
--- a/packages/coding-agent/test/configuration-menu.test.ts
+++ b/packages/coding-agent/test/configuration-menu.test.ts
@@ -1,8 +1,11 @@
-import { type KeyId, setKeybindings, type TUI } from "@earendil-works/pi-tui";
+import { type KeyId, setKeybindings, type TUI, visibleWidth } from "@earendil-works/pi-tui";
import stripAnsi from "strip-ansi";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { KeybindingsManager } from "../src/core/keybindings.js";
-import { ConfigurationMenuComponent } from "../src/modes/interactive/components/configuration-menu.js";
+import {
+ ConfigurationMenuComponent,
+ type ConfigurationMenuTab,
+} from "../src/modes/interactive/components/configuration-menu.js";
import { initTheme } from "../src/modes/interactive/theme/theme.js";
import { createHarness, type Harness } from "./suite/harness.js";
@@ -15,30 +18,21 @@ function createFakeTui(): TUI {
describe("ConfigurationMenuComponent", () => {
const harnesses: Harness[] = [];
- beforeAll(() => {
- initTheme("dark");
- });
-
- beforeEach(() => {
- setKeybindings(new KeybindingsManager());
- });
-
- afterEach(() => {
- while (harnesses.length > 0) {
- harnesses.pop()?.cleanup();
- }
- });
-
- it("uses one three-tab menu and keeps each tab body mounted", async () => {
+ async function createMenu(
+ options: {
+ initialTab?: ConfigurationMenuTab;
+ getRows?: () => number;
+ requestRender?: () => void;
+ onSelectProvider?: () => void;
+ } = {},
+ ): Promise<ConfigurationMenuComponent> {
const harness = await createHarness({
models: [{ id: "faux-1", name: "Faux One", reasoning: true }],
});
harnesses.push(harness);
- const requestRender = vi.fn();
- const selectProvider = vi.fn();
const model = harness.getModel("faux-1")!;
- const menu = new ConfigurationMenuComponent({
- initialTab: "providers",
+ return new ConfigurationMenuComponent({
+ initialTab: options.initialTab ?? "providers",
tui: createFakeTui(),
authStorage: harness.session.modelRegistry.authStorage,
providerOptions: [
@@ -54,23 +48,48 @@ describe("ConfigurationMenuComponent", () => {
currentModel: model,
scopedModels: [],
availableModels: [model],
- requestRender,
- onSelectProvider: selectProvider,
- onSelectMcpConnection: vi.fn(),
- onSelectModel: vi.fn(),
- onCancel: vi.fn(),
+ getRows: options.getRows,
+ requestRender: options.requestRender ?? (() => {}),
+ onSelectProvider: options.onSelectProvider ?? (() => {}),
+ onSelectMcpConnection: () => {},
+ onSelectModel: () => {},
+ onCancel: () => {},
});
+ }
+
+ beforeAll(() => {
+ initTheme("dark");
+ });
+
+ beforeEach(() => {
+ setKeybindings(new KeybindingsManager());
+ });
+
+ afterEach(() => {
+ initTheme("dark");
+ while (harnesses.length > 0) {
+ harnesses.pop()?.cleanup();
+ }
+ });
+
+ it("uses one clearly delineated three-tab menu and keeps each tab body mounted", async () => {
+ const requestRender = vi.fn();
+ const selectProvider = vi.fn();
+ const menu = await createMenu({ requestRender, onSelectProvider: selectProvider });
let output = stripAnsi(menu.render(120).join("\n"));
- expect(output).toContain("Providers");
- expect(output).toContain("Models");
- expect(output).toContain("MCP Connections");
+ expect(output).toContain("Tabs:");
+ expect(output).toContain("[▶ Providers]");
+ expect(output).toContain("[ Models]");
+ expect(output).toContain("[ MCP Connections]");
expect(output).toContain("Anthropic");
expect(output).not.toContain("Serper (web search)");
menu.handleInput("a");
menu.setActiveTab("models");
output = stripAnsi(menu.render(120).join("\n"));
+ expect(output).toContain("[ Providers]");
+ expect(output).toContain("[▶ Models]");
expect(output).toContain("Faux One");
menu.setActiveTab("providers");
@@ -84,45 +103,30 @@ describe("ConfigurationMenuComponent", () => {
menu.setActiveTab("mcp-connections");
output = stripAnsi(menu.render(120).join("\n"));
+ expect(output).toContain("[▶ MCP Connections]");
expect(output).toContain("Serper (web search)");
expect(output).not.toContain("Anthropic");
});
- it("switches tabs with configured left and right keys when search is empty", async () => {
- const harness = await createHarness({
- models: [{ id: "faux-1", name: "Faux One", reasoning: true }],
- });
- harnesses.push(harness);
+ it("switches tabs with configured bindings and preserves focus and search state", async () => {
setKeybindings(
new KeybindingsManager({
- "tui.editor.cursorLeft": "ctrl+y" as KeyId,
- "tui.editor.cursorRight": "ctrl+x" as KeyId,
+ "app.configuration.previousTab": "ctrl+y" as KeyId,
+ "app.configuration.nextTab": "ctrl+x" as KeyId,
}),
);
- const model = harness.getModel("faux-1")!;
- const menu = new ConfigurationMenuComponent({
- initialTab: "providers",
- tui: createFakeTui(),
- authStorage: harness.session.modelRegistry.authStorage,
- providerOptions: [
- { id: "anthropic", name: "Anthropic", authType: "oauth" },
- { id: "serper", name: "Serper", authType: "api_key", category: "service" },
- ],
- modelRegistry: harness.session.modelRegistry,
- currentModel: model,
- scopedModels: [],
- availableModels: [model],
- requestRender: () => {},
- onSelectProvider: () => {},
- onSelectMcpConnection: () => {},
- onSelectModel: () => {},
- onCancel: () => {},
- });
+ const menu = await createMenu();
+ menu.focused = true;
+ expect(stripAnsi(menu.render(120).join("\n"))).toContain("Ctrl+Y/Ctrl+X switch tabs");
menu.handleInput("\x18");
expect(menu.getActiveTab()).toBe("models");
+ expect(menu.focused).toBe(true);
+ menu.handleInput("f");
+ expect(menu.getSearchValue("models")).toBe("f");
menu.handleInput("\x18");
expect(menu.getActiveTab()).toBe("mcp-connections");
+ expect(menu.getSearchValue("models")).toBe("f");
menu.handleInput("\x19");
expect(menu.getActiveTab()).toBe("models");
});
@@ -164,4 +168,44 @@ describe("ConfigurationMenuComponent", () => {
const postLoginRow = output.split("\n").find((line) => line.includes("faux-2"));
expect(postLoginRow).toContain("current");
});
+
+ it("keeps default arrow keys in the active search field while it contains text", async () => {
+ const menu = await createMenu();
+
+ menu.handleInput("a");
+ menu.handleInput("n");
+ menu.handleInput("\x1b[D");
+ menu.handleInput("\x1b[C");
+
+ expect(menu.getActiveTab()).toBe("providers");
+ expect(menu.getSearchValue()).toBe("an");
+ });
+
+ it("wraps complete tab labels at narrow widths without overflowing the viewport", async () => {
+ const menu = await createMenu({ getRows: () => 24 });
+
+ for (const tab of ["providers", "models", "mcp-connections"] as const) {
+ menu.setActiveTab(tab);
+ const lines = menu.render(24);
+ const output = stripAnsi(lines.join("\n"));
+ expect(output).toContain("Providers");
+ expect(output).toContain("Models");
+ expect(output).toContain("MCP Connections");
+ expect(lines.length).toBeLessThanOrEqual(24);
+ for (const line of lines) {
+ expect(visibleWidth(line)).toBe(24);
+ }
+ }
+ });
+
+ it("keeps the active marker visible across supported themes", async () => {
+ const menu = await createMenu();
+
+ for (const themeName of ["dark", "light", "prime"] as const) {
+ initTheme(themeName);
+ const rendered = menu.render(120).join("\n");
+ expect(stripAnsi(rendered)).toContain("[▶ Providers]");
+ expect(rendered).not.toBe(stripAnsi(rendered));
+ }
+ });
});