fix(tui): auto-approve hook confirmations in minimal mode
This commit is contained in:
@@ -5583,6 +5583,17 @@
|
|||||||
"docs/plans/state.json"
|
"docs/plans/state.json"
|
||||||
],
|
],
|
||||||
"test_status": "pnpm typecheck passing"
|
"test_status": "pnpm typecheck passing"
|
||||||
|
},
|
||||||
|
"tui-noninteractive-confirmation-mode": {
|
||||||
|
"status": "completed",
|
||||||
|
"date": "2026-02-19",
|
||||||
|
"updated": "2026-02-19",
|
||||||
|
"summary": "Changed minimal TUI confirmation behavior to non-interactive auto-approval for hook confirmations, removing inline confirmation prompts that blocked local flows while keeping hook and audit paths active.",
|
||||||
|
"files_modified": [
|
||||||
|
"src/frontends/tui/minimal.ts",
|
||||||
|
"docs/plans/state.json"
|
||||||
|
],
|
||||||
|
"test_status": "pnpm typecheck passing"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"overall_progress": {
|
"overall_progress": {
|
||||||
|
|||||||
@@ -226,24 +226,11 @@ export class MinimalTui {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// In minimal TUI we can prompt inline for tool confirmations.
|
// Minimal TUI runs in non-interactive confirmation mode:
|
||||||
// This avoids deadlocks when hooks are configured to require confirmation
|
// confirmation hooks are auto-approved so local CLI flows never block
|
||||||
// (e.g. shell.exec) and the tool loop is awaiting a decision.
|
// on a prompt while preserving hook/audit execution paths.
|
||||||
if (this.config.hookEngine) {
|
if (this.config.hookEngine) {
|
||||||
this.config.hookEngine.setInteractiveConfirmer(async (pending) => {
|
this.config.hookEngine.setInteractiveConfirmer(async () => ({ approved: true }));
|
||||||
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' };
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Listen for line changes to show hints
|
// Listen for line changes to show hints
|
||||||
|
|||||||
Reference in New Issue
Block a user