mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:50:52 +00:00
Add host cycling and saved defaults for new TUI conversations (#59007)
## What changed - With multi-backend support enabled, show the current host before the first submission and use `leader b` to cycle through available connections. Expose the shortcut as `tui.keymap.global.change_host`. - Preserve the conversation name and composer draft, including cursor position, attachments, pending pastes, and literal versus shell-command interpretation of `!`. - Save explicit host choices in user-only `tui.default_hosts`, scoped to the local project and user identity. Use the saved host for new conversations, falling back to the first available connection when it is unavailable. - Prepare the destination and check directory trust before replacing the current conversation. Block switching during voice calls and active turns, and remove replaced blank conversations from the session overview. ## Testing Add coverage for shortcut visibility and remapping, draft and name preservation, project/user preference isolation, unavailable-host fallback, destination trust and startup failures, and voice-call guards. GitOrigin-RevId: def7b088951336bec8fe3962954fba9b861f91c6
This commit is contained in:
committed by
copyberry
parent
857415f7f2
commit
26f73fba8f
@@ -284,6 +284,7 @@ macro_rules! define_runtime_action_bindings {
|
||||
|
||||
define_runtime_action_bindings! {
|
||||
"global" => Global, app, global [
|
||||
change_host,
|
||||
open_agents,
|
||||
open_transcript,
|
||||
find_transcript,
|
||||
|
||||
@@ -53,6 +53,7 @@ const VOICE_TOGGLE: u32 = 1 << 17;
|
||||
const RAW_KEY_CAPTURE: u32 = 1 << 18;
|
||||
const VOICE_TOGGLE_BLOCKED: u32 = 1 << 19;
|
||||
const TRANSCRIPT_ACTIONS: u32 = 1 << 20;
|
||||
const BACKEND_CYCLING: u32 = 1 << 21;
|
||||
|
||||
const TRANSCRIPT_BROWSING: u32 = 1 << 14;
|
||||
|
||||
@@ -67,6 +68,11 @@ impl KeymapContextSet {
|
||||
Self(context_bit(KeymapContext::List) | context_bit(KeymapContext::Global) | ACTIVITY_FOCUS)
|
||||
}
|
||||
|
||||
/// Offer backend cycling only while the new conversation control is visible.
|
||||
pub(crate) const fn with_backend_cycling(self) -> Self {
|
||||
Self(self.0 | BACKEND_CYCLING)
|
||||
}
|
||||
|
||||
/// Add only the detail-close action to an owned composer path.
|
||||
pub(crate) const fn with_transcript_close(self) -> Self {
|
||||
Self(self.0 | context_bit(KeymapContext::Pager) | TRANSCRIPT_CLOSE)
|
||||
@@ -152,6 +158,9 @@ impl KeymapContextSet {
|
||||
|
||||
/// Whether this input path can dispatch the action, including focus-specific exclusions.
|
||||
pub(crate) fn contains_action(self, action: KeymapActionId) -> bool {
|
||||
if action.context == KeymapContext::Global && action.action == "change_host" {
|
||||
return self.0 & BACKEND_CYCLING != 0;
|
||||
}
|
||||
if action.context == KeymapContext::Chat && action.action == "open_presets" {
|
||||
return self.contains(KeymapContext::Chat)
|
||||
&& self.contains(KeymapContext::Global)
|
||||
@@ -519,6 +528,7 @@ impl KeyChordMatcher {
|
||||
{
|
||||
let label = match binding.action.action {
|
||||
"open_presets" if pending.started_at.is_none() => "presets",
|
||||
"change_host" => "cycle",
|
||||
"focus_activity" => "activity",
|
||||
"find_transcript" => "find",
|
||||
"open_warnings" => "warnings",
|
||||
|
||||
@@ -23,6 +23,13 @@ pub(in crate::keymap) fn register(keymap: &TuiKeymap, resolved: &mut RuntimeKeym
|
||||
.count(),
|
||||
);
|
||||
for (configured, context, action, completion, spec) in [
|
||||
(
|
||||
keymap.global.change_host.as_ref(),
|
||||
KeymapContext::Global,
|
||||
"change_host",
|
||||
'b',
|
||||
"leader b",
|
||||
),
|
||||
(
|
||||
keymap.global.select_transcript.as_ref(),
|
||||
KeymapContext::Global,
|
||||
|
||||
Reference in New Issue
Block a user