Unconscious agents: persistent AutoAgent, shared Agent Arc for UI

- AutoAgent stored on UnconsciousAgent, swapped out for runs, restored
  on completion (same pattern as subconscious agents)
- Agent Arc created before spawn and stored on UnconsciousAgent so
  the TUI can lock it to read conversation context live
- run_shared() method on AutoAgent for running with a pre-created Agent
- Default tools: memory_tools (not memory_and_journal_tools)
- trigger/spawn_agent made async for Agent::new()

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
ProofOfConcept 2026-04-09 01:00:48 -04:00
parent 5b75ad3553
commit dc07c92b28
4 changed files with 112 additions and 30 deletions

View file

@ -149,6 +149,16 @@ impl AutoAgent {
self.run_with_backend(&mut backend, bail_fn).await
}
/// Run using a pre-created agent Arc. The caller retains the Arc
/// so the UI can lock it to read entries live.
pub async fn run_shared(
&mut self,
agent: &std::sync::Arc<Agent>,
) -> Result<String, String> {
let mut backend = Backend(agent.clone());
self.run_with_backend(&mut backend, None).await
}
/// Run forked using a shared agent Arc. The UI can lock the same
/// Arc to read entries live during the run.
pub async fn run_forked_shared(