feat(usage_limits): per-window session/weekly tokens and a {bar} placeholder - #202
Open
nh13 wants to merge 1 commit into
Open
feat(usage_limits): per-window session/weekly tokens and a {bar} placeholder#202nh13 wants to merge 1 commit into
nh13 wants to merge 1 commit into
Conversation
…older
Add $cship.usage_limits.session and .weekly tokens (aliases .five_hour /
.seven_day) that render a single standard window colored by that window's
own utilization, rather than max(5h, 7d) as $cship.usage_limits does. This
lets the session and weekly limits live on separate lines and escalate
independently.
Add a {bar} placeholder to the per-window format strings, plus bar_width /
bar_filled_char / bar_empty_char config, so each window can show its own
proportional Unicode progress bar (mirroring context_bar).
Docs, JSON schema, and README updated; unit tests cover bar rendering,
placeholder substitution, independent per-window coloring, and aliases.
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.
Adds two capabilities to
[cship.usage_limits], both opt-in and backward-compatible.Per-window tokens
$cship.usage_limits.sessionand$cship.usage_limits.weekly(aliases.five_hour/.seven_day) render a single standard window, colored by that window's own utilization — unlike$cship.usage_limits, whose threshold color keys offmax(5h, 7d). This lets the session and weekly limits sit on separate lines and escalate (green → yellow → red) independently.{bar}placeholderA proportional Unicode bar usable in
five_hour_format/seven_day_format, withbar_width,bar_filled_char, andbar_empty_charconfig (mirrorscontext_bar's fill math). It is scoped to the per-window formats only — the per-model and extra-usage formats leave{bar}literal. Combined with the per-window tokens, each window can show its own progress bar:Notes
$cship.usage_limitsoutput is unchanged — the shared per-window formatter produces byte-identical text when no{bar}is present, andshow_per_model/ extra-usage / separator handling is preserved.bar_widthis clamped to a sane maximum, and the bar string is built only when{bar}is actually referenced.render_baris kept local with a "keep in sync" note rather than refactoringcontext_barin this feature PR — happy to extract a shared helper if you'd prefer.cship explainreports the per-window tokens as plan-unavailable on Enterprise (alongside the per-model sub-tokens) instead of a misleading fetch-failure hint.Docs & tests
docs/configuration.md,docs/faq.md,README.md, and the committedconfig-schema.jsonare updated. New unit tests cover bar rendering (incl. 0-width, clamping, floor semantics), placeholder substitution, the{bar}negative scope in per-model/extra formats, independent per-window coloring, and the aliases.cargo fmt,clippy --all-targets(0 warnings), and the full suite pass.