UI Methods
$.ui draws and manages the interface: lines in the transcript, toasts, panes, scroll, focus, the clipboard, and element tables.
Each method is also an event with the same name, such as ui.log, so a hook above the caller can rewrite or refuse the call.
Close a pane with $.ui.close. A deny from a hook refuses a call.
Official page: Draw in the Interface, Mods Reference. Source: the program (types-2.1.304.d.ts).
In a "Where it can be used" cell, "Run time" means in a hook, in a closure that a hook drew, or in a timer callback. It does not mean inside register.
Example
on('session.start', async ($, e, next) => {
$.ui.status('Mod ready')
$.ui.toast('Hello from a mod', { timeoutMs: 2000 })
return next(e)
})
Members
| Item | Status | What it does | How it works | Where it can be used |
|---|---|---|---|---|
$. | Documented | Shows text as one line under the dialog open for tool_. Removes the line when text is undefined. | (tool_. Core removes the line when the call ends. | A tool. hook while the call's dialog is open. |
$. | Documented | Re-runs an event whose results the engine caches. ui. draws the instances this plugin may draw again. The others drop the cached answers. | (event:. At most ten redraws a second. It can also drop a cached answer, such as prompt. or tool.. | Run time. |
$. | Documented | Repaints a mounted Raster that this plugin's render hook drew with new cells, or swaps a keyed Image to a new source. No redraw. | (args:. Paints at the next frame. Up to 120 calls a second are taken. Resolves {} or { deny }. | A plugin's own mounted Raster or keyed Image. |
$. | Documented | Gives the elements of the surface that e is drawn on: a frozen table of constructors, the JSX tags that a render hook draws with. | <E extends Resolve. It is a read, not a dispatch. | A ui. hook (it takes that hook's e). |
$. | Documented | Appends one line to the transcript, drawn like a dim system notice that is not sent to the model. With { to: it goes to the debug log only. | (text, options?) => void. The terminal draws 2000 characters. A remote surface draws 10000. | Run time. |
$. | Documented | Asks the user a question in the engine's own AskUserQuestion dialog. Resolves to the label they chose, or the text typed under "Other". | (question, options?) => Promise<string>. Offers 2 to 4 labels. Rejects if dismissed, and in a - run. | Not in a - run. |
$. | Documented | Shows text for a few seconds under the plugin's name in a small box at the top right of the transcript. | (text, options?) => void. A click removes it. timeout sets how long it stays (default 4000). | Run time. |
$. | Documented | Raises a native notification through the person's own notification channel (the one preferred names). | (text, options?) => Promise<Ui. The Notification hooks run first. Resolves { is or { is. | Run time. |
$. | Documented | Pins text as this plugin's status line under the prompt, until the next call replaces it. | (text:. undefined removes it. 2000 characters are drawn. | Run time. |
$. | Documented | Opens a pane: a framed region that the surface places and this plugin draws by hooking ui. for { component:. | (pane:. The id has 1 to 64 characters. Panes that were asked for fit at any width. Panes nobody asked for need 144 columns. | Run time. |
$. | Documented | Closes one of the open panes. An id that is not open is left alone. | (pane:. A ui. hook can keep it open, except on an unload. | Run time. |
$. | Documented | Lists this plugin's own open panes: id, title, and whether each is shown, holds the keyboard, and is placed. | () => Promise<readonly Ui. In open order, placed ones first. Other plugins' panes are not listed. | Run time. |
$. | Documented | Scrolls something into view, like the DOM's scroll: a render instance by request, an element by key, or the edge of a site. | (args:. to says where, in says which site, block says where it lands. | Run time. |
$. | Documented | Moves the focus ring of one of this plugin's sites to an element it drew there, like the DOM's element.. | (args:. Takes the site request and the element key. Resolves {} or { deny }. | Run time. |
$. | Documented | Puts text on the clipboard of a surface the session draws on, and says whether it took. | (args:. Resolves { is or { is. | Run time. |
$. | Documented | Returns what the person last selected with the mouse: the text as a copy would take it, and the transcript row it lies in. | () => Promise<Ui. undefined with nothing selected, in -, or when fullscreen is off. | Run time. |
$. | Documented | Puts an agent's transcript in the main view, as the person's own switch from the tasks list does. {} goes back to the main one. | (view:. Works only while the call answers the person's own input (press, pick, prompt, command). | Only while answering the person's own input. |
Related Pages
- Mod API Overview
- UI Events
- Surfaces, Elements, and Render Sites
- UI Types (element props and results of
$.ui)