pub fn default_compact_threshold_chars(model: &str) -> usizeExpand description
Compute the default compaction character-count threshold for a model.
Strategy (mirrors fake-cc getAutoCompactThreshold):
- Start from the model’s context window in tokens.
- Reserve 20 000 tokens for the compaction summary output.
- Take 80 % of the remainder as the trigger point (leaves a comfortable 20 % buffer before the hard limit is hit).
- Convert tokens → characters using a conservative 4 chars/token ratio.
Limitation: the 4 chars/token ratio works well for English but
significantly underestimates token density in CJK languages (~1 char ≈
2-3 tokens). Prefer default_compact_threshold_tokens when actual
prompt-token counts are available from the API response.