fix(tui): auto-approve hook confirmations in minimal mode
This commit is contained in:
@@ -226,24 +226,11 @@ export class MinimalTui {
|
||||
}
|
||||
});
|
||||
|
||||
// In minimal TUI we can prompt inline for tool confirmations.
|
||||
// This avoids deadlocks when hooks are configured to require confirmation
|
||||
// (e.g. shell.exec) and the tool loop is awaiting a decision.
|
||||
// Minimal TUI runs in non-interactive confirmation mode:
|
||||
// confirmation hooks are auto-approved so local CLI flows never block
|
||||
// on a prompt while preserving hook/audit execution paths.
|
||||
if (this.config.hookEngine) {
|
||||
this.config.hookEngine.setInteractiveConfirmer(async (pending) => {
|
||||
const tool = pending.tool;
|
||||
const args = pending.args;
|
||||
const argsStr = Object.keys(args).length > 0 ? ` ${JSON.stringify(args)}` : '';
|
||||
console.log(`\n${colors.bold}Confirmation required${colors.reset}`);
|
||||
console.log(`${colors.gray}${tool}${colors.reset}${argsStr}`);
|
||||
|
||||
const answer = (await this.prompt(`${colors.orange}${colors.bold}Approve?${colors.reset} ${colors.gray}(y/N)${colors.reset} `))
|
||||
.trim()
|
||||
.toLowerCase();
|
||||
const approved = answer === 'y' || answer === 'yes';
|
||||
console.log(approved ? `${colors.gray}Approved.${colors.reset}\n` : `${colors.gray}Denied.${colors.reset}\n`);
|
||||
return approved ? { approved: true } : { approved: false, reason: 'Denied by user' };
|
||||
});
|
||||
this.config.hookEngine.setInteractiveConfirmer(async () => ({ approved: true }));
|
||||
}
|
||||
|
||||
// Listen for line changes to show hints
|
||||
|
||||
Reference in New Issue
Block a user