SIGN IN SIGN UP

fix(tui): always render Conversation legend row; bar respects 0-token segments

Two related issues in the sidebar token breakdown:

1) Conversation legend row could disappear entirely when its calibrated
   value rounded to zero. Observed when toolCallsLocal massively dominated
   conversationLocal — calibrator's proportional residual distribution
   (tokenizer-calibration.ts) is correct but produces a 0-token bucket
   for Conversation. The `if (s.conversationTokens > 0)` gate then dropped
   the row from the legend, making the breakdown look truncated and
   confusing ("where did Conversation go?"). Reproduced from a screenshot
   showing Tool Calls at 44% / Tool Defs at 8% with no Conversation row.

   Conversation is now always emitted as a legend row even at 0% — a
   visible "0%" line is more informative than a missing row.

2) Bar segment widths used Math.max(1, ...) unconditionally, which means
   a 0-token segment would still consume 1 character of bar width, making
   the bar non-proportional. The comment claimed "minimum 1 char if
   tokens > 0" but the code didn't check `tokens > 0`. Fix the width
   calc to only mint a minimum width for segments with actual tokens —
   0-token segments correctly get 0 width and don't distort the bar.

Net effect: the bar stays proportional to real token distribution, and
the legend row stays present so the layout is stable across calibration
edge cases.
U
ualtinok committed
c56d9941d4cee2b28c0a97bef4e300f894ed0d7c
Parent: afa21cb