Skip to content

armgit / eve

Public Imported from GitHub
0

The Open Framework for Building Agents

feat(eve): simplify TUI setup selections (#3689)

OwenKephart650b309a3653
diff --git a/.changeset/tui-minimal-setup-selection.md b/.changeset/tui-minimal-setup-selection.md
new file mode 100644
index 000000000..1ce484594
--- /dev/null
+++ b/.changeset/tui-minimal-setup-selection.md
@@ -0,0 +1,5 @@
+---
+"eve": patch
+---
+
+Use a quieter selected-row treatment and temporary drawer for interactive setup flows in the development TUI. `/add`, `/login`, and `/deploy` now emphasize the focused option with type weight instead of a caret, keep controls below the drawer, and `/login` supports inline connection completion such as `/login openai-api-key`.
diff --git a/packages/eve/src/cli/dev/tui/argument-typeahead.test.ts b/packages/eve/src/cli/dev/tui/argument-typeahead.test.ts
index b77a7c48d..d88189006 100644
--- a/packages/eve/src/cli/dev/tui/argument-typeahead.test.ts
+++ b/packages/eve/src/cli/dev/tui/argument-typeahead.test.ts
@@ -44,7 +44,14 @@ describe("argumentTypeaheadQuery", () => {
completed: [],
argumentStart: 6,
});
+ expect(argumentTypeaheadQuery("/login ver")).toEqual({
+ command: "login",
+ argument: "ver",
+ completed: [],
+ argumentStart: 7,
+ });
expect(argumentTypeaheadQuery("/add channel/slack ")).toBeUndefined();
+ expect(argumentTypeaheadQuery("/login vercel ")).toBeUndefined();
expect(argumentTypeaheadQuery("/model anthropic/claude-sonnet high ")).toBeUndefined();
expect(argumentTypeaheadQuery("/add one two")).toBeUndefined();
expect(argumentTypeaheadQuery("hello")).toBeUndefined();
diff --git a/packages/eve/src/cli/dev/tui/argument-typeahead.ts b/packages/eve/src/cli/dev/tui/argument-typeahead.ts
index 12bd31e6c..586177104 100644
--- a/packages/eve/src/cli/dev/tui/argument-typeahead.ts
+++ b/packages/eve/src/cli/dev/tui/argument-typeahead.ts
@@ -11,7 +11,7 @@ export interface PromptArgumentSuggestion {
readonly next?: readonly PromptArgumentSuggestion[];
}
-export type ArgumentTypeaheadCommand = "model" | "add";
+export type ArgumentTypeaheadCommand = "model" | "add" | "login";
export interface ArgumentTypeaheadQuery {
readonly command: ArgumentTypeaheadCommand;
@@ -27,14 +27,16 @@ export interface ArgumentTypeaheadState extends ArgumentTypeaheadQuery {
readonly selectedIndex: number;
}
-const ARGUMENT_LIMIT: Record<ArgumentTypeaheadCommand, number> = { add: 1, model: 2 };
+const ARGUMENT_LIMIT: Record<ArgumentTypeaheadCommand, number> = { add: 1, login: 1, model: 2 };
export function isArgumentTypeaheadCommand(command: string): command is ArgumentTypeaheadCommand {
- return command === "model" || command === "add";
+ return command === "model" || command === "add" || command === "login";
}
export function argumentTypeaheadLoadingLabel(command: ArgumentTypeaheadCommand): string {
- return command === "model" ? "models" : "registry";
+ if (command === "model") return "models";
+ if (command === "add") return "registry";
+ return "connections";
}
/**
diff --git a/packages/eve/src/cli/dev/tui/prompt-command-handler.test.ts b/packages/eve/src/cli/dev/tui/prompt-command-handler.test.ts
index d1d794fbf..e7f5891f4 100644
--- a/packages/eve/src/cli/dev/tui/prompt-command-handler.test.ts
+++ b/packages/eve/src/cli/dev/tui/prompt-command-handler.test.ts
@@ -143,6 +143,44 @@ describe("createPromptCommandHandler", () => {
});
});
+ it("routes a /login argument to its connection", async () => {
+ const runTuiSetupCommand = vi.fn(async () => ({
+ message: "Connected.",
+ preserveFlowDiagnostics: false,
+ }));
+ vi.doMock("./setup-commands.js", () => ({
+ SETUP_FLOW_CONFIG: { login: { title: "", indicator: "pulse" } },
+ runTuiSetupCommand,
+ }));
+
+ try {
+ const handler = createPromptCommandHandler({ target: LOCAL_TARGET });
+ await handler.handle(
+ { type: "extension", name: "login", argument: "openai-api-key" },
+ context({ setupFlow: setupFlowRenderer() }),
+ );
+ expect(runTuiSetupCommand).toHaveBeenCalledWith(
+ expect.objectContaining({ command: "login", initialLoginConnection: "openai" }),
+ );
+ } finally {
+ vi.doUnmock("./setup-commands.js");
+ vi.resetModules();
+ }
+ });
+
+ it("rejects an unknown /login connection", async () => {
+ const handler = createPromptCommandHandler({ target: LOCAL_TARGET });
+
+ await expect(
+ handler.handle(
+ { type: "extension", name: "login", argument: "other" },
+ context({ setupFlow: setupFlowRenderer() }),
+ ),
+ ).resolves.toEqual({
+ message: "Use `/login vercel|chatgpt|vercel-api-key|openai-api-key|anthropic-api-key`.",
+ });
+ });
+
it("routes a /add argument to the registry flow's initial address", async () => {
const runTuiSetupCommand = vi.fn(async () => ({
message: "Added Slack",
diff --git a/packages/eve/src/cli/dev/tui/prompt-command-handler.ts b/packages/eve/src/cli/dev/tui/prompt-command-handler.ts
index 3ebd22115..34e447e7e 100644
--- a/packages/eve/src/cli/dev/tui/prompt-command-handler.ts
+++ b/packages/eve/src/cli/dev/tui/prompt-command-handler.ts
@@ -1,5 +1,6 @@
import type { ApplyModelOutcome } from "#setup/flows/model-source-change.js";
import type { AgentReasoningDefinition } from "#shared/agent-definition.js";
+import type { ModelConnectionSelection } from "#shared/model-connection.js";
import { toErrorMessage } from "#shared/errors.js";
import type {
@@ -13,6 +14,14 @@ import type { DevelopmentTuiTarget } from "./target.js";
type ExtensionCommand = Extract<PromptCommand, { type: "extension" }>;
+const LOGIN_CONNECTIONS: Readonly<Record<string, ModelConnectionSelection>> = {
+ vercel: "vercel",
+ chatgpt: "chatgpt",
+ "vercel-api-key": "ai-gateway-key",
+ "openai-api-key": "openai",
+ "anthropic-api-key": "anthropic",
+};
+
export interface PromptCommandHandlerOptions {
readonly target: DevelopmentTuiTarget;
/** Test seam; defaults to the model flow's shared source-change apply. */
@@ -114,6 +123,20 @@ export function createPromptCommandHandler(
return { message: "Choose an integration from the inline /add suggestions." };
}
+ const loginConnection =
+ command.name === "login" && command.argument.length > 0
+ ? LOGIN_CONNECTIONS[command.argument]
+ : undefined;
+ if (
+ command.name === "login" &&
+ command.argument.length > 0 &&
+ loginConnection === undefined
+ ) {
+ return {
+ message: "Use `/login vercel|chatgpt|vercel-api-key|openai-api-key|anthropic-api-key`.",
+ };
+ }
+
const flow = context.renderer.setupFlow;
if (flow === undefined) {
return { message: `/${command.name} is not supported by this renderer.` };
@@ -145,6 +168,7 @@ export function createPromptCommandHandler(
commandInput.onOnboardingScreen = context.onOnboardingScreen;
}
if (command.name === "add") commandInput.initialRegistryAddress = command.argument;
+ if (loginConnection !== undefined) commandInput.initialLoginConnection = loginConnection;
if (options.flows !== undefined) commandInput.flows = options.flows;
const result = await runTuiSetupCommand(commandInput);
preserveFlowDiagnostics = result.preserveFlowDiagnostics;
diff --git a/packages/eve/src/cli/dev/tui/prompt-commands.test.ts b/packages/eve/src/cli/dev/tui/prompt-commands.test.ts
index 20a73cda8..a9adcf00c 100644
--- a/packages/eve/src/cli/dev/tui/prompt-commands.test.ts
+++ b/packages/eve/src/cli/dev/tui/prompt-commands.test.ts
@@ -55,6 +55,11 @@ describe("parsePromptCommand", () => {
name: "add",
argument: "",
});
+ expect(parsePromptCommand("/login vercel-api-key")).toEqual({
+ type: "extension",
+ name: "login",
+ argument: "vercel-api-key",
+ });
});
it("parses /add with a trimmed registry address", () => {
diff --git a/packages/eve/src/cli/dev/tui/prompt-commands.ts b/packages/eve/src/cli/dev/tui/prompt-commands.ts
index ea905ab47..b28efba55 100644
--- a/packages/eve/src/cli/dev/tui/prompt-commands.ts
+++ b/packages/eve/src/cli/dev/tui/prompt-commands.ts
@@ -89,8 +89,9 @@ const PROMPT_COMMAND_DEFINITIONS = [
name: "login",
aliases: [],
description: "Connect a model provider",
- takesArgument: false,
- build: () => ({ type: "extension", name: "login", argument: "" }),
+ argumentHint: "[connection]",
+ takesArgument: true,
+ build: (argument) => ({ type: "extension", name: "login", argument }),
targets: ["local"],
},
{
diff --git a/packages/eve/src/cli/dev/tui/runner.ts b/packages/eve/src/cli/dev/tui/runner.ts
index ef5690d4d..9a270fc8a 100644
--- a/packages/eve/src/cli/dev/tui/runner.ts
+++ b/packages/eve/src/cli/dev/tui/runner.ts
@@ -471,8 +471,10 @@ export type EveTUIRunnerOptions = TuiDisplayOptions & {
promptCommandHandler?: PromptCommandHandler;
/** Commands shown in discovery for this local or remote session. */
availablePromptCommands?: readonly PromptCommandSpec[];
- /** Catalog entries available to inline `/model` and `/add` completion. */
- argumentSuggestions?: (command: "model" | "add") => Promise<readonly PromptArgumentSuggestion[]>;
+ /** Catalog entries available to inline `/model`, `/add`, and `/login` completion. */
+ argumentSuggestions?: (
+ command: "model" | "add" | "login",
+ ) => Promise<readonly PromptArgumentSuggestion[]>;
/** Gives setup subprocesses exclusive terminal and development-host ownership. */
withExclusiveTerminal?: <T>(task: () => Promise<T>) => Promise<T>;
/** Remote target and mutable OIDC token source, when connected through `--url`. */
diff --git a/packages/eve/src/cli/dev/tui/setup-commands.ts b/packages/eve/src/cli/dev/tui/setup-commands.ts
index baa21b881..fc49ae2f0 100644
--- a/packages/eve/src/cli/dev/tui/setup-commands.ts
+++ b/packages/eve/src/cli/dev/tui/setup-commands.ts
@@ -1,4 +1,4 @@
-import type { ModelAccessChange } from "#shared/model-connection.js";
+import type { ModelAccessChange, ModelConnectionSelection } from "#shared/model-connection.js";
import { runModelLogin } from "#setup/flows/model-login.js";
import { HumanActionRequiredError } from "#setup/human-action.js";
import { runDeployFlow } from "#setup/flows/deploy.js";
@@ -29,9 +29,9 @@ export type TuiSetupCommand = Exclude<PromptCommandExtensionName, "model">;
* move past their opening question.
*/
export const SETUP_FLOW_CONFIG = {
- login: { title: "Connecting your model", indicator: "pulse" },
- add: { title: "Add to your agent", indicator: "pulse" },
- deploy: { title: "Deploy to Vercel", indicator: "spinner" },
+ login: { title: "", indicator: "pulse" },
+ add: { title: "", indicator: "pulse" },
+ deploy: { title: "", indicator: "spinner" },
} satisfies Record<TuiSetupCommand, { title: string; indicator: SetupFlowIndicator }>;
export type TuiSetupCommandRenderer = TuiPrompterRenderer &
@@ -61,6 +61,8 @@ export interface TuiSetupCommandInput {
renderer: TuiSetupCommandRenderer;
/** Initial model-flow step authorized by the runner's boot evidence. */
initialModelStep?: "provider";
+ /** Connection selected through `/login <connection>`. */
+ initialLoginConnection?: ModelConnectionSelection;
/** Registry address supplied by `/add <item>`, confirmed and installed directly. */
initialRegistryAddress?: string;
/** Presentation and navigation supplied by an enclosing setup journey. */
@@ -250,6 +252,8 @@ async function executeSetupCommand(
prompter,
signal,
automatic: input.initialModelStep === "provider",
+ selected: input.initialLoginConnection,
+ connectionMessage: "",
withConnectionUpdate: input.withExclusiveTerminal,
});
return result.kind === "cancelled"
diff --git a/packages/eve/src/cli/dev/tui/setup-panel.test.ts b/packages/eve/src/cli/dev/tui/setup-panel.test.ts
index de05a2e39..43de76d3e 100644
--- a/packages/eve/src/cli/dev/tui/setup-panel.test.ts
+++ b/packages/eve/src/cli/dev/tui/setup-panel.test.ts
@@ -4,6 +4,7 @@ import { initialSelectState } from "#setup/cli/select-state.js";
import { lineOf } from "./line-editor.js";
import {
renderAcknowledgeQuestion,
+ renderFlowDrawer,
renderFlowPanel,
renderSelectQuestion,
renderTextQuestion,
@@ -205,6 +206,66 @@ describe("renderFlowPanel", () => {
});
});
+describe("renderFlowDrawer", () => {
+ it("frames an active flow while keeping its title out of the body", () => {
+ const rows = renderFlowDrawer(
+ {
+ title: "add to your agent",
+ lines: [],
+ content: {
+ kind: "question",
+ title: "add to your agent",
+ rows: [" Set up Vercel Connect", " Use portable credentials"],
+ },
+ },
+ theme,
+ 60,
+ );
+
+ expect(rows.rows[0]).toBe("─".repeat(60));
+ expect(rows.rows[1]).toBe("");
+ expect(rows.rows[2]).toBe(" ┃ add to your agent");
+ expect(rows.rows.at(-2)).toBe("");
+ expect(rows.rows.at(-1)).toBe("─".repeat(60));
+ expect(rows.rows.join("\n").split("add to your agent")).toHaveLength(2);
+ });
+
+ it("places question controls below the drawer boundary", () => {
+ const drawer = renderFlowDrawer(
+ {
+ title: "",
+ lines: [],
+ content: {
+ kind: "question",
+ rows: [" Vercel account", "", " ↑/↓ move · Enter select · Esc close"],
+ },
+ },
+ theme,
+ 60,
+ );
+
+ expect(drawer.rows).toEqual(["─".repeat(60), "", " Vercel account", "", "─".repeat(60)]);
+ expect(drawer.controls).toEqual(["↑/↓ move · Enter select · Esc close"]);
+ });
+
+ it("omits the drawer header for a titleless flow", () => {
+ const rows = renderFlowDrawer(
+ {
+ title: "",
+ lines: [],
+ content: { kind: "question", rows: [" Vercel account"] },
+ },
+ theme,
+ 60,
+ );
+
+ expect(rows).toEqual({
+ rows: ["─".repeat(60), "", " Vercel account", "", "─".repeat(60)],
+ controls: [],
+ });
+ });
+});
+
describe("renderSelectQuestion", () => {
it.each([32, 100])(
"filters by capability without displaying search metadata at width %i",
@@ -223,7 +284,8 @@ describe("renderSelectQuestion", () => {
theme,
width,
).join("\n");
- expect(text).toContain("› Blooio");
+ expect(text).toContain("Blooio");
+ expect(text).not.toContain("›");
expect(text).not.toContain("Slack");
expect(text).not.toContain("Send and receive");
},
@@ -260,7 +322,7 @@ describe("renderSelectQuestion", () => {
" Source: Official eve registry",
" Packages: @agent-browser/eve",
"",
- " › Add to project",
+ " Add to project",
" Back",
]);
});
@@ -282,8 +344,9 @@ describe("renderSelectQuestion", () => {
expect(text).not.toContain("▔".repeat(10));
// The lone hint sits one space past its own label — the longer hint-less
// "Link an existing project" no longer pads the column open.
- expect(text).toContain(" › Create a new project · fastest");
- expect(text).toContain(" Link an existing project");
+ expect(text).toContain(" Create a new project · fastest");
+ expect(text).toContain(" Link an existing project");
+ expect(text).not.toContain("›");
expect(text).not.toContain("1.");
expect(text).toContain("esc to cancel");
});
@@ -327,7 +390,8 @@ describe("renderSelectQuestion", () => {
60,
).join("\n");
- expect(text).toContain(" › Link to another project");
+ expect(text).toContain(" Link to another project");
+ expect(text).not.toContain("›");
expect(text).not.toContain("1.");
const colored = renderSelectQuestion(
@@ -340,7 +404,7 @@ describe("renderSelectQuestion", () => {
colorTheme,
60,
).join("\n");
- expect(colored).toContain("\x1b[1m › Link to another project\x1b[22m");
+ expect(colored).toContain("\x1b[1mLink to another project\x1b[22m");
});
it("renders completed task rows as focusable but not highlighted actions", () => {
@@ -376,18 +440,17 @@ describe("renderSelectQuestion", () => {
80,
);
- // The focused completed row reads as inert: a dim pointer, not a check.
+ // Completed rows retain an inert cursor rather than borrowing the
+ // available-row selection weight; resting rows retain their checks.
expect(rows).toContain(" › Terminal UI · Already installed");
- expect(rows).not.toContain(" ✓ Terminal UI");
- // An unfocused completed row keeps its check.
expect(rows).toContain(" ✓ Web Chat");
expect(rows).toContain(" Done");
const warning = rows.indexOf(" ⚠ Overwrote /tmp/weather-agent");
const success = rows.indexOf(" ✓ Scaffolded channel: web");
const done = rows.indexOf(" Done");
- expect(rows.indexOf(" Slack · Creates slackbot and deploys to Vercel")).toBeLessThan(
- warning,
- );
+ const slack = rows.indexOf(" Slack · Creates slackbot and deploys to Vercel");
+ expect(slack).toBeGreaterThanOrEqual(0);
+ expect(slack).toBeLessThan(warning);
expect(warning).toBeLessThan(success);
expect(success).toBeLessThan(done);
expect([rows[warning - 1], rows[done - 1]]).toEqual(["", ""]);
@@ -404,11 +467,11 @@ describe("renderSelectQuestion", () => {
80,
);
const coloredRow = coloredRows.find((row) => row.includes("Terminal UI"));
- // Focused completed row: dim pointer matching the dim label, never green or cyan.
- expect(coloredRow).toContain("\x1b[2m›\x1b[22m");
+ // Completed rows remain dim and never borrow the selected row's weight.
expect(coloredRow).toContain("\x1b[2mTerminal UI\x1b[22m");
expect(coloredRow).toContain("\x1b[2m · Already installed\x1b[22m");
- expect(coloredRow).not.toContain("\x1b[32m");
+ expect(coloredRow).toContain("\x1b[2m›\x1b[22m");
+ expect(coloredRow).not.toContain("\x1b[32m✓\x1b[39m");
expect(coloredRow).not.toContain("\x1b[36m");
});
@@ -423,7 +486,8 @@ describe("renderSelectQuestion", () => {
theme,
60,
).join("\n");
- expect(multi).toContain(" › Create a new project ");
+ expect(multi).toContain(" Create a new project ");
+ expect(multi).not.toContain("›");
expect(multi).not.toContain("1.");
const searchable = renderSelectQuestion(
@@ -718,7 +782,8 @@ describe("renderSelectQuestion", () => {
60,
).join("\n");
- expect(text).toContain("› Create a new project");
+ expect(text).toContain("Create a new project");
+ expect(text).not.toContain("›");
expect(text).toContain("✓ Link an existing project");
expect(text).toContain("Submit");
expect(text).toContain("space to toggle");
@@ -769,16 +834,30 @@ describe("renderSelectQuestion", () => {
);
const text = rows.join("\n");
- // The filter rail sits in the option rows' glyph column.
- expect(text).toContain(" type to filter");
- expect(text).toContain(" › Model 0");
+ // The empty filter is a block-cursor field directly above its first result.
+ expect(text).toContain(" search…\n Model 0");
+ expect(text).toContain(" Model 0");
expect(text).toContain(" Model 4");
+ expect(text).not.toContain("›");
expect(text).not.toContain("Model 5");
// The list scrolls silently: no count row, Esc is the whole footer.
expect(text).not.toContain("options, showing");
expect(text).toContain("Esc back");
expect(text).not.toContain("type to filter ·");
expect(text).not.toContain("↑/↓ move");
+
+ const colored = renderSelectQuestion(
+ {
+ kind: "search",
+ message: "Which model?",
+ options: many,
+ placeholder: "type to filter",
+ select: initialSelectState({ options: many }),
+ },
+ colorTheme,
+ 60,
+ ).join("\n");
+ expect(colored).toContain(colorTheme.colors.inverse("s"));
});
it("paints a validation error inside the question", () => {
@@ -949,10 +1028,12 @@ describe("compact menus", () => {
columns,
);
const text = stripAnsi(rows.join("\n"));
- expect(text).toContain("› Vercel account");
+ expect(text).toContain("Vercel account");
+ expect(text).not.toContain("›");
expect(text).toContain("OpenAI API key");
expect(rows.join("\n")).not.toContain("\x1b[7m");
- expect(rows.join("\n")).toContain("\x1b[1m");
+ expect(rows.join("\n")).toContain("\x1b[1mVercel account\x1b[22m");
+ expect(rows.join("\n")).toContain("\x1b[2mOpenAI API key\x1b[22m");
expect(text).not.toContain("▔");
expect(
rows
@@ -967,7 +1048,8 @@ describe("compact menus", () => {
colorTheme,
80,
);
- expect(stripAnsi(rows.join("\n"))).toContain("› Reconnect");
+ expect(stripAnsi(rows.join("\n"))).toContain("Reconnect");
+ expect(stripAnsi(rows.join("\n"))).not.toContain("›");
expect(rows.join("\n")).not.toContain("\x1b[7m");
});
});
diff --git a/packages/eve/src/cli/dev/tui/setup-panel.ts b/packages/eve/src/cli/dev/tui/setup-panel.ts
index e1e84064c..b7816bd30 100644
--- a/packages/eve/src/cli/dev/tui/setup-panel.ts
+++ b/packages/eve/src/cli/dev/tui/setup-panel.ts
@@ -1,7 +1,7 @@
/** Pure borderless setup menus. Interaction and terminal lifecycle belong to the renderer. */
import type { ChannelSetupAction, PromptOption } from "#setup/cli/index.js";
-import { renderOptionRow, renderCursorRow, resolveOptionRowState } from "#setup/cli/option-row.js";
+import { renderOptionRow, resolveOptionRowState } from "#setup/cli/option-row.js";
import {
filterOptions,
submitRowIndex,
@@ -49,6 +49,8 @@ interface SetupSelectPanelBase extends SetupQuestionPanelBase {
loadingFrame?: string;
/** A dim-inverse affordance appended to the cursor row, e.g. ` ↵ change `. */
cursorBadge?: string;
+ /** Blink state for the active searchable field. */
+ caretVisible?: boolean;
footerHints?: readonly string[];
}
@@ -327,11 +329,47 @@ export function renderFlowPanel(state: FlowPanelState, theme: Theme, width: numb
return rows.map((row) => (row.length === 0 ? clip(row, width) : clip(` ${row}`, width)));
}
+/**
+ * Frames an active setup flow as a drawer above the terminal footer. The
+ * command echo remains in the transcript; this surface owns only temporary
+ * setup state and disappears when the flow settles.
+ */
+export interface FlowDrawer {
+ /** Temporary content enclosed by the drawer boundaries. */
+ rows: string[];
+ /** Interaction hints placed below the drawer so they do not compete with its content. */
+ controls: string[];
+}
+
+export function renderFlowDrawer(state: FlowPanelState, theme: Theme, width: number): FlowDrawer {
+ const divider = theme.colors.dim(theme.glyph.dash.repeat(Math.max(1, width)));
+ const drawerMark = theme.unicode ? "┃" : "|";
+ // The drawer owns the flow title. Keep it out of the panel body so a status
+ // or question never repeats its context immediately below the header.
+ const content =
+ state.content.kind === "question" && state.content.title === state.title
+ ? { ...state.content, title: undefined }
+ : state.content;
+ const body = renderFlowPanel({ ...state, title: "", content }, theme, width);
+ // Every interactive question ends with an empty row and one or more wrapped
+ // hints. Put that affordance under the drawer boundary instead of making it
+ // compete with the active selection inside.
+ const footerStart = body.lastIndexOf("");
+ const controls = footerStart === -1 ? [] : body.slice(footerStart + 1);
+ const drawerBody = footerStart === -1 ? body : body.slice(0, footerStart);
+ const header =
+ state.title.length === 0 ? [] : [` ${theme.colors.dim(`${drawerMark} ${state.title}`)}`, ""];
+ const leftAlignedControls = controls.map((row) => row.trimStart());
+ return {
+ rows: [divider, "", ...header, ...drawerBody, "", divider],
+ controls: leftAlignedControls,
+ };
+}
+
function optionRow(input: {
option: SetupPanelOption;
isCursor: boolean;
isChecked: boolean;
- placeholder: boolean;
/** Railed lists lead resting rows with the `▏` rail and drop the hint dot. */
railed?: boolean;
hintPadding?: number;
@@ -355,7 +393,8 @@ function optionRow(input: {
accent: option.accent,
isCursor: input.isCursor,
state: resolveOptionRowState(option, input.isChecked),
- placeholder: input.placeholder,
+ placeholder: false,
+ presentation: "minimal",
hintPadding: input.hintPadding,
});
}
@@ -460,15 +499,28 @@ function searchFilter(
filter: string,
placeholder: string | undefined,
loadingFrame: string | undefined,
+ caretVisible: boolean,
theme: Theme,
railed: boolean,
): string {
- const caret = theme.colors.dim(theme.glyph.caret);
+ const caret = caretVisible ? theme.colors.dim(theme.glyph.caret) : " ";
let input = caret;
if (railed) {
- // The railed list's filter line: `▏ query▏`, or the dim placeholder.
- input = filter.length > 0 ? filter + caret : theme.colors.dim(placeholder ?? "type to filter");
- } else if (filter.length > 0) {
+ input =
+ filter.length === 0
+ ? renderInputWithBlockCursor({
+ before: "",
+ under: "s",
+ after: "earch…",
+ visible: caretVisible,
+ inverse: theme.colors.inverse,
+ render: theme.colors.dim,
+ })
+ : `${filter}${caret}`;
+ if (loadingFrame !== undefined) input += ` ${theme.colors.yellow(loadingFrame)}`;
+ return input;
+ }
+ if (filter.length > 0) {
input = filter + caret;
} else if (placeholder !== undefined) {
input = theme.colors.dim(`> ${placeholder}`);
@@ -478,9 +530,9 @@ function searchFilter(
}
/**
- * Whether a select renders as the railed searchable list — the one component
- * behind the model catalog, team, and project pickers: `▏`-railed rows, an
- * inverse cursor row, and a rail-led filter line.
+ * Whether a select renders as the compact searchable list behind the model
+ * catalog, team, and project pickers. Its filter line leads the options and
+ * the focused row uses bold weight rather than a cursor marker.
*/
function isRailedSearch(presentation: SelectPresentation): boolean {
return (
@@ -599,20 +651,6 @@ function inlineEditOption(
}
}
-function optionUsesPlaceholder(
- presentation: SelectPresentation,
- isTrailingTaskAction: boolean,
-): boolean {
- // A type-ahead list draws no placeholder dots — the filter row leads instead.
- const isFiltered = presentation.filter !== undefined && presentation.layout !== "task-list";
- // Checklists and the explicit menu layouts (stacked, task-list) present every
- // row as a pickable option, so each carries the placeholder dot.
- const isMultiSelect = presentation.selection === "multiple";
- const isMenuLayout = presentation.layout !== "plain";
-
- return !isFiltered && !isTrailingTaskAction && (isMultiSelect || isMenuLayout);
-}
-
function appendSelectOptionRows(input: {
rows: string[];
state: SetupOptionSelectPanelState;
@@ -666,8 +704,8 @@ function appendSelectOptionRows(input: {
};
if (editingKey) rowOption.hint = undefined;
const railed = isRailedSearch(presentation);
- // Railed lists already mark their cursor with `›`; only an explicit badge
- // such as the provider picker's `↵ change` adds an extra affordance.
+ // Focused rows use bold weight; only an explicit badge such as the provider
+ // picker's `↵ change` adds another affordance.
const rowBadge = state.cursorBadge;
const badge = isCursor && rowBadge !== undefined ? ` ${rowBadge}` : "";
rows.push(
@@ -678,7 +716,6 @@ function appendSelectOptionRows(input: {
presentation.selection === "multiple"
? state.select.selected.has(option.value)
: option.checked === true,
- placeholder: railed || optionUsesPlaceholder(presentation, isTrailingTaskAction),
railed,
hintPadding: Math.max(0, visibleLabelWidth - rowOption.label.length),
theme,
@@ -693,10 +730,8 @@ function appendSelectOptionRows(input: {
function appendSubmitRow(rows: string[], cursor: number, submitIndex: number, theme: Theme): void {
if (submitIndex < 0) return;
const onSubmit = cursor === submitIndex;
- const content = onSubmit
- ? `${theme.glyph.selectedPointer} ${theme.colors.bold("Submit")}`
- : " Submit";
- rows.push("", ` ${renderCursorRow(content, onSubmit, theme.colors)}`);
+ const content = onSubmit ? theme.colors.bold("Submit") : theme.colors.dim("Submit");
+ rows.push("", ` ${content}`);
}
function appendSelectNotices(
@@ -775,7 +810,6 @@ function renderActionQuestion(
option: action,
isCursor: index === state.cursor,
isChecked: false,
- placeholder: true,
hintPadding: 0,
theme,
})}`,
@@ -841,17 +875,15 @@ export function renderSelectQuestion(
}
if (presentation.filter !== undefined) {
- // The railed filter line indents one extra cell so its rail sits in the
- // option rows' glyph column.
- rows.push(
- ` ${railed ? " " : ""}${searchFilter(
- state.select.filter,
- presentation.filter.placeholder,
- state.loadingFrame,
- theme,
- railed,
- )}`,
+ const filter = searchFilter(
+ state.select.filter,
+ presentation.filter.placeholder,
+ state.loadingFrame,
+ state.caretVisible ?? true,
+ theme,
+ railed,
);
+ rows.push(` ${railed ? " " : ""}${filter}`);
}
const viewSize = selectViewSize({
diff --git a/packages/eve/src/cli/dev/tui/terminal-renderer.test.ts b/packages/eve/src/cli/dev/tui/terminal-renderer.test.ts
index 2c70226a4..aebc51464 100644
--- a/packages/eve/src/cli/dev/tui/terminal-renderer.test.ts
+++ b/packages/eve/src/cli/dev/tui/terminal-renderer.test.ts
@@ -4723,7 +4723,7 @@ describe("TerminalRenderer setup flow session", () => {
});
const snapshot = screen.snapshot();
- expect(snapshot).not.toContain("/deploy");
+ expect(snapshot).toContain("┃ /deploy");
expect(snapshot).toContain("This directory is not linked yet.");
expect(snapshot).toContain("Vercel project");
@@ -4792,9 +4792,9 @@ describe("TerminalRenderer setup flow session", () => {
const snapshot = screen.snapshot();
expect(snapshot).not.toContain("Slack channel was not added");
expect(snapshot).not.toContain("Scaffolding Web Chat channel files");
- // Focused completed row reads inert: a dim pointer, not a check.
+ // A focused completed row retains a dim inert cursor; resting completed
+ // rows retain their semantic check without borrowing selection weight.
expect(snapshot).toContain("› Terminal UI · Already installed");
- expect(snapshot).not.toContain("✓ Terminal UI");
expect(snapshot).toContain("✓ Web Chat");
expect(snapshot).toContain("Slack · Creates slackbot and deploys to Vercel");
expect(snapshot).toContain("Dependency installation failed.");
@@ -5242,32 +5242,67 @@ describe("TerminalRenderer command typeahead", () => {
renderer.shutdown();
});
- it("shows loading before model argument suggestions arrive", async () => {
- const screen = new MockScreen({ columns: 80, rows: 30 });
- const input = new MockUserInput();
- const suggestions = Promise.withResolvers<
- readonly {
- value: string;
- label: string;
- hint?: string;
- }[]
- >();
- const renderer = new TerminalRenderer({
- input,
- output: screen,
- captureForeignOutput: false,
- unicode: true,
- argumentSuggestions: async () => suggestions.promise,
- });
+ it("delays loading until model argument suggestions remain pending", async () => {
+ vi.useFakeTimers();
+ try {
+ const screen = new MockScreen({ columns: 80, rows: 30 });
+ const input = new MockUserInput();
+ const suggestions = Promise.withResolvers<
+ readonly {
+ value: string;
+ label: string;
+ hint?: string;
+ }[]
+ >();
+ const renderer = new TerminalRenderer({
+ input,
+ output: screen,
+ captureForeignOutput: false,
+ unicode: true,
+ argumentSuggestions: async () => suggestions.promise,
+ });
- const prompt = renderer.readPrompt();
- input.type("/model ");
- expect(screen.snapshot()).toContain("Loading models…");
- suggestions.resolve([{ value: "openai/gpt-5", label: "GPT-5" }]);
- await vi.waitFor(() => expect(screen.snapshot()).toContain("openai/gpt-5"));
- input.enter();
- await prompt;
- renderer.shutdown();
+ const prompt = renderer.readPrompt();
+ input.type("/model ");
+ expect(screen.snapshot()).not.toContain("Loading models…");
+
+ await vi.advanceTimersByTimeAsync(500);
+ expect(screen.snapshot()).toContain("Loading models…");
+
+ suggestions.resolve([{ value: "openai/gpt-5", label: "GPT-5" }]);
+ await vi.waitFor(() => expect(screen.snapshot()).toContain("openai/gpt-5"));
+ input.enter();
+ await prompt;
+ renderer.shutdown();
+ } finally {
+ vi.useRealTimers();
+ }
+ });
+
+ it("does not paint loading when argument suggestions resolve within the delay", async () => {
+ vi.useFakeTimers();
+ try {
+ const screen = new MockScreen({ columns: 80, rows: 30 });
+ const input = new MockUserInput();
+ const renderer = new TerminalRenderer({
+ input,
+ output: screen,
+ captureForeignOutput: false,
+ unicode: true,
+ argumentSuggestions: async () => [{ value: "openai/gpt-5", label: "GPT-5" }],
+ });
+
+ const prompt = renderer.readPrompt();
+ input.type("/model ");
+ await vi.advanceTimersByTimeAsync(499);
+ expect(screen.snapshot()).toContain("openai/gpt-5");
+ expect(screen.snapshot()).not.toContain("Loading models…");
+ input.enter();
+ await prompt;
+ renderer.shutdown();
+ } finally {
+ vi.useRealTimers();
+ }
});
it("advances to reasoning after selecting a model with reasoning choices", async () => {
diff --git a/packages/eve/src/cli/dev/tui/terminal-renderer.ts b/packages/eve/src/cli/dev/tui/terminal-renderer.ts
index 3c1978a70..8d4fbd2a3 100644
--- a/packages/eve/src/cli/dev/tui/terminal-renderer.ts
+++ b/packages/eve/src/cli/dev/tui/terminal-renderer.ts
@@ -48,7 +48,7 @@ import {
} from "./prompt-commands.js";
import {
enterBadge,
- renderFlowPanel,
+ renderFlowDrawer,
flowMessageRows,
renderAcknowledgeQuestion,
renderSelectQuestion,
@@ -181,6 +181,8 @@ import {
type SetupOptionPanelState = Exclude<SetupSelectPanelState, { kind: "actions" }>;
+const ARGUMENT_CATALOG_LOADING_DELAY_MS = 500;
+
export type TerminalInput = {
isTTY?: boolean;
on(event: "data", listener: (chunk: Buffer) => void): TerminalInput;
@@ -292,8 +294,10 @@ export type TerminalRendererOptions = {
diagnostics?: DevDiagnostics;
/** Slash commands available in this local or remote session. */
availablePromptCommands?: readonly PromptCommandSpec[];
- /** Catalog entries available to inline `/model` and `/add` completion. */
- argumentSuggestions?: (command: "model" | "add") => Promise<readonly PromptArgumentSuggestion[]>;
+ /** Catalog entries available to inline `/model`, `/add`, and `/login` completion. */
+ argumentSuggestions?: (
+ command: "model" | "add" | "login",
+ ) => Promise<readonly PromptArgumentSuggestion[]>;
onExitRequest?: () => void;
};
@@ -480,7 +484,12 @@ export class TerminalRenderer implements AgentTUIRenderer {
readonly #argumentSuggestions?: TerminalRendererOptions["argumentSuggestions"];
readonly #argumentCatalogs = new Map<
ArgumentTypeaheadState["command"],
- { kind: "loading" } | { kind: "ready"; suggestions: readonly PromptArgumentSuggestion[] }
+ | { kind: "loading"; visible: boolean }
+ | { kind: "ready"; suggestions: readonly PromptArgumentSuggestion[] }
+ >();
+ readonly #argumentCatalogLoadingTimers = new Map<
+ ArgumentTypeaheadState["command"],
+ ReturnType<typeof setTimeout>
>();
/**
* Whether the empty input row invites with a rotating placeholder. Only
@@ -685,11 +694,25 @@ export class TerminalRenderer implements AgentTUIRenderer {
}
const catalog = this.#argumentCatalogs.get(query.command);
if (catalog === undefined) {
- this.#argumentCatalogs.set(query.command, { kind: "loading" });
- void this.#argumentSuggestions(query.command)
+ this.#argumentCatalogs.set(query.command, { kind: "loading", visible: false });
+ const command = query.command;
+ this.#argumentCatalogLoadingTimers.set(
+ command,
+ setTimeout(() => {
+ this.#argumentCatalogLoadingTimers.delete(command);
+ const pending = this.#argumentCatalogs.get(command);
+ if (pending?.kind !== "loading") return;
+ this.#argumentCatalogs.set(command, { kind: "loading", visible: true });
+ this.#paint();
+ }, ARGUMENT_CATALOG_LOADING_DELAY_MS),
+ );
+ void this.#argumentSuggestions(command)
.catch(() => [])
.then((suggestions) => {
- this.#argumentCatalogs.set(query.command, { kind: "ready", suggestions });
+ const timer = this.#argumentCatalogLoadingTimers.get(command);
+ if (timer !== undefined) clearTimeout(timer);
+ this.#argumentCatalogLoadingTimers.delete(command);
+ this.#argumentCatalogs.set(command, { kind: "ready", suggestions });
if (this.#inputActive) this.#syncTypeahead(this.#inputText);
this.#paint();
});
@@ -710,7 +733,7 @@ export class TerminalRenderer implements AgentTUIRenderer {
#typeaheadDrawerRows(width: number): string[] {
const query = argumentTypeaheadQuery(this.#inputText);
const catalog = query === undefined ? undefined : this.#argumentCatalogs.get(query.command);
- if (catalog?.kind === "loading" && query !== undefined) {
+ if (catalog?.kind === "loading" && catalog.visible && query !== undefined) {
return [
clip(
this.#theme.colors.dim(`Loading ${argumentTypeaheadLoadingLabel(query.command)}…`),
@@ -1006,7 +1029,7 @@ export class TerminalRenderer implements AgentTUIRenderer {
argumentOpen === undefined &&
selected !== undefined &&
this.#argumentSuggestions !== undefined &&
- (selected.name === "add" || selected.name === "model")
+ (selected.name === "add" || selected.name === "login" || selected.name === "model")
) {
apply(lineOf(typeaheadCompletion(selected)));
break;
@@ -2076,6 +2099,7 @@ export class TerminalRenderer implements AgentTUIRenderer {
const flow = this.#beginSetupQuestion(opts.message);
const multiple = isMultiSelectRequest(opts);
const searchAction = opts.kind === "search" ? opts.searchAction : undefined;
+ const searchableField = opts.kind === "search" && opts.layout === undefined;
let selectOptions: readonly SetupPanelOption[] = opts.options;
const plannerNavigation = opts.navigation?.kind === "planner";
@@ -2162,83 +2186,89 @@ export class TerminalRenderer implements AgentTUIRenderer {
if (notices !== undefined && notices.length > 0) state.notices = notices;
if (error !== undefined) state.error = error;
if (loading) state.loadingFrame = this.#spinnerFrame();
+ if (searchableField) state.caretVisible = this.#caretVisible;
return state;
};
flow.question = (width) => renderSelectQuestion(panelState(), this.#theme, width);
+ if (searchableField) this.#startCaretBlink();
this.#paint();
- const question = this.#captureSetupQuestion<SetupSelectResult>((key, settle) => {
- const close = (value: SetupSelectResult): void => {
- searchVersion += 1;
- settle(value);
- };
- if (loading) {
- if (key.type === "ctrl-c") close(undefined);
- else if (key.type === "escape") clearSearch();
- else if (key.type === "ctrl-r") this.#paint();
- return;
- }
-
- const plannerStep = opts.navigation?.kind === "planner" ? opts.navigation : undefined;
- const plannerDirection =
- key.type === "left" &&
- (plannerStep?.activeStep ?? 0) > (plannerStep?.firstNavigableStep ?? 0)
- ? "back"
- : key.type === "right" &&
- plannerStep !== undefined &&
- plannerStep.activeStep >= (plannerStep.firstNavigableStep ?? 0) &&
- plannerStep.activeStep < plannerStep.steps.length - 1
- ? "forward"
- : undefined;
- if (plannerDirection !== undefined) {
- close({
- kind: "navigate",
- direction: plannerDirection,
- values: multiple ? orderedSelection(selectOptions, select.selected) : [],
- });
- return;
- }
-
- const base = { key, options: selectOptions, searchAction, select };
- const result = multiple
- ? reduceSetupSelectInput({
- ...base,
- kind: opts.kind,
- required: opts.required,
- plannerNavigation: plannerNavigation || undefined,
- })
- : reduceSetupSelectInput({ ...base, kind: opts.kind });
- switch (result.kind) {
- case "cancel":
- close(undefined);
- return;
- case "repaint":
- this.#paint();
+ const question = this.#captureSetupQuestion<SetupSelectResult>(
+ (key, settle) => {
+ const close = (value: SetupSelectResult): void => {
+ searchVersion += 1;
+ settle(value);
+ };
+ if (loading) {
+ if (key.type === "ctrl-c") close(undefined);
+ else if (key.type === "escape") clearSearch();
+ else if (key.type === "ctrl-r") this.#paint();
return;
- case "update":
- select = result.select;
- error = undefined;
- this.#paint();
+ }
+
+ const plannerStep = opts.navigation?.kind === "planner" ? opts.navigation : undefined;
+ const plannerDirection =
+ key.type === "left" &&
+ (plannerStep?.activeStep ?? 0) > (plannerStep?.firstNavigableStep ?? 0)
+ ? "back"
+ : key.type === "right" &&
+ plannerStep !== undefined &&
+ plannerStep.activeStep >= (plannerStep.firstNavigableStep ?? 0) &&
+ plannerStep.activeStep < plannerStep.steps.length - 1
+ ? "forward"
+ : undefined;
+ if (plannerDirection !== undefined) {
+ close({
+ kind: "navigate",
+ direction: plannerDirection,
+ values: multiple ? orderedSelection(selectOptions, select.selected) : [],
+ });
return;
- case "submit": {
- const query = searchActionQuery(result.values[0] ?? "");
- const load = searchAction?.load;
- if (query === undefined || load === undefined) {
- close(result.values);
+ }
+
+ const base = { key, options: selectOptions, searchAction, select };
+ const result = multiple
+ ? reduceSetupSelectInput({
+ ...base,
+ kind: opts.kind,
+ required: opts.required,
+ plannerNavigation: plannerNavigation || undefined,
+ })
+ : reduceSetupSelectInput({ ...base, kind: opts.kind });
+ switch (result.kind) {
+ case "cancel":
+ close(undefined);
return;
- }
+ case "repaint":
+ this.#paint();
+ return;
+ case "update":
+ select = result.select;
+ error = undefined;
+ if (searchableField) this.#showCaret();
+ this.#paint();
+ return;
+ case "submit": {
+ const query = searchActionQuery(result.values[0] ?? "");
+ const load = searchAction?.load;
+ if (query === undefined || load === undefined) {
+ close(result.values);
+ return;
+ }
- void loadSearch(query, load);
- return;
+ void loadSearch(query, load);
+ return;
+ }
+ case "error":
+ error = result.message;
+ this.#paint();
+ return;
+ case "ignore":
+ return;
}
- case "error":
- error = result.message;
- this.#paint();
- return;
- case "ignore":
- return;
- }
- });
+ },
+ searchableField ? () => this.#stopCaretBlink() : undefined,
+ );
return await question.promise;
}
@@ -2990,6 +3020,8 @@ export class TerminalRenderer implements AgentTUIRenderer {
shutdown(): void {
this.#stop();
+ for (const timer of this.#argumentCatalogLoadingTimers.values()) clearTimeout(timer);
+ this.#argumentCatalogLoadingTimers.clear();
// The parting line: the boot banner's dim counterpart, written after the
// terminal is restored so it lands as the session's last scrollback row.
// Gated on the session having ever gone live (Ctrl-C stops the terminal
@@ -4351,7 +4383,7 @@ export class TerminalRenderer implements AgentTUIRenderer {
} else {
content = { kind: "idle", indicator };
}
- const state: Parameters<typeof renderFlowPanel>[0] = {
+ const state: Parameters<typeof renderFlowDrawer>[0] = {
title: flow.title,
navigation: flow.navigation,
lines:
@@ -4368,7 +4400,12 @@ export class TerminalRenderer implements AgentTUIRenderer {
],
content,
};
- rows.push(...renderFlowPanel(state, this.#theme, width));
+ const drawer = renderFlowDrawer(state, this.#theme, width);
+ // Setup owns the footer while open. Do not lead it with the ordinary
+ // transcript spacer: the drawer begins directly below the command echo.
+ if (rows.length === 1 && rows[0] === "") rows.length = 0;
+ rows.push(...drawer.rows);
+ if (drawer.controls.length > 0) rows.push(...drawer.controls);
this.#pushRemoteStatusLine(rows, width);
return rows;
}
diff --git a/packages/eve/src/cli/dev/tui/tui.ts b/packages/eve/src/cli/dev/tui/tui.ts
index 031943f41..85d28c354 100644
--- a/packages/eve/src/cli/dev/tui/tui.ts
+++ b/packages/eve/src/cli/dev/tui/tui.ts
@@ -52,7 +52,18 @@ export interface RunDevelopmentTuiInput extends TuiDisplayOptions {
}
function inlineArgumentSuggestions(appRoot: string) {
- return async (command: "model" | "add"): Promise<readonly PromptArgumentSuggestion[]> => {
+ return async (
+ command: "model" | "add" | "login",
+ ): Promise<readonly PromptArgumentSuggestion[]> => {
+ if (command === "login") {
+ return [
+ { value: "vercel", label: "Vercel account" },
+ { value: "chatgpt", label: "ChatGPT account" },
+ { value: "vercel-api-key", label: "API key (Vercel AI Gateway)" },
+ { value: "openai-api-key", label: "API key (OpenAI)" },
+ { value: "anthropic-api-key", label: "API key (Anthropic)" },
+ ];
+ }
if (command === "model") {
const { gatewayModelCapabilities } = await import("#setup/boxes/model-capabilities.js");
const { fetchGatewayCatalog, modelOptionsFromCatalog } =
diff --git a/packages/eve/src/setup/cli/option-row.test.ts b/packages/eve/src/setup/cli/option-row.test.ts
index 8b2b03adc..b0c177cd0 100644
--- a/packages/eve/src/setup/cli/option-row.test.ts
+++ b/packages/eve/src/setup/cli/option-row.test.ts
@@ -11,6 +11,7 @@ import {
const colors: RowColors = {
blue: (text) => `<blue>${text}</blue>`,
+ bold: (text) => `<bold>${text}</bold>`,
dim: (text) => `<dim>${text}</dim>`,
green: (text) => `<green>${text}</green>`,
inverse: (text) => `<inverse>${text}</inverse>`,
@@ -46,7 +47,7 @@ describe("renderOptionRow", () => {
test("highlights the cursor row in inverse blue and keeps its hint outside", () => {
expect(row({ label: "Yes", hint: "Create a project", isCursor: true })).toBe(
- " › Yes<dim> · Create a project</dim>",
+ "<bold> › Yes</bold><dim> · Create a project</dim>",
);
});
@@ -62,6 +63,43 @@ describe("renderOptionRow", () => {
expect(row({ label: "No" })).toBe(" No");
});
+ test("the minimal presentation uses weight instead of a cursor glyph", () => {
+ expect(row({ label: "Vercel", isCursor: true, presentation: "minimal" })).toBe(
+ " <bold>Vercel</bold>",
+ );
+ expect(row({ label: "Codex", presentation: "minimal" })).toBe(" <dim>Codex</dim>");
+ });
+
+ test("the minimal presentation retains semantic checks without shifting labels", () => {
+ const visible = (text: string) => text.replaceAll(/<[^>]+>/g, "");
+ const unchecked = visible(row({ label: "Vercel", presentation: "minimal" }));
+ const checked = visible(
+ row({
+ label: "Vercel",
+ presentation: "minimal",
+ state: { kind: "available", checked: true },
+ }),
+ );
+
+ expect(unchecked).toBe(" Vercel");
+ expect(checked).toBe(" ✓ Vercel");
+ expect(checked.indexOf("Vercel")).toBe(unchecked.indexOf("Vercel"));
+ });
+
+ test("the minimal presentation retains an inert cursor on completed and disabled rows", () => {
+ expect(
+ row({ label: "Done", isCursor: true, presentation: "minimal", state: { kind: "completed" } }),
+ ).toBe(" <dim>›</dim> <dim>Done</dim>");
+ expect(
+ row({
+ label: "Unavailable",
+ isCursor: true,
+ presentation: "minimal",
+ state: { kind: "disabled" },
+ }),
+ ).toBe(" <dim>›</dim> <dim>Unavailable</dim>");
+ });
+
test("a warning accent stays yellow under the cursor highlight", () => {
expect(row({ label: "Configure provider", accent: "warning" })).toBe(
" <yellow>Configure provider</yellow>",
@@ -89,7 +127,7 @@ describe("renderOptionRow", () => {
isCursor: true,
state: { kind: "available", checked: true },
}),
- ).toBe(" ✓ Web Chat");
+ ).toBe("<bold> ✓ Web Chat</bold>");
});
test("a completed row under the cursor reads as inert: a dim pointer and dim label", () => {
@@ -171,7 +209,7 @@ describe("renderOptionRow", () => {
expect(row({ label: "Slack", hint: "persistent" })).toBe(" Slack<dim> · persistent</dim>");
expect(row({ label: "Slack", focusHint: "only on hover" })).toBe(" Slack");
expect(row({ label: "Slack", isCursor: true, focusHint: "only on hover" })).toBe(
- " › Slack<dim> · only on hover</dim>",
+ "<bold> › Slack</bold><dim> · only on hover</dim>",
);
});
diff --git a/packages/eve/src/setup/cli/option-row.ts b/packages/eve/src/setup/cli/option-row.ts
index 094696ef8..ef825b83f 100644
--- a/packages/eve/src/setup/cli/option-row.ts
+++ b/packages/eve/src/setup/cli/option-row.ts
@@ -14,7 +14,7 @@
/** The color primitives the row painter needs; satisfied by both the TUI theme and the CLI palette. */
export interface RowColors {
blue(text: string): string;
- bold?(text: string): string;
+ bold(text: string): string;
dim(text: string): string;
green(text: string): string;
inverse(text: string): string;
@@ -65,6 +65,8 @@ interface OptionRowInput {
state: OptionRowState;
/** Whether an un-hovered, selectable row draws the placeholder glyph. */
placeholder: boolean;
+ /** TUI lists use type weight rather than a caret to show focus. */
+ presentation?: "cursor" | "minimal";
/** Spaces inserted before the hint's dot so hints tab-align to a shared column. */
hintPadding?: number;
/**
@@ -186,7 +188,7 @@ export function renderCursorRow(
accent?: "warning",
): string {
if (!selected) return ` ${text}`;
- const color = accent === "warning" ? colors.yellow : (colors.bold ?? ((value: string) => value));
+ const color = accent === "warning" ? colors.yellow : colors.bold;
return color(` ${text}`);
}
@@ -214,6 +216,19 @@ export function renderOptionRow(input: OptionRowInput): string {
const separatorWidth = Math.max(0, (input.hintPadding ?? 0) + 1);
hint = c.dim(`${" ".repeat(separatorWidth)}${glyphs.dot} ${hintText}`);
}
+ if (input.presentation === "minimal") {
+ const styledLabel =
+ input.state.kind === "available" ? (selected ? c.bold(label) : c.dim(label)) : label;
+ // Minimal rows reserve the cursor/check cell even when it is blank. This
+ // keeps labels and their tab-aligned hints fixed when a checklist toggles,
+ // while completed or disabled rows retain a dim cursor when focused.
+ const marker =
+ (input.state.kind === "available" && !input.state.checked) ||
+ (input.state.kind === "disabled" && !input.isCursor)
+ ? " "
+ : glyph;
+ return ` ${marker} ${styledLabel}${hint}`;
+ }
const content = `${glyph} ${label}`;
const row = renderCursorRow(content, selected, c, input.accent);
return `${row}${hint}`;
diff --git a/packages/eve/src/setup/flows/model-login.ts b/packages/eve/src/setup/flows/model-login.ts
index 583d78984..b0df2f71c 100644
--- a/packages/eve/src/setup/flows/model-login.ts
+++ b/packages/eve/src/setup/flows/model-login.ts
@@ -82,6 +82,10 @@ type LoginInput = {
agentRoot?: string;
prompter: Prompter;
automatic?: boolean;
+ /** Connection selected by the TUI's `/login <connection>` completion. */
+ selected?: ModelConnectionSelection;
+ /** TUI callers can omit the redundant picker heading beneath `/login`. */
+ connectionMessage?: string;
signal?: AbortSignal;
/** Applies writes under one watcher lease and waits for runtime activation. */
withConnectionUpdate?(task: () => Promise<void>): Promise<void>;
@@ -289,12 +293,16 @@ export async function runModelLogin(input: LoginInput): Promise<ModelLoginResult
);
}
}
+ let selectedFromCommand = input.selected;
while (true) {
- const selected = await prompter.select({
- message: "Choose a connection",
- search: true,
- options: [...CONNECTION_OPTIONS],
- });
+ const selected =
+ selectedFromCommand ??
+ (await prompter.select({
+ message: input.connectionMessage ?? "Choose a connection",
+ search: true,
+ options: [...CONNECTION_OPTIONS],
+ }));
+ selectedFromCommand = undefined;
if (!isModelConnection(selected)) throw new Error("Choose a model connection.");
try {
const result = await connect(selected, false);
diff --git a/packages/eve/test/tui-client/tui-packed-install-model.ts b/packages/eve/test/tui-client/tui-packed-install-model.ts
index 7edb9227a..92c923f1c 100644
--- a/packages/eve/test/tui-client/tui-packed-install-model.ts
+++ b/packages/eve/test/tui-client/tui-packed-install-model.ts
@@ -156,7 +156,7 @@ void (async () => {
// the first prompt only when its module graph loads — the exact surface
// the oxc-parser regression crashed.
- await screen.waitForText("Choose a connection", 15_000);
+ await screen.waitForText("Vercel Account", 15_000);
await screen.waitForText("Anthropic API Key", 5_000);
console.log(theme.muted("[tui-packed-install] /login opened connection setup"));