Skip to content

smelt.prompt_bar.top

Availability: Terminal UI only; raises in headless mode.

The rule above the prompt, which holds the working indicator, model, tokens and cost. Register named sources with smelt.prompt_bar.top.add(name, handler), or replace a built-in one by reusing its name. add returns a Reg that removes the source. UiHost-only.

smelt.prompt_bar.top.add

fun(name: string, handler: fun(): smelt.bar.Item[]?): smelt.Reg

Types: smelt.bar.Item, smelt.Reg

Add a named source of items to the rule of the bar above the prompt. handler runs on every repaint and returns a list of items (see smelt.bar.Item); errors are reported on stderr and skip the source. The built-in sources are pause, indicator, elapsed, retry, model, tokens and cost; adding one of those names replaces it in place, keeping its position. Returns a Reg that removes this source, unless a later add with the same name has replaced it.

smelt.prompt_bar.top.builtin

fun(name: string): (fun(): smelt.bar.Item[]?)?

Types: smelt.bar.Item

The built-in source registered under name (pause, indicator, elapsed, retry, model, tokens or cost), or nil. A replacement source can call it to keep the default for the cases it does not draw.

smelt.prompt_bar.top.invalidate

fun()

Repaint after plugin-owned state changes that are not represented by a built-in signal. Adding, replacing, and removing sources invalidates automatically.

smelt.prompt_bar.top.remove

fun(name: string)

Remove every source named name from the bar above the prompt.