smelt¶
Tier: UiHost — Requires a terminal UI; calling these from headless mode raises.
Root smelt namespace. Host-tier bindings are registered first; UiHost-tier bindings are injected when a TUI is active.
smelt.focus¶
Return which top-level pane currently has focus: "transcript" or "prompt".
smelt.ns¶
Look up or allocate a stable namespace id for name. Namespaces scope buf:mark / buf:clear_ns calls so plugins can repaint their region without disturbing others.
smelt.plugin¶
Promote the current loader frame to plugin scope name and return a
small handle exposing the plugin's per-cycle state slot:
local M = smelt.plugin("banner") M.state.fires = 0 -- M.state is smelt.state("banner") M.name == "banner"
After this call, bare smelt.state() also resolves to the named
slot and unnamed resource constructors auto-name keyed by name.
Idempotent within a single module body run: counters reset on every
promotion so declaration order is what matters.
The handle deliberately doesn't wrap smelt.cell / smelt.cmd /
smelt.keymap / smelt.lifecycle.* — those calls would not be
scope-aware (cell/cmd names are global), so a method facade would
imply encapsulation it can't deliver. Call them directly through
smelt.* and namespace your cell/cmd names explicitly.
Must be called from a module body (or init.lua). Outside a loader frame (e.g. from an event callback) it raises immediately.
smelt.quit¶
Request a clean shutdown of the app. The quit fires on the next tick after the current handler returns.
smelt.sleep¶
Sleep for ms milliseconds. Must be called from inside smelt.spawn(fn)
or a tool.execute. Raises cancelled if the task is cancelled while
parked.
smelt.spawn¶
Types: smelt.Reg
Run handler as a coroutine on the Lua task runtime. The handler may yield; its result is discarded. Returns a Reg whose :remove() cancels the task — any in-flight smelt.sleep / smelt.task.wait raises cancelled and the coroutine unwinds.