The Open Framework for Building Agents
feat(eve): quiet, status-marked outcomes for TUI setup commands (#3709)
OwenKephartfaab7139a8a9
diff --git a/.changeset/quiet-add-outcomes.md b/.changeset/quiet-add-outcomes.mdnew file mode 100644index 000000000..2c56d2bf7--- /dev/null+++ b/.changeset/quiet-add-outcomes.md@@ -0,0 +1,5 @@+---+"eve": patch+---++`eve dev` now uses a single `*` marker for completed slash commands and excludes picker and drawer commands, including `/loglevel`, from input history. Setup failures keep their invocation visible, and failed registry installs no longer expose installer output in TUI diagnostics.diff --git a/.changeset/tui-setup-rendering-cleanup.md b/.changeset/tui-setup-rendering-cleanup.mdnew file mode 100644index 000000000..adf4f0000--- /dev/null+++ b/.changeset/tui-setup-rendering-cleanup.md@@ -0,0 +1,5 @@+---+"eve": patch+---++Keep setup drawer status content inside its temporary surface, and use the same model-login connection catalog for TUI completion and command handling.diff --git a/docs/guides/dev-tui.md b/docs/guides/dev-tui.mdindex 52ac3c142..459afc15b 100644--- a/docs/guides/dev-tui.md+++ b/docs/guides/dev-tui.md@@ -86,7 +86,7 @@ Pass an item address to install it directly:/add @acme/analytics```-Required authorization or deployment setup still runs for the selected item. Press `Esc` to cancel setup; files already installed remain in the project.+Required authorization or deployment setup still runs for the selected item. Press `Esc` to cancel setup; files already installed remain in the project. If dependency installation fails, retry the `eve add` command in a terminal for details; raw installer output is not captured in the TUI.## Work with the agentdiff --git a/packages/eve/src/cli/commands/registry-declared-setups.ts b/packages/eve/src/cli/commands/registry-declared-setups.tsindex c9781f0ec..725714f26 100644--- a/packages/eve/src/cli/commands/registry-declared-setups.ts+++ b/packages/eve/src/cli/commands/registry-declared-setups.ts@@ -1,5 +1,6 @@import { createHeadlessPrompter } from "#setup/headless.js";import { createPrompter, type Prompter } from "#setup/prompter.js";+import { WizardCancelledError } from "#setup/step.js";import { mergeRegistrySetupCompletions } from "#setup/registry-setup-completion.js";import type { RegistrySetupCompletion } from "#setup/registry-setup-protocol.js";@@ -25,7 +26,6 @@ export async function runDeclaredSetups(input: {setups: readonly RegistrySetupCommand[] | undefined;options: DeclaredSetupOptions;dependencies: RegistrySetupDependencies;- cancelledReminder: string;resumeCommand: string;}): Promise<RegistrySetupCompletion | false> {let completion: RegistrySetupCompletion = { facts: [] };@@ -60,10 +60,7 @@ export async function runDeclaredSetups(input: {input.item,{ prompter, signal: input.options.signal },);- if (result.kind === "cancelled") {- input.logger.log(input.cancelledReminder);- return false;- }+ if (result.kind === "cancelled") return false;if (result.kind === "blocked") {if (!input.options.nonInteractive) throw new Error("Setup requires more input.");input.logger.error(@@ -92,6 +89,7 @@ export async function runDeclaredSetups(input: {}return completion;} catch (error) {+ if (error instanceof WizardCancelledError) return false;const message = error instanceof Error ? error.message : String(error);if (input.options.nonInteractive) {input.logger.error(diff --git a/packages/eve/src/cli/commands/registry.test.ts b/packages/eve/src/cli/commands/registry.test.tsindex d9abde1d3..304fdd2e4 100644--- a/packages/eve/src/cli/commands/registry.test.ts+++ b/packages/eve/src/cli/commands/registry.test.ts@@ -304,6 +304,50 @@ describe("registry commands", () => {]);});+ it("does not expose installer credentials in dependency failures", async () => {+ const logger = createLogger();+ getRegistryItems.mockResolvedValue([+ { name: "channel/photon-imessage", type: "registry:item" },+ ]);+ addRegistryItems.mockRejectedValueOnce(+ Object.assign(+ new Error(+ "Command failed: pnpm add https://[email protected]\nERR_PNPM_FETCH_404 token=secret",+ ),+ {+ exitCode: 1,+ stderr: "ERR_PNPM_FETCH_404 token=secret",+ },+ ),+ );++ await runAddCommand(logger, "/project", "channel/photon-imessage", {+ silent: true,+ });++ expect(logger.errors).toEqual([+ "Dependency installation failed. Retry the eve add command in a terminal for details.",+ ]);+ expect(logger.errors.join("\n")).not.toContain("secret");+ expect(logger.errors.join("\n")).not.toContain("example.com");+ });++ it("does not echo arbitrary installer output", async () => {+ const logger = createLogger();+ getRegistryItems.mockResolvedValue([+ { name: "channel/photon-imessage", type: "registry:item" },+ ]);+ addRegistryItems.mockRejectedValueOnce(new Error("arbitrary secret stderr"));++ await runAddCommand(logger, "/project", "channel/photon-imessage", {+ silent: true,+ });++ expect(logger.errors).toEqual([+ "Dependency installation failed. Retry the eve add command in a terminal for details.",+ ]);+ });+it("reports only paths that rollback could not restore", async () => {const logger = createLogger();getRegistryItems.mockResolvedValue([{ name: "extension/browser", type: "registry:item" }]);@@ -811,6 +855,53 @@ describe("registry commands", () => {expect(process.exitCode).toBeUndefined();});+ it("treats a cancellation thrown by the setup CLI like a returned one", async () => {+ const logger = createLogger();+ const runSetup = vi.fn(async () => {+ throw new WizardCancelledError();+ });+ getRegistryItems.mockResolvedValue([+ {+ meta: { eve: { setup: [{ package: "@acme/slack", bin: "eve-slack", args: ["setup"] }] } },+ },+ ]);++ await runAddCommand(+ logger,+ "/project",+ "channel/slack",+ { yes: true },+ { loadSetupCommandRunner: async () => runSetup },+ );++ expect(logger.logs).toEqual([+ "Setup cancelled. Run `eve add channel/slack --skip-install` when you're ready.",+ ]);+ expect(logger.errors).toEqual([]);+ });++ it("returns unfinished setup to the TUI as a structured resume command", async () => {+ const fake = createFakePrompter();+ const runSetup = vi.fn(async () => ({ kind: "cancelled" as const }));+ getRegistryItems.mockResolvedValue([+ {+ meta: { eve: { setup: [{ package: "@acme/slack", bin: "eve-slack", args: ["setup"] }] } },+ },+ ]);++ await expect(+ installRegistryItem(+ "/project",+ "channel/slack",+ { prompter: fake.prompter, silent: true },+ { loadSetupCommandRunner: async () => runSetup },+ ),+ ).resolves.toEqual({+ output: [],+ setupIncomplete: { resumeCommand: "eve add channel/slack --skip-install" },+ });+ });+it("runs setup directly without installing the item", async () => {const logger = createLogger();const runSetup = vi.fn(async () => ({ kind: "completed" as const, facts: [] }));diff --git a/packages/eve/src/cli/commands/registry.ts b/packages/eve/src/cli/commands/registry.tsindex f68d41337..f764e3d12 100644--- a/packages/eve/src/cli/commands/registry.ts+++ b/packages/eve/src/cli/commands/registry.ts@@ -430,7 +430,12 @@ export async function installRegistryItem(item: string,options: AddCommandOptions & { prompter?: Prompter; signal?: AbortSignal } = {},dependencies: AddCommandDependencies = defaultAddCommandDependencies,-): Promise<{ output: readonly string[]; setup?: RegistrySetupCompletion }> {+): Promise<{+ output: readonly string[];+ setup?: RegistrySetupCompletion;+ /** Files were added, but setup was cancelled or skipped. */+ setupIncomplete?: { resumeCommand: string };+}> {let failure: string | undefined;const output: string[] = [];const logger: RegistryCommandLogger = {@@ -454,6 +459,9 @@ export async function installRegistryItem(process.exitCode = previousExitCode;if (failure !== undefined) throw new Error(failure);if (setup === false) throw new WizardCancelledError();+ if (setup === "setup-incomplete") {+ return { output, setupIncomplete: { resumeCommand: setupResumeCommand(item) } };+ }const result: { output: readonly string[]; setup?: RegistrySetupCompletion } = { output };if (setup !== undefined) result.setup = setup;return result;@@ -466,7 +474,12 @@ export async function runAddCommand(item: string,options: RunAddCommandOptions,dependencies: AddCommandDependencies = defaultAddCommandDependencies,-): Promise<RegistrySetupCompletion | false | undefined> {+): Promise<RegistrySetupCompletion | false | "setup-incomplete" | undefined> {+ // Silent callers render the resume hint themselves from the structured result.+ const setupIncomplete = (outcome: "cancelled" | "skipped") => {+ if (options.silent !== true) logger.log(setupReminder(item, outcome));+ return "setup-incomplete" as const;+ };return runRegistryAction(logger, appRoot, async () => {const address = itemAddress(item);const projectRoot =@@ -508,9 +521,9 @@ export async function runAddCommand(setups: eveMetadata.setup,options,dependencies,- cancelledReminder: setupReminder(item, "cancelled"),resumeCommand: setupResumeCommand(item),});+ if (completion === false && !options.nonInteractive) return setupIncomplete("cancelled");return reportCompletion(logger, item, completion, options);}@@ -557,8 +570,7 @@ export async function runAddCommand(}if (options.skipSetup === true) {if (options.nonInteractive) return reportCompletion(logger, item, { facts: [] }, options);- logger.log(setupReminder(item, "skipped"));- return;+ return setupIncomplete("skipped");}if (!options.nonInteractive &&@@ -566,8 +578,7 @@ export async function runAddCommand(!interactive &&options.setupAuthorized !== true) {- logger.log(setupReminder(item, "skipped"));- return;+ return setupIncomplete("skipped");}if (!options.nonInteractive && !options.yes && options.setupAuthorized !== true) {@@ -584,14 +595,10 @@ export async function runAddCommand({ value: "no", label: "No" },],});- if (shouldRun === "no") {- logger.log(setupReminder(item, "skipped"));- return;- }+ if (shouldRun === "no") return setupIncomplete("skipped");} catch (error) {if (!(error instanceof WizardCancelledError)) throw error;- logger.log(setupReminder(item, "cancelled"));- return;+ return setupIncomplete("cancelled");}}@@ -602,9 +609,9 @@ export async function runAddCommand(setups: eveMetadata.setup,options: { ...options, force: options.overwrite },dependencies,- cancelledReminder: setupReminder(item, "cancelled"),resumeCommand: setupResumeCommand(item),});+ if (completion === false && !options.nonInteractive) return setupIncomplete("cancelled");return reportCompletion(logger, item, completion, options);});}diff --git a/packages/eve/src/cli/dev/tui/argument-typeahead.ts b/packages/eve/src/cli/dev/tui/argument-typeahead.tsindex 586177104..92ae67b51 100644--- a/packages/eve/src/cli/dev/tui/argument-typeahead.ts+++ b/packages/eve/src/cli/dev/tui/argument-typeahead.ts@@ -1,6 +1,7 @@import { sanitizeForTerminal } from "#cli/ui/output.js";import { sliceVisible, visibleLength } from "#cli/ui/terminal-text.js";+import { PROMPT_COMMANDS, type ArgumentTypeaheadCommand } from "./prompt-commands.js";import type { Theme } from "./theme.js";export interface PromptArgumentSuggestion {@@ -11,8 +12,6 @@ export interface PromptArgumentSuggestion {readonly next?: readonly PromptArgumentSuggestion[];}-export type ArgumentTypeaheadCommand = "model" | "add" | "login";-export interface ArgumentTypeaheadQuery {readonly command: ArgumentTypeaheadCommand;readonly argument: string;@@ -27,16 +26,20 @@ export interface ArgumentTypeaheadState extends ArgumentTypeaheadQuery {readonly selectedIndex: number;}-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" || command === "login";+function typeaheadCommand(command: string):+ | {+ readonly name: ArgumentTypeaheadCommand;+ readonly maxArguments: number;+ readonly loadingLabel: string;+ }+ | undefined {+ const spec = PROMPT_COMMANDS.find((candidate) => candidate.name === command);+ if (spec?.typeahead === undefined) return undefined;+ return { name: spec.name as ArgumentTypeaheadCommand, ...spec.typeahead };}export function argumentTypeaheadLoadingLabel(command: ArgumentTypeaheadCommand): string {- if (command === "model") return "models";- if (command === "add") return "registry";- return "connections";+ return typeaheadCommand(command)?.loadingLabel ?? "suggestions";}/**@@ -47,8 +50,8 @@ export function argumentTypeaheadQuery(text: string): ArgumentTypeaheadQuery | uif (!text.startsWith("/")) return undefined;const commandEnd = text.indexOf(" ");if (commandEnd < 0) return undefined;- const command = text.slice(1, commandEnd);- if (!isArgumentTypeaheadCommand(command)) return undefined;+ const typeahead = typeaheadCommand(text.slice(1, commandEnd));+ if (typeahead === undefined) return undefined;const tokens: { value: string; start: number }[] = [];let cursor = commandEnd;@@ -60,14 +63,14 @@ export function argumentTypeaheadQuery(text: string): ArgumentTypeaheadQuery | utokens.push({ value: text.slice(start, cursor), start });}const argumentCount = tokens.length + (text.endsWith(" ") ? 1 : 0);- if (text.slice(commandEnd).includes("\n") || argumentCount > ARGUMENT_LIMIT[command]) {+ if (text.slice(commandEnd).includes("\n") || argumentCount > typeahead.maxArguments) {return undefined;}const active = tokens.at(-1);const completed = tokens.map((token) => token.value);if (!text.endsWith(" ") && active !== undefined) completed.pop();return {- command,+ command: typeahead.name,argument: text.endsWith(" ") ? "" : (active?.value ?? ""),completed,argumentStart: text.endsWith(" ") ? text.length : (active?.start ?? text.length),diff --git a/packages/eve/src/cli/dev/tui/blocks.test.ts b/packages/eve/src/cli/dev/tui/blocks.test.tsindex 30db0e213..a1b4e9ac8 100644--- a/packages/eve/src/cli/dev/tui/blocks.test.ts+++ b/packages/eve/src/cli/dev/tui/blocks.test.ts@@ -17,6 +17,14 @@ describe("renderBlockLines", () => {expect(render({ kind: "user", body: "hello there" })).toEqual(["│ hello there"]);});+ it("keeps a transient command invocation visible without a progress glyph", () => {+ const block = { kind: "command", body: "/help", live: true } as const;+ expect(renderBlockLines(block, 60, theme, { ...ctx, transientPanelOpen: true })).toEqual([+ "│ /help",+ ]);+ expect(renderBlockLines(block, 60, theme, ctx)).toEqual(["▪ /help"]);+ });+it("marks rendered assistant Markdown with the brand triangle", () => {const lines = render({ kind: "assistant", body: "all done" });expect(lines).toEqual(["▲ all done"]);@@ -59,7 +67,7 @@ describe("renderBlockLines", () => {expect(lines).toEqual(["▲ **bold**", " ", " - item"]);});- it("colors per-item status markers in a mixed command result", () => {+ it("keeps per-item status markers monochrome in a mixed command result", () => {const colored = createTheme({ color: true, unicode: true });const lines = renderBlockLines({@@ -71,9 +79,11 @@ describe("renderBlockLines", () => {ctx,);- expect(lines.join("\n")).toContain(colored.colors.green("✓"));- expect(lines[0]).toContain("2 additions: 1 added, 1 failed");- expect(lines.join("\n")).toContain(colored.colors.red("⨯"));+ const output = lines.join("\n");+ expect(output).toContain("2 additions: 1 added, 1 failed");+ expect(output).not.toContain(colored.colors.gray("✓"));+ expect(output).not.toContain(colored.colors.red("⨯"));+ expect(output).not.toContain(colored.colors.green("✓"));});it("uses ASCII status markers when Unicode is unavailable", () => {@@ -88,10 +98,9 @@ describe("renderBlockLines", () => {ctx,);- expect(lines.join("\n")).toContain("+ Web Chat");- expect(lines.join("\n")).toContain("x Slack");- expect(lines.join("\n")).toContain("- Notion");- expect(lines.join("\n")).not.toMatch(/[✓⨯–]/u);+ expect(lines.join("\n")).toContain("✓ Web Chat");+ expect(lines.join("\n")).toContain("⨯ Slack");+ expect(lines.join("\n")).toContain("– Notion");});it("summarizes a completed tool with a result line", () => {@@ -299,7 +308,15 @@ describe("renderBlockLines", () => {colorTheme,{ activityPulse: "▪" },);- expect(rows).toEqual(["\x1b[33m│\x1b[39m go"]);+ expect(rows).toEqual(["\x1b[33m│\x1b[39m \x1b[1mgo\x1b[22m"]);+ });++ it("bolds a sent user message behind an uncolored gutter", () => {+ const colorTheme = createTheme({ color: true, unicode: true });+ const rows = renderBlockLines({ kind: "user", body: "hello" }, 80, colorTheme, {+ activityPulse: "▪",+ });+ expect(rows).toEqual(["│ \x1b[1mhello\x1b[22m"]);});it("pulses the in-progress subagent mark by intensity, with a quiet label", () => {diff --git a/packages/eve/src/cli/dev/tui/blocks.ts b/packages/eve/src/cli/dev/tui/blocks.tsindex a9977f6d6..5f658211c 100644--- a/packages/eve/src/cli/dev/tui/blocks.ts+++ b/packages/eve/src/cli/dev/tui/blocks.ts@@ -84,7 +84,7 @@ export interface Block {/** Structured remediation shown between an error's body and its detail. */hint?: string;- /** Tool, connection, or synthetic command lifecycle status. */+ /** Tool, connection, or completed command lifecycle status. */status?: ToolStatus;/** When true, treat `body` as pre-styled and only wrap + indent it. */preformatted?: boolean;@@ -148,6 +148,10 @@ export interface ToolGroupItem {export interface RenderBlockContext {/** Current shared square-pulse frame for live activity blocks. */activityPulse: string;+ /** An open setup panel owns the pulse, so a running command's gutter holds still. */+ setupFlowOpen?: boolean;+ /** A transient panel keeps its command echo live without a progress glyph. */+ transientPanelOpen?: boolean;/** Whether prose responses are parsed and styled as Markdown. */renderMarkdown?: boolean;/**@@ -233,7 +237,7 @@ function renderBody(case "flow":return renderFlow(block, width, theme);case "command":- return renderCommand(block, theme);+ return renderCommand(block, theme, context);case "question":case "connection-auth":return renderPreformatted(block, width, theme);@@ -263,11 +267,9 @@ function renderBody(function renderUser(block: Block, width: number, theme: Theme): string[] {const bar =- block.promptOrigin === "steer"- ? theme.colors.yellow(theme.glyph.user)- : theme.colors.cyan(theme.glyph.user);+ block.promptOrigin === "steer" ? theme.colors.yellow(theme.glyph.user) : theme.glyph.user;const lines = wrap(block.body ?? "", width - 2);- return lines.map((line) => `${bar} ${line}`);+ return lines.map((line) => `${bar} ${theme.colors.bold(line)}`);}function renderProse(@@ -432,44 +434,32 @@ function paintCommands(line: string, theme: Theme): string {}/**- * A slash command invocation under the user gutter. Automatic commands use- * the same row so their result can follow it. The `❯` glyph remains- * exclusive to live input because the TUI tests use `❯` to detect a ready prompt.+ * A slash command invocation. While it runs, its gutter pulses — or holds a+ * still `▪` beside an open setup panel, which pulses itself. It then carries+ * a settled `*`. A settled summary replaces the invocation, dimmed as a+ * record. The `❯` glyph remains exclusive to live input because the TUI tests+ * use `❯` to detect a ready prompt.*/-function renderCommand(block: Block, theme: Theme): string[] {+function renderCommand(block: Block, theme: Theme, context: RenderBlockContext): string[] {const c = theme.colors;- const status = block.status === "error" ? `${c.red(theme.glyph.error)} ` : "";- return [`${c.cyan(theme.glyph.user)} ${status}${c.bold(block.body ?? "")}`];-}--/**- * One persistent setup-flow line: progress the user must keep (the Slack- * Connect URL, a written env file). The tone travels in `title`; info dims,- * the other tones keep the body at full intensity behind their glyph.- */-function paintOutcomeMarker(line: string, theme: Theme, source = line): string {- const marker = source.trimStart().slice(0, 1);- if (marker === "✓") return line.replace(marker, theme.colors.green(theme.glyph.success));- if (marker === "⨯") return line.replace(marker, theme.colors.red(theme.glyph.error));- if (marker === "–") return line.replace(marker, theme.colors.yellow(theme.glyph.dash));- return line;+ const gutter =+ block.live !== true+ ? block.status === "done"+ ? c.gray("*")+ : theme.glyph.user+ : context.transientPanelOpen === true+ ? theme.glyph.user+ : context.setupFlowOpen === true+ ? c.gray(theme.glyph.square)+ : c.gray(context.activityPulse);+ return [`${gutter} ${block.result === undefined ? (block.body ?? "") : c.dim(block.result)}`];}+/** One persistent setup-flow line retained after a panel closes. */function renderFlow(block: Block, width: number, theme: Theme): string[] {- const c = theme.colors;- const tone = block.title ?? "info";- const glyph =- tone === "success"- ? c.green(theme.glyph.success)- : tone === "warning"- ? c.yellow(theme.glyph.warning)- : tone === "error"- ? c.red(theme.glyph.error)- : c.dim(theme.glyph.dot);const lines = wrap(block.body ?? "", width - 2);- const paint = (line: string): string =>- tone === "info" ? c.dim(line) : paintOutcomeMarker(line, theme);- return lines.map((line, index) => `${index === 0 ? glyph : " "} ${paint(line)}`);+ const marker = theme.colors.dim("*");+ return lines.map((line, index) => `${index === 0 ? marker : " "} ${line}`);}/**@@ -479,28 +469,13 @@ function renderFlow(block: Block, width: number, theme: Theme): string[] {*/function renderResult(block: Block, width: number, theme: Theme): string[] {const lines = wrap(block.body ?? "", width - 7);- if (block.status === "done") {- const elbow = theme.colors.dim(theme.glyph.elbow);- const success = theme.colors.green(theme.glyph.success);- const rule = theme.colors.dim(theme.glyph.rule);- const corner = theme.colors.dim(theme.glyph.corner);- if (lines.length === 0) return [` ${elbow} ${success}`];- return lines.map((line, index) => {- if (index === 0) return ` ${elbow} ${success} ${line}`;- const marker = index === lines.length - 1 ? corner : rule;- return ` ${marker} ${line}`;- });- }-const marker = theme.colors.dim(theme.glyph.elbow);if (lines.length === 0) return [` ${marker}`];// SGR 22 closes bold and dim together, so a result that bolds a span (the// /model reply's model name) would drop the rest of the line out of dim;// re-open dim after each close so the whole line stays quiet.- const dim = (line: string): string => {- const body = theme.colors.dim(line.replaceAll("\x1b[22m", "\x1b[22m\x1b[2m"));- return paintOutcomeMarker(body, theme, line);- };+ const dim = (line: string): string =>+ theme.colors.dim(line.replaceAll("\x1b[22m", "\x1b[22m\x1b[2m"));return lines.map((line, index) =>index === 0 ? ` ${marker} ${dim(line)}` : ` ${dim(line)}`,);diff --git a/packages/eve/src/cli/dev/tui/command-typeahead.test.ts b/packages/eve/src/cli/dev/tui/command-typeahead.test.tsindex 2887f5936..69119fd0f 100644--- a/packages/eve/src/cli/dev/tui/command-typeahead.test.ts+++ b/packages/eve/src/cli/dev/tui/command-typeahead.test.ts@@ -22,6 +22,7 @@ function spec(name: string, options?: Partial<PromptCommandSpec>): PromptCommandaliases: [],description: `${name} command`,takesArgument: false,+ history: "keep",build: () => ({ type: "reset" }),...options,};diff --git a/packages/eve/src/cli/dev/tui/flow-drawer.ts b/packages/eve/src/cli/dev/tui/flow-drawer.tsnew file mode 100644index 000000000..dbd334b07--- /dev/null+++ b/packages/eve/src/cli/dev/tui/flow-drawer.ts@@ -0,0 +1,36 @@+import type { Theme } from "./theme.js";+import { renderFlowPanel, type FlowPanelState } from "./setup-panel.js";++/** Temporary setup content enclosed by a drawer and its navigation controls. */+export interface FlowDrawer {+ readonly rows: string[];+ readonly controls: string[];+}++/** Frames an active setup flow above the terminal footer. */+export function renderFlowDrawer(state: FlowPanelState, theme: Theme, width: number): FlowDrawer {+ const body = renderFlowPanel({ ...state, title: "" }, theme, width);+ const footerStart = state.content.kind === "question" ? body.lastIndexOf("") : -1;+ const controls =+ footerStart === -1 ? [] : body.slice(footerStart + 1).map((row) => row.trimStart());+ const drawerBody = footerStart === -1 ? body : body.slice(0, footerStart);+ return { rows: frameDrawer(drawerBody, theme, width), controls };+}++/** Frames a transient command panel with the same rules as a setup flow. */+export function renderTransientDrawer(+ body: readonly string[],+ controls: readonly string[],+ theme: Theme,+ width: number,+): FlowDrawer {+ return {+ rows: frameDrawer(body, theme, width),+ controls: controls.map((control) => ` ${theme.colors.dim(control)}`),+ };+}++function frameDrawer(body: readonly string[], theme: Theme, width: number): string[] {+ const divider = theme.colors.dim(theme.glyph.dash.repeat(Math.max(1, width)));+ return [divider, "", ...body, "", divider];+}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.tsindex e7f5891f4..ac363e291 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@@ -1,4 +1,3 @@-import pc from "picocolors";import { describe, expect, it, vi } from "vitest";import { createPromptCommandHandler } from "./prompt-command-handler.js";@@ -86,7 +85,8 @@ describe("createPromptCommandHandler", () => {context(),),).resolves.toEqual({- message: `Model changed to ${pc.bold("anthropic/claude-opus-4.6")}. Live on your next prompt.`,+ message: "",+ summary: "Model set to anthropic/claude-opus-4.6",});expect(applyModel).toHaveBeenCalledWith({appRoot: APP_ROOT,@@ -94,6 +94,21 @@ describe("createPromptCommandHandler", () => {});});+ it("marks an unchanged model as neutral", async () => {+ const handler = createPromptCommandHandler({+ target: LOCAL_TARGET,+ applyModel: async ({ slug }) => ({ kind: "unchanged", model: slug }),+ modelChangeRefusal: async () => null,+ });++ await expect(+ handler.handle({ type: "extension", name: "model", argument: "openai/gpt-5.5" }, context()),+ ).resolves.toEqual({+ message: "",+ summary: "Model already set to openai/gpt-5.5",+ });+ });+it("refuses an explicit model slug when the model is an external provider", async () => {const applyModel = vi.fn(async ({ slug }: { appRoot: string; slug: string }) =>@@ -109,6 +124,8 @@ describe("createPromptCommandHandler", () => {handler.handle({ type: "extension", name: "model", argument: "openai/gpt-5.4" }, context()),).resolves.toEqual({message: "Model is pinned to the external provider `anthropic`.",+ summary: "Couldn't change the model",+ failed: true,});expect(applyModel).not.toHaveBeenCalled();});@@ -257,7 +274,7 @@ describe("createPromptCommandHandler", () => {const settleOutcome = vi.fn(async () => {await pending;return fail- ? { tone: "error" as const, message: "The agent could not reload." }+ ? { failed: true as const, message: "The agent could not reload." }: { message: "Connected." };});const handler = createPromptCommandHandler({ target: LOCAL_TARGET });@@ -273,7 +290,7 @@ describe("createPromptCommandHandler", () => {expect(setupFlow.end).toHaveBeenCalledOnce();expect(outcome.effect).toBeUndefined();if (fail) {- expect(outcome.tone).toBe("error");+ expect(outcome.failed).toBe(true);expect(outcome.message).toContain("could not reload");expect(outcome.message).not.toContain("private runtime failure");} else {diff --git a/packages/eve/src/cli/dev/tui/prompt-command-handler.ts b/packages/eve/src/cli/dev/tui/prompt-command-handler.tsindex 34e447e7e..cf50be6a6 100644--- a/packages/eve/src/cli/dev/tui/prompt-command-handler.ts+++ b/packages/eve/src/cli/dev/tui/prompt-command-handler.ts@@ -1,6 +1,9 @@import type { ApplyModelOutcome } from "#setup/flows/model-source-change.js";+import {+ LOGIN_CONNECTION_COMMAND_HINT,+ loginConnectionForCommand,+} from "#setup/flows/model-login-options.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 {@@ -14,14 +17,6 @@ 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. */@@ -63,59 +58,53 @@ export function createPromptCommandHandler(};}const appRoot = target.agentRoot ?? target.workspaceRoot;+ const usage = modelFailure(+ "Use `/model provider/model [default|none|minimal|low|medium|high|xhigh]`.",+ );// Package-loading failures are command outcomes at this CLI boundary.try {const { modelChangeRefusalForUneditableModel } = await import("#setup/flows/model.js");- const {- changeAgentModel,- changeAgentModelSettings,- formatApplyModelOutcome,- formatApplyModelSettingsOutcome,- } = await import("#setup/flows/model-source-change.js");+ const { changeAgentModel, changeAgentModelSettings } =+ await import("#setup/flows/model-source-change.js");const [slug, reasoning, ...extra] = command.argument.split(/\s+/u);- if (slug === undefined || extra.length > 0) {- return {- message: "Use `/model provider/model [default|none|minimal|low|medium|high|xhigh]`.",- };- }+ if (slug === undefined || extra.length > 0) return usage;if (reasoning !== undefined &&!["default", "none", "minimal", "low", "medium", "high", "xhigh"].includes(reasoning)) {- return {- message: "Use `/model provider/model [default|none|minimal|low|medium|high|xhigh]`.",- };+ return usage;}// A source-backed model (an SDK model call) isn't a string literal eve// can rewrite; refuse with a clear reason rather than silently no-op.const checkRefusal = options.modelChangeRefusal ?? modelChangeRefusalForUneditableModel;const refusal = await checkRefusal(appRoot);- if (refusal !== null) {- return { message: refusal };- }+ if (refusal !== null) return modelFailure(refusal);+ const requested = reasoning === undefined ? slug : `${slug} ${reasoning}`;if (reasoning !== undefined) {- return {- message: formatApplyModelSettingsOutcome(- await changeAgentModelSettings({- appRoot,- patch: {- model: { kind: "set", value: slug },- reasoning:- reasoning === "default"- ? { kind: "remove" }- : { kind: "set", value: reasoning as AgentReasoningDefinition },- gatewayServiceTier: { kind: "keep" },- },- }),- ),- };+ const outcome = await changeAgentModelSettings({+ appRoot,+ patch: {+ model: { kind: "set", value: slug },+ reasoning:+ reasoning === "default"+ ? { kind: "remove" }+ : { kind: "set", value: reasoning as AgentReasoningDefinition },+ gatewayServiceTier: { kind: "keep" },+ },+ });+ if (outcome.kind === "rejected") return modelFailure(outcome.message);+ return outcome.kind === "unchanged"+ ? { message: "", summary: `Model already set to ${requested}` }+ : { message: "", summary: `Model set to ${requested}` };}const applyModel = options.applyModel ?? changeAgentModel;- return { message: formatApplyModelOutcome(await applyModel({ appRoot, slug })) };+ const outcome = await applyModel({ appRoot, slug });+ if (outcome.kind === "rejected") return modelFailure(outcome.message);+ return outcome.kind === "unchanged"+ ? { message: "", summary: `Model already set to ${outcome.model}` }+ : { message: "", summary: `Model set to ${outcome.to}` };} catch (error) {- return {- message: `Couldn't change the model: ${toErrorMessage(error)}`,- };+ return modelFailure(toErrorMessage(error));}}@@ -125,7 +114,7 @@ export function createPromptCommandHandler(const loginConnection =command.name === "login" && command.argument.length > 0- ? LOGIN_CONNECTIONS[command.argument]+ ? loginConnectionForCommand(command.argument): undefined;if (command.name === "login" &&@@ -133,7 +122,7 @@ export function createPromptCommandHandler(loginConnection === undefined) {return {- message: "Use `/login vercel|chatgpt|vercel-api-key|openai-api-key|anthropic-api-key`.",+ message: `Use \`/login ${LOGIN_CONNECTION_COMMAND_HINT}\`.`,};}@@ -148,9 +137,8 @@ export function createPromptCommandHandler(} catch (error) {return { message: `/${command.name} failed: ${toErrorMessage(error)}` };}- const { runTuiSetupCommand, SETUP_FLOW_CONFIG } = setupCommands;- const flowConfig = SETUP_FLOW_CONFIG[command.name];- flow.begin(flowConfig.title, flowConfig.indicator);+ const { runTuiSetupCommand } = setupCommands;+ flow.begin("");let preserveFlowDiagnostics = true;try {const commandInput: TuiSetupCommandInput = {@@ -181,3 +169,7 @@ export function createPromptCommandHandler(},};}++function modelFailure(message: string): PromptCommandOutcome {+ return { message, summary: "Couldn't change the model", failed: true };+}diff --git a/packages/eve/src/cli/dev/tui/prompt-commands.ts b/packages/eve/src/cli/dev/tui/prompt-commands.tsindex b28efba55..cf70e80ae 100644--- a/packages/eve/src/cli/dev/tui/prompt-commands.ts+++ b/packages/eve/src/cli/dev/tui/prompt-commands.ts@@ -30,6 +30,10 @@ export interface PromptCommandSpec {readonly argumentHint?: string;/** Accepts a trailing argument (enables `/name <arg>` parsing). */readonly takesArgument: boolean;+ /** Whether recalling this command would reopen a modal or take over prompt navigation. */+ readonly history: "keep" | "omit";+ /** Inline argument suggestions, when this command has a catalog-backed grammar. */+ readonly typeahead?: { readonly maxArguments: number; readonly loadingLabel: string };/** Maps a recognized invocation to its parsed command. */readonly build: (argument: string) => PromptCommand;}@@ -46,15 +50,18 @@ interface PromptCommandDefinition extends PromptCommandSpec {const PROMPT_COMMAND_DEFINITIONS = [{name: "model",+ history: "omit",aliases: [],description: "Choose a model, speed, and reasoning",argumentHint: "[provider/model]",takesArgument: true,+ typeahead: { maxArguments: 2, loadingLabel: "models" },build: (argument) => ({ type: "extension", name: "model", argument }),targets: ["local"],},{name: "reset",+ history: "keep",aliases: [],description: "Start a fresh session",takesArgument: false,@@ -63,6 +70,7 @@ const PROMPT_COMMAND_DEFINITIONS = [},{name: "clear",+ history: "keep",aliases: ["new"],description: "Clear the current session context",takesArgument: false,@@ -71,6 +79,7 @@ const PROMPT_COMMAND_DEFINITIONS = [},{name: "compact",+ history: "keep",aliases: [],description: "Compact the current session context",takesArgument: false,@@ -79,6 +88,7 @@ const PROMPT_COMMAND_DEFINITIONS = [},{name: "cancel",+ history: "keep",aliases: [],description: "Cancel the running turn",takesArgument: false,@@ -87,23 +97,28 @@ const PROMPT_COMMAND_DEFINITIONS = [},{name: "login",+ history: "omit",aliases: [],description: "Connect a model provider",argumentHint: "[connection]",takesArgument: true,+ typeahead: { maxArguments: 1, loadingLabel: "connections" },build: (argument) => ({ type: "extension", name: "login", argument }),targets: ["local"],},{name: "add",+ history: "omit",aliases: [],description: "Add an integration from the registry",takesArgument: true,+ typeahead: { maxArguments: 1, loadingLabel: "registry" },build: (argument) => ({ type: "extension", name: "add", argument }),targets: ["local"],},{name: "deploy",+ history: "keep",aliases: [],description: "Deploy the agent to Vercel",takesArgument: false,@@ -112,6 +127,7 @@ const PROMPT_COMMAND_DEFINITIONS = [},{name: "traces",+ history: "omit",aliases: [],description: "Open the local trace viewer",argumentHint: "[trace]",@@ -121,15 +137,18 @@ const PROMPT_COMMAND_DEFINITIONS = [},{name: "loglevel",+ history: "omit",aliases: [],description: "Show or hide captured stdout/stderr/sandbox logs",argumentHint: "[all|stderr|sandbox|none]",takesArgument: true,+ typeahead: { maxArguments: 1, loadingLabel: "log levels" },build: (argument) => ({ type: "loglevel", argument }),targets: ["local", "remote"],},{name: "info",+ history: "omit",aliases: [],description: "Show application and messaging information",takesArgument: false,@@ -138,6 +157,7 @@ const PROMPT_COMMAND_DEFINITIONS = [},{name: "help",+ history: "omit",aliases: [],description: "Show available commands",takesArgument: false,@@ -146,6 +166,7 @@ const PROMPT_COMMAND_DEFINITIONS = [},{name: "exit",+ history: "keep",aliases: ["quit"],description: "Quit the TUI",takesArgument: false,@@ -154,6 +175,11 @@ const PROMPT_COMMAND_DEFINITIONS = [},] satisfies readonly PromptCommandDefinition[];+export type ArgumentTypeaheadCommand = Extract<+ (typeof PROMPT_COMMAND_DEFINITIONS)[number],+ { typeahead: object }+>["name"];+export const PROMPT_COMMANDS: readonly PromptCommandSpec[] = PROMPT_COMMAND_DEFINITIONS;export function promptCommandsFor(target: PromptCommandTarget): readonly PromptCommandSpec[] {@@ -189,18 +215,26 @@ export function isPromptCommandAvailableFor(* message.*/export function parsePromptCommand(prompt: string): PromptCommand | null {+ const match = promptCommandSpec(prompt);+ return match === undefined ? null : match.spec.build(match.argument);+}++/** Resolve an invocation and its history policy from the same command definition. */+export function promptCommandSpec(+ prompt: string,+): { spec: PromptCommandSpec; argument: string } | undefined {const trimmed = prompt.trim();- if (!trimmed.startsWith("/")) return null;+ if (!trimmed.startsWith("/")) return undefined;for (const spec of PROMPT_COMMANDS) {for (const alias of [spec.name, ...spec.aliases]) {const token = `/${alias}`;- if (trimmed === token) return spec.build("");+ if (trimmed === token) return { spec, argument: "" };if (spec.takesArgument && trimmed.startsWith(`${token} `)) {- return spec.build(trimmed.slice(token.length).trim());+ return { spec, argument: trimmed.slice(token.length).trim() };}}}- return null;+ return undefined;}/** True for prompts that are commands, which never echo as user messages. */diff --git a/packages/eve/src/cli/dev/tui/registry-result-message.test.ts b/packages/eve/src/cli/dev/tui/registry-result-message.test.tsindex f855c6af4..e792e214f 100644--- a/packages/eve/src/cli/dev/tui/registry-result-message.test.ts+++ b/packages/eve/src/cli/dev/tui/registry-result-message.test.ts@@ -1,98 +1,101 @@import { describe, expect, it } from "vitest";-import { formatRegistrySessionResult } from "./registry-result-message.js";+import { registryCommandOutcome } from "./registry-result-message.js";-describe("formatRegistrySessionResult", () => {- it("renders an unlabeled completion fact as a sentence", () => {+describe("registryCommandOutcome", () => {+ it("leaves a plain installation to its summary", () => {expect(- formatRegistrySessionResult({- items: [- {- title: "Web Chat",- facts: [{ label: "", value: "Start locally with `pnpm dev:services`." }],- output: [],- },- ],- failures: [],+ registryCommandOutcome({+ outcomes: [{ kind: "installed", title: "connection/notion", facts: [], output: [] }],}),- ).toBe("Added Web Chat\n\n ✓ Web Chat\n Start locally with `pnpm dev:services`.");+ ).toEqual({ failed: false, summary: "Added connection/notion", message: "" });});- it("formats installed items and multiline failures in one report", () => {+ it("hangs one installation's facts under its summary", () => {expect(- formatRegistrySessionResult({- items: [- { title: "Web Chat", facts: [], output: [] },+ registryCommandOutcome({+ outcomes: [{- title: "Photon iMessage",- facts: [{ label: "Agent phone number", value: "+15551234567", kind: "phone" }],+ kind: "installed",+ title: "channel/photon",+ facts: [+ { label: "Agent phone number", value: "+15551234567", kind: "phone" },+ { label: "Mode", value: "dev" },+ ],output: ["Configured MCP connection."],},],- failures: [- {- title: "Slack",- message:- "Vercel CLI is not authenticated. Try again with `eve add channel/slack --skip-install`.",- },- ],}),- ).toBe(- "3 additions: 2 added, 1 failed\n\n" +- " ✓ Web Chat\n" +- " Installed.\n\n" +- " ✓ Photon iMessage\n" +- " Agent phone number +15551234567\n" +- " Configured MCP connection.\n\n" +- " ⨯ Slack\n" +- " Vercel CLI is not authenticated.\n" +- " Try again with `eve add channel/slack --skip-install`.",- );+ ).toEqual({+ failed: false,+ summary: "Added channel/photon",+ message:+ "Agent phone number +15551234567\nMode dev\nConfigured MCP connection.",+ });});- it("gives an all-failed report a meaningful headline", () => {+ it("marks unfinished setup as neutral with a resume command and flow warnings", () => {expect(- formatRegistrySessionResult({- items: [],- failures: [- { title: "Web Chat", message: "Dependency installation failed." },- { title: "Notion", message: "Vercel Connect setup failed." },+ registryCommandOutcome(+ {+ outcomes: [+ {+ kind: "incomplete",+ title: "channel/slack",+ resumeCommand: "eve add channel/slack --skip-install",+ },+ ],+ },+ ["Wait for the Slack request to expire before retrying."],+ ),+ ).toEqual({+ failed: false,+ summary: "Added channel/slack · setup not finished",+ message:+ "Finish with `eve add channel/slack --skip-install`\n" ++ "⚠ Wait for the Slack request to expire before retrying.",+ });+ });++ it("reports a cancellation before installation without detail", () => {+ expect(+ registryCommandOutcome({ outcomes: [{ kind: "cancelled", title: "connection/sentry" }] }),+ ).toEqual({ failed: false, summary: "connection/sentry not added", message: "" });+ });++ it("splits a failure's retry hint onto its own line", () => {+ expect(+ registryCommandOutcome({+ outcomes: [+ {+ kind: "failed",+ title: "channel/slack",+ message:+ "Vercel CLI is not authenticated. Try again with `eve add channel/slack --skip-install`.",+ },],}),- ).toBe(- "2 additions: 2 failed\n\n" +- " ⨯ Web Chat\n" +- " Dependency installation failed.\n\n" +- " ⨯ Notion\n" +- " Vercel Connect setup failed.",- );+ ).toEqual({+ failed: true,+ summary: "Couldn't add channel/slack",+ message:+ "Vercel CLI is not authenticated.\nTry again with `eve add channel/slack --skip-install`.",+ });});- it("reports every installed, cancelled, and failed selection in order", () => {+ it("lists one marked row per item when several settle", () => {expect(- formatRegistrySessionResult({- items: [- { title: "Web Chat", facts: [], output: [] },- { title: "Notion", facts: [], output: [] },- ],- failures: [{ title: "GitHub", message: "Installation failed." }],+ registryCommandOutcome({outcomes: [{ kind: "installed", title: "Web Chat", facts: [], output: [] },{ kind: "cancelled", title: "Slack" },{ kind: "failed", title: "GitHub", message: "Installation failed." },- { kind: "installed", title: "Notion", facts: [], output: [] },],}),- ).toBe(- "4 additions: 2 added, 1 failed, 1 cancelled\n\n" +- " ✓ Web Chat\n" +- " Installed.\n\n" +- " – Slack\n" +- " Cancelled.\n\n" +- " ⨯ GitHub\n" +- " Installation failed.\n\n" +- " ✓ Notion\n" +- " Installed.",- );+ ).toEqual({+ failed: true,+ summary: "Added 1 of 3 items",+ message: "* Added Web Chat\n* Slack not added\n* Couldn't add GitHub\n Installation failed.",+ });});});diff --git a/packages/eve/src/cli/dev/tui/registry-result-message.ts b/packages/eve/src/cli/dev/tui/registry-result-message.tsindex 36978dd21..bd4536f93 100644--- a/packages/eve/src/cli/dev/tui/registry-result-message.ts+++ b/packages/eve/src/cli/dev/tui/registry-result-message.ts@@ -1,5 +1,8 @@import type { RegistryCatalogItem } from "#cli/commands/registry.js";-import type { RegistrySessionResult } from "#setup/flows/registry-session.js";+import type {+ RegistrySessionOutcome,+ RegistrySessionResult,+} from "#setup/flows/registry-session.js";/** Builds the shared transient progress update for `/add` and initial onboarding. */export function registryItemProgress(renderer: {@@ -17,84 +20,76 @@ export function registryItemProgress(renderer: {};}-export function registryResultTone(result: RegistrySessionResult): "success" | "error" | undefined {- if (result.failures.length > 0 && result.items.length === 0) return "error";- if (result.outcomes?.some((outcome) => outcome.kind === "cancelled")) return undefined;- return result.items.length > 0 ? "success" : undefined;+export interface RegistryCommandOutcome {+ failed: boolean;+ /** Replaces the echoed `/add` once it settles. */+ summary: string;+ /** Detail hung under the summary; empty when the summary says it all. */+ message: string;}-function joinedTitles(titles: readonly string[]): string {- if (titles.length === 0) return "";- if (titles.length === 1) return titles[0]!;- if (titles.length === 2) return `${titles[0]} and ${titles[1]}`;- return `${titles.slice(0, -1).join(", ")}, and ${titles.at(-1)}`;+function outcomeDetails(outcome: RegistrySessionOutcome): string[] {+ switch (outcome.kind) {+ case "installed": {+ const labeledFacts = outcome.facts.filter((fact) => fact.label.length > 0);+ const width = Math.max(0, ...labeledFacts.map((fact) => fact.label.length));+ return [+ ...outcome.facts.map((fact) =>+ fact.label.length === 0 ? fact.value : `${fact.label.padEnd(width)} ${fact.value}`,+ ),+ ...outcome.output,+ ];+ }+ case "incomplete":+ return [`Finish with \`${outcome.resumeCommand}\``];+ case "failed":+ return outcome.message.replace(" Try again with `", "\nTry again with `").split("\n");+ case "cancelled":+ return [];+ }}-function formatFailureMessage(message: string): string {- return message.replace(" Try again with `", "\nTry again with `");+/** The one-line record of an `/add` item left in place of its invocation. */+export function registryOutcomeSummary(outcome: RegistrySessionOutcome): string {+ switch (outcome.kind) {+ case "installed":+ return `Added ${outcome.title}`;+ case "incomplete":+ return `Added ${outcome.title} · setup not finished`;+ case "failed":+ return `Couldn't add ${outcome.title}`;+ case "cancelled":+ return `${outcome.title} not added`;+ }}-function resultHeadline(- outcomes: readonly { kind: "installed" | "failed" | "cancelled" }[],- installedTitles: readonly string[],-): string {- const failed = outcomes.filter((outcome) => outcome.kind === "failed").length;- const cancelled = outcomes.filter((outcome) => outcome.kind === "cancelled").length;- if (failed === 0 && cancelled === 0) return `Added ${joinedTitles(installedTitles)}`;-- const installed = outcomes.length - failed - cancelled;- const parts = [- installed > 0 ? `${installed} added` : undefined,- failed > 0 ? `${failed} failed` : undefined,- cancelled > 0 ? `${cancelled} cancelled` : undefined,- ].filter((part): part is string => part !== undefined);- return `${outcomes.length} ${outcomes.length === 1 ? "addition" : "additions"}: ${parts.join(", ")}`;+function hasFailedOutcome(outcomes: readonly RegistrySessionOutcome[]): boolean {+ return outcomes.some((outcome) => outcome.kind === "failed");}-/** Formats structured registry setup results after their temporary panel closes. */-export function formatRegistrySessionResult(result: RegistrySessionResult): string {- const outcomes = result.outcomes ?? [- ...result.items.map((item) => ({ kind: "installed" as const, ...item })),- ...result.failures.map((failure) => ({ kind: "failed" as const, ...failure })),- ];- const lines = [- resultHeadline(- outcomes,- result.items.map((item) => item.title),- ),- ];- for (const outcome of outcomes) {- const marker = outcome.kind === "installed" ? "✓" : outcome.kind === "failed" ? "⨯" : "–";- lines.push("", ` ${marker} ${outcome.title}`);- if (outcome.kind === "cancelled") {- lines.push(" Cancelled.");- continue;- }- if (outcome.kind === "failed") {- lines.push(- ...formatFailureMessage(outcome.message)- .split("\n")- .map((line) => ` ${line}`),- );- continue;- }- if (outcome.facts.length === 0 && outcome.output.length === 0) {- lines.push(" Installed.");- continue;- }- const labeledFacts = outcome.facts.filter((fact) => fact.label.length > 0);- const width = Math.max(0, ...labeledFacts.map((fact) => fact.label.length));- for (const fact of outcome.facts) {- lines.push(- fact.label.length === 0- ? ` ${fact.value}`- : ` ${fact.label.padEnd(width)} ${fact.value}`,- );- }- for (const output of outcome.output) lines.push(` ${output}`);- }- if (result.cancelled === true) {- lines.push("", "Setup stopped before the remaining selections were added.");- }- return lines.join("\n");+/**+ * Summarizes an `/add` session in place of its echoed command. One item folds+ * into the summary itself; several items list one marked row each.+ */+export function registryCommandOutcome(+ result: RegistrySessionResult,+ notes: readonly string[] = [],+): RegistryCommandOutcome {+ const { outcomes } = result;+ const added = outcomes.filter(+ (outcome) => outcome.kind === "installed" || outcome.kind === "incomplete",+ ).length;+ const summary =+ outcomes.length === 1+ ? registryOutcomeSummary(outcomes[0]!)+ : `Added ${added} of ${outcomes.length} items`;+ const lines =+ outcomes.length === 1+ ? outcomeDetails(outcomes[0]!)+ : outcomes.flatMap((outcome) => [+ `* ${registryOutcomeSummary(outcome)}`,+ ...outcomeDetails(outcome).map((line) => ` ${line}`),+ ]);+ lines.push(...notes.map((note) => `⚠ ${note}`));+ return { failed: hasFailedOutcome(outcomes), summary, message: lines.join("\n") };}diff --git a/packages/eve/src/cli/dev/tui/runner.test.ts b/packages/eve/src/cli/dev/tui/runner.test.tsindex 47c539d5a..efd22aae2 100644--- a/packages/eve/src/cli/dev/tui/runner.test.ts+++ b/packages/eve/src/cli/dev/tui/runner.test.ts@@ -30,6 +30,7 @@ import {type AgentTUIRenderer,type AgentTUISessionOptions,type AgentTUIStreamEvent,+ type CommandPresentation,type PromptCommand,type PromptCommandOutcome,} from "./runner.js";@@ -251,7 +252,6 @@ describe("registryHandoffAddress", () => {const promptSuspended = createDeferred<void>();const handle = vi.fn(async () => ({message: "Slack setup completed.",- tone: "success" as const,}));const client = stubClient();const fetchChild = vi@@ -1673,7 +1673,9 @@ describe("EveTUIRunner development session continuity", () => {name: "Weather Agent",renderer: fakeRenderer({readPrompt: vi.fn(async () => prompts.shift()),- renderCommandResult: (message) => results.push(message),+ finishCommand: (outcome) => {+ if (outcome.kind === "result") results.push(outcome.message ?? "");+ },renderStream: vi.fn(async (result) => {for await (const event of result.events) {void event;@@ -1688,7 +1690,7 @@ describe("EveTUIRunner development session continuity", () => {expect(compact).toHaveBeenCalledOnce();expect(stream).toHaveBeenCalledOnce();expect(session.send).not.toHaveBeenCalled();- expect(results).toEqual(["Compaction requested."]);+ expect(results).toEqual([""]);});it.each(["/clear", "/new"])(@@ -1715,7 +1717,9 @@ describe("EveTUIRunner development session continuity", () => {name: "Weather Agent",renderer: fakeRenderer({readPrompt: vi.fn(async () => prompts.shift()),- renderCommandResult: (message) => results.push(message),+ finishCommand: (outcome) => {+ if (outcome.kind === "result") results.push(outcome.message ?? "");+ },renderStream: vi.fn(async (result) => {for await (const event of result.events) {void event;@@ -1730,10 +1734,33 @@ describe("EveTUIRunner development session continuity", () => {expect(clear).toHaveBeenCalledOnce();expect(stream).toHaveBeenCalledOnce();expect(session.send).not.toHaveBeenCalled();- expect(results).toEqual(["Context clear requested."]);+ expect(results).toEqual([]);},);+ it("keeps /clear in the transcript when clearing fails", async () => {+ const session = sessionYielding([]);+ vi.spyOn(session, "clear").mockRejectedValue(new Error("World unavailable"));+ const outcomes: CommandPresentation[] = [];+ const prompts: Array<string | undefined> = ["/clear", undefined];+ await new EveTUIRunner({+ name: "Weather Agent",+ renderer: fakeRenderer({+ readPrompt: vi.fn(async () => prompts.shift()),+ finishCommand: (outcome) => outcomes.push(outcome),+ }),+ session,+ }).run();++ expect(outcomes).toEqual([+ {+ kind: "result",+ message: "World unavailable",+ summary: "Couldn't clear the session",+ },+ ]);+ });+it("cancels an active turn without sending a prompt", async () => {const session = stubClient().sessions.attach("session_1");const cancel = vi@@ -1757,7 +1784,9 @@ describe("EveTUIRunner development session continuity", () => {name: "Weather Agent",renderer: fakeRenderer({readPrompt: vi.fn(async () => prompts.shift()),- renderCommandResult: (message) => results.push(message),+ finishCommand: (outcome) => {+ if (outcome.kind === "result") results.push(outcome.message ?? "");+ },renderStream: vi.fn(async (result) => {for await (const event of result.events) {void event;@@ -1772,7 +1801,7 @@ describe("EveTUIRunner development session continuity", () => {expect(cancel).toHaveBeenCalledOnce();expect(stream).toHaveBeenCalledOnce();expect(send).not.toHaveBeenCalled();- expect(results).toEqual(["Turn cancellation requested."]);+ expect(results).toEqual([""]);});it("does not call the cancel API before a session has started", async () => {@@ -1782,26 +1811,28 @@ describe("EveTUIRunner development session continuity", () => {name: "Weather Agent",renderer: fakeRenderer({readPrompt: vi.fn(async () => prompts.shift()),- renderCommandResult: (message) => results.push(message),+ finishCommand: (outcome) => {+ if (outcome.kind === "result") results.push(outcome.message ?? "");+ },}),});await runner.run();- expect(results).toEqual(["No active turn to cancel."]);+ expect(results).toEqual([""]);});it("keeps the current transcript and session when /reset cannot reset the owner", async () => {const session = sessionYielding([]);const reset = vi.spyOn(session, "reset").mockRejectedValue(new Error("World unavailable"));const resetRenderer = vi.fn();- const notices: string[] = [];+ const outcomes: CommandPresentation[] = [];const prompts: Array<string | undefined> = ["/reset", undefined];const runner = new EveTUIRunner({name: "Weather Agent",renderer: fakeRenderer({readPrompt: vi.fn(async () => prompts.shift()),- renderNotice: (message) => notices.push(message),+ finishCommand: (outcome) => outcomes.push(outcome),reset: resetRenderer,}),session,@@ -1811,7 +1842,9 @@ describe("EveTUIRunner development session continuity", () => {expect(reset).toHaveBeenCalledOnce();expect(resetRenderer).not.toHaveBeenCalled();- expect(notices).toEqual(["Couldn't reset the session: World unavailable"]);+ expect(outcomes).toEqual([+ { kind: "result", message: "Couldn't reset the session: World unavailable" },+ ]);});it("resets rather than sending a queued /reset after a turn boundary", async () => {@@ -2100,14 +2133,14 @@ describe("EveTUIRunner initial input", () => {await login.promise;return result === "cancelled"? { cancelled: true as const, message: "Connect a model with /login when you’re ready." }- : { tone: "error" as const, message: "Could not connect. Retry with /login." };+ : { failed: true as const, message: "Could not connect. Retry with /login." };});const session = stubSession();vi.spyOn(session, "send");const renderer = fakeRenderer({setupFlow: createFakeSetupFlowRenderer(),renderCommandInvocation: vi.fn(),- renderCommandResult: vi.fn(),+ finishCommand: vi.fn(),});const runner = new EveTUIRunner({session,@@ -2129,12 +2162,14 @@ describe("EveTUIRunner initial input", () => {expect.objectContaining({ initialDraft: "Hello Alice\n\nstill editing" }),);expect(renderer.renderCommandInvocation).not.toHaveBeenCalled();- expect(renderer.renderCommandResult).toHaveBeenCalledWith(- result === "cancelled"- ? "Connect a model with /login when you’re ready."- : "Could not connect. Retry with /login.",- result === "error" ? "error" : undefined,- );+ expect(renderer.finishCommand).toHaveBeenCalledWith({+ kind: "result",+ message:+ result === "cancelled"+ ? "Connect a model with /login when you’re ready."+ : "Could not connect. Retry with /login.",+ summary: undefined,+ });},);@@ -3209,14 +3244,14 @@ describe("EveTUIRunner remote authentication", () => {completedMutations: [],};});- const commandInvocations: Array<{ text: string; status: "failed" | undefined }> = [];+ const commandInvocations: Array<string> = [];await runRemoteAuth({client,flow,resolveDeployment: async () => ({ kind: "not-found" }),renderer: {- renderCommandInvocation: (text, status) => commandInvocations.push({ text, status }),+ renderCommandInvocation: (text) => commandInvocations.push(text),},});@@ -3232,7 +3267,7 @@ describe("EveTUIRunner remote authentication", () => {async (challenge) => {const client = stubClient();vi.spyOn(client, "info").mockRejectedValueOnce(challenge).mockResolvedValueOnce(AGENT_INFO);- const commandInvocations: Array<{ text: string; status: "failed" | undefined }> = [];+ const commandInvocations: Array<string> = [];const flow = successfulAuth();const statuses: string[] = [];const renderAgentHeader = vi.fn();@@ -3241,7 +3276,7 @@ describe("EveTUIRunner remote authentication", () => {client,flow,renderer: {- renderCommandInvocation: (text, status) => commandInvocations.push({ text, status }),+ renderCommandInvocation: (text) => commandInvocations.push(text),setRemoteConnectionStatus: (snapshot) => statuses.push(snapshot.connection.state),renderAgentHeader,},@@ -3325,12 +3360,12 @@ describe("EveTUIRunner remote authentication", () => {);const setupFlow = idleSetupFlow();const readPrompt = vi.fn(async () => undefined);- const renderCommandResult = vi.fn();+ const finishCommand = vi.fn();await runRemoteAuth({client,flow,initialInput: "Hello Alice",- renderer: { setupFlow, readPrompt, renderCommandResult },+ renderer: { setupFlow, readPrompt, finishCommand },});expect(flow).toHaveBeenCalledOnce();expect(client.info).toHaveBeenCalledOnce();@@ -3338,12 +3373,13 @@ describe("EveTUIRunner remote authentication", () => {expect(readPrompt).toHaveBeenCalledWith(expect.objectContaining({ initialDraft: "Hello Alice" }),);- if (kind === "cancelled") expect(renderCommandResult).not.toHaveBeenCalled();+ if (kind === "cancelled") expect(finishCommand).not.toHaveBeenCalled();else- expect(renderCommandResult).toHaveBeenCalledWith(- expect.stringContaining("Check project permissions"),- "error",- );+ expect(finishCommand).toHaveBeenCalledWith({+ kind: "result",+ message: expect.stringContaining("Check project permissions"),+ summary: undefined,+ });},);@@ -3355,23 +3391,24 @@ describe("EveTUIRunner remote authentication", () => {const flow = successfulAuth([{ kind: "trusted-sources-updated", targetProjectName: "inbound" },]);- const renderCommandResult = vi.fn();+ const finishCommand = vi.fn();const statuses: string[] = [];await runRemoteAuth({client,flow,renderer: {- renderCommandResult,+ finishCommand,setRemoteConnectionStatus: (snapshot) => statuses.push(snapshot.connection.state),},});expect(flow).toHaveBeenCalledOnce();expect(client.info).toHaveBeenCalledTimes(2);expect(statuses.at(-1)).toBe("auth-failed");- expect(renderCommandResult).toHaveBeenCalledWith(- expect.stringContaining("updated Trusted Sources for inbound"),- "error",- );+ expect(finishCommand).toHaveBeenCalledWith({+ kind: "result",+ message: expect.stringContaining("updated Trusted Sources for inbound"),+ summary: undefined,+ });});it("aborts remote setup during an idle wait and waits for cleanup before releasing input", async () => {@@ -4237,7 +4274,7 @@ describe("EveTUIRunner boot setup detection", () => {it("releases the composer while /info is still pending and ignores its result after exit", async () => {const refreshed = createDeferred<AgentInfoResult>();const renderAgentHeader = vi.fn();- const renderCommandResult = vi.fn();+ const finishCommand = vi.fn();const renderSetupWarning = vi.fn();const readPrompt = vi.fn(async () => undefined);const setStartupPhase = vi.fn();@@ -4246,7 +4283,7 @@ describe("EveTUIRunner boot setup detection", () => {bootDetections: [],renderer: {renderAgentHeader,- renderCommandResult,+ finishCommand,renderSetupWarning,readPrompt,setStartupPhase,@@ -4255,7 +4292,7 @@ describe("EveTUIRunner boot setup detection", () => {const run = runner.run();await vi.waitFor(() => expect(readPrompt).toHaveBeenCalledOnce());expect(client.info).toHaveBeenCalledTimes(2);- expect(renderCommandResult).not.toHaveBeenCalled();+ expect(finishCommand).not.toHaveBeenCalled();expect(renderSetupWarning).not.toHaveBeenCalled();expect(setStartupPhase).toHaveBeenLastCalledWith(undefined);await run;@@ -4375,7 +4412,7 @@ describe("EveTUIRunner boot setup detection", () => {it("drops stale disconnected evidence when the post-setup info refresh fails", async () => {const clearSetupWarning = vi.fn();- const renderCommandResult = vi.fn();+ const finishCommand = vi.fn();const headers: AgentTUIAgentHeader[] = [];const detect = vi.fn(({ info }: { info?: AgentInfoResult }) =>info?.agent.model.endpoint?.kind === "gateway" && !info.agent.model.endpoint.connected@@ -4395,7 +4432,7 @@ describe("EveTUIRunner boot setup detection", () => {bootDetections: [{ id: "test", detect }],renderer: {clearSetupWarning,- renderCommandResult,+ finishCommand,renderAgentHeader: (header) => headers.push(header),},});@@ -4403,7 +4440,7 @@ describe("EveTUIRunner boot setup detection", () => {await runner.run();await vi.waitFor(() => expect(clearSetupWarning).toHaveBeenCalled());- expect(renderCommandResult).not.toHaveBeenCalled();+ expect(finishCommand).not.toHaveBeenCalled();expect(client.info).toHaveBeenCalledTimes(2);expect(detect).not.toHaveBeenCalled();expect(headers.at(-1)?.info?.agent.model.endpoint).toMatchObject({@@ -4441,7 +4478,9 @@ describe("EveTUIRunner command outcome rendering", () => {const renderer: AgentTUIRenderer = {readPrompt: vi.fn(async () => prompts.shift()),renderNotice: vi.fn(),- renderCommandResult: (text) => results.push(text),+ finishCommand: (outcome) => {+ if (outcome.kind === "result") results.push(outcome.message ?? "");+ },renderStream: vi.fn(async () => {}),};@@ -4478,7 +4517,9 @@ describe("EveTUIRunner command outcome rendering", () => {name: "Weather Agent",renderer: {readPrompt: vi.fn(async () => prompts.shift()),- renderCommandResult: (text) => results.push(text),+ finishCommand: (outcome) => {+ if (outcome.kind === "result") results.push(outcome.message ?? "");+ },renderStream: vi.fn(async () => {}),},session,@@ -4492,7 +4533,7 @@ describe("EveTUIRunner command outcome rendering", () => {});it("dispatches /loglevel to the renderer and reports the outcome", async () => {- const results: string[] = [];+ const results: Array<{ text: string; summary?: string }> = [];const modes: string[] = [];const prompts: Array<string | undefined> = ["/loglevel none",@@ -4504,7 +4545,10 @@ describe("EveTUIRunner command outcome rendering", () => {const renderer: AgentTUIRenderer = {readPrompt: vi.fn(async () => prompts.shift()),- renderCommandResult: (text) => results.push(text),+ finishCommand: (outcome) => {+ if (outcome.kind === "result")+ results.push({ text: outcome.message ?? "", summary: outcome.summary });+ },renderStream: vi.fn(async () => {}),logDisplayMode: () => "all",setLogDisplayMode: (mode) => modes.push(mode),@@ -4515,9 +4559,10 @@ describe("EveTUIRunner command outcome rendering", () => {expect(modes).toEqual(["none", "sandbox"]);expect(results).toHaveLength(3);- expect(results[0]).toContain("hidden");- expect(results[1]).toContain('Unknown log level "bogus"');- expect(results[2]).toContain("sandbox");+ expect(results[0]?.summary).toContain("hidden");+ expect(results[1]?.summary).toBeUndefined();+ expect(results[1]?.text).toContain('Unknown log level "bogus"');+ expect(results[2]?.summary).toContain("sandbox");expect(session.send).not.toHaveBeenCalled();});@@ -4528,7 +4573,9 @@ describe("EveTUIRunner command outcome rendering", () => {const renderer: AgentTUIRenderer = {readPrompt: vi.fn(async () => prompts.shift()),- renderCommandResult: (text) => results.push(text),+ finishCommand: (outcome) => {+ if (outcome.kind === "result") results.push(outcome.message ?? "");+ },renderStream: vi.fn(async () => {}),};@@ -4548,7 +4595,9 @@ describe("EveTUIRunner command outcome rendering", () => {const renderer: AgentTUIRenderer = {readPrompt: vi.fn(async () => prompts.shift()),renderNotice: (text) => notices.push(text),- renderCommandResult: (text) => results.push(text),+ finishCommand: (outcome) => {+ if (outcome.kind === "result") results.push(outcome.message ?? "");+ },renderStream: vi.fn(async () => {}),};@@ -4916,7 +4965,7 @@ it("starts onboarding without login history and preserves the input draft", asynconst renderer = fakeRenderer({setupFlow: createFakeSetupFlowRenderer(),renderCommandInvocation: vi.fn(),- renderCommandResult: vi.fn(),+ finishCommand: vi.fn(),readPrompt: vi.fn(async (options?: AgentTUISessionOptions) => {order.push("prompt");expect(options?.initialDraft).toBe("Hello Alice");@@ -4936,7 +4985,7 @@ it("starts onboarding without login history and preserves the input draft", asynawait runner.run();expect(order).toEqual(["login", "prompt"]);expect(renderer.renderCommandInvocation).not.toHaveBeenCalled();- expect(renderer.renderCommandResult).not.toHaveBeenCalled();+ expect(renderer.finishCommand).not.toHaveBeenCalled();});it("keeps the result of an explicit login command after onboarding", async () => {@@ -4944,7 +4993,7 @@ it("keeps the result of an explicit login command after onboarding", async () =>const handle = vi.fn(async () => ({ message: "Connected." }));const renderer = fakeRenderer({setupFlow: createFakeSetupFlowRenderer(),- renderCommandResult: vi.fn(),+ finishCommand: vi.fn(),readPrompt: vi.fn(async () => prompts.shift()),});const runner = new EveTUIRunner({@@ -4959,5 +5008,9 @@ it("keeps the result of an explicit login command after onboarding", async () =>await runner.run();expect(handle).toHaveBeenCalledTimes(2);- expect(renderer.renderCommandResult).toHaveBeenCalledExactlyOnceWith("Connected.", undefined);+ expect(renderer.finishCommand).toHaveBeenCalledExactlyOnceWith({+ kind: "result",+ message: "Connected.",+ summary: undefined,+ });});diff --git a/packages/eve/src/cli/dev/tui/runner.ts b/packages/eve/src/cli/dev/tui/runner.tsindex 9a270fc8a..56311c4dd 100644--- a/packages/eve/src/cli/dev/tui/runner.ts+++ b/packages/eve/src/cli/dev/tui/runner.ts@@ -61,6 +61,7 @@ import {PROMPT_COMMANDS,type PromptCommand,type PromptCommandSpec,+ type ArgumentTypeaheadCommand,} from "./prompt-commands.js";import type { PromptArgumentSuggestion } from "./argument-typeahead.js";import {@@ -283,8 +284,10 @@ export type AgentTUIRenderer = {/** Clears the setup attention line once its issue is resolved. */clearSetupWarning?(): void;/** Commits the startup `/deploy` invocation to the transcript. */- renderCommandInvocation?(text: string, status?: "failed"): void;- renderCommandResult?(text: string, tone?: "success" | "error"): void;+ renderCommandInvocation?(text: string): void;+ finishCommand?(outcome: CommandPresentation): void;+ choosePromptCommand?(commands: readonly PromptCommandSpec[]): Promise<string | undefined>;+ showInfoPanel?(text: string): Promise<void>;readonly setupFlow?: SetupFlowRenderer;/*** The renderer's full-screen local trace viewer, opened by `/traces`.@@ -406,12 +409,19 @@ export interface PromptCommandHandlerContext {readonly disabledConnectionReasons?: Readonly<Record<string, string>>;}+/** One atomic transcript decision for an invocation, including no-output commands. */+export type CommandPresentation =+ | { kind: "dismiss" }+ | { kind: "result"; message?: string; summary?: string };+/** What one handled slash command leaves behind for the runner to apply. */export interface PromptCommandOutcome {/** Outcome line rendered under the echoed command; absent renders nothing. */message?: string;- /** Promotes an outcome to a top-level status. */- tone?: "success" | "error";+ /** The command failed; completed and cancelled commands share the normal settled presentation. */+ failed?: true;+ /** Replaces the echoed invocation once the command settles. */+ summary?: string;/** Post-command work after setup settles. */effect?: VercelStatusEffect | ModelAccessChange;cancelled?: true;@@ -473,7 +483,7 @@ export type EveTUIRunnerOptions = TuiDisplayOptions & {availablePromptCommands?: readonly PromptCommandSpec[];/** Catalog entries available to inline `/model`, `/add`, and `/login` completion. */argumentSuggestions?: (- command: "model" | "add" | "login",+ command: ArgumentTypeaheadCommand,) => Promise<readonly PromptArgumentSuggestion[]>;/** Gives setup subprocesses exclusive terminal and development-host ownership. */withExclusiveTerminal?: <T>(task: () => Promise<T>) => Promise<T>;@@ -813,7 +823,7 @@ export class EveTUIRunner {if (connection.state === "ready") this.#replaceAgentInfo(connection.info);} else if (access?.kind === "failed" || access?.kind === "unavailable") {startupOutcome = {- tone: "error",+ failed: true,message: access.kind === "failed" ? access.message : access.failure.message,};} else if (access?.kind === "cancelled") {@@ -829,7 +839,7 @@ export class EveTUIRunner {}let initialDraft = this.#finishStartup();- if (startupOutcome?.cancelled || startupOutcome?.tone === "error") {+ if (startupOutcome?.cancelled || startupOutcome?.failed) {initialDraft = [this.#startupPrompt, initialDraft].filter(Boolean).join("\n\n") || undefined;} else {prompt = this.#startupPrompt;@@ -838,8 +848,9 @@ export class EveTUIRunner {this.#replaceAgentInfo(this.#agentInfo);this.#paintSetupAttention();this.#renderer.setStartupPhase?.(undefined);- if (!initialAgentOnboarding || startupOutcome?.cancelled || startupOutcome?.tone === "error") {- this.#renderCommandOutcome(startupOutcome?.message, startupOutcome?.tone);+ if (!initialAgentOnboarding || startupOutcome?.cancelled || startupOutcome?.failed) {+ if (startupOutcome?.message !== undefined)+ this.#finishCommand({ kind: "result", message: startupOutcome.message });}while (true) {@@ -911,45 +922,22 @@ export class EveTUIRunner {const command = this.#idleInputResult === undefined ? parsePromptCommand(prompt!) : null;if (command?.type === "exit") {+ this.#finishCommand({ kind: "dismiss" });this.#lifecycle?.requestStop();return;}if (command?.type === "cancel") {- if (this.#session === undefined) {- this.#renderCommandOutcome("No active turn to cancel.");- pendingInputResponses = undefined;- followCurrentSession = false;- streamWithoutPrompt = false;- prompt = undefined;- continue;- }- try {- const result = await this.#session.cancel();- this.#renderCommandOutcome(- result.status === "accepted"- ? "Turn cancellation requested."- : "No active turn to cancel.",- );- if (result.status === "no_active_turn") {- pendingInputResponses = undefined;- followCurrentSession = false;- streamWithoutPrompt = false;- prompt = undefined;- continue;- }- } catch (error) {- this.#renderCommandOutcome(`Couldn't cancel the turn: ${toErrorMessage(error)}`);- pendingInputResponses = undefined;- followCurrentSession = false;- streamWithoutPrompt = false;- prompt = undefined;- continue;- }+ followCurrentSession = await this.#runSessionCommand({+ absent: "No active turn to cancel",+ accepted: "Cancellation requested",+ failed: "Couldn't cancel the turn",+ invoke: (session) => session.cancel(),+ });pendingInputResponses = undefined;- followCurrentSession = true;streamWithoutPrompt = false;prompt = undefined;+ if (!followCurrentSession) continue;}if (command?.type === "reset") {@@ -959,6 +947,7 @@ export class EveTUIRunner {prompt = undefined;continue;}+ this.#finishCommand({ kind: "dismiss" });pendingInputResponses = undefined;streamWithoutPrompt = false;prompt = undefined;@@ -966,83 +955,44 @@ export class EveTUIRunner {}if (command?.type === "compact") {- if (this.#session === undefined) {- this.#renderCommandOutcome("No active session to compact.");- pendingInputResponses = undefined;- followCurrentSession = false;- streamWithoutPrompt = false;- prompt = undefined;- continue;- }- try {- const result = await this.#session.compact();- this.#renderCommandOutcome(- result.status === "accepted"- ? "Compaction requested."- : "No active session to compact.",- );- if (result.status === "no_active_session") {- pendingInputResponses = undefined;- followCurrentSession = false;- streamWithoutPrompt = false;- prompt = undefined;- continue;- }- } catch (error) {- this.#renderCommandOutcome(`Couldn't compact the session: ${toErrorMessage(error)}`);- pendingInputResponses = undefined;- followCurrentSession = false;- streamWithoutPrompt = false;- prompt = undefined;- continue;- }+ followCurrentSession = await this.#runSessionCommand({+ absent: "No active session to compact",+ accepted: "Compaction requested",+ failed: "Couldn't compact the session",+ invoke: (session) => session.compact(),+ });pendingInputResponses = undefined;- followCurrentSession = true;streamWithoutPrompt = false;prompt = undefined;+ if (!followCurrentSession) continue;}if (command?.type === "clear") {- if (this.#session === undefined) {- this.#renderCommandOutcome("No active session to clear.");- pendingInputResponses = undefined;- followCurrentSession = false;- streamWithoutPrompt = false;- prompt = undefined;- continue;- }- try {- const result = await this.#session.clear();- this.#renderCommandOutcome(- result.status === "accepted"- ? "Context clear requested."- : "No active session to clear.",- );- if (result.status === "no_active_session") {- pendingInputResponses = undefined;- followCurrentSession = false;- streamWithoutPrompt = false;- prompt = undefined;- continue;- }- } catch (error) {- this.#renderCommandOutcome(`Couldn't clear the session: ${toErrorMessage(error)}`);- pendingInputResponses = undefined;- followCurrentSession = false;- streamWithoutPrompt = false;- prompt = undefined;- continue;- }+ followCurrentSession = await this.#runSessionCommand({+ absent: "No active session to clear",+ failed: "Couldn't clear the session",+ dismissOnAccepted: true,+ invoke: (session) => session.clear(),+ });pendingInputResponses = undefined;- followCurrentSession = true;streamWithoutPrompt = false;prompt = undefined;+ if (!followCurrentSession) continue;}// Help renders locally; unlike extension commands it must work even// without a prompt-command handler (e.g. remote --url sessions).if (command?.type === "help") {- this.#renderCommandOutcome(formatPromptCommandHelp(this.#availablePromptCommands));+ if (this.#renderer.choosePromptCommand !== undefined) {+ const selected = await this.#renderer.choosePromptCommand!(+ this.#availablePromptCommands,+ );+ if (selected !== undefined) initialDraft = selected;+ } else+ this.#finishCommand({+ kind: "result",+ message: formatPromptCommandHelp(this.#availablePromptCommands),+ });pendingInputResponses = undefined;streamWithoutPrompt = false;prompt = undefined;@@ -1060,7 +1010,13 @@ export class EveTUIRunner {// Like /help, /loglevel renders locally: it adjusts the renderer's// own log filter, so it works without a prompt-command handler.if (command?.type === "loglevel") {- this.#renderCommandOutcome(this.#applyLogLevelCommand(command.argument));+ const outcome = this.#applyLogLevelCommand(command.argument);+ const error =+ outcome.startsWith("/loglevel is not available") ||+ outcome.startsWith("Unknown log level");+ this.#finishCommand(+ error ? { kind: "result", message: outcome } : { kind: "result", summary: outcome },+ );pendingInputResponses = undefined;streamWithoutPrompt = false;prompt = undefined;@@ -1283,6 +1239,41 @@ export class EveTUIRunner {}}+ /** Runs a session mutation and gives every control command one completion policy. */+ async #runSessionCommand(input: {+ readonly absent: string;+ readonly accepted?: string;+ readonly failed: string;+ readonly dismissOnAccepted?: boolean;+ readonly invoke: (session: ClientSession) => Promise<{ status: string }>;+ }): Promise<boolean> {+ const session = this.#session;+ if (session === undefined) {+ this.#finishCommand({ kind: "result", summary: input.absent });+ return false;+ }+ try {+ const result = await input.invoke(session);+ if (result.status !== "accepted") {+ this.#finishCommand({ kind: "result", summary: input.absent });+ return false;+ }+ this.#finishCommand(+ input.dismissOnAccepted === true+ ? { kind: "dismiss" }+ : { kind: "result", summary: input.accepted },+ );+ return true;+ } catch (error) {+ this.#finishCommand({+ kind: "result",+ message: toErrorMessage(error),+ summary: input.failed,+ });+ return false;+ }+ }+/** Resets the durable owner before clearing the local conversation view. */async #resetCurrentSession(): Promise<boolean> {if (this.#session === undefined) {@@ -1293,7 +1284,10 @@ export class EveTUIRunner {try {await this.#session.reset();} catch (error) {- this.#renderer.renderNotice?.(`Couldn't reset the session: ${toErrorMessage(error)}`);+ this.#finishCommand({+ kind: "result",+ message: `Couldn't reset the session: ${toErrorMessage(error)}`,+ });return false;}@@ -1665,6 +1659,7 @@ export class EveTUIRunner {}async #openRegistrySetup(address: string): Promise<void> {+ this.#renderer.renderCommandInvocation?.(`/add ${address}`);await this.#executeExtensionCommand({ type: "extension", name: "add", argument: address },"Add to your agent",@@ -1743,13 +1738,15 @@ export class EveTUIRunner {}}- #renderCommandOutcome(text: string | undefined, tone?: "success" | "error"): void {- if (text === undefined) return;- if (this.#renderer.renderCommandResult !== undefined) {- this.#renderer.renderCommandResult(text, tone);+ #finishCommand(outcome: CommandPresentation): void {+ if (this.#renderer.finishCommand !== undefined) {+ this.#renderer.finishCommand(outcome);return;}- this.#renderer.renderNotice?.(text);+ if (outcome.kind === "result") {+ const notice = [outcome.summary, outcome.message].filter(Boolean).join("\n");+ if (notice !== "") this.#renderer.renderNotice?.(notice);+ }}async #handleExtensionCommand(@@ -1808,7 +1805,7 @@ export class EveTUIRunner {return settled;} catch {return {- tone: "error",+ failed: true,message:"Settings were saved, but the agent could not reload. Retry the command or restart eve dev.",};@@ -1832,10 +1829,13 @@ export class EveTUIRunner {const outcome =pendingOutcome === undefined ? undefined : await this.#settleCommandOutcome(pendingOutcome);const suppressTranscript =- (input.suppressSuccessfulTranscript === true && outcome?.tone !== "error") ||+ (input.suppressSuccessfulTranscript === true && outcome?.failed !== true) ||(input.suppressCancelledTranscript === true && outcome?.cancelled === true);- if (!suppressTranscript && input.trigger !== "startup")- this.#renderCommandOutcome(outcome?.message, outcome?.tone);+ if (!suppressTranscript && input.trigger !== "startup") {+ if (outcome === undefined) this.#finishCommand({ kind: "result" });+ else+ this.#finishCommand({ kind: "result", message: outcome.message, summary: outcome.summary });+ }this.#refreshHeaderFromRemoteConnection();return outcome;}@@ -1847,12 +1847,12 @@ export class EveTUIRunner {title,{ trigger: "startup", initialModelStep: "provider" },);- if (!outcome?.cancelled && outcome?.tone !== "error")+ if (!outcome?.cancelled && outcome?.failed !== true)this.#onOnboardingStep?.({ flow: "onboarding", step: "connection_ready" });this.#onOnboardingTerminal?.({flow: "onboarding",step: "model_provider",- result: outcome?.cancelled ? "cancelled" : outcome?.tone === "error" ? "error" : "completed",+ result: outcome?.cancelled ? "cancelled" : outcome?.failed === true ? "error" : "completed",});return outcome;}@@ -1877,7 +1877,10 @@ export class EveTUIRunner {*/async #openTraceViewer(argument: string): Promise<void> {if (this.#appRoot === undefined || this.#renderer.traceViewer === undefined) {- this.#renderCommandOutcome("/traces is only available in local dev sessions.");+ this.#finishCommand({+ kind: "result",+ message: "/traces is only available in local dev sessions.",+ });return;}try {@@ -1889,22 +1892,29 @@ export class EveTUIRunner {} catch (error) {if (isInterruptedError(error)) return;throw error;+ } finally {+ this.#finishCommand({ kind: "dismiss" });}}async #showApplicationInfo(): Promise<void> {const appRoot = this.#appRoot;if (appRoot === undefined) {- this.#renderCommandOutcome("/info is only available in local dev sessions.");+ this.#finishCommand({+ kind: "result",+ message: "/info is only available in local dev sessions.",+ });return;}try {- this.#renderCommandOutcome(renderApplicationInfo(await this.#inspectApplication(appRoot)));+ const info = renderApplicationInfo(await this.#inspectApplication(appRoot));+ if (this.#renderer.showInfoPanel !== undefined) await this.#renderer.showInfoPanel(info);+ else this.#finishCommand({ kind: "result", message: info });} catch (error) {- this.#renderCommandOutcome(- `Couldn't inspect the application: ${toErrorMessage(error)}`,- "error",- );+ this.#finishCommand({+ kind: "result",+ message: `Couldn't inspect the application: ${toErrorMessage(error)}`,+ });}}diff --git a/packages/eve/src/cli/dev/tui/setup-commands.test.ts b/packages/eve/src/cli/dev/tui/setup-commands.test.tsindex 2513af62d..ac58eb642 100644--- a/packages/eve/src/cli/dev/tui/setup-commands.test.ts+++ b/packages/eve/src/cli/dev/tui/setup-commands.test.ts@@ -8,7 +8,6 @@ import { WizardCancelledError } from "#setup/step.js";import {runTuiSetupCommand,- SETUP_FLOW_CONFIG,type TuiSetupCommandInput,type TuiSetupCommandRenderer,type TuiSetupFlows,@@ -51,7 +50,7 @@ function fakePanelRenderer(): TuiSetupCommandRenderer & {function registryResult(overrides: Partial<RegistrySessionResult> = {}) {return {kind: "done" as const,- result: { items: [], failures: [], ...overrides },+ result: { outcomes: [], ...overrides },};}@@ -70,7 +69,7 @@ function fakeFlows(overrides: Partial<TuiSetupFlows> = {}): TuiSetupFlows {}function run(input: {- command: "add" | "deploy";+ command: "add" | "deploy" | "login";flows: TuiSetupFlows;renderer?: TuiSetupCommandRenderer;initialModelStep?: "provider";@@ -78,6 +77,8 @@ function run(input: {useDefaultPrompter?: boolean;upgradeChoice?: "upgrade" | "later";withExclusiveTerminal?: TuiSetupCommandInput["withExclusiveTerminal"];+ initialRegistryAddress?: string;+ initialLoginConnection?: TuiSetupCommandInput["initialLoginConnection"];}) {const { upgradeChoice } = input;const fake = createFakePrompter(@@ -90,6 +91,12 @@ function run(input: {flows: input.flows,};if (input.agentRoot !== undefined) commandInput.agentRoot = input.agentRoot;+ if (input.initialLoginConnection !== undefined) {+ commandInput.initialLoginConnection = input.initialLoginConnection;+ }+ if (input.initialRegistryAddress !== undefined) {+ commandInput.initialRegistryAddress = input.initialRegistryAddress;+ }if (input.useDefaultPrompter !== true) commandInput.createPrompter = () => fake.prompter;if (input.initialModelStep !== undefined) {commandInput.initialModelStep = input.initialModelStep;@@ -173,46 +180,66 @@ describe("runTuiSetupCommand", () => {expect(renderer.setStatus).toHaveBeenCalledWith("Adding Web Chat · 1 of 4");});- it("uses the build pulse for every setup command except deploy", () => {- expect(- Object.fromEntries(- Object.entries(SETUP_FLOW_CONFIG).map(([command, config]) => [command, config.indicator]),- ),- ).toEqual({- login: "pulse",- add: "pulse",- deploy: "spinner",- });- });+ const installed = {+ kind: "installed" as const,+ title: "Agent Browser",+ facts: [],+ output: [],+ };it.each([["added",- registryResult({- items: [{ title: "Agent Browser", facts: [], output: [] }],- }),- "Added Agent Browser\n\n ✓ Agent Browser\n Installed.",+ registryResult({ outcomes: [installed] }),+ { message: "", preserveFlowDiagnostics: false },+ ],+ [+ "deployed",+ registryResult({ outcomes: [installed], deployed: "production" }),+ { message: "", effect: { kind: "deployed" } },],- ["empty", registryResult(), "No integrations selected."],- ["deployed", registryResult({ deployed: "production" }), "No integrations selected."],- ["cancelled", { kind: "cancelled" as const }, ""],- ] as const)("reports a %s registry flow", async (_case, result, message) => {+ ["empty", registryResult(), { message: "", cancelled: true }],+ ["cancelled", { kind: "cancelled" as const }, { message: "", cancelled: true }],+ ] as const)("reports a %s registry flow", async (_case, result, expected) => {const runRegistryFlow = vi.fn(async () => result);const outcome = await run({ command: "add", flows: fakeFlows({ runRegistryFlow }) });- expect(outcome).toMatchObject({- message,- preserveFlowDiagnostics: result.kind !== "cancelled",- });- if (result.kind === "done" && result.result.items.length > 0)- expect(outcome.tone).toBe("success");- if (result.kind === "done" && result.result.deployed === "production") {- expect(outcome.effect).toEqual({ kind: "deployed" });- }+ expect(outcome).toMatchObject(expected);expect(runRegistryFlow).toHaveBeenCalledWith(expect.objectContaining({ appRoot: APP_ROOT, installRoot: undefined }),);});+ it("keeps flow warnings only as notes on the add outcome", async () => {+ const renderer = fakePanelRenderer();+ const runRegistryFlow = vi.fn<TuiSetupFlows["runRegistryFlow"]>(async ({ prompter }) => {+ prompter.log.warning("Wait for the Slack request to expire before retrying.");+ return registryResult({+ outcomes: [+ {+ kind: "incomplete",+ title: "channel/slack",+ resumeCommand: "eve add channel/slack --skip-install",+ },+ ],+ });+ });++ await expect(+ run({+ command: "add",+ flows: fakeFlows({ runRegistryFlow }),+ renderer,+ useDefaultPrompter: true,+ }),+ ).resolves.toEqual({+ message:+ "Finish with `eve add channel/slack --skip-install`\n" ++ "⚠ Wait for the Slack request to expire before retrying.",+ summary: "Added channel/slack · setup not finished",+ preserveFlowDiagnostics: false,+ });+ });+it("keeps shared setup at the workspace root while installing into its agent", async () => {const runRegistryFlow = vi.fn<TuiSetupFlows["runRegistryFlow"]>(async () => registryResult());await run({@@ -229,59 +256,60 @@ describe("runTuiSetupCommand", () => {);});- it("reports completed items and skipped failures together", async () => {+ it("reports a failed installation as an error without its flow logs", async () => {const flows = fakeFlows({- runRegistryFlow: vi.fn<TuiSetupFlows["runRegistryFlow"]>(async () => ({- kind: "done",- result: {- items: [- {- title: "Photon iMessage",- output: [],- facts: [{ label: "Agent phone number", value: "+15551234567" }],- },- ],- failures: [+ runRegistryFlow: vi.fn<TuiSetupFlows["runRegistryFlow"]>(async () =>+ registryResult({+ outcomes: [{- title: "GitHub",+ kind: "failed",+ title: "connection/github",message: "Refusing to overwrite github.ts",},],- },- })),+ }),+ ),});- await expect(run({ command: "add", flows })).resolves.toMatchObject({- message: expect.stringContaining("⨯ GitHub"),- preserveFlowDiagnostics: true,+ await expect(run({ command: "add", flows })).resolves.toEqual({+ message: "Refusing to overwrite github.ts",+ summary: "Couldn't add connection/github",+ failed: true,+ preserveFlowDiagnostics: false,});});- it("headlines a completely failed registry batch", async () => {+ it("summarizes a login with its connection", async () => {const flows = fakeFlows({- runRegistryFlow: vi.fn<TuiSetupFlows["runRegistryFlow"]>(async () => ({- kind: "done",- result: {- items: [],- failures: [- { title: "Web Chat", message: "Dependency installation failed." },- { title: "Vercel", message: "Connector setup failed." },- ],- },- })),+ runModelLogin: vi.fn(async () => ({ kind: "ready" as const, reload: false })),});- await expect(run({ command: "add", flows })).resolves.toMatchObject({- message: expect.stringMatching(/^\/add failed — 2 additions: 2 failed/),- tone: "error",- preserveFlowDiagnostics: true,+ await expect(+ run({ command: "login", flows, initialLoginConnection: "vercel" }),+ ).resolves.toMatchObject({+ message: "",+ summary: "Connected with Vercel Account",+ });+ });++ it("summarizes a cancelled login without the onboarding hint", async () => {+ const flows = fakeFlows({+ runModelLogin: vi.fn(async () => ({ kind: "cancelled" as const })),+ });++ await expect(run({ command: "login", flows })).resolves.toEqual({+ message: "",+ summary: "Login cancelled",+ cancelled: true,+ preserveFlowDiagnostics: false,});});it("reports the production URL after a deploy", async () => {const flows = fakeFlows();await expect(run({ command: "deploy", flows })).resolves.toEqual({- message: "Deployed: https://my-agent.vercel.app",+ message: "",+ summary: "Deployed to https://my-agent.vercel.app",preserveFlowDiagnostics: true,effect: { kind: "deployed" },});@@ -302,17 +330,7 @@ describe("runTuiSetupCommand", () => {}),),).rejects.toBeInstanceOf(WizardCancelledError);- return registryResult({- items: [- { title: "Web Chat", facts: [], output: [] },- { title: "Notion", facts: [], output: [] },- ],- outcomes: [- { kind: "installed", title: "Web Chat", facts: [], output: [] },- { kind: "cancelled", title: "Slack" },- { kind: "installed", title: "Notion", facts: [], output: [] },- ],- });+ return registryResult({ outcomes: [{ kind: "cancelled", title: "channel/slack" }] });}),});@@ -320,10 +338,27 @@ describe("runTuiSetupCommand", () => {renderer.fireInterrupt();await expect(result).resolves.toEqual({- message:- "3 additions: 2 added, 1 cancelled\n\n ✓ Web Chat\n Installed.\n\n" +- " – Slack\n Cancelled.\n\n ✓ Notion\n Installed.",- preserveFlowDiagnostics: true,+ message: "",+ summary: "channel/slack not added",+ cancelled: true,+ preserveFlowDiagnostics: false,+ });+ });++ it("summarizes an addressed add that fails before any item settles", async () => {+ const flows = fakeFlows({+ runRegistryFlow: vi.fn<TuiSetupFlows["runRegistryFlow"]>(async () => {+ throw new Error("Registry unavailable.");+ }),+ });++ await expect(+ run({ command: "add", flows, initialRegistryAddress: "connection/sentry" }),+ ).resolves.toEqual({+ message: "Registry unavailable.",+ summary: "Couldn't add connection/sentry",+ failed: true,+ preserveFlowDiagnostics: false,});});@@ -388,16 +423,22 @@ describe("runTuiSetupCommand", () => {const flows = fakeFlows({runRegistryFlow: vi.fn(async () => {throw new RegistryFlowFailedError(cause, {- items: [{ title: "Web Chat", facts: [], output: [] }],- failures: [],+ outcomes: [+ {+ kind: "installed",+ title: "Web Chat",+ facts: [{ label: "URL", value: "http://localhost:3000" }],+ output: [],+ },+ ],});}),});await expect(run({ command: "add", flows })).resolves.toMatchObject({- message: expect.stringMatching(/^Added Web Chat[\s\S]*run \/deploy/),+ message: expect.stringMatching(/^URL {2}http:\/\/localhost:3000\n[\s\S]*run \/deploy/),partial: true,- tone: "error",+ failed: true,});});@@ -414,7 +455,8 @@ describe("runTuiSetupCommand", () => {await expect(run({ command: "deploy", flows })).resolves.toEqual({message:"Vercel denied access to that team — check your team access and SSO, then retry /deploy.",- tone: "error",+ summary: "Couldn't deploy",+ failed: true,preserveFlowDiagnostics: true,});});@@ -430,7 +472,9 @@ describe("runTuiSetupCommand", () => {}),});await expect(run({ command: "deploy", flows })).resolves.toMatchObject({- message: expect.stringMatching(/^\/deploy failed: /),+ message:+ "Human action required: `vercel link` — Deployment needs this directory linked to a Vercel project.",+ failed: true,});});@@ -446,7 +490,8 @@ describe("runTuiSetupCommand", () => {});await expect(run({ command: "deploy", flows })).resolves.toEqual({message: "The Vercel CLI isn't installed — run /deploy to install it, then retry /deploy.",- tone: "error",+ summary: "Couldn't deploy",+ failed: true,preserveFlowDiagnostics: true,});});diff --git a/packages/eve/src/cli/dev/tui/setup-commands.ts b/packages/eve/src/cli/dev/tui/setup-commands.tsindex fc49ae2f0..706591efb 100644--- a/packages/eve/src/cli/dev/tui/setup-commands.ts+++ b/packages/eve/src/cli/dev/tui/setup-commands.ts@@ -1,5 +1,6 @@import type { ModelAccessChange, ModelConnectionSelection } from "#shared/model-connection.js";import { runModelLogin } from "#setup/flows/model-login.js";+import { LOGIN_CONNECTION_OPTIONS } from "#setup/flows/model-login-options.js";import { HumanActionRequiredError } from "#setup/human-action.js";import { runDeployFlow } from "#setup/flows/deploy.js";import {@@ -11,29 +12,17 @@ import { RegistryFlowFailedError, runRegistryFlow } from "#setup/flows/registry.import type { Prompter } from "#setup/prompter.js";import { WizardCancelledError } from "#setup/step.js";-import {- formatRegistrySessionResult,- registryItemProgress,- registryResultTone,-} from "./registry-result-message.js";+import type { RegistrySessionResult } from "#setup/flows/registry-session.js";++import { registryCommandOutcome, registryItemProgress } from "./registry-result-message.js";+import type { PromptCommandOutcome } from "./runner.js";import { createTuiPrompter, type TuiPrompterRenderer } from "./tui-prompter.js";import type { PromptCommandExtensionName } from "./prompt-commands.js";-import type { SetupFlowIndicator, SetupFlowRenderer } from "./setup-flow.js";+import type { SetupFlowRenderer } from "./setup-flow.js";import type { VercelStatusEffect } from "./vercel-status.js";export type TuiSetupCommand = Exclude<PromptCommandExtensionName, "model">;-/**- * Panel title and loading indicator per command. The bordered panel never- * repeats the echoed command verbatim, but it keeps a constant title as flows- * move past their opening question.- */-export const SETUP_FLOW_CONFIG = {- login: { title: "", indicator: "pulse" },- add: { title: "", indicator: "pulse" },- deploy: { title: "", indicator: "spinner" },-} satisfies Record<TuiSetupCommand, { title: string; indicator: SetupFlowIndicator }>;-export type TuiSetupCommandRenderer = TuiPrompterRenderer &Pick<SetupFlowRenderer, "readProviderPicker" | "setNavigation" | "waitForInterrupt">;@@ -83,14 +72,15 @@ export interface TuiSetupFlows {runDeployFlow: typeof runDeployFlow;}-export interface TuiSetupCommandResult {+/** Setup owns flow-close behavior; the command adapter receives only the transcript outcome. */+export interface TuiSetupCommandResult extends PromptCommandOutcome {message: string;/** The user dismissed this setup step without completing it. */cancelled?: true;/** Keep settled batch results instead of replacing them with an interrupt notice. */partial?: true;- /** Promotes an outcome to a top-level status. */- tone?: "success" | "error";+ /** Replaces the echoed invocation once the command settles. */+ summary?: string;/** Keep warning/error lines after the bordered panel closes. */preserveFlowDiagnostics: boolean;/** Status refresh required after the command settles. */@@ -105,7 +95,8 @@ export interface TuiSetupCommandResult {function muteableRenderer(renderer: TuiSetupCommandRenderer,isMuted: () => boolean,- withSuspendedRuntime?: TuiSetupCommandInput["withExclusiveTerminal"],+ withSuspendedRuntime: TuiSetupCommandInput["withExclusiveTerminal"],+ warnings: string[],): MuteableSetupRenderer {return {readSelect: (options) =>@@ -128,6 +119,7 @@ function muteableRenderer(if (!isMuted()) renderer.setStatus(text);},renderLine: (text, tone) => {+ if (tone === "warning") warnings.push(text);if (!isMuted() || tone === "warning" || tone === "error") {renderer.renderLine(text, tone);}@@ -163,7 +155,14 @@ export async function runTuiSetupCommand(const { command } = input;let interrupted = false;const controller = new AbortController();- const renderer = muteableRenderer(input.renderer, () => interrupted, input.withExclusiveTerminal);+ // Flow warnings outlive the panel only as short notes on the `/add` outcome.+ const warnings: string[] = [];+ const renderer = muteableRenderer(+ input.renderer,+ () => interrupted,+ input.withExclusiveTerminal,+ warnings,+ );const prompter = (input.createPrompter ?? createTuiPrompter)(renderer);let cancelActiveRegistryItem: (() => void) | undefined;@@ -186,6 +185,7 @@ export async function runTuiSetupCommand(renderer,controller.signal,runRegistryItem,+ warnings,);const outcomePromise = execution.then((value) => ({ kind: "outcome" as const, value }));try {@@ -196,7 +196,7 @@ export async function runTuiSetupCommand(outcomePromise,interrupt.promise.then((interrupt) => ({ kind: "interrupt" as const, interrupt })),]);- if (settled.kind === "outcome") return settled.value;+ if (settled.kind === "outcome") return withCommandSummary(input, settled.value);if (command === "add" &&settled.interrupt === "escape" &&@@ -208,13 +208,12 @@ export async function runTuiSetupCommand(interrupted = true;controller.abort(new WizardCancelledError());const outcome = await execution;- return outcome.partial === true- ? outcome- : {- ...outcome,- ...cancelledSetupResult(),- tone: undefined,- };+ return withCommandSummary(+ input,+ outcome.partial === true+ ? outcome+ : { ...outcome, ...cancelledSetupResult(), failed: undefined, summary: undefined },+ );}} finally {interrupt.dispose();@@ -234,6 +233,7 @@ async function executeSetupCommand(renderer: MuteableSetupRenderer,signal: AbortSignal,runRegistryItem: <T>(task: (signal?: AbortSignal) => Promise<T>) => Promise<T>,+ warnings: readonly string[],): Promise<TuiSetupCommandResult> {const { command, appRoot } = input;const flows: TuiSetupFlows = {@@ -256,21 +256,30 @@ async function executeSetupCommand(connectionMessage: "",withConnectionUpdate: input.withExclusiveTerminal,});- return result.kind === "cancelled"- ? {- message: "Connect a model with /login when you’re ready.",- cancelled: true,- preserveFlowDiagnostics: false,- }- : {- message: "Connected. Start chatting · /add to extend your agent",- effect: {- kind: "model-access-changed",- reload: result.reload,- ...(result.model && { model: result.model }),- },- preserveFlowDiagnostics: false,- };+ if (result.kind === "cancelled") {+ return {+ // Onboarding has no echoed `/login` to summarize, so it keeps the hint.+ message:+ input.initialModelStep === "provider"+ ? "Connect a model with /login when you’re ready."+ : "",+ cancelled: true,+ preserveFlowDiagnostics: false,+ };+ }+ const connection = LOGIN_CONNECTION_OPTIONS.find(+ (option) => option.value === input.initialLoginConnection,+ );+ return {+ message: "",+ summary: connection === undefined ? "Connected" : `Connected with ${connection.label}`,+ effect: {+ kind: "model-access-changed",+ reload: result.reload,+ ...(result.model && { model: result.model }),+ },+ preserveFlowDiagnostics: false,+ };}case "add": {const flow = await flows.runRegistryFlow({@@ -283,24 +292,12 @@ async function executeSetupCommand(onItemStart: registryItemProgress(renderer),runItem: runRegistryItem,});- if (flow.kind === "cancelled") {+ if (flow.kind === "cancelled" || flow.result.outcomes.length === 0) {return cancelledSetupResult();}- const result = flow.result;- const tone = registryResultTone(result);- const report =- result.items.length > 0 || result.failures.length > 0 || result.outcomes !== undefined- ? formatRegistrySessionResult(result)- : "No integrations selected.";- const outcome: TuiSetupCommandResult = {- message: tone === "error" ? `/add failed — ${report}` : report,- preserveFlowDiagnostics: true,- };- if (result.cancelled === true) {- outcome.partial = true;- outcome.tone = "error";- } else if (tone !== undefined) outcome.tone = tone;- if (result.deployed === "production") outcome.effect = { kind: "deployed" };+ const outcome = registryResult(flow.result, warnings);+ if (flow.result.cancelled === true) outcome.partial = true;+ if (flow.result.deployed === "production") outcome.effect = { kind: "deployed" };return outcome;}case "deploy": {@@ -312,6 +309,7 @@ async function executeSetupCommand(return {message:"Not linked to a Vercel project. Run eve deploy in an interactive terminal to link it.",+ failed: true,preserveFlowDiagnostics: true,};}@@ -319,12 +317,14 @@ async function executeSetupCommand(return {message:"ChatGPT subscription models are local-only. Switch to an AI Gateway or server-authenticated model before deploying.",+ failed: true,preserveFlowDiagnostics: true,};}return {- message:- result.productionUrl === undefined ? "Deployed." : `Deployed: ${result.productionUrl}`,+ message: "",+ summary:+ result.productionUrl === undefined ? "Deployed" : `Deployed to ${result.productionUrl}`,preserveFlowDiagnostics: true,effect: { kind: "deployed" },};@@ -340,39 +340,85 @@ async function executeSetupCommand(prompter,signal,});- if (upgrade !== undefined) return withRegistryResults(upgrade, error);+ if (upgrade !== undefined) return withRegistryResults(upgrade, error, warnings);// Provisioning steps (link, deploy, Slack) throw a Vercel human action when// `whoami` fails or a scope is denied. Route it to the in-TUI fix instead of// dumping the raw "Human action required" message.const routed = vercelActionOutcome(actionableError, command);- if (routed !== undefined) return withRegistryResults(routed, error);+ if (routed !== undefined) return withRegistryResults(routed, error, warnings);if (error instanceof RegistryFlowFailedError) {- return {- message: `${formatRegistrySessionResult(error.completed)}\n\n${error.message}`,- partial: true,- tone: "error",- preserveFlowDiagnostics: true,- };+ return withRegistryResults(+ { message: error.message, failed: true, preserveFlowDiagnostics: false },+ error,+ warnings,+ );}return {- message: `/${command} failed: ${error instanceof Error ? error.message : String(error)}`,- tone: "error",- preserveFlowDiagnostics: true,+ message: error instanceof Error ? error.message : String(error),+ failed: true,+ preserveFlowDiagnostics: command !== "add",};}}+function fallbackSummaries(+ input: TuiSetupCommandInput,+): { error: string; cancelled: string } | undefined {+ switch (input.command) {+ case "add": {+ const address = input.initialRegistryAddress;+ if (address === undefined) return undefined;+ return { error: `Couldn't add ${address}`, cancelled: `${address} not added` };+ }+ case "login":+ return { error: "Couldn't connect a model", cancelled: "Login cancelled" };+ case "deploy":+ return { error: "Couldn't deploy", cancelled: "Deploy cancelled" };+ }+}++/** Failed and cancelled outcomes leave a summary in place of their invocation too. */+function withCommandSummary(+ input: TuiSetupCommandInput,+ outcome: TuiSetupCommandResult,+): TuiSetupCommandResult {+ const summaries = fallbackSummaries(input);+ if (outcome.summary !== undefined || summaries === undefined) return outcome;+ if (outcome.failed === true) return { ...outcome, summary: summaries.error };+ if (outcome.cancelled === true) return { ...outcome, summary: summaries.cancelled };+ return outcome;+}++function registryResult(+ result: RegistrySessionResult,+ warnings: readonly string[],+): TuiSetupCommandResult {+ const { failed, summary, message } = registryCommandOutcome(result, warnings);+ const cancelled =+ result.cancelled === true || result.outcomes.some((item) => item.kind === "cancelled");+ return {+ message,+ summary,+ ...(failed && { failed: true }),+ ...(!failed && cancelled && { cancelled: true }),+ preserveFlowDiagnostics: false,+ };+}+function withRegistryResults(outcome: TuiSetupCommandResult,error: unknown,+ warnings: readonly string[],): TuiSetupCommandResult {if (!(error instanceof RegistryFlowFailedError)) return outcome;+ const completed = registryResult(error.completed, warnings);return {...outcome,- message: `${formatRegistrySessionResult(error.completed)}\n\n${outcome.message}`,+ summary: completed.summary,+ message: [completed.message, outcome.message].filter((part) => part !== "").join("\n"),partial: true,- tone: "error",- preserveFlowDiagnostics: true,+ failed: true,+ preserveFlowDiagnostics: false,};}@@ -413,7 +459,7 @@ async function vercelCliUpgradeOutcome(if (choice === "later") {return {message: `The Vercel CLI needs an update — run \`vercel upgrade\`, then retry /${command}.`,- tone: "error",+ failed: true,preserveFlowDiagnostics: true,};}@@ -429,7 +475,7 @@ async function vercelCliUpgradeOutcome(} catch (error) {return {message: vercelCliUpgradeFailureMessage(command, errorMessage(error)),- tone: "error",+ failed: true,preserveFlowDiagnostics: true,};}@@ -437,25 +483,25 @@ async function vercelCliUpgradeOutcome(case "installed":return {message: `Upgraded the Vercel CLI. Retry /${command}.`,- tone: "error",+ failed: true,preserveFlowDiagnostics: false,};case "failed":return {message: vercelCliUpgradeFailureMessage(command, result.reason),- tone: "error",+ failed: true,preserveFlowDiagnostics: true,};case "cancelled":return {message: `Vercel CLI upgrade cancelled — run \`vercel upgrade\`, then retry /${command}.`,- tone: "error",+ failed: true,preserveFlowDiagnostics: true,};case "already":return {message: `The Vercel CLI is already up to date. Retry /${command}.`,- tone: "error",+ failed: true,preserveFlowDiagnostics: false,};}@@ -484,7 +530,7 @@ function vercelActionOutcome(error: unknown, command: string): TuiSetupCommandReconst message = vercelActionMessage(error.action.kind, command);return message === undefined? undefined- : { message, tone: "error", preserveFlowDiagnostics: true };+ : { message, failed: true, preserveFlowDiagnostics: true };}/** The one-line fix message per Vercel action kind, or `undefined` for others. */diff --git a/packages/eve/src/cli/dev/tui/setup-flow.ts b/packages/eve/src/cli/dev/tui/setup-flow.tsindex c611ea08d..6adbd3a80 100644--- a/packages/eve/src/cli/dev/tui/setup-flow.ts+++ b/packages/eve/src/cli/dev/tui/setup-flow.ts@@ -9,12 +9,6 @@ export type SetupEditableSelectResult =| { kind: "selected"; value: string }| { kind: "edited"; value: string; text: string };-/** Animation shown while a setup flow is between questions. */-export type SetupFlowIndicator = "spinner" | "pulse";--/** Ephemeral setup status, with external user action distinct from background work. */-export type SetupFlowStatus = string | { kind: "external-action"; text: string; emphasis: string };-interface SetupSelectRequestBase {message: string;description?: string;@@ -74,7 +68,7 @@ export type SetupSelectResult =export type SetupFlowInterrupt = "escape" | "ctrl-c";export interface SetupFlowRenderer {- begin(title: string, indicator?: SetupFlowIndicator): void;+ begin(title: string): void;/** Sets progress owned by an enclosing setup journey, independent of its active question. */setNavigation?(navigation: PlannerNavigation | undefined): void;end(options?: { preserveDiagnostics?: boolean }): void;@@ -109,7 +103,7 @@ export interface SetupFlowRenderer {* whichever settles first wins.*/readChoice(options: ChannelSetupChoiceOptions): ChannelSetupChoice;- setStatus(status: SetupFlowStatus | undefined): void;+ setStatus(status: string | undefined): void;renderLine(text: string, tone: "info" | "success" | "warning" | "error"): void;replaceContent?(content?: {headline: string;diff --git a/packages/eve/src/cli/dev/tui/setup-panel.test.ts b/packages/eve/src/cli/dev/tui/setup-panel.test.tsindex 43de76d3e..08a5dc28f 100644--- a/packages/eve/src/cli/dev/tui/setup-panel.test.ts+++ b/packages/eve/src/cli/dev/tui/setup-panel.test.ts@@ -4,11 +4,11 @@ import { initialSelectState } from "#setup/cli/select-state.js";import { lineOf } from "./line-editor.js";import {renderAcknowledgeQuestion,- renderFlowDrawer,renderFlowPanel,renderSelectQuestion,renderTextQuestion,} from "./setup-panel.js";+import { renderFlowDrawer } from "./flow-drawer.js";import { stripAnsi } from "#cli/ui/terminal-text.js";import { createTheme } from "./theme.js";@@ -105,7 +105,7 @@ describe("renderFlowPanel", () => {tone: "error",},],- content: { kind: "idle", indicator: { glyph: "▪", color: "green" } },+ content: { kind: "idle", indicator: { glyph: "▪" } },},theme,60,@@ -125,7 +125,7 @@ describe("renderFlowPanel", () => {{title: "/channels",lines,- content: { kind: "idle", indicator: { glyph: "⠏", color: "yellow" } },+ content: { kind: "idle", indicator: { glyph: "⠏" } },},theme,60,@@ -144,9 +144,8 @@ describe("renderFlowPanel", () => {content: {kind: "status",status: {- kind: "progress",text: "Loading teams…",- indicator: { glyph: "⠼", color: "yellow" },+ indicator: { glyph: "⠼" },},},},@@ -165,9 +164,8 @@ describe("renderFlowPanel", () => {content: {kind: "status",status: {- kind: "progress",text: "Checking the project…",- indicator: { glyph: "▪", color: "green" },+ indicator: { glyph: "▪" },},},},@@ -187,9 +185,8 @@ describe("renderFlowPanel", () => {content: {kind: "question",status: {- kind: "progress",text: "Creating a Slackbot through Vercel Connect…",- indicator: { glyph: "▪", color: "green" },+ indicator: { glyph: "▪" },},rows: [" Try again", " Cancel"],},@@ -207,7 +204,7 @@ describe("renderFlowPanel", () => {});describe("renderFlowDrawer", () => {- it("frames an active flow while keeping its title out of the body", () => {+ it("frames an active flow without repeating its command title", () => {const rows = renderFlowDrawer({title: "add to your agent",@@ -224,7 +221,7 @@ describe("renderFlowDrawer", () => {expect(rows.rows[0]).toBe("─".repeat(60));expect(rows.rows[1]).toBe("");- expect(rows.rows[2]).toBe(" ┃ add to your agent");+ 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);@@ -248,7 +245,7 @@ describe("renderFlowDrawer", () => {expect(drawer.controls).toEqual(["↑/↓ move · Enter select · Esc close"]);});- it("omits the drawer header for a titleless flow", () => {+ it("frames a flow without a redundant header", () => {const rows = renderFlowDrawer({title: "",@@ -264,6 +261,27 @@ describe("renderFlowDrawer", () => {controls: [],});});++ it("keeps a live status inside the drawer after flow progress", () => {+ const drawer = renderFlowDrawer(+ {+ title: "",+ lines: [{ text: "Checked credentials", tone: "success" }],+ content: {+ kind: "status",+ status: {+ text: "Loading teams…",+ indicator: { glyph: "⠼" },+ },+ },+ },+ theme,+ 60,+ );++ expect(drawer.rows.join("\n")).toContain("Loading teams…");+ expect(drawer.controls).toEqual([]);+ });});describe("renderSelectQuestion", () => {diff --git a/packages/eve/src/cli/dev/tui/setup-panel.ts b/packages/eve/src/cli/dev/tui/setup-panel.tsindex b7816bd30..3e105a4c6 100644--- a/packages/eve/src/cli/dev/tui/setup-panel.ts+++ b/packages/eve/src/cli/dev/tui/setup-panel.ts@@ -143,21 +143,16 @@ export interface FlowPanelLine {evidence?: boolean;}-/** One already-resolved animation frame and its active color. */+/** One already-resolved animation frame. */export interface FlowPanelIndicator {glyph: string;- color: "green" | "yellow";}-/** One live flow status after its animation frame and visual intent are resolved. */-export type FlowPanelStatus =- | { kind: "progress"; text: string; indicator: FlowPanelIndicator }- | {- kind: "external-action";- text: string;- emphasis: string;- indicator: FlowPanelIndicator;- };+/** One live flow status after its animation frame is resolved. */+export interface FlowPanelStatus {+ text: string;+ indicator: FlowPanelIndicator;+}export type FlowPanelContent =| {@@ -225,24 +220,11 @@ function toneGlyph(tone: FlowPanelLine["tone"], theme: Theme): string {}function renderIndicator(indicator: FlowPanelIndicator, theme: Theme): string {- return indicator.color === "green"- ? theme.colors.green(indicator.glyph)- : theme.colors.yellow(indicator.glyph);-}--function renderStatusText(status: FlowPanelStatus, theme: Theme): string {- if (status.kind === "progress") return theme.colors.dim(status.text);-- const start = status.text.indexOf(status.emphasis);- if (start === -1) return theme.colors.dim(status.text);- const end = start + status.emphasis.length;- return `${theme.colors.dim(status.text.slice(0, start))}${theme.colors.yellow(- status.text.slice(start, end),- )}${theme.colors.dim(status.text.slice(end))}`;+ return theme.colors.green(indicator.glyph);}function renderFlowPanelStatus(status: FlowPanelStatus, theme: Theme): string {- return `${renderIndicator(status.indicator, theme)} ${renderStatusText(status, theme)}`;+ return `${renderIndicator(status.indicator, theme)} ${theme.colors.dim(status.text)}`;}export function flowMessageRows(lines: readonly FlowPanelLine[], theme: Theme): string[] {@@ -329,43 +311,6 @@ export function renderFlowPanel(state: FlowPanelState, theme: Theme, width: numbreturn 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;diff --git a/packages/eve/src/cli/dev/tui/terminal-renderer.test.ts b/packages/eve/src/cli/dev/tui/terminal-renderer.test.tsindex aebc51464..13d0bbad1 100644--- a/packages/eve/src/cli/dev/tui/terminal-renderer.test.ts+++ b/packages/eve/src/cli/dev/tui/terminal-renderer.test.ts@@ -12,7 +12,7 @@ import {} from "#internal/nitro/host/dev-watcher-log.js";import type { AgentTUIStreamEvent, AgentTUIStreamResult, SubagentToolUpdate } from "./runner.js";-import { promptCommandsFor } from "./prompt-commands.js";+import { PROMPT_COMMANDS, promptCommandsFor } from "./prompt-commands.js";import { TerminalRenderer } from "./terminal-renderer.js";import { MockScreen, MockUserInput } from "./test/mock-terminal.js";@@ -1803,7 +1803,7 @@ describe("TerminalRenderer (inline scrollback)", () => {it("hangs a command outcome under its invocation with the elbow connector", () => {const { screen, renderer } = makeRenderer();- renderer.renderCommandResult("/model dismissed.");+ renderer.finishCommand({ kind: "result", message: "/model dismissed." });renderer.shutdown();expect(screen.snapshot()).toContain("\u23bf /model dismissed.");@@ -1811,9 +1811,10 @@ describe("TerminalRenderer (inline scrollback)", () => {it("strips complete ANSI styles from command outcomes", () => {const { screen, renderer } = makeRenderer();- renderer.renderCommandResult(- "Model changed to \u001b[1mchatgpt/gpt-5.6-sol\u001b[22m. Live on your next prompt.",- );+ renderer.finishCommand({+ kind: "result",+ message: "Model changed to \u001b[1mchatgpt/gpt-5.6-sol\u001b[22m. Live on your next prompt.",+ });renderer.shutdown();expect(screen.snapshot()).toContain(@@ -1825,42 +1826,119 @@ describe("TerminalRenderer (inline scrollback)", () => {it("hangs a successful command outcome from an elbow into a full-intensity rail", () => {const { screen, renderer } = makeRenderer();- renderer.renderCommandResult(- "Registry items added: channel/photon-imessage.\n" ++ renderer.finishCommand({+ kind: "result",+ message:+ "Registry items added: channel/photon-imessage.\n" +"Text your agent: +15550000000\n" +"Photon project: https://app.photon.codes/dashboard/project-id",- "success",- );+ });renderer.shutdown();const snapshot = screen.snapshot();- expect(snapshot).toContain("⎿ ✓ Registry items added: channel/photon-imessage.");- expect(snapshot).toContain("│ Text your agent: +15550000000");- expect(snapshot).toContain("└ Photon project: https://app.photon.codes/dashboard/project-id");- expect(screen.rawOutput()).toContain("\u001b[32m✓\u001b[39m");- expect(screen.rawOutput()).not.toContain("\u001b[2mText your agent");+ expect(snapshot).toContain("⎿ Registry items added: channel/photon-imessage.");+ expect(snapshot).toContain(" Text your agent: +15550000000");+ expect(snapshot).toContain(+ " Photon project: https://app.photon.codes/dashboard/project-id",+ );});it("keeps a single-line successful command result under the elbow", () => {const { screen, renderer } = makeRenderer();- renderer.renderCommandResult("Registry items added: connection/linear.", "success");+ renderer.finishCommand({ kind: "result", message: "Registry items added: connection/linear." });renderer.shutdown();- expect(screen.snapshot()).toContain("⎿ ✓ Registry items added: connection/linear.");+ expect(screen.snapshot()).toContain("⎿ Registry items added: connection/linear.");+ });++ it("pulses a running command's gutter", () => {+ const { screen, renderer } = makeRenderer();+ renderer.renderCommandInvocation("/add connection/notion");++ expect(screen.snapshot()).toMatch(/^[▪ ] \/add connection\/notion$/m);+ expect(screen.snapshot()).not.toContain("│ /add connection/notion");+ renderer.shutdown();+ });++ it("holds a running command's gutter still while its setup panel pulses", () => {+ const { screen, renderer } = makeRenderer();+ renderer.renderCommandInvocation("/deploy");+ renderer.setupFlow.begin("");++ expect(screen.snapshot()).toMatch(/^▪ \/deploy$/m);+ expect(screen.rawOutput()).toContain("\u001b[90m▪\u001b[39m /deploy");+ renderer.setupFlow.end();+ renderer.shutdown();+ });++ it("keeps a running command pending when an idle session stream closes", async () => {+ const { screen, renderer } = makeRenderer();+ renderer.renderCommandInvocation("/model anthropic/claude-opus-4.6 default");+ await renderer.renderIdleStream(streamOf([]));+ renderer.finishCommand({+ kind: "result",+ message: "",+ summary: "Model set to anthropic/claude-opus-4.6 default",+ });+ renderer.shutdown();++ const snapshot = screen.snapshot();+ expect(snapshot).toMatch(/^\* Model set to anthropic\/claude-opus-4.6 default$/m);+ expect(snapshot).not.toContain("/model anthropic");+ });++ it("replaces a settled command with its dimmed summary", () => {+ const { screen, renderer } = makeRenderer();+ renderer.renderCommandInvocation("/add connection/notion");+ renderer.finishCommand({ kind: "result", message: "", summary: "Added connection/notion" });+ renderer.shutdown();++ const snapshot = screen.snapshot();+ expect(snapshot).toMatch(/^\* Added connection\/notion$/m);+ expect(snapshot).not.toContain("/add connection/notion");+ expect(snapshot).not.toContain("⎿");+ expect(screen.rawOutput()).toContain("\u001b[2mAdded connection/notion");+ });++ it("hangs a settled command's details under its summary", () => {+ const { screen, renderer } = makeRenderer();+ renderer.renderCommandInvocation("/add channel/slack");+ renderer.finishCommand({+ kind: "result",+ message: "Finish with `eve add channel/slack --skip-install`",+ summary: "Added channel/slack · setup not finished",+ });+ renderer.shutdown();++ expect(screen.snapshot()).toMatch(+ /^\* Added channel\/slack · setup not finished\n {3}⎿ {2}Finish with `eve add channel\/slack --skip-install`$/m,+ );+ });++ it("keeps the invocation when a settled command has no summary", () => {+ const { screen, renderer } = makeRenderer();+ renderer.renderCommandInvocation("/deploy");+ renderer.finishCommand({ kind: "result", message: "Deployed: https://example.vercel.app" });+ renderer.shutdown();++ expect(screen.snapshot()).toMatch(+ /^\* \/deploy\n {3}⎿ {2}Deployed: https:\/\/example.vercel.app$/m,+ );});it("marks a failed automatic command and keeps its multiline outcome in one result block", () => {const { screen, renderer } = makeRenderer();- renderer.renderCommandInvocation("/deploy", "failed");- renderer.renderCommandResult(- "Authentication was refreshed, but example.vercel.app is unavailable: Access denied.\n\n" ++ renderer.renderCommandInvocation("/deploy");+ renderer.finishCommand({+ kind: "result",+ message:+ "Authentication was refreshed, but example.vercel.app is unavailable: Access denied.\n\n" +"TRUSTED_SOURCES_ENVIRONMENT_MISMATCH",- "error",- );+ });renderer.shutdown();const snapshot = screen.snapshot();- expect(snapshot).toContain("│ ⨯ /deploy");+ expect(snapshot).toMatch(/^\* \/deploy$/m);expect(snapshot).toContain("⎿ Authentication was refreshed");expect(snapshot).toContain("TRUSTED_SOURCES_ENVIRONMENT_MISMATCH");expect(snapshot).not.toContain("· Authentication was refreshed");@@ -2156,8 +2234,8 @@ describe("TerminalRenderer (inline scrollback)", () => {await vi.waitFor(() => {expect(cancel).toHaveBeenCalledOnce();- expect(screen.snapshot()).toContain("/cancel");- expect(screen.snapshot()).toContain("Turn cancellation requested.");+ expect(screen.snapshot()).toContain("* Cancellation requested");+ expect(screen.snapshot()).not.toContain("/cancel");expect(screen.snapshot()).toContain("Cancelling turn…");});@@ -2674,7 +2752,7 @@ describe("TerminalRenderer (inline scrollback)", () => {.split("\n").findIndex((line) => line.includes("Hello"));renderer.setStartupPhase("connecting");- renderer.setupFlow.begin("Connect a model", "pulse");+ renderer.setupFlow.begin("Connect a model");const interrupt = renderer.setupFlow.waitForInterrupt();renderer.setupFlow.setStatus("Connecting with Vercel…");expect(screen.snapshot()).toContain("Connecting with Vercel");@@ -2725,7 +2803,7 @@ describe("TerminalRenderer (inline scrollback)", () => {it("restores the startup draft after a masked key question is cancelled", async () => {const { renderer, input, screen } = makeRenderer();renderer.beginStartupDraft({ initialDraft: "My message", title: "Agent" });- renderer.setupFlow.begin("Connect a model", "pulse");+ renderer.setupFlow.begin("Connect a model");const answer = renderer.setupFlow.readText({ message: "API key", mask: true });input.type("private-test-key");expect(screen.snapshot()).not.toContain("private-test-key");@@ -3114,13 +3192,12 @@ describe("TerminalRenderer (inline scrollback)", () => {renderer.shutdown();});- it("paints a fully typed known command bold in the input line", async () => {+ it("leaves a fully typed known command as plain text in the input line", async () => {const { screen, input, renderer } = makeRenderer();const prompt = renderer.readPrompt();input.type("/add");- // Bold confirms command dispatch without competing with status color.- expect(screen.rawOutput()).toContain("[1m/add");+ expect(screen.rawOutput()).not.toContain("[1m/add");expect(screen.rawOutput()).not.toContain("[34m/add");input.enter();await prompt;@@ -4497,7 +4574,7 @@ describe("TerminalRenderer setup panel", () => {renderer.shutdown();});- it("commits toned flow lines to the transcript", () => {+ it("commits flow lines to the transcript with a shared marker", () => {const { screen, renderer } = makeRenderer();renderer.setupFlow.renderLine("Connected the agent to the Vercel AI Gateway.", "success");@@ -4505,8 +4582,8 @@ describe("TerminalRenderer setup panel", () => {renderer.shutdown();const snapshot = screen.snapshot();- expect(snapshot).toContain("✓ Connected the agent to the Vercel AI Gateway.");- expect(snapshot).toContain("· visit https://vercel.com/connect");+ expect(snapshot).toContain("* Connected the agent to the Vercel AI Gateway.");+ expect(snapshot).toContain("* visit https://vercel.com/connect");});});@@ -4516,7 +4593,7 @@ describe("TerminalRenderer setup flow session", () => {const message ="You need to link to a project to use linear through Vercel Connect.\n\nSelect your team";- renderer.setupFlow.begin("Add to your agent", "pulse");+ renderer.setupFlow.begin("Add to your agent");const answer = renderer.setupFlow.readSelect({kind: "single",message,@@ -4539,7 +4616,7 @@ describe("TerminalRenderer setup flow session", () => {vi.useFakeTimers();try {const { screen, renderer } = makeRenderer();- renderer.setupFlow.begin("Add integration", "pulse");+ renderer.setupFlow.begin("Add integration");renderer.beginSubagent({ callId: "background", name: "researcher" });renderer.backgroundSubagent({ callId: "background" });let release!: () => void;@@ -4563,7 +4640,7 @@ describe("TerminalRenderer setup flow session", () => {const { screen, input, renderer } = makeRenderer();renderer.renderNotice("anchor");- renderer.setupFlow.begin("Add integration", "pulse");+ renderer.setupFlow.begin("Add integration");let inherited = false;await renderer.setupFlow.withInheritedStdio(async () => {inherited = true;@@ -4575,7 +4652,7 @@ describe("TerminalRenderer setup flow session", () => {expect(inherited).toBe(true);expect(input.resumeCalls).toBe(2);expect(screen.snapshot()).toContain("anchor");- expect(screen.snapshot()).toContain("Add integration");+ expect(screen.snapshot()).not.toContain("┃ Add integration");expect(screen.snapshot()).not.toContain("temporary OAuth instructions");renderer.setupFlow.end();renderer.shutdown();@@ -4583,7 +4660,7 @@ describe("TerminalRenderer setup flow session", () => {it("discards input without interrupting a non-interruptible flow", async () => {const { input, renderer } = makeRenderer();- renderer.setupFlow.begin("Add to your agent", "pulse");+ renderer.setupFlow.begin("Add to your agent");const interrupt = renderer.setupFlow.waitForInterrupt({ interruptible: false });let interrupted = false;void interrupt.promise.then(() => {@@ -4604,7 +4681,7 @@ describe("TerminalRenderer setup flow session", () => {try {const { screen, renderer } = makeRenderer();- renderer.setupFlow.begin("Configure the agent model", "pulse");+ renderer.setupFlow.begin("Configure the agent model");renderer.setupFlow.setStatus("Checking the project…");expect(screen.snapshot()).toContain("▪ Checking the project…");@@ -4622,7 +4699,7 @@ describe("TerminalRenderer setup flow session", () => {try {const { screen, renderer } = makeRenderer();- renderer.setupFlow.begin("Add to your agent", "pulse");+ renderer.setupFlow.begin("Add to your agent");renderer.setupFlow.setStatus("Installing Slack and dependencies…");expect(screen.snapshot()).not.toContain("5s");@@ -4634,18 +4711,15 @@ describe("TerminalRenderer setup flow session", () => {}});- it("uses the attention color for an external-action pulse", () => {+ it("keeps a browser wait on the green pulse without highlighting its text", () => {const { screen, renderer } = makeRenderer();- renderer.setupFlow.begin("Agent connections", "pulse");- renderer.setupFlow.setStatus({- kind: "external-action",- text: "Waiting for you to complete setup in the browser…",- emphasis: "browser",- });+ renderer.setupFlow.begin("Agent connections");+ renderer.setupFlow.setStatus("Finish signing in to Vercel in your browser");- expect(screen.rawOutput()).toContain("\x1b[33m▪\x1b[39m");- expect(screen.rawOutput()).toContain("\x1b[33mbrowser\x1b[39m");+ expect(screen.rawOutput()).toContain("\x1b[32m▪\x1b[39m");+ expect(screen.rawOutput()).toContain("\x1b[2mFinish signing in to Vercel in your browser");+ expect(screen.rawOutput()).not.toContain("\x1b[33m");renderer.shutdown();});@@ -4659,7 +4733,7 @@ describe("TerminalRenderer setup flow session", () => {unicode: false,});- renderer.setupFlow.begin("Configure the agent model", "pulse");+ renderer.setupFlow.begin("Configure the agent model");renderer.setupFlow.setStatus("Checking the project...");expect(screen.snapshot()).toContain("* Checking the project...");@@ -4677,7 +4751,7 @@ describe("TerminalRenderer setup flow session", () => {renderer.setupFlow.setStatus("Loading teams…");let snapshot = screen.snapshot();- expect(snapshot).toContain("/deploy");+ expect(snapshot).not.toContain("┃ /deploy");expect(snapshot).toContain("Creating Vercel project…");expect(snapshot).toContain("Loading teams…");@@ -4702,7 +4776,10 @@ describe("TerminalRenderer setup flow session", () => {"warning",);renderer.setupFlow.end({ preserveDiagnostics: false });- renderer.renderCommandResult("Project linked. Connected to AI Gateway via VERCEL_OIDC_TOKEN.");+ renderer.finishCommand({+ kind: "result",+ message: "Project linked. Connected to AI Gateway via VERCEL_OIDC_TOKEN.",+ });renderer.shutdown();const snapshot = screen.snapshot();@@ -4723,7 +4800,9 @@ describe("TerminalRenderer setup flow session", () => {});const snapshot = screen.snapshot();- expect(snapshot).toContain("┃ /deploy");+ expect(snapshot).not.toContain("┃ /deploy");+ expect(snapshot).toContain("Vercel project");+ expect(snapshot).toMatch(/─{20,}/);expect(snapshot).toContain("This directory is not linked yet.");expect(snapshot).toContain("Vercel project");@@ -5192,7 +5271,7 @@ describe("TerminalRenderer command echo spacing", () => {input.type("/connect");input.enter();await prompt;- renderer.renderCommandResult("Project linked.");+ renderer.finishCommand({ kind: "result", message: "Project linked." });renderer.shutdown();const lines = screen.snapshot().split("\n");@@ -5214,8 +5293,8 @@ describe("TerminalRenderer command typeahead", () => {expect(snapshot).toContain("/help");expect(snapshot).toContain("Show available commands");expect(snapshot).toContain("Choose a model, speed, and reasoning");- const promptLine = snapshot.split("\n").find((line) => line.includes("❯ /"));- expect(promptLine?.startsWith("❯ /")).toBe(true);+ const promptLine = snapshot.split("\n").find((line) => line.includes("│ /"));+ expect(promptLine?.startsWith("│ /")).toBe(true);input.enter();// The highlighted default — /model leads the registry — is what a bare@@ -5326,7 +5405,7 @@ describe("TerminalRenderer command typeahead", () => {input.type("/model sol");await vi.waitFor(() => expect(screen.snapshot()).toContain("openai/gpt-6-sol"));input.enter();- expect(screen.snapshot()).toContain("❯ /model openai/gpt-6-sol ");+ expect(screen.snapshot()).toContain("│ /model openai/gpt-6-sol ");expect(screen.snapshot()).toContain("high");input.enter();@@ -5425,6 +5504,152 @@ describe("TerminalRenderer command typeahead", () => {expect(screen.snapshot()).toContain("│ /quit");});+ it("keeps a submitted /help invocation above its transient drawer", async () => {+ const { input, renderer, screen } = makeRenderer();+ const prompt = renderer.readPrompt();+ input.type("/help");+ input.enter();+ expect(await prompt).toBe("/help");++ const choice = renderer.choosePromptCommand(PROMPT_COMMANDS);+ const open = screen.snapshot().split("\n");+ expect(open.filter((line) => line.startsWith("│ /help"))).toEqual(["│ /help"]);+ expect(open.indexOf("│ /help")).toBeLessThan(open.findIndex((line) => /^─{20,}$/.test(line)));+ input.send("\x1b");+ expect(await choice).toBeUndefined();+ expect(screen.snapshot()).not.toContain("Show available commands");+ expect(screen.snapshot()).not.toContain("│ /help");+ renderer.renderCommandInvocation("/model anthropic/claude-opus-4.8");+ renderer.finishCommand({+ kind: "result",+ message: "",+ summary: "Model set to anthropic/claude-opus-4.8",+ });+ renderer.shutdown();+ expect(screen.snapshot()).toContain("Model set to anthropic/claude-opus-4.8");+ expect(screen.snapshot()).not.toContain("/help");+ });++ it("lets /help choose a command without retaining the drawer", async () => {+ const { input, renderer, screen } = makeRenderer();+ const choice = renderer.choosePromptCommand(PROMPT_COMMANDS);++ const open = screen.snapshot();+ expect(open).not.toContain("┃ Commands");+ expect(open).toContain("/model");+ expect(open).toContain("↑/↓ move · Enter select · Esc close");+ expect(open.match(/─{20,}/g)).toHaveLength(2);+ expect(open).not.toMatch(/\b1\. \/model/);+ input.down();+ input.enter();+ expect(await choice).toBe("/reset");+ expect(screen.snapshot()).not.toContain("Choose a model, speed, and reasoning");+ renderer.shutdown();+ });++ it("restores a help selection as a command-gutter composer with argument suggestions", async () => {+ 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 help = renderer.choosePromptCommand(PROMPT_COMMANDS);+ input.enter();+ const selection = await help;+ expect(selection).toBe("/model ");+ const prompt = renderer.readPrompt({ initialDraft: selection });+ await vi.waitFor(() => expect(screen.snapshot()).toContain("openai/gpt-5"));+ expect(screen.snapshot()).toContain("│ /model");+ expect(screen.snapshot()).not.toContain("❯ /model");+ input.enter();+ expect(await prompt).toBe("/model openai/gpt-5");+ renderer.shutdown();+ });++ it("keeps the selected help command visible on short terminals", async () => {+ const { input, renderer, screen } = makeRenderer(80, 10);+ const choice = renderer.choosePromptCommand(PROMPT_COMMANDS);+ for (let i = 0; i < 8; i += 1) input.down();+ expect(screen.snapshot()).toContain("/traces");+ expect(screen.snapshot()).not.toContain("┃ Commands");+ input.enter();+ expect(await choice).toBe("/traces ");+ renderer.shutdown();+ });++ it("keeps a submitted /info invocation above its transient drawer", async () => {+ const { input, renderer, screen } = makeRenderer();+ const prompt = renderer.readPrompt();+ input.type("/info");+ input.enter();+ expect(await prompt).toBe("/info");++ const panel = renderer.showInfoPanel("Application");+ const open = screen.snapshot().split("\n");+ expect(open.filter((line) => line.includes("/info"))).toEqual(["│ /info"]);+ expect(open.indexOf("│ /info")).toBeLessThan(open.findIndex((line) => /^─{20,}$/.test(line)));+ input.send("\x1b");+ await panel;+ expect(screen.snapshot()).not.toContain("Application");+ expect(screen.snapshot()).not.toContain("│ /info");+ renderer.renderCommandInvocation("/model anthropic/claude-opus-4.8");+ renderer.finishCommand({+ kind: "result",+ message: "",+ summary: "Model set to anthropic/claude-opus-4.8",+ });+ renderer.shutdown();+ expect(screen.snapshot()).toContain("Model set to anthropic/claude-opus-4.8");+ expect(screen.snapshot()).not.toContain("/info");+ });++ it("closes the transient info panel without retaining its contents", async () => {+ const { input, renderer, screen } = makeRenderer();+ const panel = renderer.showInfoPanel(+ "\x1b[36mApplication\x1b[39m\n\x1b[1mAgent\x1b[22m: Weather",+ );++ const open = screen.snapshot();+ expect(open).not.toContain("┃ Application info");+ expect(open).toContain("Application");+ expect(open).toContain("Agent: Weather");+ expect(open).toContain("Esc to close");+ expect(open.match(/─{20,}/g)).toHaveLength(2);+ expect(open).not.toContain("[36m");+ input.send("\x1b");+ await panel;+ expect(screen.snapshot()).not.toContain("Application");+ expect(screen.snapshot()).not.toContain("Agent: Weather");+ renderer.shutdown();+ });++ it("scrolls long info drawers within the terminal before closing", async () => {+ const { input, renderer, screen } = makeRenderer(60, 10);+ const panel = renderer.showInfoPanel(+ Array.from({ length: 12 }, (_, i) => `Entry ${i}`).join("\n"),+ );+ expect(screen.snapshot()).toContain("Entry 0");+ expect(screen.snapshot()).toContain("↑/↓ scroll · Esc close");+ for (let i = 0; i < 10; i += 1) input.down();+ expect(screen.snapshot()).toContain("Entry 11");+ expect(screen.snapshot()).not.toContain("Entry 0");+ input.send("\x1b");+ await panel;+ expect(screen.snapshot()).not.toContain("Entry 11");+ renderer.shutdown();+ });++ it("resolves an open transient drawer on shutdown", async () => {+ const { renderer } = makeRenderer();+ const choice = renderer.choosePromptCommand(PROMPT_COMMANDS);+ renderer.shutdown();+ expect(await choice).toBeUndefined();+ });+it("moves the suggestion highlight with arrows instead of recalling history", async () => {const { input, renderer } = makeRenderer();@@ -5443,6 +5668,32 @@ describe("TerminalRenderer command typeahead", () => {renderer.shutdown();});+ it("leaves transient commands and setup drawers out of prompt history", async () => {+ const { input, renderer } = makeRenderer();++ for (const text of [+ "an earlier prompt",+ "/model anthropic/claude-opus-4.6 default",+ "/help",+ "/info",+ "/add connection/linear",+ "/login chatgpt",+ "/loglevel all",+ "/traces",+ ]) {+ const prompt = renderer.readPrompt();+ input.type(text);+ input.enter();+ await prompt;+ }++ const recalled = renderer.readPrompt();+ input.up();+ input.enter();+ expect(await recalled).toBe("an earlier prompt");+ renderer.shutdown();+ });+it("escape dismisses the suggestions until the draft changes", async () => {const { screen, input, renderer } = makeRenderer();@@ -5867,10 +6118,11 @@ describe("setup interaction transitions", () => {{ value: "linear", label: "Linear" },],});- expect(titleRow()).toBe(initialRow);+ const questionRow = titleRow();+ expect(questionRow).toBeGreaterThan(initialRow);expect(screen.snapshot().split("Add to your agent")).toHaveLength(2);input.type("sl");- expect(titleRow()).toBe(initialRow);+ expect(titleRow()).toBe(questionRow);input.send("\x1b");input.send("\x1b");await expect(answer).resolves.toBeUndefined();diff --git a/packages/eve/src/cli/dev/tui/terminal-renderer.ts b/packages/eve/src/cli/dev/tui/terminal-renderer.tsindex 8d4fbd2a3..31dec1ad7 100644--- a/packages/eve/src/cli/dev/tui/terminal-renderer.ts+++ b/packages/eve/src/cli/dev/tui/terminal-renderer.ts@@ -12,6 +12,7 @@ import type {AgentTUIStreamResult,AgentTUIToolApprovalRequest,AgentTUIToolApprovalResponse,+ CommandPresentation,ConnectionAuthUpdate,SubagentStepUpdate,SubagentView,@@ -43,12 +44,13 @@ import {import {isPromptControlCommand,parsePromptCommand,+ promptCommandSpec,PROMPT_COMMANDS,+ type ArgumentTypeaheadCommand,type PromptCommandSpec,} from "./prompt-commands.js";import {enterBadge,- renderFlowDrawer,flowMessageRows,renderAcknowledgeQuestion,renderSelectQuestion,@@ -60,12 +62,11 @@ import {type SetupPanelOption,type SetupSelectPanelState,} from "./setup-panel.js";+import { renderFlowDrawer, renderTransientDrawer } from "./flow-drawer.js";import type {SetupEditableSelectResult,- SetupFlowIndicator,SetupFlowInterrupt,SetupFlowRenderer,- SetupFlowStatus,SetupSelectRequest,SetupSelectResult,} from "./setup-flow.js";@@ -134,6 +135,7 @@ import {renderInputText,renderInputWithBlockCursor,stripAnsi,+ wrapVisibleLine,stripTerminalControls,} from "#cli/ui/terminal-text.js";import type { VercelStatusSnapshot } from "./vercel-status.js";@@ -233,18 +235,15 @@ function completedTurnStatus(input: {return "Done";}-type SetupFlowIndicatorState = { kind: "spinner" } | { kind: "pulse"; startedAtMs: number };--type SetupFlowStatusState =- | { kind: "progress"; text: string; startedAtMs: number }- | { kind: "external-action"; text: string; emphasis: string; startedAtMs: number };+type SetupFlowStatusState = { text: string; startedAtMs: number };type TurnIndicatorState = { kind: "idle" } | { kind: "waiting"; startedAtMs: number };type SetupFlowState = {title: string;navigation?: PlannerNavigation;- indicator: SetupFlowIndicatorState;+ /** When the flow's pulse started, so its blink stays on a steady beat. */+ startedAtMs: number;lines: FlowPanelLine[];summary?: { headline: string; facts: readonly { label: string; value: string }[] };status?: SetupFlowStatusState;@@ -296,7 +295,7 @@ export type TerminalRendererOptions = {availablePromptCommands?: readonly PromptCommandSpec[];/** Catalog entries available to inline `/model`, `/add`, and `/login` completion. */argumentSuggestions?: (- command: "model" | "add" | "login",+ command: ArgumentTypeaheadCommand,) => Promise<readonly PromptArgumentSuggestion[]>;onExitRequest?: () => void;};@@ -416,6 +415,8 @@ export class TerminalRenderer implements AgentTUIRenderer {/** Live (uncommitted) blocks, in transcript order. */#blocks: Block[] = [];readonly #blockById = new Map<string, Block>();+ /** The invocation whose gutter awaits the command's outcome. */+ #pendingCommandEcho: Block | undefined;/** Section ids already committed to scrollback — never re-rendered. */readonly #committedIds = new Set<string>();/**@@ -590,6 +591,8 @@ export class TerminalRenderer implements AgentTUIRenderer {#pendingEchoedPrompt?: string;/** The open HITL question overlay, painted above the input area. */#questionPanel?: (width: number) => string[];+ #transientPanel?: (width: number) => ReturnType<typeof renderTransientDrawer>;+ #transientPanelClose?: () => void;/** The active setup flow's bordered panel: progress, question, status. */#setupFlow?: SetupFlowState;/** The clearable setup attention line (`⚠ … · /deploy`), rendered in the live footer. */@@ -634,7 +637,7 @@ export class TerminalRenderer implements AgentTUIRenderer {*/#terminalBackground?: RgbColor;readonly setupFlow: SetupFlowRenderer = {- begin: (title, indicator) => this.#beginSetupFlow(title, indicator),+ begin: (title) => this.#beginSetupFlow(title),setNavigation: (navigation) => this.#setSetupFlowNavigation(navigation),end: (options) => this.#endSetupFlow(options?.preserveDiagnostics ?? true),readSelect: (options) => this.#readSetupSelect(options),@@ -1029,7 +1032,10 @@ export class TerminalRenderer implements AgentTUIRenderer {argumentOpen === undefined &&selected !== undefined &&this.#argumentSuggestions !== undefined &&- (selected.name === "add" || selected.name === "login" || selected.name === "model")+ (selected.name === "add" ||+ selected.name === "login" ||+ selected.name === "loglevel" ||+ selected.name === "model")) {apply(lineOf(typeaheadCompletion(selected)));break;@@ -1044,19 +1050,15 @@ export class TerminalRenderer implements AgentTUIRenderer {if (prompt.trim().length === 0) break;this.#typeahead = undefined;this.#argumentTypeahead = undefined;- this.#promptHistory.add(prompt);+ if (promptCommandSpec(prompt)?.spec.history !== "omit") this.#promptHistory.add(prompt);this.#inputActive = false;this.#stopCaretBlink();this.#status = STATUS.processing;if (isPromptControlCommand(prompt)) {- // Commands echo as their own line (blue, under the prompt- // glyph) so the elbow-connected outcome has an invocation to- // hang under — never as a user chat message.- this.#pushBlock({- kind: "command",- body: stripTerminalControls(prompt.trim()),- live: false,- });+ // Commands echo as their own line so the elbow-connected+ // outcome has an invocation to hang under — never as a user+ // chat message.+ this.#pushCommandEcho(stripTerminalControls(prompt.trim()));} else {this.#startWorking();this.#addUserBlock(prompt);@@ -1987,50 +1989,167 @@ export class TerminalRenderer implements AgentTUIRenderer {this.#paint();}- /** Commits a slash-command invocation that was started without prompt input. */- renderCommandInvocation(text: string, status?: "failed"): void {+ /** Echoes a slash-command invocation that was started without prompt input. */+ renderCommandInvocation(text: string): void {const content = stripTerminalControls(text);if (content.trim().length === 0) return;this.#start();- const block: Block = {- kind: "command",- body: content,- live: false,+ this.#pushCommandEcho(content);+ this.#paint();+ }++ /** Lets `/help` select a command without leaving a transcript row. */+ async choosePromptCommand(commands: readonly PromptCommandSpec[]): Promise<string | undefined> {+ this.#start();+ this.#inputActive = false;+ let state = typeaheadFor(commands, "/");+ this.#transientPanel = (width) => {+ const rows = renderCommandSuggestions(state, this.#theme, width);+ const visible = Math.max(1, this.#height() - 7);+ const start = Math.max(0, Math.min(state.selectedIndex - visible + 1, rows.length - visible));+ return renderTransientDrawer(+ rows.slice(start, start + visible),+ ["↑/↓ move · Enter select · Esc close"],+ this.#theme,+ width,+ );};- if (status === "failed") block.status = "error";- this.#pushBlock(block);+ this.#status = "";this.#paint();+ return await new Promise((resolve) => {+ this.#transientPanelClose = () => resolve(undefined);+ this.#consumeKey = (key) => {+ if (key.type === "up" || key.type === "ctrl-p") {+ state = moveTypeaheadSelection(state, -1);+ this.#paint();+ } else if (key.type === "down" || key.type === "ctrl-n") {+ state = moveTypeaheadSelection(state, 1);+ this.#paint();+ } else if (key.type === "enter") {+ const command = selectedTypeaheadCommand(state);+ this.#closeTransientPanel();+ resolve(command === undefined ? undefined : typeaheadCompletion(command));+ } else if (key.type === "escape" || key.type === "ctrl-c") {+ this.#closeTransientPanel();+ resolve(undefined);+ }+ };+ this.#attachInput();+ });}- /** Commits one command outcome, promoting explicit status to a top-level result. */- renderCommandResult(text: string, tone?: "success" | "error"): void {- const content = stripAnsi(text);- if (content.trim().length === 0) return;+ /** Shows local application metadata without retaining it in the transcript. */+ async showInfoPanel(text: string): Promise<void> {this.#start();- this.#pushBlock({- kind: "result",- body: content,- live: false,- status: tone === "success" ? "done" : undefined,+ this.#inputActive = false;+ const plainText = stripAnsi(text);+ let scroll = 0;+ const infoRows = (width: number) =>+ plainText+ .split("\n")+ .flatMap((line) =>+ wrapVisibleLine(line, Math.max(1, width - 4)).map((part) => ` ${part}`),+ );+ this.#transientPanel = (width) => {+ const rows = infoRows(width);+ const visible = Math.max(1, this.#height() - 7);+ scroll = Math.min(scroll, Math.max(0, rows.length - visible));+ return renderTransientDrawer(+ rows.slice(scroll, scroll + visible),+ [rows.length > visible ? "↑/↓ scroll · Esc close" : "Esc to close"],+ this.#theme,+ width,+ );+ };+ this.#status = "";+ this.#paint();+ await new Promise<void>((resolve) => {+ this.#transientPanelClose = resolve;+ this.#consumeKey = (key) => {+ if (key.type === "up" || key.type === "ctrl-p") {+ scroll = Math.max(0, scroll - 1);+ this.#paint();+ } else if (key.type === "down" || key.type === "ctrl-n") {+ const visible = Math.max(1, this.#height() - 7);+ scroll = Math.min(scroll + 1, Math.max(0, infoRows(this.#width()).length - visible));+ this.#paint();+ } else if (key.type === "escape" || key.type === "ctrl-c" || key.type === "enter") {+ this.#closeTransientPanel();+ resolve();+ }+ };+ this.#attachInput();});+ }++ #closeTransientPanel(): void {+ this.#transientPanel = undefined;+ this.finishCommand({ kind: "dismiss" });+ this.#consumeKey = undefined;+ this.#transientPanelClose = undefined;+ this.#detachInput();+ this.#paint();+ }++ /** Completes the active command's transcript record in one operation. */+ finishCommand(outcome: CommandPresentation): void {+ if (outcome.kind === "dismiss") {+ if (this.#removePendingCommandEcho()) this.#paint();+ return;+ }+ const echo = this.#settleCommandEcho(outcome.summary);+ if (echo !== undefined) echo.status = "done";+ const content = outcome.message === undefined ? "" : stripAnsi(outcome.message);+ if (content.trim().length === 0) {+ if (echo !== undefined) this.#paint();+ return;+ }+ this.#start();+ this.#pushBlock({ kind: "result", body: content, live: false });this.#paint();}+ #removePendingCommandEcho(): boolean {+ const block = this.#pendingCommandEcho;+ if (block === undefined) return false;+ this.#pendingCommandEcho = undefined;+ this.#blocks = this.#blocks.filter((candidate) => candidate !== block);+ return true;+ }++ /**+ * The echo stays live, and so out of scrollback, until its command settles:+ * its gutter pulses meanwhile, then carries the outcome.+ */+ #pushCommandEcho(body: string): void {+ if (this.#pendingCommandEcho !== undefined) this.#settleCommandEcho();+ const block: Block = { kind: "command", body, live: true };+ this.#pendingCommandEcho = block;+ this.#pushBlock(block);+ }++ #settleCommandEcho(summary?: string): Block | undefined {+ const block = this.#pendingCommandEcho;+ if (block === undefined) return undefined;+ this.#pendingCommandEcho = undefined;+ block.live = false;+ if (summary !== undefined) block.result = stripTerminalControls(summary);+ return block;+ }+/*** Opens the setup flow for one command. Until the flow ends,* every flow line, question, and status renders inside it; the transcript* above stays untouched.*/- #beginSetupFlow(title: string, indicator: SetupFlowIndicator = "spinner"): void {+ #beginSetupFlow(title: string): void {this.#start();if (this.#startupEditor === undefined) this.#inputActive = false;this.#turnIndicator = { kind: "idle" };this.#status = "";- const indicatorState: SetupFlowIndicatorState =- indicator === "pulse" ? { kind: "pulse", startedAtMs: Date.now() } : { kind: "spinner" };this.#setupFlow = {title: stripTerminalControls(title),- indicator: indicatorState,+ startedAtMs: Date.now(),lines: [],outputBuffer: [],};@@ -2284,7 +2403,6 @@ export class TerminalRenderer implements AgentTUIRenderer {this.#start();const flow = this.#requireSetupFlow();flow.status = {- kind: "progress",text: stripTerminalControls(opts.status),startedAtMs: Date.now(),};@@ -2721,7 +2839,7 @@ export class TerminalRenderer implements AgentTUIRenderer {if (this.#setupFlow === undefined) {this.#setupFlow = {title: "",- indicator: { kind: "spinner" },+ startedAtMs: Date.now(),lines: [],outputBuffer: [],// Fabricated for a bare question (no begin/end pair) — closed with@@ -2867,18 +2985,11 @@ export class TerminalRenderer implements AgentTUIRenderer {* status into the working indicator; `undefined` clears it. Nothing is ever* committed to the transcript.*/- #setFlowStatus(status: SetupFlowStatus | undefined): void {+ #setFlowStatus(status: string | undefined): void {const content: SetupFlowStatusState | undefined =status === undefined? undefined- : typeof status === "string"- ? { kind: "progress", text: stripTerminalControls(status), startedAtMs: Date.now() }- : {- kind: "external-action",- text: stripTerminalControls(status.text),- emphasis: stripTerminalControls(status.emphasis),- startedAtMs: Date.now(),- };+ : { text: stripTerminalControls(status), startedAtMs: Date.now() };if (this.#setupFlow !== undefined) {this.#setupFlow.status = content;if (content === undefined) this.#setupFlow.preview = undefined;@@ -3165,6 +3276,14 @@ export class TerminalRenderer implements AgentTUIRenderer {};#stop() {+ const closeTransientPanel = this.#transientPanelClose;+ if (closeTransientPanel !== undefined) {+ this.#transientPanelClose = undefined;+ this.#transientPanel = undefined;+ this.finishCommand({ kind: "dismiss" });+ this.#consumeKey = undefined;+ closeTransientPanel();+ }// An open trace viewer must leave the alt screen before teardown, and its// awaited `open()` resolves so the runner loop can observe the shutdown.this.#closeTraceViewer();@@ -3190,6 +3309,7 @@ export class TerminalRenderer implements AgentTUIRenderer {// vanishing with the repaint area. The in-place rebuild status and any// open log run settle first so their last state survives as scrollback.this.#settleDevRebuildStatus();+ this.#settleCommandEcho();for (const block of this.#blocks) {if (block.kind === "log" && block.id === undefined) block.live = false;}@@ -3361,7 +3481,7 @@ export class TerminalRenderer implements AgentTUIRenderer {this.#messageQueue.requestCancellation();this.#cancelRequestedByUser = true;this.renderCommandInvocation(message.trim());- this.renderCommandResult("Turn cancellation requested.");+ this.finishCommand({ kind: "result", summary: "Cancellation requested" });this.#requestTurnCancel();this.#paint();break;@@ -3710,7 +3830,9 @@ export class TerminalRenderer implements AgentTUIRenderer {this.#provisionalSubagentCallIds.has(block.subagentCallId)) ||block.status === "approval" ||block.status === "running" ||- (block.kind === "connection-auth" && block.live)+ (block.kind === "connection-auth" && block.live) ||+ // A command's echo settles only with its own outcome.+ block === this.#pendingCommandEcho) {continue;}@@ -4305,6 +4427,8 @@ export class TerminalRenderer implements AgentTUIRenderer {),};if (previous !== undefined) context.previous = previous;+ if (this.#setupFlow !== undefined) context.setupFlowOpen = true;+ if (this.#transientPanel !== undefined) context.transientPanelOpen = true;const rows = renderBlockLines(block, width, this.#theme, context);if ((block.depth ?? 0) === 0 && leadsWithGap(block, previous)) {return ["", ...rows];@@ -4320,16 +4444,12 @@ export class TerminalRenderer implements AgentTUIRenderer {return isProgressPulseVisible(Date.now() - startedAtMs) ? glyph : " ";}- #setupFlowIndicator(flow: SetupFlowState, status?: SetupFlowStatusState): FlowPanelIndicator {- if (flow.indicator.kind === "spinner") {- return { glyph: this.#spinnerFrame(), color: "yellow" };- }+ #setupFlowIndicator(flow: SetupFlowState): FlowPanelIndicator {return {glyph: this.#progressPulseGlyph(- flow.indicator.startedAtMs,+ flow.startedAtMs,this.#theme.unicode ? PROGRESS_PULSE_GLYPH : PROGRESS_PULSE_ASCII_GLYPH,),- color: status?.kind === "external-action" ? "yellow" : "green",};}@@ -4337,6 +4457,11 @@ export class TerminalRenderer implements AgentTUIRenderer {const c = this.#theme.colors;const rows: string[] = [""];+ if (this.#transientPanel !== undefined) {+ const drawer = this.#transientPanel(width);+ return [...drawer.rows, ...drawer.controls];+ }+// The HITL question overlay owns the footer down to the status bar —// no indicator or hint row beneath it (the panel carries its own).if (this.#questionPanel !== undefined) {@@ -4351,7 +4476,7 @@ export class TerminalRenderer implements AgentTUIRenderer {// very state the line shows (link, pending deploy, model), so mid-flow// values are guaranteed stale; it reappears, refreshed, when the// panel closes.- const indicator = this.#setupFlowIndicator(flow, flow.status);+ const indicator = this.#setupFlowIndicator(flow);let status: FlowPanelStatus | undefined;if (flow.status !== undefined) {const { startedAtMs, ...flowStatus } = flow.status;@@ -4446,9 +4571,6 @@ export class TerminalRenderer implements AgentTUIRenderer {if (this.#exitArmed) {rows.push(clip(c.dim("Press Ctrl+C again to exit"), width), "");}- // A fully typed known command paints blue, confirming it will dispatch- // as a command instead of being sent to the agent as a message.- const isCommand = isPromptControlCommand(this.#inputText);const ghost = inlineHint ? c.dim(` ${inlineHint}`) : "";const statusRows: string[] = [];this.#pushStatusLine(statusRows, width);@@ -4471,7 +4593,6 @@ export class TerminalRenderer implements AgentTUIRenderer {width,theme: this.#theme,caretVisible: this.#caretVisible,- isCommand,ghost,maxRows: maxPromptRows,};@@ -4600,7 +4721,6 @@ export class TerminalRenderer implements AgentTUIRenderer {width,theme: this.#theme,caretVisible: true,- isCommand: false,ghost: "",maxRows: 4,inert: options.inert,@@ -5055,8 +5175,6 @@ interface PromptInputRowsInput {readonly width: number;readonly theme: Theme;readonly caretVisible: boolean;- /** A fully typed known command is bold, confirming it will dispatch as a command. */- readonly isCommand: boolean;readonly ghost: string;readonly maxRows: number;/**@@ -5081,7 +5199,6 @@ function promptInputRows({width,theme,caretVisible,- isCommand,ghost,maxRows,placeholder,@@ -5105,10 +5222,7 @@ function promptInputRows({return [clip(`${theme.glyph.prompt} ${body}`, width), ""];}- const style = (segment: string): string => {- const rendered = renderInputText(segment);- return isCommand && rendered.length > 0 ? c.bold(rendered) : rendered;- };+ const style = renderInputText;const layout = layoutPromptInput({ text, cursor });const visibleCount = Math.min(Math.max(1, maxRows), layout.rows.length);@@ -5117,7 +5231,12 @@ function promptInputRows({Math.min(layout.caretRow - visibleCount + 1, layout.rows.length - visibleCount),);// An inert prompt's typed draft keeps the mark dim: the state is legible without claiming readiness.- const promptGlyph = inert === true ? c.dim(theme.glyph.prompt) : c.cyan(theme.glyph.prompt);+ const promptGlyph =+ inert === true+ ? c.dim(theme.glyph.prompt)+ : text.startsWith("/")+ ? theme.glyph.user+ : theme.glyph.prompt;const ellipsis = c.dim(theme.glyph.ellipsis);// Reserve the gutter and the block cursor's trailing cell at end-of-line.// The gutter sits at column 0, sharing a column with the conversationdiff --git a/packages/eve/src/cli/dev/tui/tui-prompter.ts b/packages/eve/src/cli/dev/tui/tui-prompter.tsindex d136de1a5..2c4c6a31f 100644--- a/packages/eve/src/cli/dev/tui/tui-prompter.ts+++ b/packages/eve/src/cli/dev/tui/tui-prompter.ts@@ -10,7 +10,6 @@ import type {} from "#setup/prompter.js";import { createSelectOptionCodec } from "#setup/cli/select-option-codec.js";import { searchActionQuery } from "#setup/cli/select-state.js";-import type { SetupSpinnerIntent } from "#setup/cli/index.js";import { WizardCancelledError } from "#setup/step.js";import type { SetupFlowPrompterRenderer, SetupSelectRequest } from "./setup-flow.js";@@ -225,12 +224,8 @@ export function createTuiPrompter(renderer: TuiPrompterRenderer): Prompter {renderer.renderLine(title, "info");for (const entry of lines) renderer.renderLine(` ${entry}`, "info");},- spinner(message, intent?: SetupSpinnerIntent) {- renderer.setStatus(- intent?.kind === "external-action"- ? { kind: "external-action", text: message, emphasis: intent.emphasis }- : message,- );+ spinner(message) {+ renderer.setStatus(message);let stopped = false;return {stop() {diff --git a/packages/eve/src/cli/dev/tui/tui.ts b/packages/eve/src/cli/dev/tui/tui.tsindex 85d28c354..dad2710ea 100644--- a/packages/eve/src/cli/dev/tui/tui.ts+++ b/packages/eve/src/cli/dev/tui/tui.ts@@ -20,11 +20,13 @@ import { createDevDiagnostics, type DevDiagnostics } from "../diagnostics.js";import { createPromptCommandHandler } from "./prompt-command-handler.js";import { promptCommandsFor } from "./prompt-commands.js";+import { LOGIN_CONNECTION_COMMAND_OPTIONS } from "#setup/flows/model-login-options.js";import { formatRemoteAuthChallengeMessage } from "./remote-auth-result.js";import { probeMcpConnection } from "./mcp-connection-status.js";import { EveTUIRunner, type EveTUIRunnerOptions } from "./runner.js";import { TerminalRenderer } from "./terminal-renderer.js";import type { PromptArgumentSuggestion } from "./argument-typeahead.js";+import type { ArgumentTypeaheadCommand } from "./prompt-commands.js";import { remoteHost, type DevelopmentTuiTarget, type RemoteDevelopmentTarget } from "./target.js";import type { TuiDisplayOptions } from "./types.js";@@ -53,17 +55,22 @@ export interface RunDevelopmentTuiInput extends TuiDisplayOptions {function inlineArgumentSuggestions(appRoot: string) {return async (- command: "model" | "add" | "login",+ command: ArgumentTypeaheadCommand,): Promise<readonly PromptArgumentSuggestion[]> => {- if (command === "login") {+ if (command === "loglevel") {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)" },+ { value: "all", label: "all", hint: "Show all captured logs" },+ { value: "stderr", label: "stderr", hint: "Show stderr logs only" },+ { value: "sandbox", label: "sandbox", hint: "Show sandbox logs only" },+ { value: "none", label: "none", hint: "Hide captured logs" },];}+ if (command === "login") {+ return LOGIN_CONNECTION_COMMAND_OPTIONS.map((option) => ({+ value: option.command,+ label: option.label,+ }));+ }if (command === "model") {const { gatewayModelCapabilities } = await import("#setup/boxes/model-capabilities.js");const { fetchGatewayCatalog, modelOptionsFromCatalog } =diff --git a/packages/eve/src/setup/cli/channel-setup-prompter.ts b/packages/eve/src/setup/cli/channel-setup-prompter.tsindex a31ce655c..e7c43e0d6 100644--- a/packages/eve/src/setup/cli/channel-setup-prompter.ts+++ b/packages/eve/src/setup/cli/channel-setup-prompter.ts@@ -28,11 +28,6 @@ export interface ChannelSetupChoice {/** Optional interaction capability for a long-running setup operation. */export type ChannelSetupAwaitChoice = (options: ChannelSetupChoiceOptions) => ChannelSetupChoice;-/** Why a live setup indicator is waiting. */-export type SetupSpinnerIntent =- | { kind: "progress" }- | { kind: "external-action"; emphasis: string };-/** Status and subprocess output operations used by shared setup flows. */export interface ChannelSetupLog {message(text: string): void;@@ -49,7 +44,7 @@ export interface ChannelSetupLog {* (which have no live status surface) can omit it and callers fall back to* a persisted message.*/- spinner?(message: string, intent?: SetupSpinnerIntent): { stop(): void };+ spinner?(message: string): { stop(): void };}/**@@ -62,9 +57,8 @@ export async function withPhase<T>(log: ChannelSetupLog,message: string,task: () => Promise<T>,- intent?: SetupSpinnerIntent,): Promise<T> {- const spinner = log.spinner?.(message, intent);+ const spinner = log.spinner?.(message);if (!spinner) log.message(message);try {return await task();diff --git a/packages/eve/src/setup/cli/index.ts b/packages/eve/src/setup/cli/index.tsindex 88c384e59..039efd4ee 100644--- a/packages/eve/src/setup/cli/index.ts+++ b/packages/eve/src/setup/cli/index.ts@@ -6,7 +6,6 @@ export {type ChannelSetupChoiceOptions,type ChannelSetupLog,type DisabledChannelReasons,- type SetupSpinnerIntent,withPhase,} from "./channel-setup-prompter.js";export { createPromptCommandOutput, type PromptCommandLog } from "./command-output.js";diff --git a/packages/eve/src/setup/connection-connector.ts b/packages/eve/src/setup/connection-connector.tsindex 47206d68c..32c57b12e 100644--- a/packages/eve/src/setup/connection-connector.ts+++ b/packages/eve/src/setup/connection-connector.ts@@ -320,7 +320,6 @@ async function resolveFallbackConnector(],{ cwd: options.projectRoot, onOutput: createOutput, signal: options.signal },),- { kind: "external-action", emphasis: "browser" },);const raw = parseConnectorRef(parseJson(created.stdout));const ownedId = raw?.id ?? CREATED_CONNECTOR.exec(transcript.join("\n"))?.[1];diff --git a/packages/eve/src/setup/flows/model-login-connection.ts b/packages/eve/src/setup/flows/model-login-connection.tsindex a38464d34..e5b0c083c 100644--- a/packages/eve/src/setup/flows/model-login-connection.ts+++ b/packages/eve/src/setup/flows/model-login-connection.ts@@ -22,14 +22,7 @@ import { withLoginProgress } from "./model-login-progress.js";import { validateGatewayApiKey } from "#setup/validate-gateway-key.js";import { ensureChatGptAuth } from "./chatgpt-auth.js";import { loginVercelModel } from "./vercel-model-login.js";--export const CONNECTION_OPTIONS = [- { value: "vercel", label: "Vercel Account" },- { value: "ai-gateway-key", label: "Vercel AI Gateway API Key" },- { value: "chatgpt", label: "ChatGPT Subscription" },- { value: "openai", label: "OpenAI API Key" },- { value: "anthropic", label: "Anthropic API Key" },-] as const;+import { CONNECTION_OPTIONS } from "./model-login-options.js";type Team = { teamId: string; teamName: string };diff --git a/packages/eve/src/setup/flows/model-login-options.ts b/packages/eve/src/setup/flows/model-login-options.tsnew file mode 100644index 000000000..6071a66cc--- /dev/null+++ b/packages/eve/src/setup/flows/model-login-options.ts@@ -0,0 +1,36 @@+import type { ModelConnection, ModelConnectionSelection } from "#shared/model-connection.js";++export const LOGIN_CONNECTION_OPTIONS = [+ { command: "vercel", commandOrder: 0, value: "vercel", label: "Vercel Account" },+ {+ command: "vercel-api-key",+ commandOrder: 2,+ value: "ai-gateway-key",+ label: "Vercel AI Gateway API Key",+ },+ { command: "chatgpt", commandOrder: 1, value: "chatgpt", label: "ChatGPT Subscription" },+ { command: "openai-api-key", commandOrder: 3, value: "openai", label: "OpenAI API Key" },+ { command: "anthropic-api-key", commandOrder: 4, value: "anthropic", label: "Anthropic API Key" },+] as const satisfies readonly {+ command: string;+ commandOrder: number;+ value: ModelConnection;+ label: string;+}[];++export const CONNECTION_OPTIONS = LOGIN_CONNECTION_OPTIONS.map(({ value, label }) => ({+ value,+ label,+}));++export const LOGIN_CONNECTION_COMMAND_OPTIONS = [...LOGIN_CONNECTION_OPTIONS].sort(+ (left, right) => left.commandOrder - right.commandOrder,+);++export function loginConnectionForCommand(command: string): ModelConnectionSelection | undefined {+ return LOGIN_CONNECTION_OPTIONS.find((option) => option.command === command)?.value;+}++export const LOGIN_CONNECTION_COMMAND_HINT = LOGIN_CONNECTION_COMMAND_OPTIONS.map(+ (option) => option.command,+).join("|");diff --git a/packages/eve/src/setup/flows/model-login.ts b/packages/eve/src/setup/flows/model-login.tsindex b0df2f71c..abc2741c5 100644--- a/packages/eve/src/setup/flows/model-login.ts+++ b/packages/eve/src/setup/flows/model-login.ts@@ -26,9 +26,9 @@ import {import type { Prompter } from "#setup/prompter.js";import { WizardCancelledError } from "#setup/step.js";import { changeValidatedAgentModel, readAuthoredModelSelection } from "./model-source-change.js";+import { CONNECTION_OPTIONS } from "./model-login-options.js";import {authenticateModelConnection,- CONNECTION_OPTIONS,reuseModelConnection,type ValidatedModelConnection,} from "./model-login-connection.js";diff --git a/packages/eve/src/setup/flows/model-source-change.ts b/packages/eve/src/setup/flows/model-source-change.tsindex 0a44a1692..76f47fd2d 100644--- a/packages/eve/src/setup/flows/model-source-change.ts+++ b/packages/eve/src/setup/flows/model-source-change.ts@@ -52,18 +52,6 @@ export type ApplyModelOutcome =| { kind: "unchanged"; model: string }| { kind: "rejected"; message: string };-/** The one-line transcript form of an apply outcome (`/model <slug>`'s reply). */-export function formatApplyModelOutcome(outcome: ApplyModelOutcome): string {- switch (outcome.kind) {- case "changed":- return `Model changed to ${pc.bold(outcome.to)}. Live on your next prompt.`;- case "unchanged":- return `Model is already \`${outcome.model}\`.`;- case "rejected":- return outcome.message;- }-}-/** Applies one completed `/model` draft through a single atomic source write. */export async function changeAgentModelSettings(input: {readonly appRoot: string;diff --git a/packages/eve/src/setup/flows/registry-session.ts b/packages/eve/src/setup/flows/registry-session.tsindex 38057b89b..3541e82bf 100644--- a/packages/eve/src/setup/flows/registry-session.ts+++ b/packages/eve/src/setup/flows/registry-session.ts@@ -9,30 +9,23 @@ export interface RegistrySessionDeps {runDeployFlow: typeof runDeployFlow;}-export interface RegistrySessionItemResult {- title: string;- facts: readonly RegistrySetupFact[];- output: readonly string[];-}--/** An item the user chose to skip after its installation could not complete. */-export interface RegistrySessionItemFailure {- title: string;- /** User-facing installation error, including any actionable follow-up lines. */- message: string;-}-export type RegistrySessionOutcome =- | ({ kind: "installed" } & RegistrySessionItemResult)- | ({ kind: "failed" } & RegistrySessionItemFailure)+ | {+ kind: "installed";+ title: string;+ facts: readonly RegistrySetupFact[];+ output: readonly string[];+ }+ /** Files were added, but the item's setup was cancelled or skipped. */+ | { kind: "incomplete"; title: string; resumeCommand: string }+ /** User-facing installation error, including any actionable follow-up lines. */+ | { kind: "failed"; title: string; message: string }+ /** Stopped before anything was written. */| { kind: "cancelled"; title: string };export interface RegistrySessionResult {- items: readonly RegistrySessionItemResult[];- /** Installation failures retained when a user skips an item. */- failures: readonly RegistrySessionItemFailure[];/** Every item outcome in installation order. */- outcomes?: readonly RegistrySessionOutcome[];+ outcomes: readonly RegistrySessionOutcome[];/** Setup stopped outside an individual item after preserving settled results. */cancelled?: true;deployed?: "production";@@ -40,6 +33,7 @@ export interface RegistrySessionResult {export interface RegistrySession {add(title: string, output: readonly string[], setup?: RegistrySetupCompletion): void;+ addIncomplete(title: string, resumeCommand: string): void;addFailure(title: string, message: string): void;addCancellation(title: string): void;result(deployed?: "production"): RegistrySessionResult;@@ -56,16 +50,7 @@ export function createRegistrySession(deps: RegistrySessionDeps): RegistrySessiolet deploymentRequired = false;function result(deployed?: "production"): RegistrySessionResult {- const items = outcomes.flatMap((outcome) =>- outcome.kind === "installed"- ? [{ title: outcome.title, facts: outcome.facts, output: outcome.output }]- : [],- );- const failures = outcomes.flatMap((outcome) =>- outcome.kind === "failed" ? [{ title: outcome.title, message: outcome.message }] : [],- );- const session: RegistrySessionResult = { items, failures };- if (outcomes.some((outcome) => outcome.kind !== "installed")) session.outcomes = outcomes;+ const session: RegistrySessionResult = { outcomes: [...outcomes] };if (deployed !== undefined) session.deployed = deployed;return session;}@@ -76,6 +61,10 @@ export function createRegistrySession(deps: RegistrySessionDeps): RegistrySessiodeploymentRequired ||= setup.deploymentRequired === true;},+ addIncomplete(title, resumeCommand) {+ outcomes.push({ kind: "incomplete", title, resumeCommand });+ },+addFailure(title, message) {outcomes.push({ kind: "failed", title, message });},diff --git a/packages/eve/src/setup/flows/registry.test.ts b/packages/eve/src/setup/flows/registry.test.tsindex 6bc8471ef..796286aa3 100644--- a/packages/eve/src/setup/flows/registry.test.ts+++ b/packages/eve/src/setup/flows/registry.test.ts@@ -118,6 +118,33 @@ describe("runRegistryFlow", () => {expect(flow.browseRegistryCatalog).not.toHaveBeenCalled();expect(flow.installRegistryItem).toHaveBeenCalledOnce();});+ it("reports unfinished setup separately from a cancelled installation", async () => {+ const flow = deps();+ flow.installRegistryItem = vi.fn(async () => ({+ output: [],+ setupIncomplete: { resumeCommand: "eve add channel/slack --skip-install" },+ }));++ await expect(+ runRegistryFlow({+ appRoot: "/agent",+ initialAddress: "channel/slack",+ prompter: createFakePrompter().prompter,+ deps: flow,+ }),+ ).resolves.toEqual({+ kind: "done",+ result: {+ outcomes: [+ {+ kind: "incomplete",+ title: "channel/slack",+ resumeCommand: "eve add channel/slack --skip-install",+ },+ ],+ },+ });+ });it("reports an installation failure without another decision prompt", async () => {const flow = deps();flow.installRegistryItem = vi.fn(async () => {@@ -135,7 +162,13 @@ describe("runRegistryFlow", () => {).resolves.toMatchObject({kind: "done",result: {- failures: [{ title: "connection/linear", message: "Dependency installation failed." }],+ outcomes: [+ {+ kind: "failed",+ title: "connection/linear",+ message: "Dependency installation failed.",+ },+ ],},});diff --git a/packages/eve/src/setup/flows/registry.ts b/packages/eve/src/setup/flows/registry.tsindex 1d895e85f..043fe98e0 100644--- a/packages/eve/src/setup/flows/registry.ts+++ b/packages/eve/src/setup/flows/registry.ts@@ -31,10 +31,7 @@ export class RegistryFlowFailedError extends Error {function hasSettledOutcomes(result: RegistrySessionResult | undefined,): result is RegistrySessionResult {- return (- result !== undefined &&- (result.items.length > 0 || result.failures.length > 0 || result.outcomes !== undefined)- );+ return result !== undefined && result.outcomes.length > 0;}/** Searches the catalog and installs one selected item with its required setup. */@@ -110,7 +107,11 @@ export async function runRegistryFlow(input: {});const run = () => (input.runItem === undefined ? install() : input.runItem(install));const installed = await (input.prompter.withExclusiveTerminal?.(run) ?? run());- activeSession.add(label(item), installed.output, installed.setup);+ if (installed.setupIncomplete !== undefined) {+ activeSession.addIncomplete(label(item), installed.setupIncomplete.resumeCommand);+ } else {+ activeSession.add(label(item), installed.output, installed.setup);+ }} catch (error) {input.signal?.throwIfAborted();if (error instanceof WizardCancelledError) {diff --git a/packages/eve/src/setup/flows/vercel-model-login.ts b/packages/eve/src/setup/flows/vercel-model-login.tsindex d12eded75..b9c0636c0 100644--- a/packages/eve/src/setup/flows/vercel-model-login.ts+++ b/packages/eve/src/setup/flows/vercel-model-login.ts@@ -56,10 +56,7 @@ export async function loginVercelModel(typeof device.interval === "number" ? Math.max(1, Math.min(30, device.interval)) : 5;const duration = typeof device.expires_in === "number" ? Math.min(600, device.expires_in) : 300;const deadline = Date.now() + duration * 1000;- const spinner = prompter.log.spinner?.("Finish signing in to Vercel in your browser", {- kind: "external-action",- emphasis: "your browser",- });+ const spinner = prompter.log.spinner?.("Finish signing in to Vercel in your browser");let session;try {while (Date.now() < deadline) {diff --git a/packages/eve/src/setup/integrations/photon/setup-flow.ts b/packages/eve/src/setup/integrations/photon/setup-flow.tsindex 51f7d1595..67933c227 100644--- a/packages/eve/src/setup/integrations/photon/setup-flow.ts+++ b/packages/eve/src/setup/integrations/photon/setup-flow.ts@@ -187,10 +187,7 @@ async function resolvePhotonProject(phoneNumber: plan.phoneNumber,});if (plan.phoneNumber === undefined) throw new Error("Photon phone number is required.");- const spinner = context.presenter.log.spinner?.("Waiting for Photon approval…", {- kind: "external-action",- emphasis: "browser",- });+ const spinner = context.presenter.log.spinner?.("Waiting for Photon approval…");let authorizationAction:| ReturnType<SetupApplyContext["presenter"]["beginExternalAction"]>| undefined;diff --git a/packages/eve/src/setup/prompter.ts b/packages/eve/src/setup/prompter.tsindex e9a8ca5db..1ac448a96 100644--- a/packages/eve/src/setup/prompter.ts+++ b/packages/eve/src/setup/prompter.ts@@ -11,7 +11,6 @@ import {runSelectComponent,type ChannelSetupAwaitChoice,type PromptState,- type SetupSpinnerIntent,} from "#setup/cli/index.js";import { createRailLog, type RailSpinner } from "#setup/cli/index.js";import pc from "#compiled/picocolors/index.js";@@ -301,7 +300,7 @@ export interface Prompter {* returning a handle whose `stop()` clears it. Present on the real prompter;* optional so lightweight test fakes can omit it.*/- spinner?(message: string, intent?: SetupSpinnerIntent): RailSpinner;+ spinner?(message: string): RailSpinner;};}diff --git a/packages/eve/src/setup/registry-setup-client.ts b/packages/eve/src/setup/registry-setup-client.tsindex d14d57755..1101b5c2e 100644--- a/packages/eve/src/setup/registry-setup-client.ts+++ b/packages/eve/src/setup/registry-setup-client.ts@@ -211,14 +211,9 @@ export function createRegistrySetupClient(warning: (text) => send(childProcess, { type: "log", level: "warning", text }),error: (text) => send(childProcess, { type: "log", level: "error", text }),commandOutput: (text) => send(childProcess, { type: "log", level: "commandOutput", text }),- spinner(status, intent) {+ spinner(status) {const id = nextId++;- send(childProcess, {- type: "status",- id,- status,- intent: intent?.kind === "external-action" ? intent : undefined,- });+ send(childProcess, { type: "status", id, status });return { stop: () => send(childProcess, { type: "status", id }) };},},diff --git a/packages/eve/src/setup/registry-setup-protocol.ts b/packages/eve/src/setup/registry-setup-protocol.tsindex f8f7b7367..b4af36513 100644--- a/packages/eve/src/setup/registry-setup-protocol.ts+++ b/packages/eve/src/setup/registry-setup-protocol.ts@@ -75,7 +75,6 @@ export type RegistrySetupChildMessage =type: "status";id: number;status?: string;- intent?: { kind: "external-action"; emphasis: string };};export type RegistrySetupParentMessage =diff --git a/packages/eve/src/setup/slack-connect-lifecycle.ts b/packages/eve/src/setup/slack-connect-lifecycle.tsindex b150fa609..a37589607 100644--- a/packages/eve/src/setup/slack-connect-lifecycle.ts+++ b/packages/eve/src/setup/slack-connect-lifecycle.ts@@ -250,7 +250,7 @@ export async function cleanupCreatedAttempt(}context.log.warning(- "Vercel returned no connector UID for the abandoned Slack Connect request, so eve cannot prove that request was cancelled. No connector was removed; do not retry until the browser request is no longer usable.",+ "eve couldn't confirm the Slack request in your browser was cancelled. Wait for it to expire before retrying.",);const inventory = await listSlackConnectors(context.deps, context.projectRoot, context.onOutput);if (inventory.state === "failed") return { state: "failed", connectorUids: [] };diff --git a/packages/eve/src/setup/slackbot.test.ts b/packages/eve/src/setup/slackbot.test.tsindex 293cb1909..8b7d57ac5 100644--- a/packages/eve/src/setup/slackbot.test.ts+++ b/packages/eve/src/setup/slackbot.test.ts@@ -1032,7 +1032,7 @@ describe("provisionSlackbot", () => {await expect(provisioning).rejects.toMatchObject({ name: "AbortError" });expect(log.warning).toHaveBeenCalledWith(- "Vercel returned no connector UID for the abandoned Slack Connect request, so eve cannot prove that request was cancelled. No connector was removed; do not retry until the browser request is no longer usable.",+ "eve couldn't confirm the Slack request in your browser was cancelled. Wait for it to expire before retrying.",);});