feat: add double Ctrl+C to exit from approval screen (#200)

Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
Charles Packer
2025-12-12 20:14:38 -08:00
committed by GitHub
parent 8bb588e5af
commit 28094b6cac
2 changed files with 37 additions and 0 deletions

View File

@@ -19,6 +19,7 @@ type Props = {
onApproveAll: () => void;
onApproveAlways: (scope?: "project" | "session") => void;
onDenyAll: (reason: string) => void;
onCancel?: () => void; // Cancel all approvals without sending to server
};
type DynamicPreviewProps = {
@@ -397,6 +398,7 @@ export const ApprovalDialog = memo(function ApprovalDialog({
onApproveAll,
onApproveAlways,
onDenyAll,
onCancel,
}: Props) {
const [selectedOption, setSelectedOption] = useState(0);
const [isEnteringReason, setIsEnteringReason] = useState(false);
@@ -453,6 +455,14 @@ export const ApprovalDialog = memo(function ApprovalDialog({
useInput((_input, key) => {
if (isExecuting) return;
// Handle CTRL-C to cancel all approvals
if (key.ctrl && _input === "c") {
if (onCancel) {
onCancel();
}
return;
}
if (isEnteringReason) {
// When entering reason, only handle enter/escape
if (key.return) {