move context functions from agent/context.rs to thought/context.rs

trim_conversation moved to thought/context.rs where model_context_window,
msg_token_count, is_context_overflow, is_stream_error already lived.
Delete the duplicate agent/context.rs (94 lines).

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-04-02 15:28:00 -04:00
parent 01bfbc0dad
commit 214806cb90
5 changed files with 48 additions and 104 deletions

View file

@ -41,13 +41,13 @@ use poc_memory::agent::ui_channel::{ContextInfo, StatusInfo, StreamTarget, UiMes
/// Hard compaction threshold — context is rebuilt immediately.
/// Uses config percentage of model context window.
fn compaction_threshold(model: &str, app: &AppConfig) -> u32 {
(context::model_context_window(model) as u32) * app.compaction.hard_threshold_pct / 100
(poc_memory::thought::context::model_context_window(model) as u32) * app.compaction.hard_threshold_pct / 100
}
/// Soft threshold — nudge the model to journal before compaction.
/// Fires once; the hard threshold handles the actual rebuild.
fn pre_compaction_threshold(model: &str, app: &AppConfig) -> u32 {
(context::model_context_window(model) as u32) * app.compaction.soft_threshold_pct / 100
(poc_memory::thought::context::model_context_window(model) as u32) * app.compaction.soft_threshold_pct / 100
}
#[tokio::main]