fix: guarded terminal control sequences behind isTTY checks

- Skipped thinking-line writes and clears when stdout is not a TTY.
- Prevented terminal title (set/push/pop) from emitting OSC/xterm escape sequences to piped or non-interactive output.
- Suppressed all ProcessTerminal control writes when stdout isn't a TTY.
This commit is contained in:
can1357
2026-05-17 05:29:56 +02:00
parent f945e5e382
commit f4b1cc084b
4 changed files with 9 additions and 1 deletions
@@ -79,12 +79,14 @@ export async function runCommitAgentSession(input: CommitAgentInput): Promise<Co
let thinkingLineActive = false;
const toolArgsById = new Map<string, { name: string; args?: Record<string, unknown> }>();
const writeThinkingLine = (text: string) => {
if (!process.stdout.isTTY) return;
const line = chalk.dim(`… ${text}`);
process.stdout.write(`\r\x1b[2K${line}`);
thinkingLineActive = true;
};
const clearThinkingLine = () => {
if (!thinkingLineActive) return;
if (!process.stdout.isTTY) return;
process.stdout.write("\r\x1b[2K");
thinkingLineActive = false;
};