mirror of
https://github.com/openai/codex.git
synced 2026-12-03 00:41:03 +00:00
Improve agent command center rows and page navigation (#46837)
## What changed - Align task titles, status, and relative update times in columns, hiding metadata at narrow widths. Highlight the full selected row and show explicit empty states. - Share grouped row layout between rendering and paging so `PageUp` and `PageDown` move by the visible viewport, account for group headings, and stop at either end. Support paging while searching. - Show filtered group counts, shorten long project paths, and indicate additional rows above or below the viewport. - Display system errors as `Error` and unloaded tasks as `Inactive` instead of `Finished`. ## Testing Add a column-layout snapshot and paging regression coverage for short lists, multiple project groups, filtered tasks during reconnection, and boundary clamping. Update existing command center snapshots for the new layout and labels. GitOrigin-RevId: b2bfaf26a48f7a02a48be6e1499357a79c09cede
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
//! Shared grouped rows and viewport state for task rendering and paging.
|
||||
|
||||
mod navigation;
|
||||
mod render;
|
||||
mod rows;
|
||||
|
||||
use super::*;
|
||||
@@ -0,0 +1,83 @@
|
||||
//! Page navigation shares the rendered row layout, including group headings.
|
||||
//! Command-center paging moves the viewport and selection together without wrapping at either end.
|
||||
|
||||
use super::*;
|
||||
|
||||
pub(super) enum CenterRow {
|
||||
Group(usize),
|
||||
Task(usize),
|
||||
Gap,
|
||||
}
|
||||
|
||||
impl AgentsOverviewView {
|
||||
pub(super) fn center_rows(
|
||||
&self,
|
||||
indices: &[usize],
|
||||
grouping: AgentsOverviewGrouping,
|
||||
) -> Vec<CenterRow> {
|
||||
let mut entries = Vec::new();
|
||||
let mut previous = None;
|
||||
for index in indices.iter().copied() {
|
||||
if previous.is_none_or(|previous| !self.same_group(grouping, previous, index)) {
|
||||
if previous.is_some() {
|
||||
entries.push(CenterRow::Gap);
|
||||
}
|
||||
entries.push(CenterRow::Group(index));
|
||||
}
|
||||
entries.push(CenterRow::Task(index));
|
||||
previous = Some(index);
|
||||
}
|
||||
entries
|
||||
}
|
||||
|
||||
pub(in crate::app::agents_overview_view) fn page_selection(&mut self, action: ListAction) {
|
||||
let indices = self.visible_indices();
|
||||
let mut state = self.state();
|
||||
if state.renaming || indices.is_empty() {
|
||||
return;
|
||||
}
|
||||
let forward = action == ListAction::PageDown;
|
||||
let entries = self.center_rows(&indices, state.grouping);
|
||||
let tasks = entries
|
||||
.iter()
|
||||
.enumerate()
|
||||
.filter_map(|(position, row)| {
|
||||
if let CenterRow::Task(index) = row {
|
||||
Some((position, *index))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
let current = tasks
|
||||
.iter()
|
||||
.find(|(_, index)| *index == self.selected)
|
||||
.map(|(position, _)| *position)
|
||||
.unwrap_or(tasks[0].0);
|
||||
let height = state.page_height.max(/*other*/ 1);
|
||||
let target = if forward {
|
||||
current.saturating_add(height)
|
||||
} else {
|
||||
current.saturating_sub(height)
|
||||
};
|
||||
let selected = if forward {
|
||||
tasks
|
||||
.partition_point(|(position, _)| *position < target)
|
||||
.min(tasks.len() - 1)
|
||||
} else {
|
||||
tasks
|
||||
.partition_point(|(position, _)| *position <= target)
|
||||
.saturating_sub(1)
|
||||
};
|
||||
let selected = tasks[selected].1;
|
||||
let scroll = state.scroll;
|
||||
state.scroll = (if forward {
|
||||
scroll.saturating_add(height)
|
||||
} else {
|
||||
scroll.saturating_sub(height)
|
||||
})
|
||||
.min(entries.len().saturating_sub(height));
|
||||
drop(state);
|
||||
self.selected = selected;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
//! Clipped rectangles and text shared by task rows and the dashboard layout.
|
||||
|
||||
use super::*;
|
||||
use crate::line_truncation::truncate_line_with_ellipsis_if_overflow;
|
||||
|
||||
pub(super) fn row(area: Rect, offset: u16, height: u16) -> Rect {
|
||||
let offset = offset.min(area.height);
|
||||
Rect::new(
|
||||
area.x,
|
||||
area.y + offset,
|
||||
area.width,
|
||||
height.min(area.height - offset),
|
||||
)
|
||||
}
|
||||
|
||||
pub(super) fn line(text: impl Into<Line<'static>>, area: Rect, buf: &mut Buffer) {
|
||||
if !area.is_empty() {
|
||||
truncate_line_with_ellipsis_if_overflow(text.into(), usize::from(area.width))
|
||||
.render(row(area, /*offset*/ 0, /*height*/ 1), buf);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,234 @@
|
||||
//! Grouped live tasks with shared identity colors and stable title, status and age columns.
|
||||
//! Current-task labels and full titles share the flexible column; metadata drops at narrow widths.
|
||||
//! The final cell stays blank inside the full-width selection highlight.
|
||||
|
||||
use super::navigation::CenterRow;
|
||||
use super::render::line;
|
||||
use super::render::row;
|
||||
use super::*;
|
||||
use crate::bottom_pane::selection_style;
|
||||
use crate::resume_picker::format_relative_time;
|
||||
use crate::status::format_directory_display;
|
||||
|
||||
fn columns(area: Rect) -> (Rect, Rect, Rect) {
|
||||
let metadata = if area.width >= 56 { 24 } else { 0 };
|
||||
let gutter = area.width.min(/*other*/ 4);
|
||||
let title = Rect::new(
|
||||
area.x + gutter,
|
||||
area.y,
|
||||
area.width - gutter - metadata,
|
||||
area.height,
|
||||
);
|
||||
let updated = Rect::new(
|
||||
area.right() - metadata.min(/*other*/ 9),
|
||||
area.y,
|
||||
metadata.min(/*other*/ 9),
|
||||
area.height,
|
||||
);
|
||||
let status = Rect::new(
|
||||
title.right() + metadata.min(/*other*/ 2),
|
||||
area.y,
|
||||
if metadata == 24 { 11 } else { 0 },
|
||||
area.height,
|
||||
);
|
||||
(title, status, updated)
|
||||
}
|
||||
|
||||
impl AgentsOverviewView {
|
||||
pub(in crate::app::agents_overview_view) fn render_center_rows(
|
||||
&self,
|
||||
area: Rect,
|
||||
buf: &mut Buffer,
|
||||
) {
|
||||
let row_width = area.width;
|
||||
let area = Rect {
|
||||
width: row_width.saturating_sub(/*rhs*/ 1),
|
||||
..area
|
||||
};
|
||||
if area.is_empty() {
|
||||
return;
|
||||
}
|
||||
let indices = self.visible_indices();
|
||||
let mut state = self.state();
|
||||
if indices.is_empty() {
|
||||
line(
|
||||
if state.connection_notice.is_some() {
|
||||
"Reconnecting…"
|
||||
} else if state.refresh_failed {
|
||||
"Could not load tasks"
|
||||
} else if self.rows.is_empty() {
|
||||
"No tasks yet"
|
||||
} else {
|
||||
"No matching tasks"
|
||||
}
|
||||
.dim(),
|
||||
area,
|
||||
buf,
|
||||
);
|
||||
return;
|
||||
}
|
||||
let entries = self.center_rows(&indices, state.grouping);
|
||||
let selected = entries
|
||||
.iter()
|
||||
.position(|row| matches!(row, CenterRow::Task(index) if *index == self.selected))
|
||||
.unwrap_or_default();
|
||||
let padding = u16::from(area.height >= 3);
|
||||
let viewport = row(area, padding, area.height - padding * 2);
|
||||
if padding > 0 {
|
||||
let (title, status, updated) = columns(row(area, /*offset*/ 0, /*height*/ 1));
|
||||
line(
|
||||
if !state.editing_metadata() {
|
||||
"Tasks".cyan().bold()
|
||||
} else {
|
||||
"Tasks".dim()
|
||||
},
|
||||
title,
|
||||
buf,
|
||||
);
|
||||
line("Status".dim(), status, buf);
|
||||
Line::from("Updated".dim())
|
||||
.right_aligned()
|
||||
.render(updated, buf);
|
||||
}
|
||||
let reference = chrono::Utc::now();
|
||||
let height = usize::from(viewport.height);
|
||||
state.page_height = height;
|
||||
let mut start = state.scroll.min(entries.len().saturating_sub(height));
|
||||
if selected < start {
|
||||
start = if height > 1
|
||||
&& selected > 0
|
||||
&& matches!(entries[selected - 1], CenterRow::Group(_))
|
||||
{
|
||||
selected - 1
|
||||
} else {
|
||||
selected
|
||||
};
|
||||
}
|
||||
if selected >= start + height {
|
||||
start = selected.saturating_add(/*rhs*/ 1).saturating_sub(height);
|
||||
}
|
||||
state.scroll = start;
|
||||
for (offset, entry) in entries.iter().skip(start).take(height).enumerate() {
|
||||
let index = match entry {
|
||||
CenterRow::Group(index) | CenterRow::Task(index) => *index,
|
||||
CenterRow::Gap => continue,
|
||||
};
|
||||
let task = &self.rows[index];
|
||||
let rect = row(viewport, offset as u16, /*height*/ 1);
|
||||
if matches!(entry, CenterRow::Group(_)) {
|
||||
let group = match state.grouping {
|
||||
AgentsOverviewGrouping::Project => {
|
||||
format_directory_display(
|
||||
&self.project_groups[index].heading,
|
||||
/*max_width*/ None,
|
||||
)
|
||||
}
|
||||
AgentsOverviewGrouping::Status => task.group.label().to_owned(),
|
||||
AgentsOverviewGrouping::Model => model_name(&task.thread).to_owned(),
|
||||
};
|
||||
let count = indices
|
||||
.iter()
|
||||
.filter(|&&candidate| self.same_group(state.grouping, candidate, index))
|
||||
.count();
|
||||
let total = (0..self.rows.len())
|
||||
.filter(|&candidate| self.same_group(state.grouping, candidate, index))
|
||||
.count();
|
||||
let count = if count == total {
|
||||
count.to_string()
|
||||
} else {
|
||||
format!("{count} of {total}")
|
||||
};
|
||||
let group = if state.grouping == AgentsOverviewGrouping::Project {
|
||||
crate::text_formatting::center_truncate_path(
|
||||
&group,
|
||||
usize::from(rect.width)
|
||||
.saturating_sub(count.width() + 2)
|
||||
.min(/*other*/ 64),
|
||||
)
|
||||
} else {
|
||||
group
|
||||
};
|
||||
line(format!("{group} {count}").dim(), rect, buf);
|
||||
continue;
|
||||
}
|
||||
let style = if index == self.selected {
|
||||
selection_style()
|
||||
} else {
|
||||
Style::default()
|
||||
};
|
||||
buf.set_style(
|
||||
Rect {
|
||||
width: row_width,
|
||||
..rect
|
||||
},
|
||||
style,
|
||||
);
|
||||
let (status, dot) = Self::status(task);
|
||||
line(
|
||||
Line::from(if index == self.selected { "›" } else { " " }).style(style),
|
||||
rect,
|
||||
buf,
|
||||
);
|
||||
line(
|
||||
Line::from(dot),
|
||||
Rect::new(
|
||||
rect.x + rect.width.min(/*other*/ 2),
|
||||
rect.y,
|
||||
rect.width.saturating_sub(/*rhs*/ 2).min(/*other*/ 1),
|
||||
/*height*/ 1,
|
||||
),
|
||||
buf,
|
||||
);
|
||||
let (mut title, status_area, updated) = columns(rect);
|
||||
if task.is_current && title.width >= 14 {
|
||||
let badge = Rect::new(
|
||||
title.right() - 10,
|
||||
title.y,
|
||||
/*width*/ 10,
|
||||
/*height*/ 1,
|
||||
);
|
||||
title.width -= 10;
|
||||
line(Line::from(" current").style(style), badge, buf);
|
||||
}
|
||||
let title_style = if index == self.selected {
|
||||
style
|
||||
} else {
|
||||
self.title_style(task.thread_id)
|
||||
};
|
||||
line(
|
||||
Line::from(display_title(&task.thread).to_owned()).style(title_style),
|
||||
title,
|
||||
buf,
|
||||
);
|
||||
line(Line::from(status).style(style), status_area, buf);
|
||||
if !updated.is_empty() {
|
||||
let age = format_relative_time(
|
||||
reference,
|
||||
chrono::DateTime::from_timestamp(task.thread.updated_at, /*nsecs*/ 0),
|
||||
);
|
||||
Line::from(age)
|
||||
.style(if index == self.selected {
|
||||
style
|
||||
} else {
|
||||
style.dim()
|
||||
})
|
||||
.right_aligned()
|
||||
.render(updated, buf);
|
||||
}
|
||||
}
|
||||
if padding > 0 && start > 0 {
|
||||
line("↑".dim(), row(area, /*offset*/ 0, /*height*/ 1), buf);
|
||||
}
|
||||
if padding > 0 && start + height < entries.len() {
|
||||
line(
|
||||
"↓".dim(),
|
||||
row(
|
||||
area,
|
||||
area.height.saturating_sub(/*rhs*/ 1),
|
||||
/*height*/ 1,
|
||||
),
|
||||
buf,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
//! Dashboard rows, paging, metadata clipping and status-filter regressions.
|
||||
|
||||
use super::*;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
fn screen(view: &AgentsOverviewView, width: u16, height: u16) -> String {
|
||||
let area = Rect::new(/*x*/ 0, /*y*/ 0, width, height);
|
||||
let mut buf = ratatui::buffer::Buffer::empty(area);
|
||||
view.render(area, &mut buf);
|
||||
crate::chatwidget::tests::helpers::normalize_agent_center_snapshot(
|
||||
buf.content
|
||||
.chunks(usize::from(width))
|
||||
.map(|row| {
|
||||
row.iter()
|
||||
.map(ratatui::buffer::Cell::symbol)
|
||||
.collect::<String>()
|
||||
.trim_end()
|
||||
.to_owned()
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n"),
|
||||
)
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn live_center_columns() {
|
||||
let mut app = make_test_app().await;
|
||||
let current = ThreadId::from_u128(/*value*/ 42);
|
||||
app.primary_thread_id = Some(current);
|
||||
let now = chrono::Utc::now().timestamp();
|
||||
let fixtures = [
|
||||
("Current task", ThreadStatus::Idle, -3600),
|
||||
(
|
||||
"A longer task title that uses the available column",
|
||||
ThreadStatus::Idle,
|
||||
330,
|
||||
),
|
||||
(
|
||||
"Needs an answer",
|
||||
ThreadStatus::Active {
|
||||
active_flags: vec![ThreadActiveFlag::WaitingOnUserInput],
|
||||
},
|
||||
7230,
|
||||
),
|
||||
("Unloaded task", ThreadStatus::NotLoaded, 172830),
|
||||
(
|
||||
"Working task",
|
||||
ThreadStatus::Active {
|
||||
active_flags: Vec::new(),
|
||||
},
|
||||
86430,
|
||||
),
|
||||
("Failed task", ThreadStatus::SystemError, 3630),
|
||||
];
|
||||
let threads = fixtures
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(index, (title, status, age))| {
|
||||
let mut thread = overview_thread(
|
||||
ThreadId::from_u128(index as u128 + 42),
|
||||
/*parent_thread_id*/ None,
|
||||
title,
|
||||
status.clone(),
|
||||
);
|
||||
thread.updated_at = now - age;
|
||||
thread
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
let view = app.agents_overview_view(threads, Some(current));
|
||||
insta::assert_snapshot!(screen(&view, /*width*/ 160, /*height*/ 22));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn live_center_pages_visible_rows_without_wrapping() {
|
||||
for (count, offline) in [(5, false), (30, true)] {
|
||||
let app = make_test_app().await;
|
||||
let first = ThreadId::from_u128(/*value*/ 100);
|
||||
let threads = (0..count)
|
||||
.map(|index| {
|
||||
let mut thread = overview_thread(
|
||||
ThreadId::from_u128(100 + index),
|
||||
/*parent_thread_id*/ None,
|
||||
&format!("Paging task {index:02}"),
|
||||
ThreadStatus::Idle,
|
||||
);
|
||||
thread.updated_at -= index as i64;
|
||||
if index >= 10 {
|
||||
thread.cwd = test_path_buf("/tmp/second-project").abs();
|
||||
}
|
||||
thread
|
||||
})
|
||||
.collect();
|
||||
let mut view = app.agents_overview_view(threads, Some(first));
|
||||
if offline {
|
||||
app.agents_overview
|
||||
.view_state
|
||||
.lock()
|
||||
.unwrap()
|
||||
.connection_notice = Some("Reconnecting…");
|
||||
view.handle_key_event(KeyCode::Char('f').into());
|
||||
view.handle_paste("Paging".into());
|
||||
}
|
||||
screen(&view, /*width*/ 110, /*height*/ 18);
|
||||
view.handle_key_event(KeyCode::PageDown.into());
|
||||
// Eleven visible rows: skip the next heading/gap, or clamp a short list.
|
||||
assert_eq!(
|
||||
view.rows[view.selected_index().unwrap()].thread_id,
|
||||
ThreadId::from_u128(100 + (count - 1).min(10)),
|
||||
);
|
||||
let page_down = view.selected_index().unwrap();
|
||||
view.handle_key_event(KeyCode::PageUp.into());
|
||||
assert!(view.selected_index().unwrap() < page_down);
|
||||
view.handle_key_event(KeyCode::PageUp.into());
|
||||
assert_eq!(view.rows[view.selected_index().unwrap()].thread_id, first);
|
||||
// Repeated pages eventually reach the last filtered task and stay there.
|
||||
for _ in 0..count {
|
||||
view.handle_key_event(KeyEvent::new(KeyCode::Char('f'), KeyModifiers::CONTROL));
|
||||
screen(&view, /*width*/ 110, /*height*/ 18);
|
||||
}
|
||||
let last = view.rows[view.selected_index().unwrap()].thread_id;
|
||||
view.handle_key_event(KeyCode::PageDown.into());
|
||||
assert_eq!(
|
||||
(last, view.rows[view.selected_index().unwrap()].thread_id),
|
||||
(ThreadId::from_u128(100 + count - 1), last)
|
||||
);
|
||||
view.handle_key_event(KeyCode::Down.into());
|
||||
assert!(
|
||||
screen(&view, /*width*/ 110, /*height*/ 18)
|
||||
.lines()
|
||||
.any(|line| line.trim_start().starts_with("/tmp/project"))
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -138,6 +138,7 @@ async fn hiding_tasks_keeps_selection_adjacent_in_display_order() -> Result<()>
|
||||
)
|
||||
})
|
||||
.collect();
|
||||
let age = regex_lite::Regex::new(r"\d+d ago$").unwrap();
|
||||
let mut selections = Vec::new();
|
||||
for grouping in [
|
||||
AgentsOverviewGrouping::Project,
|
||||
@@ -159,7 +160,8 @@ async fn hiding_tasks_keeps_selection_adjacent_in_display_order() -> Result<()>
|
||||
app.keymap = RuntimeKeymap::from_config(&keymap).unwrap();
|
||||
let mut view =
|
||||
app.agents_overview_view(threads.clone(), Some(ThreadId::from_u128(/*value*/ 3)));
|
||||
view.handle_key_event(KeyCode::Esc.into());
|
||||
// Clear retained search without dismissing the command center.
|
||||
view.on_ctrl_c();
|
||||
if filtered {
|
||||
view.handle_key_event(KeyCode::Char('f').into());
|
||||
view.handle_paste("Task".into());
|
||||
@@ -189,15 +191,19 @@ async fn hiding_tasks_keeps_selection_adjacent_in_display_order() -> Result<()>
|
||||
"{grouping:?}, filtered={filtered}"
|
||||
);
|
||||
let rendered = render_bottom_popup(&app.chat_widget, /*width*/ 100);
|
||||
let selected_row = rendered.lines().find(|line| line.contains('›')).unwrap();
|
||||
let selected_row = rendered
|
||||
.lines()
|
||||
.find(|line| line.trim_start().starts_with('›'))
|
||||
.expect("selected task row");
|
||||
let selected_row = selected_row.split('│').next().unwrap().trim();
|
||||
selections.push(format!(
|
||||
"{grouping:?}, filtered={filtered}: {}",
|
||||
selected_row.split('│').next().unwrap().trim()
|
||||
age.replace(selected_row, "[age]")
|
||||
));
|
||||
app.chat_widget.handle_key_event(hide_key.into());
|
||||
let hide = std::iter::from_fn(|| rx.try_recv().ok())
|
||||
.find(|event| matches!(event, AppEvent::HideAgentsOverviewThread { .. }))
|
||||
.expect("hide shortcut emits an event");
|
||||
.expect("hide action emits an event");
|
||||
assert!(matches!(
|
||||
&hide,
|
||||
AppEvent::HideAgentsOverviewThread { thread_id }
|
||||
|
||||
@@ -294,10 +294,10 @@ impl Renderable for AgentsOverviewView {
|
||||
.set_symbol("│")
|
||||
.set_style(Style::new().dim());
|
||||
}
|
||||
self.render_rows(list, buf);
|
||||
self.render_center_rows(list, buf);
|
||||
self.render_details(details, buf);
|
||||
} else {
|
||||
self.render_rows(body, buf);
|
||||
self.render_center_rows(body, buf);
|
||||
}
|
||||
let state = self.state();
|
||||
let (label, input) = if state.searching {
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
#[path = "agent_center_tests.rs"]
|
||||
mod command_center;
|
||||
|
||||
use super::super::agents_overview_view::AgentsOverviewGrouping;
|
||||
use super::*;
|
||||
use crate::chatwidget::tests::helpers::normalize_agent_center_snapshot;
|
||||
|
||||
#[tokio::test]
|
||||
async fn overview_worktree_creation_busy_state() {
|
||||
@@ -34,7 +38,13 @@ async fn overview_thread_colors_match_footer_and_respect_color_suppression() {
|
||||
ThreadStatus::Idle,
|
||||
);
|
||||
thread.name = Some("Named task".into());
|
||||
let view = app.agents_overview_view(vec![thread], Some(id));
|
||||
let mut selected = thread.clone();
|
||||
selected.id = ThreadId::from_u128(/*value*/ 43).to_string();
|
||||
selected.name = Some("Selected task".into());
|
||||
let view = app.agents_overview_view(
|
||||
vec![thread, selected],
|
||||
Some(ThreadId::from_u128(/*value*/ 43)),
|
||||
);
|
||||
let mut terminal = Terminal::new(TestBackend::new(100, 30)).unwrap();
|
||||
terminal
|
||||
.draw(|frame| view.render(frame.area(), frame.buffer_mut()))
|
||||
@@ -46,7 +56,7 @@ async fn overview_thread_colors_match_footer_and_respect_color_suppression() {
|
||||
let x = text[..x].chars().count();
|
||||
snapshot.push(format!(
|
||||
"{} | title style: {:?}",
|
||||
text.trim_end(),
|
||||
crate::chatwidget::tests::helpers::normalize_agent_center_snapshot(&text),
|
||||
row[x].style()
|
||||
));
|
||||
}
|
||||
@@ -86,8 +96,7 @@ async fn server_version_overview_notice_updates_and_clears() {
|
||||
let view = app.agents_overview_view(Vec::new(), /*selected_thread_id*/ None);
|
||||
app.chat_widget.show_bottom_pane_view(Box::new(view));
|
||||
let rendered = render_bottom_popup(&app.chat_widget, /*width*/ 80);
|
||||
insta::assert_snapshot!(rendered.lines().take(/*n*/ 2).collect::<Vec<_>>().join("\n"), @" Agent command center
|
||||
0 need input 0 working 0 ready");
|
||||
assert!(!rendered.contains("Service v"));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
@@ -603,10 +612,12 @@ async fn shared_overview_seeds_once_and_retains_locally_resumed_history() -> Res
|
||||
let retained: HashSet<_> = restarted.agents_overview.threads.keys().copied().collect();
|
||||
assert_eq!(retained, recent_ids);
|
||||
restarted.open_agents_overview(&app_server);
|
||||
let rendered = render_bottom_popup(&restarted.chat_widget, /*width*/ 80)
|
||||
.replace(&test_path_display("/"), "/");
|
||||
let age = regex_lite::Regex::new(r" +[0-9]+d ago").unwrap();
|
||||
insta::assert_snapshot!(
|
||||
"agents_overview_recent_sessions",
|
||||
render_bottom_popup(&restarted.chat_widget, /*width*/ 80)
|
||||
.replace(&test_path_display("/"), "/")
|
||||
age.replace_all(&rendered, " [age]")
|
||||
);
|
||||
app_server.shutdown().await?;
|
||||
Ok(())
|
||||
@@ -863,16 +874,9 @@ async fn agents_overview_details_render_markdown() {
|
||||
.draw(|frame| view.render(frame.area(), frame.buffer_mut()))
|
||||
.unwrap();
|
||||
let cached = terminal.backend().to_string();
|
||||
let project = test_path_display("/tmp/project");
|
||||
let padding = " ".repeat(project.len().saturating_sub("/tmp/project".len()));
|
||||
insta::assert_snapshot!(
|
||||
"agents_overview_markdown",
|
||||
cached
|
||||
.replace(
|
||||
&format!("{project} 1"),
|
||||
&format!("/tmp/project 1{padding}")
|
||||
)
|
||||
.replace(&project, &format!("/tmp/project{padding}"))
|
||||
normalize_agent_center_snapshot(&cached)
|
||||
);
|
||||
|
||||
app.agents_overview.last_messages.clear();
|
||||
@@ -906,12 +910,10 @@ async fn agents_overview_details_render_markdown() {
|
||||
);
|
||||
let view = app.agents_overview_view(vec![thread.clone()], Some(thread_id));
|
||||
app.chat_widget.show_bottom_pane_view(Box::new(view));
|
||||
let normalized_group = format!("/tmp/project 1{padding}");
|
||||
|
||||
insta::assert_snapshot!(
|
||||
"agents_overview_markdown_long_lines",
|
||||
render_bottom_popup(&app.chat_widget, /*width*/ 96)
|
||||
.replace(&format!("{project} 1"), &normalized_group)
|
||||
.replace(&project, "/tmp/project")
|
||||
normalize_agent_center_snapshot(render_bottom_popup(&app.chat_widget, /*width*/ 96))
|
||||
);
|
||||
|
||||
app.agents_overview.last_messages.insert(
|
||||
@@ -922,9 +924,7 @@ async fn agents_overview_details_render_markdown() {
|
||||
app.chat_widget.show_bottom_pane_view(Box::new(view));
|
||||
insta::assert_snapshot!(
|
||||
"agents_overview_markdown_table",
|
||||
render_bottom_popup(&app.chat_widget, /*width*/ 96)
|
||||
.replace(&format!("{project} 1"), &normalized_group)
|
||||
.replace(&project, "/tmp/project")
|
||||
normalize_agent_center_snapshot(render_bottom_popup(&app.chat_widget, /*width*/ 96))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1072,7 +1072,14 @@ async fn worktrees_overview_grouping_requires_feature() {
|
||||
thread
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
let grouped_heading = format!("{} 2", primary.join("").display());
|
||||
let headings = [primary.join(""), primary.join("subdir").join("child")].map(|path| {
|
||||
crate::text_formatting::center_truncate_path(
|
||||
&crate::status::format_directory_display(&path, /*max_width*/ None),
|
||||
/*max_width*/ 64,
|
||||
)
|
||||
});
|
||||
let display_heading = &headings[0];
|
||||
let grouped_heading = format!("{display_heading} 2");
|
||||
let width = 160;
|
||||
for enabled in [false, true] {
|
||||
app.config
|
||||
@@ -1089,13 +1096,14 @@ async fn worktrees_overview_grouping_requires_feature() {
|
||||
.map(|line| line.split('│').next().unwrap_or(line).trim_end())
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n")
|
||||
.replace(
|
||||
&primary.join("").display().to_string(),
|
||||
"/tmp/worktree-root/primary/",
|
||||
)
|
||||
.replace(&headings[1], "/tmp/worktree-root/primary/subdir/child")
|
||||
.replace(display_heading, "/tmp/worktree-root/primary")
|
||||
.replace('\\', "/");
|
||||
insta::with_settings!({snapshot_path => "../snapshots"}, {
|
||||
insta::assert_snapshot!("agents_overview_worktree_grouping", grouping);
|
||||
insta::assert_snapshot!(
|
||||
"agents_overview_worktree_grouping",
|
||||
normalize_agent_center_snapshot(grouping)
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1119,13 +1127,12 @@ async fn overview_model_grouping_shows_details_and_preserves_selection() {
|
||||
ThreadStatus::Idle,
|
||||
);
|
||||
thread.model = model.map(str::to_string);
|
||||
thread.updated_at = index as i64;
|
||||
thread.updated_at = *OVERVIEW_TIMESTAMP + index as i64 - 30;
|
||||
thread
|
||||
})
|
||||
.collect();
|
||||
let selected = ThreadId::from_u128(/*value*/ 1);
|
||||
let mut view = app.agents_overview_view(threads, Some(selected));
|
||||
view.handle_key_event(KeyCode::Esc.into());
|
||||
for _ in 0..2 {
|
||||
view.handle_key_event(KeyEvent::new(KeyCode::Char('g'), KeyModifiers::NONE));
|
||||
}
|
||||
@@ -1295,8 +1302,7 @@ async fn shared_overview_shows_only_root_sessions() {
|
||||
assert!(
|
||||
rendered
|
||||
.lines()
|
||||
.any(|line| line.contains("› ● Inspect unnamed task current")
|
||||
&& line.contains("Needs input"))
|
||||
.any(|line| line.contains("› ● Inspect unnamed task") && line.contains("current"))
|
||||
);
|
||||
|
||||
app.transcript_cells.push(std::sync::Arc::new(
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
//! Dashboard for inspecting and managing the TUI's retained daemon tasks.
|
||||
//! Search and rename input survive metadata refreshes; root Escape never exits.
|
||||
|
||||
#[path = "agent_center/mod.rs"]
|
||||
pub(super) mod command_center;
|
||||
|
||||
#[path = "agents_overview_grouping.rs"]
|
||||
mod grouping;
|
||||
#[path = "agents_overview_input.rs"]
|
||||
@@ -84,7 +87,7 @@ impl AgentsOverviewGroup {
|
||||
Self::NeedsYou => "Needs input",
|
||||
Self::Working => "Working",
|
||||
Self::Ready => "Ready",
|
||||
Self::Finished => "Finished",
|
||||
Self::Finished => "Inactive",
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -132,6 +135,8 @@ impl AgentsOverviewProjectGroup {
|
||||
|
||||
#[derive(Default)]
|
||||
pub(super) struct AgentsOverviewViewState {
|
||||
scroll: usize,
|
||||
page_height: usize,
|
||||
pub(super) input: String,
|
||||
pub(super) key_chord_hint: Option<Vec<(String, String)>>,
|
||||
pub(super) creating_worktree: bool,
|
||||
@@ -324,89 +329,13 @@ impl AgentsOverviewView {
|
||||
|
||||
fn status(row: &AgentsOverviewRow) -> (&'static str, Span<'static>) {
|
||||
match row.group {
|
||||
AgentsOverviewGroup::NeedsYou if row.thread.status == ThreadStatus::SystemError => {
|
||||
("Error", "!".red())
|
||||
}
|
||||
AgentsOverviewGroup::NeedsYou => ("Needs input", "●".red()),
|
||||
AgentsOverviewGroup::Working => ("Working", "●".green()),
|
||||
AgentsOverviewGroup::Ready => ("Ready", "○".cyan()),
|
||||
AgentsOverviewGroup::Finished => ("Finished", "✓".dim()),
|
||||
}
|
||||
}
|
||||
|
||||
fn render_rows(&self, area: Rect, buf: &mut Buffer) {
|
||||
let mut offset = 0;
|
||||
let mut previous_group_index: Option<usize> = None;
|
||||
let grouping = self.state().grouping;
|
||||
let visible = self.visible_indices();
|
||||
let mut first = visible
|
||||
.iter()
|
||||
.position(|index| *index == self.selected)
|
||||
.unwrap_or_default();
|
||||
let mut height = 2;
|
||||
while first > 0 {
|
||||
let previous_index = visible[first - 1];
|
||||
let current_index = visible[first];
|
||||
let group_changed = !self.same_group(grouping, previous_index, current_index);
|
||||
let added_height = 1 + 2 * u16::from(group_changed);
|
||||
if height + added_height > area.height {
|
||||
break;
|
||||
}
|
||||
height += added_height;
|
||||
first -= 1;
|
||||
}
|
||||
for index in visible.into_iter().skip(first) {
|
||||
if offset >= area.height {
|
||||
break;
|
||||
}
|
||||
let row = &self.rows[index];
|
||||
let group = match grouping {
|
||||
AgentsOverviewGrouping::Project => {
|
||||
self.project_groups[index].heading.display().to_string()
|
||||
}
|
||||
AgentsOverviewGrouping::Status => row.group.label().to_string(),
|
||||
AgentsOverviewGrouping::Model => model_name(&row.thread).to_string(),
|
||||
};
|
||||
let group_changed = previous_group_index
|
||||
.is_none_or(|previous_index| !self.same_group(grouping, previous_index, index));
|
||||
if group_changed {
|
||||
offset += u16::from(previous_group_index.is_some());
|
||||
if offset >= area.height {
|
||||
break;
|
||||
}
|
||||
let count = self
|
||||
.rows
|
||||
.iter()
|
||||
.enumerate()
|
||||
.filter(|(candidate_index, _)| {
|
||||
self.same_group(grouping, *candidate_index, index)
|
||||
})
|
||||
.count();
|
||||
Line::from(vec![group.clone().bold(), format!(" {count}").dim()])
|
||||
.render(Rect::new(area.x, area.y + offset, area.width, 1), buf);
|
||||
offset += 1;
|
||||
previous_group_index = Some(index);
|
||||
}
|
||||
if offset >= area.height {
|
||||
break;
|
||||
}
|
||||
let marker = if self.selected == index {
|
||||
"›".cyan().bold()
|
||||
} else {
|
||||
" ".into()
|
||||
};
|
||||
let (status, dot) = Self::status(row);
|
||||
let current = if row.is_current { " current" } else { "" };
|
||||
let mut spans = vec![
|
||||
marker,
|
||||
" ".into(),
|
||||
dot,
|
||||
" ".into(),
|
||||
Span::styled(display_title(&row.thread), self.title_style(row.thread_id)),
|
||||
current.dim(),
|
||||
];
|
||||
if grouping != AgentsOverviewGrouping::Status {
|
||||
spans.extend([" ".into(), status.dim()]);
|
||||
}
|
||||
Line::from(spans).render(Rect::new(area.x, area.y + offset, area.width, 1), buf);
|
||||
offset += 1;
|
||||
AgentsOverviewGroup::Finished => ("Inactive", "○".dim()),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -594,6 +523,9 @@ impl BottomPaneView for AgentsOverviewView {
|
||||
match self.keymap.action_for(key) {
|
||||
Some(ListAction::MoveUp) => self.move_selection(/*forward*/ false),
|
||||
Some(ListAction::MoveDown) => self.move_selection(/*forward*/ true),
|
||||
Some(action @ (ListAction::PageUp | ListAction::PageDown)) => {
|
||||
self.page_selection(action);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
return;
|
||||
@@ -702,9 +634,7 @@ impl BottomPaneView for AgentsOverviewView {
|
||||
self.on_ctrl_c();
|
||||
}
|
||||
ListAction::PageUp | ListAction::PageDown => {
|
||||
for _ in 0..5 {
|
||||
self.move_selection(action == ListAction::PageDown);
|
||||
}
|
||||
self.page_selection(action);
|
||||
}
|
||||
ListAction::MoveRight if !self.state().editing_metadata() => self.activate(),
|
||||
ListAction::MoveLeft | ListAction::MoveRight => {}
|
||||
|
||||
+2
-2
@@ -5,9 +5,9 @@ expression: "render_bottom_popup(&app.chat_widget,\n48).replace(&test_path_displ
|
||||
Agent command center
|
||||
0 need input 0 working 1 ready
|
||||
────────────────────────────────────────────
|
||||
Tasks
|
||||
/tmp/project 1
|
||||
› ○ Task Ready
|
||||
|
||||
› ○ Task
|
||||
|
||||
|
||||
|
||||
|
||||
+16
-17
@@ -1,26 +1,25 @@
|
||||
---
|
||||
source: tui/src/app/agents_overview_actions_tests.rs
|
||||
assertion_line: 211
|
||||
expression: "selections.join(\"\\n\")"
|
||||
---
|
||||
Project, filtered=false: › ○ Task 3 Ready
|
||||
Project, filtered=false: › ○ Task 4 Ready
|
||||
Project, filtered=false: › ○ Other 2 Ready
|
||||
Project, filtered=false: › ○ Task 1 current Ready
|
||||
Project, filtered=true: › ○ Task 3 Ready
|
||||
Project, filtered=true: › ○ Task 4 Ready
|
||||
Project, filtered=true: › ○ Task 1 current Ready
|
||||
Project, filtered=false: › ○ Task 3
|
||||
Project, filtered=false: › ○ Task 4
|
||||
Project, filtered=false: › ○ Other 2
|
||||
Project, filtered=false: › ○ Task 1 current
|
||||
Project, filtered=true: › ○ Task 3
|
||||
Project, filtered=true: › ○ Task 4
|
||||
Project, filtered=true: › ○ Task 1 current
|
||||
Status, filtered=false: › ○ Task 3
|
||||
Status, filtered=false: › ○ Other 2
|
||||
Status, filtered=false: › ○ Task 1 current
|
||||
Status, filtered=false: › ○ Task 1 current
|
||||
Status, filtered=false: › ○ Task 4
|
||||
Status, filtered=true: › ○ Task 3
|
||||
Status, filtered=true: › ○ Task 1 current
|
||||
Status, filtered=true: › ○ Task 1 current
|
||||
Status, filtered=true: › ○ Task 4
|
||||
Model, filtered=false: › ○ Task 3 Ready
|
||||
Model, filtered=false: › ○ Task 4 Ready
|
||||
Model, filtered=false: › ○ Other 2 Ready
|
||||
Model, filtered=false: › ○ Task 1 current Ready
|
||||
Model, filtered=true: › ○ Task 3 Ready
|
||||
Model, filtered=true: › ○ Task 4 Ready
|
||||
Model, filtered=true: › ○ Task 1 current Ready
|
||||
Model, filtered=false: › ○ Task 3
|
||||
Model, filtered=false: › ○ Task 4
|
||||
Model, filtered=false: › ○ Other 2
|
||||
Model, filtered=false: › ○ Task 1 current
|
||||
Model, filtered=true: › ○ Task 3
|
||||
Model, filtered=true: › ○ Task 4
|
||||
Model, filtered=true: › ○ Task 1 current
|
||||
|
||||
+4
-4
@@ -1,13 +1,13 @@
|
||||
---
|
||||
source: tui/src/app/agents_overview_tests.rs
|
||||
expression: "cached.replace(&format!(\"{project} 1\"),\n&format!(\"/tmp/project 1{padding}\")).replace(&project,\n&format!(\"/tmp/project{padding}\"))"
|
||||
expression: normalize_agent_center_snapshot(&cached)
|
||||
---
|
||||
" Agent command center "
|
||||
" 0 need input 0 working 1 ready "
|
||||
" ──────────────────────────────────────────────────────────────────────────────────────────── "
|
||||
" /tmp/project 1 │ Task details "
|
||||
" › ○ Review parser Ready │ "
|
||||
" │ Review parser "
|
||||
" Tasks │ Task details "
|
||||
" /tmp/project 1 │ "
|
||||
" › ○ Review parser │ Review parser "
|
||||
" │ ○ Ready "
|
||||
" │ "
|
||||
" │ Last message "
|
||||
|
||||
+4
-4
@@ -1,13 +1,13 @@
|
||||
---
|
||||
source: tui/src/app/agents_overview_tests.rs
|
||||
expression: "render_bottom_popup(&app.chat_widget,\n96).replace(&format!(\"{project} 1\"),\n&normalized_group).replace(&project, \"/tmp/project\")"
|
||||
expression: "normalize_agent_center_snapshot(render_bottom_popup(&app.chat_widget, 96))"
|
||||
---
|
||||
Agent command center
|
||||
0 need input 0 working 1 ready
|
||||
────────────────────────────────────────────────────────────────────────────────────────────
|
||||
/tmp/project 1 │ Task details
|
||||
› ○ Review parser Ready │
|
||||
│ Review parser
|
||||
Tasks │ Task details
|
||||
/tmp/project 1 │
|
||||
› ○ Review parser │ Review parser
|
||||
│ ○ Ready
|
||||
│
|
||||
│ Last message
|
||||
|
||||
+4
-4
@@ -1,13 +1,13 @@
|
||||
---
|
||||
source: tui/src/app/agents_overview_tests.rs
|
||||
expression: "render_bottom_popup(&app.chat_widget,\n96).replace(&format!(\"{project} 1\"),\n&normalized_group).replace(&project, \"/tmp/project\")"
|
||||
expression: "normalize_agent_center_snapshot(render_bottom_popup(&app.chat_widget, 96))"
|
||||
---
|
||||
Agent command center
|
||||
0 need input 0 working 1 ready
|
||||
────────────────────────────────────────────────────────────────────────────────────────────
|
||||
/tmp/project 1 │ Task details
|
||||
› ○ Review parser Ready │
|
||||
│ Review parser
|
||||
Tasks │ Task details
|
||||
/tmp/project 1 │
|
||||
› ○ Review parser │ Review parser
|
||||
│ ○ Ready
|
||||
│
|
||||
│ Last message
|
||||
|
||||
+11
-11
@@ -1,20 +1,20 @@
|
||||
---
|
||||
source: tui/src/app/agents_overview_tests.rs
|
||||
expression: "render_bottom_popup(&app.chat_widget,\n100).replace(&test_path_display(\"/tmp/project\"),\n\"/tmp/project\").replace(\"del\", \"del\")"
|
||||
expression: "render_bottom_popup(&app.chat_widget,\n100).replace(&test_path_display(\"/tmp/project\"),\n\"/tmp/project\").replace(\"fwd del\", \"del\")"
|
||||
---
|
||||
Agent command center
|
||||
0 need input 0 working 4 ready
|
||||
────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
Unknown 1 │ Task details
|
||||
› ○ Legacy task Ready │
|
||||
│ Legacy task
|
||||
model-a 2 │ ○ Ready
|
||||
○ Recent task Ready │
|
||||
○ Older task Ready │ Project
|
||||
│ /tmp/project
|
||||
model-b 1 │ Model: Unknown
|
||||
○ Other model Ready │
|
||||
│ Prompt
|
||||
Tasks │ Task details
|
||||
Unknown 1 │
|
||||
› ○ Legacy task │ Legacy task
|
||||
│ ○ Ready
|
||||
model-a 2 │
|
||||
○ Recent task │ Project
|
||||
○ Older task │ /tmp/project
|
||||
│ Model: Unknown
|
||||
model-b 1 │
|
||||
○ Other model │ Prompt
|
||||
│ Legacy task
|
||||
│
|
||||
│
|
||||
|
||||
+12
-12
@@ -1,22 +1,22 @@
|
||||
---
|
||||
source: tui/src/app/agents_overview_tests.rs
|
||||
expression: "render_bottom_popup(&restarted.chat_widget,\n80).replace(&test_path_display(\"/\"), \"/\")"
|
||||
expression: "age.replace_all(&rendered, \" [age]\")"
|
||||
---
|
||||
Agent command center
|
||||
0 need input 0 working 0 ready
|
||||
────────────────────────────────────────────────────────────────────────────
|
||||
Tasks Status Updated
|
||||
/ 10
|
||||
› ✓ Task 12 Finished
|
||||
✓ Task 11 Finished
|
||||
✓ Task 10 Finished
|
||||
✓ Task 9 Finished
|
||||
✓ Task 8 Finished
|
||||
✓ Task 7 Finished
|
||||
✓ Task 6 Finished
|
||||
✓ Task 5 Finished
|
||||
✓ Task 4 Finished
|
||||
✓ Task 3 Finished
|
||||
|
||||
› ○ Task 12 Inactive [age]
|
||||
○ Task 11 Inactive [age]
|
||||
○ Task 10 Inactive [age]
|
||||
○ Task 9 Inactive [age]
|
||||
○ Task 8 Inactive [age]
|
||||
○ Task 7 Inactive [age]
|
||||
○ Task 6 Inactive [age]
|
||||
○ Task 5 Inactive [age]
|
||||
○ Task 4 Inactive [age]
|
||||
○ Task 3 Inactive [age]
|
||||
|
||||
|
||||
|
||||
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
---
|
||||
source: tui/src/app/agent_center_tests.rs
|
||||
expression: "screen(&view, 160, 22)"
|
||||
---
|
||||
Agent command center
|
||||
2 need input 1 working 2 ready
|
||||
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
Tasks Status Updated │ Task details
|
||||
/tmp/project 6 │
|
||||
› ○ Current task current Ready now │ Current task
|
||||
○ A longer task title that uses the available column Ready 5m ago │ ○ Ready
|
||||
! Failed task Error 1h ago │
|
||||
● Needs an answer Needs input 2h ago │ Project
|
||||
● Working task Working 1d ago │ /tmp/project
|
||||
○ Unloaded task Inactive 2d ago │ Model: Unknown
|
||||
│
|
||||
│ Prompt
|
||||
│ Current task
|
||||
│
|
||||
│
|
||||
│
|
||||
│
|
||||
│
|
||||
│
|
||||
│
|
||||
↑↓ navigate o resume enter open n new w new worktree f search g group: project r rename x stop h hide a archive del delete ctrl+c quit
|
||||
+1
-1
@@ -9,7 +9,7 @@ expression: "render_bottom_popup(&app.chat_widget, 12)"
|
||||
v0.153.0
|
||||
0 need i
|
||||
────────
|
||||
|
||||
No tas…
|
||||
|
||||
|
||||
|
||||
|
||||
+2
-4
@@ -2,7 +2,5 @@
|
||||
source: tui/src/app/agents_overview_tests.rs
|
||||
expression: "snapshot.join(\"\\n\")"
|
||||
---
|
||||
› ○ Named task Ready │ | title style: Style::new().fg(Color::Rgb(242, 205, 205)).bg(Color::Reset).underline_color(Color::Reset)
|
||||
│ Named task | title style: Style::new().fg(Color::Rgb(242, 205, 205)).bg(Color::Reset).underline_color(Color::Reset).bold()
|
||||
› ○ Named task Ready │ | title style: Style::new().fg(Color::Reset).bg(Color::Reset).underline_color(Color::Reset)
|
||||
│ Named task | title style: Style::new().fg(Color::Reset).bg(Color::Reset).underline_color(Color::Reset).bold()
|
||||
○ Named task │ Selected task | title style: Style::new().fg(Color::Rgb(242, 205, 205)).bg(Color::Reset).underline_color(Color::Reset)
|
||||
○ Named task │ Selected task | title style: Style::new().fg(Color::Reset).bg(Color::Reset).underline_color(Color::Reset)
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ expression: "render_bottom_popup(&app.chat_widget, 80)"
|
||||
Agent command center
|
||||
Creating worktree…
|
||||
────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
No tasks yet
|
||||
|
||||
|
||||
|
||||
|
||||
+5
-5
@@ -1,14 +1,14 @@
|
||||
---
|
||||
source: tui/src/app/agents_overview_usage_tests.rs
|
||||
expression: "render_bottom_popup(&app.chat_widget,\n96).replace(&format!(\"{project} 2\"),\n&group).replace(&project, \"/tmp/project\").replace(\"del\", \"del\")"
|
||||
expression: "render_bottom_popup(&app.chat_widget,\n96).replace(&format!(\"{project} 2\"),\n&group).replace(&project, \"/tmp/project\").replace(\"fwd del\", \"del\")"
|
||||
---
|
||||
Agent command center
|
||||
1 need input 0 working 1 ready
|
||||
────────────────────────────────────────────────────────────────────────────────────────────
|
||||
/tmp/project 2 │ Task details
|
||||
› ● Review parser Needs input │
|
||||
○ Other task Ready │ Review parser
|
||||
│ ● Needs input
|
||||
Tasks │ Task details
|
||||
/tmp/project 2 │
|
||||
› ● Review parser │ Review parser
|
||||
○ Other task │ ● Needs input
|
||||
│
|
||||
│ Needs attention
|
||||
│ Which dependency version should I use?
|
||||
|
||||
@@ -1067,11 +1067,6 @@ async fn archive_current_thread_returns_shared_servers_to_agents() -> Result<()>
|
||||
)
|
||||
.is_some()
|
||||
);
|
||||
assert_snapshot!(
|
||||
"agents_command_center_after_archive",
|
||||
render_bottom_popup(&app.chat_widget, /*width*/ 100)
|
||||
);
|
||||
|
||||
server.shutdown().await?;
|
||||
proxy.await??;
|
||||
}
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ expression: "render_bottom_popup(&app.chat_widget, 100)"
|
||||
Agent command center
|
||||
Reconnecting — agent list is stale
|
||||
────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
│
|
||||
Reconnecting… │
|
||||
│
|
||||
│
|
||||
│
|
||||
|
||||
+4
-4
@@ -5,10 +5,10 @@ expression: "render_bottom_popup(&app.chat_widget, 100)"
|
||||
Agent command center
|
||||
Reconnect failed — agent list is stale; relaunch to retry
|
||||
────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
/tmp/project 2 │ Task details
|
||||
› ● Selected task Working │
|
||||
○ Vanished task Ready │ Selected task
|
||||
│ ● Working
|
||||
Tasks │ Task details
|
||||
/tmp/project 2 │
|
||||
› ● Selected task │ Selected task
|
||||
○ Vanished task │ ● Working
|
||||
│
|
||||
│ Project
|
||||
│ /tmp/project
|
||||
|
||||
+4
-4
@@ -5,10 +5,10 @@ expression: "render_bottom_popup(&app.chat_widget, 100)"
|
||||
Agent command center
|
||||
Reconnecting — agent list is stale
|
||||
────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
/tmp/project 2 │ Task details
|
||||
› ● Selected task Working │
|
||||
○ Vanished task Ready │ Selected task
|
||||
│ ● Working
|
||||
Tasks │ Task details
|
||||
/tmp/project 2 │
|
||||
› ● Selected task │ Selected task
|
||||
○ Vanished task │ ● Working
|
||||
│
|
||||
│ Project
|
||||
│ /tmp/project
|
||||
|
||||
+4
-4
@@ -5,10 +5,10 @@ expression: "render_bottom_popup(&app.chat_widget, 100)"
|
||||
Service v2.0.0 ≠ Codex CLI v0.0.0 · /daemon
|
||||
0 need input 1 working 1 ready
|
||||
────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
/tmp/project 2 │ Task details
|
||||
› ● New task Working │
|
||||
○ Selected task Ready │ New task
|
||||
│ ● Working
|
||||
Tasks │ Task details
|
||||
/tmp/project 2 │
|
||||
› ● New task │ New task
|
||||
○ Selected task │ ● Working
|
||||
│
|
||||
│ Project
|
||||
│ /tmp/project
|
||||
|
||||
-28
@@ -1,28 +0,0 @@
|
||||
---
|
||||
source: tui/src/app/tests/session_lifecycle_requests.rs
|
||||
expression: "render_bottom_popup(&app.chat_widget, 100)"
|
||||
---
|
||||
Agent command center
|
||||
0 need input 0 working 0 ready
|
||||
────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
│
|
||||
│
|
||||
│
|
||||
│
|
||||
│
|
||||
│
|
||||
│
|
||||
│
|
||||
│
|
||||
│
|
||||
│
|
||||
│
|
||||
│
|
||||
│
|
||||
│
|
||||
│
|
||||
│
|
||||
│
|
||||
│
|
||||
↑↓ navigate o resume enter open n new w new worktree f search g group: project r rename x stop
|
||||
h hide a archive del delete ctrl+c quit
|
||||
@@ -67,6 +67,44 @@ pub(crate) fn normalize_snapshot_paths(text: impl Into<String>) -> String {
|
||||
}
|
||||
}
|
||||
|
||||
/// Normalize command-center fixture paths without moving fixed pane separators.
|
||||
/// Pad after each complete pane so group counts and destination hints keep their spacing.
|
||||
pub(crate) fn normalize_agent_center_snapshot(text: impl AsRef<str>) -> String {
|
||||
text.as_ref()
|
||||
.split('\n')
|
||||
.map(|line| {
|
||||
let quoted = line
|
||||
.strip_prefix('"')
|
||||
.and_then(|line| line.strip_suffix('"'));
|
||||
let content = quoted.unwrap_or(line);
|
||||
let normalized = content
|
||||
.split('│')
|
||||
.map(|pane| {
|
||||
let mut normalized = pane.to_owned();
|
||||
for unix_path in ["/tmp/second-project", "/tmp/project", "/project"] {
|
||||
// test_path_buf uses this drive for all absolute Windows fixtures.
|
||||
let windows_path = format!("C:{}", unix_path.replace('/', "\\"));
|
||||
normalized = normalized
|
||||
.replace(&windows_path, unix_path)
|
||||
.replace(&windows_path.replace('\\', "/"), unix_path);
|
||||
}
|
||||
// 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));
|
||||
normalized
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
.join("│");
|
||||
if quoted.is_some() {
|
||||
format!("\"{normalized}\"")
|
||||
} else {
|
||||
normalized.trim_end().to_owned()
|
||||
}
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n")
|
||||
}
|
||||
|
||||
pub(super) fn normalized_backend_snapshot<T: std::fmt::Display>(value: &T) -> String {
|
||||
let platform_test_cwd = test_path_display("/tmp/project");
|
||||
let rendered = format!("{value}");
|
||||
|
||||
@@ -3436,7 +3436,7 @@ fn expanded_time_detail_line(
|
||||
expanded_detail_line(label, &value, width)
|
||||
}
|
||||
|
||||
fn format_relative_time(reference: DateTime<Utc>, ts: Option<DateTime<Utc>>) -> String {
|
||||
pub(crate) fn format_relative_time(reference: DateTime<Utc>, ts: Option<DateTime<Utc>>) -> String {
|
||||
let Some(ts) = ts else {
|
||||
return "-".to_string();
|
||||
};
|
||||
|
||||
+5
-5
@@ -5,11 +5,11 @@ expression: "render_bottom_popup(&app.chat_widget,\n96).replace(&format!(\"{proj
|
||||
Agent command center
|
||||
1 need input 1 working 0 ready
|
||||
────────────────────────────────────────────────────────────────────────────────────────────
|
||||
/tmp/project 3 │ Task details
|
||||
› ● Build the dashboard current Needs input │
|
||||
● Repair authentication Working │ Build the dashboard
|
||||
✓ Review yesterday's changes Finished │ ● Needs input
|
||||
│
|
||||
Tasks │ Task details
|
||||
/tmp/project 3 │
|
||||
› ● Build the dashboard current │ Build the dashboard
|
||||
● Repair authentication │ ● Needs input
|
||||
○ Review yesterday's changes │
|
||||
│ Agent: Inspect keyboard shortcuts
|
||||
│ Open task to review.
|
||||
│ Waiting for approval.
|
||||
|
||||
+4
-4
@@ -5,10 +5,10 @@ expression: "render_bottom_popup(&app.chat_widget,\n96).replace(&format!(\"{proj
|
||||
Agent command center
|
||||
1 need input 0 working 0 ready
|
||||
────────────────────────────────────────────────────────────────────────────────────────────
|
||||
/tmp/project 2 │ Task details
|
||||
› ● Repair authentication Needs input │
|
||||
✓ Investigate parser Finished │ Repair authentication
|
||||
│ ● Needs input
|
||||
Tasks │ Task details
|
||||
/tmp/project 2 │
|
||||
› ● Repair authentication │ Repair authentication
|
||||
○ Investigate parser │ ● Needs input
|
||||
│
|
||||
│ Agent: Check dependencies
|
||||
│ Which dependency version should I use?
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ expression: rendered
|
||||
Agent command center
|
||||
0 need input 0 working 0 ready
|
||||
────────────────────────────────────────────
|
||||
|
||||
No tasks yet
|
||||
|
||||
|
||||
|
||||
|
||||
+4
-4
@@ -5,10 +5,10 @@ expression: "render_bottom_popup(&app.chat_widget,\n96).replace(&format!(\"{proj
|
||||
Agent command center
|
||||
1 need input 0 working 0 ready
|
||||
────────────────────────────────────────────────────────────────────────────────────────────
|
||||
/tmp/project 2 │ Task details
|
||||
● Repair authentication Needs input │
|
||||
› ✓ Investigate parser Finished │ Investigate parser
|
||||
│ ✓ Finished
|
||||
Tasks │ Task details
|
||||
/tmp/project 2 │
|
||||
● Repair authentication │ Investigate parser
|
||||
› ○ Investigate parser │ ○ Inactive
|
||||
│
|
||||
│ Last message
|
||||
│ Found the regression in the parser.
|
||||
|
||||
+3
-3
@@ -5,9 +5,9 @@ expression: "render_bottom_popup(&app.chat_widget,\n96).replace(&format!(\"{proj
|
||||
Agent command center
|
||||
0 need input 1 working 0 ready
|
||||
────────────────────────────────────────────────────────────────────────────────────────────
|
||||
/tmp/project 1 │ Task details
|
||||
› ● Check startup performance Working │
|
||||
│ Check startup performance
|
||||
Tasks │ Task details
|
||||
/tmp/project 1 │
|
||||
› ● Check startup performance │ Check startup performance
|
||||
│ ● Working
|
||||
│
|
||||
│ Latest activity
|
||||
|
||||
+7
-7
@@ -1,20 +1,20 @@
|
||||
---
|
||||
source: tui/src/app/agents_overview_tests.rs
|
||||
expression: grouping
|
||||
expression: normalize_agent_center_snapshot(grouping)
|
||||
---
|
||||
Agent command center
|
||||
0 need input 0 working 4 ready
|
||||
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
/tmp/worktree-root/primary/ 2
|
||||
› ○ Task Ready
|
||||
○ Task Ready
|
||||
Tasks Status Updated
|
||||
/tmp/worktree-root/primary 2
|
||||
› ○ Task Ready 2m ago
|
||||
○ Task Ready 2m ago
|
||||
|
||||
/tmp/worktree-root/primary/subdir/child 1
|
||||
○ Task Ready
|
||||
○ Task Ready 2m ago
|
||||
|
||||
/tmp/worktree-root/primary/subdir/child 1
|
||||
○ Task Ready
|
||||
|
||||
○ Task Ready 2m ago
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user