mirror of
https://github.com/openai/codex.git
synced 2026-11-18 22:20:48 +00:00
Open subagent transcripts in the TUI sidebar (#62157)
## Why Selecting a subagent from the sidebar switched the active conversation to that agent. Keeping the parent conversation visible makes it easier to review the agent's work in context. ## What changed - Open the selected subagent in a sidebar tab alongside its parent conversation. Switch focus between the two panes as needed. - Show parent-owned subagents in a watch-only reader with transcript navigation, search, and selection. - Press `Esc` from the reader to return to the subagent list with the same agent selected. The tab also supports the sidebar's close button and close shortcut. ## Testing Add a TUI integration test that opens a saved subagent through the sidebar, snapshots the watch-only view, and covers transcript navigation, search, resizing, and tab dismissal. GitOrigin-RevId: 60da0759b7c046c33b665abdbb063153c5beafa4
This commit is contained in:
@@ -1076,7 +1076,10 @@ impl App {
|
||||
self.begin_thread_switch_history_replay_buffer();
|
||||
}
|
||||
AppEvent::ParkSideCompanion { pair, thread_id, stream, display } => {
|
||||
if self.side_threads.contains_key(&pair) {
|
||||
if self.side_threads.contains_key(&pair)
|
||||
|| self.sidebars.get(&self.primary_thread_id)
|
||||
.is_some_and(|pane| pane.agents.detail == Some(pair))
|
||||
{
|
||||
self.transcript_view.sync_history_tail(&self.transcript_cells);
|
||||
let mut answer = None;
|
||||
if let Some(stream) = stream {
|
||||
|
||||
@@ -369,6 +369,9 @@ impl App {
|
||||
.paint_document_links(frame.buffer, link_pointer);
|
||||
match &self.conversation_frame.sidebar {
|
||||
Some(sidebar::SidebarLayout::Chat(panes)) => {
|
||||
let watch_only = self.docked_agent().is_some_and(|(_, id)| {
|
||||
id == panes.passive_thread && self.agent_navigation.is_parent_owned(id)
|
||||
});
|
||||
if let Some(companion) = self.side_companions.get_mut(&panes.passive_thread) {
|
||||
companion.view.image_protocol = self.transcript_view.image_protocol;
|
||||
panes.paint_companion(
|
||||
@@ -376,6 +379,7 @@ impl App {
|
||||
frame,
|
||||
self.local_settings.tui.collapse_turn_details,
|
||||
&frames,
|
||||
watch_only,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -517,21 +521,27 @@ impl App {
|
||||
&& (pane.creation.is_none()
|
||||
|| matches!(
|
||||
pane.visible_content(),
|
||||
Some(sidebar::SidebarContent::Document(_))
|
||||
Some(
|
||||
sidebar::SidebarContent::Document(_)
|
||||
| sidebar::SidebarContent::Subagents
|
||||
)
|
||||
))
|
||||
{
|
||||
let document = matches!(
|
||||
let content_tab = matches!(
|
||||
pane.visible_content(),
|
||||
Some(sidebar::SidebarContent::Document(_))
|
||||
Some(
|
||||
sidebar::SidebarContent::Document(_)
|
||||
| sidebar::SidebarContent::Subagents
|
||||
)
|
||||
);
|
||||
let chooser = if document {
|
||||
let chooser = if content_tab {
|
||||
TabState::Absent
|
||||
} else if focused {
|
||||
TabState::Active
|
||||
} else {
|
||||
TabState::Inactive
|
||||
};
|
||||
if document {
|
||||
if content_tab {
|
||||
ratatui::widgets::Clear
|
||||
.render(side_pane::tab_and_body(*sidebar)[0], frame.buffer);
|
||||
}
|
||||
@@ -539,9 +549,9 @@ impl App {
|
||||
crate::sidebar_chooser::tab_strip(
|
||||
*sidebar,
|
||||
chooser,
|
||||
if document && focused {
|
||||
if content_tab && focused {
|
||||
TabState::Active
|
||||
} else if document {
|
||||
} else if content_tab {
|
||||
TabState::Inactive
|
||||
} else {
|
||||
TabState::Absent
|
||||
@@ -691,6 +701,14 @@ impl App {
|
||||
frame: &mut Frame<'_>,
|
||||
prepared: &PreparedConversation,
|
||||
) -> PaintedConversation {
|
||||
if self.docked_agent().is_some_and(|(_, id)| {
|
||||
self.current_displayed_thread_id() == Some(id)
|
||||
&& self.agent_navigation.is_parent_owned(id)
|
||||
}) && self.chat_widget.no_modal_or_popup_active()
|
||||
&& !self.chat_widget.is_read_only_view()
|
||||
{
|
||||
return self.paint_agent_reader(frame, prepared);
|
||||
}
|
||||
let PreparedConversation {
|
||||
area,
|
||||
transcript_width,
|
||||
@@ -878,6 +896,125 @@ impl App {
|
||||
}
|
||||
}
|
||||
|
||||
fn paint_agent_reader(
|
||||
&mut self,
|
||||
frame: &mut Frame<'_>,
|
||||
prepared: &PreparedConversation,
|
||||
) -> PaintedConversation {
|
||||
use crate::keymap::ListAction;
|
||||
use ratatui::widgets::Paragraph;
|
||||
|
||||
let area = prepared.area;
|
||||
ratatui::widgets::Clear.render(area, frame.buffer);
|
||||
let back = self.keymap.list.primary_hint(ListAction::Cancel);
|
||||
let heading = back.map_or_else(
|
||||
|| "Watch only".to_owned(),
|
||||
|hint| format!("{} back to agents · Watch only", hint.display_label()),
|
||||
);
|
||||
Line::from(heading).dim().render(
|
||||
Rect {
|
||||
height: area.height.min(1),
|
||||
..area
|
||||
},
|
||||
frame.buffer,
|
||||
);
|
||||
let mut body = Rect {
|
||||
y: area.y.saturating_add(1),
|
||||
height: area.height.saturating_sub(1),
|
||||
..area
|
||||
};
|
||||
let view = &mut self.transcript_view;
|
||||
let footer = self
|
||||
.pane_resize
|
||||
.is_none()
|
||||
.then(|| view.footer_with_navigation(body.width, prepared.motion, "end latest"))
|
||||
.flatten();
|
||||
let hints = crate::footer_hint::HintLine::new(
|
||||
[
|
||||
Some(crate::footer_hint::shortcut("↑/↓", "read")),
|
||||
self.keymap
|
||||
.pager
|
||||
.find
|
||||
.first()
|
||||
.map(|key| crate::footer_hint::shortcut(&key.display_label(), "find")),
|
||||
self.keymap
|
||||
.primary_hint(KeymapContext::Global, "select_transcript")
|
||||
.map(|hint| crate::footer_hint::shortcut(&hint.display_label(), "select")),
|
||||
]
|
||||
.into_iter()
|
||||
.flatten(),
|
||||
body.width,
|
||||
);
|
||||
let text = if self.pane_resize.is_some() {
|
||||
crate::sidebar_chooser::resize_hint(side_pane::RESIZE_HINT, body.width).into()
|
||||
} else if let Some(footer) = &footer {
|
||||
footer.text.clone()
|
||||
} else {
|
||||
hints.line.into()
|
||||
};
|
||||
let footer_height = body.height.saturating_sub(1).min(text.height() as u16);
|
||||
body.height -= footer_height;
|
||||
let gap = if body.height > 1 {
|
||||
body.height -= 1;
|
||||
Some(Rect {
|
||||
y: body.bottom(),
|
||||
height: 1,
|
||||
..body
|
||||
})
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let bottom_area = Rect {
|
||||
y: area.bottom() - footer_height,
|
||||
height: footer_height,
|
||||
..area
|
||||
};
|
||||
body.width = prepared.transcript_width;
|
||||
view.render_with_turn_tip_space(
|
||||
body,
|
||||
frame.buffer,
|
||||
&self.transcript_cells,
|
||||
/*tip*/ None,
|
||||
);
|
||||
view.finish_collapse_layout(&self.transcript_cells);
|
||||
// Escape returns to the agent list, so the transcript's Escape hint would be misleading.
|
||||
let show_follow_control = std::mem::replace(&mut view.show_follow_control, false);
|
||||
let feedback_tick =
|
||||
view.render_composer_gap(gap, /*hint*/ None, frame.buffer, prepared.now);
|
||||
view.show_follow_control = show_follow_control;
|
||||
Paragraph::new(text).render(bottom_area, frame.buffer);
|
||||
if footer_height > 0
|
||||
&& let Some(column) = footer.and_then(|footer| footer.cursor_column)
|
||||
{
|
||||
frame.set_cursor_position((bottom_area.x + column, bottom_area.y));
|
||||
}
|
||||
self.chat_widget
|
||||
.rendered_selection
|
||||
.borrow_mut()
|
||||
.areas
|
||||
.clear();
|
||||
self.chat_widget.note_rendered_width(area.width);
|
||||
let first_image = frame.image_placements.len();
|
||||
frame.image_placements.extend(view.image_placements());
|
||||
let tick = (view.is_loading_history()
|
||||
|| (view.is_following()
|
||||
&& self
|
||||
.chat_widget
|
||||
.active_cell_transcript_key()
|
||||
.is_some_and(|key| key.animation_tick.is_some())))
|
||||
&& prepared.motion == MotionMode::Animated;
|
||||
PaintedConversation {
|
||||
image_range: first_image..frame.image_placements.len(),
|
||||
bottom_area,
|
||||
delayed_frames: [
|
||||
feedback_tick,
|
||||
None,
|
||||
tick.then_some(Duration::from_millis(50)),
|
||||
],
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
|
||||
/// Acknowledge only a presented frame. Keep neighboring images for the next input refresh.
|
||||
pub(super) fn finish_conversation(
|
||||
&mut self,
|
||||
|
||||
@@ -955,6 +955,11 @@ impl App {
|
||||
) -> Result<()> {
|
||||
let retain_side_view = self.side_retention_enabled(tui);
|
||||
let side_parent = |id| {
|
||||
if let Some((parent, agent)) = self.docked_agent()
|
||||
&& (id == parent || id == agent)
|
||||
{
|
||||
return Some(parent);
|
||||
}
|
||||
self.side_threads
|
||||
.get(&self.side_pair_key(id)?)
|
||||
.map(|side| side.parent_thread_id)
|
||||
|
||||
@@ -324,8 +324,9 @@ impl App {
|
||||
return Some(focused);
|
||||
}
|
||||
let child = self.side_pair_key(focused)?;
|
||||
(self.sidebar()?.visible_content() == Some(sidebar::SidebarContent::Chat(child)))
|
||||
.then_some(focused)
|
||||
(self.docked_agent().is_some()
|
||||
|| self.sidebar()?.visible_content() == Some(sidebar::SidebarContent::Chat(child)))
|
||||
.then_some(focused)
|
||||
}
|
||||
|
||||
pub(super) fn switchable_side_child(&self) -> Option<ThreadId> {
|
||||
@@ -336,7 +337,11 @@ impl App {
|
||||
}
|
||||
|
||||
pub(super) fn side_pair_key(&self, thread_id: ThreadId) -> Option<ThreadId> {
|
||||
if self.side_threads.contains_key(&thread_id) {
|
||||
if let Some((owner, agent)) = self.docked_agent()
|
||||
&& (thread_id == owner || thread_id == agent)
|
||||
{
|
||||
Some(agent)
|
||||
} else if self.side_threads.contains_key(&thread_id) {
|
||||
Some(thread_id)
|
||||
} else {
|
||||
self.side_thread_for_parent(thread_id)
|
||||
@@ -474,7 +479,13 @@ impl App {
|
||||
let Some(active_thread_id) = self.current_displayed_thread_id() else {
|
||||
return Ok(());
|
||||
};
|
||||
let target_thread_id = if let Some(state) = self.side_threads.get(&active_thread_id) {
|
||||
let target_thread_id = if let Some((owner, agent)) = self.docked_agent() {
|
||||
if active_thread_id == agent {
|
||||
owner
|
||||
} else {
|
||||
agent
|
||||
}
|
||||
} else if let Some(state) = self.side_threads.get(&active_thread_id) {
|
||||
state.parent_thread_id
|
||||
} else if let Some(side_thread_id) = self.side_thread_for_parent(active_thread_id) {
|
||||
side_thread_id
|
||||
@@ -501,10 +512,18 @@ impl App {
|
||||
let Some(child) = self.current_displayed_thread_id() else {
|
||||
return Ok(());
|
||||
};
|
||||
let Some(side) = self.side_threads.get(&child) else {
|
||||
let parent = self
|
||||
.side_threads
|
||||
.get(&child)
|
||||
.map(|side| side.parent_thread_id)
|
||||
.or_else(|| {
|
||||
self.docked_agent()
|
||||
.filter(|(_, agent)| *agent == child)
|
||||
.map(|(parent, _)| parent)
|
||||
});
|
||||
let Some(parent) = parent else {
|
||||
return Ok(());
|
||||
};
|
||||
let parent = side.parent_thread_id;
|
||||
self.select_agent_thread(tui, app_server, parent).await?;
|
||||
if self.current_displayed_thread_id() == Some(parent) {
|
||||
self.sidebar_mut().hide();
|
||||
|
||||
@@ -58,7 +58,10 @@ impl App {
|
||||
tui: &mut tui::Tui,
|
||||
server: &mut AppServerSession,
|
||||
) -> Result<()> {
|
||||
if let Some(parent) = self.active_side_parent_thread_id() {
|
||||
if let Some(parent) = self
|
||||
.sidebar_parent()
|
||||
.filter(|parent| Some(*parent) != self.current_displayed_thread_id())
|
||||
{
|
||||
self.select_agent_thread(tui, server, parent).await?;
|
||||
if self.current_displayed_thread_id() != Some(parent) {
|
||||
return Ok(());
|
||||
@@ -115,24 +118,34 @@ impl App {
|
||||
server: &mut AppServerSession,
|
||||
tab: SidebarTab,
|
||||
) -> Result<()> {
|
||||
if tab == SidebarTab::Subagents {
|
||||
if let Some(agent) = self.sidebar().and_then(|pane| pane.agents.detail) {
|
||||
return Box::pin(self.open_sidebar_agent(tui, server, agent)).await;
|
||||
}
|
||||
return Ok(());
|
||||
}
|
||||
if let SidebarTab::Document(id) = tab {
|
||||
if let Some(parent) = self.active_side_parent_thread_id() {
|
||||
if let Some(parent) = self
|
||||
.sidebar_parent()
|
||||
.filter(|parent| Some(*parent) != self.current_displayed_thread_id())
|
||||
{
|
||||
self.select_agent_thread(tui, server, parent).await?;
|
||||
if self.current_displayed_thread_id() != Some(parent) {
|
||||
return Ok(());
|
||||
}
|
||||
self.focus_returned_parent_composer(parent).await?;
|
||||
}
|
||||
if self
|
||||
if !self
|
||||
.sidebar()
|
||||
.and_then(|pane| pane.documents.get(&id))
|
||||
.is_some_and(|doc| doc.backend == server.backend_id())
|
||||
{
|
||||
self.zoomed_thread = None;
|
||||
self.sidebar_mut()
|
||||
.show(SidebarContent::Document(id), PaneFocus::Sidebar);
|
||||
tui.frame_requester().schedule_frame();
|
||||
return Ok(());
|
||||
}
|
||||
self.zoomed_thread = None;
|
||||
self.sidebar_mut()
|
||||
.show(SidebarContent::Document(id), PaneFocus::Sidebar);
|
||||
tui.frame_requester().schedule_frame();
|
||||
return Ok(());
|
||||
}
|
||||
let SidebarTab::Chat(id) = tab else {
|
||||
@@ -158,10 +171,32 @@ impl App {
|
||||
) -> Result<()> {
|
||||
match tab {
|
||||
SidebarTab::Chat(id) => sidebar_close::request(self, tui, server, id, CloseTab).await,
|
||||
SidebarTab::Document(id) => {
|
||||
SidebarTab::Document(_) | SidebarTab::Subagents => {
|
||||
if tab == SidebarTab::Subagents
|
||||
&& let Some((parent, agent)) = self.docked_agent()
|
||||
&& self.current_displayed_thread_id() == Some(agent)
|
||||
{
|
||||
self.select_agent_thread(tui, server, parent).await?;
|
||||
if self.current_displayed_thread_id() != Some(parent) {
|
||||
return Ok(());
|
||||
}
|
||||
self.focus_returned_parent_composer(parent).await?;
|
||||
}
|
||||
if tab == SidebarTab::Subagents
|
||||
&& let Some(agent) = self.sidebar().and_then(|pane| pane.agents.detail)
|
||||
{
|
||||
self.side_companions.remove(&agent);
|
||||
}
|
||||
let pane = self.sidebar_mut();
|
||||
let active = pane.visible_content() == Some(SidebarContent::Document(id));
|
||||
pane.remove_document(id);
|
||||
let active = match tab {
|
||||
SidebarTab::Document(id) => {
|
||||
let active = pane.visible_content() == Some(SidebarContent::Document(id));
|
||||
pane.remove_document(id);
|
||||
active
|
||||
}
|
||||
SidebarTab::Subagents => pane.close_agents(),
|
||||
SidebarTab::Chat(_) => unreachable!(),
|
||||
};
|
||||
if active {
|
||||
if let Some(previous) = pane.recent_tab(/*excluding*/ None) {
|
||||
self.zoomed_thread = None;
|
||||
@@ -313,6 +348,13 @@ impl App {
|
||||
) {
|
||||
return self.handle_document_input(tui, server, event).await;
|
||||
}
|
||||
if self
|
||||
.sidebar()
|
||||
.and_then(sidebar::SidebarPane::visible_content)
|
||||
== Some(SidebarContent::Subagents)
|
||||
{
|
||||
return self.handle_docked_agent_input(tui, server, event).await;
|
||||
}
|
||||
if self.chooser_focus().is_none() {
|
||||
return false;
|
||||
}
|
||||
@@ -499,7 +541,7 @@ impl App {
|
||||
.visible_threads()
|
||||
.iter()
|
||||
.any(|(id, _)| *id == agent)
|
||||
&& let Err(error) = Box::pin(self.select_agent_thread(tui, server, agent)).await
|
||||
&& let Err(error) = Box::pin(self.open_sidebar_agent(tui, server, agent)).await
|
||||
{
|
||||
self.chat_widget.add_error_message(error.to_string());
|
||||
}
|
||||
@@ -571,7 +613,8 @@ impl App {
|
||||
});
|
||||
}
|
||||
} else if matches!(action, ChooserAction::Back)
|
||||
&& let Some(tab @ SidebarTab::Document(_)) = pane.recent_tab(/*excluding*/ None)
|
||||
&& let Some(tab @ (SidebarTab::Document(_) | SidebarTab::Subagents)) =
|
||||
pane.recent_tab(/*excluding*/ None)
|
||||
{
|
||||
if let Err(err) = self.activate_sidebar_tab(tui, server, tab).await {
|
||||
self.chat_widget.add_error_message(err.to_string());
|
||||
@@ -664,12 +707,18 @@ impl App {
|
||||
(bindings.close_sidebar_tab.is_pressed(key)
|
||||
|| (document_shortcut && crate::key_hint::plain(KeyCode::Esc).is_press(key)))
|
||||
.then_some(SidebarTab::Document(id))
|
||||
} else if bindings.close_sidebar_tab.is_pressed(key) {
|
||||
self.current_displayed_thread_id().and_then(|id| {
|
||||
if self.docked_agent().is_some_and(|(_, agent)| id == agent) {
|
||||
Some(SidebarTab::Subagents)
|
||||
} else {
|
||||
self.side_threads
|
||||
.contains_key(&id)
|
||||
.then_some(SidebarTab::Chat(id))
|
||||
}
|
||||
})
|
||||
} else {
|
||||
self.current_displayed_thread_id()
|
||||
.filter(|id| {
|
||||
bindings.close_sidebar_tab.is_pressed(key) && self.side_threads.contains_key(id)
|
||||
})
|
||||
.map(SidebarTab::Chat)
|
||||
None
|
||||
};
|
||||
let left = bindings.focus_pane_left.is_pressed(key);
|
||||
let tab_step = if bindings.sidebar_up.is_pressed(key)
|
||||
@@ -852,7 +901,10 @@ impl App {
|
||||
tui: &mut tui::Tui,
|
||||
app_server: &mut AppServerSession,
|
||||
) -> Result<()> {
|
||||
if let Some(parent) = self.active_side_parent_thread_id() {
|
||||
if let Some(parent) = self
|
||||
.sidebar_parent()
|
||||
.filter(|parent| Some(*parent) != self.current_displayed_thread_id())
|
||||
{
|
||||
self.select_agent_thread(tui, app_server, parent).await?;
|
||||
if self.current_displayed_thread_id() == Some(parent) {
|
||||
self.focus_returned_parent_composer(parent).await?;
|
||||
|
||||
@@ -137,10 +137,18 @@ pub(super) fn pair_layout(
|
||||
return None;
|
||||
}
|
||||
let active = app.current_displayed_thread_id()?;
|
||||
let side = app.side_threads.get(&child)?;
|
||||
let owner = app
|
||||
.side_threads
|
||||
.get(&child)
|
||||
.map(|side| side.parent_thread_id)
|
||||
.or_else(|| {
|
||||
app.docked_agent()
|
||||
.filter(|(_, agent)| *agent == child)
|
||||
.map(|(parent, _)| parent)
|
||||
})?;
|
||||
let [tab_strip, sidebar] = tab_and_body(sidebar);
|
||||
let (focused, passive, passive_thread) = if active == child {
|
||||
(sidebar, parent, side.parent_thread_id)
|
||||
(sidebar, parent, owner)
|
||||
} else {
|
||||
(parent, sidebar, child)
|
||||
};
|
||||
@@ -452,19 +460,28 @@ impl SidePaneLayout {
|
||||
frame: &mut Frame<'_>,
|
||||
collapse_turn_details: bool,
|
||||
frames: &FrameRequester,
|
||||
watch_only: bool,
|
||||
) {
|
||||
companion.flush_answer();
|
||||
let area = self.passive;
|
||||
// Keep the live composer's bottom hint row blank on the inactive side.
|
||||
let hint_rows = 1;
|
||||
let composer_height = area.height.saturating_sub(hint_rows).min(3);
|
||||
let composer_height = if watch_only {
|
||||
0
|
||||
} else {
|
||||
area.height.saturating_sub(hint_rows).min(3)
|
||||
};
|
||||
let available = area.height - composer_height;
|
||||
let footer = FooterLayout::new(
|
||||
Some(composer_height_limit(area.height)),
|
||||
hint_rows,
|
||||
/*priority_hint_rows*/ hint_rows,
|
||||
);
|
||||
let status = companion.display.status_line.as_ref();
|
||||
let status = companion
|
||||
.display
|
||||
.status_line
|
||||
.as_ref()
|
||||
.filter(|_| !watch_only);
|
||||
let wanted_status = status.map_or(0, |status| {
|
||||
status.height(footer.status_bounds(area.width, available))
|
||||
});
|
||||
|
||||
@@ -30,6 +30,7 @@ pub(super) enum SidebarContent {
|
||||
Chooser,
|
||||
Chat(ThreadId),
|
||||
Document(uuid::Uuid),
|
||||
Subagents,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
@@ -177,6 +178,13 @@ impl SidebarPane {
|
||||
self.add_document_tab(id);
|
||||
self.visit(tab);
|
||||
}
|
||||
SidebarContent::Subagents => {
|
||||
if !self.tabs.contains(&SidebarTab::Subagents) {
|
||||
self.tabs.push(SidebarTab::Subagents);
|
||||
self.tabs_revision += 1;
|
||||
}
|
||||
self.visit(SidebarTab::Subagents);
|
||||
}
|
||||
SidebarContent::Chooser => {}
|
||||
}
|
||||
if content != SidebarContent::Chooser || focus == PaneFocus::Main {
|
||||
@@ -208,6 +216,13 @@ impl SidebarPane {
|
||||
ids: &self.tabs,
|
||||
choices: &self.choices,
|
||||
agents: &self.agents.rows,
|
||||
agent_title: self.agents.detail.and_then(|id| {
|
||||
self.agents
|
||||
.rows
|
||||
.iter()
|
||||
.find(|agent| agent.id == id)
|
||||
.map(|agent| agent.name.as_str())
|
||||
}),
|
||||
latest_prompts: &self.latest_prompts,
|
||||
selected: self.visits.last().copied(),
|
||||
files: self
|
||||
@@ -340,7 +355,7 @@ impl SidebarPane {
|
||||
pub(super) fn selected_chat(&self) -> Option<ThreadId> {
|
||||
self.visits.iter().rev().find_map(|tab| match *tab {
|
||||
SidebarTab::Chat(id) => Some(id),
|
||||
SidebarTab::Document(_) => None,
|
||||
SidebarTab::Document(_) | SidebarTab::Subagents => None,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -416,6 +431,14 @@ impl SidebarPane {
|
||||
self.tabs_revision += 1;
|
||||
}
|
||||
|
||||
pub(super) fn close_agents(&mut self) -> bool {
|
||||
self.agents.detail = None;
|
||||
self.tabs.retain(|tab| *tab != SidebarTab::Subagents);
|
||||
self.visits.retain(|tab| *tab != SidebarTab::Subagents);
|
||||
self.tabs_revision += 1;
|
||||
self.visible_content() == Some(SidebarContent::Subagents)
|
||||
}
|
||||
|
||||
pub(super) fn input_state(&self) -> SidebarInputState {
|
||||
let tabs = self.chat_tabs();
|
||||
let choice = if let Some(id) = tabs.choice(self.choice) {
|
||||
@@ -496,6 +519,7 @@ impl SidebarPane {
|
||||
if self.content == SidebarContent::Chat(id) {
|
||||
self.content = match self.recent_tab(/*excluding*/ None) {
|
||||
Some(SidebarTab::Chat(child)) => SidebarContent::Chat(child),
|
||||
Some(SidebarTab::Subagents) => SidebarContent::Subagents,
|
||||
Some(SidebarTab::Document(doc)) => SidebarContent::Document(doc),
|
||||
None => {
|
||||
self.hide();
|
||||
@@ -649,6 +673,11 @@ impl App {
|
||||
|
||||
pub(super) fn sidebar_parent(&self) -> Option<ThreadId> {
|
||||
self.active_side_parent_thread_id()
|
||||
.or_else(|| {
|
||||
self.docked_agent()
|
||||
.filter(|(_, agent)| Some(*agent) == self.current_displayed_thread_id())
|
||||
.map(|(parent, _)| parent)
|
||||
})
|
||||
.or_else(|| self.current_displayed_thread_id())
|
||||
}
|
||||
|
||||
@@ -668,12 +697,17 @@ impl App {
|
||||
|
||||
pub(super) fn panel_focus(&self) -> Option<PaneFocus> {
|
||||
let pane = self.sidebar()?;
|
||||
pane.focus
|
||||
.filter(|_| !matches!(pane.content, SidebarContent::Chat(_)))
|
||||
pane.focus.filter(|_| {
|
||||
!(matches!(pane.content, SidebarContent::Chat(_))
|
||||
|| pane.content == SidebarContent::Subagents && pane.agents.detail.is_some())
|
||||
})
|
||||
}
|
||||
|
||||
pub(super) fn sidebar_has_focus(&self) -> bool {
|
||||
self.active_side_parent_thread_id().is_some()
|
||||
|| self
|
||||
.docked_agent()
|
||||
.is_some_and(|(_, agent)| self.current_displayed_thread_id() == Some(agent))
|
||||
|| self.panel_focus() == Some(PaneFocus::Sidebar)
|
||||
}
|
||||
}
|
||||
@@ -745,7 +779,12 @@ pub(super) fn content_layout(
|
||||
[main, sidebar]: [Rect; 2],
|
||||
) -> Option<SidebarLayout> {
|
||||
match content {
|
||||
SidebarContent::Chooser | SidebarContent::Document(_) => (app.sidebar_chooser_available()
|
||||
SidebarContent::Subagents if app.docked_agent().is_some() => {
|
||||
let (_, agent) = app.docked_agent()?;
|
||||
side_pane::pair_layout(app, agent, [main, sidebar]).map(SidebarLayout::Chat)
|
||||
}
|
||||
SidebarContent::Chooser | SidebarContent::Document(_) | SidebarContent::Subagents => (app
|
||||
.sidebar_chooser_available()
|
||||
&& (focus == PaneFocus::Main || app.chat_widget.completion_can_yield_focus()))
|
||||
.then_some(SidebarLayout::Panel {
|
||||
main,
|
||||
|
||||
@@ -292,3 +292,246 @@ async fn active_discovery_supersedes_restored_completion() -> color_eyre::Result
|
||||
server.shutdown().await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn opens_agent_transcript_beside_parent_and_returns_to_chooser() -> color_eyre::Result<()> {
|
||||
use crate::app::side_focus::SidebarTarget;
|
||||
use crate::app::sidebar::PaneFocus;
|
||||
use crate::app::sidebar::SidebarContent;
|
||||
use crate::app::test_support::enable_side_retention;
|
||||
use crate::app::test_support::side_frame;
|
||||
use crate::app::tests::make_test_app_with_channels;
|
||||
use crate::sidebar_tab_strip::SidebarTab;
|
||||
use crate::sidebar_tab_strip::TabTarget;
|
||||
use crate::tui::TuiEvent;
|
||||
use codex_protocol::protocol::SessionSource;
|
||||
use codex_protocol::protocol::SubAgentSource;
|
||||
use crossterm::event::KeyCode;
|
||||
use crossterm::event::MouseButton;
|
||||
use crossterm::event::MouseEventKind;
|
||||
use ratatui::layout::Size;
|
||||
|
||||
let (mut app, mut rx, _ops) = Box::pin(make_test_app_with_channels()).await;
|
||||
enable_side_retention(&mut app)?;
|
||||
app.local_settings.tui.animations = false;
|
||||
let config = app.chat_widget.config_ref().clone();
|
||||
let root = ThreadId::from_string(
|
||||
&app_test_support::create_fake_paginated_rollout(
|
||||
config.codex_home.as_path(),
|
||||
"2025-01-05T12-00-00",
|
||||
"2025-01-05T12:00:00Z",
|
||||
"Parent conversation",
|
||||
Some(config.model_provider_id.as_str()),
|
||||
/*git_info*/ None,
|
||||
)
|
||||
.expect("seed test rollout"),
|
||||
)?;
|
||||
let child = ThreadId::from_string(
|
||||
&app_test_support::create_fake_parented_rollout_with_source(
|
||||
config.codex_home.as_path(),
|
||||
"2025-01-05T12-00-01",
|
||||
"2025-01-05T12:00:01Z",
|
||||
"Review result",
|
||||
Some(config.model_provider_id.as_str()),
|
||||
/*git_info*/ None,
|
||||
SessionSource::SubAgent(SubAgentSource::ThreadSpawn {
|
||||
parent_thread_id: root,
|
||||
depth: 1,
|
||||
agent_path: Some("/root/reviewer".parse().expect("agent path")),
|
||||
agent_nickname: Some("Reviewer".into()),
|
||||
agent_role: None,
|
||||
}),
|
||||
root.into(),
|
||||
root,
|
||||
)
|
||||
.expect("seed test rollout"),
|
||||
)?;
|
||||
let path = app_test_support::rollout_path(
|
||||
config.codex_home.as_path(),
|
||||
"2025-01-05T12-00-01",
|
||||
&child.to_string(),
|
||||
);
|
||||
let rollout = std::fs::read_to_string(&path)?;
|
||||
let (metadata, messages) = rollout.split_once('\n').expect("seeded child history");
|
||||
let mut metadata: serde_json::Value = serde_json::from_str(metadata)?;
|
||||
metadata["payload"]["multi_agent_version"] =
|
||||
serde_json::to_value(codex_protocol::protocol::MultiAgentVersion::V2)?;
|
||||
std::fs::write(path, format!("{metadata}\n{messages}"))?;
|
||||
|
||||
let mut server = Box::pin(crate::start_embedded_app_server_for_picker(&config)).await?;
|
||||
let started = Box::pin(server.resume_thread(
|
||||
&app.local_settings,
|
||||
config.clone(),
|
||||
root,
|
||||
crate::app_server_session::ResumeModelSettings::RestoreFromThread,
|
||||
))
|
||||
.await?;
|
||||
app.enqueue_primary_thread_session(started.session, started.turns)
|
||||
.await?;
|
||||
let mut tui = crate::tui::test_support::make_test_tui()?;
|
||||
tui.set_owned_screen(/*owned*/ true)?;
|
||||
// Wait for the real app-server to discover the saved child before opening its row.
|
||||
let discovery = tokio::time::timeout(std::time::Duration::from_secs(5), async {
|
||||
loop {
|
||||
let event = rx.recv().await.expect("app event channel");
|
||||
if matches!(
|
||||
event,
|
||||
crate::app_event::AppEvent::AgentPickerThreadsLoaded { .. }
|
||||
) {
|
||||
break Ok::<_, color_eyre::Report>(event);
|
||||
}
|
||||
Box::pin(app.handle_event(&mut tui, &mut server, event)).await?;
|
||||
}
|
||||
})
|
||||
.await??;
|
||||
Box::pin(app.handle_event(&mut tui, &mut server, discovery)).await?;
|
||||
while let Ok(event) = rx.try_recv() {
|
||||
Box::pin(app.handle_event(&mut tui, &mut server, event)).await?;
|
||||
}
|
||||
app.sidebar_mut()
|
||||
.show(SidebarContent::Chooser, PaneFocus::Sidebar);
|
||||
let screen = side_frame(&mut app, &mut tui, Size::new(140, 20))?;
|
||||
assert!(screen.contains("Subagents 1"), "{screen}");
|
||||
let pane = app.sidebar_mut();
|
||||
pane.choice = pane
|
||||
.chat_tabs()
|
||||
.agent_index(child)
|
||||
.expect("child agent row");
|
||||
Box::pin(app.handle_tui_event(&mut tui, &mut server, TuiEvent::Key(KeyCode::Enter.into())))
|
||||
.await?;
|
||||
while let Ok(event) = rx.try_recv() {
|
||||
Box::pin(app.handle_event(&mut tui, &mut server, event)).await?;
|
||||
}
|
||||
assert_eq!(app.current_displayed_thread_id(), Some(child));
|
||||
assert_eq!(app.docked_agent(), Some((root, child)));
|
||||
let screen = side_frame(&mut app, &mut tui, Size::new(180, 20))?;
|
||||
assert!(app.sidebar_has_focus());
|
||||
insta::assert_snapshot!(
|
||||
"watch_only_subagent",
|
||||
crate::chatwidget::tests::helpers::normalize_agent_center_snapshot(
|
||||
screen.replace(&child.to_string(), "[agent id]")
|
||||
)
|
||||
);
|
||||
assert!(!screen.contains("direct input is disabled"), "{screen}");
|
||||
|
||||
app.keymap.pager.jump_top = vec![crate::key_hint::plain(KeyCode::F(6))];
|
||||
Box::pin(app.handle_tui_event(&mut tui, &mut server, TuiEvent::Key(KeyCode::F(6).into())))
|
||||
.await?;
|
||||
assert!(!app.transcript_view.is_following());
|
||||
Box::pin(app.handle_tui_event(&mut tui, &mut server, TuiEvent::Key(KeyCode::End.into())))
|
||||
.await?;
|
||||
assert!(app.transcript_view.is_following());
|
||||
|
||||
tui.screen_size_for_event(&TuiEvent::Resize(Size::new(180, 20)))?;
|
||||
app.begin_pane_resize(&mut tui)?;
|
||||
assert!(app.pane_resize.is_some());
|
||||
let resize = side_frame(&mut app, &mut tui, Size::new(180, 20))?;
|
||||
let footer = resize
|
||||
.lines()
|
||||
.find_map(|line| {
|
||||
line.split_once('│')
|
||||
.map(|(_, sidebar)| sidebar.trim())
|
||||
.filter(|row| row.starts_with("Resize"))
|
||||
})
|
||||
.expect("agent resize footer");
|
||||
insta::assert_snapshot!(footer, @"Resize · ←/h →/l · Shift+←/→ 10 cols · Enter/Esc done");
|
||||
Box::pin(app.handle_tui_event(&mut tui, &mut server, TuiEvent::Key(KeyCode::Enter.into())))
|
||||
.await?;
|
||||
|
||||
Box::pin(app.handle_tui_event(&mut tui, &mut server, TuiEvent::Key(KeyCode::F(3).into())))
|
||||
.await?;
|
||||
let screen = side_frame(&mut app, &mut tui, Size::new(140, 20))?;
|
||||
assert!(screen.contains("Find:"), "{screen}");
|
||||
Box::pin(app.handle_tui_event(&mut tui, &mut server, TuiEvent::Key(KeyCode::Esc.into())))
|
||||
.await?;
|
||||
assert_eq!(app.current_displayed_thread_id(), Some(child));
|
||||
Box::pin(app.handle_tui_event(&mut tui, &mut server, TuiEvent::Key(KeyCode::Esc.into())))
|
||||
.await?;
|
||||
while let Ok(event) = rx.try_recv() {
|
||||
Box::pin(app.handle_event(&mut tui, &mut server, event)).await?;
|
||||
}
|
||||
assert_eq!(app.current_displayed_thread_id(), Some(root));
|
||||
assert_eq!(app.docked_agent(), None);
|
||||
let screen = side_frame(&mut app, &mut tui, Size::new(140, 20))?;
|
||||
assert!(screen.contains("Subagents 1"), "{screen}");
|
||||
let pane = app.sidebar().unwrap();
|
||||
assert!(
|
||||
!pane
|
||||
.chat_tabs()
|
||||
.ids
|
||||
.contains(&crate::sidebar_tab_strip::SidebarTab::Subagents)
|
||||
);
|
||||
assert_eq!(
|
||||
pane.chat_tabs().agent(pane.choice).map(|agent| agent.id),
|
||||
Some(child)
|
||||
);
|
||||
|
||||
Box::pin(app.handle_tui_event(&mut tui, &mut server, TuiEvent::Key(KeyCode::Enter.into())))
|
||||
.await?;
|
||||
assert_eq!(app.docked_agent(), Some((root, child)));
|
||||
while let Ok(event) = rx.try_recv() {
|
||||
Box::pin(app.handle_event(&mut tui, &mut server, event)).await?;
|
||||
}
|
||||
side_frame(&mut app, &mut tui, Size::new(140, 20))?;
|
||||
let close = app
|
||||
.conversation_frame
|
||||
.sidebar_targets
|
||||
.iter()
|
||||
.find_map(|(target, area)| {
|
||||
(*target == SidebarTarget::Tab(TabTarget::Close(SidebarTab::Subagents)))
|
||||
.then_some(*area)
|
||||
})
|
||||
.expect("docked agent close button");
|
||||
for kind in [
|
||||
MouseEventKind::Down(MouseButton::Left),
|
||||
MouseEventKind::Up(MouseButton::Left),
|
||||
] {
|
||||
let click = crate::app::owned_transcript::tests::mouse(kind, close.x, close.y);
|
||||
Box::pin(app.handle_tui_event(&mut tui, &mut server, click)).await?;
|
||||
}
|
||||
assert_eq!(app.current_displayed_thread_id(), Some(root));
|
||||
assert_eq!(app.docked_agent(), None);
|
||||
while let Ok(event) = rx.try_recv() {
|
||||
Box::pin(app.handle_event(&mut tui, &mut server, event)).await?;
|
||||
}
|
||||
assert!(!app.side_companions.contains_key(&child));
|
||||
|
||||
// Closing a saved side chat can return to the last-used agent tab.
|
||||
app.open_sidebar_agent(&mut tui, &mut server, child).await?;
|
||||
while let Ok(event) = rx.try_recv() {
|
||||
Box::pin(app.handle_event(&mut tui, &mut server, event)).await?;
|
||||
}
|
||||
let started = server.start_thread(&config).await?;
|
||||
let side = started.session.thread_id;
|
||||
let channel = crate::app::ThreadEventChannel::new(/*capacity*/ 1);
|
||||
channel
|
||||
.store
|
||||
.lock()
|
||||
.await
|
||||
.set_session(started.session, started.turns);
|
||||
app.thread_event_channels.insert(side, channel);
|
||||
let mut state = crate::app::side::SideThreadState::new(root);
|
||||
state.storage = crate::app_server_session::SideChatStorage::Attached;
|
||||
app.side_threads.insert(side, state);
|
||||
app.activate_sidebar_tab(&mut tui, &mut server, SidebarTab::Chat(side))
|
||||
.await?;
|
||||
while let Ok(event) = rx.try_recv() {
|
||||
Box::pin(app.handle_event(&mut tui, &mut server, event)).await?;
|
||||
}
|
||||
assert_eq!(app.current_displayed_thread_id(), Some(side));
|
||||
app.close_sidebar_tab(&mut tui, &mut server, SidebarTab::Chat(side))
|
||||
.await?;
|
||||
assert_eq!(app.current_displayed_thread_id(), Some(child));
|
||||
assert!(app.side_threads[&side].close_request.is_some());
|
||||
while let Ok(event) = rx.try_recv() {
|
||||
Box::pin(app.handle_event(&mut tui, &mut server, event)).await?;
|
||||
}
|
||||
|
||||
app.keymap.app.close_sidebar_tab = vec![crate::key_hint::plain(KeyCode::F(8))];
|
||||
Box::pin(app.handle_tui_event(&mut tui, &mut server, TuiEvent::Key(KeyCode::F(8).into())))
|
||||
.await?;
|
||||
assert_eq!(app.current_displayed_thread_id(), Some(root));
|
||||
assert!(app.sidebar().unwrap().agents.detail.is_none());
|
||||
server.shutdown().await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -120,9 +120,10 @@ pub(super) async fn request(
|
||||
let Some(index) = tabs.choice_index(target) else {
|
||||
return Ok(());
|
||||
};
|
||||
let title = crate::sidebar_chooser::side_chat_label(&tabs.choices[index - 1])
|
||||
let ordinal = index - 1;
|
||||
let title = crate::sidebar_chooser::side_chat_label(&tabs.choices[ordinal])
|
||||
.map(str::to_owned)
|
||||
.unwrap_or_else(|| format!("Side chat {index}"));
|
||||
.unwrap_or_else(|| format!("Side chat {}", ordinal + 1));
|
||||
app.conversation_frame.close_buttons = Default::default();
|
||||
let verb = match action {
|
||||
Action::CloseTab => "Close",
|
||||
@@ -232,11 +233,15 @@ async fn execute(
|
||||
.unwrap_or(SidebarTab::Chat(parent)),
|
||||
Action::Archive => SidebarTab::Chat(parent),
|
||||
};
|
||||
app.activate_sidebar_tab(tui, server, next).await?;
|
||||
let destination_thread = match next {
|
||||
SidebarTab::Chat(id) => id,
|
||||
SidebarTab::Document(_) => parent,
|
||||
SidebarTab::Chat(id) => Some(id),
|
||||
SidebarTab::Document(_) => Some(parent),
|
||||
SidebarTab::Subagents => app.sidebar().and_then(|pane| pane.agents.detail),
|
||||
};
|
||||
let Some(destination_thread) = destination_thread else {
|
||||
return Ok(());
|
||||
};
|
||||
app.activate_sidebar_tab(tui, server, next).await?;
|
||||
if app.current_displayed_thread_id() != Some(destination_thread) {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
//! Sidebar subagents follow the primary conversation's spawn tree and retain observed outcomes.
|
||||
use super::sidebar::PaneFocus;
|
||||
use super::sidebar::SidebarContent;
|
||||
use super::*;
|
||||
use crate::keymap::ListAction;
|
||||
use crate::sidebar_chooser::AgentRow;
|
||||
use codex_app_server_protocol::CollabAgentStatus;
|
||||
use codex_app_server_protocol::CollabAgentTool;
|
||||
@@ -21,6 +24,7 @@ pub(super) struct Overview {
|
||||
states: HashMap<ThreadId, State>,
|
||||
restored_outcomes: HashSet<ThreadId>,
|
||||
pub(super) rows: Vec<AgentRow>,
|
||||
pub(super) detail: Option<ThreadId>,
|
||||
}
|
||||
|
||||
impl Overview {
|
||||
@@ -71,6 +75,95 @@ impl Overview {
|
||||
}
|
||||
|
||||
impl App {
|
||||
pub(super) async fn handle_docked_agent_input(
|
||||
&mut self,
|
||||
tui: &mut tui::Tui,
|
||||
server: &mut AppServerSession,
|
||||
event: &TuiEvent,
|
||||
) -> bool {
|
||||
let Some((root, agent)) = self.docked_agent() else {
|
||||
return false;
|
||||
};
|
||||
let TuiEvent::Key(key) = event else {
|
||||
return false;
|
||||
};
|
||||
if self.current_displayed_thread_id() != Some(agent)
|
||||
|| !self.chat_widget.no_modal_or_popup_active()
|
||||
|| self.transcript_view.has_active_interaction()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if self.agent_navigation.is_parent_owned(agent)
|
||||
&& self
|
||||
.transcript_view
|
||||
.navigate_pager(*key, &self.transcript_cells, &self.keymap.pager)
|
||||
{
|
||||
tui.frame_requester().schedule_frame();
|
||||
return true;
|
||||
}
|
||||
if key.kind != KeyEventKind::Press
|
||||
|| self.keymap.list.action_for(*key) != Some(ListAction::Cancel)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if let Err(error) = Box::pin(self.select_agent_thread(tui, server, root)).await {
|
||||
self.chat_widget.add_error_message(error.to_string());
|
||||
}
|
||||
if self.current_displayed_thread_id() == Some(root) {
|
||||
self.side_companions.remove(&agent);
|
||||
let pane = self.sidebar_mut();
|
||||
if let Some(index) = pane.chat_tabs().agent_index(agent) {
|
||||
pane.choice = index;
|
||||
pane.chooser_scroll = Default::default();
|
||||
}
|
||||
pane.close_agents();
|
||||
pane.show(SidebarContent::Chooser, PaneFocus::Sidebar);
|
||||
}
|
||||
tui.frame_requester().schedule_frame();
|
||||
true
|
||||
}
|
||||
|
||||
pub(super) fn docked_agent(&self) -> Option<(ThreadId, ThreadId)> {
|
||||
let parent = self.primary_thread_id?;
|
||||
let pane = self.sidebars.get(&Some(parent))?;
|
||||
(pane.visible_content() == Some(SidebarContent::Subagents))
|
||||
.then_some((parent, pane.agents.detail?))
|
||||
}
|
||||
|
||||
pub(super) async fn open_sidebar_agent(
|
||||
&mut self,
|
||||
tui: &mut tui::Tui,
|
||||
server: &mut AppServerSession,
|
||||
agent: ThreadId,
|
||||
) -> Result<()> {
|
||||
let Some(parent) = self.primary_thread_id else {
|
||||
return Ok(());
|
||||
};
|
||||
if !self.is_sidebar_agent(agent) || self.sidebar_parent() != Some(parent) {
|
||||
return Ok(());
|
||||
}
|
||||
let pane = self.sidebars.entry(Some(parent)).or_default();
|
||||
let previous_content = pane.visible_content();
|
||||
let previous_agent = pane.agents.detail.replace(agent);
|
||||
pane.show(SidebarContent::Subagents, PaneFocus::Sidebar);
|
||||
let result = Box::pin(self.select_agent_thread(tui, server, agent)).await;
|
||||
if self.current_displayed_thread_id() != Some(agent) {
|
||||
let pane = self.sidebars.entry(Some(parent)).or_default();
|
||||
if previous_agent.is_none() {
|
||||
pane.close_agents();
|
||||
}
|
||||
pane.agents.detail = previous_agent;
|
||||
pane.show(
|
||||
previous_content.unwrap_or(SidebarContent::Chooser),
|
||||
PaneFocus::Sidebar,
|
||||
);
|
||||
} else if let Some(previous) = previous_agent.filter(|previous| *previous != agent) {
|
||||
self.side_companions.remove(&previous);
|
||||
}
|
||||
tui.frame_requester().schedule_frame();
|
||||
result
|
||||
}
|
||||
|
||||
pub(super) fn is_sidebar_agent(&self, id: ThreadId) -> bool {
|
||||
self.primary_thread_id
|
||||
.and_then(|root| self.sidebars.get(&Some(root)))
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
---
|
||||
source: tui/src/app/sidebar_agent_status_tests.rs
|
||||
expression: "screen.replace(&child.to_string(), \"[agent id]\")"
|
||||
---
|
||||
│ reviewer × +
|
||||
>_ OpenAI Codex (v0.0.0) │esc back to agents · Watch only
|
||||
/tmp/project │
|
||||
│ >_ OpenAI Codex (v0.0.0)
|
||||
To get started, describe a task or try one of these commands: │ /
|
||||
│
|
||||
/init - create an AGENTS.md file with instructions for Codex │
|
||||
/status - show current session configuration │› Review result
|
||||
/permissions - choose what Codex is allowed to do │
|
||||
/model - choose what model and reasoning effort to use │
|
||||
/review - review any changes and find issues │• Agent thread [agent id] could
|
||||
│not be resumed live. Replaying saved transcript.
|
||||
│
|
||||
│
|
||||
│
|
||||
│
|
||||
› │
|
||||
│
|
||||
GPT-6.2-Sol default · /tmp/project │
|
||||
│↑/↓ read · f3 find · ⌃x [ select
|
||||
@@ -109,6 +109,9 @@ pub(crate) fn normalize_agent_center_snapshot(text: impl AsRef<str>) -> String {
|
||||
.replace(&windows_path, unix_path)
|
||||
.replace(&windows_path.replace('\\', "/"), unix_path);
|
||||
}
|
||||
if normalized.trim() == r"C:\" || normalized.trim() == "C:/" {
|
||||
normalized = normalized.replace(normalized.trim(), "/");
|
||||
}
|
||||
// Only ASCII path bytes change, so this is also the removed cell width.
|
||||
let padding = pane.len().saturating_sub(normalized.len());
|
||||
normalized.push_str(&" ".repeat(padding));
|
||||
|
||||
@@ -217,6 +217,7 @@ pub(crate) struct ChatTabs<'a> {
|
||||
// Chooser index zero is reserved for New side chat.
|
||||
pub(crate) choices: &'a [SideChat],
|
||||
pub(crate) agents: &'a [AgentRow],
|
||||
pub(crate) agent_title: Option<&'a str>,
|
||||
pub(crate) latest_prompts: &'a HashMap<ThreadId, String>,
|
||||
pub(crate) selected: Option<SidebarTab>,
|
||||
pub(crate) files: &'a [FileLink],
|
||||
@@ -311,6 +312,10 @@ pub(crate) fn tab_strip(
|
||||
let width = usize::from(area.width.saturating_sub(1));
|
||||
let mut title = match id {
|
||||
SidebarTab::Document(id) => Line::from(document_title(id, width)),
|
||||
SidebarTab::Subagents => Line::from(middle_label(
|
||||
tabs.agent_title.unwrap_or("Agent transcript"),
|
||||
width.saturating_sub(1),
|
||||
)),
|
||||
SidebarTab::Chat(id) => {
|
||||
let name = match tabs.choice_index(id) {
|
||||
Some(index) => {
|
||||
|
||||
@@ -14,6 +14,7 @@ use ratatui::widgets::Widget;
|
||||
pub(crate) enum SidebarTab {
|
||||
Chat(codex_protocol::ThreadId),
|
||||
Document(uuid::Uuid),
|
||||
Subagents,
|
||||
}
|
||||
|
||||
/// Adjacent tabs have one unpainted, noninteractive terminal column between them.
|
||||
|
||||
Reference in New Issue
Block a user