The Open Framework for Building Agents
feat(eve)!: simplify TUI log levels and hide warnings by default (#4086)
OwenKephart63f86de73e0e
diff --git a/.changeset/severity-based-tui-logs.md b/.changeset/severity-based-tui-logs.mdnew file mode 100644index 000000000..2a67296a1--- /dev/null+++ b/.changeset/severity-based-tui-logs.md@@ -0,0 +1,5 @@+---+"eve": minor+---++The TUI's `--logs` and `/loglevel` modes are now `none`, `error` (default), `warn`, `debug`, and `all`, replacing the `stderr` and `sandbox` filters. Console warnings retain their severity across local server workers, stay hidden by default, and render yellow when enabled; unclassified output is shown only with `all`, in neutral styling. Complete log records now commit immediately instead of holding completed turns in the clipped live region.diff --git a/docs/guides/dev-tui.md b/docs/guides/dev-tui.mdindex 0196be27b..1abbee1a9 100644--- a/docs/guides/dev-tui.md+++ b/docs/guides/dev-tui.md@@ -116,7 +116,7 @@ Slash commands run immediately, even during a turn. Press `Esc` or `Ctrl+C`, or## Logs and traces-By default, the UI shows `stderr` logs. Use `/loglevel <all|stderr|sandbox|none>` to change the display; bare `/loglevel` reports the current setting. `Ctrl+L` cycles the same modes.+By default, the UI shows severity-tagged errors. Use `/loglevel <none|error|warn|debug|all>` to change the display; bare `/loglevel` reports the current setting. `warn` adds warnings, `debug` adds all severity-tagged records, and `all` also shows unclassified stdout, stderr, and sandbox output. `none` hides logs. Errors render red, warnings yellow, and unclassified stderr neutral. `Ctrl+L` cycles the same modes. These modes filter received records; they do not change `EVE_LOG_LEVEL` or enable a dependency's debug logging.Workflow SDK output, such as lines tagged `[workflow-sdk]` or `[world-local]`, reports internal runtime details, so the transcript shows it only in `all` mode.diff --git a/docs/reference/cli.md b/docs/reference/cli.mdindex f03b87c15..3e3e69dff 100644--- a/docs/reference/cli.md+++ b/docs/reference/cli.md@@ -276,7 +276,7 @@ Starts a local development server and terminal UI. To connect the UI to an exist| `--connection-auth <mode>` | enum | `full` | Connection-authorization rendering || `--assistant-response-stats <mode>` | enum | `tokensPerSecond` | Assistant header statistic || `--context-size <tokens>` | number | none | Model context window size |-| `--logs <mode>` | enum | `stderr` | Server and agent logs to show |+| `--logs <mode>` | enum | `error` | Display `none`, `error`, `warn`, `debug`, or `all` logs |Local development mounts bundled development extensions without adding files to your project. Pass `--no-default-extensions` to disable them. See [Self-Modification](../guides/self-modification) for details.diff --git a/packages/eve/src/cli/dev/command.ts b/packages/eve/src/cli/dev/command.tsindex 14b852970..eb36263a1 100644--- a/packages/eve/src/cli/dev/command.ts+++ b/packages/eve/src/cli/dev/command.ts@@ -139,11 +139,7 @@ export function registerRemoteCommands(input: {"Model context window size, shown as a usage percentage",parseContextSizeOption,)- .option(- "--logs <mode>",- "Which server/agent logs to show: all | stderr | sandbox | none",- parseLogsMode,- )+ .option("--logs <mode>", "Log severity: none | error | warn | debug | all", parseLogsMode).action(async (options: DevelopmentCliOptions & { url: string }) => {const remoteTarget = resolveDevelopmentUrlTarget(options, undefined)!;const mode = resolveDevUiMode({ options, interactive: hasInteractiveTerminal() });@@ -224,11 +220,7 @@ export function registerDevelopmentCommand(input: {"Model context window size, shown as a usage percentage",parseContextSizeOption,)- .option(- "--logs <mode>",- "Which server/agent logs to show: all | stderr | sandbox | none",- parseLogsMode,- )+ .option("--logs <mode>", "Log severity: none | error | warn | debug | all", parseLogsMode).action(async (options: DevelopmentCliOptions) => {const interactive = hasInteractiveTerminal();const mode = resolveDevUiMode({ options, interactive });diff --git a/packages/eve/src/cli/dev/console-records-preload.ts b/packages/eve/src/cli/dev/console-records-preload.tsnew file mode 100644index 000000000..0c6f96a2e--- /dev/null+++ b/packages/eve/src/cli/dev/console-records-preload.ts@@ -0,0 +1,3 @@+import { installConsoleRecords } from "./console-records.js";++installConsoleRecords();diff --git a/packages/eve/src/cli/dev/console-records.scenario.test.ts b/packages/eve/src/cli/dev/console-records.scenario.test.tsnew file mode 100644index 000000000..24e395015--- /dev/null+++ b/packages/eve/src/cli/dev/console-records.scenario.test.ts@@ -0,0 +1,38 @@+import { execFile } from "node:child_process";+import { promisify } from "node:util";+import { describe, expect, it } from "vitest";+import { parseConsoleRecord } from "./console-records.js";++const execute = promisify(execFile);++describe("dev console severity preload", () => {+ it("captures complete warnings from the child and inherited worker preloads", async () => {+ const preload = new URL("../../../dist/src/cli/dev/console-records-preload.js", import.meta.url)+ .href;+ const { stderr } = await execute(process.execPath, [+ "--import",+ preload,+ "--input-type=module",+ "-e",+ `+ import { Worker } from 'node:worker_threads';+ console.warn('parent warning\\n step abc');+ console.error('parent error');+ process.stderr.write('raw stderr\\n');+ const worker = new Worker(new URL('data:text/javascript,console.warn("worker warning");console.error("worker error")'), { type: 'module' });+ await new Promise((resolve, reject) => { worker.once('exit', resolve); worker.once('error', reject); });+ `,+ ]);+ const lines = stderr.trim().split("\n");+ const records = lines.map(parseConsoleRecord).filter((record) => record !== undefined);+ expect(records).toEqual(+ expect.arrayContaining([+ { level: "warn", text: "parent warning\n step abc" },+ { level: "error", text: "parent error" },+ { level: "warn", text: "worker warning" },+ { level: "error", text: "worker error" },+ ]),+ );+ expect(lines).toContain("raw stderr");+ });+});diff --git a/packages/eve/src/cli/dev/console-records.test.ts b/packages/eve/src/cli/dev/console-records.test.tsnew file mode 100644index 000000000..ce6b7b25f--- /dev/null+++ b/packages/eve/src/cli/dev/console-records.test.ts@@ -0,0 +1,33 @@+import { afterEach, describe, expect, it } from "vitest";+import {+ CONSOLE_RECORD_PREFIX,+ createConsoleOutputForwarder,+ parseConsoleRecord,+ setConsoleRecordSubscriber,+} from "./console-records.js";++afterEach(() => setConsoleRecordSubscriber(undefined));++describe("dev console transport", () => {+ it("preserves multiline warnings across chunk boundaries without classifying raw stderr", () => {+ const records: unknown[] = [];+ const raw: string[] = [];+ setConsoleRecordSubscriber((record) => records.push(record));+ const forwarder = createConsoleOutputForwarder((text) => raw.push(text));+ const encoded = `${CONSOLE_RECORD_PREFIX}${JSON.stringify({ level: "warn", text: "Step already running\n run abc\n step def" })}\n`;+ forwarder.write(encoded.slice(0, 15));+ forwarder.write(encoded.slice(15) + "raw failure\npartial");+ forwarder.flush();+ expect(records).toEqual([+ { level: "warn", text: "Step already running\n run abc\n step def" },+ ]);+ expect(raw).toEqual(["raw failure\n", "partial"]);+ });+ it("leaves malformed frames as unclassified output", () => {+ expect(parseConsoleRecord(`${CONSOLE_RECORD_PREFIX}null`)).toBeUndefined();+ expect(+ parseConsoleRecord(`${CONSOLE_RECORD_PREFIX}{"level":"fatal","text":"oops"}`),+ ).toBeUndefined();+ expect(parseConsoleRecord("ordinary stderr")).toBeUndefined();+ });+});diff --git a/packages/eve/src/cli/dev/console-records.ts b/packages/eve/src/cli/dev/console-records.tsnew file mode 100644index 000000000..d7f32c64b--- /dev/null+++ b/packages/eve/src/cli/dev/console-records.ts@@ -0,0 +1,89 @@+import { format } from "node:util";+import { setLogRecordSubscriber, type LogLevel } from "#internal/logging.js";++export const CONSOLE_RECORD_PREFIX = "\u001eeve-console:";++export interface ConsoleRecord {+ readonly level: LogLevel;+ readonly text: string;+}++let subscriber: ((record: ConsoleRecord) => void) | undefined;++export function setConsoleRecordSubscriber(value: typeof subscriber): void {+ subscriber = value;+}++export function forwardConsoleRecord(record: ConsoleRecord): void {+ if (subscriber !== undefined) {+ try {+ subscriber(record);+ return;+ } catch {}+ }+ console[record.level === "info" ? "log" : record.level](record.text);+}++export function createConsoleOutputForwarder(raw: (text: string) => void): {+ write(chunk: string): void;+ flush(): void;+} {+ let buffered = "";+ return {+ write(chunk) {+ buffered += chunk;+ if (buffered.length > 1024 * 1024 && !buffered.includes("\n")) {+ raw(buffered);+ buffered = "";+ }+ let newline: number;+ while ((newline = buffered.indexOf("\n")) !== -1) {+ const line = buffered.slice(0, newline);+ buffered = buffered.slice(newline + 1);+ const record = parseConsoleRecord(line);+ if (record === undefined) raw(`${line}\n`);+ else forwardConsoleRecord(record);+ }+ },+ flush() {+ if (buffered.length > 0) raw(buffered);+ buffered = "";+ },+ };+}++export function parseConsoleRecord(line: string): ConsoleRecord | undefined {+ if (!line.startsWith(CONSOLE_RECORD_PREFIX)) return undefined;+ try {+ const record = JSON.parse(line.slice(CONSOLE_RECORD_PREFIX.length));+ if (+ ["error", "warn", "info", "debug"].includes(record.level) &&+ typeof record.text === "string"+ )+ return record;+ } catch {}+ return undefined;+}++/** Runs in the dev child and its worker threads before application imports. */+export function installConsoleRecords(): void {+ const write = (record: ConsoleRecord) =>+ process.stderr.write(`${CONSOLE_RECORD_PREFIX}${JSON.stringify(record)}\n`);+ setLogRecordSubscriber((record) =>+ write({+ level: record.level,+ text: `[eve:${record.namespace}] ${record.message}${record.fields === undefined ? "" : ` ${JSON.stringify(record.fields)}`}`,+ }),+ );+ for (const [method, level] of Object.entries({+ error: "error",+ warn: "warn",+ log: "info",+ info: "info",+ debug: "debug",+ }) as Array<["error" | "warn" | "log" | "info" | "debug", LogLevel]>) {+ console[method] = (...args: unknown[]) => {+ write({ level, text: format(...args) });+ };+ }+}diff --git a/packages/eve/src/cli/dev/diagnostic-sink.ts b/packages/eve/src/cli/dev/diagnostic-sink.tsindex 8129834d6..5447f2ef3 100644--- a/packages/eve/src/cli/dev/diagnostic-sink.ts+++ b/packages/eve/src/cli/dev/diagnostic-sink.ts@@ -9,6 +9,7 @@ type DevDiagnosticSource = "stderr" | "stdout" | "sandbox" | "workflow" | "tool"/** Captured output or a failure summary attributed to one capture point. */export interface DevDiagnosticOutputEntry {readonly source: Exclude<DevDiagnosticSource, "log">;+ readonly level?: LogLevel;readonly summary?: string;readonly detail: string;/** Structured remediation carried by cataloged failures. */diff --git a/packages/eve/src/cli/dev/local-server-process.test.ts b/packages/eve/src/cli/dev/local-server-process.test.tsindex 7abf25c30..96122bf2b 100644--- a/packages/eve/src/cli/dev/local-server-process.test.ts+++ b/packages/eve/src/cli/dev/local-server-process.test.ts@@ -8,6 +8,7 @@ import {DEV_SERVER_CLOSE_BUDGET_MS,} from "#cli/dev/local-server-process.js";import { FORCED_EXIT_BACKSTOP_MS } from "#cli/shutdown.js";+import { CONSOLE_RECORD_PREFIX, setConsoleRecordSubscriber } from "./console-records.js";const mocks = vi.hoisted(() => ({ fork: vi.fn(), loadEnv: vi.fn() }));vi.mock("node:child_process", () => ({ fork: mocks.fork }));@@ -108,6 +109,31 @@ describe("createDevelopmentServer", () => {}});+ it("preloads severity capture and forwards child warning records without exposing transport framing", async () => {+ const records: unknown[] = [];+ setConsoleRecordSubscriber((record) => records.push(record));+ const server = createDevelopmentServer("/tmp/app");+ try {+ const started = server.start();+ await vi.waitFor(() => expect(mocks.fork).toHaveBeenCalled());+ expect(mocks.fork.mock.calls.at(-1)?.[2].execArgv).toContain("--import");+ child.stderr.write(+ `${CONSOLE_RECORD_PREFIX}${JSON.stringify({ level: "warn", text: "contention\n step abc" })}\n`,+ );+ child.emit("message", {+ type: "started",+ handle: { kind: "started", appRoot: "/tmp/app", url: "http://127.0.0.1:2000" },+ });+ await started;+ expect(records).toEqual([{ level: "warn", text: "contention\n step abc" }]);+ const closing = server.close();+ child.emit("exit", 0, null);+ await closing;+ } finally {+ setConsoleRecordSubscriber(undefined);+ }+ });+it("escalates when graceful cleanup misses the deadline", async () => {vi.useFakeTimers();try {diff --git a/packages/eve/src/cli/dev/local-server-process.ts b/packages/eve/src/cli/dev/local-server-process.tsindex 977bebae9..55b700f19 100644--- a/packages/eve/src/cli/dev/local-server-process.ts+++ b/packages/eve/src/cli/dev/local-server-process.ts@@ -21,6 +21,7 @@* the next run (see local-server-cleanup.ts).*/+import { createConsoleOutputForwarder } from "./console-records.js";import { fork, type ChildProcess } from "node:child_process";import { fileURLToPath } from "node:url";@@ -73,7 +74,9 @@ export function createDevelopmentServer(const terminated = Promise.withResolvers<void>();void exited.promise.catch(() => undefined);+ const consoleOutput = createConsoleOutputForwarder((text) => process.stderr.write(text));const release = () => {+ consoleOutput.flush();const active = child;if (active === undefined) return;child = undefined;@@ -107,13 +110,18 @@ export function createDevelopmentServer([EVE_DEV_ENV_FLAG]: "1",},stdio: ["ignore", "pipe", "pipe", "ipc"],+ execArgv: [+ ...process.execArgv,+ "--import",+ new URL("./console-records-preload.js", import.meta.url).href,+ ],},);child = spawned;spawned.stdout?.on("data", (chunk: Buffer) =>(options.output === "stderr" ? process.stderr : process.stdout).write(chunk),);- spawned.stderr?.on("data", (chunk: Buffer) => process.stderr.write(chunk));+ spawned.stderr?.on("data", (chunk: Buffer) => consoleOutput.write(chunk.toString()));return new Promise<DevelopmentServerHandle>((resolve, reject) => {let settled = false;diff --git a/packages/eve/src/cli/dev/tui/blocks.test.ts b/packages/eve/src/cli/dev/tui/blocks.test.tsindex 5df9397ee..ab6fa3b11 100644--- a/packages/eve/src/cli/dev/tui/blocks.test.ts+++ b/packages/eve/src/cli/dev/tui/blocks.test.ts@@ -13,6 +13,20 @@ function render(block: DisplayBlock, width = 60): string[] {}describe("renderBlockLines", () => {+ it("colors only classified failures red, warnings yellow, and raw stderr neutral", () => {+ const colored = createTheme({ color: true, unicode: true });+ const body = (logLevel?: "error" | "warn") =>+ renderBlockLines(+ { kind: "log", title: "stderr", body: "message", logLevel },+ 60,+ colored,+ ctx,+ ).join("\n");+ expect(body("error")).toContain(colored.colors.red("message"));+ expect(body("warn")).toContain(colored.colors.yellow("message"));+ expect(body()).toContain(colored.colors.gray("message"));+ expect(body()).not.toContain(colored.colors.red("message"));+ });it("renders a user message behind a left bar", () => {expect(render({ kind: "user", body: "hello there" })).toEqual(["│ hello there"]);});diff --git a/packages/eve/src/cli/dev/tui/blocks.ts b/packages/eve/src/cli/dev/tui/blocks.tsindex 71523b6c9..54a564230 100644--- a/packages/eve/src/cli/dev/tui/blocks.ts+++ b/packages/eve/src/cli/dev/tui/blocks.ts@@ -98,7 +98,8 @@ export interface Block {/** When true, expand tool input/output instead of summarizing. */expanded?: boolean;/** Captured-log visibility used for concise-vs-raw diagnostic replay. */- logVisibility?: "stderr-only" | "all-only";+ logVisibility?: "summary" | "all-only";+ logLevel?: "error" | "warn" | "info" | "debug";/** Raw tool input / output for the expanded view. */toolInput?: unknown;toolOutput?: unknown;@@ -516,10 +517,14 @@ function renderSandbox(* only ever sees visible blocks.*/function renderLog(block: DisplayBlock, width: number, theme: Theme): string[] {- const isErr = block.title === "stderr";- const color = isErr ? theme.colors.red : theme.colors.gray;+ const color =+ block.logLevel === "error"+ ? theme.colors.red+ : block.logLevel === "warn"+ ? theme.colors.yellow+ : theme.colors.gray;const rule = theme.colors.dim(theme.glyph.rule);- const source = isErr ? "stderr" : "stdout";+ const source = block.logLevel ?? block.title ?? "stdout";const rows = [`${theme.colors.dim(theme.glyph.reasoning)} ${theme.colors.dim(source)}`];if (block.elided !== undefined && block.elided > 0) {diff --git a/packages/eve/src/cli/dev/tui/log-display-mode.test.ts b/packages/eve/src/cli/dev/tui/log-display-mode.test.tsindex 160d9ca20..fadd2fc5e 100644--- a/packages/eve/src/cli/dev/tui/log-display-mode.test.ts+++ b/packages/eve/src/cli/dev/tui/log-display-mode.test.ts@@ -1,31 +1,64 @@import { describe, expect, it } from "vitest";-import {- LOG_DISPLAY_MODE_CYCLE,+ isLogVisible,LOG_DISPLAY_MODES,nextLogDisplayMode,parseLogDisplayMode,- type LogDisplayMode,} from "./log-display-mode.js";-describe("parseLogDisplayMode", () => {- it("accepts every supported mode and rejects unknown values", () => {+describe("log severity modes", () => {+ it("accepts the severity modes and rejects old source filters", () => {for (const mode of LOG_DISPLAY_MODES) expect(parseLogDisplayMode(mode)).toBe(mode);- expect(parseLogDisplayMode("bogus")).toBeUndefined();+ for (const mode of ["stderr", "sandbox", "bogus"])+ expect(parseLogDisplayMode(mode)).toBeUndefined();});-});--describe("nextLogDisplayMode", () => {- it("advances none → all → stderr → sandbox → none", () => {- expect(nextLogDisplayMode("none")).toBe("all");- expect(nextLogDisplayMode("all")).toBe("stderr");- expect(nextLogDisplayMode("stderr")).toBe("sandbox");- expect(nextLogDisplayMode("sandbox")).toBe("none");+ it("cycles none → error → warn → debug → all → none", () => {+ expect(LOG_DISPLAY_MODES.map(nextLogDisplayMode)).toEqual([+ "error",+ "warn",+ "debug",+ "all",+ "none",+ ]);});-- it("returns to the start after one full lap", () => {- let mode: LogDisplayMode = LOG_DISPLAY_MODE_CYCLE[0];- for (let i = 0; i < LOG_DISPLAY_MODE_CYCLE.length; i++) mode = nextLogDisplayMode(mode);- expect(mode).toBe(LOG_DISPLAY_MODE_CYCLE[0]);+ it("shows unclassified output only under all", () => {+ const records = [+ ["stderr", "error"],+ ["stderr", "warn"],+ ["stdout", "info"],+ ["stdout", "debug"],+ ["stderr", undefined],+ ["stdout", undefined],+ ["sandbox", undefined],+ ] as const;+ expect(records.map(([, level]) => isLogVisible("error", level))).toEqual([+ true,+ false,+ false,+ false,+ false,+ false,+ false,+ ]);+ expect(records.map(([, level]) => isLogVisible("warn", level))).toEqual([+ true,+ true,+ false,+ false,+ false,+ false,+ false,+ ]);+ expect(records.map(([, level]) => isLogVisible("debug", level))).toEqual([+ true,+ true,+ true,+ true,+ false,+ false,+ false,+ ]);+ expect(records.every(([, level]) => isLogVisible("all", level))).toBe(true);+ expect(records.some(([, level]) => isLogVisible("none", level))).toBe(false);});});diff --git a/packages/eve/src/cli/dev/tui/log-display-mode.ts b/packages/eve/src/cli/dev/tui/log-display-mode.tsindex d306d8e3c..8b6e369a6 100644--- a/packages/eve/src/cli/dev/tui/log-display-mode.ts+++ b/packages/eve/src/cli/dev/tui/log-display-mode.ts@@ -1,27 +1,22 @@-/** Every supported captured-output filter, in CLI help order. */-export const LOG_DISPLAY_MODES = ["all", "stderr", "sandbox", "none"] as const;+import type { LogLevel } from "#internal/logging.js";+export const LOG_DISPLAY_MODES = ["none", "error", "warn", "debug", "all"] as const;export type LogDisplayMode = (typeof LOG_DISPLAY_MODES)[number];+export const LOG_DISPLAY_MODE_CYCLE = ["none", "error", "warn", "debug", "all"] as const;-/**- * Order the dev TUI's Ctrl+L shortcut steps through {@link LogDisplayMode}- * values, starting from `none`: each press reveals the next view and wraps- * back to `none`.- */-export const LOG_DISPLAY_MODE_CYCLE = [- "none",- "all",- "stderr",- "sandbox",-] as const satisfies readonly LogDisplayMode[];--/** Parses one CLI or `/loglevel` argument into a supported display mode. */export function parseLogDisplayMode(value: string): LogDisplayMode | undefined {return LOG_DISPLAY_MODES.find((mode) => mode === value);}-/** The mode after `current` in the Ctrl+L cycle, wrapping at the end. */export function nextLogDisplayMode(current: LogDisplayMode): LogDisplayMode {const index = LOG_DISPLAY_MODE_CYCLE.indexOf(current);return LOG_DISPLAY_MODE_CYCLE[(index + 1) % LOG_DISPLAY_MODE_CYCLE.length] ?? "none";}++export function isLogVisible(mode: LogDisplayMode, level?: LogLevel): boolean {+ if (mode === "none") return false;+ if (mode === "all") return true;+ if (level === "error") return true;+ if (mode === "debug") return level !== undefined;+ return mode === "warn" && level === "warn";+}diff --git a/packages/eve/src/cli/dev/tui/prompt-commands.ts b/packages/eve/src/cli/dev/tui/prompt-commands.tsindex cf70e80ae..462382ed6 100644--- a/packages/eve/src/cli/dev/tui/prompt-commands.ts+++ b/packages/eve/src/cli/dev/tui/prompt-commands.ts@@ -139,8 +139,8 @@ const PROMPT_COMMAND_DEFINITIONS = [name: "loglevel",history: "omit",aliases: [],- description: "Show or hide captured stdout/stderr/sandbox logs",- argumentHint: "[all|stderr|sandbox|none]",+ description: "Choose the minimum displayed log severity",+ argumentHint: "[none|error|warn|debug|all]",takesArgument: true,typeahead: { maxArguments: 1, loadingLabel: "log levels" },build: (argument) => ({ type: "loglevel", argument }),diff --git a/packages/eve/src/cli/dev/tui/runner.test.ts b/packages/eve/src/cli/dev/tui/runner.test.tsindex e39632503..690ca044d 100644--- a/packages/eve/src/cli/dev/tui/runner.test.ts+++ b/packages/eve/src/cli/dev/tui/runner.test.ts@@ -1847,15 +1847,15 @@ describe("EveTUIRunner local commands", () => {it("dispatches /loglevel to the renderer and reports the outcome", async () => {const modes: string[] = [];const { renderer, outcomes } = recorder(- ["/loglevel none", "/loglevel bogus", "/loglevel sandbox", undefined],+ ["/loglevel none", "/loglevel bogus", "/loglevel warn", undefined],{ logDisplayMode: () => "all", setLogDisplayMode: (mode) => modes.push(mode) },);await new EveTUIRunner({ client: stubClient(), renderer }).run();- expect(modes).toEqual(["none", "sandbox"]);+ expect(modes).toEqual(["none", "warn"]);expect(outcomes[0]).toContain("hidden");expect(outcomes[1]).toContain('Unknown log level "bogus"');- expect(outcomes[2]).toContain("sandbox");+ expect(outcomes[2]).toContain("warnings");});it("reports /loglevel as unavailable when the renderer cannot toggle logs", async () => {diff --git a/packages/eve/src/cli/dev/tui/runner.ts b/packages/eve/src/cli/dev/tui/runner.tsindex 08b8994b5..ccc4f815e 100644--- a/packages/eve/src/cli/dev/tui/runner.ts+++ b/packages/eve/src/cli/dev/tui/runner.ts@@ -1447,7 +1447,7 @@ export class EveTUIRunner {}/**- * Applies `/loglevel [all|stderr|sandbox|none]` against the renderer's buffered+ * Applies `/loglevel [none|error|warn|debug|all]` against the renderer's buffered* log filter and returns the one-line outcome. A bare `/loglevel` reports* the current mode instead of changing it.*/@@ -1457,11 +1457,11 @@ export class EveTUIRunner {return "/loglevel is not available in this session.";}if (argument === "") {- return `Logs: ${renderer.logDisplayMode()}. Use /loglevel all|stderr|sandbox|none — logs stay buffered, so switching also hides or restores past lines.`;+ return `Logs: ${renderer.logDisplayMode()}. Use /loglevel none|error|warn|debug|all — logs stay buffered, so switching also hides or restores past lines.`;}const mode = parseLogDisplayMode(argument);if (mode === undefined) {- return `Unknown log level "${argument}". Use all, stderr, sandbox, or none.`;+ return `Unknown log level "${argument}". Use none, error, warn, debug, or all.`;}if (mode === renderer.logDisplayMode()) {return `Logs already set to ${mode}.`;@@ -1470,10 +1470,12 @@ export class EveTUIRunner {switch (mode) {case "none":return "Logs hidden. Output stays buffered — /loglevel all restores it.";- case "stderr":- return "Showing stderr logs only.";- case "sandbox":- return "Showing sandbox logs only.";+ case "error":+ return "Showing errors.";+ case "warn":+ return "Showing warnings and errors.";+ case "debug":+ return "Showing all severity-tagged logs.";case "all":return "Showing all logs.";}diff --git a/packages/eve/src/cli/dev/tui/status-line.test.ts b/packages/eve/src/cli/dev/tui/status-line.test.tsindex 79bf1bf45..2e163a78d 100644--- a/packages/eve/src/cli/dev/tui/status-line.test.ts+++ b/packages/eve/src/cli/dev/tui/status-line.test.ts@@ -207,7 +207,7 @@ describe("buildStatusLine", () => {it("leads with the transient logs hint and keeps it as width narrows", () => {const input = {- logLevel: "sandbox",+ logLevel: "warn",model: "anthropic/claude-sonnet-5",endpoint: connected,vercel: { identity },@@ -215,10 +215,10 @@ describe("buildStatusLine", () => {} as const;const full = buildStatusLine({ ...input, width: 120 })!;- expect(full.startsWith("logs: sandbox · ")).toBe(true);+ expect(full.startsWith("logs: warn · ")).toBe(true);// Narrow enough that only the leading hint survives.- expect(buildStatusLine({ ...input, width: 13 })).toBe("logs: sandbox");+ expect(buildStatusLine({ ...input, width: 13 })).toBe("logs: warn");});it("renders the logs hint alone at a bare prompt", () => {diff --git a/packages/eve/src/cli/dev/tui/terminal-renderer.test.ts b/packages/eve/src/cli/dev/tui/terminal-renderer.test.tsindex 4d43f1040..fc637a756 100644--- a/packages/eve/src/cli/dev/tui/terminal-renderer.test.ts+++ b/packages/eve/src/cli/dev/tui/terminal-renderer.test.ts@@ -1232,7 +1232,7 @@ describe("TerminalRenderer (inline scrollback)", () => {renderer.shutdown();});- it("coalesces a source's writes into one section showing the newest write", () => {+ it("commits complete writes in arrival order across transcript boundaries", () => {const screen = new MockScreen({ columns: 80, rows: 30 });const input = new MockUserInput();const renderer = new TerminalRenderer({@@ -1251,15 +1251,12 @@ describe("TerminalRenderer (inline scrollback)", () => {renderer.shutdown();const snapshot = screen.snapshot();- // A stream is continuous: every stdout write — the notice interleaving- // included — merges into ONE section anchored at the newest write,- // showing only that write with the rest behind the elided count.- expect(countOccurrences(snapshot, "○ stdout")).toBe(1);- expect(snapshot).toContain("│ … (2 more)");+ expect(snapshot).toContain("city: 'NY'");+ expect(snapshot).toContain("city: 'LA'");expect(snapshot).toContain("│ post-turn line");- expect(snapshot).not.toContain("city: 'NY'");- // The section sits at the last write's position — after the notice.- expect(snapshot.indexOf("○ stdout")).toBeGreaterThan(snapshot.indexOf("turn boundary"));+ expect(snapshot.indexOf("city: 'NY'")).toBeLessThan(snapshot.indexOf("city: 'LA'"));+ expect(snapshot.indexOf("city: 'LA'")).toBeLessThan(snapshot.indexOf("turn boundary"));+ expect(snapshot.indexOf("turn boundary")).toBeLessThan(snapshot.indexOf("post-turn line"));});it("retroactively hides and restores buffered logs when the level changes", () => {@@ -1309,7 +1306,7 @@ describe("TerminalRenderer (inline scrollback)", () => {input,output: screen,captureForeignOutput: true,- logs: "stderr",+ logs: "error",unicode: true,diagnostics: stub.diagnostics,});@@ -1322,9 +1319,9 @@ describe("TerminalRenderer (inline scrollback)", () => {" at fourth",].join("\n");- process.stderr.write(`${detail}\n`);+ console.error(detail);- expect(append).toHaveBeenCalledWith({ source: "stderr", detail });+ expect(append).toHaveBeenCalledWith({ source: "stderr", level: "error", detail });expect(screen.snapshot()).toContain("Error: request returned 403");expect(screen.snapshot()).toContain("details: .eve/logs/dev.log");expect(screen.snapshot()).not.toContain("at fourth");@@ -1346,7 +1343,7 @@ describe("TerminalRenderer (inline scrollback)", () => {input,output: screen,captureForeignOutput: true,- logs: "stderr",+ logs: "error",unicode: true,diagnostics: stub.diagnostics,});@@ -1365,6 +1362,37 @@ describe("TerminalRenderer (inline scrollback)", () => {expect(stub.subscribed).toBe(false);});+ it("defaults to errors, buffers warnings, and preserves console severity", () => {+ const screen = new MockScreen({ columns: 100, rows: 30 });+ const renderer = new TerminalRenderer({+ input: new MockUserInput(),+ output: screen,+ captureForeignOutput: true,+ unicode: true,+ });+ renderer.renderAgentHeader({ name: "Weather Agent", serverUrl: "http://localhost:3000" });+ console.warn("Step already running\n run abc\n step def");+ console.error("Actual failure");+ process.stderr.write("Unclassified stderr\n");+ console.debug("Debug detail");+ expect(screen.snapshot()).not.toContain("Step already running");+ expect(screen.snapshot()).toContain("○ error");+ expect(screen.snapshot()).toContain("Actual failure");+ expect(screen.snapshot()).not.toContain("Unclassified stderr");+ renderer.setLogDisplayMode("warn");+ expect(screen.snapshot()).toContain("○ warn");+ expect(screen.snapshot()).toContain("step def");+ expect(screen.snapshot()).not.toContain("Debug detail");+ renderer.setLogDisplayMode("debug");+ expect(screen.snapshot()).toContain("Debug detail");+ expect(screen.snapshot()).not.toContain("Unclassified stderr");+ console.info('eve: built sandbox template "root" on backend "microsandbox".');+ expect(screen.snapshot()).toContain('sandbox · built sandbox template "root"');+ renderer.setLogDisplayMode("all");+ expect(screen.snapshot()).toContain("Unclassified stderr");+ renderer.shutdown();+ });+it("records captured sandbox log lines in the diagnostic log", () => {const screen = new MockScreen({ columns: 80, rows: 30 });const input = new MockUserInput();@@ -1405,7 +1433,7 @@ describe("TerminalRenderer (inline scrollback)", () => {{ event: "change", path: "/app/agent/instructions.md" },])}\n`,);- expect(renderer.logDisplayMode()).toBe("none");+ expect(renderer.logDisplayMode()).toBe("error");expect(screen.snapshot()).not.toContain("agent/instructions.md changed");expect(screen.snapshot()).not.toContain("○ stdout");@@ -1445,7 +1473,7 @@ describe("TerminalRenderer (inline scrollback)", () => {process.stdout.write("captured while hidden\n");renderer.renderNotice("after the log");- expect(renderer.logDisplayMode()).toBe("none");+ expect(renderer.logDisplayMode()).toBe("error");expect(screen.snapshot()).not.toContain("captured while hidden");renderer.setLogDisplayMode("all");@@ -1468,17 +1496,16 @@ describe("TerminalRenderer (inline scrollback)", () => {output: screen,captureForeignOutput: true,unicode: true,- logs: "stderr",+ logs: "error",});renderer.renderAgentHeader({ name: "Weather Agent", serverUrl: "http://localhost:3000" });- process.stderr.write("first stderr line\n");+ console.error("first stderr line");process.stdout.write("interleaved stdout line\n");- process.stderr.write("second stderr line\n");+ console.error("second stderr line");- // Both stderr writes merge into one stream section; the hidden stdout- // write contributes no section of its own.- expect(countOccurrences(screen.snapshot(), "○ stderr")).toBe(1);+ expect(screen.snapshot()).toContain("first stderr line");+ expect(screen.snapshot()).toContain("second stderr line");expect(screen.snapshot()).not.toContain("○ stdout");renderer.setLogDisplayMode("all");@@ -1487,7 +1514,7 @@ describe("TerminalRenderer (inline scrollback)", () => {// Once visible, stdout gets its own section; the stderr stream stays// whole and ordered.const snapshot = screen.snapshot();- expect(countOccurrences(snapshot, "○ stderr")).toBe(1);+ expect(countOccurrences(snapshot, "○ error")).toBe(1);expect(countOccurrences(snapshot, "○ stdout")).toBe(1);expect(snapshot.indexOf("first stderr line")).toBeLessThan(snapshot.indexOf("second stderr line"),@@ -1495,35 +1522,6 @@ describe("TerminalRenderer (inline scrollback)", () => {expect(snapshot).toContain("interleaved stdout line");});- it("shows sandbox stdout lines and hides ordinary stdout under the sandbox log level", () => {- const screen = new MockScreen({ columns: 100, rows: 30 });- const input = new MockUserInput();- const renderer = new TerminalRenderer({- input,- output: screen,- captureForeignOutput: true,- logs: "sandbox",- unicode: true,- });- renderer.renderAgentHeader({ name: "Weather Agent", serverUrl: "http://localhost:3000" });-- process.stdout.write('eve: sandbox template "root" (microsandbox): checking cached snapshot\n');- process.stdout.write("eve: initializing 3 sandbox templates...\n");- process.stdout.write('eve: built sandbox template "root" on backend "microsandbox".\n');- process.stdout.write("ordinary stdout log\n");- renderer.shutdown();-- const snapshot = screen.snapshot();- expect(snapshot).toContain(- 'sandbox · built sandbox template "root" on backend "microsandbox".',- );- expect(snapshot).not.toContain("initializing 3 sandbox templates");- expect(snapshot).not.toContain("checking cached snapshot");- expect(snapshot).not.toContain("ordinary stdout log");- expect(snapshot).not.toContain("○ stdout");- expect(snapshot).not.toContain("○ stderr");- });-it("hides sandbox lines under the none log level", () => {const screen = new MockScreen({ columns: 100, rows: 30 });const input = new MockUserInput();@@ -1567,14 +1565,14 @@ describe("TerminalRenderer (inline scrollback)", () => {expect(snapshot).toContain("ordinary stdout log");});- it("renders captured lazy preparation logs under the sandbox log level", () => {+ it("renders captured lazy preparation logs under all", () => {const screen = new MockScreen({ columns: 100, rows: 30 });const input = new MockUserInput();const renderer = new TerminalRenderer({input,output: screen,captureForeignOutput: true,- logs: "sandbox",+ logs: "all",unicode: true,});renderer.renderAgentHeader({ name: "Weather Agent", serverUrl: "http://localhost:3000" });@@ -1587,10 +1585,10 @@ describe("TerminalRenderer (inline scrollback)", () => {const snapshot = screen.snapshot();expect(snapshot).toContain('sandbox · built sandbox template "root" on backend "docker".');- expect(snapshot).not.toContain("initializing 3 sandbox templates");- expect(snapshot).not.toContain("checking Docker daemon");- expect(snapshot).not.toContain("ordinary stdout log");- expect(snapshot).not.toContain("○ stdout");+ expect(snapshot).toContain("initializing 3 sandbox templates");+ expect(snapshot).toContain("checking Docker daemon");+ expect(snapshot).toContain("ordinary stdout log");+ expect(snapshot).toContain("○ stdout");});it("cycles the log mode on Ctrl+L with a transient status hint that clears after 5s", () => {@@ -1604,21 +1602,21 @@ describe("TerminalRenderer (inline scrollback)", () => {// Ctrl+R only redraws — it must not cycle the mode or show the hint.input.type("\u0012");- expect(renderer.logDisplayMode()).toBe("none");+ expect(renderer.logDisplayMode()).toBe("error");expect(screen.snapshot()).not.toContain("logs:");- input.type("\u000c"); // Ctrl+L: none → all- expect(renderer.logDisplayMode()).toBe("all");- expect(screen.snapshot()).toContain("logs: all");+ input.type("\u000c"); // Ctrl+L: error → warn+ expect(renderer.logDisplayMode()).toBe("warn");+ expect(screen.snapshot()).toContain("logs: warn");- input.type("\u000c"); // Ctrl+L: all → stderr- expect(renderer.logDisplayMode()).toBe("stderr");- expect(screen.snapshot()).toContain("logs: stderr");+ input.type("\u000c"); // Ctrl+L: warn → debug+ expect(renderer.logDisplayMode()).toBe("debug");+ expect(screen.snapshot()).toContain("logs: debug");// The hint clears after 5s of no further cycling; the mode itself stays.vi.advanceTimersByTime(5_000);expect(screen.snapshot()).not.toContain("logs:");- expect(renderer.logDisplayMode()).toBe("stderr");+ expect(renderer.logDisplayMode()).toBe("debug");renderer.shutdown();} finally {@@ -1755,7 +1753,7 @@ describe("TerminalRenderer (inline scrollback)", () => {input,output: screen,captureForeignOutput: true,- logs: "stderr",+ logs: "error",unicode: true,});renderer.renderAgentHeader({ name: "Weather Agent", serverUrl: "http://localhost:3000" });@@ -1778,7 +1776,7 @@ describe("TerminalRenderer (inline scrollback)", () => {input,output: screen,captureForeignOutput: true,- logs: "stderr",+ logs: "error",unicode: true,});renderer.renderAgentHeader({ name: "Weather Agent", serverUrl: "http://localhost:3000" });@@ -1802,7 +1800,7 @@ describe("TerminalRenderer (inline scrollback)", () => {input,output: screen,captureForeignOutput: true,- logs: "stderr",+ logs: "error",unicode: true,});renderer.renderAgentHeader({ name: "Weather Agent", serverUrl: "http://localhost:3000" });@@ -3914,8 +3912,14 @@ describe("TerminalRenderer conversation", () => {const completed = (turnId: string, message: string) =>stamped(createMessageCompletedEvent({ message, sequence: 2, stepIndex: 0, turnId }));- it("streams prose in the live region and commits it whole once it settles", async () => {- const { screen, renderer } = makeRenderer(34, 8);+ it("commits settled prose past hidden logs and reveals those logs without clipping", async () => {+ const screen = new MockScreen({ columns: 34, rows: 8 });+ const renderer = new TerminalRenderer({+ input: new MockUserInput(),+ output: screen,+ captureForeignOutput: true,+ unicode: true,+ });const prompt = readPrompt(renderer);const words = Array.from({ length: 44 },@@ -3923,7 +3927,11 @@ describe("TerminalRenderer conversation", () => {);const streaming = [turn("turn_1"), ...words.map((word) => appended("turn_1", `${word} `))];+ console.warn("Workflow is awaiting settlement");+ process.stdout.write("Raw progress\n");+ process.stderr.write("Raw diagnostic\n");renderer.renderConversation(conversationOf(streaming, { working: true }));+ expect(screen.snapshot()).not.toContain("Workflow is awaiting settlement");expect(screen.snapshot()).toContain("earlier rows hidden");expect(screen.snapshot()).not.toContain("word-01");@@ -3934,6 +3942,14 @@ describe("TerminalRenderer conversation", () => {expect(countOccurrences(snapshot, "word-01")).toBe(1);expect(countOccurrences(snapshot, "word-44")).toBe(1);expect(snapshot).not.toContain("earlier rows hidden");+ renderer.setLogDisplayMode("all");+ const revealed = screen.snapshot();+ expect(revealed).toContain("Workflow is awaiting settlement");+ expect(revealed).toContain("Raw progress");+ expect(revealed).toContain("Raw diagnostic");+ expect(revealed).not.toContain("earlier rows hidden");+ expect(countOccurrences(revealed, "word-01")).toBe(1);+ expect(countOccurrences(revealed, "word-44")).toBe(1);renderer.requestInterrupt();await prompt.catch(() => {});});diff --git a/packages/eve/src/cli/dev/tui/terminal-renderer.ts b/packages/eve/src/cli/dev/tui/terminal-renderer.tsindex 8dd53aceb..3df416423 100644--- a/packages/eve/src/cli/dev/tui/terminal-renderer.ts+++ b/packages/eve/src/cli/dev/tui/terminal-renderer.ts@@ -130,7 +130,10 @@ import { copyTextToClipboard } from "./clipboard.js";import type { TraceViewerOpenOptions, TraceViewerRenderer } from "./traces/trace-viewer-session.js";import { TraceViewerSession } from "./traces/trace-viewer-session.js";import { buildStatusLine, type DevBuildStatus } from "./status-line.js";-import { nextLogDisplayMode } from "./log-display-mode.js";+import { isLogVisible, nextLogDisplayMode } from "./log-display-mode.js";+import { setConsoleRecordSubscriber, type ConsoleRecord } from "../console-records.js";+import type { LogLevel } from "#internal/logging.js";+import { format } from "node:util";import { createTheme, detectUnicode, type Theme } from "./theme.js";import {clipVisible,@@ -146,11 +149,7 @@ import { groupToolBlocksForDisplay } from "./tool-block-groups.js";import { inputContextLabel, renderQuestionChoices, renderQuestionPanel } from "./question-panel.js";import { TurnClock } from "./turn-clock.js";import { MessageQueue, renderMessageQueueRows } from "./message-queue.js";-import {- formatStoredDiagnostic,- presentDiagnostic,- splitWorkflowLogs,-} from "./diagnostic-presentation.js";+import { formatStoredDiagnostic, presentDiagnostic } from "./diagnostic-presentation.js";import { reduceSetupSelectInput, setupSelectionIntent } from "./setup-selection-input.js";import {isProgressPulseVisible,@@ -474,7 +473,6 @@ export class TerminalRenderer implements AgentTUIRenderer {#restoreLogCapture?: () => void;#stdoutLogBuffer = "";#stderrLogBuffer = "";- #stderrInWorkflowLog = false;#delayedDevBuildError?: string;/*** The in-place dev rebuild status line. While the dev server's rebuild log@@ -562,7 +560,7 @@ export class TerminalRenderer implements AgentTUIRenderer {this.#diagnostics = options?.diagnostics;this.#onExitRequest = options?.onExitRequest;this.#argumentSuggestions = options?.argumentSuggestions;- this.#logs = options?.logs ?? "none";+ this.#logs = options?.logs ?? "error";this.#availablePromptCommands = options?.availablePromptCommands ?? PROMPT_COMMANDS;}@@ -3446,7 +3444,7 @@ export class TerminalRenderer implements AgentTUIRenderer {const body = this.#delayedDevBuildError;if (body === undefined) return;this.#delayedDevBuildError = undefined;- this.#pushBlock({ kind: "log", title: "stderr", body, live: true });+ this.#pushBlock({ kind: "log", title: "stderr", logLevel: "error", body, live: false });this.#paint();}@@ -3901,7 +3899,6 @@ export class TerminalRenderer implements AgentTUIRenderer {this.#stdoutLogBuffer = "";this.#stderrLogBuffer = "";- this.#stderrInWorkflowLog = false;const capture = (target: NodeJS.WriteStream, source: "stdout" | "stderr"): (() => void) => {const original = target.write.bind(target);@@ -3921,6 +3918,16 @@ export class TerminalRenderer implements AgentTUIRenderer {};};+ const consoleMethods = ["error", "warn", "log", "info", "debug"] as const;+ const originals = consoleMethods.map((method) => [method, console[method]] as const);+ for (const method of consoleMethods) {+ console[method] = (...args: unknown[]) =>+ this.#displayConsoleRecord({+ level: method === "log" ? "info" : method,+ text: format(...args),+ });+ }+ setConsoleRecordSubscriber((record) => this.#displayConsoleRecord(record));const restoreStdout = capture(process.stdout, "stdout");const restoreStderr = capture(process.stderr, "stderr");// The recorder takes ownership of eve's own structured log records for@@ -3931,6 +3938,8 @@ export class TerminalRenderer implements AgentTUIRenderer {this.#diagnostics?.subscribeLogRecords((record) => this.#displayLogRecord(record));this.#restoreLogCapture = () => {this.#diagnostics?.unsubscribeLogRecords();+ setConsoleRecordSubscriber(undefined);+ for (const [method, original] of originals) console[method] = original;restoreStdout();restoreStderr();};@@ -3944,12 +3953,12 @@ export class TerminalRenderer implements AgentTUIRenderer {if (this.#stdoutLogBuffer.length > 0) {this.#diagnostics?.append({ source: "stdout", detail: this.#stdoutLogBuffer });- if (this.#shouldRenderLog("stdout")) process.stdout.write(`${this.#stdoutLogBuffer}\n`);+ if (this.#shouldRenderLog()) process.stdout.write(`${this.#stdoutLogBuffer}\n`);this.#stdoutLogBuffer = "";}if (this.#stderrLogBuffer.length > 0) {this.#diagnostics?.append({ source: "stderr", detail: this.#stderrLogBuffer });- if (this.#shouldRenderLog("stderr")) process.stderr.write(`${this.#stderrLogBuffer}\n`);+ if (this.#shouldRenderLog()) process.stderr.write(`${this.#stderrLogBuffer}\n`);this.#stderrLogBuffer = "";}}@@ -3962,7 +3971,18 @@ export class TerminalRenderer implements AgentTUIRenderer {*/#displayLogRecord(record: LogRecord): void {const fieldsText = record.fields === undefined ? "" : ` ${JSON.stringify(record.fields)}`;- this.#presentCapturedStderr(`[eve:${record.namespace}] ${record.message}${fieldsText}`);+ this.#handleCapturedStderr(+ `[eve:${record.namespace}] ${record.message}${fieldsText}`,+ record.level,+ );+ this.#paint();+ }++ #displayConsoleRecord(record: ConsoleRecord): void {+ const source = record.level === "error" || record.level === "warn" ? "stderr" : "stdout";+ this.#diagnostics?.append({ source, level: record.level, detail: record.text });+ if (source === "stderr") this.#handleCapturedStderr(stripAnsi(record.text), record.level);+ else this.#handleCapturedStdout(stripAnsi(record.text), record.level);this.#paint();}@@ -4012,21 +4032,21 @@ export class TerminalRenderer implements AgentTUIRenderer {* Contiguous ordinary lines within one write stay one block, preserving the* single-block-per-write shape for plain output.*/- #handleCapturedStdout(content: string): void {+ #handleCapturedStdout(content: string, logLevel?: LogLevel): void {let pending: string[] = [];const flushPending = () => {if (pending.length === 0) return;const body = pending.join("\n");pending = [];if (body.trim().length === 0) return;- this.#pushBlock({ kind: "log", title: "stdout", body, live: true });+ this.#pushBlock({ kind: "log", title: "stdout", logLevel, body, live: false });};for (const line of content.split("\n")) {const sandboxMessage = parseSandboxLogLine(line.trimEnd());if (sandboxMessage !== undefined) {flushPending();- this.#pushBlock({ kind: "sandbox", body: sandboxMessage, live: false });+ this.#pushBlock({ kind: "sandbox", logLevel, body: sandboxMessage, live: false });continue;}@@ -4041,64 +4061,49 @@ export class TerminalRenderer implements AgentTUIRenderer {flushPending();}- /**- * Workflow SDK output is framework-internal and not actionable for users, so- * it shows only under `/loglevel all`; the diagnostic log keeps every line.- */- #handleCapturedStderr(content: string): void {- const segments = splitWorkflowLogs(content, this.#stderrInWorkflowLog);- this.#stderrInWorkflowLog = segments.at(-1)?.workflow ?? this.#stderrInWorkflowLog;- for (const segment of segments) {- if (segment.text.trim().length === 0) continue;- if (!segment.workflow) {- this.#presentCapturedStderr(segment.text);- continue;- }- this.#pushBlock({- kind: "log",- title: "stderr",- body: segment.text,- logVisibility: "all-only",- live: true,- });- }- }-- #presentCapturedStderr(content: string): void {+ #handleCapturedStderr(content: string, logLevel?: LogLevel): void {const lines = content.split("\n");const failedIndex = lines.findIndex((line) => {return parseDevRebuildLogLine(line.trimEnd())?.kind === "failed";});if (failedIndex === -1) {if (this.#diagnostics === undefined) {- this.#pushBlock({ kind: "log", title: "stderr", body: content, live: true });+ this.#pushBlock({ kind: "log", title: "stderr", logLevel, body: content, live: false });return;}const presentation = presentDiagnostic(content, this.#diagnostics.displayPath);if (presentation.kind === "inline") {- this.#pushBlock({ kind: "log", title: "stderr", body: presentation.text, live: true });+ this.#pushBlock({+ kind: "log",+ title: "stderr",+ logLevel,+ body: presentation.text,+ live: false,+ });return;}this.#pushBlock({kind: "log",title: "stderr",body: formatStoredDiagnostic(presentation),- logVisibility: "stderr-only",- live: true,+ logVisibility: "summary",+ logLevel,+ live: false,});this.#pushBlock({kind: "log",title: "stderr",body: content,logVisibility: "all-only",- live: true,+ logLevel,+ live: false,});return;}const previous = lines.slice(0, failedIndex).join("\n");if (previous.trim().length > 0) {- this.#pushBlock({ kind: "log", title: "stderr", body: previous, live: true });+ this.#pushBlock({ kind: "log", title: "stderr", logLevel, body: previous, live: false });}const failedBody = lines.slice(failedIndex).join("\n");this.#handleDevRebuildFailure(failedBody);@@ -4108,7 +4113,7 @@ export class TerminalRenderer implements AgentTUIRenderer {this.#clearDevBuildStatus();if (this.#logs === "all") {if (body.trim().length === 0) return;- this.#pushBlock({ kind: "log", title: "stderr", body, live: true });+ this.#pushBlock({ kind: "log", title: "stderr", logLevel: "error", body, live: false });return;}this.#delayedDevBuildError = body;@@ -4159,7 +4164,7 @@ export class TerminalRenderer implements AgentTUIRenderer {return;}if (update.kind === "rebuilt") this.#delayedDevBuildError = undefined;- this.#pushBlock({ kind: "log", title: "stdout", body: line, live: true });+ this.#pushBlock({ kind: "log", title: "stdout", body: line, live: false });}#setDevBuildStatus(status: DevBuildStatus): void {@@ -4209,26 +4214,17 @@ export class TerminalRenderer implements AgentTUIRenderer {if (block !== undefined) block.live = false;}- #shouldRenderLog(source: "stdout" | "stderr" | "sandbox"): boolean {- switch (this.#logs) {- case "none":- return false;- case "stderr":- return source === "stderr";- case "sandbox":- return source === "sandbox";- case "all":- return true;- }+ #shouldRenderLog(level?: LogLevel): boolean {+ return isLogVisible(this.#logs, level);}/** True for a buffered log or sandbox block the current display mode filters out. */#isHiddenLog(block: Block): boolean {- if (block.kind === "sandbox") return !this.#shouldRenderLog("sandbox");+ if (block.kind === "sandbox") return !this.#shouldRenderLog(block.logLevel);if (block.kind !== "log") return false;- if (block.logVisibility === "stderr-only") return this.#logs !== "stderr";+ if (block.logVisibility === "summary" && this.#logs === "all") return true;if (block.logVisibility === "all-only") return this.#logs !== "all";- return !this.#shouldRenderLog(block.title === "stderr" ? "stderr" : "stdout");+ return !this.#shouldRenderLog(block.logLevel);}}diff --git a/packages/eve/src/cli/dev/tui/tool-block-groups.test.ts b/packages/eve/src/cli/dev/tui/tool-block-groups.test.tsindex fc0c8722a..bf60e3b18 100644--- a/packages/eve/src/cli/dev/tui/tool-block-groups.test.ts+++ b/packages/eve/src/cli/dev/tui/tool-block-groups.test.ts@@ -168,7 +168,7 @@ describe("groupToolBlocksForDisplay", () => {kind: "log",title: "stderr",body: "concise one",- logVisibility: "stderr-only",+ logVisibility: "summary",live: false,};const raw: Block = {@@ -189,7 +189,7 @@ describe("groupToolBlocksForDisplay", () => {expect(groups[0]?.display).toMatchObject({body: "concise two",elided: 1,- logVisibility: "stderr-only",+ logVisibility: "summary",});expect(groups[1]?.display).toMatchObject({body: "raw two",diff --git a/packages/eve/src/cli/dev/tui/tool-block-groups.ts b/packages/eve/src/cli/dev/tui/tool-block-groups.tsindex cb8fdee27..77f5ead85 100644--- a/packages/eve/src/cli/dev/tui/tool-block-groups.ts+++ b/packages/eve/src/cli/dev/tui/tool-block-groups.ts@@ -169,7 +169,7 @@ function isGroupableLogWrite(block: Block): boolean {/** The (source, visibility) identity a write merges under. */function logBucketKey(block: Block): string {- return `${block.title ?? ""}\u0000${block.logVisibility ?? ""}`;+ return `${block.title ?? ""}\u0000${block.logLevel ?? ""}\u0000${block.logVisibility ?? ""}`;}/**@@ -207,6 +207,7 @@ function coalesceLogBucket(members: readonly Block[]): ToolBlockDisplayGroup {};if (newest.title !== undefined) display.title = newest.title;if (newest.logVisibility !== undefined) display.logVisibility = newest.logVisibility;+ if (newest.logLevel !== undefined) display.logLevel = newest.logLevel;return { members, display };}diff --git a/packages/eve/src/cli/dev/tui/tui.ts b/packages/eve/src/cli/dev/tui/tui.tsindex 063f019e1..7682d2a22 100644--- a/packages/eve/src/cli/dev/tui/tui.ts+++ b/packages/eve/src/cli/dev/tui/tui.ts@@ -59,10 +59,15 @@ function inlineArgumentSuggestions(appRoot: string) {): Promise<readonly PromptArgumentSuggestion[]> => {if (command === "loglevel") {return [- { 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" },+ { value: "none", label: "none", hint: "Hide logs" },+ { value: "error", label: "error", hint: "Errors only (default)" },+ { value: "warn", label: "warn", hint: "Warnings and errors" },+ {+ value: "debug",+ label: "debug",+ hint: "All severity-tagged logs",+ },+ { value: "all", label: "all", hint: "Include raw stdout and sandbox output" },];}if (command === "login") {diff --git a/packages/eve/src/cli/dev/tui/types.ts b/packages/eve/src/cli/dev/tui/types.tsindex 73dab705f..bee6464dd 100644--- a/packages/eve/src/cli/dev/tui/types.ts+++ b/packages/eve/src/cli/dev/tui/types.ts@@ -73,12 +73,10 @@ export type TuiDisplayOptions = {contextSize?: number;/**- * Which captured output (stdout, stderr, sandbox lifecycle lines) to- * surface as inline regions. Output is always captured and buffered so it+ * Minimum log severity to surface as inline regions. Output is always captured and buffered so it* cannot corrupt the frame; this only controls what is rendered. The* `/loglevel` command switches the mode at runtime, retroactively hiding or- * restoring buffered lines. `TerminalRenderer` defaults to `none`; the- * `eve dev` CLI defaults to `stderr`.+ * restoring buffered lines. Defaults to `error`. Only `all` includes unclassified raw output.*/logs?: LogDisplayMode;};diff --git a/packages/eve/src/cli/dev/ui-options.ts b/packages/eve/src/cli/dev/ui-options.tsindex 6ea927a75..da04bf788 100644--- a/packages/eve/src/cli/dev/ui-options.ts+++ b/packages/eve/src/cli/dev/ui-options.ts@@ -32,7 +32,7 @@ export function resolveDevUiMode(input: {/** Builds terminal-UI display options with the defaults used by `eve dev`. */export function resolveTuiDisplayOptions(options: DevelopmentTuiOptions): TuiDisplayOptions {const display: TuiDisplayOptions = {- logs: options.logs ?? "stderr",+ logs: options.logs ?? "error",// Collapsed reasoning renders as the fixed thinking line; `--reasoning// full` restores the streaming transcript trace.reasoning: options.reasoning ?? "auto-collapsed",diff --git a/packages/eve/src/cli/run.test.ts b/packages/eve/src/cli/run.test.tsindex f0f507c4a..63721e9ea 100644--- a/packages/eve/src/cli/run.test.ts+++ b/packages/eve/src/cli/run.test.ts@@ -888,19 +888,19 @@ describe("eve remote connect", () => {});describe("eve dev --logs", () => {- it("accepts sandbox as the initial TUI log mode", async () => {+ it("accepts warn as the initial TUI log mode", async () => {const runDevelopmentTui = await runInteractiveDev(["remote","connect","--url","https://example.com","--logs",- "sandbox",+ "warn",]);expect(runDevelopmentTui).toHaveBeenCalledWith(expect.objectContaining({- logs: "sandbox",+ logs: "warn",target: {kind: "remote",serverUrl: "https://example.com/",@@ -1234,7 +1234,7 @@ describe("resolveDevUiMode", () => {describe("resolveTuiDisplayOptions", () => {it("defaults tools and reasoning to auto-collapsed with stderr logs visible", () => {expect(resolveTuiDisplayOptions({})).toEqual({- logs: "stderr",+ logs: "error",// Collapsed reasoning is the fixed thinking line; `--reasoning full`// restores the streaming transcript trace.reasoning: "auto-collapsed",@@ -1251,7 +1251,7 @@ describe("resolveTuiDisplayOptions", () => {connectionAuth: "full",assistantResponseStats: "tokens",contextSize: 200_000,- logs: "stderr",+ logs: "error",}),).toEqual({tools: "hidden",@@ -1260,7 +1260,7 @@ describe("resolveTuiDisplayOptions", () => {connectionAuth: "full",assistantResponseStats: "tokens",contextSize: 200_000,- logs: "stderr",+ logs: "error",});});@@ -1268,6 +1268,6 @@ describe("resolveTuiDisplayOptions", () => {const resolved = resolveTuiDisplayOptions({ tools: "full" });expect(resolved).not.toHaveProperty("subagents");expect(resolved).not.toHaveProperty("contextSize");- expect(resolved.logs).toBe("stderr");+ expect(resolved.logs).toBe("error");});});diff --git a/packages/eve/test/tui-client/tui-log-modes.ts b/packages/eve/test/tui-client/tui-log-modes.tsindex 40999afe0..e36bef496 100644--- a/packages/eve/test/tui-client/tui-log-modes.ts+++ b/packages/eve/test/tui-client/tui-log-modes.ts@@ -10,14 +10,9 @@ import {import { theme } from "./lib/theme.ts";/**- * End-to-end proof of the `--logs` modes. With capture forced on, a stdout- * line from each source is emitted while the TUI sits at its prompt; what gets- * rendered depends on the mode:- *- * - `all` → stdout, stderr, and sandbox render- * - `stderr` → only stderr renders- * - `sandbox` → only sandbox renders- * - `none` → none render (still buffered, never corrupt the frame)+ * End-to-end proof of the `--logs` modes. With capture forced on, unclassified+ * stdout, stderr, and sandbox lines are emitted while the TUI sits at its+ * prompt. They appear only at `all`; `error` and `none` keep them hidden.** Needs no agent server and no model credentials.*/@@ -27,7 +22,7 @@ const STDERR_MARK = "STDERR_LOG_MARK_9c1";const SANDBOX_MARK = "SANDBOX_LOG_MARK_6a2";process.env.EVE_TUI_UNICODE = "1";-async function snapshotForMode(mode: "all" | "stderr" | "sandbox" | "none"): Promise<string> {+async function snapshotForMode(mode: "all" | "error" | "none"): Promise<string> {const client = new Client({ host: UNREACHABLE_HOST });const screen = new MockScreen({ columns: 100, rows: 40 });const input = new MockUserInput();@@ -70,22 +65,13 @@ void (async () => {throw new Error(`logs=all should show every source:\n${all}`);}- const stderrOnly = await snapshotForMode("stderr");+ const errors = await snapshotForMode("error");if (- stderrOnly.includes(STDOUT_MARK) ||- !stderrOnly.includes(STDERR_MARK) ||- stderrOnly.includes(SANDBOX_MARK)+ errors.includes(STDOUT_MARK) ||+ errors.includes(STDERR_MARK) ||+ errors.includes(SANDBOX_MARK)) {- throw new Error(`logs=stderr should show only stderr:\n${stderrOnly}`);- }-- const sandboxOnly = await snapshotForMode("sandbox");- if (- sandboxOnly.includes(STDOUT_MARK) ||- sandboxOnly.includes(STDERR_MARK) ||- !sandboxOnly.includes(SANDBOX_MARK)- ) {- throw new Error(`logs=sandbox should show only sandbox lines:\n${sandboxOnly}`);+ throw new Error(`logs=error should hide unclassified output:\n${errors}`);}const none = await snapshotForMode("none");@@ -93,9 +79,7 @@ void (async () => {throw new Error(`logs=none should hide every source:\n${none}`);}- process.stdout.write(- `${theme.muted("[tui-log-modes] all / stderr / sandbox / none modes verified")}\n`,- );+ process.stdout.write(`${theme.muted("[tui-log-modes] all / error / none modes verified")}\n`);} catch (error) {process.stdout.write(`${theme.danger("\n[tui] tui-log-modes smoke test failed:")} ${String(error)}\n`,diff --git a/packages/eve/test/tui-client/tui-loglevel.ts b/packages/eve/test/tui-client/tui-loglevel.tsindex bfce4c81f..d83fe2b02 100644--- a/packages/eve/test/tui-client/tui-loglevel.ts+++ b/packages/eve/test/tui-client/tui-loglevel.ts@@ -15,9 +15,7 @@ import { theme } from "./lib/theme.ts";** - `/loglevel none` hides log lines already in the transcript* - lines captured while hidden stay buffered, invisible- * - `/loglevel all` restores the streams: each source renders one- * section showing its NEWEST write, with earlier writes behind an- * `… (N more)` count (the diagnostics file carries the history)+ * - `/loglevel all` restores every buffered log line** Needs no agent server and no model credentials.*/@@ -79,22 +77,19 @@ void (async () => {await screen.waitForText("Showing all logs", 5_000);const restored = screen.snapshot();- // The stdout section shows only its newest write (the one captured- // while hidden); the earlier mark sits behind the elided count.- if (!restored.includes(HIDDEN_STDOUT_MARK) || !restored.includes(VISIBLE_STDERR_MARK)) {- throw new Error(`/loglevel all should restore each stream's newest write:\n${restored}`);- }- if (restored.includes(VISIBLE_STDOUT_MARK) || !restored.includes("(1 more)")) {- throw new Error(`earlier writes should collapse behind the elided count:\n${restored}`);+ if (+ !restored.includes(VISIBLE_STDOUT_MARK) ||+ !restored.includes(HIDDEN_STDOUT_MARK) ||+ !restored.includes(VISIBLE_STDERR_MARK)+ ) {+ throw new Error(`/loglevel all should restore every buffered line:\n${restored}`);}input.type("/exit");input.enter();await runPromise;- process.stdout.write(- `${theme.muted("[tui-loglevel] buffered hide/restore with newest-write sections verified")}\n`,- );+ process.stdout.write(`${theme.muted("[tui-loglevel] buffered hide/restore verified")}\n`);} catch (error) {process.stdout.write(`${theme.danger("\n[tui] tui-loglevel smoke test failed:")} ${String(error)}\n`,diff --git a/packages/eve/test/tui-client/tui-server-logs.ts b/packages/eve/test/tui-client/tui-server-logs.tsindex 2124f0589..6b0651e30 100644--- a/packages/eve/test/tui-client/tui-server-logs.ts+++ b/packages/eve/test/tui-client/tui-server-logs.ts@@ -50,7 +50,7 @@ void (async () => {input.enter();console.warn(WARNING);- await screen.waitForText("○ stderr", 5_000);+ await screen.waitForText("○ warn", 5_000);await screen.waitForText(WARNING, 5_000);// The warning must ride the section's rail, not shred the prompt.