From 121b46e1d2a6d9249ceb2455d03cee5abe0d307d Mon Sep 17 00:00:00 2001 From: ProofOfConcept Date: Thu, 9 Apr 2026 22:18:43 -0400 Subject: [PATCH] Add ActivityGuard::update() for in-place progress updates Lets long-running operations update their status bar message without creating/dropping a new activity per iteration. Useful for loops like memory scoring where you want "scoring: 3/25 keyname" updating in place. Co-Authored-By: Proof of Concept --- src/agent/mod.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/agent/mod.rs b/src/agent/mod.rs index 54bc418..a31a82c 100644 --- a/src/agent/mod.rs +++ b/src/agent/mod.rs @@ -42,6 +42,17 @@ pub struct ActivityGuard { id: u64, } +impl ActivityGuard { + pub async fn update(&self, label: impl Into) { + let label = label.into(); + let mut st = self.agent.state.lock().await; + if let Some(entry) = st.activities.iter_mut().find(|a| a.id == self.id) { + entry.label = label; + } + st.changed.notify_one(); + } +} + const ACTIVITY_LINGER: std::time::Duration = std::time::Duration::from_secs(5); impl Drop for ActivityGuard {