mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-07-11 02:20:48 -07:00
feat(cli): improve UserSimulator robustness and prompt sensitivity
- Prioritize interactive markers (prompts, confirmation dialogs) over background timers/spinners. - Suppress background update checks and non-fatal UI warnings when simulateUser is enabled. - Refine simulator system prompt for more aggressive prompt detection. - Implement reliable key submission with stabilized terminal initialization and inter-character delays. - Add unit tests for UserSimulator vision and input submission.
This commit is contained in:
@@ -94,11 +94,14 @@ export async function startInteractiveUI(
|
||||
const version = await getVersion();
|
||||
setWindowTitle(basename(workspaceRoot), settings);
|
||||
|
||||
const simulateUser = config.getSimulateUser();
|
||||
|
||||
const consolePatcher = new ConsolePatcher({
|
||||
onNewMessage: (msg) => {
|
||||
coreEvents.emitConsoleLog(msg.type, msg.content);
|
||||
},
|
||||
debugMode: config.getDebugMode(),
|
||||
interactive: !simulateUser,
|
||||
});
|
||||
consolePatcher.patch();
|
||||
|
||||
@@ -144,7 +147,6 @@ export async function startInteractiveUI(
|
||||
await new Promise((resolve) => setTimeout(resolve, 100));
|
||||
}
|
||||
|
||||
const simulateUser = config.getSimulateUser();
|
||||
const simulatedStdin = new PassThrough({ encoding: 'utf8' });
|
||||
|
||||
let lastFrame: string | undefined;
|
||||
@@ -199,16 +201,18 @@ export async function startInteractiveUI(
|
||||
registerCleanup(cleanupLineWrapping);
|
||||
}
|
||||
|
||||
checkForUpdates(settings)
|
||||
.then((info) => {
|
||||
handleAutoUpdate(info, settings, config.getProjectRoot());
|
||||
})
|
||||
.catch((err) => {
|
||||
// Silently ignore update check errors.
|
||||
if (config.getDebugMode()) {
|
||||
debugLogger.warn('Update check failed:', err);
|
||||
}
|
||||
});
|
||||
if (!simulateUser) {
|
||||
checkForUpdates(settings)
|
||||
.then((info) => {
|
||||
handleAutoUpdate(info, settings, config.getProjectRoot());
|
||||
})
|
||||
.catch((err) => {
|
||||
// Silently ignore update check errors.
|
||||
if (config.getDebugMode()) {
|
||||
debugLogger.warn('Update check failed:', err);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (simulateUser) {
|
||||
const simulator = new UserSimulator(
|
||||
|
||||
Reference in New Issue
Block a user