feat: fixed-bottom status bar with adaptive layout and resize watcher#245
Open
MicalLee0415 wants to merge 8 commits into
Open
feat: fixed-bottom status bar with adaptive layout and resize watcher#245MicalLee0415 wants to merge 8 commits into
MicalLee0415 wants to merge 8 commits into
Conversation
Add ModelPricing struct, lookup_pricing(), and estimate_cost() for computing API costs based on model name, input/output token counts, and optional per-model pricing overrides. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Add StatusBarConfig struct with visible/style/refresh_interval_ms fields and optional per-model pricing overrides. Register in ConfigModel with serde defaults. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Add statusbar.notice.hidden key across all 6 locales (en/zh/ja/de/fr/es). Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Add statusbar module with Plan C adaptive layout (cwd, context tokens, I/O split, cost, request count, latency, state), ANSI scroll region management (enter/exit/reassert_after_resize), Ctrl+T toggle rendering, and 23 unit tests covering latency formatting, cwd shortening, progress bars, and state segments. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Bind Ctrl+T to a StatusToggleHandler that interrupts read_line so the main loop can toggle status bar visibility. Also add /token show and /token hide to slash command list. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Add context_budget_state() accessor so the status bar can display current token usage and budget percentage. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Wire status bar into the main REPL loop: enter/exit fixed mode on startup/shutdown, render status bar each iteration, time AI API calls for latency display, detect terminal resize, and spawn a background polling thread (200ms interval) that re-asserts the ANSI scroll region during read_line when the terminal is resized — preventing the prompt and status bar from being stranded mid-screen. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Contributor
|
Thanks for the pull request. A maintainer will review it when available. Please keep the PR focused, explain the why in the description, and make sure local checks pass before requesting review. Contribution guide: https://github.com/AI-Shell-Team/aish/blob/main/CONTRIBUTING.md |
Contributor
|
This pull request description looks incomplete. Please update the missing sections below before review. Missing items:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a fixed-bottom status bar with adaptive 3-tier layout, pinned via ANSI scroll region (DECSTBM), and a background polling thread that keeps the scroll region correct during terminal resize.
Closes #35
Fields displayed
Key changes (8 atomic commits)
efresh_interval_ms/\pricing\ overrides
Resize-during-read_line fix
Problem: DECSTBM was set once at startup. When the terminal was resized while
ead_line\ was blocking, the scroll region stayed stale, leaving the prompt and status bar stranded mid-screen.
Solution: A 200ms polling watcher thread detects terminal height changes during
ead_line\ and immediately calls
eassert_after_resize()\ — which saves cursor (DECSC), clears stale status bar rows at the old position, sets the new DECSTBM scroll region, and restores cursor (DECRC). The main loop's resize detection acts as a safety net after
ead_line\ returns.
Controls
Testing
Ultraworked with Sisyphus