Sweep 19 Sep 2026 · 02:36Z Build v2.1.278 500 read Stable v2.1.267 Latest v2.1.278 Next v2.1.278 Feeds RSS JSON llms.txt Unofficial
Mods API

The whole surface.

Every noun, verb, event and type a Claude Code mod can reach, with the signature and the doc comment Claude Code wrote for it. None of it is documented anywhere else, and none of it is written by hand here: the release pipeline pulls the declarations out of the shipped binary and this section renders what it found.

Start typing to find a name. The three pages under it are the same symbols in full, with the source text.

Symbols664all of them, on this page
Mined from2.1.278the shipped binary
Machine readableapi.jsonthe whole document
/
664 symbols
  1. $.plugin noun This plugin, as loaded: its manifest name and its directory.
  2. $.plugin.name verb From plugin.json; debug-log and `$.ui.log` lines carry it.
  3. $.plugin.root verb The plugin's directory (the one holding plugin.json), absolute.
  4. $.ui noun Display: a line under an open dialog, a redraw or a repaint, a
  5. $.ui.notice verb Shows `text` as one line under the dialog open for `tool_use_id`, or
  6. $.ui.invalidate verb Re-runs an event whose results the engine caches: `ui.render` draws the
  7. $.ui.blit verb Repaints a mounted `Raster` this plugin's own render hook drew with new
  8. $.ui.resolve verb The elements of the surface `e` is drawn on (Elements[e.surface]): a
  9. $.ui.log verb Appends one line to the transcript, drawn like a system notice (dim;
  10. $.ui.ask verb Asks the user `question` in the engine's own AskUserQuestion dialog and
  11. $.ui.toast verb Shows `text` on the notification bar under the prompt for a few
  12. $.ui.status verb Pins `text` as this plugin's status line under the prompt, beside the
  13. $.ui.open verb Opens a pane: a framed region the surface places, whose body this
  14. $.ui.close verb Closes one of the open panes; an id that is not open is left alone.
  15. $.ui.panes verb Lists this plugin's own open panes (UiPane): each one's id and title,
  16. $.ui.scroll verb Scrolls something into view as the DOM's `scrollIntoView` would: a
  17. $.ui.focus verb Moves the focus ring of one of this plugin's sites onto an element it
  18. $.model noun Completions through the session's own client and credentials.
  19. $.model.complete verb Runs one text completion through the session's own API client and
  20. $.model.fork verb Runs one tool-less completion over the session's OWN transcript, sharing
  21. $.model.classify verb Picks one of `labels` for `text` with one completion over
  22. $.audio noun Sound: clip playback and platform speech.
  23. $.audio.play verb Plays one audio clip, starting now; clips are not queued, so two calls
  24. $.audio.speak verb Speaks `text` with the platform's own synthesizer (`say` on macOS).
  25. $.mcp noun The engine's connected MCP servers.
  26. $.mcp.call verb Calls `tool` on one of the engine's connected MCP servers with the
  27. $.session noun The running session, read as plain data, and compacting it.
  28. $.session.messages verb Returns the transcript so far, one entry per user or assistant
  29. $.session.cwd verb Returns the directory the session runs in, absolute.
  30. $.session.root verb Returns the session's project root, absolute: where it started, or
  31. $.session.model verb Returns the main loop's model, as `/model` shows it.
  32. $.session.turns verb Returns how many prompts the user has sent this session (user turns in
  33. $.session.id verb Returns the session's id (the transcript file's name).
  34. $.session.repo verb Returns the git repository the session runs in, read from the working
  35. $.session.surfaces verb Returns every surface the session draws on, each once: `terminal` under
  36. $.session.surface verb Returns the first of `$.session.surfaces()`, or null where nothing
  37. $.session.usage verb Returns the context window's fill, the rate-limit windows and the
  38. $.session.compact verb Compacts the conversation: the event `session.compact` with `trigger`
  39. $.session.authorize verb Holds the session's Anthropic credential on the host and answers an
  40. $.turn noun The running model turn: ending it.
  41. $.turn.abort verb Cancels the running model turn: the one whose id `turn.start` handed
  42. $.prompt noun Submitting a prompt the model reads as a user turn, and the person's
  43. $.prompt.submit verb Submits a prompt: the event `prompt.submit`, the same call the engine
  44. $.prompt.read verb Returns the prompt box as it stands, the draft typed so far and the
  45. $.prompt.fill verb Puts `input.text` in the prompt box as the draft, by `mode`: `replace`
  46. $.prompt.suggest verb Proposes `input.text` as the prompt box's dim suggestion, Tab to take:
  47. $.tool noun The tools the model has in this session, and running one.
  48. $.tool.list verb Returns the tools the model can call now, built-in and MCP alike, in
  49. $.tool.call verb Calls a tool: the event `tool.call`, the same call the engine makes for
  50. $.tool.check verb Asks the engine's permission decision for a tool call now: the event
  51. $.tool.register verb Declares a tool the model can call from the next prompt on: the name,
  52. $.command noun The slash commands the person can run in this session, and running one.
  53. $.command.list verb Returns the slash commands the person can run now, built-in, plugin
  54. $.command.run verb Runs a slash command as if the person typed `/command args`: the
  55. $.command.register verb Declares the slash command `/<name>` for this session, listed in the
  56. $.config noun Every row of the settings menu (`/config`), the panel's own and each
  57. $.config.list verb Returns the rows the `/config` menu would draw now, in its order,
  58. $.config.set verb Changes one row as if the person did in the menu: the event
  59. $.agent noun Subagents.
  60. $.agent.spawn verb Spawns a subagent: the event `agent.spawn`, the same call the engine
  61. $.agent.list verb Returns the session's subagents so far, the ones the model spawned and
  62. $.agent.register verb Defines an agent type the Agent tool dispatches from the next turn on,
  63. $.fs noun The file system as the engine's own process reaches it; a relative path
  64. $.fs.read verb Reads a file and returns its text, or with `{ as: "bytes" }` its bytes
  65. $.fs.write verb Writes `text` to a file, creating it and its directories as needed.
  66. $.fs.list verb Lists a directory: `{ name, kind, size, isLink }` per entry, by name,
  67. $.fs.exists verb Returns whether the path exists; rejects only a network location as
  68. $.fs.stat verb Returns `{ kind, size, mtimeMs, isLink }` of the path: what it leads to,
  69. $.fs.ancestors verb Reads the named instruction files in every directory above the
  70. $.store noun This plugin's own key-value store, kept between sessions and hot
  71. $.store.get verb Returns the value under `key`, or `undefined` when unset.
  72. $.store.set verb Sets `key` to `value`, which must be JSON data.
  73. $.store.delete verb Removes `key` from the store.
  74. $.store.keys verb Returns every key set, in insertion order.
  75. $.clock noun The time and timers, each an event through the host: `clock.now` reads
  76. $.clock.now verb Resolves milliseconds since the epoch, now.
  77. $.clock.sleep verb Resolves after `ms` milliseconds; rejects at once when `signal` aborts.
  78. $.clock.after verb Calls `fn` once after `ms` milliseconds; `cancel()` before then stops it.
  79. $.clock.every verb Calls `fn` every `ms` milliseconds (at least 1) until `cancel()`.
  80. $.http noun The network, through the host.
  81. $.http.fetch verb Fetches `url` through the host (never the plugin's own network) and
  82. $.process noun Commands on the host, run as the user the session runs as. CLI only.
  83. $.process.run verb Runs a command on the host by its argument vector (no shell) and
  84. $.settings noun What the settings files, `--settings` and managed policy hold, as the
  85. $.settings.read verb Resolves with the settings merged over every source, as the engine
  86. $.env noun The environment of this process, the one every Bash child, MCP server
  87. $.env.get verb Resolves with the variable's value, or `undefined` when it is unset.
  88. $.env.set verb Sets the variable for this process and everything it starts after, or
  89. tool.call event Fires when the engine is about to run a tool. `next(e)` runs the hooks
  90. tool.check event Fires when the engine decides whether a tool call may run, after the
  91. ui.render event Fires when the engine is about to draw a component: once per input value
  92. ui.resolve event Fires when the plugins load (not per draw), once per surface, component
  93. ui.press event Fires when a `Button` a render hook drew is pressed on a surface; `e` is
  94. ui.input event Fires when an `Input` a render hook drew changes or is submitted; `e` is
  95. ui.select event Fires when a `Select` a render hook drew is picked from; `e` is
  96. ui.message event Fires when a `Client` THIS plugin drew posts from its surface module
  97. ui.scroll event Fires before a site's window moves: the person's wheel or scroll keys on
  98. ui.focus event Fires before a site's focus ring moves: the person's Tab, arrows or click
  99. agent.offer event Fires when the engine offers an agent type to the model, in the agent
  100. agent.spawn event Fires when the Agent tool is about to start a subagent, everything
  101. prompt.submit event Fires when a prompt is submitted, before the turn starts. `next(e)` runs
  102. prompt.fill event Fires when a text is about to be put in the prompt box as the person's
  103. prompt.suggest event Fires when a text is proposed as the prompt box's dim suggestion, Tab to
  104. prompt.edit event Fires when the person edits the main prompt box: a key the editor took as
  105. prompt.section event Fires once per named section of the system prompt, when the engine
  106. prompt.context event Fires once per conversation, when the engine computes the context blocks
  107. prompt.attachment event Fires once per message the engine injects for the model on its own (a
  108. tool.describe event Fires once per tool, when the engine first renders the tool's schema in
  109. command.run event Fires when a slash command is about to run (`/name args` typed, or a
  110. command.describe event Fires once per command, when the engine lists it for the typeahead and
  111. config.set event Fires when a `/config` row is about to change, from the menu or a
  112. config.describe event Fires once per `/config` row, when the menu lists it and for
  113. skill.prompt event Fires when the engine expands a skill's prompt for the model (`/name`,
  114. attribution.text event Fires when the engine composes a git text the model is to write (`kind`:
  115. session.start event Fires once per process for each loaded plugin, before the first prompt,
  116. session.receive event Fires when a delivery reaches the session (a relay's event, a peer's
  117. session.compact event Fires when the conversation is about to be compacted (`/compact`, the
  118. session.attach event Fires when a remote client joins the session's roster of attached
  119. session.detach event Fires when a client leaves the roster: it detached, or the session ended
  120. session.measure event Fires when the engine measures the session and a unit moved: after each
  121. session.end event Fires once when the session ends (exit, /clear, resume, logout, signal, a
  122. plugin.register event Fires once per hooks module about to join the chain, at load (the set
  123. turn.start event Fires when a model turn begins, before its first model call; `next(e)`
  124. turn.step event Fires when the engine is about to send a model request of a turn, main's
  125. turn.complete event Fires when a model turn has ended, at the point its duration is reported;
  126. engine.create event Runs while `$` is being built, once per load or reload of this plugin
  127. model.complete event The argument of `$.model.complete(request)`.
  128. model.fork event The argument of `$.model.fork(request)`.
  129. audio.speak event The argument of `$.audio.speak(text, { voice })`.
  130. session.cwd event The argument of `$.session.cwd()`.
  131. session.root event The argument of `$.session.root()`.
  132. session.model event The argument of `$.session.model()`.
  133. session.turns event The argument of `$.session.turns()`.
  134. session.id event The argument of `$.session.id()`.
  135. session.messages event The argument of `$.session.messages()`.
  136. session.repo event The argument of `$.session.repo()`.
  137. session.surface event The argument of `$.session.surface()`.
  138. session.surfaces event The argument of `$.session.surfaces()`.
  139. session.authorize event The argument of `$.session.authorize()`.
  140. session.usage event The argument of `$.session.usage({ breakdown, columns })`.
  141. prompt.read event The argument of `$.prompt.read()`.
  142. tool.list event The argument of `$.tool.list()`.
  143. tool.register event The argument of `$.tool.register(spec)`.
  144. command.list event The argument of `$.command.list()`.
  145. command.register event The argument of `$.command.register(spec)`.
  146. config.list event The argument of `$.config.list()`.
  147. agent.list event The argument of `$.agent.list()`.
  148. agent.register event The argument of `$.agent.register(spec)`: the agent type as the plugin
  149. ui.open event The argument of `$.ui.open({ id, title, focus })`; a hook above the
  150. ui.close event The argument of `$.ui.close({ id })` with `origin` `plugin`; the engine
  151. ui.panes event The argument of `$.ui.panes()`.
  152. ui.blit event The argument of `$.ui.blit(...)`: a Raster's `cells` or a keyed Image's
  153. fs.ancestors event The argument of `$.fs.ancestors({ names, of, below })`.
  154. store.keys event The argument of `$.store.keys()`.
  155. clock.now event The argument of `$.clock.now()`.
  156. clock.sleep event The argument of `$.clock.sleep(ms, { signal })`; the signal does not
  157. clock.after event The argument of `$.clock.after(ms, fn)`: the wait before `fn`, which
  158. clock.every event The argument of `$.clock.every(ms, fn)`, dispatched once per period:
  159. settings.read event The argument of `$.settings.read({ source })`.
  160. AgentCallRecord type What an Agent call a plugin raised (`$.tool.call({ tool: "Agent", ... })`)
  161. AgentInfo type One agent loop of this session as `$.agent.list()` returns it: a subagent
  162. AgentLoop type Which model loop an event happened in: the loop's agent id inside a
  163. AgentOfferInput type The input of `agent.offer`: one agent type, at the moment the engine
  164. AgentOfferResult type What an `agent.offer` hook returns: whether the model is offered the agent
  165. AgentSpawnArgs type `agent.spawn`'s input as the call takes it: what the Agent tool's caller
  166. AgentSpawnInput type The input of `agent.spawn`: what the Agent tool decided about the
  167. AgentSpawnResult type What an `agent.spawn` hook returns and what `next(e)` resolves to: the
  168. AgentSpec type What `$.agent.register` takes: an agent type this plugin defines, spelled
  169. AnyEventHook type The hook `on("*", hook)` takes: it runs on every event, plugin nouns no
  170. AnyKeyOf type Every key of every variant, index signatures included.
  171. Args type The argument of event `N`: `e` in its hooks, and what its call takes. For a
  172. AskOptions type Options of `$.ui.ask`.
  173. AttributionTextInput type The input of `attribution.text`: one text the engine asks the model to
  174. AttributionTextKind type Which git text `attribution.text` carries: the commit trailer, the PR
  175. AttributionTextResult type What an `attribution.text` hook returns: the text the model reads in
  176. AudioClip type What `$.audio.play` plays: a URL the engine fetches, or the bytes.
  177. BackgroundTaskSummary type
  178. BaseHookInput type
  179. BoxHoverProps type The `Box` props a `hover` may override, none of which moves the Box's
  180. BoxProps type The props of `Box`: the layout, position, margin, padding and border props
  181. BuiltinToolCallInput type One variant per built-in tool; with none in the table (a plugin author's
  182. BuiltinToolCallInputFallback type The built-in branch's answer when no built-in tool is declared: every
  183. BuiltinToolInputs interface The arguments of each built-in tool by name, for declaration merging;
  184. BuiltinToolName type The names of the built-in tools.
  185. BuiltinToolResults interface The structured result of each built-in tool by name, for declaration
  186. ButtonProps type The props of `Button`, every surface's pressable leaf: an address, a
  187. CatchHandler type The handler `on(...).catch(handler)` takes for a hook of type `F`: the
  188. Caught type What `next` carries into a `.catch` handler and nowhere else: why the
  189. Chunk type What a hook on streaming event `N` yields, and what its `next(e)` yields
  190. ChunkOf type The chunk type of each streaming event, by name: what its stream yields.
  191. ChunkRef type What every `turn.step` chunk may carry: the engine's handle on the item
  192. ClassicEventName type The name of a classic hook event as a function-hooks event: the settings
  193. ClassicEventOf type The classic (settings) hook events, one per classic event name: `e` is
  194. ClassicHookEvent type The name of a classic hook event: `PreToolUse`, `Stop`, and the rest.
  195. ClassicHookInputs type What a classic hook receives on stdin for each event, by event name: the
  196. ClassicResult type Everything a classic hook event's answer can carry, named as the classic
  197. ClassicResultFields type The event-specific fields of ClassicResult each classic event reads (its
  198. ClassicResultOf type What each classic hook event's hook returns and its `next(e)` resolves to:
  199. ClassifyOptions type Options of `$.model.classify`.
  200. ClientElements type The element table a surface module draws with, `surface.elements`: the
  201. ClientKeyEvent type One key the person pressed while a `Client` had the focus, as
  202. ClientModule type The component a surface module exports (default, or its one PascalCase
  203. ClientPointerEvent type One pointer event over a `Client`'s region, as `surface.onPointer` hands
  204. ClientPointerType type What the pointer did over a `Client`'s region: a button went down, the
  205. ClientProps type The props of `Client`: which of the plugin's surface modules draws here,
  206. ClientSurface type What a surface module's function receives as its second argument: its
  207. ClockWait type The argument of the `$.clock` waits (`sleep`, `after`, `every`): how long,
  208. CodeProps type The props of `Code`, source text every surface draws with the engine's own
  209. CommandDescribeInput type The input of `command.describe`: how one slash command presents in the
  210. CommandDescribeResult type What a `command.describe` hook returns: the description, hint and hidden
  211. CommandInfo type One slash command as `$.command.list()` returns it.
  212. CommandPresentation type Where a command's answer will show: which of the terminal's two layouts
  213. CommandRunArgs type `command.run`'s input as a plugin's `$.command.run` takes it: `args` may
  214. CommandRunInput type The input of `command.run`: one slash command about to run, the way the
  215. CommandRunResult type What a `command.run` hook returns and what `next(e)` and `$.command.run`
  216. CommandSource type Where a slash command comes from, as `$.command.list()` tells them apart.
  217. CommandSpec type What `$.command.register` takes: the slash command this plugin serves.
  218. ConfigChangeHookInput type
  219. ConfigDescribeInput type The input of `config.describe`: how one `/config` row presents, at the
  220. ConfigDescribeResult type What a `config.describe` hook returns: the label, help text and hidden
  221. ConfigKind type How a `/config` row takes its value: `boolean` toggles, `choice` picks one
  222. ConfigOrigin type Where a `config.set` came from, in `prompt.submit`'s words: the person
  223. ConfigRow type One `/config` row as `$.config.list()` returns it: what the menu would
  224. ConfigSetArgs type `config.set`'s input as a plugin's `$.config.set(args)` takes it: the
  225. ConfigSetInput type The input of `config.set`: one `/config` row about to change, from the
  226. ConfigSetResult type What a `config.set` hook returns and what `next(e)` resolves to:
  227. ConfigValue type A `/config` row's value as a hook and `$.config` see it: a toggle's
  228. ContextAgent type One custom agent whose description the Agent tool's prompt carries;
  229. ContextApiUsage type The token counts the last API response of the live window reported, as
  230. ContextBreakdownDetail type How a context breakdown is counted: `full` with the token-count API per
  231. ContextCategory type One row of the breakdown, as /context lists it beside the grid (`System
  232. ContextCategoryKind type What a breakdown row is; branch on this, never on the row's `name`.
  233. ContextGridSquare type One square of the grid /context draws: which row it belongs to and how
  234. ContextMcpTool type One MCP tool's schema as the context carries it.
  235. ContextMemoryFile type One memory file the context carries (a CLAUDE.md, a rules file, an
  236. ContextSkill type One skill whose listing the context carries.
  237. ContextSkills type The skills the context lists for the model: how many there are, how many
  238. ContextSlashCommands type The slash commands the Skill tool's prompt lists, counted.
  239. ContextWindowSource type How the window the breakdown measures against was settled; /context
  240. CoreEngineInterface interface The plugin's identity (`plugin`) and the nouns core contributes to `$` as
  241. CoreEventName type The name of an event the engine defines itself (a key of CoreEventOf);
  242. CoreEventOf type The argument of each event the engine defines itself: its call sites'
  243. CwdChangedHookInput type
  244. DirectoryAddedHookInput type
  245. ElementChildren type The `children` field every element constructor's props carry, appended
  246. ElementConstructor type An element as `$.ui.resolve(e)` hands it out: a constructor from props to
  247. ElementName type Every element name of every surface: what a table handed out is completed to
  248. Elements type The element constructors each surface draws, by `e.surface`: what
  249. ElementTable type The table `ui.resolve` answers for an argument of surface `P`.
  250. ElicitationHookInput type Hook input for the Elicitation event. Fired when an MCP server requests user input. Hooks can auto-respond (accept/decline) instead of showing the dialog.
  251. ElicitationResultHookInput type Hook input for the ElicitationResult event. Fired after the user responds to an MCP elicitation. Hooks can observe or override the response before it is sent to the server.
  252. EngineCreateInput type The input of `engine.create`: the fold that builds `$`, once per load,
  253. EngineCreateResult type What an `engine.create` hook returns: `$` as built so far with this
  254. EngineEventOf type The events the engine raises at its call sites, and `engine.create`; the
  255. EngineInterface interface `$`, the first parameter of every hook. Frozen; core's interface plus
  256. EngineInterfaceBuilt type What `next(e)` resolves to at `engine.create`: `$` as the steps beneath
  257. EngineResultOf type The engine's events' results.
  258. EventCalls type The engine's own events as calls on `$`, one signature each:
  259. EventName type The name of an event: a key of EventOf, the engine's own (CoreEventName)
  260. EventOf type The argument of each event, by event name: what a hook receives as `e`
  261. EventResult type The result of event `N`: what its hooks return and what their `next(e)`
  262. Events type The hook signature of each event, `($, e, next)`, as one mapped type over
  263. ExitReason type
  264. FileChangedHookInput type
  265. Frozen type `T` with every property read-only to every depth, arrays and tuples kept
  266. FsAncestor type One file `$.fs.ancestors` found: the directory it stands in, the name it
  267. FsAncestorPart type One file of an ancestor entry: the file itself or one it imported.
  268. FsAncestorsRequest type The argument of `$.fs.ancestors`: the file names to look for in each
  269. FsBytes type What `$.fs.read(path, { as: "bytes" })` resolves with: the file's bytes,
  270. FsEntry type One entry of `$.fs.list`: the entry itself, a link not followed.
  271. FsReadAs type How `$.fs.read` answers: `text` (UTF-8, the default) or `bytes` (base64).
  272. FsReadBytesOptions type The options of `$.fs.read` that ask for the bytes: the call answers
  273. FsReadCall type `$.fs.read`: the file's text, or with `{ as: "bytes" }` its bytes as
  274. FsReadOptions type The options of `$.fs.read`.
  275. FsStat type What `$.fs.stat` resolves with: what the path leads to, whether the path
  276. FsStatOptions type The options of `$.fs.stat`.
  277. Glob type Every event (`*`), or every event under a namespace (`classic.*`: each
  278. GlobHook type The hook `on(pattern, hook)` takes for a glob or a negation: one function
  279. GlobNext type `next` in a hook on a glob or a negation: an overload per selected event,
  280. GlobNextResult type What `next(e)` resolves to in a glob hook before `e` is narrowed: the
  281. Hook type One hook, `($, e, next)`, on event `E`.
  282. HookBudget type The time bounds every hook runs under, in milliseconds: the engine's own
  283. HookFailure type Why a hook failed, as its `.catch` handler reads it on `next.error`: plain
  284. HookFor type The hook type per pattern: an event's own (Events), `*`'s (AnyEventHook),
  285. HookInput type
  286. HookOf type The hook event `E` takes: an async generator over its chunks for a
  287. HooksModule type What a hooks module exports: `register`, and nothing the loader reads
  288. HookStream type What `next(e)` returns on a streaming event: the stream of everything
  289. HttpInit type Options of `$.http.fetch`.
  290. HttpResponse type What `$.http.fetch` resolves with.
  291. ImageBlitArgs type A `$.ui.blit` argument swapping one of the caller's mounted keyed Images
  292. ImageProps type The props of `Image`, the terminal surface's picture leaf: pixels over a
  293. ImageSource type The picture an `Image` shows: base64 bytes the plugin holds (at most 2 MiB
  294. ImpossibleKeys type The keys of object pattern `P` that object member `E` cannot satisfy, `D`
  295. InputProps type The props of `Input`, every surface's one-line text field: an address,
  296. INSTRUCTION_FILE_KINDS const Every tier an instruction file can belong to, for checking a hook's
  297. InstructionFile type One instruction file behind the `claudeMd` block: where it was read, its
  298. InstructionFileKind type What tier an instruction file belongs to: the organization's managed
  299. InstructionsLoadedHookInput type
  300. InvalidatableEventName type What `$.ui.invalidate` takes: a render event, or one of the six events
  301. IsDiscriminant type Whether tag key `K` selects members of `I`: it does when each member gives
  302. IsLiteralValued type Whether `V` is made of literals only: `"a" | "b"` is, `string` is not.
  303. IsSingleLiteral type Whether `V` is exactly one string, number or boolean literal.
  304. IsUnion type Whether `T` is a union of two or more members.
  305. JsonValue type Plain data: what JSON holds, and what crosses between a plugin's hooks
  306. KeptEvent type What `next` takes in a matched hook: the variants of `e` the matcher can
  307. KeptMembers type The members of the argument union `E` matcher `P` can match, as declared;
  308. KnownKeys type The declared keys of `T`, the string and number index signatures left out.
  309. LateOverload type The events whose overload must come after the rest, lest it shadow them.
  310. LinkProps type The props of `Link`, a hyperlink every surface draws: an OSC 8 span on the
  311. Literal type What a matcher value selects by: itself, or `unknown` for a RegExp, which
  312. MarkdownLeafProps type What a `Markdown` carries across the boundary: its address, text, dimness
  313. MarkdownProps type The props of `Markdown`, a block of markdown every surface draws as it
  314. MatchedEvent type The argument a matched hook receives: `e` narrowed by `M` (Narrowed), per
  315. MatchedHook type The hook `on(pattern, matcher, hook)` takes: `($, e, next)` with `e`
  316. MatchedNames type The events a matched registration on `P` covers: the event named, or for a
  317. MatchedResult type What a matched hook returns: the event's result, narrowed by `M` where the
  318. MatchedStreamHook type The hook `on(event, matcher, hook)` takes on a streaming event: the
  319. MatchedStreamNarrowings type What a matched streaming hook's `next.is(pattern, e)` narrows `e` to:
  320. MatchedStreamNext type A matched streaming hook's `next`: the variants the matcher keeps, the
  321. Matcher type What `on(event, matcher, hook)` takes for an argument of type `I`: the
  322. MatcherData type Any matcher at all, for a field typed `unknown` (a tool's input, a
  323. MatcherKeys type The declared keys of every variant of `I` (index signatures aside).
  324. MatcherOne type What matches one value of type `V`, by the runtime's kinds:
  325. MatcherValue type What a matcher gives a key whose value is `V` on this variant and `Across`
  326. MatcherValueOf type The type of key `K` across the variants of `I` that declare it.
  327. McpContentBlock type One block of an MCP result: `type` and the fields that kind of block carries.
  328. McpServerProvenance type The MCP server serving this tool, for `mcp__*` tools: `name` is the server's config key (for `source: "sdk"`, exactly the name the SDK host registered in `sdkMcpServers` / `mcp_set_servers`; for any other source, the key as authored in that configuration - untrusted text, the same value `mcp_status` and system/init report, to be escaped before display), `source` is where its definition came from - `sdk` (an in-process server the SDK host runs; only the host can register one, so a configured server of the same name never reads `sdk`), `plugin` (a server a plugin ships or registers at runtime), or a config scope (`user`, `project`, `local`, `dynamic` for --mcp-config / `mcp_set_servers` process servers, `managed`, `enterprise`, `claudeai`, `agent`). Key trust on `source`, not on the name or the tool-name prefix. Absent for non-MCP tools.
  329. McpToolCallInput type The MCP branch of a `tool.call` hook's `e` (and of `$.tool.call`'s input):
  330. McpToolCallInputFallback type The `e` a `tool.call` (or `classic.PreToolUse`) hook receives for an MCP
  331. McpToolInputs interface The inputs of the MCP tools this project knows, keyed by full tool name,
  332. McpToolName type The name of an MCP tool as the engine spells it: `mcp__<server>__<tool>`.
  333. McpToolResult type An MCP tools/call result as the SDK returns it, plain data.
  334. MessageDisplayHookInput type Hook input for the MessageDisplay event. Fired with each batch of newly completed lines while an assistant message streams. Display-only: the stored message and what the model sees are untouched.
  335. ModelCompleteRequest type What `$.model.complete` takes.
  336. ModelForkRequest type What `$.model.fork` takes.
  337. ModelForkResult type What `$.model.fork` resolves to when the fork answered: the reply's text
  338. ModelForkUsage type What one fork cost, as the API counted it: the four token counts of the
  339. Namespace type The prefixes a glob may name: one or more whole leading segments of an
  340. NarrowDepth type How many object or array levels a matcher narrows `e` through, counted as
  341. Narrowed type `e` in a matched hook: the members of the argument union `E` matcher `P`
  342. NarrowedByAny type A value of declared type `V` under a one-of, folded over the tuple into
  343. NarrowedByOne type A value of declared type `V` under one matcher node `Q` that is not a
  344. NarrowedMember type One object member `E` under object pattern `P`, `D` levels down: `never`
  345. NarrowedValue type A value of declared type `V` where the matcher gives `Q`, `D` levels
  346. Negation type `!` before a name or a glob: every event except the ones it selects. `!*`
  347. Next type The rest of the chain, as one hook receives it: made once per dispatch per
  348. NextBudget type The budget the code reading `next.budget` runs under: the whole allowance
  349. NextResult type What `next(e)` resolves to for event `N`: the event's result, except at
  350. NextResultFor type What `next(e)` resolves to once `e.tool` is the literal `T`: on `tool.call`
  351. NoArgs type The argument of a call on `$` that takes nothing (`$.session.cwd()`): an
  352. NoArgsEvent type The events whose argument is exactly NoArgs (`session.cwd`, a declared
  353. NoEngineInterface type What an `engine.create` hook receives as `$`: nothing. Every property
  354. NonEmpty type Array type `V`, of element `Item`, once some element of it is known to
  355. NotificationHookInput type
  356. NounEvent type The declared plugin nouns' methods as event rows (NounEventRow), one per
  357. NounEventName type The name of a declared plugin noun's event (`voice.speak`).
  358. NounEventOf type The events of the plugin nouns declared on EngineInterface, by name: the
  359. NounEventResult type The result of a declared plugin noun's event as its hooks see it:
  360. NounEventRow type One method of a declared plugin noun as an event row: its event's name,
  361. NounValueOf type What each declared plugin noun's method answers (the `value` of its
  362. On type Registers `hook` on the events `pattern` selects: one by name, every one
  363. OnScreen type The part of a transcript message the surface that drew it has on screen:
  364. OpenMatcher type The keys a variant with a string index signature (an MCP tool's input)
  365. OpEventName type The name of a call on `$` the host serves, as an event.
  366. OpEventOf type The calls on `$` the host serves, as events: `e` is the call's argument as
  367. OpEventResult type The result of a call on `$` as its event's hooks see it: `{ value }` (the
  368. OpValueOf type What each call on `$` answers (the `value` of its event's result), by event
  369. OrderedOverloads type One call signature per event in `Names`, intersected, the ambiguous ones
  370. Origin type Who raised a dispatch, as `next.origin` holds it: the calling plugin's
  371. Overloads type One call signature per event in `Names`, intersected into an overload set.
  372. PaneCloseArgs type The argument of `$.ui.close`: the pane to close (`{ id }`). `origin` is
  373. PaneCloseInput type The input of `ui.close`: the pane closing and why (PaneCloseOrigin).
  374. PaneCloseOrigin type Why a pane closes, as the engine stamped it at `ui.close`.
  375. PaneOpenArgs type The argument of `$.ui.open`: which pane, its title, whether it asks the
  376. Pattern type What `on(pattern, hook)` and `next.is(pattern, e)` take: an event's name,
  377. PatternOver type The patterns `next.is` takes in a hook covering the events `N`: their
  378. PermissionBehavior type
  379. PermissionDeniedHookInput type
  380. PermissionMode type Permission mode for controlling how tool executions are handled. 'default' - Standard behavior, prompts for dangerous operations. 'acceptEdits' - Auto-accept file edit operations. 'bypassPermissions' - Bypass all permission checks (requires allowDangerouslySkipPermissions). 'plan' - Planning mode, no actual tool execution. 'dontAsk' - Don't prompt for permissions, deny if not pre-approved. 'auto' - Use a model classifier to approve/deny permission prompts.
  381. PermissionRequestDecision type A `classic.PermissionRequest` answer's `decision`, as the classic hook's
  382. PermissionRequestHookInput type
  383. PermissionRuleValue type
  384. PermissionUpdate type
  385. PermissionUpdateDestination type
  386. PermissionUpdates type The permission rules a PermissionRequest allow may add: the shape of the
  387. PlayOptions type How `$.audio.play` plays a clip: looped until `signal` aborts, or once.
  388. PluginNoun type The nouns a plugin declared on `$` by merging into EngineInterface; never
  389. PluginOptions type A plugin's options as `register(on, options)` receives them: the values of
  390. PluginRegisterInput type The input of `plugin.register`: one hooks module the engine is about to
  391. PluginRegisterResult type What a `plugin.register` hook returns and what `next(e)` resolves to:
  392. PluginRegisterUses type What a hooks module uses, as the host scanned its source before loading it:
  393. PluginStamp type Whose element: the plugin whose hook drew it, stamped by the runtime as the
  394. PostCompactHookInput type
  395. PostModelSwitchHookInput type
  396. PostToolBatchHookInput type Hook input for the PostToolBatch event. Fired once after every tool call in a batch has resolved, before the next model request. PostToolUse fires per-tool and may run concurrently for parallel tool calls; PostToolBatch fires exactly once with the full batch.
  397. PostToolBatchToolCall type
  398. PostToolUseFailureHookInput type
  399. PostToolUseHookInput type
  400. PreCompactHookInput type
  401. PreModelSwitchHookInput type
  402. PressedLink type The link a press landed on: one a `Markdown` drew, pressed where the
  403. PreToolUseDecision type The decision of a `classic.PreToolUse` result: `allow`, `ask`, `deny`, or
  404. PreToolUseHookInput type
  405. PreToolUseResult type What a `classic.PreToolUse` hook returns: one of `allow`, `ask`, `deny`,
  406. ProcessRunInit type Options of `$.process.run`.
  407. ProcessRunResult type What `$.process.run` resolves with once the child has exited.
  408. PromptAttachmentInput type The input of `prompt.attachment`: one message the engine injects into the
  409. PromptAttachmentOrigin type Who authored the text an injected attachment carries, as the engine knows
  410. PromptAttachmentResult type What a `prompt.attachment` hook returns: the text the model reads for that
  411. PromptBox type The person's prompt box as it stands: the draft and where the cursor is in
  412. PromptContextBlock type One block of the context the first user message carries: a name the
  413. PromptContextBlocks type The context blocks of a conversation's first user message, in the order
  414. PromptContextInput type The input of `prompt.context`: the context blocks the engine prepends to a
  415. PromptContextResult type What a `prompt.context` hook returns: the blocks the conversation
  416. PromptEditInput type The input of `prompt.edit` (prompt-edit/): one edit the person makes in the
  417. PromptEditOrigin type Who edits the prompt box at `prompt.edit`, as the engine stamps it where
  418. PromptEditResult type What a `prompt.edit` hook returns and what `next(e)` resolves to: the box
  419. PromptFillArgs type `prompt.fill`'s input as a plugin's `$.prompt.fill(args)` takes it: no
  420. PromptFilled type What `$.prompt.fill` resolves to: whether the box took the text, and the
  421. PromptFillInput type The input of `prompt.fill` (prompt-fill/): a text about to be put in the
  422. PromptFillMode type Where a `prompt.fill` puts its text: over the whole draft, after it, or
  423. PromptFillOrigin type Who writes the prompt box at `prompt.fill`, as the engine stamps it where
  424. PromptFillResult type What a `prompt.fill` hook returns and what `next(e)` resolves to: whether
  425. PromptOrigin type Where a `prompt.submit` submission came from, as the engine knows it at
  426. PromptSectionInput type The input of `prompt.section`: one named section of the system prompt, at
  427. PromptSectionResult type What a `prompt.section` hook returns: the text the prompt carries for that
  428. PromptSubmitArgs type `prompt.submit`'s input as a plugin's call takes it: `origin`, `turnId`
  429. PromptSubmitAttachment type A pasted or attached non-text item of a submitted prompt; its kind, never
  430. PromptSubmitInput type The input of `prompt.submit`: the prompt as typed, after the input became
  431. PromptSubmitResult type What a `prompt.submit` hook returns and what `next(e)` resolves to: the
  432. PromptSuggestArgs type `prompt.suggest`'s input as a plugin's `$.prompt.suggest(args)` takes it:
  433. PromptSuggestInput type The input of `prompt.suggest` (prompt-suggest/): a text about to be shown
  434. PromptSuggestOrigin type Who proposes the text at `prompt.suggest`, as the engine stamps it where
  435. PromptSuggestResult type What a `prompt.suggest` hook returns and what `next(e)` resolves to:
  436. RasterBlitArgs type A `$.ui.blit` argument repainting one of the caller's mounted Rasters.
  437. RasterProps type The props of `Raster`, the terminal surface's cell-grid leaf: a fixed box
  438. Register type The hooks module's entry: `export function register(on, options)`. `on`
  439. Registration type What `on(...)` returns for a hook of type `F`: the registration, which
  440. RenderChildren type What an element takes as `children`, as JSX passes them: a node, a number
  441. RenderComponent type Everything `ui.render` can draw: one name per component that has a render
  442. RenderElement type What a render hook returns, and what `next(e)` resolves to: a plain-data
  443. RenderEventName type The render event: `ui.render`, one event for every component that has a
  444. RenderInput type The input of `ui.render`: a union discriminated by `component`, one member
  445. RenderInputOf type One `ui.render` input, for a component narrowed to one surface.
  446. RenderNode type A node of a render tree: an element, or a string (text).
  447. RenderPropsOf type The plain-data props of each renderable component, as `ui.render` sees
  448. RenderResultOf type What a `ui.render` hook returns and what `next(e)` resolves to: a
  449. RenderSurface type Where a render event's component is drawn: `terminal` is Ink, which draws
  450. RenderViewport type The size of what a surface draws into, in character cells of the
  451. ResolveInput type The input of `ui.resolve`: which surface's elements, for which component;
  452. ResolveInputOf type One `ui.resolve` input, for a component on one surface.
  453. ResultOf type What each event's hook returns, and what its `next(e)` resolves to, by event
  454. SDKAssistantMessageError type
  455. Select type The members of `T` assignable to `S`; all of `T` when none is.
  456. Selected type The events a pattern selects, as a union of names: the one named, every
  457. Selection type The literal each tag key of `I` is held to by matcher `M`: one-of arrays
  458. SelectOption type One option of a `Select`: the value `onSelect` and `ui.select` carry, and
  459. SelectProps type The props of `Select`, every surface's one-of-several picker: an address,
  460. SessionAttachInput type The input of `session.attach`: a surface joined the session's roster of
  461. SessionAttachResult type What a `session.attach` hook returns and what `next(e)` resolves to:
  462. SessionAuthorization type What `$.session.authorize()` answers: an opaque handle for the session's
  463. SessionCompactArgs type `session.compact`'s input as a plugin's `$.session.compact(args)` takes
  464. SessionCompacted type A compaction that stands: the conversation as it reads afterwards, and
  465. SessionCompactInput type The input of `session.compact`: one compaction of the conversation, about
  466. SessionCompactResult type What a `session.compact` hook returns and what `next(e)` resolves to: the
  467. SessionCompactSkipped type A compaction vetoed: on `precompute` nothing is computed or kept; on any
  468. SessionCompactTrigger type Who compacts: the person's `/compact` (`manual`), the engine at its
  469. SessionContextBreakdown type The context window broken down as /context breaks it down: the rows, the
  470. SessionContextUsage type The live context window as the status line reads it, and by category as
  471. SessionCost type What the session has cost, as `/cost` and the status line total it.
  472. SessionCronSummary type
  473. SessionDetachInput type The input of `session.detach`: a client left the session's roster. Every
  474. SessionDetachReason type Why a client left the roster: `detach`, it said so (ui_detach); `end`, the
  475. SessionDetachResult type What a `session.detach` hook returns and what `next(e)` resolves to:
  476. SessionEndHookInput type
  477. SessionEndInput type The input of `session.end`: the session is ending, why, and how to come back
  478. SessionEndReason type Why the session ended: the classic SessionEnd hook's own `reason`, word for
  479. SessionEndResult type What a `session.end` hook returns and what `next(e)` resolves to:
  480. SessionMeasureInput type The input of `session.measure`: what `$.session.usage()` answers at this
  481. SessionMeasureResult type What a `session.measure` hook returns and what `next(e)` resolves to:
  482. SessionMessage type One message of the transcript as `$.session.messages()` returns it.
  483. SessionRateLimit type One rate-limit window as the rate-limit notices read it.
  484. SessionReceiveEvent type An external-event wake the delivery's text parsed as (a GitHub relay
  485. SessionReceiveInput type The input of `session.receive`: one inbound delivery (a relay's event, a
  486. SessionReceiveOrigin type Where an inbound delivery came from, as the bridge classified it from the
  487. SessionReceiveResult type What a `session.receive` hook returns and what `next(e)` resolves to: the
  488. SessionRepo type What `$.session.repo()` answers: the repository's root and its origin remote,
  489. SessionResume type How to come back to the session that ended: what `claude --resume` takes.
  490. SessionStartHookInput type
  491. SessionStartInput type The input of `session.start`: the session the process starts with, read the
  492. SessionStartResult type What a `session.start` hook returns and what `next(e)` resolves to:
  493. SessionUsage type What `$.session.usage()` answers: the context window's fill, the account's
  494. SessionUsageArgs type What `$.session.usage(args)` takes: nothing for the status line's figures
  495. Settings type What `$.settings.read` answers: an object keyed as a settings.json is
  496. SettingsReadArgs type What `$.settings.read(args)` takes.
  497. SettingsSource type One source of settings by the name a plugin gives it, lowest precedence
  498. SetupHookInput type
  499. SiteScroll type Where a site's window sits over the tree a hook drew in it (a pane's body,
  500. SiteView type Which transcript the person has on screen where a site draws: the main
  501. SkillPromptInput type The input of `skill.prompt`: one skill's prompt, at the moment the engine
  502. SkillPromptResult type What a `skill.prompt` hook returns: the text the model reads for that
  503. SleepOptions type Options of `$.clock.sleep`.
  504. SpeakOptions type Options of `$.audio.speak`.
  505. SpeakRequest type The argument of `$.audio.speak(text, options)` as the event carries it.
  506. SpeakResult type What `$.audio.speak` resolves with once the utterance has ended.
  507. StarNext type `next` in a `*` hook: the set of events is open at runtime, so `e` is
  508. StopFailureHookInput type
  509. StopHookInput type
  510. StreamHook type The hook a streaming event takes: `async function* ($, e, next) {}`,
  511. StreamHookBody type What a hook on a streaming event evaluates to: the async generator an
  512. StreamingEventName type The events that stream: their hooks are async generators, `next(e)` is
  513. StreamNext type The rest of the chain as a hook on a streaming event receives it: Next,
  514. StyledElement type The shape a `Box` and a `Text` share in a render tree: allowlisted props,
  515. SubagentStartHookInput type
  516. SubagentStopHookInput type
  517. SvgProps type The props of `Svg`, the remote surfaces' vector leaf: the markup is the
  518. TagKeys type The keys of `I` a matcher may select variants by: literal-valued in every
  519. TargetTier type A tier `next.to(e, tier)` may name: one a floor can reach past a tier of
  520. TaskCompletedHookInput type
  521. TaskCreatedHookInput type
  522. TeammateIdleHookInput type
  523. TextHoverProps type The `Text` props a `hover` may override (its colors and styles, not its
  524. TextProps type The props of `Text`: the color and style props of Ink's Text a tree may
  525. Tier type One of the chain's five tiers (TIERS), outermost first; on every
  526. TIERS const The chain's five tiers, outermost first: earlier is outer is more
  527. Timer type A pending timer from `$.clock.after` / `$.clock.every`.
  528. TimerCall type A timer on `$.clock` (`after`, `every`): `fn` runs after `ms` milliseconds,
  529. ToastOptions type Options of `$.ui.toast`.
  530. ToolCallArgs type `tool.call`'s input as the call takes it: `tool_use_id` and `agentId` may
  531. ToolCallEnvelope type The envelope the two tool events share: the tool, the id of this call, and
  532. ToolCallInput type The input of `tool.call`: the tool, the id of this call, the tool's
  533. ToolCallOverloads type `$.tool.call(input)`: resolves with `result` typed for the tool `input`
  534. ToolCallReserved type The keys `tool.call`'s input carries beside the tool's own arguments, none
  535. ToolCallResult type What a `tool.call` hook returns and what `next(e)` and `$.tool.call(input)`
  536. ToolCheckArgs type `tool.check`'s input as `$.tool.check` takes it: the tool and its
  537. ToolCheckDecision type The verdict of `tool.check`: run the tool, put it to the mode's decider
  538. ToolCheckInput type The input of `tool.check`: the tool, its arguments, and the call's id when
  539. ToolCheckResult type What a `tool.check` hook returns and what `next(e)` resolves to: the
  540. ToolDeferral type Where a `tool.describe` answer places the tool: `true` behind ToolSearch
  541. ToolDescribeInput type The input of `tool.describe`: one tool's description, at the moment the
  542. ToolDescribeResult type What a `tool.describe` hook returns: the description the model sees for that
  543. ToolEnvelope type `{ tool, tool_use_id, ...args }` as one flat object type, generic over
  544. ToolGroupCall type One tool call of a ToolGroup, as `ui.render` sees it under `calls`.
  545. ToolInfo type One tool as `$.tool.list()` returns it.
  546. ToolInputOf type `{ tool, tool_use_id, ...args }` as one flat object type.
  547. ToolNamed type An input that names its tool as the literal `T`: what `next` and
  548. ToolResultOf type The structured result of the tool named `Name`: its BuiltinToolResults
  549. ToolResultSummary type One tool_result block of a user message.
  550. ToolSpec type What `$.tool.register` takes.
  551. ToolUseSummary type One tool_use block of an assistant message, with its outcome once the
  552. TraceEntry type One settled run of a link beneath the caller, as `next.trace` lists it:
  553. TraceOutcome type What the chain decided for one link, as `next.trace` names it.
  554. TurnCompleteFields type What every `turn.complete` carries whatever its reason: the answer, the
  555. TurnCompleteInput type The input of `turn.complete`: the assistant's final message of a turn, at
  556. TurnCompleteReason type Why a turn ended: the model answered, the user interrupted it, the model
  557. TurnCompleteRefused type The end of a turn the model refused with no fallback model to retry on:
  558. TurnCompleteResult type What a `turn.complete` hook returns and what `next(e)` resolves to:
  559. TurnCompleteUnrefused type The end of a turn that was not a refusal: answered, interrupted, or dead
  560. TurnRefusal type What the API said about a refusal that ended a turn: the classifier's
  561. TurnStartInput type The input of `turn.start`: the prompt a model turn begins with, after
  562. TurnStartResult type What a `turn.start` hook returns and what `next(e)` resolves to:
  563. TurnStepChunk type One piece of a `turn.step` response as it streams through the chain:
  564. TurnStepEngineChunk type An item of the engine's stream the other chunk kinds do not model (the
  565. TurnStepInput type The input of `turn.step`: one model request inside a turn, at the moment
  566. TurnStepInputChunk type A piece of a tool call's arguments as they arrive: JSON text, partial,
  567. TurnStepResult type What a `turn.step` hook returns and what `next(e)` resolves to: the
  568. TurnStepStopChunk type The response is whole: why the model stopped and what the request cost,
  569. TurnStepTextChunk type A piece of the response's visible text as it arrives, in block `index`.
  570. TurnStepThinkingChunk type A piece of the model's thinking as it arrives, in block `index`: what
  571. TurnStepToolChunk type The model begins a tool call in block `index`: the tool's name and the
  572. TurnStepToolUse type One tool call the model asked for in a step: the tool's name and its
  573. TurnStopReason type Why the model stopped, as a `turn.step` result and its stop chunk carry
  574. TurnUsage type What a model turn, or one response inside it, cost as the API reported it:
  575. UiBlitArgs type What a plugin's `$.ui.blit(args)` takes: a Raster's next `cells`
  576. UiBlitResult type What `$.ui.blit` resolves to and what a `ui.blit` hook's `{ value }`
  577. UiFocusArgs type What a plugin's `$.ui.focus(args)` takes: one of its own elements, by the
  578. UiFocusComponent type The render components whose site keeps a focus ring: a pane's body and
  579. UiFocusInput type The input of `ui.focus`: a site's focus ring about to move onto one of the
  580. UiFocusOrigin type Who moves the ring at `ui.focus`, as the engine stamps it where the move
  581. UiFocusResult type What a `ui.focus` hook returns, what `next(e)` resolves to, and what
  582. UiInputArgument type The argument of `ui.input`: a change of, or a submit from, an `Input` a
  583. UiInputResult type What a `ui.input` hook returns and what `next(e)` resolves to.
  584. UiLogOptions type Options of `$.ui.log`.
  585. UiLogSink type Where a `$.ui.log` line goes: `transcript`, a dim row of its own (and the
  586. UiMessageArgument type The argument of `ui.message`: what a `Client` instance's surface module
  587. UiMessageResult type What a `ui.message` hook returns and what `next(e)` resolves to.
  588. UiPane type One of this plugin's open panes as `$.ui.panes()` lists it: the pane's
  589. UiPressArgument type The argument of `ui.press`: a press on a `Button` a render hook drew, or
  590. UiPressResult type What a `ui.press` hook returns and what `next(e)` resolves to.
  591. UiScrollArgs type What a plugin's `$.ui.scroll(args)` takes: what to bring into view, in
  592. UiScrollBlock type Where in its scrollable a revealed row lands, as the DOM's
  593. UiScrollComponent type The render components whose site the engine scrolls: a pane's body and
  594. UiScrollInput type The input of `ui.scroll`: a site's window asked to move over the tree a
  595. UiScrollOrigin type Who moves the window at `ui.scroll`, as the engine stamps it where the
  596. UiScrollPointer type The cell the pointer was over when the person's wheel raised `ui.scroll`,
  597. UiScrollResult type What a `ui.scroll` hook returns, what `next(e)` resolves to, and what
  598. UiScrollTarget type What `$.ui.scroll` brings into view: never a row number, always a thing
  599. UiSelectArgument type The argument of `ui.select`: a pick from a `Select` a render hook drew.
  600. UiSelectResult type What a `ui.select` hook returns and what `next(e)` resolves to.
  601. UnionToIntersection type The intersection of a union's members (`A | B` to `A & B`), by inferring
  602. UsageUnit type One unit of what `$.session.usage()` answers, by its key there: the
  603. UserMessageFrom type Who sent the message a `UserMessage` row carries, when someone other than
  604. UserMessageTask type The background task a `UserMessage` notification row reports on: a
  605. UserPromptExpansionHookInput type
  606. UserPromptSubmitHookInput type
  607. ValueOrDeny type The result of a call on `$` as the hooks on its event see it: `{ value }`,
  608. WorktreeCreateHookInput type
  609. WorktreeRemoveHookInput type
  610. h const The JSX factory (classic runtime, `@jsx h`; the engine prepends the
  611. Fragment const `<>...</>`: a column Box around the children.
  612. JSX namespace JSX over the element table: every tag is a constructor from
  613. AbortSignal interface
  614. AbortController interface
  615. TextEncoder interface
  616. TextDecoder interface
  617. URLSearchParams interface
  618. URL interface
  619. atob function
  620. structuredClone function
  621. AsymmetricMatcher type A value that matches by a rule inside `toEqual` and its kin
  622. AsyncMatchers type The same checks on what a promise received settles with, each resolving
  623. ClientScope type Which `Client` of a mounted drawing an act or a read means, by the `key`
  624. Constructor type A class, as `toThrow`, `toBeInstanceOf` and `expect.any` take it.
  625. describe const A group of tests: its name leads the title of each test declared inside,
  626. ElementOfAct type The element each surface-dependent act of a mounted drawing reaches: a
  627. ElementQuery type What a mounted drawing's `find` and `findAll` match an element on, every
  628. Engine type What a test holds as `$`, the engine's own: every call on it is made as
  629. EngineCall type One call on the engine's `$`: the event's input whole, as an engine call
  630. EngineMount type A surface drawing a component instance through the plugins, then driven
  631. EngineNoun type One noun of the engine's `$`: each of its events as the engine calls it,
  632. EngineNounEvent type The events of one noun a test's `$` carries: every one but `ui.resolve`,
  633. EnginePress type A surface pressing a Button a test rendered, or a Markdown's link: the
  634. Expect type The checks on a value (`expect(received)`), and with them the matchers
  635. expect const Checks a value: `expect(received).toEqual(expected)` throws an
  636. Expectation type What `expect(received)` answers: the checks, their negation, and the
  637. Expecting type `expect(received, message?)`: the checks on a value, a message of the
  638. FoundElement type One element of a mounted drawing as `find` returns it: the description
  639. Matchers type The checks `expect(received)` offers; each throws an AssertionError when
  640. Matching type The matchers that stand inside an expected value, each matching received
  641. Mock type The world beneath the plugins, mocked noun by noun: each member registers
  642. mock const The world beneath the plugins, mocked noun by noun: `mock.clock`,
  643. MockClock type The clock `mock.clock` hands back: the time its hooks answer, and the only
  644. MockClockOptions type Where a mocked clock starts: `now`, in milliseconds (0 when not given).
  645. Mounted type A drawing of component `C` the test mounted on surface `P`: reads over its
  646. MountedMembers type Every member a mounted drawing of component `C` can have; `Mounted<P, C>`
  647. MountInputTarget type What a mounted drawing's `input` takes: the Input's key, the text, which
  648. MountKeyEvent type What a mounted drawing's `key` takes: the key as a `Client`'s `onKey`
  649. MountPointerEvent type What a mounted drawing's `pointer` takes: the event as a `Client`'s
  650. MountPressTarget type What a mounted drawing's `press` takes: the Button's key, another
  651. MountResizeTarget type What a mounted drawing's `resize` takes: a `Client` region's size in
  652. MountSelectTarget type What a mounted drawing's `select` takes: the Select's key, the picked
  653. MountTarget type What `$.ui.mount` takes: whose elements the test will act on, the surface
  654. Negatable type A set of checks and, under `not`, the same set passing where they fail.
  655. Plugin type Written inline in a test and loaded as a plugin folder is: its name, the
  656. PluginTier type A tier a plugin loads in: every tier but the engine's own.
  657. PressTarget type What `$.ui.press` takes: the plugin whose `ui.render` hook drew the element,
  658. test const One test: it passes when its body returns or resolves, and fails when it
  659. TestBody type A test: the engine's `$`, and `on`, a plugin's registrar, whose hooks sit
  660. TestOptions type What `test` takes beside its name: the inline plugins it loads beside the
  661. TestRest type What follows a test's name: its body, or its options then its body.
  662. ThrowExpectation type What `toThrow` compares the thrown error with: a substring or pattern of
  663. tier const Says which tier the plugin under test loads in, once, at the top of the
  664. WithMessage type An error-like value `toThrow` compares by its whole message.

The three pages

  1. 01 The engine · 69 verbs Every noun and verb on $, with its signature, its parameters and the example the declarations carry.
  2. 02 Events · 71 events Every event a hook can be registered for, with the payload it arrives with and the result it may return.
  3. 03 Types · 505 declarations Every declaration in the file, verbatim, with the doc comment above it.

What the file says about itself

Claude Code writes the declarations with an introduction at the top, and this is it, reproduced as it ships. It is the only guidance shipped with the surface.

EARLY ACCESS: this surface may change between releases without notice. Written by `/plugin-types`; regenerate with that command after an update rather than editing. The first line names the Claude Code version that wrote it. TypeScript 5.4 or newer reads it. `claude plugin validate <dir>` is the other half: it reads a plugin's manifest and its hooks module's source the way the engine will and reports what the module hooks and calls and everything the engine would refuse, before any session loads it.

What is here: the module a hooks module may import types from,

import type { Register, On, EngineInterface } from 'claude-code'

(at run time the import is empty), and the globals a hooks module has: `h` and `Fragment` (what JSX compiles against), the JSX namespace, and the environment's web APIs (URL, TextEncoder, AbortController, crypto.subtle, ...). A hooks module runs in an environment of its own: no DOM, no Node. The module, and every file it imports from the plugin, is named .ts, .tsx, .jsx, .js, .mjs, .cjs, .mts or .cts (a file named otherwise is not loaded) and is an ES module whatever its suffix: there is no `require`. The elements a render hook draws with (`Box`, `Text`, `Button`, ...) are not globals: they come from the surface's table,

const { Box, Text } = $.ui.resolve(e)

Also here: 'claude-code/testing', the kit a plugin's *.test.ts and *.test.tsx files import under `claude plugin test <dir>`, which runs each in an environment like the one a plugin's hooks run in (no fs, network or process), the plugin loaded from the folder by the engine's own host: `test(name, async ($, on) => { ... })`, where `$` is the engine's own and the hooks `on` registers sit beneath every plugin; with describe, expect, tier, and `mock`, whose clock, store and env answer those nouns beneath the plugins from memory. `$.ui.mount` draws a component through the plugin on the surface the test names (terminal, desktop, vscode or mobile: never assumed) and hands back the drawing to read and act on by key: find an element, press a Button, type into an Input, drive a `Client`'s module (keys, pointer, posts, its frame clock), each act typed by that surface's element table, so one test body run over several surfaces covers the mod's hooks and description on each. It exercises the mod (its hooks, the tree they return under each surface's rules, its `Client` modules), never a surface's paint (Ink's, the desktop page's):

test('notes add up on every surface that takes input', async $ => {
  for (const surface of ['terminal', 'desktop'] as const) {
    const ui = await $.ui.mount({ plugin: 'notes', surface, ...BAND })
    await ui.input({ key: 'new', text: 'milk' })
    expect((await ui.find({ key: 'count' }))?.text).toBe('1 note')
    await ui.key({ key: 'down', in: 'list' })
    await ui.unmount()
  }
  for (const surface of ['terminal', 'desktop', 'vscode', 'mobile'] as const) {
    const ui = await $.ui.mount({ plugin: 'notes', surface, ...HINT })
    expect(await ui.find({ type: 'Text', text: /notes/ })).toBeDefined()
    await ui.press({ key: 'dismiss' })
  }
})

Typing a plugin against it:

export const register: Register = (on, options) => { ... }

or, in a .js module,

/** @type {import('claude-code').Register} */
export const register = (on, options) => { ... }

A tsconfig.json (or jsconfig.json) that fits a hooks module:

{
  "compilerOptions": {
    "target": "es2023", "lib": ["es2023"], "types": [],
    "module": "esnext", "moduleResolution": "bundler",
    "strict": true, "noUncheckedIndexedAccess": true,
    "noEmit": true, "skipLibCheck": true,
    "jsx": "react", "jsxFactory": "h", "jsxFragmentFactory": "Fragment"
  },
  "include": [".claude/types", "hooks", "tests"]
}

".claude/types" is where /plugin-types writes this file and, beside it, claude-code-mcp.d.ts and claude-code-plugins.d.ts, the index of the enabled plugins' type contracts, each copied to claude-code-plugins/ <plugin>.d.ts: what a plugin adds to `$` in engine.create, so a plugin you depend on is typed with nothing copied (the include above takes the whole folder). "hooks" is the plugin's hooks/ folder and "tests" its test files. `lib` names no DOM: the environment has none, and its `Text` would shadow the element.

A plugin that adds a noun to `$` ships its own contract: a .d.ts its plugin.json names as "types", exporting the noun's types at its top level and declaring the noun on the engine's interface,

export type Topo = { ... }
declare module 'claude-code' {
  interface EngineInterface { topo: Topo }
}

with no import or reference, its exported names led by the noun's PascalCase name; the plugin's own hooks module imports them from it.

Where this comes from

Claude Code carries its own type declarations for the hooks runtime, and /plugin-types writes them into a project. They are not in the npm package as a file and not in the JavaScript bundle either: the command decompresses an asset embedded in the binary. So documenting the surface used to mean installing a build and running a slash command by hand, which is why nobody did it twice.

The release pipeline reads that asset straight out of the binary it already downloads, parses it, and writes a JSON document beside the rest of the release data. This section renders that document. Which means it is never a release behind, and nobody has to remember anything.

The prose about how to use any of this, what the calls cost, and which ones do not behave the way their shape suggests is the Mods Guide. This section is the inventory.

Mined from build 2.1.278 on 19 Sep 2026 . The declarations are Claude Code's own writing about itself, reproduced here; everything around them is this site's.