ActiveTools wrapper: replace SharedActiveTools Arc<Mutex<Vec>>

New ActiveTools struct with proper methods: push, remove, abort_all,
take_finished, take_foreground, iter, len. Lives directly on AgentState,
no separate Arc<Mutex> needed.

TUI reads active tools through agent.state.try_lock(). Turn loop uses
helpers instead of manual index iteration.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-04-08 16:45:56 -04:00
parent 9c9618d034
commit 31a41fa042
5 changed files with 23 additions and 26 deletions

View file

@ -125,7 +125,9 @@ impl ScreenView for ConsciousScreen {
)));
lines.push(Line::raw(format!(" Reasoning: {}", app.reasoning_effort)));
lines.push(Line::raw(format!(" Running processes: {}", app.running_processes)));
lines.push(Line::raw(format!(" Active tools: {}", app.active_tools.lock().unwrap().len())));
let tool_count = app.agent.state.try_lock()
.map(|st| st.active_tools.len()).unwrap_or(0);
lines.push(Line::raw(format!(" Active tools: {}", tool_count)));
let block = pane_block("context")
.title_top(Line::from(screen_legend()).left_aligned())