Files
codex/codex-rs/tui/src/chatwidget/side.rs
T
Eric TrautandGitHub 95dafbc7b5 Add /side conversations (#18190)
The TUI supports long-running turns and agent threads, but quick side
questions have required interrupting the main flow or manually
forking/navigating threads. This PR adds a guarded `/side` flow so users
can ask brief side-conversation questions in an ephemeral fork while
keeping the primary thread focused. This also helps address the feature
request in #18125.

The implementation creates one side conversation at a time, lets `/side`
open either an empty side thread or immediately submit `/side
<question>`, and returns to the parent with Esc or Ctrl+C. Side
conversations get hidden developer guardrails that treat inherited
history as reference-only and steer the model away from workspace
mutations unless explicitly requested in the side conversation.

The TUI hides most slash commands while side mode is active, leaving
only `/copy`, `/diff`, `/mention`, and `/status` available there.
2026-04-19 11:59:41 -07:00

32 lines
1.1 KiB
Rust

//! Chat widget hooks for side-conversation mode.
//!
//! App-level side-thread lifecycle lives in `app::side`; this module owns the
//! chat-surface pieces that side mode toggles, such as the composer placeholder,
//! footer label, and inline `/side` message submission behavior.
use super::*;
impl ChatWidget {
pub(crate) fn submit_user_message_as_plain_user_turn(
&mut self,
user_message: UserMessage,
) -> Option<AppCommand> {
self.submit_user_message_with_shell_escape_policy(user_message, ShellEscapePolicy::Disallow)
}
pub(crate) fn set_side_conversation_active(&mut self, active: bool) {
self.active_side_conversation = active;
let placeholder = if active {
self.side_placeholder_text.clone()
} else {
self.normal_placeholder_text.clone()
};
self.bottom_pane.set_placeholder_text(placeholder);
self.bottom_pane.set_side_conversation_active(active);
}
pub(crate) fn set_side_conversation_context_label(&mut self, label: Option<String>) {
self.bottom_pane.set_side_conversation_context_label(label);
}
}