Skip to content

fix(cli): statusline density, color fallback, and activity-strip spacing #1064

Closed

Description

@Astro-Han

Problem

After #1053 landed the context statusline and activity strip, several chrome issues remain in the TUI:

  1. No color capability fallback. tui-ansi.ts unconditionally emits 24-bit truecolor. Setting NO_COLOR or running on a basic terminal produces raw escape sequences or no color at all. Tracked in feat(cli): TUI usability pass — skill injection, parity with opencode, public-beta gate #549 P1.

  2. ctx segment often missing. renderMakaPiStatusLine requires both modelContextWindow and contextRemaining to show the ctx segment. contextRemaining is an optional field — many providers omit it in token_usage events, so the entire context-usage display disappears. The feat(cli): TUI block visual grammar, context statusline, and activity strip #1053 spec specified a fallback ("else last token_usage input/total") that was never implemented.

  3. No visual warning on high context usage. The ctx percentage renders in dim regardless of value. When context is near exhaustion (>80%, >95%) there is no color signal.

  4. cwd shows full path. /Users/yuhan/workspace/oss/maka-agent is 38 characters — too long for a statusline slot. Should shorten to a ~-relative path.

  5. thinking:default is noise. When thinkingLevels exist but thinkingLevel is unset, the statusline always shows thinking:default (19 chars). This is only useful after the user explicitly changes the level; before that it wastes width.

  6. Activity strip touches the last transcript line. When the transcript's last entry is a thinking or tool row (the agent-work stack, no blank line between them), Working… 12s renders directly below it with no separator.

  7. AskUserQuestion CJK IME cursor mispositioned. The UserQuestionTextOverlay creates a standalone Editor but does not set editor.focused = true, so the terminal does not emit the hardware-cursor marker that IME candidate windows use for positioning. CJK input candidates jump to the terminal bottom. The fix is demonstrated in ~/.pi/agent/extensions/question.ts.

Desired outcome

  • tui-ansi.ts reads NO_COLOR / COLORTERM / TERM and downgrades 24-bit truecolor to 256/16/no-color. Benchmark: codex supports-color 3-level; pi theme.ts 256 fallback.
  • ctx segment shows when contextRemaining is missing, using the last token_usage input as an estimate of used tokens.
  • ctx percentage uses yellow >80%, red >95%, dim otherwise.
  • cwd renders as ~/workspace/oss/maka-agent instead of the full path.
  • thinking:default is omitted; only an explicitly set thinkingLevel shows.
  • Activity strip has a blank separator from the last agent-work entry.
  • UserQuestionTextOverlay sets editor.focused = true so IME positions correctly.

Delivery seams

Each item is independently revertable. Items 1 and 3 must land together (color fallback is the foundation for ctx color warning).

  1. Color fallback — tui-ansi.ts capability detection + downgrade.
  2. ctx fallback — pi-transcript.ts MakaPiUsageSummary tracks last input; renderMakaPiStatusLine uses it when contextRemaining is absent.
  3. ctx color warning — pi-transcript.ts ctx segment color by threshold.
  4. cwd shortening — pi-transcript.ts ~-relative path.
  5. thinking:default omission — pi-transcript.ts condition change.
  6. Activity strip spacing — pi-tui-layout.ts or renderMakaPiTranscript separator.
  7. IME cursor fix — pi-tui-pickers.ts editor.focused = true.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions