fix(context): show both summarize and compress thresholds in /context

The /context command previously showed only the hard budget compression
threshold (contextWindow - maxTokens), which confused users who expected
to see the soft summarization trigger from summarize_token_percent.

This commit adds SummarizeAtTokens alongside the existing CompressAtTokens
so that both thresholds are visible:

- Compress at: contextWindow - maxTokens (hard budget, triggers proactive
  compression when exceeded)
- Summarize at: contextWindow * summarizeTokenPercent / 100 (soft trigger,
  matches maybeSummarize's threshold)

The fix updates the /context command output, the Web UI popover, and the
pico channel WebSocket payload.

Fixes #2968
This commit is contained in:
程智超0668000959
2026-06-02 15:43:24 +08:00
parent 709c8b2b52
commit 5f826f4448
9 changed files with 57 additions and 24 deletions
@@ -145,6 +145,23 @@ export function ContextUsageRing({
/>
</div>
<div className="mt-2 space-y-0.5">
<div className="flex items-center justify-between text-[10px]">
<span className="text-muted-foreground">Compress at</span>
<span className="tabular-nums">
{formatTokens(usage.compress_at_tokens)}
</span>
</div>
{usage.summarize_at_tokens != null && usage.summarize_at_tokens > 0 && (
<div className="flex items-center justify-between text-[10px]">
<span className="text-muted-foreground">Summarize at</span>
<span className="tabular-nums">
{formatTokens(usage.summarize_at_tokens)}
</span>
</div>
)}
</div>
<button
type="button"
onClick={handleDetail}