Liking cljdoc? Tell your friends :D

com.blockether.vis.internal.limits-format

Channel-neutral {:dynamic {:limits [...]}} row formatters.

Hoisted from the TUI extension (channel_tui/limits_fmt.clj) so every channel — TUI footer, TUI provider cards, web provider cards, Telegram — renders the SAME compact account-quota summary from a provider's normalized limits report. The TUI namespace now aliases these vars; the web channel consumes them through vis.core.

The interesting account-level rows (:zai-coding-plan-5h, :codex-7d, :premium_interactions, ...) live under [:dynamic :limits]; static :rpm/:tpm are svar catalog defaults, identical for every provider, useful only as fallback.

Channel-neutral `{:dynamic {:limits [...]}}` row formatters.

Hoisted from the TUI extension (`channel_tui/limits_fmt.clj`) so
every channel — TUI footer, TUI provider cards, web provider cards,
Telegram — renders the SAME compact account-quota summary from a
provider's normalized limits report. The TUI namespace now aliases
these vars; the web channel consumes them through `vis.core`.

The interesting account-level rows (`:zai-coding-plan-5h`,
`:codex-7d`, `:premium_interactions`, ...) live under
`[:dynamic :limits]`; static `:rpm`/`:tpm` are svar catalog
defaults, identical for every provider, useful only as fallback.
raw docstring

dynamic-summaryclj

(dynamic-summary limits)
(dynamic-summary limits max-rows)

Compact one-line summary of the most informative :dynamic :limits rows for a provider's normalized limits report.

Picks rows with signal first, falls back to all rows when nothing has signal yet (so a fresh, all-zero report still surfaces SOMETHING rather than collapsing to empty). Takes up to max-rows (default 2) and joins them with ·.

Returns nil when there's nothing to render.

Compact one-line summary of the most informative `:dynamic :limits`
rows for a provider's normalized limits report.

Picks rows with signal first, falls back to all rows when nothing
has signal yet (so a fresh, all-zero report still surfaces SOMETHING
rather than collapsing to empty). Takes up to `max-rows` (default 2)
and joins them with ` · `.

Returns nil when there's nothing to render.
sourceraw docstring

format-limit-numberclj

(format-limit-number n)

Render a numeric usage/limit/remaining value with a single-decimal suffix when the value is non-integral, else as a clean integer. Locale/ROOT keeps the JVM locale from injecting a comma decimal separator next to English suffix text.

Render a numeric usage/limit/remaining value with a single-decimal
suffix when the value is non-integral, else as a clean integer.
`Locale/ROOT` keeps the JVM locale from injecting a comma decimal
separator next to English suffix text.
sourceraw docstring

format-limit-usageclj

(format-limit-usage {:keys [used limit remaining unlimited?] :as row})

Render the usage/remaining portion of a row as a short string, choosing the most informative shape the row's numbers allow:

  • explicit unlimited? flag -> "unlimited"
  • percentage-style row -> "47% left"
  • used + limit + remaining -> "3/5 used (2 left)"
  • used + limit -> "3/5 used"
  • remaining + limit -> "2/5 left"
  • remaining only -> "2 left"
  • used only -> "3 used"
  • none of the above -> nil

Returns nil only when the row carries no usage signal at all, so callers can (when usage ...) to skip empty cells.

Render the usage/remaining portion of a row as a short string,
choosing the most informative shape the row's numbers allow:

  - explicit `unlimited?` flag         -> "unlimited"
  - percentage-style row               -> "47% left"
  - used + limit + remaining           -> "3/5 used (2 left)"
  - used + limit                       -> "3/5 used"
  - remaining + limit                  -> "2/5 left"
  - remaining only                     -> "2 left"
  - used only                          -> "3 used"
  - none of the above                  -> nil

Returns nil only when the row carries no usage signal at all, so
callers can `(when usage ...)` to skip empty cells.
sourceraw docstring

generic-limit-has-signal?clj

(generic-limit-has-signal? row)

True when the row has any usage signal worth surfacing. Used to prefer non-zero rows when the visible area is tight.

True when the row has any usage signal worth surfacing. Used to
prefer non-zero rows when the visible area is tight.
sourceraw docstring

generic-limit-labelclj

(generic-limit-label row)

Human label for a dynamic-limit row. Hand-rolled overrides for the widely-known plan rows; fallback derives a label from :label or :id, trimming the redundant Quota / Quota (%) suffixes the raw provider rows ship with.

Human label for a dynamic-limit row. Hand-rolled overrides for the
widely-known plan rows; fallback derives a label from `:label` or
`:id`, trimming the redundant ` Quota` / ` Quota (%)` suffixes the
raw provider rows ship with.
sourceraw docstring

label+usageclj

(label+usage row)

Compose "<label> <usage>" for a single row, or "<label>" when the row has no usage signal. Returns nil when both are blank/absent.

Compose `"<label> <usage>"` for a single row, or `"<label>"`
when the row has no usage signal. Returns nil when both are
blank/absent.
sourceraw docstring

percentage-limit-row?clj

(percentage-limit-row? {:keys [id kind limit remaining]})

True when the row is best displayed as a percent-remaining (the provider reports a 0-100 percentage rather than raw token counts). The ID allowlist covers the Codex / Z.ai plan windows; the :rate + :limit 100 heuristic catches generic percentage rows.

True when the row is best displayed as a percent-remaining (the
provider reports a 0-100 percentage rather than raw token counts).
The ID allowlist covers the Codex / Z.ai plan windows; the
`:rate` + `:limit 100` heuristic catches generic percentage rows.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close