Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

uji.status

These functions report what uji is doing right now, and keep the footer segments that a statusline plugin draws.

uji.status.provider()

Returns the name of the current provider, or nil before one is set.

local provider = uji.status.provider()

uji.status.model()

Works like uji.status.provider, but gives the model id.

local model = uji.status.model()

uji.status.effort()

The reasoning effort comes back as a string such as "medium", or as nil when reasoning is off.

local effort = uji.status.effort() or "off"

uji.status.context()

Returns a table with used, the estimated tokens in the conversation, and window, the model’s context size when uji knows it.

local context = uji.status.context()
if context.window then
  uji.notify(string.format("%d%% of context used", context.used * 100 // context.window))
end

uji.status.queue()

Lists the messages you typed while the model worked that uji has not sent yet.

local waiting = #uji.status.queue()

uji.status.state()

Gives "working" during a turn, and "idle" otherwise.

local busy = uji.status.state() == "working"

uji.status.elapsed()

Counts the seconds since the current turn started. When idle, the result is nil.

local seconds = math.floor(uji.status.elapsed() or 0)

uji.status.loader_frame()

Picks the loader frame to draw now from waiting.loader.frames in uji.ui.configure, or an empty string when idle.

local frame = uji.status.loader_frame()

uji.status.add(name, render, opts)

Registers a footer segment. render returns any value the statusline plugin understands, or nil to hide the segment. opts.priority orders segments, lowest first, and defaults to 50.

uji.status.add("model", function()
  return { text = uji.status.model() or "no model", color = "cyan" }
end, { priority = 10 })

uji.status.remove(name)

Removes a segment. The result is true if it existed.

uji.status.remove("model")

uji.status.list()

Gives the segment names in priority order.

local segments = uji.status.list()

uji.status.render()

Calls every segment in priority order and returns the values that are not nil. Footer plugins draw from it.

local parts = uji.status.render()