Subconscious screen: show AutoAgent state

F3 screen now displays SubconsciousSnapshot from Mind's AutoAgents
instead of the old process-based AgentSnapshot. Shows running status
(phase + turn), last run time, and walked key count.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-04-07 01:59:09 -04:00
parent 94ddf7b189
commit 85aafd206c
3 changed files with 86 additions and 107 deletions

View file

@ -91,6 +91,30 @@ impl SubconsciousAgent {
}
}
/// Lightweight snapshot of subconscious agent state for the TUI.
#[derive(Clone, Default)]
pub struct SubconsciousSnapshot {
pub name: String,
pub running: bool,
pub current_phase: String,
pub turn: usize,
pub walked_count: usize,
pub last_run_secs_ago: Option<f64>,
}
impl SubconsciousAgent {
fn snapshot(&self) -> SubconsciousSnapshot {
SubconsciousSnapshot {
name: self.auto.name.clone(),
running: self.is_running(),
current_phase: self.auto.current_phase.clone(),
turn: self.auto.turn,
walked_count: self.auto.walked.len(),
last_run_secs_ago: self.last_run.map(|t| t.elapsed().as_secs_f64()),
}
}
}
/// Which pane streaming text should go to.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum StreamTarget {
@ -316,6 +340,10 @@ impl Mind {
}
/// Initialize — restore log, start daemons and background agents.
pub async fn subconscious_snapshots(&self) -> Vec<SubconsciousSnapshot> {
self.subconscious.lock().await.iter().map(|s| s.snapshot()).collect()
}
pub async fn init(&self) {
// Restore conversation
let mut ag = self.agent.lock().await;