Add enabled toggle to AutoAgent, simplify unconscious scheduling
- AutoAgent.enabled: universal toggle for any auto agent - Subconscious: should_trigger checks auto.enabled - Unconscious: simplified from consolidation-plan-driven budgets to simple loop with cooldown. Static agent list, max 2 concurrent. - TUI: unconscious agents shown in F3 subconscious screen under separator, with enabled/running/runs display Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
ddfdbe6cb1
commit
1df49482fd
5 changed files with 99 additions and 94 deletions
|
|
@ -102,8 +102,10 @@ impl ScreenView for SubconsciousScreen {
|
|||
]).areas(area);
|
||||
|
||||
// Left column: agent list (top) | outputs (middle) | history (bottom, main)
|
||||
let agent_count = app.agent_state.len().max(1) as u16;
|
||||
let list_height = (agent_count + 2).min(left.height / 4);
|
||||
let unc_count = if app.unconscious_state.is_empty() { 0 }
|
||||
else { app.unconscious_state.len() + 1 }; // +1 for separator
|
||||
let agent_count = (app.agent_state.len() + unc_count).max(1) as u16;
|
||||
let list_height = (agent_count + 2).min(left.height / 3);
|
||||
let output_lines = app.agent_state.get(self.selected())
|
||||
.map(|s| s.state.values().map(|v| v.lines().count() + 1).sum::<usize>())
|
||||
.unwrap_or(0);
|
||||
|
|
@ -162,7 +164,7 @@ impl SubconsciousScreen {
|
|||
}
|
||||
|
||||
fn draw_list(&mut self, frame: &mut Frame, area: Rect, app: &App) {
|
||||
let items: Vec<ListItem> = app.agent_state.iter().map(|snap| {
|
||||
let mut items: Vec<ListItem> = app.agent_state.iter().map(|snap| {
|
||||
if snap.running {
|
||||
ListItem::from(Line::from(vec![
|
||||
Span::styled(&snap.name, Style::default().fg(Color::Green)),
|
||||
|
|
@ -191,6 +193,39 @@ impl SubconsciousScreen {
|
|||
}
|
||||
}).collect();
|
||||
|
||||
// Unconscious agents (graph maintenance)
|
||||
if !app.unconscious_state.is_empty() {
|
||||
items.push(ListItem::from(Line::styled(
|
||||
"── unconscious ──",
|
||||
Style::default().fg(Color::DarkGray),
|
||||
)));
|
||||
for snap in &app.unconscious_state {
|
||||
let (name_color, indicator) = if !snap.enabled {
|
||||
(Color::DarkGray, "○")
|
||||
} else if snap.running {
|
||||
(Color::Yellow, "●")
|
||||
} else {
|
||||
(Color::Gray, "○")
|
||||
};
|
||||
let ago = snap.last_run_secs_ago
|
||||
.map(|s| format_age(s))
|
||||
.unwrap_or_else(|| "—".to_string());
|
||||
let detail = if snap.running {
|
||||
format!("run {}", snap.runs + 1)
|
||||
} else if !snap.enabled {
|
||||
"off".to_string()
|
||||
} else {
|
||||
format!("×{} {}", snap.runs, ago)
|
||||
};
|
||||
items.push(ListItem::from(Line::from(vec![
|
||||
Span::styled(&snap.name, Style::default().fg(name_color)),
|
||||
Span::styled(format!(" {} ", indicator),
|
||||
Style::default().fg(if snap.running { Color::Yellow } else { Color::DarkGray })),
|
||||
Span::styled(detail, Style::default().fg(Color::DarkGray)),
|
||||
])));
|
||||
}
|
||||
}
|
||||
|
||||
let mut block = pane_block_focused("agents", self.focus == Pane::Agents)
|
||||
.title_top(Line::from(screen_legend()).left_aligned());
|
||||
if self.focus == Pane::Agents {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue