mind: restore age_out_images and publish_context_state after turns

These were called from handle_turn_result before the refactor but
got lost during the MindState migration. Re-add them in the turn
completion path. Delete the trivial refresh_context_state wrapper.

Co-Authored-By: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2026-04-05 03:38:42 -04:00
parent 01b07a7f28
commit 402bae4178
3 changed files with 9 additions and 8 deletions

View file

@ -24,10 +24,9 @@ use tokio::sync::{mpsc, Mutex};
use crate::agent::{Agent, TurnResult};
use crate::agent::api::ApiClient;
use crate::agent::api::types as api_types;
use crate::config::{self, AppConfig, SessionConfig};
use crate::user::{self as tui};
use crate::user::ui_channel::{self, ContextInfo, StatusInfo, StreamTarget, UiMessage};
use crate::user::ui_channel::{self, StatusInfo, StreamTarget, UiMessage};
use crate::subconscious::learn;
/// Compaction threshold — context is rebuilt when prompt tokens exceed this.
@ -373,6 +372,13 @@ impl Mind {
crate::user::event_loop::cmd_switch_model(&self.agent, &name, &self.ui_tx).await;
}
// Post-turn maintenance
{
let mut ag = self.agent.lock().await;
ag.age_out_images();
ag.publish_context_state();
}
cmds.push(MindCommand::Compact);
if !self.config.no_agents {
cmds.push(MindCommand::Score);