mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 12:03:23 +00:00
fix(coding-agent): show unknown context usage after compaction, fix multi-compaction boundary
After compaction, context token count is unknown until the next LLM response. Instead of showing stale pre-compaction values or heuristic estimates, the footer now shows ?/200k. ContextUsage.tokens and ContextUsage.percent are now number | null (breaking change). Removed usageTokens, trailingTokens, lastUsageIndex from ContextUsage (internal details). Also fixed _checkCompaction() using .find() (first compaction) instead of getLatestCompactionEntry() (latest), which caused incorrect overflow detection with multiple compactions. Closes #1382
This commit is contained in:
parent
1e88c5e463
commit
7eb969ddb1
5 changed files with 56 additions and 29 deletions
|
|
@ -235,12 +235,11 @@ export interface ExtensionUIContext {
|
|||
// ============================================================================
|
||||
|
||||
export interface ContextUsage {
|
||||
tokens: number;
|
||||
/** Estimated context tokens, or null if unknown (e.g. right after compaction, before next LLM response). */
|
||||
tokens: number | null;
|
||||
contextWindow: number;
|
||||
percent: number;
|
||||
usageTokens: number;
|
||||
trailingTokens: number;
|
||||
lastUsageIndex: number | null;
|
||||
/** Context usage as percentage of context window, or null if tokens is unknown. */
|
||||
percent: number | null;
|
||||
}
|
||||
|
||||
export interface CompactOptions {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue