fix: track context window size instead of cumulative API tokens
The plugin tracked totalTokens by accumulating (input + output + reasoning) deltas across all session messages. Since each message's input already includes the full conversation context, this re-counted prior turns on every new message, inflating the total by 5-10x compared to what OpenCode displays. Fix: use Math.max instead of additive delta so totalTokens reflects the peak context window size. This matches what OpenCode shows users and makes the budget check intuitive (context window vs. limit). Also renames all user-facing labels from tracked tokens to context tokens for clarity, and adds a regression test. Fixes #5
W
Willy committed
79822591b3699bf0c575b2468e79a9543a763a97
Parent: 4576578