split out src/mind
This commit is contained in:
parent
ce04568454
commit
79e384f005
21 changed files with 1865 additions and 2175 deletions
|
|
@ -95,11 +95,21 @@ impl SavedAgentState {
|
|||
/// Persistent state for the agent orchestration cycle.
|
||||
/// Created once, `trigger()` called on each user message.
|
||||
/// TUI reads snapshots for display.
|
||||
///
|
||||
/// TODO: surface-observe, journal, reflect agents currently spawn child
|
||||
/// processes (legacy from the Claude Code hook path). They should be
|
||||
/// converted to async tasks using the ApiClient, like memory scoring.
|
||||
pub struct AgentCycleState {
|
||||
output_dir: PathBuf,
|
||||
log_file: Option<File>,
|
||||
pub agents: Vec<AgentInfo>,
|
||||
pub last_output: AgentCycleOutput,
|
||||
/// Incremental memory scoring — entry index to resume from.
|
||||
pub memory_score_cursor: usize,
|
||||
/// Whether incremental memory scoring is currently running.
|
||||
pub memory_scoring_in_flight: bool,
|
||||
/// Latest per-memory scores from incremental scoring.
|
||||
pub memory_scores: Vec<(String, f64)>,
|
||||
}
|
||||
|
||||
const AGENT_CYCLE_NAMES: &[&str] = &["surface-observe", "journal", "reflect"];
|
||||
|
|
@ -126,6 +136,9 @@ impl AgentCycleState {
|
|||
reflection: None,
|
||||
sleep_secs: None,
|
||||
},
|
||||
memory_score_cursor: 0,
|
||||
memory_scoring_in_flight: false,
|
||||
memory_scores: Vec::new(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -171,7 +184,20 @@ impl AgentCycleState {
|
|||
}
|
||||
|
||||
pub fn snapshots(&self) -> Vec<AgentSnapshot> {
|
||||
self.agents.iter().map(|a| a.snapshot()).collect()
|
||||
let mut snaps: Vec<AgentSnapshot> = self.agents.iter().map(|a| a.snapshot()).collect();
|
||||
snaps.push(AgentSnapshot {
|
||||
name: "memory-scoring".to_string(),
|
||||
pid: None,
|
||||
phase: if self.memory_scoring_in_flight {
|
||||
Some(format!("scoring (cursor: {})", self.memory_score_cursor))
|
||||
} else if self.memory_scores.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(format!("{} memories scored", self.memory_scores.len()))
|
||||
},
|
||||
log_path: None,
|
||||
});
|
||||
snaps
|
||||
}
|
||||
|
||||
/// Restore agent state from a saved snapshot (for Claude Code hook path).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue