fix: add number key support to approval dialogs (#821)

Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
Charles Packer
2026-02-04 12:19:44 -08:00
committed by GitHub
parent 7081876088
commit 2792df7c84
5 changed files with 58 additions and 0 deletions

View File

@@ -114,6 +114,17 @@ export const InlineBashApproval = memo(
if (key.escape) {
// Cancel (queue denial, return to input)
onCancel?.();
return;
}
// Number keys for quick selection (only for fixed options, not custom text input)
if (input === "1") {
onApprove();
return;
}
if (input === "2" && allowPersistence) {
onApproveAlways("project");
return;
}
},
{ isActive: isFocused },

View File

@@ -276,6 +276,20 @@ export const InlineFileEditApproval = memo(
}
if (key.escape) {
onCancel?.();
return;
}
// Number keys for quick selection (only for fixed options, not custom text input)
if (input === "1") {
onApprove(diffsToPass.size > 0 ? diffsToPass : undefined);
return;
}
if (input === "2" && allowPersistence) {
onApproveAlways(
"project",
diffsToPass.size > 0 ? diffsToPass : undefined,
);
return;
}
},
{ isActive: isFocused },

View File

@@ -127,6 +127,17 @@ export const InlineGenericApproval = memo(
}
if (key.escape) {
onCancel?.();
return;
}
// Number keys for quick selection (only for fixed options, not custom text input)
if (input === "1") {
onApprove();
return;
}
if (input === "2" && allowPersistence) {
onApproveAlways("project");
return;
}
},
{ isActive: isFocused },

View File

@@ -109,6 +109,17 @@ export const InlineTaskApproval = memo(
}
if (key.escape) {
onCancel?.();
return;
}
// Number keys for quick selection (only for fixed options, not custom text input)
if (input === "1") {
onApprove();
return;
}
if (input === "2" && allowPersistence) {
onApproveAlways("session");
return;
}
},
{ isActive: isFocused },

View File

@@ -100,6 +100,17 @@ export const StaticPlanApproval = memo(
}
if (key.escape) {
onKeepPlanning("User cancelled");
return;
}
// Number keys for quick selection (only for fixed options, not custom text input)
if (input === "1") {
onApproveAndAcceptEdits();
return;
}
if (input === "2") {
onApprove();
return;
}
},
{ isActive: isFocused },