refactor(stdio): always patch stdout and use createWorkingStdio for clean output (#14159)

This commit is contained in:
Allen Hutchison
2025-12-02 15:08:25 -08:00
committed by GitHub
parent 2d935b3798
commit 828afe113e
12 changed files with 31 additions and 24 deletions
@@ -30,6 +30,7 @@ import {
debugLogger,
ReadManyFilesTool,
getEffectiveModel,
createWorkingStdio,
startupProfiler,
} from '@google/gemini-cli-core';
import * as acp from './acp.js';
@@ -51,15 +52,10 @@ export async function runZedIntegration(
settings: LoadedSettings,
argv: CliArgs,
) {
const stdout = Writable.toWeb(process.stdout) as WritableStream;
const { stdout: workingStdout } = createWorkingStdio();
const stdout = Writable.toWeb(workingStdout) as WritableStream;
const stdin = Readable.toWeb(process.stdin) as ReadableStream<Uint8Array>;
// Stdout is used to send messages to the client, so console.log/console.info
// messages to stderr so that they don't interfere with ACP.
console.log = console.error;
console.info = console.error;
console.debug = console.error;
new acp.AgentSideConnection(
(client: acp.Client) => new GeminiAgent(config, settings, argv, client),
stdout,