mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
fix: console patcher test errors
This commit is contained in:
@@ -40,6 +40,7 @@ import {
|
|||||||
} from './types.js';
|
} from './types.js';
|
||||||
import type { LoadedSettings } from '../config/settings.js';
|
import type { LoadedSettings } from '../config/settings.js';
|
||||||
import { runNonInteractive } from '../nonInteractiveCli.js';
|
import { runNonInteractive } from '../nonInteractiveCli.js';
|
||||||
|
import { ConsolePatcher } from '../ui/utils/ConsolePatcher.js';
|
||||||
|
|
||||||
const SESSION_STATE = {
|
const SESSION_STATE = {
|
||||||
INITIALIZING: 'initializing',
|
INITIALIZING: 'initializing',
|
||||||
@@ -695,21 +696,30 @@ export async function runNonInteractiveStreamJson(
|
|||||||
input: string,
|
input: string,
|
||||||
_promptId: string,
|
_promptId: string,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
// Create initial user message from prompt input if provided
|
const consolePatcher = new ConsolePatcher({
|
||||||
let initialPrompt: CLIUserMessage | undefined = undefined;
|
debugMode: config.getDebugMode(),
|
||||||
if (input && input.trim().length > 0) {
|
});
|
||||||
const sessionId = config.getSessionId();
|
consolePatcher.patch();
|
||||||
initialPrompt = {
|
|
||||||
type: 'user',
|
|
||||||
session_id: sessionId,
|
|
||||||
message: {
|
|
||||||
role: 'user',
|
|
||||||
content: input.trim(),
|
|
||||||
},
|
|
||||||
parent_tool_use_id: null,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
const manager = new SessionManager(config, settings, initialPrompt);
|
try {
|
||||||
await manager.run();
|
// Create initial user message from prompt input if provided
|
||||||
|
let initialPrompt: CLIUserMessage | undefined = undefined;
|
||||||
|
if (input && input.trim().length > 0) {
|
||||||
|
const sessionId = config.getSessionId();
|
||||||
|
initialPrompt = {
|
||||||
|
type: 'user',
|
||||||
|
session_id: sessionId,
|
||||||
|
message: {
|
||||||
|
role: 'user',
|
||||||
|
content: input.trim(),
|
||||||
|
},
|
||||||
|
parent_tool_use_id: null,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const manager = new SessionManager(config, settings, initialPrompt);
|
||||||
|
await manager.run();
|
||||||
|
} finally {
|
||||||
|
consolePatcher.cleanup();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user