mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-04-11 03:43:30 +08:00
feat: show ecc2 delegate states in dashboard
This commit is contained in:
@@ -37,7 +37,7 @@ pub struct Dashboard {
|
|||||||
unread_message_counts: HashMap<String, usize>,
|
unread_message_counts: HashMap<String, usize>,
|
||||||
selected_messages: Vec<SessionMessage>,
|
selected_messages: Vec<SessionMessage>,
|
||||||
selected_parent_session: Option<String>,
|
selected_parent_session: Option<String>,
|
||||||
selected_child_sessions: Vec<String>,
|
selected_child_sessions: Vec<DelegatedChildSummary>,
|
||||||
logs: Vec<ToolLogEntry>,
|
logs: Vec<ToolLogEntry>,
|
||||||
selected_diff_summary: Option<String>,
|
selected_diff_summary: Option<String>,
|
||||||
selected_pane: Pane,
|
selected_pane: Pane,
|
||||||
@@ -88,6 +88,13 @@ struct AggregateUsage {
|
|||||||
overall_state: BudgetState,
|
overall_state: BudgetState,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
struct DelegatedChildSummary {
|
||||||
|
session_id: String,
|
||||||
|
state: SessionState,
|
||||||
|
unread_messages: usize,
|
||||||
|
}
|
||||||
|
|
||||||
impl Dashboard {
|
impl Dashboard {
|
||||||
pub fn new(db: StateStore, cfg: Config) -> Self {
|
pub fn new(db: StateStore, cfg: Config) -> Self {
|
||||||
Self::with_output_store(db, cfg, SessionOutputStore::default())
|
Self::with_output_store(db, cfg, SessionOutputStore::default())
|
||||||
@@ -794,7 +801,25 @@ impl Dashboard {
|
|||||||
};
|
};
|
||||||
|
|
||||||
self.selected_child_sessions = match self.db.delegated_children(&session_id, 3) {
|
self.selected_child_sessions = match self.db.delegated_children(&session_id, 3) {
|
||||||
Ok(children) => children,
|
Ok(children) => children
|
||||||
|
.into_iter()
|
||||||
|
.filter_map(|child_id| match self.db.get_session(&child_id) {
|
||||||
|
Ok(Some(session)) => Some(DelegatedChildSummary {
|
||||||
|
unread_messages: self
|
||||||
|
.unread_message_counts
|
||||||
|
.get(&child_id)
|
||||||
|
.copied()
|
||||||
|
.unwrap_or(0),
|
||||||
|
state: session.state,
|
||||||
|
session_id: child_id,
|
||||||
|
}),
|
||||||
|
Ok(None) => None,
|
||||||
|
Err(error) => {
|
||||||
|
tracing::warn!("Failed to load delegated child session {}: {error}", child_id);
|
||||||
|
None
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.collect(),
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
tracing::warn!("Failed to load delegated child sessions: {error}");
|
tracing::warn!("Failed to load delegated child sessions: {error}");
|
||||||
Vec::new()
|
Vec::new()
|
||||||
@@ -892,14 +917,15 @@ impl Dashboard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !self.selected_child_sessions.is_empty() {
|
if !self.selected_child_sessions.is_empty() {
|
||||||
lines.push(format!(
|
lines.push("Delegates".to_string());
|
||||||
"Delegates {}",
|
for child in &self.selected_child_sessions {
|
||||||
self.selected_child_sessions
|
lines.push(format!(
|
||||||
.iter()
|
"- {} [{}] | inbox {}",
|
||||||
.map(|session_id| format_session_id(session_id))
|
format_session_id(&child.session_id),
|
||||||
.collect::<Vec<_>>()
|
session_state_label(&child.state),
|
||||||
.join(", ")
|
child.unread_messages
|
||||||
));
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(worktree) = session.worktree.as_ref() {
|
if let Some(worktree) = session.worktree.as_ref() {
|
||||||
|
|||||||
Reference in New Issue
Block a user