The Open Framework for Building Agents
feat(eve): add block cursors and progress pulses (#165)
Rui680ff48ad1f3
diff --git a/.changeset/calm-tui-progress.md b/.changeset/calm-tui-progress.mdnew file mode 100644index 000000000..ec5369126--- /dev/null+++ b/.changeset/calm-tui-progress.md@@ -0,0 +1,5 @@+---+"eve": patch+---++Text prompts now use block cursors, while active turns and model or channel setup use shared green progress pulses.diff --git a/docs/guides/dev-tui.md b/docs/guides/dev-tui.mdindex eeee8c9bc..0762c7e6d 100644--- a/docs/guides/dev-tui.md+++ b/docs/guides/dev-tui.md@@ -22,7 +22,7 @@ If agent discovery reported problems, an error and warning count renders betweenThe conversation streams straight into your terminal's normal scrollback, so you keep native scrolling, copy and paste, and a transcript that persists after you exit. The scrollback holds your prompts, the agent's replies, reasoning, tool calls, nested subagents, connection-authorization prompts, and any captured `stdout`, `stderr`, or sandbox lifecycle lines.-Each turn renders without boxes. A colored gutter glyph marks who is speaking, tool calls collapse to a one-line summary (`✓ get_weather city="SF" → 73°F`), and a subagent's work is indented beneath its `◆` header. When input is ready, the prompt stays bare until you type. While a turn or setup action owns the terminal, only its live status shows.+Each turn renders without boxes. A colored gutter glyph marks who is speaking, tool calls collapse to a one-line summary (`✓ get_weather city="SF" → 73°F`), and a subagent's work is indented beneath its `◆` header. When input is ready, the prompt stays bare until you type. A green circle-dot pulses while the agent is waiting to answer and disappears when reasoning or answer content begins.A persistent line beneath the prompt or status shows the model, the session's token flow (`↑ 394.4K ↓ 4.3K`), the linked Vercel project and team (`▲ my-agent (acme)`), and a yellow `/deploy pending` marker once a channel added this session still needs `/deploy`. The Vercel segment stays hidden until the directory is linked.@@ -30,7 +30,7 @@ Errors render compactly with docs links highlighted. A code bug escaping your ag## Slash commands-Each command echoes as an invocation line, asks through a bordered panel that takes the input area's place (one question at a time, separate from the chat transcript), and finishes with a one-line `⎿` result. Loading states stay on the ephemeral status line instead of piling into the transcript. Setup menus render the selected option with a filled arrow and an inverse label padded by one space on each side. The label is blue normally and yellow for warning rows.+Each command echoes as an invocation line, asks through a bordered panel that takes the input area's place (one question at a time, separate from the chat transcript), and finishes with a one-line `⎿` result. Loading states stay on the ephemeral status line instead of piling into the transcript; model and channel setup use the same green square pulse as the build phase. Setup menus render the selected option with a filled arrow and an inverse label padded by one space on each side. Text prompts use a blinking block cursor over the character at the caret. The selected label is blue normally and yellow for warning rows.| Command | Does || ----------- | --------------------------------------------------------------------------------------------------------------------------------- |diff --git a/packages/eve/src/cli/dev/tui/line-editor.ts b/packages/eve/src/cli/dev/tui/line-editor.tsindex 65d2a7654..2f64fcbfd 100644--- a/packages/eve/src/cli/dev/tui/line-editor.ts+++ b/packages/eve/src/cli/dev/tui/line-editor.ts@@ -36,6 +36,14 @@ export function lineOf(text: string): LineState {return { text, cursor: text.length };}+/** Masks each grapheme with one bullet while preserving the caret's grapheme position. */+export function maskLine(state: LineState): LineState {+ return {+ text: "•".repeat(graphemes(state.text).length),+ cursor: graphemes(state.text.slice(0, state.cursor)).length,+ };+}+/** Inserts `value` at the caret and advances the caret past it. */export function insert(state: LineState, value: string): LineState {if (value.length === 0) return state;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 76e4ed8ec..164dace0f 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@@ -115,7 +115,9 @@ describe("createPromptCommandHandler", () => {effect: { kind: "model-access-changed" } as const,}));vi.doMock("./setup-commands.js", () => ({- SETUP_FLOW_TITLES: { model: "Configure the agent model" },+ SETUP_FLOW_CONFIG: {+ model: { title: "Configure the agent model", indicator: "pulse" },+ },runTuiSetupCommand,}));@@ -135,7 +137,7 @@ describe("createPromptCommandHandler", () => {expect(runTuiSetupCommand).toHaveBeenCalledWith(expect.objectContaining({ initialModelStep: "provider" }),);- expect(setupFlow.begin).toHaveBeenCalledWith("Configure the agent model");+ expect(setupFlow.begin).toHaveBeenCalledWith("Configure the agent model", "pulse");expect(setupFlow.end).toHaveBeenCalledWith({ preserveDiagnostics: false });} finally {vi.doUnmock("./setup-commands.js");diff --git a/packages/eve/src/cli/dev/tui/prompt-command-handler.ts b/packages/eve/src/cli/dev/tui/prompt-command-handler.tsindex 94f51d027..eaf0944d0 100644--- a/packages/eve/src/cli/dev/tui/prompt-command-handler.ts+++ b/packages/eve/src/cli/dev/tui/prompt-command-handler.ts@@ -75,8 +75,9 @@ export function createPromptCommandHandler(} catch (error) {return { message: `/${command.name} failed: ${toErrorMessage(error)}` };}- const { runTuiSetupCommand, SETUP_FLOW_TITLES } = setupCommands;- flow.begin(SETUP_FLOW_TITLES[command.name]);+ const { runTuiSetupCommand, SETUP_FLOW_CONFIG } = setupCommands;+ const flowConfig = SETUP_FLOW_CONFIG[command.name];+ flow.begin(flowConfig.title, flowConfig.indicator);let preserveFlowDiagnostics = true;try {const commandInput: TuiSetupCommandInput = {diff --git a/packages/eve/src/cli/dev/tui/setup-commands.test.ts b/packages/eve/src/cli/dev/tui/setup-commands.test.tsindex 854a8a906..e10baedb1 100644--- a/packages/eve/src/cli/dev/tui/setup-commands.test.ts+++ b/packages/eve/src/cli/dev/tui/setup-commands.test.ts@@ -7,6 +7,7 @@ import { WizardCancelledError } from "#setup/step.js";import {runTuiSetupCommand,+ SETUP_FLOW_CONFIG,type TuiSetupCommandInput,type TuiSetupCommandRenderer,type TuiSetupFlows,@@ -89,6 +90,20 @@ function run(input: {}describe("runTuiSetupCommand", () => {+ it("uses the build pulse only for model and channel loading", () => {+ expect(+ Object.fromEntries(+ Object.entries(SETUP_FLOW_CONFIG).map(([command, config]) => [command, config.indicator]),+ ),+ ).toEqual({+ vc: "spinner",+ login: "spinner",+ model: "pulse",+ channels: "pulse",+ deploy: "spinner",+ });+ });+it("surfaces the model flow's apply line as the outcome", async () => {const flows = fakeFlows();await expect(run({ command: "model", flows })).resolves.toEqual({diff --git a/packages/eve/src/cli/dev/tui/setup-commands.ts b/packages/eve/src/cli/dev/tui/setup-commands.tsindex 12628704a..01c422bd5 100644--- a/packages/eve/src/cli/dev/tui/setup-commands.ts+++ b/packages/eve/src/cli/dev/tui/setup-commands.ts@@ -14,25 +14,23 @@ import { WizardCancelledError } from "#setup/step.js";import { createTuiPrompter, type TuiPrompterRenderer } from "./tui-prompter.js";import type { PromptCommandExtensionName } from "./prompt-commands.js";-import type { SetupFlowRenderer } from "./setup-flow.js";+import type { SetupFlowIndicator, SetupFlowRenderer } from "./setup-flow.js";import type { VercelStatusEffect } from "./vercel-status.js";export type TuiSetupCommand = PromptCommandExtensionName;/**- * Human panel titles per command. The bordered panel never repeats the echoed- * command verbatim (the transcript already shows it), but it always carries a- * title: flows move past their opening question (project pickers, name- * prompts), and without a constant header those later questions float- * unanchored in the panel.+ * 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_TITLES: Record<TuiSetupCommand, string> = {- vc: "Install the Vercel CLI",- login: "Log in to Vercel",- model: "Configure the agent model",- channels: "Agent channels",- deploy: "Deploy to Vercel",-};+export const SETUP_FLOW_CONFIG = {+ vc: { title: "Install the Vercel CLI", indicator: "spinner" },+ login: { title: "Log in to Vercel", indicator: "spinner" },+ model: { title: "Configure the agent model", indicator: "pulse" },+ channels: { title: "Agent channels", indicator: "pulse" },+ deploy: { title: "Deploy to Vercel", indicator: "spinner" },+} satisfies Record<TuiSetupCommand, { title: string; indicator: SetupFlowIndicator }>;/** The prompter surface plus the working-state interrupt trap a command races against. */export type TuiSetupCommandRenderer = TuiPrompterRenderer &@@ -108,7 +106,7 @@ function muteableRenderer(* Runs one TUI setup command (/model, /channels, /deploy) over the* shared setup flows, asking through the TUI's own bordered panel. Never throws:* every outcome — done, cancelled, failed — folds into the returned command- * result. Ctrl-C or Esc on the working spinner (no question open) aborts the+ * result. Ctrl-C or Esc on the working indicator (no question open) aborts the* active flow, then keeps command ownership until its subprocesses and setup* stack have unwound.*/diff --git a/packages/eve/src/cli/dev/tui/setup-flow.ts b/packages/eve/src/cli/dev/tui/setup-flow.tsindex 66620c8f3..e537947b8 100644--- a/packages/eve/src/cli/dev/tui/setup-flow.ts+++ b/packages/eve/src/cli/dev/tui/setup-flow.ts@@ -7,6 +7,9 @@ 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";+interface SetupSelectRequestBase {message: string;options: readonly SetupPanelOption[];@@ -49,7 +52,7 @@ export type SetupSelectRequest =| SetupSearchableMultiSelectRequest;export interface SetupFlowRenderer {- begin(title: string): void;+ begin(title: string, indicator?: SetupFlowIndicator): void;end(options?: { preserveDiagnostics?: boolean }): void;readSelect(options: SetupSelectRequest): Promise<readonly string[] | undefined>;readEditableSelect(options: {@@ -74,7 +77,7 @@ export interface SetupFlowRenderer {readAcknowledge(options: { message: string; lines: readonly string[] }): Promise<void>;/*** Presents an inert context row and a separate action menu beside the live- * flow spinner. Returns the choice plus a `close()` that dismisses the menu+ * flow indicator. Returns the choice plus a `close()` that dismisses the menu* when a concurrent wait resolves first. Used by the Slack install wait for* "Try again" / "Cancel": the poll keeps running while the prompt is up, and* whichever settles first wins.@@ -84,7 +87,7 @@ export interface SetupFlowRenderer {renderLine(text: string, tone: "info" | "success" | "warning" | "error"): void;renderOutput(text: string): void;/**- * Arms a key trap for the flow's working state — the status spinner between+ * Arms a key trap for the flow's working state — the status indicator between* questions, where no prompt is consuming keys. Ctrl-C or Esc resolves the* promise so the command can abandon an in-flight flow (e.g. a parked* `vercel connect create` browser OAuth). Open questions own their keys; thediff --git a/packages/eve/src/cli/dev/tui/setup-panel.test.ts b/packages/eve/src/cli/dev/tui/setup-panel.test.tsindex 447c52b99..c02c2d9fc 100644--- a/packages/eve/src/cli/dev/tui/setup-panel.test.ts+++ b/packages/eve/src/cli/dev/tui/setup-panel.test.ts@@ -8,6 +8,7 @@ import {renderSelectQuestion,renderTextQuestion,} from "./setup-panel.js";+import { stripAnsi } from "./terminal-text.js";import { createTheme } from "./theme.js";const theme = createTheme({ color: false, unicode: true });@@ -50,7 +51,11 @@ describe("renderFlowPanel", () => {tone: "info" as const,}));const text = renderFlowPanel(- { title: "/channels", lines, content: { kind: "idle", frame: "⠏" } },+ {+ title: "/channels",+ lines,+ content: { kind: "idle", indicator: { glyph: "⠏", color: "yellow" } },+ },theme,60,).join("\n");@@ -67,7 +72,7 @@ describe("renderFlowPanel", () => {lines: [],content: {kind: "status",- status: { text: "Loading teams…", frame: "⠼" },+ status: { text: "Loading teams…", indicator: { glyph: "⠼", color: "yellow" } },},},theme,@@ -77,14 +82,38 @@ describe("renderFlowPanel", () => {expect(text).toContain("⠼ Loading teams…");});- it("rides the status spinner above an open question for the install wait", () => {+ it("renders the build-phase pulse for a setup status", () => {+ const text = renderFlowPanel(+ {+ title: "/model",+ lines: [],+ content: {+ kind: "status",+ status: {+ text: "Checking the project…",+ indicator: { glyph: "▪", color: "green" },+ },+ },+ },+ colorTheme,+ 60,+ ).join("\n");++ expect(text).toContain(colorTheme.colors.green("▪"));+ expect(stripAnsi(text)).toContain("▪ Checking the project…");+ });++ it("rides the status pulse above an open question for the install wait", () => {const text = renderFlowPanel({title: "/channels",lines: [],content: {kind: "question",- status: { text: "Creating a Slackbot through Vercel Connect…", frame: "⠏" },+ status: {+ text: "Creating a Slackbot through Vercel Connect…",+ indicator: { glyph: "▪", color: "green" },+ },rows: [" ◦ Try again", " ◦ Cancel"],},},@@ -92,7 +121,7 @@ describe("renderFlowPanel", () => {60,).join("\n");- expect(text).toContain("⠏ Creating a Slackbot through Vercel Connect…");+ expect(text).toContain("▪ Creating a Slackbot through Vercel Connect…");expect(text).toContain("◦ Try again");expect(text).toContain("◦ Cancel");// The spinner leads; the actions follow.@@ -663,7 +692,7 @@ describe("renderSelectQuestion", () => {});describe("renderTextQuestion", () => {- it("paints the message, caret line, and hints", () => {+ it("paints the message, input line, and hints", () => {const rows = renderTextQuestion({ message: "Project name", editor: lineOf("my-agent"), mask: false },theme,@@ -678,6 +707,42 @@ describe("renderTextQuestion", () => {expect(text).toContain("enter to submit · esc to cancel");});+ it("draws the blinking cursor as a block over the grapheme under it", () => {+ const rows = renderTextQuestion(+ {+ message: "Project name",+ editor: { text: "hello", cursor: 3 },+ mask: false,+ },+ colorTheme,+ 60,+ true,+ );+ const input = rows[1] ?? "";++ expect(stripAnsi(input)).toBe(" hello");+ expect(input).toContain(colorTheme.colors.inverse("l"));+ expect(input).not.toContain(colorTheme.glyph.caret);+ });++ it("draws the block over the first placeholder grapheme", () => {+ const rows = renderTextQuestion(+ {+ message: "API key",+ editor: lineOf(""),+ mask: true,+ placeholder: "type your key",+ },+ colorTheme,+ 60,+ true,+ );+ const input = rows[1] ?? "";++ expect(stripAnsi(input)).toBe(" type your key");+ expect(input).toContain(colorTheme.colors.inverse("t"));+ });+it("paints notices above the message, gone with the question", () => {const rows = renderTextQuestion({diff --git a/packages/eve/src/cli/dev/tui/setup-panel.ts b/packages/eve/src/cli/dev/tui/setup-panel.tsindex 689198282..ba46ff0ec 100644--- a/packages/eve/src/cli/dev/tui/setup-panel.ts+++ b/packages/eve/src/cli/dev/tui/setup-panel.ts@@ -23,11 +23,16 @@ import {} from "#setup/cli/option-row.js";import { filterOptions, submitRowIndex, type SelectState } from "#setup/cli/select-state.js";import type { SelectNotice } from "#setup/prompter.js";-import { graphemes } from "#shared/text-boundaries.js";-import { visibleLine, type LineState } from "./line-editor.js";+import { maskLine, visibleLine, type LineState } from "./line-editor.js";import type { Theme } from "./theme.js";-import { clipVisible, renderInputText, visibleLength, wrapVisibleLine } from "./terminal-text.js";+import {+ clipVisible,+ renderInputText,+ renderInputWithBlockCursor,+ visibleLength,+ wrapVisibleLine,+} from "./terminal-text.js";function clip(line: string, width: number): string {return clipVisible(line, width);@@ -113,21 +118,27 @@ export interface FlowPanelLine {evidence?: boolean;}+/** One already-resolved animation frame and its active color. */+export interface FlowPanelIndicator {+ glyph: string;+ color: "green" | "yellow";+}+export type FlowPanelContent =| {kind: "question";rows: readonly string[];- /** The install wait keeps its spinner above the concurrent actions. */- status?: { text: string; frame: string };+ /** The install wait keeps its indicator above the concurrent actions. */+ status?: { text: string; indicator: FlowPanelIndicator };}| {kind: "status";- status: { text: string; frame: string };+ status: { text: string; indicator: FlowPanelIndicator };/** Latest child-process output shown transiently beneath the status. */preview?: string;}- | { kind: "preview"; text: string; frame: string }- | { kind: "idle"; frame: string };+ | { kind: "preview"; text: string; indicator: FlowPanelIndicator }+ | { kind: "idle"; indicator: FlowPanelIndicator };/** The whole bordered section: title, recent progress, and one explicit mode. */export interface FlowPanelState {@@ -174,9 +185,15 @@ 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);+}+/*** Paints the bordered flow panel. Everything a running command produces lives- * here — progress, questions, the status spinner — and the panel vanishes+ * here — progress, questions, the status indicator — and the panel vanishes* wholesale when the command resolves; only the command echo and the elbow* outcome persist in the transcript.*/@@ -199,28 +216,32 @@ export function renderFlowPanel(state: FlowPanelState, theme: Theme, width: numbswitch (state.content.kind) {case "question":- // The install wait's question rides beneath its live status spinner.+ // The install wait's question rides beneath its live status indicator.if (state.content.status !== undefined) {rows.push(- ` ${c.yellow(state.content.status.frame)} ${c.dim(state.content.status.text)}`,+ ` ${renderIndicator(state.content.status.indicator, theme)} ${c.dim(state.content.status.text)}`,"",);}rows.push(...state.content.rows);break;case "status":- rows.push(` ${c.yellow(state.content.status.frame)} ${c.dim(state.content.status.text)}`);+ rows.push(+ ` ${renderIndicator(state.content.status.indicator, theme)} ${c.dim(state.content.status.text)}`,+ );if (state.content.preview !== undefined) {rows.push(` ${c.dim(state.content.preview)}`);}break;case "preview":- rows.push(` ${c.yellow(state.content.frame)} ${c.dim(state.content.text)}`);+ rows.push(+ ` ${renderIndicator(state.content.indicator, theme)} ${c.dim(state.content.text)}`,+ );break;case "idle":// A flow between phases must never look dead: boxes run subprocesses// without narrating every gap, so the panel keeps a live pulse.- rows.push(` ${c.yellow(state.content.frame)} ${c.dim("Working…")}`);+ rows.push(` ${renderIndicator(state.content.indicator, theme)} ${c.dim("Working…")}`);break;}@@ -610,7 +631,7 @@ export function renderSelectQuestion(return rows.map((row) => clip(row, width));}-/** Paints a text question section: message, a caret-bearing input line, hints. */+/** Paints a text question section: message, a block-cursor input line, hints. */export function renderTextQuestion(state: SetupTextPanelState,theme: Theme,@@ -626,18 +647,15 @@ export function renderTextQuestion(rows.push(...state.message.split("\n").map((line) => ` ${c.bold(line)}`));const budget = Math.max(4, width - 4);- const display = state.mask- ? {- text: "•".repeat(graphemes(state.editor.text).length),- cursor: graphemes(state.editor.text.slice(0, state.editor.cursor)).length,- }- : { text: state.editor.text, cursor: state.editor.cursor };- const { before, under, after } = visibleLine(display, budget, theme.glyph.ellipsis);- const caret = caretVisible ? c.cyan(theme.glyph.caret) : " ";- const body =- state.editor.text.length === 0 && state.placeholder !== undefined- ? `${caret}${c.dim(state.placeholder)}`- : `${renderInputText(before)}${caret}${renderInputText(under)}${renderInputText(after)}`;+ const display = state.mask ? maskLine(state.editor) : state.editor;+ const placeholder = state.editor.text.length === 0 ? state.placeholder : undefined;+ const cursorLine = placeholder === undefined ? display : { text: placeholder, cursor: 0 };+ const body = renderInputWithBlockCursor({+ ...visibleLine(cursorLine, budget, theme.glyph.ellipsis),+ visible: caretVisible,+ inverse: c.inverse,+ render: placeholder === undefined ? renderInputText : (text) => c.dim(renderInputText(text)),+ });rows.push(` ${body}`);if (state.error !== undefined) {diff --git a/packages/eve/src/cli/dev/tui/terminal-renderer.test.ts b/packages/eve/src/cli/dev/tui/terminal-renderer.test.tsindex 1115aa70c..4853ca5da 100644--- a/packages/eve/src/cli/dev/tui/terminal-renderer.test.ts+++ b/packages/eve/src/cli/dev/tui/terminal-renderer.test.ts@@ -200,6 +200,70 @@ describe("TerminalRenderer (inline scrollback)", () => {renderer.shutdown();});+ it("uses the turn pulse while waiting for the first stream event", async () => {+ vi.useFakeTimers();+ try {+ const { screen, renderer } = makeRenderer();+ renderer.renderAgentHeader({+ name: "Weather Agent",+ serverUrl: "http://localhost:3000",+ info: agentInfoWithModel("gpt-5"),+ });+ let streamController: ReadableStreamDefaultController<AgentTUIStreamEvent> | undefined;+ const rendering = renderer.renderStream(+ {+ events: new ReadableStream<AgentTUIStreamEvent>({+ start(controller) {+ streamController = controller;+ },+ }),+ },+ { submittedPrompt: "hello", continueSession: true },+ );++ await Promise.resolve();+ let lines = screen.snapshot().split("\n");+ let workingRow = lines.findIndex((line) => line === " ⊙ Working…");+ expect(workingRow).toBeGreaterThan(-1);+ expect(lines[workingRow + 1]).toBe("");+ expect(lines[workingRow + 2]).toContain("gpt-5");++ vi.advanceTimersByTime(450);+ expect(screen.snapshot()).not.toContain("⊙ Working…");+ lines = screen.snapshot().split("\n");+ workingRow = lines.findIndex((line) => line === " Working…");+ expect(workingRow).toBeGreaterThan(-1);+ expect(lines[workingRow + 1]).toBe("");+ expect(lines[workingRow + 2]).toContain("gpt-5");++ streamController?.close();+ await rendering;+ renderer.shutdown();+ } finally {+ vi.useRealTimers();+ }+ });++ it("uses an ASCII fallback for the turn pulse", async () => {+ const screen = new MockScreen({ columns: 80, rows: 30 });+ const input = new MockUserInput();+ const renderer = new TerminalRenderer({+ input,+ output: screen,+ captureForeignOutput: false,+ unicode: false,+ });+ const prompt = renderer.readPrompt();++ input.type("hello");+ input.enter();++ expect(await prompt).toBe("hello");+ expect(screen.snapshot()).toContain(" o Working…");+ expect(screen.snapshot()).not.toContain("⊙");+ renderer.shutdown();+ });+it("interrupts a running response and returns to the prompt without exiting", async () => {const { screen, input, renderer } = makeRenderer();let streamController: ReadableStreamDefaultController<AgentTUIStreamEvent> | undefined;@@ -304,7 +368,7 @@ describe("TerminalRenderer (inline scrollback)", () => {renderer.shutdown();});- it("draws the caret over the character under it without inserting a cell", async () => {+ it("draws the block cursor over the character under it without inserting a cell", async () => {const { screen, input, renderer } = makeRenderer();const prompt = renderer.readPrompt();@@ -643,8 +707,52 @@ describe("TerminalRenderer (inline scrollback)", () => {renderer.shutdown();});- it("does not paint a prompt while input is detached for a running turn", async () => {+ it("starts the turn pulse as soon as the prompt is submitted", async () => {+ vi.useFakeTimers();+ try {+ const { screen, input, renderer } = makeRenderer();+ const prompt = renderer.readPrompt();++ input.type("hello");+ input.enter();++ expect(await prompt).toBe("hello");+ expect(screen.snapshot()).toContain(" ⊙ Working…");++ vi.advanceTimersByTime(450);+ expect(screen.snapshot()).not.toContain("⊙ Working…");+ expect(screen.snapshot()).toContain(" Working…");++ let streamController: ReadableStreamDefaultController<AgentTUIStreamEvent> | undefined;+ const rendering = renderer.renderStream(+ {+ events: new ReadableStream<AgentTUIStreamEvent>({+ start(controller) {+ streamController = controller;+ },+ }),+ },+ { continueSession: true },+ );+ await Promise.resolve();+ expect(screen.snapshot()).not.toContain("⊙ Working…");+ expect(screen.snapshot()).toContain(" Working…");++ streamController?.close();+ await rendering;+ renderer.shutdown();+ } finally {+ vi.useRealTimers();+ }+ });++ it("removes the turn indicator when reasoning starts", async () => {const { screen, renderer } = makeRenderer();+ renderer.renderAgentHeader({+ name: "Weather Agent",+ serverUrl: "http://localhost:3000",+ info: agentInfoWithModel("gpt-5"),+ });let streamController: ReadableStreamDefaultController<AgentTUIStreamEvent> | undefined;const rendering = renderer.renderStream({@@ -663,11 +771,16 @@ describe("TerminalRenderer (inline scrollback)", () => {});const lines = screen.snapshot().split("\n");const thinkingRow = lines.findIndex((line) => line.includes("thinking"));- const workingRow = lines.findIndex((line) => line.includes("Responding…"));+ const workingRow = lines.findIndex(+ (line) => line.includes("Working…") || line.includes("Responding…"),+ );+ const modelRow = lines.findIndex((line) => line.includes("gpt-5"));const inputRow = lines.findIndex((line) => line.includes("❯"));expect(thinkingRow).toBeGreaterThan(-1);- expect(workingRow).toBeGreaterThan(thinkingRow);+ expect(workingRow).toBe(-1);+ expect(lines[thinkingRow + 1]).toBe("");+ expect(modelRow).toBe(thinkingRow + 2);expect(inputRow).toBe(-1);streamController?.close();@@ -714,6 +827,7 @@ describe("TerminalRenderer (inline scrollback)", () => {input.type("no");input.enter();await answer;+ expect(screen.snapshot()).toContain("⊙ Working…");renderer.shutdown();});@@ -1382,6 +1496,7 @@ describe("TerminalRenderer (inline scrollback)", () => {});input.type("n");expect(await approval).toEqual({ approved: false, reason: "Denied by user." });+ expect(screen.snapshot()).toContain("⊙ Working…");renderer.shutdown();const snapshot = screen.snapshot();@@ -1389,6 +1504,49 @@ describe("TerminalRenderer (inline scrollback)", () => {expect(snapshot).toContain("→ denied");});+ it("stops the turn ticker while a later human-input request is open", async () => {+ vi.useFakeTimers();+ try {+ const { screen, input, renderer } = makeRenderer();++ const firstApproval = renderer.readToolApproval({+ approvalId: "a1",+ toolCallId: "c1",+ toolName: "read_file",+ input: { path: "README.md" },+ });+ input.type("y");+ await firstApproval;++ const question = renderer.readInputQuestion({+ requestId: "q1",+ prompt: "Continue?",+ display: "select",+ options: [{ id: "yes", label: "Yes" }],+ });+ const questionOutputLength = screen.rawOutput().length;+ vi.advanceTimersByTime(300);+ expect(screen.rawOutput()).toHaveLength(questionOutputLength);+ input.enter();+ await question;++ const secondApproval = renderer.readToolApproval({+ approvalId: "a2",+ toolCallId: "c2",+ toolName: "write_file",+ input: { path: "README.md" },+ });+ const approvalOutputLength = screen.rawOutput().length;+ vi.advanceTimersByTime(300);+ expect(screen.rawOutput()).toHaveLength(approvalOutputLength);+ input.type("n");+ await secondApproval;+ renderer.shutdown();+ } finally {+ vi.useRealTimers();+ }+ });+it("does not treat bracketed-paste text as a tool approval action", async () => {const { input, renderer } = makeRenderer();const approval = renderer.readToolApproval({@@ -1654,6 +1812,42 @@ describe("TerminalRenderer setup panel", () => {});describe("TerminalRenderer setup flow session", () => {+ it("uses the build-phase pulse for pulse setup flows", () => {+ vi.useFakeTimers();+ try {+ const { screen, renderer } = makeRenderer();++ renderer.setupFlow.begin("Configure the agent model", "pulse");+ renderer.setupFlow.setStatus("Checking the project…");+ expect(screen.snapshot()).toContain("▪ Checking the project…");++ vi.advanceTimersByTime(450);+ expect(screen.snapshot()).not.toContain("▪ Checking the project…");+ expect(screen.snapshot()).toContain(" Checking the project…");+ renderer.shutdown();+ } finally {+ vi.useRealTimers();+ }+ });++ it("uses an ASCII fallback for pulse setup flows", () => {+ const screen = new MockScreen({ columns: 80, rows: 30 });+ const input = new MockUserInput();+ const renderer = new TerminalRenderer({+ input,+ output: screen,+ captureForeignOutput: false,+ unicode: false,+ });++ renderer.setupFlow.begin("Configure the agent model", "pulse");+ renderer.setupFlow.setStatus("Checking the project...");++ expect(screen.snapshot()).toContain("* Checking the project...");+ expect(screen.snapshot()).not.toContain("▪");+ renderer.shutdown();+ });+it("holds flow output inside the panel and clears it on end, flushing warnings", () => {const { screen, renderer } = makeRenderer();@@ -2263,7 +2457,7 @@ describe("TerminalRenderer status line", () => {renderer.shutdown();});- it("shows the running token total on the status line, not the Ready row", async () => {+ it("keeps the running token total after the turn indicator disappears", async () => {const { screen, renderer } = makeRenderer();await renderer.renderStream(streamOf([@@ -2278,9 +2472,8 @@ describe("TerminalRenderer status line", () => {const lines = screen.snapshot().split("\n");const readyRow = lines.find((line) => line.includes("Ready"));const statusRow = lines.find((line) => line.includes("↑ 500 ↓ 300"));- expect(readyRow).toBeDefined();+ expect(readyRow).toBeUndefined();expect(statusRow).toBeDefined();- expect(readyRow).not.toContain("↑ 500");renderer.shutdown();});diff --git a/packages/eve/src/cli/dev/tui/terminal-renderer.ts b/packages/eve/src/cli/dev/tui/terminal-renderer.tsindex f40c7010b..e3d51ad89 100644--- a/packages/eve/src/cli/dev/tui/terminal-renderer.ts+++ b/packages/eve/src/cli/dev/tui/terminal-renderer.ts@@ -34,12 +34,14 @@ import {renderSelectQuestion,renderTextQuestion,type FlowPanelContent,+ type FlowPanelIndicator,type FlowPanelLine,type SetupPanelOption,type SetupSelectPanelState,} from "./setup-panel.js";import type {SetupEditableSelectResult,+ SetupFlowIndicator,SetupFlowRenderer,SetupSelectRequest,} from "./setup-flow.js";@@ -86,10 +88,21 @@ import { LiveRegion } from "./live-region.js";import { buildStatusLine } from "./status-line.js";import { nextLogDisplayMode } from "./log-display-mode.js";import { createTheme, detectUnicode, type Theme } from "./theme.js";-import { clipVisible, renderInputText, stripAnsi, stripTerminalControls } from "./terminal-text.js";+import {+ clipVisible,+ renderInputText,+ renderInputWithBlockCursor,+ stripAnsi,+ stripTerminalControls,+} from "./terminal-text.js";import type { VercelStatusSnapshot } from "./vercel-status.js";import { summarizeToolArgs, summarizeToolResult } from "./tool-format.js";import { reduceSetupSelectInput, setupSelectionIntent } from "./setup-selection-input.js";+import {+ isProgressPulseVisible,+ PROGRESS_PULSE_ASCII_GLYPH,+ PROGRESS_PULSE_GLYPH,+} from "#cli/ui/progress-pulse.js";import {formatAssistantResponseStats,formatTokenFlow,@@ -149,8 +162,16 @@ function completedTurnStatus(interrupted: boolean, continueSession: boolean): streturn "Done";}+type SetupFlowIndicatorState = { kind: "spinner" } | { kind: "pulse"; startedAtMs: number };++type TurnIndicatorState =+ | { kind: "idle" }+ | { kind: "waiting"; startedAtMs: number }+ | { kind: "answering" };+type SetupFlowState = {title: string;+ indicator: SetupFlowIndicatorState;lines: FlowPanelLine[];status?: string;/** Latest subprocess output line; replaced per write, never persisted. */@@ -221,6 +242,8 @@ type NativeToolState = {const caretBlinkMs = 500;const tickMs = 90;+const TURN_PULSE_GLYPH = "⊙";+const TURN_PULSE_ASCII_GLYPH = "o";// How long to wait on a lone `ESC` before treating it as the Escape key, so a// split arrow sequence (`ESC` then `[A`) has time to reassemble first.const escFlushMs = 30;@@ -304,7 +327,7 @@ export class TerminalRenderer implements AgentTUIRenderer {* a `/`-prefixed freeform answer must never sprout suggestions.*/#typeahead?: CommandTypeaheadState;- #working = false;+ #turnIndicator: TurnIndicatorState = { kind: "idle" };#status: string = STATUS.processing;#title = "eve";#isInteractive = false;@@ -360,7 +383,7 @@ export class TerminalRenderer implements AgentTUIRenderer {/** The installed working-state key consumer, so re-arming and disposal can recognize it. */#flowIdleConsumer?: (key: TerminalKey) => void;readonly setupFlow: SetupFlowRenderer = {- begin: (title) => this.#beginSetupFlow(title),+ begin: (title, indicator) => this.#beginSetupFlow(title, indicator),end: (options) => this.#endSetupFlow(options?.preserveDiagnostics ?? true),readSelect: (options) => this.#readSetupSelect(options),readEditableSelect: (options) => this.#readSetupEditableSelect(options),@@ -428,8 +451,9 @@ export class TerminalRenderer implements AgentTUIRenderer {async readPrompt(options?: AgentTUISessionOptions): Promise<string> {this.#start(options);+ this.#stopTicker();this.#inputActive = true;- this.#working = false;+ this.#turnIndicator = { kind: "idle" };this.#status = "";let editor: LineState = lineOf(stripPromptControlCharacters(options?.initialDraft ?? ""));this.#promptHistory.begin(editor.text);@@ -525,6 +549,7 @@ export class TerminalRenderer implements AgentTUIRenderer {this.#promptHistory.add(prompt);this.#inputActive = false;this.#stopCaretBlink();+ this.#startWorking();this.#status = STATUS.processing;if (isPromptControlCommand(prompt)) {// Commands echo as their own line (blue, under the prompt@@ -592,7 +617,9 @@ export class TerminalRenderer implements AgentTUIRenderer {// ids from prior turns must not suppress the next prompt's blocks.this.#committedIds.clear();this.#inputActive = false;- this.#working = true;+ if (this.#turnIndicator.kind !== "waiting") {+ this.#turnIndicator = { kind: "waiting", startedAtMs: Date.now() };+ }this.#status = STATUS.processing;this.#addSubmittedPrompt(options?.submittedPrompt);this.#interrupted = false;@@ -633,7 +660,9 @@ export class TerminalRenderer implements AgentTUIRenderer {if (this.#interrupted) result.abort?.();this.#detachInput();this.#stopTicker();- this.#working = false;+ if (this.#turnIndicator.kind === "waiting") {+ this.#turnIndicator = { kind: "idle" };+ }this.#status = completedTurnStatus(this.#interrupted, options?.continueSession === true);this.#finalizeAllBlocks();this.#paint();@@ -649,8 +678,9 @@ export class TerminalRenderer implements AgentTUIRenderer {options?: AgentTUISessionOptions,): Promise<AgentTUIToolApprovalResponse> {this.#start(options);+ this.#stopTicker();this.#inputActive = false;- this.#working = false;+ this.#turnIndicator = { kind: "idle" };this.#status = `Approve ${formatToolApprovalTitle(request)}? (y/n)`;this.#interrupted = false;this.#paint();@@ -664,11 +694,13 @@ export class TerminalRenderer implements AgentTUIRenderer {if (key.framing !== "unframed") break;const value = key.value.toLowerCase();if (value === "y") {+ this.#startWorking();this.#status = STATUS.processing;this.#detachInput();this.#paint();resolve({ approved: true });} else if (value === "n") {+ this.#startWorking();this.#status = STATUS.processing;this.#markToolDenied(request.toolCallId);this.#detachInput();@@ -699,8 +731,9 @@ export class TerminalRenderer implements AgentTUIRenderer {options?: AgentTUISessionOptions,): Promise<AgentTUIInputQuestionResponse | undefined> {this.#start(options);+ this.#stopTicker();this.#inputActive = false;- this.#working = false;+ this.#turnIndicator = { kind: "idle" };this.#interrupted = false;const optionList = question.options ?? [];@@ -758,6 +791,7 @@ export class TerminalRenderer implements AgentTUIRenderer {live: false,});this.#inputActive = false;+ this.#startWorking();this.#status = STATUS.processing;this.#stopCaretBlink();this.#detachInput();@@ -1088,13 +1122,20 @@ export class TerminalRenderer implements AgentTUIRenderer {* every flow line, question, and status renders inside it; the transcript* above stays untouched.*/- #beginSetupFlow(title: string): void {+ #beginSetupFlow(title: string, indicator: SetupFlowIndicator = "spinner"): void {this.#start();this.#inputActive = false;- this.#working = false;+ this.#turnIndicator = { kind: "idle" };this.#status = "";- this.#setupFlow = { title: stripTerminalControls(title), lines: [], outputBuffer: [] };- // The ticker runs for the whole flow: the idle pulse, the status spinner,+ const indicatorState: SetupFlowIndicatorState =+ indicator === "pulse" ? { kind: "pulse", startedAtMs: Date.now() } : { kind: "spinner" };+ this.#setupFlow = {+ title: stripTerminalControls(title),+ indicator: indicatorState,+ lines: [],+ outputBuffer: [],+ };+ // The ticker runs for the whole flow: the idle pulse, the status indicator,// and the output preview all animate through it.this.#startTicker();this.#paint();@@ -1503,7 +1544,7 @@ export class TerminalRenderer implements AgentTUIRenderer {#beginSetupQuestion(): SetupFlowState {this.#start();this.#inputActive = false;- this.#working = false;+ this.#turnIndicator = { kind: "idle" };this.#status = "";return this.#requireSetupFlow();}@@ -1511,7 +1552,12 @@ export class TerminalRenderer implements AgentTUIRenderer {/** A flow is implicitly opened for a bare question (tests, future hosts). */#requireSetupFlow(): SetupFlowState {if (this.#setupFlow === undefined) {- this.#setupFlow = { title: "", lines: [], outputBuffer: [] };+ this.#setupFlow = {+ title: "",+ indicator: { kind: "spinner" },+ lines: [],+ outputBuffer: [],+ };}return this.#setupFlow;}@@ -1606,7 +1652,7 @@ export class TerminalRenderer implements AgentTUIRenderer {/*** The flow's ephemeral one-line loading state: a message turns the footer- * status into the working spinner; `undefined` clears it. Nothing is ever+ * status into the working indicator; `undefined` clears it. Nothing is ever* committed to the transcript.*/#setFlowStatus(text: string | undefined): void {@@ -1618,16 +1664,15 @@ export class TerminalRenderer implements AgentTUIRenderer {return;}if (content === undefined) {- this.#working = false;+ this.#turnIndicator = { kind: "idle" };this.#status = "";this.#stopTicker();this.#paint();return;}this.#start();- this.#working = true;+ this.#startWorking();this.#status = content;- this.#startTicker();this.#paint();}@@ -1846,6 +1891,7 @@ export class TerminalRenderer implements AgentTUIRenderer {case "ctrl-c":if (!this.#interrupted) {this.#interrupted = true;+ this.#turnIndicator = { kind: "idle" };this.#status = "Interrupted";this.#resolveStreamInterrupt?.();this.#paint();@@ -1887,6 +1933,11 @@ export class TerminalRenderer implements AgentTUIRenderer {this.#tickTimer.unref?.();}+ #startWorking(): void {+ this.#turnIndicator = { kind: "waiting", startedAtMs: Date.now() };+ this.#startTicker();+ }+#stopTicker() {if (this.#tickTimer) {clearInterval(this.#tickTimer);@@ -1992,8 +2043,9 @@ export class TerminalRenderer implements AgentTUIRenderer {break;case "assistant-delta": {- this.#setStreamStatus(STATUS.streaming);const text = (turnState.text.get(event.id) ?? "") + stripTerminalControls(event.delta);+ this.#showAnswerContent(text);+ this.#setStreamStatus(STATUS.streaming);turnState.text.set(event.id, text);this.#upsertAssistantBlock(event.id, text, true);break;@@ -2005,6 +2057,7 @@ export class TerminalRenderer implements AgentTUIRenderer {event.text !== undefined && existing.length === 0? stripTerminalControls(event.text ?? ""): existing;+ this.#showAnswerContent(text);turnState.text.set(event.id, text);this.#upsertAssistantBlock(event.id, text, false);break;@@ -2012,8 +2065,9 @@ export class TerminalRenderer implements AgentTUIRenderer {case "reasoning-delta": {if (displayModes.reasoning === "hidden") break;- this.#setStreamStatus(STATUS.streaming);const text = (turnState.reasoning.get(event.id) ?? "") + stripTerminalControls(event.delta);+ this.#showAnswerContent(text);+ this.#setStreamStatus(STATUS.streaming);turnState.reasoning.set(event.id, text);this.#upsertReasoningBlock(event.id, text, true, displayModes);break;@@ -2022,6 +2076,7 @@ export class TerminalRenderer implements AgentTUIRenderer {case "reasoning-complete": {if (displayModes.reasoning === "hidden") break;const text = turnState.reasoning.get(event.id) ?? "";+ this.#showAnswerContent(text);this.#upsertReasoningBlock(event.id, text, false, displayModes);break;}@@ -2095,6 +2150,10 @@ export class TerminalRenderer implements AgentTUIRenderer {this.#paint();}+ #showAnswerContent(text: string): void {+ if (text.trim().length > 0) this.#turnIndicator = { kind: "answering" };+ }+#upsertAssistantBlock(id: string, text: string, live: boolean): void {const content = stripTerminalControls(text).trim();if (content.length === 0) return;@@ -2366,6 +2425,23 @@ export class TerminalRenderer implements AgentTUIRenderer {return this.#theme.spinner[this.#spinnerIndex % this.#theme.spinner.length] ?? "";}+ #progressPulseGlyph(startedAtMs: number, glyph: string): string {+ return isProgressPulseVisible(Date.now() - startedAtMs) ? glyph : " ";+ }++ #setupFlowIndicator(flow: SetupFlowState): FlowPanelIndicator {+ if (flow.indicator.kind === "spinner") {+ return { glyph: this.#spinnerFrame(), color: "yellow" };+ }+ return {+ glyph: this.#progressPulseGlyph(+ flow.indicator.startedAtMs,+ this.#theme.unicode ? PROGRESS_PULSE_GLYPH : PROGRESS_PULSE_ASCII_GLYPH,+ ),+ color: "green",+ };+ }+#footerRows(width: number): string[] {const c = this.#theme.colors;const rows: string[] = [""];@@ -2376,30 +2452,30 @@ 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 frame = this.#spinnerFrame();+ const indicator = this.#setupFlowIndicator(flow);let content: FlowPanelContent;- // A live status spinner rides alongside an open question only when one is+ // A live status indicator rides alongside an open question only when one is// explicitly set (the install wait); ordinary questions leave it cleared,// so their panels stay status-free as before.if (flow.question !== undefined) {const rows = flow.question(width);content = { kind: "question", rows };if (flow.status !== undefined) {- content = { kind: "question", rows, status: { text: flow.status, frame } };+ content = { kind: "question", rows, status: { text: flow.status, indicator } };}} else if (flow.status !== undefined) {- content = { kind: "status", status: { text: flow.status, frame } };+ content = { kind: "status", status: { text: flow.status, indicator } };if (flow.preview !== undefined) {content = {kind: "status",- status: { text: flow.status, frame },+ status: { text: flow.status, indicator },preview: flow.preview,};}} else if (flow.preview !== undefined) {- content = { kind: "preview", text: flow.preview, frame };+ content = { kind: "preview", text: flow.preview, indicator };} else {- content = { kind: "idle", frame };+ content = { kind: "idle", indicator };}const state: Parameters<typeof renderFlowPanel>[0] = {title: flow.title,@@ -2455,17 +2531,34 @@ export class TerminalRenderer implements AgentTUIRenderer {return rows;}- const icon = this.#working ? c.yellow(this.#spinnerFrame()) : c.dim(this.#theme.glyph.dot);+ const turnIndicator = this.#turnIndicator;+ if (turnIndicator.kind === "answering") {+ this.#pushStatusLine(rows, width);+ return rows;+ }+ const working = turnIndicator.kind === "waiting";+ const icon = working+ ? c.green(+ this.#progressPulseGlyph(+ turnIndicator.startedAtMs,+ this.#theme.unicode ? TURN_PULSE_GLYPH : TURN_PULSE_ASCII_GLYPH,+ ),+ )+ : c.dim(this.#theme.glyph.dot);const statusText = this.#status.length > 0 ? this.#status : "Ready";- // Dim the live streaming status (the spinner carries the eye); keep+ // Dim the live streaming status (the pulse carries the eye); keep// interactive prompts (approvals, questions) at full intensity.- const status = this.#working ? c.dim(statusText) : statusText;+ const status = working ? c.dim(statusText) : statusText;const meta = this.#statusMeta();+ const indent = working ? " " : "";const line = meta- ? `${icon} ${status} ${c.dim(this.#theme.glyph.dot)} ${meta}`- : `${icon} ${status}`;+ ? `${indent}${icon} ${status} ${c.dim(this.#theme.glyph.dot)} ${meta}`+ : `${indent}${icon} ${status}`;rows.push(clip(line, width));- this.#pushStatusLine(rows, width);+ const statusRows: string[] = [];+ this.#pushStatusLine(statusRows, width);+ if (working && statusRows.length > 0) rows.push("");+ rows.push(...statusRows);return rows;}@@ -2830,7 +2923,7 @@ function promptInputRows({);const promptGlyph = c.cyan(theme.glyph.prompt);const ellipsis = c.dim(theme.glyph.ellipsis);- // Reserve the leading pad, gutter, and block caret's trailing cell at end-of-line.+ // Reserve the leading pad, gutter, and block cursor's trailing cell at end-of-line.const budget = Math.max(1, width - 4);const out: string[] = [];for (let r = top; r < top + visibleCount; r += 1) {@@ -2849,10 +2942,14 @@ function promptInputRows({budget,theme.glyph.ellipsis,);- // Inverse video keeps the underlying text in place; EOL uses a space.- const caretText = under || " ";- const caretCell = caretVisible ? c.inverse(renderInputText(caretText)) : style(caretText);- body = `${style(before)}${caretCell}${style(after)}`;+ body = renderInputWithBlockCursor({+ before,+ under,+ after,+ visible: caretVisible,+ inverse: c.inverse,+ render: style,+ });// The argument hint trails the caret only on a single-line command draft.if (ghost.length > 0 && layout.rows.length === 1) body += ghost;} else {diff --git a/packages/eve/src/cli/dev/tui/terminal-text.ts b/packages/eve/src/cli/dev/tui/terminal-text.tsindex 35a682f5e..9369b1c73 100644--- a/packages/eve/src/cli/dev/tui/terminal-text.ts+++ b/packages/eve/src/cli/dev/tui/terminal-text.ts@@ -88,6 +88,25 @@ export function renderInputText(input: string): string {return input.replaceAll("\t", " ");}+interface BlockCursorInput {+ readonly before: string;+ readonly under: string;+ readonly after: string;+ readonly visible: boolean;+ readonly inverse: (text: string) => string;+ readonly render?: (text: string) => string;+}++/** Renders a blinking block cursor without inserting or removing a terminal cell. */+export function renderInputWithBlockCursor(input: BlockCursorInput): string {+ const render = input.render ?? renderInputText;+ const cursorText = input.under.length > 0 ? input.under : " ";+ const cursorCell = input.visible+ ? input.inverse(renderInputText(cursorText))+ : render(cursorText);+ return `${render(input.before)}${cursorCell}${render(input.after)}`;+}+/*** Returns the UTF-16 offset at or immediately before a terminal column.* Graphemes stay intact even when the requested column falls inside a wide one.diff --git a/packages/eve/src/cli/ui/live-row.ts b/packages/eve/src/cli/ui/live-row.tsindex f97051b24..aba00643d 100644--- a/packages/eve/src/cli/ui/live-row.ts+++ b/packages/eve/src/cli/ui/live-row.ts@@ -2,6 +2,11 @@ import pc from "picocolors";import { sliceVisible, visibleLength } from "#cli/dev/tui/terminal-text.js";import { sanitizeForTerminal } from "#cli/ui/output.js";+import {+ PROGRESS_PULSE_DURATION_MS,+ PROGRESS_PULSE_GLYPH,+ PROGRESS_PULSE_SEQUENCE,+} from "#cli/ui/progress-pulse.js";import { isLogLevelEnabled } from "#internal/logging.js";interface CliLiveRow {@@ -25,9 +30,6 @@ interface CliLiveRowOptions {}const REDRAW_PROGRESS_ROW = "\r\u001B[K";-const PULSE_GLYPH = "▪";-const PULSE_SEQUENCE_DURATION_MS = 1000;-const DEFAULT_PULSE_SEQUENCE = "1111110000111111";function validatePulseSequence(sequence: string): void {if (sequence.length !== 8 && sequence.length !== 16) {@@ -39,8 +41,8 @@ function validatePulseSequence(sequence: string): void {}function pulseStepDurationMs(index: number, stepCount: number): number {- const start = Math.round((index * PULSE_SEQUENCE_DURATION_MS) / stepCount);- const end = Math.round(((index + 1) * PULSE_SEQUENCE_DURATION_MS) / stepCount);+ const start = Math.round((index * PROGRESS_PULSE_DURATION_MS) / stepCount);+ const end = Math.round(((index + 1) * PROGRESS_PULSE_DURATION_MS) / stepCount);return end - start;}@@ -81,7 +83,7 @@ export function startCliLiveRow(options: CliLiveRowOptions = {},): CliLiveRow {const output = options.output ?? process.stdout;- const pulseSequence = options.pulseSequence ?? DEFAULT_PULSE_SEQUENCE;+ const pulseSequence = options.pulseSequence ?? PROGRESS_PULSE_SEQUENCE;validatePulseSequence(pulseSequence);const animate = output.isTTY === true && !isLogLevelEnabled("debug");@@ -96,7 +98,7 @@ export function startCliLiveRow(const paint = (): void => {if (current === undefined) return;const row = renderProgressRow(- pulseVisible ? PULSE_GLYPH : " ",+ pulseVisible ? PROGRESS_PULSE_GLYPH : " ",current.message,current.detail,output.columns,diff --git a/packages/eve/src/cli/ui/progress-pulse.ts b/packages/eve/src/cli/ui/progress-pulse.tsnew file mode 100644index 000000000..fd80422ba--- /dev/null+++ b/packages/eve/src/cli/ui/progress-pulse.ts@@ -0,0 +1,18 @@+/** The one-cell pulse used while `eve dev` builds an agent. */+export const PROGRESS_PULSE_GLYPH = "▪";++/** Single-cell fallback for terminals without Unicode glyph support. */+export const PROGRESS_PULSE_ASCII_GLYPH = "*";++/** Lit and unlit steps in the build indicator's one-second loop. */+export const PROGRESS_PULSE_SEQUENCE = "1111110000111111";++/** Duration of one complete build-indicator pulse. */+export const PROGRESS_PULSE_DURATION_MS = 1000;++/** Whether the shared build pulse is lit at an elapsed time. */+export function isProgressPulseVisible(elapsedMs: number): boolean {+ const loopTime = elapsedMs % PROGRESS_PULSE_DURATION_MS;+ const step = Math.floor((loopTime * PROGRESS_PULSE_SEQUENCE.length) / PROGRESS_PULSE_DURATION_MS);+ return PROGRESS_PULSE_SEQUENCE[step] === "1";+}