Follow Discord
Sweep 06 Nov 2026 · 01:32Z Build v2.1.319 537 read Stable v2.1.311 Latest v2.1.318 Next v2.1.319 Feeds RSS JSON llms.txt llms-full.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. Anthropic's Mods reference covers the same surface a table at a time. This is every declaration in full, 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.

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

Symbols866every one, in the index below
Mined from2.1.319the shipped binary
Machine readableapi.jsonin pages, sized for an agent's fetch; api-full.json is the whole document
What changed

v2.1.319

+9 added · 4 removed · 3 changed · 3 docs only 5 may break Every release since v2.1.259
  1. TypesEvery declaration in the file, verbatim, with the doc comment above it.
  2. ToastOptions type Options of $.ui.toast.
  3. ToolCallArgs type tool.call's input as the call takes it: tool_use_id and agentId may ride along (a hook passing its event's input on) and are dropped.
  4. ToolCallEnvelope type The envelope the two tool events share: the tool, the id of this call, and the tool's arguments spread beside them (e.command for Bash).
  5. ToolCallInput type The input of tool.call: the tool, the id of this call, the tool's arguments beside them (e.command for Bash), and agentId in a subagent.
  6. ToolCallOverloads type $.tool.call(input): resolves with result typed for the tool input names (ToolCallResult), or loosely for an input that names none literally.
  7. ToolCallReserved type The keys tool.call's input carries beside the tool's own arguments, none of which the tool sees (the engine strips them before the tool runs).
  8. ToolCallResult type What a tool.call hook returns and what next(e) and $.tool.call(input) resolve to: the tool's result ({ result, context? }) or { deny }.
  9. ToolCheckApprover type Who answers the asks of a tool.check evaluation.
  10. ToolCheckArgs type tool.check's input as $.tool.check takes it: the tool and its arguments; the call's id, agentId, ceiling, approver and isReadOnly are the engine's to set.
  11. ToolCheckDecision type The verdict of tool.check: run the tool, put it to the mode's decider (the dialog, the auto-mode classifier, a headless host) or, a hook's ask, to a person, or refuse it.
  12. ToolCheckInput type The input of tool.check: the tool, its arguments, the organization's ceiling if it set one, and on a real call its id and the loop's agentId.
  13. ToolCheckResult type What a tool.check hook returns and what next(e) resolves to: the verdict, why, and what stands behind it, never who answers it.
  14. ToolDeferral type Where a tool.describe answer places the tool: true behind ToolSearch (its schema loads when the model asks for it), false in the prompt's list.
  15. ToolDescribeInput type The input of tool.describe: one tool's description, at the moment the engine first renders the tool's schema for the model.
  16. ToolDescribeResult type What a tool.describe hook returns: the description the model sees for that tool and, when the hook moves it, where the tool waits (ToolDeferral).
  17. ToolEnvelope type { tool, tool_use_id, ...args } as one flat object type, generic over the tool name and its parsed arguments.
  18. ToolGroupCall type One tool call of a ToolGroup, as ui.render sees it under calls.
  19. ToolInfo type One tool as $.tool.list() returns it.
  20. ToolInputOf type { tool, tool_use_id, ...args } as one flat object type.
  21. ToolNamed type An input that names its tool as the literal T: what next and $.tool.call read to type the call's result per tool (NextResultFor).
  22. ToolRequestMeta type What a tool.call hook sets for the request of an MCP server's tool.
  23. ToolResultOf type The structured result of the tool named Name: its BuiltinToolResults entry for a built-in tool, else unknown.
  24. ToolResultSummary type One tool_result block of a user message.
  25. ToolSpec type What $.tool.register takes.
  26. ToolUseSummary type One tool_use block of an assistant message, with its outcome once the transcript holds the call's tool_result (paired by tool_use_id).
  27. TraceEntry type One settled run of a link beneath the caller, as next.trace lists it: data, not a handle.
  28. TraceOutcome type What the chain decided for one link, as next.trace names it.
  29. TurnCompleteFields type What every turn.complete carries whatever its reason: the answer, the duration, the interrupt flag, the turn's id, its loop and what it cost.
  30. TurnCompleteInput type The input of turn.complete: the assistant's final message of a turn, at the moment the turn ends (where the turn's duration is reported).
  31. TurnCompleteReason type Why a turn ended: the model answered, the user interrupted it, the model refused with no fallback model to retry on, or an API error ended it.
  32. TurnCompleteRefused type The end of a turn the model refused with no fallback model to retry on: what the API said of the refusal rides along.
  33. TurnCompleteResult type What a turn.complete hook returns and what next(e) resolves to: { text }; a text other than a main-loop answer's is shown beneath it.
  34. TurnCompleteUnrefused type The end of a turn that was not a refusal: answered, interrupted, or dead on an API error (retries exhausted, the context limit), nothing more.
  35. TurnRefusal type What the API said about a refusal that ended a turn: the classifier's category and its explanation, each null when the API sent none.
  36. TurnStartInput type The input of turn.start: the prompt a model turn begins with, the main loop's or a subagent's or teammate's run (agentId).
  37. TurnStartResult type What a turn.start hook returns and what next(e) resolves to: { turnId }, echoed by core; a hook's own value does not change the turn.
  38. TurnStepChunk type One piece of a turn.step response as it streams through the chain: what a hook's next(e) yields and what the hook yields up in turn.
  39. TurnStepEngineChunk type An item of the engine's stream the other chunk kinds do not model (the envelope, a block's start and end, a retry marker), opaque by ref.
  40. TurnStepInput type The input of turn.step: one model request inside a turn, at the moment the engine is about to send it; the bottom of the chain sends it.
  41. TurnStepInputChunk type A piece of a tool call's arguments as they arrive: JSON text, partial, for the tool chunk of the same index.
  42. TurnStepResult type What a turn.step hook returns and what next(e) resolves to: the model's response to the step's request, once its blocks are all in.
  43. TurnStepServerToolUse type One tool call of a step that the API ran itself, inside the request (the advisor is one): the engine ran nothing for it.
  44. TurnStepStopChunk type The response is whole: why the model stopped and what the request cost, as the step's result will carry them. The last chunk of one response.
  45. TurnStepTextChunk type A piece of the response's visible text as it arrives, in block index.
  46. TurnStepThinkingChunk type A piece of the model's thinking as it arrives, in block index: what the person sees of it live.
  47. TurnStepToolChunk type The model begins a tool call in block index: the tool's name and the call's id; its arguments follow as input chunks of the same index.
  48. TurnStepToolUse type One tool call the model asked for in a step: the tool's name and its arguments.
  49. TurnStopReason type Why the model stopped, as a turn.step result and its stop chunk carry it: one of the API's stop reasons, or null when no response arrived.
  50. TurnUsage type What a model turn, or one response inside it, cost as the API reported it: the four token counts (ModelUsage) and the model's id.
  51. UiBlitArgs type What a plugin's $.ui.blit(args) takes: a Raster's next cells (RasterBlitArgs) or a keyed Image's next source (ImageBlitArgs).
  52. UiBlitResult type What $.ui.blit resolves to and what a ui.blit hook's { value } holds: {} once the cells or source are the next frame's, or why not.
  53. UiCopyArgs type The argument of $.ui.copy and the input of ui.copy: the text, and which surface's clipboard takes it, the caller's choice.
  54. UiCopyResult type What $.ui.copy resolves to and what a ui.copy hook's { value } holds: whether the text reached a clipboard (isCopied), else why not.
  55. UiFaultInput type The input of ui.fault: a Client this plugin drew failed on a surface, addressed by where the instance is drawn.
  56. UiFaultPhase type When a Client failed, as ui.fault names it; a closed set a matcher narrows on.
  57. UiFaultResult type What a ui.fault hook returns and what next(e) resolves to: {}, the fault was heard.
  58. UiFocusArgs type What a plugin's $.ui.focus(args) takes: one of its own elements, by the key it drew it under, in one of its sites that holds the keyboard now.
  59. UiFocusComponent type The render components whose site keeps a focus ring: a pane's body and the band above the prompt, each a ring over the elements hooks drew there.
  60. UiFocusInput type The input of ui.focus: a site's focus ring about to move onto one of the elements a hook drew in it (a Button, Input or Select), or off them.
  61. UiFocusOrigin type Who moves the ring at ui.focus, as the engine stamps it where the move starts; a closed set a matcher narrows on.
  62. UiFocusResult type What a ui.focus hook returns, what next(e) resolves to, and what $.ui.focus hands back: {} once the ring moved, or why it did not.
  63. UiInputArgument type The argument of ui.input: a change of, or a submit from, an Input a render hook drew. Flat and frozen like every event's.
  64. UiInputResult type What a ui.input hook returns and what next(e) resolves to.
  65. UiLogOptions type Options of $.ui.log.
  66. UiLogSink type Where a $.ui.log line goes: transcript, a dim row of its own (and the debug log, as every line); debug, the debug log alone, nothing on screen.
  67. UiMessageArgument type The argument of ui.message: what a Client instance's surface module posted (surface.post(data)), addressed by where the instance is drawn.
  68. UiMessageResult type What a ui.message hook returns and what next(e) resolves to.
  69. UiNotifyResult type What $.ui.notify resolves to and what a ui.notify hook's { value } holds: whether a channel sent it (isSent) and which, else why not.
  70. UiOpenResult type What $.ui.open resolves to and what a ui.open hook's { value } holds.
  71. UiPane type One of this plugin's open panes as $.ui.panes() lists it: the pane's id and title, and where it stands with the person right now.
  72. UiPlaceArgs type The argument of $.ui.place.
  73. UiPlaceResult type What $.ui.place resolves to and what a ui.place hook's { value } holds.
  74. UiPressArgument type The argument of ui.press: a press on a Button a render hook drew, or on an answered Markdown link. Flat and frozen like every event's.
  75. UiPressResult type What a ui.press hook returns and what next(e) resolves to.
  76. UiScrollArgs type What a plugin's $.ui.scroll(args) takes: what to bring into view, in which of its sites, and where in the window it lands.
  77. UiScrollBlock type Where in its scrollable a revealed row lands, as the DOM's scrollIntoView({ block }) names it.
  78. UiScrollComponent type The render components whose site the engine scrolls: a pane's body and the band above the prompt, each a window over the tree a hook drew there.
  79. UiScrollInput type The input of ui.scroll: a site's window asked to move over the tree a hook drew in it (a pane's body, the band above the prompt).
  80. UiScrollOrigin type Who moves the window at ui.scroll, as the engine stamps it where the move starts; a closed set a matcher narrows on.
  81. UiScrollPointer type The cell the pointer was over when the person's wheel raised ui.scroll, in the site's body: the box its ui.render hook draws into, as painted.
  82. UiScrollResult type What a ui.scroll hook returns, what next(e) resolves to, and what $.ui.scroll hands back: {} once the window moved, or why it did not.
  83. UiScrollTarget type What $.ui.scroll brings into view: never a row number, always a thing drawn somewhere.
  84. UiSelectArgument type The argument of ui.select: a pick from a Select a render hook drew. Flat and frozen like every event's.
  85. UiSelection type What the person has selected on screen, as $.ui.selection() answers it: the text, and the transcript row it lies in when it lies in one.
  86. UiSelectResult type What a ui.select hook returns and what next(e) resolves to.
  87. UiViewResult type What $.ui.view hands back and what a ui.view hook's { value } holds: {} once the main view shows what was asked, or why it does not.
  88. UndeclaredAttachmentInput type One prompt.attachment input of every other type, the ones PromptAttachmentDetailOf does not name: the attachment's text alone.
  89. UnionToIntersection type The intersection of a union's members (A | B to A & B), by inferring one parameter type from the contravariant positions.
  90. UpdateFunction type update($, target, fn): reads the value, applies fn here in the plugin's environment, writes with ifVersion, and tries again on a miss.
  91. UsageUnit type One unit of what $.session.usage() answers, by its key there: the context window's fill, the rate-limit windows, the session's cost.
  92. UserMessageFrom type Who sent the message a UserMessage row carries, when someone other than the person did: another agent, a teammate, another session, a channel.
  93. UserMessageTask type The background task a UserMessage notification row reports on: a subagent, a background shell, a workflow, a remote agent, a monitor.
  94. UserPromptExpansionHookInput type
  95. UserPromptSubmitHookInput type
  96. ValueOrDeny type The result of a call on $ as the hooks on its event see it: { value }, the call's answer, or { deny }, the reason the caller's promise rejects.
  97. WorktreeCreateHookInput type
  98. WorktreeRemoveHookInput type
  99. atom const A named value with its initial: read answers the initial while nothing is written, so never undefined. Pure; runs in the plugin's environment.
  100. derive const A value computed from atoms and references, cached by their versions.
  101. memberOf const A family's member for the instance being drawn, keyed by e.requestId.

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. Until Anthropic published their mods docs with 2.1.287, it was the only guidance that came with the surface.

EARLY ACCESS: this surface may change between releases without notice. Written by the engine each time it loads a mod from a folder the person owns, beside that mod as .claude-plugin/types/claude-code/index.d.ts; written again after an update rather than edited. 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`. A file of the plugin is imported with an `import` declaration. A module holding `import()` does not load. 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-plugin/types", "hooks", "types", "tests"]
}

".claude-plugin/types" is where the engine lays this file (claude-code/) and, beside it, this build's built-in tools (claude-code-tools/), the MCP tools connected when the mod last reloaded (claude-code-mcp/) and one entry per plugin the mod's plugin.json lists under "dependencies" (that plugin's own contract): what it 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, "types" its own contract and "tests" its test files. `lib` names no DOM: the environment has none, and its `Text` would shadow the element. A mod with no tsconfig of its own has these options without writing them: the engine gives it a tsconfig.json that extends .claude-plugin/types/tsconfig.json, which carries them with that folder as the one type root.

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. From 2.1.287 it writes them into .claude-plugin/types/ each time it loads a mod from --plugin-dir, and before that /plugin-types wrote them on request. They are not in the npm package as a file and not in the JavaScript bundle either: Claude Code decompresses an asset embedded in the binary. So documenting the surface used to mean installing a build and running it 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.319 on 6 Nov 2026 . The declarations are Claude Code's own writing about itself, reproduced here; everything around them is this site's.

Feedback