Follow Discord
Sweep 25 Sep 2026 · 19:33Z Build v2.1.283 504 read Stable v2.1.274 Latest v2.1.283 Next v2.1.283 Feeds RSS JSON llms.txt llms-full.txt Unofficial
Mods API · 03 of 03

Types

Every declaration in the file, verbatim, with the doc comment above it.

Declarations570over 12 pages
Mined from2.1.283the shipped binary

Every named declaration in the file, 570 of them, verbatim and in the order Claude Code wrote them, 50 to a page. This is the page to land on from a signature: a verb that returns ToolCallResult links here, at whichever page it is on, and what you get is the declaration itself rather than a description of it.

The source is 13,820 lines of TypeScript mined from build 2.1.283. Anything longer than 12 lines is folded; click the line count to open it. To find a name on another page, search every symbol.

Names on this page, 551 to 570 of 570

MountedMembers type # line 13439

Added in 2.1.277

Every member a mounted drawing of component C can have; Mounted<P, C> keeps the ones surface P has the element for (ElementOfAct).

Each act resolves once the work it started settled (chain, handler, what the handler left running) and what a plugin invalidated was drawn again. The kit exercises the mod's hooks and modules, never a surface's paint.

146 lines
  export type MountedMembers<P extends RenderSurface, C extends RenderComponent = RenderComponent> = {
      /**
       * Where this drawing is, as the test named it.
       */
      readonly surface: P;
      /**
       * The tree as last drawn: what the plugins' `ui.render` chain returned
       * for this instance, validated by the surface's table, as plain data.
       *
       * With `in`, what that `Client`'s surface module last drew instead.
       *
       * @param scope `{ in }`: a `Client`'s key, to read its module's tree
       * @returns the tree; rejects with the refusal when the surface could not
       *   draw what the chain returned, or with a `Client`'s fault line
       * @example
       * expect(await ui.drawn()).toMatchObject({ type: 'Box' })
       */
      drawn: (scope?: ClientScope) => Promise<RenderElement>;
      /**
       * The first element matching the query, outermost first in document
       * order, or undefined.
       *
       * @param query tag, key and shown text to match; `in` to search a Client
       * @returns the element's description, or undefined when none matches
       * @example
       * expect((await ui.find({ key: 'count' }))?.text).toBe('3 notes')
       */
      find: (query: ElementQuery) => Promise<FoundElement | undefined>;
      /**
       * Every element matching the query, in document order.
       *
       * @param query tag, key and shown text to match; `in` to search a Client
       * @returns the matching elements' descriptions
       * @example
       * expect(await ui.findAll({ type: 'Button' })).toHaveLength(2)
       */
      findAll: (query: ElementQuery) => Promise<FoundElement[]>;
      /**
       * Presses the Button keyed `key`, as the person activating it on this
       * surface does: the `ui.press` chain, the Button's own `onPress` last.
       *
       * `e.surface` is this drawing's. With `link`, presses that link of the
       * Markdown keyed `key` instead. A Button a `Client`'s module drew is
       * pressed the same way, by its key.
       *
       * @param target the key; another plugin's name to press its Button; a link
       * @returns what the chain settled on
       * @example
       * await ui.press({ key: 'save' })
       */
      press: (target: MountPressTarget) => Promise<UiPressResult | undefined>;
      /**
       * Types into the Input keyed `key`: the `ui.input` chain with the text as
       * `e.value`, the Input's own handler last.
       *
       * `kind` `submit` (the default) is Enter with that text, `change` an edit
       * that leaves it in the field.
       *
       * @param target the key and the text; `kind`; another plugin's name
       * @returns what the chain settled on
       * @example
       * await ui.input({ key: 'title', text: 'groceries' })
       */
      input: (target: MountInputTarget) => Promise<UiInputResult | undefined>;
      /**
       * Picks `value` in the Select keyed `key`: the `ui.select` chain, the
       * Select's own `onSelect` last.
       *
       * @param target the key and the option's value; another plugin's name
       * @returns what the chain settled on
       * @example
       * await ui.select({ key: 'sort', value: 'date' })
       */
      select: (target: MountSelectTarget) => Promise<UiSelectResult | undefined>;
      /**
       * Hands a `Client`'s `onKey` listener one key, as a key pressed while
       * its region has the focus does.
       *
       * `in` names the `Client` by key; optional when the drawing holds one.
       *
       * @param event the key (`{ key: 'right' }`, `{ key: 'a', ctrl: true }`)
       * @example
       * await ui.key({ key: 'return', in: 'board' })
       */
      key: (event: MountKeyEvent) => Promise<void>;
      /**
       * Hands a `Client`'s `onPointer` listener one event, in the cells of its
       * region as every surface that draws a `Client` reports them.
       *
       * @param event the event (`{ type: 'down', x: 3, y: 0, button: 'left' }`)
       * @example
       * await ui.pointer({ type: 'down', x: 2, y: 0, button: 'left' })
       */
      pointer: (event: MountPointerEvent) => Promise<void>;
      /**
       * Posts as a `Client`'s own `surface.post(data)` does: the plugin's
       * `ui.message` hooks run with `e.data`, `e.surface` this drawing's.
       *
       * A `{ props }` they answer reaches the instance, which redraws with
       * its state kept.
       *
       * @param data plain data (JsonValue)
       * @param scope `{ in }`: which `Client`, when the drawing holds several
       * @example
       * await ui.post({ pick: 2 })
       */
      post: (data: JsonValue, scope?: ClientScope) => Promise<void>;
      /**
       * Moves the drawing's frame clock on: each `surface.every(ms, fn)` timer
       * of its `Client`s fires at every interval of its own the move crosses.
       *
       * @param ms how far, in milliseconds
       * @example
       * await ui.advance(250)
       */
      advance: (ms: number) => Promise<void>;
      /**
       * Lays a `Client`'s region out at a size, as the surface measuring it
       * does: what its module reads as `surface.columns` and `surface.rows`.
       *
       * @param size cells across and down; `in`: which `Client`
       * @example
       * await ui.resize({ columns: 40, rows: 3 })
       */
      resize: (size: MountResizeTarget) => Promise<void>;
      /**
       * Draws the instance again, as the engine does when its props change (a
       * tool row's output arrived): the `ui.render` chain with the next props.
       *
       * A plugin's own `$.ui.invalidate` needs no call: the drawing follows it
       * before the next read.
       *
       * @param props the component's next props; the current ones when absent
       * @example
       * await ui.redraw({ ...TOOL_ROW, isRunning: false, output: 'done' })
       */
      redraw: (props?: RenderPropsOf[C]) => Promise<void>;
      /**
       * Lets the drawing go, as the surface dropping the instance does: its
       * `Client`s and their timers end. Later acts on the handle reject.
       *
       * @example
       * await ui.unmount()
       */
      unmount: () => Promise<void>;
  };

MountInputTarget type # line 13590

Added in 2.1.277

What a mounted drawing's input takes: the Input's key, the text, which of the two inputs it is (submit when unsaid), another plugin's name.

  export type MountInputTarget = {
      key: string;
      text: string;
      kind?: UiInputArgument['kind'];
      plugin?: string;
  };

MountKeyEvent type # line 13601

Added in 2.1.277

What a mounted drawing's key takes: the key as a Client's onKey listener receives it (ClientKeyEvent), and which Client when several.

  export type MountKeyEvent = ClientKeyEvent & ClientScope;

MountPointerEvent type # line 13607

Added in 2.1.277

What a mounted drawing's pointer takes: the event as a Client's onPointer listener receives it, in its region's cells, and which one.

  export type MountPointerEvent = ClientPointerEvent & ClientScope;

MountPressTarget type # line 13613

Added in 2.1.277

What a mounted drawing's press takes: the Button's key, another plugin's name when the Button is not the mounted plugin's, a link.

  export type MountPressTarget = {
      key: string;
      plugin?: string;
      /**
       * Presses this link of the Markdown keyed `key` instead of a Button.
       */
      link?: PressedLink;
  };

MountResizeTarget type # line 13626

Added in 2.1.277

What a mounted drawing's resize takes: a Client region's size in cells, as the surface measuring it hands it, and which Client.

  export type MountResizeTarget = {
      columns: number;
      rows: number;
      in?: string;
  };

MountSelectTarget type # line 13636

Added in 2.1.277

What a mounted drawing's select takes: the Select's key, the picked option's value, another plugin's name when the Select is not its own.

  export type MountSelectTarget = {
      key: string;
      value: string;
      plugin?: string;
  };

MountTarget type # line 13653

Added in 2.1.275 · changed in 2.1.277

What $.ui.mount takes: whose elements the test will act on, the surface that draws, and the component instance the engine asks the plugins for.

The envelope a ui.render hook sees as e (surface, component, requestId, viewport, props) plus plugin. surface is never defaulted: one body run over several surfaces is what shows independence.

$.ui.mount({ plugin: 'notes', surface, component: 'Pane', props: PANE })
37 lines
  export type MountTarget<P extends RenderSurface = RenderSurface, C extends RenderComponent = RenderComponent> = {
      /**
       * Whose elements the handle's acts address by bare `key`: the plugin
       * under test, usually. An act names another plugin to reach its element.
       */
      plugin: string;
      /**
       * What draws: its element table validates every tree the plugins
       * return, and every dispatch the handle raises carries it as `e.surface`.
       *
       * One of `terminal`, `desktop`, `vscode`, `mobile`.
       */
      surface: P;
      /**
       * Which component the engine asks the plugins to draw (`Pane`,
       * `AbovePrompt`, `ToolUse`, ...): what a `ui.render` matcher narrows on.
       */
      component: C;
      /**
       * The component's props, what the hook reads as `e.props`.
       */
      props: RenderPropsOf[C];
      /**
       * The instance drawn (a pane's id, a tool row's tool_use_id); one is
       * minted when absent. Two mounts of one component are two instances.
       */
      requestId?: string;
      /**
       * What the surface measured, as the hook reads it under `e.viewport`;
       * absent when the surface has not measured, as on `e`.
       *
       * Cells across and down in the surface's monospace metric and whether it
       * docks a pane. A `Client` in the drawing starts laid out at this size
       * (0 by 0 when absent) until the handle's `resize` lays its region out.
       */
      viewport?: RenderViewport;
  };

Negatable type # line 13694

Added in 2.1.271

A set of checks and, under not, the same set passing where they fail.

  export type Negatable<M> = M & {
      /**
       * The checks negated.
       */
      not: M;
  };

Plugin type # line 13708

Added in 2.1.271

Written inline in a test and loaded as a plugin folder is: its name, the tier it loads in (user when not given), and its hooks module's register.

register is written register(on) { ... } and is self-contained, as a module's is: it closes over nothing of the test file.

  export type Plugin = {
      name: string;
      tier?: PluginTier;
      register: Register;
  };

PluginTier type # line 13717

Added in 2.1.271

A tier a plugin loads in: every tier but the engine's own.

  export type PluginTier = Exclude<Tier, 'core'>;

PressTarget type # line 13723

Added in 2.1.271 · changed in 2.1.274, 2.1.277

What $.ui.press takes: the plugin whose ui.render hook drew the element, the key it gave it, the instance and surface when several, a link.

17 lines
  export type PressTarget = {
      plugin: string;
      key: string;
      /**
       * Which instance holds it, when the plugin drew the key in several.
       */
      requestId?: string;
      /**
       * Which surface's drawing, when the key is drawn on more than one; the
       * press carries the surface of the drawing it lands in either way.
       */
      surface?: RenderSurface;
      /**
       * For a Markdown answering its links: which of them the press lands on.
       */
      link?: PressedLink;
  };

SelectTarget type # line 13745

Added in 2.1.280

What $.ui.select takes: the plugin whose hook drew the Select, its key, the picked option's value, instance and surface when several.

17 lines
  export type SelectTarget = {
      plugin: string;
      key: string;
      /**
       * Which option is picked, by the `value` the Select listed it under.
       */
      value: string;
      /**
       * Which instance holds it, when the plugin drew the key in several.
       */
      requestId?: string;
      /**
       * Which surface's drawing, when the key is drawn on more than one; the
       * pick carries the surface of the drawing it lands in either way.
       */
      surface?: RenderSurface;
  };

test const # line 13774

Added in 2.1.271

One test: it passes when its body returns or resolves, and fails when it throws, rejects or outlasts its time (5000 ms, or timeoutMs).

The body gets the engine's $ and an on whose hooks sit beneath every plugin; plugins load inline plugins beside the one under test. A failure carries what the engine reported meanwhile: each hook it skipped, and why.

name
the test's name, led in its title by the describes around it
rest
the body, ($, on) => ..., or the options then the body
  export const test: (name: string, ...rest: TestRest) => void;

TestBody type # line 13783

Added in 2.1.271

A test: the engine's $, and on, a plugin's registrar, whose hooks sit beneath every plugin; beneath them the bottom hook throws, naming its event.

The plugins load at the test's first call on $, so a test registers its hooks before it, as a module registers its own in register().

  export type TestBody = ($: Engine, on: On) => unknown;

TestOptions type # line 13789

Added in 2.1.271

What test takes beside its name: the inline plugins it loads beside the one under test, and how long it may run (5000 ms when not given).

  export type TestOptions = {
      plugins?: readonly Plugin[];
      timeoutMs?: number;
  };

TestRest type # line 13797

Added in 2.1.271

What follows a test's name: its body, or its options then its body.

  export type TestRest = readonly [body: TestBody] | readonly [options: TestOptions, body: TestBody];

ThrowExpectation type # line 13803

Added in 2.1.271

What toThrow compares the thrown error with: a substring or pattern of its message, its class, a value carrying the whole message, or nothing.

  export type ThrowExpectation = string | RegExp | Constructor | WithMessage;

tier const # line 13811

Added in 2.1.271

Says which tier the plugin under test loads in, once, at the top of the file: prepend, user (when unsaid), append or builtin.

tier
the tier
  export const tier: (tier: PluginTier) => void;

WithMessage type # line 13816

Added in 2.1.271

An error-like value toThrow compares by its whole message.

  export type WithMessage = {
      message: string;
  };
Feedback