fix: console patcher test errors

This commit is contained in:
mingholy.lmh
2025-11-12 13:59:05 +08:00
parent 6423eec614
commit 4324ba4686

View File

@@ -40,6 +40,7 @@ import {
} from './types.js';
import type { LoadedSettings } from '../config/settings.js';
import { runNonInteractive } from '../nonInteractiveCli.js';
import { ConsolePatcher } from '../ui/utils/ConsolePatcher.js';
const SESSION_STATE = {
INITIALIZING: 'initializing',
@@ -695,6 +696,12 @@ export async function runNonInteractiveStreamJson(
input: string,
_promptId: string,
): Promise<void> {
const consolePatcher = new ConsolePatcher({
debugMode: config.getDebugMode(),
});
consolePatcher.patch();
try {
// Create initial user message from prompt input if provided
let initialPrompt: CLIUserMessage | undefined = undefined;
if (input && input.trim().length > 0) {
@@ -712,4 +719,7 @@ export async function runNonInteractiveStreamJson(
const manager = new SessionManager(config, settings, initialPrompt);
await manager.run();
} finally {
consolePatcher.cleanup();
}
}