The Open Framework for Building Agents
fix(eve): make /new the dev TUI fresh-session command and confirm /clear (#4200)
Andrew Barba73242f083002
diff --git a/.changeset/tui-new-command-feedback.md b/.changeset/tui-new-command-feedback.mdnew file mode 100644index 000000000..6fe1ba805--- /dev/null+++ b/.changeset/tui-new-command-feedback.md@@ -0,0 +1,5 @@+---+"eve": patch+---++In the dev TUI, `/new` now starts a fresh session, and `/reset` is an alias of `/new`. `/clear` still clears the session's model-message history in place, and now confirms with "Session context cleared" instead of disappearing without feedback.diff --git a/docs/guides/dev-tui.md b/docs/guides/dev-tui.mdindex 1abbee1a9..9e1bd098b 100644--- a/docs/guides/dev-tui.md+++ b/docs/guides/dev-tui.md@@ -22,8 +22,8 @@ Before your first message, the empty composer may suggest asking your local agen| Command | Description || ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ || `/model` | Choose the model, speed, and reasoning. Pass a model ID to set it directly: `/model provider/model-id`. |-| `/reset` | Start a fresh session. |-| `/clear` | Clear the session's model-message history. `/new` is an alias. |+| `/new` | Start a fresh session and clear the screen. `/reset` is an alias. |+| `/clear` | Clear the session's model-message history and keep the session. || `/compact` | Compact the current session's context. || `/cancel` | Cancel the current turn without discarding settled context. || `/login` | Connect a ChatGPT subscription, Vercel account, or provider API key. |diff --git a/packages/eve/src/cli/dev/tui/command-typeahead.test.ts b/packages/eve/src/cli/dev/tui/command-typeahead.test.tsindex 89a9c59bb..4a4281149 100644--- a/packages/eve/src/cli/dev/tui/command-typeahead.test.ts+++ b/packages/eve/src/cli/dev/tui/command-typeahead.test.ts@@ -23,7 +23,7 @@ function spec(name: string, options?: Partial<PromptCommandSpec>): PromptCommanddescription: `${name} command`,takesArgument: false,history: "keep",- build: () => ({ type: "reset" }),+ build: () => ({ type: "new" }),...options,};}diff --git a/packages/eve/src/cli/dev/tui/prompt-commands.test.ts b/packages/eve/src/cli/dev/tui/prompt-commands.test.tsindex a9adcf00c..e5b25e5ae 100644--- a/packages/eve/src/cli/dev/tui/prompt-commands.test.ts+++ b/packages/eve/src/cli/dev/tui/prompt-commands.test.ts@@ -9,16 +9,17 @@ import {} from "./prompt-commands.js";describe("parsePromptCommand", () => {- it("parses /reset", () => {- expect(parsePromptCommand("/reset")).toEqual({ type: "reset" });+ it("parses /new and its /reset alias", () => {+ expect(parsePromptCommand("/new")).toEqual({ type: "new" });+ expect(parsePromptCommand("/reset")).toEqual({ type: "new" });});it("parses /cancel", () => {expect(parsePromptCommand("/cancel")).toEqual({ type: "cancel" });});- it("parses /new as a context clear", () => {- expect(parsePromptCommand("/new")).toEqual({ type: "clear" });+ it("parses /clear as a context clear", () => {+ expect(parsePromptCommand("/clear")).toEqual({ type: "clear" });});it("parses /exit and its /quit alias", () => {@@ -100,7 +101,7 @@ describe("parsePromptCommand", () => {});it("trims surrounding whitespace before matching", () => {- expect(parsePromptCommand(" /reset ")).toEqual({ type: "reset" });+ expect(parsePromptCommand(" /new ")).toEqual({ type: "new" });});it("rejects near-misses and ordinary prompts", () => {@@ -161,8 +162,9 @@ describe("promptCommandsFor", () => {describe("isPromptControlCommand", () => {it("is true exactly for recognized commands", () => {- expect(isPromptControlCommand("/reset")).toBe(true);expect(isPromptControlCommand("/new")).toBe(true);+ expect(isPromptControlCommand("/reset")).toBe(true);+ expect(isPromptControlCommand("/clear")).toBe(true);expect(isPromptControlCommand("/model gpt-5")).toBe(true);expect(isPromptControlCommand("/unknown")).toBe(false);expect(isPromptControlCommand("hello")).toBe(false);diff --git a/packages/eve/src/cli/dev/tui/prompt-commands.ts b/packages/eve/src/cli/dev/tui/prompt-commands.tsindex 462382ed6..e5370840e 100644--- a/packages/eve/src/cli/dev/tui/prompt-commands.ts+++ b/packages/eve/src/cli/dev/tui/prompt-commands.ts@@ -4,7 +4,7 @@ type PromptCommandTarget = "local" | "remote";/** The slash commands the prompt accepts. */export type PromptCommand =- | { type: "reset" }+ | { type: "new" }| { type: "cancel" }| { type: "clear" }| { type: "compact" }@@ -60,19 +60,19 @@ const PROMPT_COMMAND_DEFINITIONS = [targets: ["local"],},{- name: "reset",+ name: "new",history: "keep",- aliases: [],+ aliases: ["reset"],description: "Start a fresh session",takesArgument: false,- build: () => ({ type: "reset" }),+ build: () => ({ type: "new" }),targets: ["local", "remote"],},{name: "clear",history: "keep",- aliases: ["new"],- description: "Clear the current session context",+ aliases: [],+ description: "Clear the session context and keep the session",takesArgument: false,build: () => ({ type: "clear" }),targets: ["local", "remote"],@@ -186,7 +186,7 @@ export function promptCommandsFor(target: PromptCommandTarget): readonly PromptCconst commands = PROMPT_COMMAND_DEFINITIONS.filter((definition) =>definition.targets.some((supportedTarget) => supportedTarget === target),);- // Remote sessions have no model picker, so keep bare `/` from defaulting to reset.+ // Remote sessions have no model picker, so keep bare `/` from defaulting to /new.if (target === "remote") {return [...commands.filter((command) => command.name === "help"),@@ -207,9 +207,9 @@ export function isPromptCommandAvailableFor(}/**- * Recognizes the slash commands the prompt accepts. `/reset` clears the- * session and transcript; `/cancel` stops the running turn; `/clear` (and- * `/new`) clears context; `/compact` queues context compaction; `/exit` (and+ * Recognizes the slash commands the prompt accepts. `/new` (and `/reset`)+ * starts a fresh session and transcript; `/cancel` stops the running turn;+ * `/clear` clears context in place; `/compact` queues context compaction; `/exit` (and* `/quit`) terminate the TUI like Ctrl+C; extension commands are dispatched* outside the runner. Anything else — including unknown `/text` — is a normal* message.diff --git a/packages/eve/src/cli/dev/tui/runner.integration.test.ts b/packages/eve/src/cli/dev/tui/runner.integration.test.tsindex 715a9a237..784b28c8d 100644--- a/packages/eve/src/cli/dev/tui/runner.integration.test.ts+++ b/packages/eve/src/cli/dev/tui/runner.integration.test.ts@@ -504,7 +504,7 @@ describe("eve dev conversation", () => {await run;});- it("retires the session on /reset before the next message", async () => {+ it("retires the session on /new before the next message", async () => {const server = new FakeEveServer(reply("Done."));const reset = vi.fn();const tui = scriptedRenderer({ reset });@@ -512,7 +512,7 @@ describe("eve dev conversation", () => {await tui.input({ type: "submit", text: "Hello." });await vi.waitFor(() => expect(tui.latest().working).toBe(false));- await tui.input({ type: "submit", text: "/reset" });+ await tui.input({ type: "submit", text: "/new" });await vi.waitFor(() => expect(reset).toHaveBeenCalledOnce());expect(server.requestsTo("POST", "/session_1/reset")).toHaveLength(1);diff --git a/packages/eve/src/cli/dev/tui/runner.test.ts b/packages/eve/src/cli/dev/tui/runner.test.tsindex 690ca044d..7e43d3d73 100644--- a/packages/eve/src/cli/dev/tui/runner.test.ts+++ b/packages/eve/src/cli/dev/tui/runner.test.ts@@ -133,8 +133,9 @@ describe("parsePromptCommand", () => {});});- it("recognizes /reset, /cancel, /clear, /compact, /exit, and /quit", () => {- expect(parsePromptCommand("/reset")).toEqual({ type: "reset" });+ it("recognizes /new, /reset, /cancel, /clear, /compact, /exit, and /quit", () => {+ expect(parsePromptCommand("/new")).toEqual({ type: "new" });+ expect(parsePromptCommand("/reset")).toEqual({ type: "new" });expect(parsePromptCommand("/cancel")).toEqual({ type: "cancel" });expect(parsePromptCommand("/clear")).toEqual({ type: "clear" });expect(parsePromptCommand("/compact")).toEqual({ type: "compact" });@@ -386,8 +387,9 @@ describe("EveTUIRunner initial input", () => {describe("parsePromptCommand", () => {it.each([- ["/reset", { type: "reset" }],- ["/new", { type: "clear" }],+ ["/new", { type: "new" }],+ ["/reset", { type: "new" }],+ ["/clear", { type: "clear" }],["/exit", { type: "exit" }],["/quit", { type: "exit" }],["/deploy", { type: "extension", name: "deploy", argument: "" }],@@ -1428,7 +1430,7 @@ describe("EveTUIRunner session commands", () => {renderer: turnTaking(["Hello.", "/compact", "/clear", undefined], { finishCommand }).renderer,}).run();- expect(outcomes).toEqual(["Compaction requested", "dismissed"]);+ expect(outcomes).toEqual(["Compaction requested", "Session context cleared"]);expect(server.requestsTo("POST", "/session_1/compact")).toHaveLength(1);expect(server.requestsTo("POST", "/session_1/clear")).toHaveLength(1);expect(server.requestsTo("POST", "/session_1")).toHaveLength(0);diff --git a/packages/eve/src/cli/dev/tui/runner.ts b/packages/eve/src/cli/dev/tui/runner.tsindex ccc4f815e..ee5d626f2 100644--- a/packages/eve/src/cli/dev/tui/runner.ts+++ b/packages/eve/src/cli/dev/tui/runner.ts@@ -238,7 +238,7 @@ export type AgentTUIRenderer = {/*** Reports the server session id backing the conversation — pushed by the* runner once a send is accepted, and overwritten when a later session's- * turn is accepted. Deliberately sticky across `/reset` and interrupt+ * turn is accepted. Deliberately sticky across `/new` and interrupt* recovery: the terminal renderer echoes the LAST session this TUI talked* to in the parting line on exit, so an interrupted conversation (whose* replacement session never ran a turn) can still be found again@@ -283,7 +283,7 @@ export type AgentTUIRenderer = {/*** Clears the rendered transcript and resets per-conversation display* state, leaving the UI interactive on a fresh screen. Used by the- * `/reset` command to start a new session with a clean slate.+ * `/new` command to start a new session with a clean slate.*/reset?(): void;/**@@ -781,7 +781,7 @@ export class EveTUIRunner {});return;}- case "reset":+ case "new":await this.#resetSession();return;case "compact":@@ -795,8 +795,8 @@ export class EveTUIRunner {case "clear":await this.#runSessionCommand({absent: "No active session to clear",+ accepted: "Session context cleared",failed: "Couldn't clear the session",- dismissOnAccepted: true,invoke: () => this.#store.clear(),});return;@@ -1031,9 +1031,8 @@ 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 accepted: string;readonly failed: string;- readonly dismissOnAccepted?: boolean;readonly invoke: () => Promise<{ status: string }>;}): Promise<void> {if (this.#store.snapshot.session === undefined) {@@ -1046,11 +1045,7 @@ export class EveTUIRunner {this.#finishCommand({ kind: "result", summary: input.absent });return;}- this.#finishCommand(- input.dismissOnAccepted === true- ? { kind: "dismiss" }- : { kind: "result", summary: input.accepted },- );+ this.#finishCommand({ kind: "result", summary: input.accepted });} catch (error) {this.#finishCommand({kind: "result",diff --git a/packages/eve/src/cli/dev/tui/terminal-renderer.test.ts b/packages/eve/src/cli/dev/tui/terminal-renderer.test.tsindex fc637a756..c79012899 100644--- a/packages/eve/src/cli/dev/tui/terminal-renderer.test.ts+++ b/packages/eve/src/cli/dev/tui/terminal-renderer.test.ts@@ -3354,7 +3354,7 @@ describe("TerminalRenderer command typeahead", () => {expect(open).not.toMatch(/\b1\. \/model/);input.down();input.enter();- expect(await choice).toBe("/reset");+ expect(await choice).toBe("/new");expect(screen.snapshot()).not.toContain("Choose a model, speed, and reasoning");renderer.shutdown();});@@ -3474,9 +3474,9 @@ describe("TerminalRenderer command typeahead", () => {input.type("/");input.down();input.enter();- // Down moved /model → /reset; history recall would have submitted the+ // Down moved /model → /new; history recall would have submitted the// earlier prompt instead.- expect(await second).toBe("/reset");+ expect(await second).toBe("/new");renderer.shutdown();});diff --git a/packages/eve/src/cli/dev/tui/terminal-renderer.ts b/packages/eve/src/cli/dev/tui/terminal-renderer.tsindex 3df416423..50ad0ea87 100644--- a/packages/eve/src/cli/dev/tui/terminal-renderer.ts+++ b/packages/eve/src/cli/dev/tui/terminal-renderer.ts@@ -1491,7 +1491,7 @@ export class TerminalRenderer implements AgentTUIRenderer {this.#lastCommitted = undefined;this.#committedTranscriptRows.length = 0;this.#transcriptBlocks.length = 0;- // `/reset` resets the conversation, not the workspace: keep #agentHeader+ // `/new` resets the conversation, not the workspace: keep #agentHeader// (the status line's model segment reads it — the header is not re-sent// after a reset) and #vercelStatus (link + pending-deploy outlive the// conversation). The header *block* still leaves the transcript because@@ -1541,7 +1541,7 @@ export class TerminalRenderer implements AgentTUIRenderer {/*** THE one authority for state scoped to a server-side conversation- * context. Called by both context cuts — `/reset` and the+ * context. Called by both context cuts — `/new` and the* mid-conversation session replacement (`renderSessionBoundary`) — so the* two can never drift on what dies with the old context: write-diff* bases (a fresh session may run a fresh sandbox, where stale bases