Add keybindings for cycling TUI permission modes (#39873)

## What changed

- Add unbound `previous_permission_mode` and `next_permission_mode` actions to
  `tui.keymap.chat` so users can configure shortcuts that cycle through the
  available built-in permission modes.
- Apply shortcut selections only to the active session, without writing them
  to `config.toml`, and report update failures in the transcript.
- Exclude modes disallowed by managed requirements or platform safety checks,
  reject printable-key bindings, and ignore these bindings in project config.

## Testing

- Cover mode cycling, unavailable modes, session-only updates, server errors,
  stale threads, keymap validation, and project-config sanitization.

GitOrigin-RevId: c3cfdf1e732b7b7bfe8f53fcac19a37e593bbfab
This commit is contained in:
Eric Traut authored and copyberry committed 2026-08-21 06:19:23 +00:00
1 parent 44e95c857f
commit 2aaefa32b0
32 files changed
+708 -47

No files matched your search

+18 -8
View File
@@ -1013,7 +1013,7 @@ mod tests {
let selectable = tab.items.iter().filter(|item| !item.is_disabled).count();
format!("tab: {} ({selectable} selectable)", tab.label)
})
.chain(all_tab.items.iter().take(12).map(|item| {
.chain(all_tab.items.iter().take(13).map(|item| {
format!(
"{} | {} | {}",
item.name,
@@ -1059,13 +1059,23 @@ mod tests {
let params = build_keymap_picker_params(&runtime, &TuiKeymap::default());
let unbound_tab = selection_tab(&params, KEYMAP_UNBOUND_TAB_ID);
assert_eq!(unbound_tab.items.len(), 2);
assert_eq!(unbound_tab.items[0].name, "Toggle Vim Mode");
assert_eq!(unbound_tab.items[0].description.as_deref(), Some("unbound"));
assert!(!unbound_tab.items[0].is_disabled);
assert_eq!(unbound_tab.items[1].name, "Kill Whole Line");
assert_eq!(unbound_tab.items[1].description.as_deref(), Some("unbound"));
assert!(!unbound_tab.items[1].is_disabled);
assert_eq!(
unbound_tab
.items
.iter()
.map(|item| (
item.name.as_str(),
item.description.as_deref(),
item.is_disabled
))
.collect::<Vec<_>>(),
vec![
("Toggle Vim Mode", Some("unbound"), false),
("Previous Permission Mode", Some("unbound"), false),
("Next Permission Mode", Some("unbound"), false),
("Kill Whole Line", Some("unbound"), false),
]
);
}
#[test]