pressure: calculate_pressure counts every block kind
Was Text-only, blind to tool_use/tool_result/reasoning — ~74% of a real
thread. This is the number behind the 80/90/95 tier warnings and the
archivist's emergency trigger, so both fired late or not at all.
countable_text() (7530d6d) is exhaustive. turn.rs::bifrost_pressure is
still a second counter and still blind to tool_calls by shape; collapsing
the two is not done.
This commit is contained in:
parent
525157250a
commit
764a4b8e35
1 changed files with 1 additions and 5 deletions
|
|
@ -1087,11 +1087,7 @@ Resolve entries: `[YYYY-MM-DD HH:MM] RESOLVED — note`"#;
|
|||
let tokens: usize = messages
|
||||
.iter()
|
||||
.flat_map(|m| &m.blocks)
|
||||
.filter_map(|b| match b {
|
||||
crate::core::session::ContentBlock::Text { text } => Some(text.as_str()),
|
||||
_ => None,
|
||||
})
|
||||
.map(|t| self.counter.count(t))
|
||||
.map(|b| self.counter.count(b.countable_text().as_ref()))
|
||||
.sum();
|
||||
let limit = context_limit.max(1);
|
||||
(tokens as f32 / limit as f32).min(1.0)
|
||||
|
|
|
|||
Loading…
Reference in a new issue