smelt.provider¶
Tier: Host - Available in every runtime, including headless mode.
Visibility: Public - Stable Lua API intended for user config and plugins.
List built-in model providers and register custom ones. Headless-safe.
smelt.provider.has_real_rows¶
Return true when the row list contains at least one non-synthetic row.
smelt.provider.is_loading¶
Return true when a provider or normalized result is still loading.
smelt.provider.item_key¶
Return the stable identity key used to preserve selection across provider refreshes.
smelt.provider.list¶
Return every registered provider as an array of tables. Each entry has name, type, api_base, api_key_env, and a models array.
smelt.provider.middleware¶
Types: smelt.Reg
Register provider middleware. mw is a table of { on_response = fn }:
on_response(message)- runs after the assistant message is fully assembled but before it's appended to history.messageis the same{ role = "assistant", content?, tool_calls? }shape used everywhere else. Return a replacement table to mutate it; any other return leaves it as-is.
Hooks fire in registration order. Each hook sees the previous hook's replacement. Returns a Reg whose :remove() drops this middleware.
For streaming observation use smelt.events.on("stream_delta", ...) - synchronous mutation of mid-stream tokens isn't safe because the parser owns the partial state.
smelt.provider.normalize¶
fun(result: table[]|table?, opts?: { show_message?: boolean, loading_message?: string }): smelt.provider.NormalizedResult
Types: smelt.provider.NormalizedResult
Normalize a provider result or plain row list into renderable rows plus loading state.
smelt.provider.register¶
Types: smelt.provider.Config, smelt.Reg
Declare a provider named name. Re-registering replaces the previous entry of the same name. Returns a Reg whose :remove() drops the provider.
smelt.provider.synthetic_only¶
Return true when the row list is exactly one synthetic status/message row.