Every named declaration in the file, 833 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 22,468 lines of TypeScript mined from build 2.1.330. 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, 251 to 300 of 833
OpValueOf type
#
line 9144
In the first published surface (2.1.259) · changed in 2.1.260, 2.1.265, 2.1.267, 2.1.268, 2.1.269, 2.1.271, 2.1.274, 2.1.275, 2.1.277, 2.1.280, 2.1.281, 2.1.285, 2.1.288, 2.1.295, 2.1.299, 2.1.300, 2.1.301, 2.1.311, 2.1.314, 2.1.317, 2.1.319, 2.1.321, 2.1.326, 2.1.328
What each call on $ answers (the value of its event's result), by event name.
149 lines
export type OpValueOf = {
'model.complete': ModelCompleteResult;
'model.classify': string | undefined;
'model.fork': ModelForkResult;
'audio.play': void;
'audio.speak': SpeakResult;
'mcp.call': McpToolResult;
'mcp.connect': McpConnectResult;
'session.cwd': string;
'session.root': string;
'session.model': string;
'session.turns': number;
'session.id': string;
/**
* The conversation's messages, as rows or in Messages API form; `{ deny }`
* for an `agentId` the session cannot read or an `after` that is gone.
*/
'session.messages': SessionMessagesValue;
'session.repo': SessionRepo | null;
'session.surface': RenderSurface | null;
'session.surfaces': readonly RenderSurface[];
/**
* The credential handle, or null where the session holds no first-party
* credential (a third-party provider, a cloud gateway, no login or key).
*/
'session.authorize': SessionAuthorization;
/**
* How the session is signed in and, under a pin of its organization, as
* whom; or the refusal a hook answered in its place.
*/
'session.identity': SessionIdentity;
'session.usage': SessionUsage;
/**
* The engine's version, its release, and its build time when stamped.
*/
'session.version': SessionVersion;
'session.info': SessionInfo;
/**
* The machine as uname names it, and the developer tools on its PATH.
*/
'session.machine': SessionMachine;
'turn.abort': void;
/**
* The box as it stands; the empty box where the session draws none.
*/
'prompt.read': PromptBox;
/**
* Whether the runs were painted, and the box as it stands.
*/
'prompt.paint': PromptPainted;
'tool.list': ToolInfo[];
'tool.register': {
tool: string;
};
'command.list': CommandInfo[];
'command.register': {
command: string;
};
'config.list': ConfigRow[];
'agent.list': AgentInfo[];
'agent.limits': AgentLimits;
'agent.register': {
agent: string;
};
'agent.call': ToolCallResult;
'ui.toast': void;
'ui.status': void;
'ui.log': void;
'ui.notice': void;
'ui.invalidate': void;
/**
* Whether a surface draws the pane now, or why it waits undrawn.
*/
'ui.open': UiOpenResult;
'ui.close': void;
/**
* The calling plugin's open panes, placed then unplaced, in open order.
*/
'ui.panes': readonly UiPane[];
/**
* The row's id, or why nothing draws it.
*/
'ui.place': UiPlaceResult;
/**
* Its request id, or why nothing draws it.
*/
'theme.set': ThemeResult;
/**
* `isDrawn: false`, and whether a theme stood to be cleared.
*/
'theme.clear': ThemeResult;
/**
* What the person last selected; `undefined` when there is nothing.
*/
'ui.selection': UiSelection | undefined;
'ui.copy': UiCopyResult;
'ui.view': UiViewResult;
/**
* The channel that sent the notification, or why none did.
*/
'ui.notify': UiNotifyResult;
/**
* Whether a client was handed the cancel.
*/
'ui.cancelNotify': {
isSent: boolean;
};
'ui.blit': UiBlitResult;
/**
* The text; `{ base64 }` when asked for bytes.
*/
'fs.read': string | FsBytes;
'fs.write': void;
'fs.list': FsEntry[];
'fs.exists': boolean;
'fs.stat': FsStat;
'fs.ancestors': readonly FsAncestor[];
'store.get': unknown;
'store.set': void;
'store.delete': void;
'store.keys': string[];
/**
* The value and the version it stands at; `undefined` at 0 when never
* written.
*/
'state.get': StateRead;
/**
* Whether the write landed, and the version the value stands at now.
*/
'state.set': StateSetResult;
/**
* Milliseconds since the epoch.
*/
'clock.now': number;
'clock.sleep': void;
'clock.after': void;
'clock.every': void;
'http.fetch': HttpResponse;
'process.run': ProcessRunResult;
'process.spawn': ProcessSpawnResult;
'process.hookEnv': Record<string, string>;
'settings.read': Settings;
'env.get': string | undefined;
'env.set': EnvSetResult;
/**
* The bytes that compile; the caller is resolved the module they make.
*/
'wasm.compile': WasmBytes;
};
OrderedOverloads type
#
line 9300
Added in 2.1.265
One call signature per event in Names, intersected, the ambiguous ones (LateOverload) after the rest: next for a hook covering several events.
An empty group contributes nothing (Overloads<never> is unknown).
type OrderedOverloads<Names extends EventName> = Overloads<Exclude<Names, LateOverload>> & Overloads<Extract<Names, 'classic.PreToolUse'>> & Overloads<Extract<Names, 'turn.abort'>> & Overloads<Extract<Names, NoArgsEvent>>;
Origin type
#
line 9310
Added in 2.1.267 · changed in 2.1.268
Who raised a dispatch, as next.origin holds it: the calling plugin's name and the tier it sits in; the engine reads engine in core.
The same pair a next.trace entry names its link by, and an event's provider its subject's definer by. Set by the host from where the call came from and where that plugin was seated; nothing a plugin writes.
15 lines
export type Origin = {
/**
* Whose hook made the `$` call, by name; `"engine"` for a call site,
* `"client"` for a `Client` surface module's `ui.message` post,
* `"hook:<event>"` for a settings hook's own MCP call at `tool.check`: a
* plugin whose name starts with `hook:` loads no hooks.
*/
readonly plugin: string;
/**
* Where that plugin sits among the chain's tiers (Tier); `"core"` for the
* engine, the owning plugin's for a `client` post; for a settings hook,
* `"prepend"` where it is known as the organization's, else `"user"`.
*/
readonly tier: Tier;
};
Overloads type
#
line 9329
In the first published surface (2.1.259)
One call signature per event in Names, intersected into an overload set.
type Overloads<Names extends EventName> = UnionToIntersection<{
[N in Names]: (e: Args<N>) => Promise<NextResult<N>>;
}[Names]>;
PaneCloseArgs type
#
line 9337
Added in 2.1.265 · changed in 2.1.268
The argument of $.ui.close: the pane to close ({ id }). origin is the engine's to set: a plugin's call reads plugin at the hooks.
export type PaneCloseArgs = Omit<PaneCloseInput, 'origin'>;
PaneCloseInput type
#
line 9343
Added in 2.1.265 · changed in 2.1.268
The input of ui.close: the pane closing and why (PaneCloseOrigin). Closing an id that is not open does nothing.
export type PaneCloseInput = {
/**
* What `$.ui.open` named the pane; pinned: `next(e)` passes it on.
*/
id: string;
/**
* Who closes it, set by the engine: a hook that answers without `next`
* keeps the pane open on `plugin` and `person`, never on `unload`.
*/
origin: PaneCloseOrigin;
};
PaneCloseOrigin type
#
line 9362
Added in 2.1.265 · changed in 2.1.268
Why a pane closes, as the engine stamped it at ui.close.
unload drops a pane nothing draws any more (its plugin unloaded, or its drawing threw): it is gone before the hooks hear of it, and its opener's hooks do not run. next(e) passes the origin on as received; none sets it.
export type PaneCloseOrigin = {
/**
* `plugin`, a plugin's `$.ui.close`; `person`, the person's close mark or
* close key; `unload`, the engine's own.
*/
kind: 'plugin' | 'person' | 'unload';
};
PaneOpenArgs type
#
line 9380
Added in 2.1.265 · changed in 2.1.268, 2.1.271, 2.1.277, 2.1.311, 2.1.323
The argument of $.ui.open: which pane, its title, whether it asks the person's keyboard, its dialog manners, its size (rows, columns), its seat.
An open answering the person's input (a command or prompt they entered, a press) is placed at any width; one the plugin makes on its own waits undrawn below 144 terminal columns, 110 once they asked for that id (in this session or an earlier one, until they close the pane by hand), and the call resolves { isPlaced: false, reason } (UiOpenResult) saying so.
99 lines
export type PaneOpenArgs = {
/**
* Names the pane: 1-64 of letters, digits, `_` and `-`. One pane per id:
* opening an open id delivers the new title, never a second instance.
*
* Pinned at the hooks: `next(e)` passes it on; the title and focus rewrite.
*/
id: string;
/**
* The pane's tab while more than one pane is open (with one, no title is
* drawn), and the `title` its hook sees; the id when omitted.
*
* An unpaired surrogate half (a `.slice()` through an emoji) is drawn as
* U+FFFD; a control character is refused.
*/
title?: string;
/**
* A request, not a grant: the surface focuses (and raises) the pane only
* while the prompt has the keys over an empty composer.
*
* An element of the band or a pane the person holds, text in the
* composer, a dialog or a survey each refuse it: the pane opens without
* the keyboard.
*/
focus?: true;
/**
* While the pane holds the keyboard, the key that hands it back (Escape)
* also closes it as the person's close does: `ui.close`, origin `person`.
*
* So does Escape at an idle, empty prompt once the prompt has the keys
* again (the person typed, or `focus` was refused); over text, a turn, a
* dialog, a footer selection, a viewed agent or a prompt mode it is theirs.
*
* @remarks A hook may refuse that close and keep it open. Left out, Escape
* returns the keys and the pane stays. Each open sets it anew, as a title.
*/
closeOnEscape?: true;
/**
* While the pane is the one shown the surface holds every transient toast:
* each other plugin's `$.ui.toast` and the engine's own, as this plugin's.
*
* The toast stack is not drawn, its timers waiting; the notification line
* queues all but the engine's standing warnings, and one up as the pane opens
* may end unseen. After, the stack draws its newest few, the line one by one.
*
* @remarks For a dialog the person answers and leaves, not a pane that stays.
* Left out, toasts show. Every open sets it; a `ui.open` hook may drop it.
*/
holdToasts?: true;
/**
* What the surface paints under the pane's body while it is the one shown, as
* a Box takes it: a theme key, a raw color, or `"transparent"`.
*
* `"transparent"` paints nothing, so what lies behind the pane shows through;
* a color stops at the body. Left out, the surface's own look stands. Anything
* else is refused. Each open sets it anew; a `ui.open` hook may drop it.
*
* @remarks A request, not a grant: a surface with no counterpart for a theme
* key keeps its own look.
*/
backgroundColor?: Color;
/**
* The body rows the pane's content wants while seated inline above the
* prompt: it opens that tall, up to what the layout spares, not a third.
*
* A request, not a grant: a size the person dragged or keyed the block
* to wins, this session's or a kept one, and the dock ignores it. A
* positive whole number; left out, a third. Each open sets it anew.
*/
rows?: number;
/**
* The body columns the pane's content wants while docked beside a
* fullscreen transcript: the dock opens that wide, at most 45% of the
* terminal's columns and at least 24. Each open sets it anew.
*
* A request, not a grant: a width the person dragged or keyed the dock to,
* this session's or a kept one, wins under the same ceiling, and the
* inline block ignores it. A positive whole number; left out, the share.
*
* @example
* await $.ui.open({ id: "browser", focus: true, rows: 24, columns: 60 })
*/
columns?: number;
/**
* Asks that the pane start as a `"widget"`, the small form of a minimized pane
* on the desktop app; drawn so, its `Pane` props say `placement: "widget"`.
*
* A request: the surface decides, and the person can expand or minimize the
* pane afterwards. A surface with no widgets (the terminal, VS Code, a desktop
* app without them) opens the pane as if this were left out. Any other value
* is ignored.
*
* @remarks Each open sets it anew, but a surface is meant to read it only when
* it first shows the pane. A `ui.open` hook may set or drop it.
* @example
* await $.ui.open({ id: "ticker", placement: "widget" })
*/
placement?: 'widget';
};
Pattern type
#
line 9484
Added in 2.1.265
What on(pattern, hook) and next.is(pattern, e) take: an event's name, a glob (*, classic.*), or a negation of either (!tool.describe).
export type Pattern = EventName | Glob | Negation;
PatternOver type
#
line 9493
Added in 2.1.265
The patterns next.is takes in a hook covering the events N: their names, *, a glob over one of their namespaces, or a negation.
A name none of them has is a compile error, as is a glob over a namespace none is under; a negation that selects none of them narrows e to never.
type PatternOver<N extends EventName> = N | '*' | `${Namespace<N>}.*` | Negation;
PermissionBehavior type
#
line 9495
Added in 2.1.265
type PermissionBehavior = 'allow' | 'deny' | 'ask';
PermissionDeniedHookInput type
#
line 9497
Added in 2.1.265 · changed in 2.1.274
type PermissionDeniedHookInput = BaseHookInput & {
hook_event_name: 'PermissionDenied';
tool_name: string;
tool_input: unknown;
tool_use_id: string;
reason: string;
mcp_server?: McpServerProvenance;
};
PermissionMode type
#
line 9509
Added in 2.1.265
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.
type PermissionMode = 'default' | 'acceptEdits' | 'bypassPermissions' | 'plan' | 'dontAsk' | 'auto';
PermissionRequestDecision type
#
line 9520
Added in 2.1.265
A classic.PermissionRequest answer's decision, as the classic hook's hookSpecificOutput.decision: allow (with a rewrite or rules) or deny.
Off the person's machine a mod's update stands unless it is setMode, loosens a device tool, or lifts a deny or ask or removes an exception on a shell, Read, Write, Edit, Glob, Grep or TaskStop. A restarted cloud worker has none of the session allow rules the mod added. Its directory lifts no forwarded call's block.
export type PermissionRequestDecision = {
behavior: 'allow';
updatedInput?: Record<string, unknown>;
updatedPermissions?: PermissionUpdates;
} | {
behavior: 'deny';
message?: string;
interrupt?: true;
};
PermissionRequestHookInput type
#
line 9530
Added in 2.1.265 · changed in 2.1.274
type PermissionRequestHookInput = BaseHookInput & {
hook_event_name: 'PermissionRequest';
tool_name: string;
tool_input: unknown;
permission_suggestions?: PermissionUpdate[];
mcp_server?: McpServerProvenance;
};
PermissionRuleValue type
#
line 9538
Added in 2.1.265
type PermissionRuleValue = {
toolName: string;
ruleContent?: string;
};
PermissionUpdate type
#
line 9543
Added in 2.1.265
28 lines
type PermissionUpdate = {
type: 'addRules';
rules: PermissionRuleValue[];
behavior: PermissionBehavior;
destination: PermissionUpdateDestination;
} | {
type: 'replaceRules';
rules: PermissionRuleValue[];
behavior: PermissionBehavior;
destination: PermissionUpdateDestination;
} | {
type: 'removeRules';
rules: PermissionRuleValue[];
behavior: PermissionBehavior;
destination: PermissionUpdateDestination;
} | {
type: 'setMode';
mode: PermissionMode;
destination: PermissionUpdateDestination;
} | {
type: 'addDirectories';
directories: string[];
destination: PermissionUpdateDestination;
} | {
type: 'removeDirectories';
directories: string[];
destination: PermissionUpdateDestination;
};
PermissionUpdateDestination type
#
line 9572
Added in 2.1.265
type PermissionUpdateDestination = 'userSettings' | 'projectSettings' | 'localSettings' | 'session' | 'cliArg';
PermissionUpdates type
#
line 9578
Added in 2.1.265
The permission rules a PermissionRequest allow may add: the shape of the request's own permission_suggestions (the SDK's PermissionUpdate list).
type PermissionUpdates = NonNullable<ClassicHookInputs['PermissionRequest']['permission_suggestions']>;
PlanModeDetail type
#
line 9584
Added in 2.1.287
What the engine knew as it made a plan-mode reminder: which of its two wordings the row carries, where the plan is kept, whether one is there.
18 lines
type PlanModeDetail = {
/**
* Which wording the row carries: `full`, the whole workflow, or `sparse`,
* the one line that restates it between two full ones.
*
* A row made for a subagent reads the same under either.
*/
reminder: 'full' | 'sparse';
/**
* Where the plan is kept, as the text names it: the file the model
* writes its plan to, of the loop the row was made for.
*/
planFilePath: string;
/**
* True when the engine found that file as it made the row.
*/
hasPlan: boolean;
};
PlanModeExitDetail type
#
line 9607
Added in 2.1.287
What the engine knew as it made the note that plan mode has ended: where the plan is kept, whether one is there.
type PlanModeExitDetail = {
/**
* Where the plan is kept; the text names it only when `hasPlan`.
*/
planFilePath: string;
/**
* True when the engine found that file as it made the row.
*/
hasPlan: boolean;
};
PlanModeReentryDetail type
#
line 9622
Added in 2.1.287
What the engine knew as it made the note that plan mode is entered again: where the plan of the earlier planning is kept.
type PlanModeReentryDetail = {
/**
* Where the earlier plan is kept, as the text names it; the note is made
* only when the engine finds that file.
*/
planFilePath: string;
};
PlayOptions type
#
line 9635
In the first published surface (2.1.259)
How $.audio.play plays a clip: looped until signal aborts, or once.
A loop needs the signal that ends it; a single play takes one as an option.
27 lines
export type PlayOptions = {
/**
* Repeat the clip until `signal` aborts (the promise then resolves).
*/
shouldLoop: true;
/**
* Linear gain, from 0 to 4; default 1.
*/
gain?: number;
/**
* Stops the clip: playback ends at once and the promise resolves.
*/
signal: AbortSignal;
} | {
/**
* Play once.
*/
shouldLoop?: false;
/**
* Linear gain, from 0 to 4; default 1.
*/
gain?: number;
/**
* Stops the clip early, as above.
*/
signal?: AbortSignal;
};
PluginHookEntry type
#
line 9668
Added in 2.1.326
One settings hook a plugin ships (hooks.json or its manifest's hooks): the classic event it stands on (PreToolUse), its entry's matcher when it names one, and what it runs.
29 lines
export type PluginHookEntry = {
event: string;
matcher?: string;
type: 'command';
/**
* A line for the shell, or with `args` the program spawned directly.
*/
command: string;
/**
* There, even empty, when no shell reads the command.
*/
args?: readonly string[];
} | {
event: string;
matcher?: string;
type: 'http';
url: string;
} | {
event: string;
matcher?: string;
type: 'prompt' | 'agent';
prompt: string;
} | {
event: string;
matcher?: string;
type: 'mcp_tool';
server: string;
tool: string;
};
PluginHosts type
#
line 9714
Added in 2.1.328
The network hosts a plugin's files and source name, and the parts that could reach others: drawn from provides, uses and what its author declares, with nothing dialed or run.
It only shows: it allows no host, and no call is held to it. Not in either list: where a host redirects or sends a sign-in; a server's headersHelper; a command in the plugin's settings; what the module's hook on any event but process.run, process.spawn, http.fetch and audio.play rewrites or answers (a tool call, a command's arguments, an agent, the settings); what the plugin has a server, the model, another session or another plugin do ($.mcp, $.model, $.agent.spawn, a prompt, an agent, a workflow, a hook of another type); what follows from a file, variable or setting it writes, or a link it draws; and what the engine itself runs or dials to serve a call (speech, a notification, telemetry).
58 lines
export type PluginHosts = {
/**
* One row a host, sorted, with every place that names it.
*/
named: readonly {
/**
* As `sandbox.network.allowedDomains` spells an entry: lowercase ASCII,
* IPv6 in brackets, and `:port` unless it is the scheme's default. A name
* with no dot is listed too, though that setting takes only `localhost`.
* A declared one keeps its port as written, and may lead with `*.`.
*/
host: string;
sources: readonly PluginHostSource[];
}[];
/**
* The parts whose reach is not read, whatever is declared for them. More
* reasons may be added.
*/
unread: readonly {
kind: keyof PluginProvides;
/**
* The part's name in `provides`: a hook's event, a module's path. Absent
* where the whole kind is meant.
*/
name?: string;
/**
* `process`: it is, or can start, a program (a stdio server, a bundle's
* server, an LSP server, a command hook, a monitor, a file of `bin/`, a
* skill, a command, a module that calls or hooks `process.run` or
* `process.spawn`, or calls `$.tool.call`, `$.agent.call`, `$.command.run`
* or `$.agent.register`).
* `url`: its URL does not settle where it goes, as it spells out no host,
* is computed, or goes or may go over a `socketPath`; or the module hooks
* `http.fetch` or `audio.play`, where it can send a request elsewhere.
* `unlisted`: the kind's list may be short, or the module was not scanned.
*/
reason: 'process' | 'url' | 'unlisted';
}[];
/**
* Where the author wrote a `network.hosts` list, an empty one included: a place
* listed here that is the source of no row says it needs none, and one left
* out did not say. A list with no usable entry counts as not written. Absent
* where the plugin's files were not read, or where its lists' rows together
* pass 131,072 characters of JSON: then `named` holds none of them.
*/
declared?: {
/**
* Whether plugin.json has one at its top level, or the marketplace entry
* that is the plugin's only manifest.
*/
plugin: boolean;
/**
* The stdio MCP servers whose entries have one, named as in `provides` and
* short where its `mcpServers` is.
*/
servers: readonly string[];
};
};
PluginHostSource type
#
line 9777
Added in 2.1.328
Where a host in PluginHosts came from, named as provides names the part. More types may be added, so a reader leaves room for one it does not know.
33 lines
export type PluginHostSource = {
/**
* A remote MCP server (`http`, `sse`, `ws`), or a bundle (`mcpb`) given
* by the URL it is downloaded from.
*/
type: 'mcp';
name: string;
} | {
/**
* An HTTP hook.
*/
type: 'hook';
event: string;
matcher?: string;
} | {
/**
* The hooks module (PluginRegisterUses `hosts`).
*/
type: 'module';
path: string;
} | {
/**
* The author's word, from a `network.hosts` list: `{ "network": { "hosts":
* ["api.example.com"] } }` at the top of plugin.json, for every part of the
* plugin, or on a stdio MCP server's entry. It is unchecked and not a limit:
* the plugin may reach other hosts, or none of these, and it allows nothing.
*/
type: 'declared';
/**
* The server whose entry lists the host; absent for the plugin's own list.
*/
server?: string;
};
PluginNoun type
#
line 9819
Added in 2.1.265
The nouns a plugin declared on $ by merging into EngineInterface; never one the engine's own events are under (tool, session, ui).
Where a hook with no .catch is run again beneath its call to one and makes that call again for the same event, the third identical open call waits behind the second, and ends with it if the second goes unanswered.
type PluginNoun = Exclude<keyof EngineInterface & string, keyof CoreEngineInterface | Namespace<CoreEventName>>;
PluginOptions type
#
line 9833
In the first published surface (2.1.259)
A plugin's options as register(on, options) receives them: the values of the fields its manifest's userConfig declares, defaults filled in.
Stored in settings.json pluginConfigs[<plugin>].options (sensitive ones in secure storage), validated against the declared type before the module loads; a required field with no value fails the load, naming the field. A string field that declares options holds one of them: /config draws it as a picker over them, and a stored value outside them counts as unset, so its default applies. A --plugin-dir plugin's key is its plugin.json <name> (or <name>@inline).
export type PluginOptions = Readonly<Record<string, string | number | boolean | readonly string[]>>;
PluginProvides type
#
line 9849
Added in 2.1.326
What a plugin provides, kind by kind, as the host read it off the plugin's folder: the same lists claude plugin validate prints.
Text is as written, before ${} expansion; no env, headers or option values. A command, its args and a prompt are whole. A url, and a target that is a URL, name the host dialed and lose their login, query and fragment; with a ${} ahead of the path the host is not yet known. A name is the one its part loads under. Parts that read the same are one entry, and go or stay together.
A plugin.register hook removes entries (PluginRegisterInput provides). A list with an entry removed is an allowlist for its kind: a part loads only while it reads as an entry left in. A list left whole loads as it would have.
71 lines
export type PluginProvides = {
/**
* Its hooks module, if it names one, by its path under the plugin's folder
* with forward slashes. Emptied, the module alone stays out.
*/
modules: readonly {
path: string;
}[];
/**
* Its settings hooks, in the order it declares them. The hooks in a skill's
* own frontmatter are not listed: they go or stay with that skill.
*/
hooks: readonly PluginHookEntry[];
/**
* Each server by its key in `.mcp.json` or the manifest, with its URL, or its
* command and `args`. A bundle (`mcpb`) has its path or URL as both: its
* server is named inside it, and nothing is fetched or unpacked to judge a
* plugin. A key declared twice is listed both ways.
*/
mcpServers: readonly {
name: string;
type: 'stdio' | 'http' | 'sse' | 'ws' | 'mcpb';
target: string;
args?: readonly string[];
}[];
/**
* Each by its key, with its command and, if it has them, its `args`.
*/
lspServers: readonly {
name: string;
command: string;
args?: readonly string[];
}[];
/**
* One armed before its entry was removed runs on, as it does past a refusal.
*/
monitors: readonly {
name: string;
command: string;
}[];
/**
* `<plugin>:<skill>`; a built-in plugin's go by their bare names.
*/
skills: readonly string[];
/**
* `<plugin>:<command>`, each folder on the way between (`<plugin>:a:b`).
*/
commands: readonly string[];
/**
* The agent types: `<plugin>:<agent>`, each folder on the way between.
*/
agents: readonly string[];
/**
* `<plugin>:<style>`.
*/
outputStyles: readonly string[];
/**
* `<plugin>:<file name less .json>`. Pinned for now: a `next` that removes
* one is refused, as one that changes any pinned field is.
*/
themes: readonly string[];
/**
* `<plugin>:<workflow>`.
*/
workflows: readonly string[];
/**
* The files in its `bin/`. Pinned for now: the folder joins `PATH` whole, so
* a `next` that removes one is refused.
*/
bin: readonly string[];
};
PluginRegisterInput type
#
line 9936
Added in 2.1.269 · changed in 2.1.326, 2.1.328
The input of plugin.register: one plugin the engine is about to load, with a hooks module or without one, read off its manifest and, where it has a module, its scanned source. Every field is pinned but provides, which only narrows.
A { refuse } refuses the plugin whole: it keeps out its hooks module, command hooks, MCP servers, LSP servers, skills, commands, agents, output styles, themes, monitors, settings and bin/. None of them starts before the verdict. To keep out less, pass provides on with entries removed.
tier, uses, provides, unread, hosts and requiredByOrganization are the host's reading of the plugin, what a gate holds it to; name, root, version and provenance are its own word (its manifest, its place), so a rule keyed on them is one a rename walks past. So is what hosts marks as declared.
79 lines
export type PluginRegisterInput = {
/**
* The plugin's name, as its own plugin.json declares it.
*/
name: string;
/**
* The tier it is judged in (Tier), which for a hooks module is where its hooks
* would stand in the chain; never `core`, the engine's own.
*/
tier: Exclude<Tier, 'core'>;
/**
* The plugin's directory (the one holding `.claude-plugin/plugin.json`),
* absolute; `builtin` for a bundled one. In a hosted cloud session (SessionInfo
* `isHosted`), an installed plugin with no hooks module has its `provenance`
* here, and one whose module did not load may.
*/
root: string;
/**
* Its manifest's `version`, when it states one.
*/
version?: string;
/**
* Where the plugin came from, as the loader keys it: `<name>@<marketplace>`
* installed, `<name>@inline` by `--plugin-dir`, `<name>@builtin` bundled.
*/
provenance: string;
/**
* True where the app that started this session handed over this plugin by path
* and said its organization requires or auto-installs it, or, in a hosted cloud
* session (SessionInfo `isHosted`), where claude.ai lists it as required; else absent.
* It gives no permission, and sets `tier` only for a plugin with no hooks
* module to load (Tier). Left out, it is restored.
*/
requiredByOrganization?: true;
/**
* What its hooks module hooks and calls, as scanned (PluginRegisterUses).
* Empty for a plugin with no module, or whose module did not load, and for a
* module that scans empty: with no hook and no `$`, it can touch nothing.
*/
uses: PluginRegisterUses;
/**
* Every part it ships (PluginProvides). Pass it to `next` or `next.to` with
* entries removed and those parts stay out while the rest load.
*
* A list that is not a subset, by value, of the one received is refused,
* and so is `themes` or `bin` narrowed; left out, `provides` is restored.
* What loads is what every mod's `next` in the dispatch left in, so an allow
* beneath or a second `next` widens nothing; a mod's own hooks on the event
* compose first, and the `next` that leaves the mod is the one read. Settings
* are not listed: a narrowing leaves them on.
*
* @example
* next({ ...e, provides: { ...e.provides, modules: [] } })
*/
provides: PluginProvides;
/**
* The kinds whose list in `provides` may be short, sorted: something the host
* read for it was there and could not be read or used. Left out, it is restored.
* A kind whose entries come to more than 131,072 characters of JSON is named
* here and its list is empty; `modules` never is.
*
* The engine keeps nothing out for it. A part that is not listed cannot be
* removed, and loads while its list is left whole, as an empty one always is;
* a mod that must see or remove every part refuses the plugin.
*
* @example
* e.unread.includes('bin') ? { refuse: 'bin/ could not be listed' } : next(e)
*/
unread: readonly (keyof PluginProvides)[];
/**
* The network hosts it names and the parts that could reach others
* (PluginHosts), of the whole plugin: narrowing `provides` leaves it as it
* is. Left out, it is restored.
*
* @example
* e.hosts.named.some(row => !known.has(row.host)) ? { refuse: 'new host' } : next(e)
*/
hosts: PluginHosts;
};
PluginRegisterResult type
#
line 10020
Added in 2.1.269
What a plugin.register hook returns and what next(e) resolves to: { allow: true } from core, or { refuse: reason }.
19 lines
export type PluginRegisterResult = {
/**
* The plugin loads: its module's `engine.create` step runs and its hooks
* join, and the rest of its parts follow, less what a hook removed from
* `provides` on the way down.
*/
allow: true;
refuse?: undefined;
} | {
/**
* The whole plugin does not load: no step, no hooks, no tools or commands
* from its module, and none of its other parts (command hooks, MCP and LSP
* servers, skills, commands, agents, output styles, themes, monitors,
* settings, `bin/`) take effect, but for a monitor armed before the refusal,
* which runs on. The debug log names the plugin that refused and this reason.
*/
refuse: string;
allow?: undefined;
};
PluginRegisterUses type
#
line 10048
Added in 2.1.269 · changed in 2.1.281, 2.1.328
What a hooks module uses, as the host scanned its source before loading it: the same lists claude plugin validate prints and the host's rule reads.
Exact, since a module that spells on, $, $.env or a $.state reference other than literally does not load. hosts alone is not: a URL may be computed, and it says where one is.
60 lines
export type PluginRegisterUses = {
/**
* The patterns its `on(...)` registrations name, as written (`tool.call`,
* `*`, `classic.*`, `!tool.describe`), in registration order, each once.
*/
events: readonly string[];
/**
* What it calls on `$`, spelled `noun.method` (`fs.write`, `http.fetch`),
* sorted, each once.
*/
calls: readonly string[];
/**
* The environment variables its `$.env.get` and `$.env.set` calls name;
* absent when it calls neither.
*/
env?: {
/**
* The names its `$.env.get` calls spell, sorted, each once.
*/
reads: readonly string[];
/**
* The names its `$.env.set` calls spell, sorted, each once.
*/
writes: readonly string[];
};
/**
* The named values its `$.state.get` and `$.state.set` calls refer to by
* literal, each `{ plugin, key }`; absent when it calls neither.
*/
state?: {
/**
* The values its `$.state.get` calls spell, sorted, each once.
*/
reads: readonly StateName[];
/**
* The values its `$.state.set` calls spell, sorted, each once.
*/
writes: readonly StateName[];
};
/**
* The hosts its `$.http.fetch` and `$.audio.play({ url })` calls name, as far
* as the source spells them; absent when it calls neither. No call is held
* to the list, and where a host redirects is not known.
*/
hosts?: {
/**
* Spelled as PluginHosts spells a host, sorted, each once: read off a string
* literal, a template that spells the host out, or a `const` of the same
* file holding one, there or in a template's `${}`. A fetch whose options,
* written at the call, give a `socketPath` dials no host and names none.
*/
named: readonly string[];
/**
* Which of `audio.play` and `http.fetch` it calls with any other URL, one
* over 2,048 characters, or options that give or may give a `socketPath`,
* sorted: it loads all the same, and may reach what is not in `named`.
*/
unread: readonly string[];
};
};
PluginStamp type
#
line 10116
Added in 2.1.271
Whose element: the plugin whose hook drew it, stamped by the runtime as the tree leaves it; a Box's or Text's group, a Client's or Raster's own.
A Button's press names its plugin the same way, beside its handle. Two plugins under one hover.scope string never share a group.
type PluginStamp = {
plugin: string;
};
PluginState interface
#
line 10131
Added in 2.1.281
The named values plugins keep in the session ($.state), by plugin name then key, for declaration merging; empty by default.
A plugin declares its own in the contract it ships, inside declare module "claude-code"; a key's type is the value $.state.get answers and $.state.set takes, and a StateFamily key holds one value per id.
interface PluginState { swarm: { workers: Worker[] } }
export interface PluginState {
}
PluginValidateAdvice type
#
line 10137
Added in 2.1.326
One thing claude plugin validate advises and no verdict counts.
type PluginValidateAdvice = {
/**
* The README that holds no install line.
*/
file: string;
message: string;
/**
* The line to paste, a placeholder standing where no remote was read.
*/
installLine: string;
};
PluginValidateDirectory type
#
line 10152
Added in 2.1.326
What the plugin directory's checks found, in a validate report.
25 lines
type PluginValidateDirectory = {
/**
* The profile the run enforced, or null when the findings did not count.
*/
profile: 'directory' | null;
findings: PluginValidateDirectoryFinding[];
/**
* What a check could not look at, or how to read a finding: plain
* sentences, one entry per subject.
*/
notes: string[];
/**
* Rule ids that could not be decided because listed files were not checked.
*/
undecided: string[];
/**
* Whether a note says that something a rule needs was not looked at, or
* that a rule was not applied.
*/
incomplete: boolean;
/**
* Why `--profile directory` failed the run, or null when it did not.
*/
failure: string | null;
};
PluginValidateDirectoryFinding type
#
line 10181
Added in 2.1.326
One finding of the plugin directory's checks.
29 lines
type PluginValidateDirectoryFinding = {
/**
* The directory's id for the rule.
*/
code: string;
/**
* The directory's title for the rule, where validate carries one.
*/
title: string | null;
severity: 'error' | 'warning' | 'info';
/**
* Whether the directory refuses a submission that has this finding.
*/
blocking: boolean;
/**
* Whether the directory accepts the submission and holds it for a reviewer.
*/
hold: boolean;
/**
* The file the finding is about, or '' when it is about no one file.
*/
file: string;
/**
* The key or place inside that file, or ''.
*/
field: string;
message: string;
fix: string | null;
};
PluginValidateFile type
#
line 10215
Added in 2.1.326
One file of a validate report. It failed exactly when errors holds something; nothing else here is a verdict.
43 lines
type PluginValidateFile = {
/**
* Where the findings were read from: a label, which may be cleaned and cut,
* and not a path to open.
*/
file: string;
/**
* Which check made the entry, more than what the file is: a notice about
* `.mcp.json` commands, or a target that is missing, is a `plugin` entry.
*/
type: 'plugin' | 'marketplace' | 'skill' | 'agent' | 'command' | 'hooks' | 'mcp';
errors: PluginValidateFinding[];
warnings: PluginValidateFinding[];
/**
* What the validator knows beyond pass or fail, as display lines, cleaned
* and cut. What they say of a hooks module is whole in `modules`.
*/
notes: string[];
/**
* Each hook at a site whose answer can refuse what was asked, but for a
* `command.run` hook that answers its own command.
*/
gatingHooks: PluginValidateGatingHook[];
/**
* What the module's `$.wasm.compile` calls compile. A file that does not
* read or compile is in `errors` instead.
*/
wasm: PluginValidateWasm[];
/**
* What the hooks module this file names does, listed once it scans even
* when a later check on it fails; empty for an entry with no module.
*
* Null is "not read": a hooks file that is a link, too large, not JSON or
* refused, or whose module leaves the plugin's folder or does not scan,
* and a manifest or folder not read for the hooks files it can lead to.
*
* Null too, scanned or not, where another disk could load other code: it
* can be reached through a name that differs only by letter case or
* Unicode form, a name on the way could not be compared for that, or a
* path is spelled so that Windows can open it as another file.
*/
modules: PluginValidateModule[] | null;
};
PluginValidateFinding type
#
line 10262
Added in 2.1.326
One error or warning of a validate report, as display text: cleaned and cut.
type PluginValidateFinding = {
/**
* Where in the file: a dotted JSON path, a frontmatter key, `root`, `json`.
*/
path: string;
message: string;
/**
* Reserved for a stable, documented rule id. Always null today.
*/
code: string | null;
};
PluginValidateGatingHook type
#
line 10280
Added in 2.1.326
One hook at a gating site as claude plugin validate --json reports it: where it is written, what it is registered on, whether .catch follows.
A fact for the author, who decides how a hook fails; never a verdict.
17 lines
type PluginValidateGatingHook = {
/**
* As hooks.json `modules` spells it or, past 200 characters, the same path
* normalized (padding such as `./` collapsed), since each row repeats it.
*/
module: string;
/**
* What the hook is registered on: a name, a glob or a negation.
*/
pattern: string;
/**
* The registration as the notes list it, its matcher printed after the
* pattern (`tool.call{tool=Bash}`): a cut display line, not a syntax.
*/
hook: string;
hasCatch: boolean;
};
PluginValidateHook type
#
line 10301
Added in 2.1.326
One on(...) call of a hooks module, as validate read it.
19 lines
type PluginValidateHook = {
/**
* What the hook is registered on: a name, a glob or a negation.
*/
pattern: string;
/**
* `{ has: {} }` for a call with no matcher.
*/
matcher: PluginValidateMatcher;
/**
* The matcher keys the engine fills in where the call names none.
*/
defaultKeys: readonly string[];
/**
* True exactly for a hook the file's `gatingHooks` lists.
*/
isGate: boolean;
hasCatch: boolean;
};
PluginValidateMatcher type
#
line 10329
Added in 2.1.326
A matcher, or a part of one, as validate read it off the source. anyOf is an array, or the literals a for...of registers a hook on in turn.
Null is "not read": a value not spelled as JSON can hold it, an object with a spread, a computed key, an accessor or a key the engine refuses, a matcher past the engine's limits, and each after a plugin's matchers total 8 MiB.
type PluginValidateMatcher = {
is: string | number | boolean | null;
} | {
regex: string;
flags: string;
} | {
anyOf: PluginValidateMatcher[];
} | {
has: {
[key: string]: PluginValidateMatcher;
};
} | null;
PluginValidateModule type
#
line 10346
Added in 2.1.326
What a hooks module does, as validate read it off its source. An empty list and false mean nothing; every name is whole.
43 lines
type PluginValidateModule = {
/**
* The path exactly as hooks.json `modules` spells it.
*/
module: string;
/**
* What `plugin.register` carries as `e.uses`, with no member left out.
*/
uses: Required<PluginRegisterUses>;
/**
* One item per `on(...)` call, in order.
*/
hooks: readonly PluginValidateHook[];
/**
* The tiers its `next.to(e, tier)` calls name.
*/
nextTo: readonly TargetTier[];
/**
* The streams its telemetry hooks stand on.
*/
telemetry: readonly TelemetryDestination[];
/**
* The surface modules its `Client` elements name, as paths under the
* plugin's folder.
*/
clients: readonly string[];
/**
* Whether its source spells a `breakPromptCache` key on an object.
*/
breaksPromptCache: boolean;
/**
* Four empty lists with no hook on `engine.create`; null when the hook is
* outside the one form validate reads.
*/
nouns: PluginValidateNouns | null;
/**
* One item per file its `Shader` elements name, by path. Null when that is
* not all known: a check before it threw, a `module` prop names no file
* (an error says which), or the list is past the report's size limit.
* A report from an older CLI leaves it out.
*/
shaders: readonly PluginValidateShader[] | null;
};
PluginValidateNouns type
#
line 10393
Added in 2.1.326
What a module's engine.create hook does to $ if it registers.
15 lines
type PluginValidateNouns = {
adds: readonly string[];
/**
* Written before what is beneath, which wins where it holds the name.
*/
addsUnlessThere: readonly string[];
/**
* In the user or builtin tier the fold refuses this and unloads the module.
*/
withholds: readonly string[] | 'everything';
/**
* Written over a name core puts on `$`, which unloads the module.
*/
replaces: readonly string[];
};
PluginValidatePerGpu type
#
line 10412
Added in 2.1.326
One figure for each class of GPU.
type PluginValidatePerGpu = {
weak: number;
fast: number;
};
PluginValidateReport type
#
line 10425
Added in 2.1.326 · changed in 2.1.328
What claude plugin validate --json prints: a public contract, to which fields are added and in which none is renamed or retyped.
Names are the author's true spelling, never cut or cleaned, so a consumer printing one scrubs it first. A file entry with no modules came from an older CLI. On an unexpected failure (exit 2) nothing is printed to stdout.
43 lines
export type PluginValidateReport = {
/**
* The verdict under the flags given (`--strict` counts warnings), which is
* the exit code's: true exactly when that is 0.
*/
success: boolean;
strict: boolean;
/**
* The manifest path that was validated, or the component directory.
*/
target: string;
/**
* The plugin.json or marketplace.json; null for a bare skills, agents or
* commands directory.
*/
manifest: PluginValidateFile | null;
/**
* Each other file with an error, a warning or a note (the plugin.json beside
* a marketplace.json too); a hooks file naming a module is always listed.
*/
contents: PluginValidateFile[];
/**
* What `plugin.register` carries as `e.provides` for an installed copy of
* the folder. Null is "not read": a target that is no plugin folder, one
* with errors, or one with a hooks or server file left unread. A report from an older CLI leaves it out.
*/
provides: PluginProvides | null;
/**
* What `plugin.register` carries as `e.hosts` for an installed copy of the
* folder. Null wherever `provides` is. A report from an older CLI leaves it out.
*/
hosts: PluginHosts | null;
/**
* What the validator advises without counting it under any flag: today, the
* install line a plugin's README lacks.
*/
advice: readonly PluginValidateAdvice[];
/**
* The plugin directory's checks, which count under `--profile directory`
* alone. Null when they had nothing to run on and that was not passed.
*/
directory: PluginValidateDirectory | null;
};
PluginValidateShader type
#
line 10473
Added in 2.1.326
One shader file as claude plugin validate read it. The report's text is drawn from this; every name is whole.
22 lines
type PluginValidateShader = {
/**
* The file's path under the plugin's folder.
*/
module: string;
/**
* Which GPUs it runs on: any, fast ones alone, or none.
*/
verdict: 'any' | 'fast' | 'refused';
/**
* Why it is refused, or null if it is not. `line` is null when the file
* could not be read.
*/
refusal: {
line: number | null;
message: string;
} | null;
/**
* Null when it was refused before it could be costed.
*/
cost: PluginValidateShaderCost | null;
};
PluginValidateShaderCost type
#
line 10499
Added in 2.1.326
A shader's worst-case cost in a window of 1512x945 points.
53 lines
type PluginValidateShaderCost = {
/**
* The picture's pixels a point that each class holds, 0 to 2.
*/
sharpness: PluginValidatePerGpu;
/**
* The frames a second it asks for.
*/
fps: 30 | 60;
/**
* In the order they run, then each table a pass reads. `name` is the
* variable the pass is first bound to, empty with none. `frameMs` is its
* time on a frame and `startMs` on the first.
*/
passes: readonly {
kind: 'buffer' | 'table' | 'picture' | 'shapes';
name: string;
line: number;
frameMs: PluginValidatePerGpu;
startMs: PluginValidatePerGpu;
}[];
/**
* What it reads from outside itself; `values` by the names it gives them.
*/
reads: {
pointers: boolean;
scene: boolean;
values: readonly string[];
};
/**
* The steps of all its programs, as written.
*/
steps: number;
/**
* The guards put in where a range could not rule out a bad point.
*/
guards: number;
/**
* The memory it holds, the app's check for flashes included.
*/
bytes: number;
/**
* How much data its constants and tables carry.
*/
bits: number;
/**
* Up to three lines, dearest first, each with its share (0 to 1) of the work.
*/
dearest: readonly {
line: number;
share: number;
}[];
};
PluginValidateWasm type
#
line 10556
Added in 2.1.326
One thing a hooks module's $.wasm.compile calls compile.
type PluginValidateWasm = {
/**
* As hooks.json `modules` spells it or, past 200 characters, the same path
* normalized (padding such as `./` collapsed), since each row repeats it.
*/
module: string;
/**
* Null for bytes the module makes at run time, which nothing reads.
*/
file: PluginValidateWasmFile | null;
};
PluginValidateWasmFile type
#
line 10572
Added in 2.1.326
One .wasm file a hooks module lists, as claude plugin validate reports it: which bytes they are, and what they ask for and offer.
23 lines
type PluginValidateWasmFile = {
/**
* The file under the plugin's folder, as `wasm.compile`'s `path` reads.
*/
path: string;
/**
* Its length in bytes.
*/
size: number;
/**
* Its SHA-256, lowercase hex.
*/
sha256: string;
imports: {
module: string;
name: string;
kind: string;
}[];
exports: {
name: string;
kind: string;
}[];
};