pub async fn run_compact_session(
runtime: &AgentRuntime,
session_id: &SessionId,
emit_fn: Option<Arc<dyn Fn(UserEvent) + Send + Sync>>,
) -> AgentResult<Option<bool>>Expand description
Run compact_session on the current session: read → compress → write back.
Ok(Some(true))— compression applied, session rewritten.Ok(Some(false))— session is below the threshold, no-op.Ok(None)— compression not available (feature disabled or no compactor registered).Err(...)— actual error (write-back failure, concurrent modification, etc.).
When emit_fn is provided, lifecycle events
(CompressionEvent::Preparing/Started/Progress/Completed) with
CompressionTrigger::Manual are emitted through it.