{"version":"2.1.319","generated_at":"2026-11-06T01:04:07+00:00","counts":{"nouns":22,"verbs":89,"events":92,"declarations":663},"engine":[{"noun":"plugin","doc":{"desc":["This plugin, as loaded: its manifest name and its directory."],"params":[],"example":[],"returns":[]},"members":[{"name":"name","optional":false,"kind":"verb","sig":"string","doc":{"desc":["From plugin.json; debug-log and `$.ui.log` lines carry it."],"params":[],"example":[],"returns":[]}},{"name":"root","optional":false,"kind":"verb","sig":"string","doc":{"desc":["The plugin's directory (the one holding plugin.json), absolute."],"params":[],"example":[],"returns":[]}}]},{"noun":"ui","doc":{"desc":["Display: a line under an open dialog, a redraw or a repaint, a log line,","panes the surface places, a window or ring, a surface's clipboard."],"params":[],"example":[],"returns":[]},"members":[{"name":"notice","optional":false,"kind":"verb","sig":"(tool_use_id: string, text: string | undefined) => void","doc":{"desc":["Shows `text` as one line under the dialog open for `tool_use_id`, or","removes the line when `text` is undefined.","","Core removes the line when the call resolves. A call that is not open","is refused, as is another plugin's `$.tool.call` run."],"params":[["tool_use_id","the call whose open dialog gets the line"],["text","the line to show; undefined removes it"]],"example":["$.ui.notice(e.tool_use_id, \"checked by my-plugin\"); return next(e)"],"returns":[]}},{"name":"invalidate","optional":false,"kind":"verb","sig":"(event: InvalidatableEventName) => void","doc":{"desc":["Re-runs an event whose results the engine caches: `ui.render` draws the","instances this plugin may draw again; the others drop the cached answers.","","A redraw: ten a second at most, thirty in the terminal for a shown pane,","expanded band and prompt hint (sooner calls fold). A cached answer drops","next turn; a changed tool or section text rewrites what a thread sent,","which loses its thinking and the prompt cache, so do not call it for","these once a thread has sent."],"params":[["event","`ui.render`, or a cached-answer event: `prompt.section`,   `prompt.context`, `prompt.attachment`, `tool/command/config.describe`"]],"example":[],"returns":[]}},{"name":"blit","optional":false,"kind":"verb","sig":"(args: UiBlitArgs) => Promise<UiBlitResult>","doc":{"desc":["Repaints a mounted `Raster` this plugin's own render hook drew with new","cells, or swaps a keyed `Image` it drew to a new source; no redraw.","","The surface paints the cells or source at its next frame, so blits","between frames fold into one: up to 120 a second taken, some sixty","shown. An Image swap sends one small command; a resize is a redraw."],"params":[["args","`requestId` (the site), `key`, and `cells` (RasterProps) or             `source` (ImageSource); `columns`, `rows` (the mounted size)"]],"example":["$.clock.every(33, () => $.ui.blit({ requestId, key, cells: frame() }))","await $.ui.blit({ requestId: 'browser', key: 'view',","  source: { shm: name, format: 'rgb', width, height } })"],"returns":["`{}` once the cells or source are its next frame, or `{ deny }`","         (not mounted, not this plugin's, another size, cells that do","         not decode, a bad source, or an Image drawing its alt there:","         no placeholder images, or a file this terminal cannot read)"]}},{"name":"resolve","optional":false,"kind":"verb","sig":"<E extends ResolveInput>(e: E) => Elements[E['surface']]","doc":{"desc":["The elements of the surface `e` is drawn on (Elements[e.surface]): a","frozen table of constructors, the JSX tags a render hook draws with.","","A read, not a dispatch: the engine ran `ui.resolve` (the other hooks,","then core) at load, per surface and component. Narrowed `e.surface`:","that table exactly; unnarrowed: the union, so shared names type-check."],"params":[["e","this hook's own `ui.render` argument (its surface and          component pick the table)"]],"example":["const { Box, Text } = $.ui.resolve(e)","return <Box>{await next(e)}<Text dimColor>done</Text></Box>"],"returns":["the surface's frozen element table (`Elements[e.surface]`)"]}},{"name":"log","optional":false,"kind":"verb","sig":"(text: string, options?: UiLogOptions) => void","doc":{"desc":["Appends one line to the transcript, drawn like a system notice (dim;","not sent to the model), or with `{ to: \"debug\" }` to the debug log alone.","","A row of its own at the next frame, in logging order; a `-p` or SDK","host receives it as `ui_log`; the debug log has it either way, to 10000","characters. Raised as `ui.log`: a hook above may rewrite `e.to`."],"params":[["text","the line's text, of any length: the terminal draws its   first 2000 characters, a remote surface 10000"],["options","`to`: `transcript` (the default) or `debug`"]],"example":["$.ui.log(`prompt from ${e.origin.kind}: ${e.text.length} chars`)","$.ui.log(`cache miss for ${e.tool_use_id}`, { to: \"debug\" })"],"returns":[]}},{"name":"ask","optional":false,"kind":"verb","sig":"(question: string, options?: readonly string[] | AskOptions) => Promise<string>","doc":{"desc":["Asks the user `question` in the engine's own AskUserQuestion dialog and","resolves to the label they chose, or the text typed under \"Other\".","","A `tool.call` of `AskUserQuestion` through every hook but the calling","one, drawn by `ui.render` on `AskUserQuestion`; a multi-select answer is","comma-joined. Rejects when dismissed, and in a `-p` run (no one to ask)."],"params":[["question","the question, ending in a question mark"],["options","2-4 option labels, or `{ options, header, multiSelect }`"]],"example":["const mood = await $.ui.ask(\"How careful?\", [\"Bold\", \"Careful\"])"],"returns":["the label chosen, the chosen labels comma-joined, or free text","         typed under \"Other\" (so compare it with the labels exactly)"]}},{"name":"toast","optional":false,"kind":"verb","sig":"(text: string, options?: ToastOptions) => void","doc":{"desc":["Shows `text` for a few seconds under the plugin's name: a small box on","the stack of plugin toasts over the transcript's top right corner.","","A click takes it off, the pointer over it holds it. Where the transcript","is printed into scrollback (nothing to float over) it is one line on the","notification bar. It leaves the transcript and the model untouched."],"params":[["text","the line to show, its first 2000 characters drawn (10000   remotely); an unpaired surrogate half in it is drawn as U+FFFD"],["options","`timeoutMs`: how long it stays (default 4000)"]],"example":["$.ui.toast(`turn took ${Math.round(e.durationMs / 1000)} s`)"],"returns":[]}},{"name":"notify","optional":false,"kind":"verb","sig":"(text: string, options?: NotifyOptions) => Promise<UiNotifyResult>","doc":{"desc":["Raises a native notification of `text` through the person's own","notification channel, the one their `preferredNotifChannel` names.","","Their `Notification` hooks run first, reading `plugin_notification`,","then the channel writes. Raised as `ui.notify`; nothing limits how","often. With no terminal the hooks alone run; unbound or exiting, none."],"params":[["text","the notification's body, sent as given, of any length"],["options","`title`: what heads it (default: the plugin's name)"]],"example":["const sent = await $.ui.notify(\"tests passed\", { title: \"CI\" })"],"returns":["`{ isSent: true, channel }`, or `{ isSent: false, reason }`:","         turned off (`disabled`), `no-channel`, `no-surface`, `refused`"]}},{"name":"status","optional":false,"kind":"verb","sig":"(text: string | undefined) => void","doc":{"desc":["Pins `text` as this plugin's status line under the prompt, beside the","engine's own pinned notices, until the next call replaces it.","","One per plugin; `undefined` removes it."],"params":[["text","the line to keep on screen, its first 2000 characters drawn   (10000 remotely); undefined clears it"]],"example":["$.ui.status(\"thinking...\"); return next(e)"],"returns":[]}},{"name":"open","optional":false,"kind":"verb","sig":"(pane: PaneOpenArgs) => Promise<UiOpenResult>","doc":{"desc":["Opens a pane, a framed region the surface places and this plugin draws","by hooking `ui.render` for `{ component: \"Pane\" }`; says if it is drawn.","","One per id (an open id retitles; a `ui.open` hook may refuse). Asked,","the person's command, prompt or press behind it (not `focus`), it is","placed at any width; unasked, from 144 columns, 110 for one once asked."],"params":[["pane","`id` (1-64 of letters, digits, `_`, `-`), `title`, `focus`,   `closeOnEscape` and `holdToasts` (a dialog), `backgroundColor` (what   is painted under its body), `rows` / `columns` wanted"]],"example":["await $.ui.open({ id: \"clock\", title: \"Clock\" })","await $.ui.open({ id: \"ask\", focus: true, closeOnEscape: true, rows: 9 })","const opened = await $.ui.open({ id: \"clock\" })","if (!opened.isPlaced) $.ui.log(\"clock: \" + opened.reason)"],"returns":["`{ isPlaced: true }` once drawn (or retitled), else `{ isPlaced:","  false, reason }` (UiOpenResult); `dock` or `inline` is on `Pane` props"]}},{"name":"close","optional":false,"kind":"verb","sig":"(pane: PaneCloseArgs) => Promise<void>","doc":{"desc":["Closes one of the open panes; an id that is not open is left alone.","","Every close raises `ui.close`, `e.origin` naming whose it is: this call","(`plugin`), the person's mark or key (`person`), an unload (`unload`).","A hook answering without `next` keeps the pane open, save on an unload."],"params":[["pane","`id`: the id the pane was opened under"]],"example":["onPress: () => $.ui.close({ id: \"clock\" })"],"returns":["settles once the pane is gone or a hook answered for it;","         rejects on a hook's `{ deny }`"]}},{"name":"panes","optional":false,"kind":"verb","sig":"() => Promise<readonly UiPane[]>","doc":{"desc":["Lists this plugin's own open panes (UiPane): each one's id and title,","and whether it is shown, holds the keyboard, and is placed.","","The engine's record, not the module's: a module reloaded while its","pane stayed up finds it here. Another plugin's panes are not listed."],"params":[],"example":["const isUp = (await $.ui.panes()).some(pane => pane.id === \"clock\")","if (!isUp) await $.ui.open({ id: \"clock\", title: \"Clock\" })"],"returns":["the panes in open order, placed ones first; empty with none"]}},{"name":"place","optional":false,"kind":"verb","sig":"(args: UiPlaceArgs) => Promise<UiPlaceResult>","doc":{"desc":["Places one row at the transcript's end, which scrolls with the","conversation and draws what `ui.render` answers for `Placed`.","","A hook reads `e.props.id` and `e.props.plugin`. Display only: the model","and the transcript file never read it, and `--resume` brings none back. A","hook that passes draws nothing; the same id answers the row that stands."],"params":[],"example":["await $.ui.place({ id: \"build\" })"],"returns":[]}},{"name":"scroll","optional":false,"kind":"verb","sig":"(args: UiScrollArgs) => Promise<UiScrollResult>","doc":{"desc":["Scrolls something into view as the DOM's `scrollIntoView` would: a","render instance by `requestId`, an element by `key`, a site's edge.","","A site of this plugin's (its pane, the band it draws into) moves under","the event `ui.scroll`, origin `plugin`. A transcript row moves only","while this call answers the person's own input, where one scrolls."],"params":[["args","`to` (what), `in` (which site, required for `start` and             `end`), `block` (where it lands; `nearest` by default)"]],"example":["onPress: () => $.ui.scroll({ in: \"log\", to: \"end\" })"],"returns":["`{}` once it moved, or `{ deny }` saying why not"]}},{"name":"focus","optional":false,"kind":"verb","sig":"(args: UiFocusArgs) => Promise<UiFocusResult>","doc":{"desc":["Moves the focus ring of one of this plugin's sites onto an element it","drew there, as the DOM's `element.focus()`, while it holds the keys.","","Raised as `ui.focus`, origin `plugin`; the engine's inverse marks it.","A site not holding the keys, or holding them on another's element, is","`{ deny }`; an element not yet drawn is awaited, bounded: no retrying."],"params":[["args","`requestId` (which site: a pane's id, the band's) and `key`             (the element's, as drawn)"]],"example":["await $.ui.open({ id: \"files\", focus: true })","await $.ui.focus({ requestId: \"files\", key: \"row:0\" })"],"returns":["`{}` once it moved, or `{ deny }` saying why not"]}},{"name":"copy","optional":false,"kind":"verb","sig":"(args: UiCopyArgs) => Promise<UiCopyResult>","doc":{"desc":["Puts `text` on the clipboard of a surface the session draws on, as the","DOM's `navigator.clipboard.writeText`, and says whether it took.","","`surface` names which (a press hook passes `e.surface`); left out, the","session's first. Raised as `ui.copy` with that target on `e`. The","terminal writes as `/copy` does; a remote surface has no path yet."],"params":[["args","`text`, what the person pastes; `surface`, where"]],"example":["onPress: press => $.ui.copy({ text: url, surface: press.surface })"],"returns":["`{ isCopied: true }`, or `{ isCopied: false, reason }`"]}},{"name":"selection","optional":false,"kind":"verb","sig":"() => Promise<UiSelection | undefined>","doc":{"desc":["Returns what the person last selected with the mouse: the text as a","copy would take it, and the transcript row it lies in.","","A key or a click takes the highlight down before a command or a press","runs, so the answer stays what the person last selected, until they","select again, dismiss it, or their next prompt or command has run."],"params":[],"example":["const selected = await $.ui.selection()"],"returns":["the selection; `undefined` with nothing selected, and where","         none is seen: fullscreen off, -p, a surface that answers none"]}},{"name":"view","optional":false,"kind":"verb","sig":"(view: SiteView) => Promise<UiViewResult>","doc":{"desc":["Puts an agent's transcript in the main view, as the person's own","switch from the tasks list does; `{}` goes back to the main one.","","Only while the call answers the person's own input (a press, a pick,","their prompt or command): the viewed agent takes the prompt's next","Enter. A site reads the view in force as `e.props.view`."],"params":[["view","`agentId`: the agent's `id` in `$.agent.list()`; absent for             the main conversation"]],"example":["onPress: () => $.ui.view({ agentId: agent.id })","onPress: () => $.ui.view({})"],"returns":["`{}` once the view shows it, or `{ deny }` saying why not"]}}]},{"noun":"theme","doc":{"desc":["The session's one theme: how the app looks behind and around the","conversation. One theme stands at a time, the latest set, whichever plugin","set it; there is no stack."],"params":[],"example":[],"returns":[]},"members":[{"name":"set","optional":false,"kind":"verb","sig":"(attributes: ThemeSetArgs) => Promise<ThemeResult>","doc":{"desc":["Sets the session's theme from one object of named top-level attributes.","`backdrop` is drawn behind the conversation by what `ui.render` answers","for `Backdrop`: full window on desktop under its frosted panels, full","screen on mobile under one veil (`tint` and `opacity`, not yet `blur`).","Display only: `--resume` brings none back and a plugin that unloads","takes its own with it, so set it at `session.start`."],"params":[["attributes","`backdrop`: `id`, `glass` (`blur`, `tint`, `opacity`) or   `false`, and `colorScheme` (`light` or `dark`)"]],"example":["await $.theme.set({ backdrop: { id: \"lagoon\", glass: { blur: 14, opacity: 0.55 } } })"],"returns":["`{ isDrawn: true, requestId }`, or `isDrawn: false` and why"]}},{"name":"clear","optional":false,"kind":"verb","sig":"() => Promise<ThemeResult>","doc":{"desc":["Clears the session's theme, back to the app's own look.","","IT CLEARS WHATEVER THEME STANDS, WHICHEVER PLUGIN SET IT: there is one","theme, so a clear is the session's and not the caller's own. Clear on a","person's ask (a command, a button), never at `session.start` or on a","reload: a plugin that clears there wipes another plugin's theme each time."],"params":[],"example":["await $.theme.clear() // a preview ends with no theme to go back to"],"returns":["`isDrawn: false` and why"]}}]},{"noun":"model","doc":{"desc":["Completions through the session's own client and credentials."],"params":[],"example":[],"returns":[]},"members":[{"name":"complete","optional":false,"kind":"verb","sig":"(request: ModelCompleteRequest, options?: ModelCompleteOptions) => Promise<ModelCompleteResult>","doc":{"desc":["Runs one text completion through the session's own API client and","resolves a result: the reply's text and cost, or why there is no text.","","No tools, no history, no system prompt beyond the CLI's identity block","and `request.system`; ModelCompleteRequest says the rest. Only a request","the engine refuses to send (a blocked model, a bad cap) rejects."],"params":[["request","the model (an alias such as `haiku`, or a full id                resolved like `--model`), prompt, cap, effort, time limit"],["options","`signal`: the plugin's own AbortSignal; aborting it   cuts the call while it runs, which then resolves `aborted`"]],"example":["const r = await $.model.complete({ model: \"haiku\", prompt, effort })","// one handler starts it, a later one cancels it while it runs","let stop = new AbortController()","const start = async () => {","  stop = new AbortController()","  const r = await $.model.complete(ask, { signal: stop.signal })","  if (!r.isAnswered && r.reason === \"aborted\") $.ui.log(\"cancelled\")","}","const cancel = () => stop.abort()"],"returns":["the reply (`isAnswered`, `text`, `usage`), else the `reason`:","         `api-error` with `status` and `error`, `empty-reply`, `aborted`"]}},{"name":"fork","optional":false,"kind":"verb","sig":"(request: ModelForkRequest) => Promise<ModelForkResult>","doc":{"desc":["Runs one tool-less completion over the session's OWN transcript as the","main thread last sent it, so the API serves that prefix from its cache.","","The main thread's last request again (its model, system prompt, tools,","messages) with `prompt` after it: every tool denied, its own tail never","cached, the prefix billed afresh once the entry lapsed or after `/model`.","It thinks as hard as the session does unless `effort` says otherwise;","ModelForkRequest says what holds that level and when it costs the cache."],"params":[["request","the one user message the fork answers, and its effort"]],"example":["const reply = await $.model.fork({ prompt: \"One line to learn?\" })","$.ui.log(reply.isAnswered ? reply.text : `no reply: ${reply.reason}`)","// a quick side job in a session the person runs at max","const cut = await $.model.fork({ prompt: \"Shorter.\", effort: \"low\" })"],"returns":["always a result, never null: the reply (`isAnswered`, `text`,","         `usage`, the `effort` sent), or why there is no text (`reason`:","         `nothing-to-fork` before the first request and after `/clear`,","         `api-error` with its HTTP `status` and `error` kind,","         `empty-reply`, or `aborted` when the turn whose hook forked was","         interrupted); a request of the wrong shape (no prompt, an","         `effort` that is no level) rejects instead"]}},{"name":"classify","optional":false,"kind":"verb","sig":"(text: string, labels: readonly string[], options?: ClassifyOptions) => Promise<string | undefined>","doc":{"desc":["Picks one of `labels` for `text` with one completion over","`$.model.complete` and a fixed classifier prompt.","","`text` is data; the model answers with a label alone. It resolves","`undefined` when the answer named none of `labels`. A failed request,","an abort or a reply with no text rejects, naming the cause."],"params":[["text","what to classify"],["labels","the labels to choose from (2 or more)"],["options","`model`: an alias or id; default the engine's small   fast model"]],"example":["const kind = await $.model.classify(e.text, [\"bug\", \"feature\"])","if (kind === undefined) return next(e)"],"returns":["the label the model named, or undefined when it named none;","         rejects when the request fails or the reply has no text"]}}]},{"noun":"audio","doc":{"desc":["Sound: clip playback and platform speech."],"params":[],"example":[],"returns":[]},"members":[{"name":"play","optional":false,"kind":"verb","sig":"(clip: AudioClip, options?: PlayOptions) => Promise<void>","doc":{"desc":["Plays one audio clip, starting now; clips are not queued, so two calls","play together (a bed under speech).","","`{ asset }` is the plugin's own file; `afplay` plays it on macOS, and a","Linux or Windows terminal, having no player, plays nothing. Resolves once","played or skipped; rejects, naming the cause, when the clip cannot play."],"params":[["clip","the plugin's own file (`{ asset }`), a URL the engine   fetches, or the bytes as base64 with their MIME type"],["options","`shouldLoop`, `gain`, and an AbortSignal that stops the   clip"]],"example":["await $.audio.play({ asset: \"sounds/done.wav\" })"],"returns":[]}},{"name":"speak","optional":false,"kind":"verb","sig":"(text: string, options?: SpeakOptions) => Promise<SpeakResult>","doc":{"desc":["Speaks `text` with the platform's own synthesizer (`say` on macOS).","Plain text.","","Utterances are queued among themselves; clips are not. Resolves when","the utterance has ended; rejects, naming the cause, when there is no","synthesizer, the voice is not installed, or the utterance failed."],"params":[["text","what to say, as plain text"],["options","`voice`: the system voice's exact name (`Samantha`);   absent, the synthesizer's default"]],"example":[],"returns":["which synthesizer spoke, once the utterance has ended"]}}]},{"noun":"mcp","doc":{"desc":["The engine's MCP servers: calling a connected one's tools, and","connecting one the plugin lists itself."],"params":[],"example":[],"returns":[]},"members":[{"name":"call","optional":false,"kind":"verb","sig":"(server: string, tool: string, args?: Record<string, unknown>) => Promise<McpToolResult>","doc":{"desc":["Calls `tool` on one of the engine's connected MCP servers with the","engine's own connection and credentials.","","A `cached` server is dialed on first use. No permission prompt: the","plugin's call, seen by the hooks above it, is the grant. Positional, not","the `{ tool: \"mcp__server__tool\", ... }` shape a `tool.call` hook sees."],"params":[["server","the server's name as /mcp lists it (`claude.ai Gmail`;   the tool-name spelling `claude_ai_Gmail` is accepted too)"],["tool","the tool's name on that server (`create_draft`)"],["args","the tool's arguments; none when absent"]],"example":["const { content } = await $.mcp.call(\"claude.ai Gmail\", \"create_draft\", {","  to: \"team@example.com\",","  subject: \"Release notes\",","})"],"returns":["the tool's result as MCP returns it: `content` blocks and","         `isError`"]}},{"name":"connect","optional":false,"kind":"verb","sig":"(server: string) => Promise<McpConnectResult>","doc":{"desc":["Connects one of the MCP servers this plugin's own manifest lists, if","the session has not already: a listed server joins it at its start.","","So listing a server defers nothing: to hold its tools back, refuse","their calls at `tool.check`. The same server run under another name","answers with that name; a refusal resolves with `reason`, `message`."],"params":[["server","the server's key in this plugin's manifest"]],"example":["const browser = await $.mcp.connect(\"browser\")","if (browser.isConnected) $.mcp.call(browser.server, \"open\", { url })"],"returns":["connected, with the name `call` takes, or why not"]}}]},{"noun":"session","doc":{"desc":["The running session, read as plain data; compacting it; and sending a","message from it to another agent or session."],"params":[],"example":[],"returns":[]},"members":[{"name":"messages","optional":false,"kind":"verb","sig":"SessionMessagesCall","doc":{"desc":["Returns the transcript so far, one SessionMessage per user or assistant","message; progress rows, `$.ui.log` lines and notices are not messages.","","With `{ agentId }`, one of this session's agents' instead (a subagent, a","fork, a teammate in this process): what the session saved for it joined","with what the engine holds. With `{ as: \"api\" }`, either as ApiMessage."],"params":[["args","`agentId`, the id `tool.call`, `turn.complete` and `$.agent             .list()` carry; `as: \"api\"` for ApiMessage; hooks see both"]],"example":["const last = (await $.session.messages()).at(-1)","const request = await $.session.messages({ as: \"api\" })","await $.http.fetch(AUDIT_URL, {","  method: \"POST\",","  body: JSON.stringify({ session: await $.session.id(), request }),","})","on(\"turn.complete\", async ($, e, next) => {","  if (e.agentId === undefined) return next(e)","  const found = await $.session.messages({ agentId: e.agentId })","  if (!(\"deny\" in found)) $.ui.log(`${found.length} messages`)","  return next(e)","})"],"returns":["the newest 4096 entries, `{ role, text, toolUses }` (a user","         message may add `toolResults`; a `toolUses` entry adds `result`","         and `text` once answered, an Agent tool use its `agentId`), or","         with `as` `{ role, content }`, blocks intact, at most 4096","         opening on a user message; for an `agentId` the session","         cannot read, `{ deny }` (SessionMessagesDeny), never main"]}},{"name":"cwd","optional":false,"kind":"verb","sig":"() => Promise<string>","doc":{"desc":["Returns the directory the session runs in, absolute.","","A timer that outlives its hook reads the session's directory; keep the","value read inside the hook if you need the hook's (a subagent's own)."],"params":[],"example":[],"returns":[]}},{"name":"root","optional":false,"kind":"verb","sig":"() => Promise<string>","doc":{"desc":["Returns the session's project root, absolute: where it started, or","where `/cd`, a host's directory change or a worktree move took it.","","A shell `cd` during the session does not move it; nested instruction","files are read only beneath it."],"params":[],"example":[],"returns":[]}},{"name":"model","optional":false,"kind":"verb","sig":"() => Promise<string>","doc":{"desc":["Returns the main loop's model, as `/model` shows it."],"params":[],"example":[],"returns":[]}},{"name":"turns","optional":false,"kind":"verb","sig":"() => Promise<number>","doc":{"desc":["Returns how many prompts the user has sent this session (user turns in","the transcript)."],"params":[],"example":[],"returns":[]}},{"name":"id","optional":false,"kind":"verb","sig":"() => Promise<string>","doc":{"desc":["Returns the session's id (the transcript file's name)."],"params":[],"example":[],"returns":[]}},{"name":"repo","optional":false,"kind":"verb","sig":"() => Promise<SessionRepo | null>","doc":{"desc":["Returns the git repository the session runs in, read from the working","copy on each call; null when the directory is not inside one."],"params":[],"example":["const repo = await $.session.repo(); const publicRepo = !repo?.internal"],"returns":[]}},{"name":"surfaces","optional":false,"kind":"verb","sig":"() => Promise<readonly RenderSurface[]>","doc":{"desc":["Returns every surface the session draws on, each once: `terminal` under","the REPL first, then the remote ones in the order they attached.","","A session may draw on several at once (a terminal and two phones):","clients attach (`session.attach`) and detach, and a render hook still","reads `e.surface` per ask. Empty in a plain -p run; never rejects."],"params":[],"example":["const inApp = (await $.session.surfaces()).some(s => s !== \"terminal\")"],"returns":[]}},{"name":"surface","optional":false,"kind":"verb","sig":"() => Promise<RenderSurface | null>","doc":{"desc":["Returns the first of `$.session.surfaces()`, or null where nothing","draws."],"params":[],"example":[],"returns":[]}},{"name":"usage","optional":false,"kind":"verb","sig":"(args?: SessionUsageArgs) => Promise<SessionUsage>","doc":{"desc":["Returns when the session began, and the context window's fill, the","rate-limit windows and the cost as the status line has them, itemized.","","The plain call costs nothing; `\"full\"` counts each category with the","token-count API as /context does, `\"summary\"` estimates locally, and","`context.breakdown` comes back in the SDK's `get_context_usage` shape."],"params":[["args","`{ breakdown, columns }`: how the breakdown is counted and   the width its grid is drawn in; nothing for the status line's figures"]],"example":["const { context } = await $.session.usage()","if ((context.percent ?? 0) >= 85) await $.session.compact()","const isOlder = stat.mtimeMs < (await $.session.usage()).startedAt","const usage = await $.session.usage({ breakdown: \"full\", columns })","for (const row of usage.context.breakdown?.gridRows ?? []) draw(row)"],"returns":["`{ startedAt, context, rateLimits, cost }` as the status line","  has them"]}},{"name":"version","optional":false,"kind":"verb","sig":"() => Promise<SessionVersion>","doc":{"desc":["Returns the version of the engine the session runs on, the release it","is built from, and when it was built.","","The same three values the engine's own analytics rows carry, answered","in every mode and build; `base` is absent when the version is not","spelled as a release, `builtAt` in a run from source that stamps none."],"params":[],"example":["const { version, base, builtAt } = await $.session.version()","row.env = { version, version_base: base, build_time: builtAt }","const isRelease = !(await $.session.version()).base?.endsWith(\"-dev\")"],"returns":["the full `version`, its release `base` (`2.1.280`, or","         `2.1.280-dev` for a development build) and an ISO `builtAt`"]}},{"name":"compact","optional":false,"kind":"verb","sig":"EventCalls['session']['compact']","doc":{"desc":["Compacts the conversation: the event `session.compact` with `trigger`","`plugin`, the same call `/compact` makes, between turns.","","It runs through every hook but the calling one, then core: a summary","and the kept messages in the transcript's place. Resolves `{ skip }`","when a hook vetoed it; rejects while a turn runs."],"params":[],"example":["const { skip } = await $.session.compact({ instructions: \"the plan\" })"],"returns":[]}},{"name":"send","optional":false,"kind":"verb","sig":"EventCalls['session']['send']","doc":{"desc":["Sends a plain-text message to another agent or session: the event","`session.send`, the model's SendMessage tool's own call and delivery.","","`to` is the tool's spelling (a name, an agent id, a received `from`","address) or `{ sessionId }` / `{ agentId }`; framed at the receiver as a","peer's, `origin.plugin` naming this plugin there. Resolves once queued."],"params":[],"example":["const sent = await $.session.send({ to: { sessionId }, text: \"ok\" })","await $.session.send({ to: { agentId }, text: \"stop after this file\" })"],"returns":[]}},{"name":"append","optional":false,"kind":"verb","sig":"(args: SessionAppendArgs) => Promise<SessionAppendResult>","doc":{"desc":["Appends a row to a conversation of the session: the event","`session.append`, the engine's own call for every row it keeps.","","A user-role row the person does not see as typed or a notice, of text","blocks alone in this release (else refused with the reason): listed at","once. `{ deny: reason }` when a plugin above refused it, nothing stored."],"params":[],"example":["await $.session.append({ message: { type: \"user\", content: [note] } })"],"returns":[]}},{"name":"authorize","optional":false,"kind":"verb","sig":"() => Promise<SessionAuthorization>","doc":{"desc":["Holds the session's Anthropic credential on the host and answers an","opaque handle and its kind; the secret never reaches the plugin.","","The handle is spent through `$.http.fetch(url, { auth: handle })`,","which sets the credential header, only for a first-party host. Null","with no first-party credential (a 3P provider, a gateway, no login)."],"params":[],"example":["await $.http.fetch(url, { auth: (await $.session.authorize())?.handle })"],"returns":[]}},{"name":"identity","optional":false,"kind":"verb","sig":"() => Promise<SessionIdentity>","doc":{"desc":["Returns how the session is signed in, to a mod the organization's","managed settings install; `{ deny }` to any other. No request is made.","","The account (organization, plan, email) only where managed","`forceLoginOrgUUID` lists its organization; else `kind` alone. A","contract, not a wall: any mod can read the person's own config file."],"params":[],"example":["const { kind, organizationId, email } = await $.session.identity()"],"returns":[]}}]},{"noun":"turn","doc":{"desc":["The running model turn: ending it."],"params":[],"example":[],"returns":[]},"members":[{"name":"abort","optional":false,"kind":"verb","sig":"(input: OpEventOf['turn.abort']) => Promise<void>","doc":{"desc":["Cancels the main loop's running model turn (the id its `turn.start`","handed this plugin), its running tools stopped, no interruption marker.","","The event `turn.abort`, seen by the hooks above; the prompt this","plugin submits next is the context. Rejects, naming both ids, when","`turnId` is not the running turn's; a hook may end its own turn."],"params":[["input","`turnId`: the id the main loop's `turn.start` carried"]],"example":["on(\"turn.start\", ($, e, next) => {","  if (e.agentId === undefined) held = e.turnId","  return next(e)","})"],"returns":[]}}]},{"noun":"prompt","doc":{"desc":["Submitting a prompt the model reads as a user turn, and the person's","prompt box: read as it stands, written, or proposed into."],"params":[],"example":[],"returns":[]},"members":[{"name":"submit","optional":false,"kind":"verb","sig":"EventCalls['prompt']['submit']","doc":{"desc":["Submits a prompt: the event `prompt.submit`, the same call the engine","makes for a typed prompt; a turn of its own, once the session is idle.","","It goes through every hook but the calling one (the plugin's others","see it) with `e.origin` `{ kind: 'plugin', name }`, the name the","model reads it under unless a hook leaves it out of its answer."],"params":[],"example":["void $.prompt.submit({ text: \"List the TODOs you just mentioned.\" })"],"returns":[]}},{"name":"read","optional":false,"kind":"verb","sig":"() => Promise<PromptBox>","doc":{"desc":["Returns the prompt box as it stands, the draft typed so far and the","cursor's offset into it, so a `fill` can keep what the person typed.","","Never rejects: `{ text: '', cursor: 0 }` where the session draws no box","(a -p run, an SDK host) or none is mounted yet."],"params":[],"example":["const { text, cursor } = await $.prompt.read()"],"returns":[]}},{"name":"media","optional":false,"kind":"verb","sig":"(args: PromptMediaArgs) => Promise<PromptMedia>","doc":{"desc":["Returns one image or document of the prompt being submitted, by the","`id` `e.attachments` lists it under: its bytes, base64, 4 MiB a call.","","For a `prompt.submit` hook; else `{ deny }`, as once the submission","has settled. The engine's own read, no event: no hook answers for it.","`{ unreadable }`: no image."],"params":[],"example":["const media = id ? await $.prompt.media({ id }) : undefined"],"returns":[]}},{"name":"fill","optional":false,"kind":"verb","sig":"(input: PromptFillArgs) => Promise<PromptFilled>","doc":{"desc":["Puts `input.text` in the prompt box as the draft, by `mode`: `replace`","(the default) over it, `append` after it, `insert` at the cursor.","","The event `prompt.fill` through the other plugins' hooks; `isFilled:","false` under a dialog or headless. To hand the model text WITH the next","prompt instead, a `prompt.submit` hook adds `context` (second example)."],"params":[],"example":["await $.prompt.fill({ text: `> ${quote}\\n`, mode: \"insert\" })","($, e, next) => next({ ...e, context: [...(e.context ?? []), hunk] })"],"returns":[]}},{"name":"paint","optional":false,"kind":"verb","sig":"(input: PromptPaintArgs) => Promise<PromptPainted>","doc":{"desc":["Sets this plugin's own decorations over the draft and nothing else.","","No text, caret or undo entry, no `prompt.change` or `prompt.edit`. Hooks","may rewrite or `{ deny }` it. `isPainted: false`, the box handed back,","when the draft no longer reads `text`, or another plugin hooks its read."],"params":[],"example":["await $.prompt.paint({ text, decorations: [{ start, end, bold: true }] })"],"returns":[]}},{"name":"suggest","optional":false,"kind":"verb","sig":"EventCalls['prompt']['suggest']","doc":{"desc":["Proposes `input.text` as the prompt box's dim suggestion, Tab to take:","the event `prompt.suggest`, as the engine's own guess after a turn.","","It goes through every other plugin's hook with `e.origin` `{ kind:","'plugin', name }`, the engine's own suggestions on or off; `{ isShown:","false }` while the box holds text, a turn runs, or headless (no box)."],"params":[],"example":["void $.prompt.suggest({ text: \"run the tests you just wrote\" })"],"returns":[]}},{"name":"compose","optional":false,"kind":"verb","sig":"EventCalls['prompt']['compose']","doc":{"desc":["Returns the system prompt's sections for `facts`: the event","`prompt.compose`, the call the engine makes for every prompt it sends.","","A fact left out is the session's own (its model, its tools). Through","every other plugin's hook, over the engine's own composition; composed","for nobody to send, so nothing the session holds is written."],"params":[],"example":["const ids = (await $.prompt.compose()).sections.map(s => s.id)"],"returns":[]}}]},{"noun":"tool","doc":{"desc":["The tools the model has in this session, and running one."],"params":[],"example":[],"returns":[]},"members":[{"name":"list","optional":false,"kind":"verb","sig":"() => Promise<ToolInfo[]>","doc":{"desc":["Returns the tools the model can call now, built-in and MCP alike, in","the order the model sees them."],"params":[],"example":["const names = (await $.tool.list()).map(t => t.name)"],"returns":[]}},{"name":"call","optional":false,"kind":"verb","sig":"EventCalls['tool']['call']","doc":{"desc":["Calls a tool: the event `tool.call`, the same call the engine makes for","the model's tool calls, under a `tool_use_id` of its own.","","It runs through every hook but the calling one (the plugin's others","see it), the permission check and its dialog, then the tool. Rejects","when no tool has that name or the call is aborted."],"params":[],"example":["const { text } = await $.tool.call({ tool: \"Read\", file_path: \"a.md\" })"],"returns":[]}},{"name":"check","optional":false,"kind":"verb","sig":"EventCalls['tool']['check']","doc":{"desc":["Asks the engine's permission decision for a tool call now: the event","`tool.check`, resolved to its verdict (`{ decision, reason?, ... }`).","","The hooks run (the calling hook's own frame skipped, `next.origin` this","plugin, no `tool_use_id`); nothing runs, no dialog opens, no PreToolUse","hook or classifier is asked."],"params":[],"example":["const { decision } = await $.tool.check({ tool: \"Read\", input })"],"returns":[]}},{"name":"register","optional":false,"kind":"verb","sig":"(tool: ToolSpec) => Promise<OpValueOf['tool.register']>","doc":{"desc":["Declares a tool the model can call from the next prompt on: the name,","description and input schema of `mcp__<plugin>__<name>`.","","Serve it with a `tool.call` hook on `{ tool: \"mcp__<plugin>__<name>\" }`","that returns the result (a call no hook answers fails); a name registered","again is replaced. Rejects until the session binds, at `session.start`."],"params":[["tool","`name`, `description` (what the model reads), `inputSchema`             (default `{ type: \"object\" }`), `isDeferred` (ToolSpec)"]],"example":["await $.tool.register({ name: \"weather\", description: \"Weather.\" })"],"returns":["`{ tool }`, the registered tool's full name","         `mcp__<plugin>__<name>`"]}}]},{"noun":"command","doc":{"desc":["The slash commands the person can run in this session, and running one."],"params":[],"example":[],"returns":[]},"members":[{"name":"list","optional":false,"kind":"verb","sig":"() => Promise<CommandInfo[]>","doc":{"desc":["Returns the slash commands the person can run now, built-in, plugin","and MCP alike, in the order the typeahead lists them."],"params":[],"example":["const names = (await $.command.list()).map(c => c.name)"],"returns":[]}},{"name":"run","optional":false,"kind":"verb","sig":"EventCalls['command']['run']","doc":{"desc":["Runs a slash command as if the person typed `/command args`: the","event `command.run`, queued and run once the session is idle.","","It runs through every hook but the calling one with `e.origin` `{ kind:","'plugin', name }`, its lines in the transcript. Rejects an unknown name,","inside a hook the turn or the session's start waits on, past a Stop or","a host's limit."],"params":[],"example":["const { text } = await $.command.run({ command: \"status\" })"],"returns":[]}},{"name":"register","optional":false,"kind":"verb","sig":"(command: CommandSpec) => Promise<OpValueOf['command.register']>","doc":{"desc":["Declares the slash command `/<name>` for this session, listed in the","typeahead from the next keystroke on.","","Serve it with a `command.run` hook on `{ command: \"<name>\" }` that","returns `{ text }`; a run no hook answers says so as its output.","Registering a name again replaces it; a built-in's name is refused."],"params":[["command","`name`, `description` (what the menu shows),   `argumentHint` (dim after the name), `immediate` (runs mid-turn)"]],"example":["await $.command.register({ name: \"hello\", description: \"Says hi.\" })"],"returns":["`{ command }`, the registered name"]}}]},{"noun":"config","doc":{"desc":["Every row of the settings menu (`/config`), the panel's own and each","enabled plugin's `userConfig` fields alike: listing and changing them."],"params":[],"example":[],"returns":[]},"members":[{"name":"list","optional":false,"kind":"verb","sig":"() => Promise<ConfigRow[]>","doc":{"desc":["Returns the rows the `/config` menu would draw now, in its order,","each with its current value, its kind, its owner and its lock.","","After every `config.describe` hook: a hidden row is left out, a","relabelled one carries the new label."],"params":[],"example":["const theme = (await $.config.list()).find(row => row.key === \"theme\")"],"returns":[]}},{"name":"set","optional":false,"kind":"verb","sig":"EventCalls['config']['set']","doc":{"desc":["Changes one row as if the person did in the menu: the event","`config.set` with `origin` `{ kind: 'plugin', name }`, then the writer.","","Through the other plugins' hooks, this plugin's own skipped; `{ deny }`","when a hook refused, the value does not fit, a trusted source owns the","row or only its dialog changes it. Rejects a key no row has."],"params":[["args","`key` (as `list` names it) and `value` (the row's kind)"]],"example":["const { deny } = await $.config.set({ key: \"verbose\", value: true })"],"returns":["`{ value }` once written, or `{ deny }`"]}}]},{"noun":"telemetry","doc":{"desc":["Analytics: first-party rows and feature marks for Anthropic, and records","for the telemetry collector the session's operator configured."],"params":[],"example":[],"returns":[]},"members":[{"name":"log","optional":false,"kind":"verb","sig":"(entry: TelemetryLogArgs) => Promise<void>","doc":{"desc":["Logs one record to the destination `entry.to` names, the event","`telemetry.log`; `e.to` is pinned, and `anthropic` when left out.","","A first-party row is queued by the built-in plugin that hooks the","event, for built-ins and the engine alone. A collector record reaches","the collector only when the engine raised it; any plugin may hook."],"params":[["entry","a first-party row, or a collector record"]],"example":["await $.telemetry.log({","  to: \"anthropic\",","  event: \"survey_answered\",","  props: { answer: 2, page: { value: \"ready\", of: [\"ready\", \"later\"] } },","})"],"returns":["once the hooks have answered; rejects when one denies"]}},{"name":"mark","optional":false,"kind":"verb","sig":"(entry: TelemetryMarkInput) => Promise<void>","doc":{"desc":["Marks one use of a feature as the CLI's own feature events do, the","event `telemetry.mark`; it takes no `to` and always means `anthropic`.","","The engine does nothing with it: the built-in plugins that hook the","event queue the row. They serve built-ins and the engine alone; any","plugin may hook it."],"params":[["entry","the feature, how its use went, why, and its properties"]],"example":["await $.telemetry.mark({ feature: \"learn_page\", kind: \"sad\",","  reason: \"blocked\" })"],"returns":["once the hooks have answered; rejects when one denies"]}}]},{"noun":"agent","doc":{"desc":["Subagents."],"params":[],"example":[],"returns":[]},"members":[{"name":"spawn","optional":false,"kind":"verb","sig":"EventCalls['agent']['spawn']","doc":{"desc":["Spawns a subagent: the event `agent.spawn`, the same call the engine","makes when the Agent tool starts one; the engine fills the rest.","","It runs every hook but the calling one, then the Agent tool in the","background under this call's origin: `{ model, agentId }` once the","subagent started (its answer is its `turn.complete`), or `{ deny }`.","","`{ deny }` is a hook's refusal, or the engine's own with its reason:","past a Stop or a host's limit nothing is spawned, as for a prompt."],"params":[],"example":["const { agentId } = await $.agent.spawn({ prompt: \"Read README.md.\" })"],"returns":[]}},{"name":"list","optional":false,"kind":"verb","sig":"() => Promise<AgentInfo[]>","doc":{"desc":["Returns the session's agents so far, subagents and teammates: the ones","the model spawned and the ones plugins did alike.","","One entry an agent, until the engine drops its task: as a teammate ends","or seconds after, a subagent's later. Loops the engine tracks as agents","with no `agent.spawn` (a forked skill) are here; a workflow's are not."],"params":[],"example":[],"returns":[]}},{"name":"register","optional":false,"kind":"verb","sig":"(spec: AgentSpec) => Promise<OpValueOf['agent.register']>","doc":{"desc":["Defines an agent type the Agent tool dispatches from the next turn on,","named `<plugin>:<name>`: the event `agent.register`.","","Every field takes effect as in an agent file; re-registered, a name is","replaced; unloaded, a plugin's types go. `agent.offer` hides it from","the model alone; any plugin's `$.agent.spawn` answers to `agent.spawn`."],"params":[["spec","`name`, `description` (when to delegate), `prompt` (its             system prompt), and any other field of an agent definition"]],"example":["await $.agent.register({ name: \"runner\", description: \"Runs a spec\",","  prompt: RUNNER_PROMPT, tools: [\"Read\", \"Bash\"], omitClaudeMd: true })","// runner-only: hidden from the model, spawned by this plugin's tool,","// answered by the subagent's turn.complete (matched by agentId)","on(\"agent.offer\", { agent: \"lab:runner\" }, () => ({ isOffered: false }))","on(\"tool.call\", { tool: \"mcp__lab__run\" }, async ($, e) => {","  const { agentId, deny } = await $.agent.spawn({","    subagentType: \"lab:runner\", prompt: e.spec, description: \"run\" })","  return { result: deny ?? (await answerOf(agentId)) }","})"],"returns":["`{ agent }`, the full name; rejects until the session binds,","         on a spec the schema refuses (its reason), on a hook's deny"]}}]},{"noun":"fs","doc":{"desc":["The file system as the engine's own process reaches it; a relative path","is under the session's working directory, and text is UTF-8.","","An absolute path is used as given; where one may go is an `fs.*` hook's","to say. A read or write over 4 MiB rejects, the implementation beneath the","hooks rejects a network location untouched, an OS refusal with its errno."],"params":[],"example":[],"returns":[]},"members":[{"name":"read","optional":false,"kind":"verb","sig":"FsReadCall","doc":{"desc":["Reads a file and returns its text, or with `{ as: \"bytes\" }` its bytes","as `{ base64 }`.","","Rejects when missing, or over 4 MiB, which bounds what one read copies","into the plugin's environment. A file the plugin ships is under","`$.plugin.root`."],"params":[["path","relative to the working directory, or absolute"],["options","`as`: `\"text\"` (the default) or `\"bytes\"`"]],"example":["const readme = await $.fs.read(\"README.md\")","const { base64 } = await $.fs.read(","  `${$.plugin.root}/hooks/weights.bin`, { as: \"bytes\" })","const weights = Uint8Array.fromBase64(base64)"],"returns":["the file's text, or `{ base64 }`"]}},{"name":"write","optional":false,"kind":"verb","sig":"(path: string, text: string) => Promise<void>","doc":{"desc":["Writes `text` to a file, creating it and its directories as needed."],"params":[["path","relative to the working directory, or absolute"],["text","the whole new content"]],"example":[],"returns":[]}},{"name":"list","optional":false,"kind":"verb","sig":"(path?: string) => Promise<FsEntry[]>","doc":{"desc":["Lists a directory by name: `{ name, kind, size, mtimeMs, isLink }` per","entry, each entry as it stands.","","A symbolic link is `other` with `isLink`; `size` and `mtimeMs` are a","regular file's own and 0 for every other kind (`$.fs.stat` has those)."],"params":[["path","the directory's path; absent, the working directory"]],"example":["const logs = await $.fs.list(\"logs\")","const newest = [...logs].sort((a, b) => b.mtimeMs - a.mtimeMs)[0]"],"returns":["the entries, `{ name, kind, size, mtimeMs, isLink }` each"]}},{"name":"exists","optional":false,"kind":"verb","sig":"(path: string) => Promise<boolean>","doc":{"desc":["Returns whether the path exists; rejects only a network location, which","the implementation beneath the hooks never touches."],"params":[],"example":[],"returns":[]}},{"name":"stat","optional":false,"kind":"verb","sig":"(path: string, options?: FsStatOptions) => Promise<FsStat>","doc":{"desc":["Returns `{ kind, size, mtimeMs, isLink }` of the path: what it leads to,","and whether it is itself a symbolic link. Rejects when missing.","","With `{ resolve: true }` also `realPath`, where the path lands, absent","when it leads nowhere; a guard matches it and denies without it, since a","spelling it cannot resolve (`~`, a file not there yet) the tool may open."],"params":[["path","relative to the working directory, or absolute"],["options","`resolve`: also answer `realPath` (one more file system                call)"]],"example":["// ROOT was resolved the same way and SEP is its separator; an","// allow-list under it is the robust guard, a deny-list on spellings","// only best effort (a hard link or a case alias keeps its own)","on(\"tool.call\", { tool: \"Read\" }, async ($, e, next) => {","  const stat = await $.fs.stat(e.file_path, { resolve: true })","    .catch(() => undefined)","  const real = stat?.realPath","  const isInside = real !== undefined && real.startsWith(ROOT + SEP)","  return isInside ? next(e) : { deny: \"outside the project\" }","})","// a Write may name a file not there yet: `placed` answers where the","// path lands or undefined, and the guard denies on undefined or","// outside ROOT. Unplaceable by spelling first, with no file system","// call (drive-relative `D:x`, a `\\\\` or `//` network or device path,","// a name that is empty, \".\", \"..\" or itself `C:...`); then the file","// if it stats; else its folder, cut after the last separator and","// keeping it so a drive or share root stays that root, plus the name","const placed = async (path) => {","  const cut = Math.max(path.lastIndexOf(\"/\"), path.lastIndexOf(\"\\\\\"))","  const name = path.slice(cut + 1)","  const isPlaceable = !/^[A-Za-z]:(?![\\\\/])/.test(path) &&","    !/^[\\\\/][\\\\/]/.test(path) && !/^[A-Za-z]:/.test(name) &&","    name !== \"\" && name !== \".\" && name !== \"..\"","  if (!isPlaceable) return undefined","  const own = await $.fs.stat(path, { resolve: true })","    .catch(() => undefined)","  if (own) return own.realPath","  const folder = cut < 0 ? \".\" : path.slice(0, cut + 1)","  const dir = await $.fs.stat(folder, { resolve: true })","    .catch(() => undefined)","  return dir?.realPath === undefined ? undefined","    : `${dir.realPath.replace(/[\\\\/]$/, \"\")}${SEP}${name}`","}","const real = await placed(e.file_path)","const isInside = real !== undefined && real.startsWith(ROOT + SEP)","return isInside ? next(e) : { deny: \"cannot place it, or outside\" }"],"returns":["the stat, `realPath` with it when asked and resolvable; rejects","         `ENOENT` for a missing path"]}},{"name":"ancestors","optional":false,"kind":"verb","sig":"(request: FsAncestorsRequest) => Promise<readonly FsAncestor[]>","doc":{"desc":["Reads the named instruction files in every directory above the","session's original working directory, the way the engine reads CLAUDE.md.","","Root first, each `{ dir, name, content }` that exists, the content","with its `@include`s after it; `of` and `below` together are the","engine's own walk for a nested CLAUDE.md between root and read file."],"params":[["request","`names`, relative `.md` file names (no `..`); `of`, the file walked down to; `below`, the directory the walk stays inside"]],"example":["const found = await $.fs.ancestors({ names: [\"AGENTS.md\"] })","const stack = await $.fs.ancestors({ names: [\"AGENTS.md\"], of: path })","const nested = await $.fs.ancestors({","  names: [\"AGENTS.md\"],","  of: e.file_path,","  below: await $.session.root(),","})"],"returns":["the files found, root first"]}}]},{"noun":"store","doc":{"desc":["This plugin's own key-value store, kept between sessions and hot","reloads; values are JSON data.","","A JSON file of the plugin's own under the user's Claude Code","configuration directory."],"params":[],"example":[],"returns":[]},"members":[{"name":"get","optional":false,"kind":"verb","sig":"(key: string) => Promise<unknown>","doc":{"desc":["Returns the value under `key`, or `undefined` when unset."],"params":[],"example":["const count = Number((await $.store.get(\"count\")) ?? 0) + 1"],"returns":[]}},{"name":"set","optional":false,"kind":"verb","sig":"(key: string, value: unknown) => Promise<void>","doc":{"desc":["Sets `key` to `value`, which must be JSON data.","","`get` reads back `JSON.parse(JSON.stringify(value))`: a Date is its ISO","string, an `undefined` field is dropped, a Map or Set is `{}`. Rejects","a function, a cycle, or a store over 4 MiB of JSON text in all."],"params":[],"example":[],"returns":[]}},{"name":"delete","optional":false,"kind":"verb","sig":"(key: string) => Promise<void>","doc":{"desc":["Removes `key` from the store."],"params":[],"example":[],"returns":[]}},{"name":"keys","optional":false,"kind":"verb","sig":"() => Promise<string[]>","doc":{"desc":["Returns every key set, in insertion order."],"params":[],"example":[],"returns":[]}}]},{"noun":"state","doc":{"desc":["Named values held by the host for the session, each with a version: plain","data that survives a hot reload of the plugin's code.","","A `get` made while a `ui.render` hook draws subscribes that instance: a","later `set` draws it again, nobody calling `$.ui.invalidate`. Any plugin","reads any value; its owner alone writes it. Persist through `$.store`."],"params":[],"example":[],"returns":[]},"members":[{"name":"get","optional":false,"kind":"verb","sig":"<P extends keyof PluginState & string, K extends keyof PluginState[P] & string>(ref: StateRef<P, K>) => Promise<StateRead<StateValue<P, K>>>","doc":{"desc":["Resolves the value under `ref` and the version it stands at; a value","never written is `undefined` at version 0.","","Every `get` of one dispatch reads one moment, whatever is written","meanwhile. `plugin` and `key` must be literals in source (`claude plugin","validate` lists them); only a family member's `id` may be computed."],"params":[["ref","`{ plugin, key }` as the owner's contract declares it in   PluginState, with `id` for a StateFamily key"]],"example":["const workers = { plugin: \"swarm\", key: \"workers\" } as const","const { value = [] } = await $.state.get(workers)"],"returns":["`{ value, version }`"]}},{"name":"set","optional":false,"kind":"verb","sig":"<P extends keyof PluginState & string, K extends keyof PluginState[P] & string>(ref: StateRef<P, K>, value: StateValue<P, K>, options?: StateSetOptions) => Promise<StateSetResult>","doc":{"desc":["Writes `value` under `ref`, which must be this plugin's own; the sites","that read it while drawing are drawn again, at the redraw rate.","","Refused while a `ui.render` hook draws (write from `onPress` or another","event) and for another plugin's value (hook its `state.set` and rewrite","`e.value`). JSON data, as `$.store.set` takes; never `undefined`."],"params":[["ref","`{ plugin, key }`, with `id` for a StateFamily key"],["value","the value, of the type the contract declares"],["options","`ifVersion`: write only while it stands at that version"]],"example":["await $.state.set(count, held.value + 1, { ifVersion: held.version })"],"returns":["`{ isSet, version }`; `isSet` false when `ifVersion` missed"]}}]},{"noun":"clock","doc":{"desc":["The time and timers, each an event through the host: `clock.now` reads","the time; `clock.sleep`, `after` and `every` wait until it has passed.","","A timer's callback is the plugin's own function, kept in its environment","and run there when the wait resolves; a hot reload of the plugin cancels","its pending waits with the old environment."],"params":[],"example":[],"returns":[]},"members":[{"name":"now","optional":false,"kind":"verb","sig":"() => Promise<number>","doc":{"desc":["Resolves milliseconds since the epoch, now."],"params":[],"example":["const startedAt = await $.clock.now()"],"returns":[]}},{"name":"sleep","optional":false,"kind":"verb","sig":"(ms: number, options?: SleepOptions) => Promise<void>","doc":{"desc":["Resolves after `ms` milliseconds; rejects at once when `signal` aborts.","","The wait is the hook's own time and its budget runs on through it, as","through no other `$` call: a `turn.step` generator that polls with it","pays every sleep out of its one budget (`next.budget.remainingMs`)."],"params":[["ms","how long, in milliseconds"],["options","`signal`: ends the wait early with a rejection (pass   `next.signal` so a hook's wait ends with its dispatch)"]],"example":["await $.clock.sleep(500, { signal: next.signal })"],"returns":[]}},{"name":"after","optional":false,"kind":"verb","sig":"TimerCall","doc":{"desc":["Calls `fn` once after `ms` milliseconds; `cancel()` before then stops it.","","One `clock.after` dispatch: `fn` runs when it resolves, and never when","a hook refuses it."],"params":[],"example":[],"returns":[]}},{"name":"every","optional":false,"kind":"verb","sig":"TimerCall","doc":{"desc":["Calls `fn` every `ms` milliseconds (at least 1) until `cancel()`.","","One `clock.every` dispatch per period: `fn` runs when it resolves and","the next period is asked; a refused period ends the interval."],"params":[],"example":["const tick = $.clock.every(1000, () => $.ui.status(\"polling\"))"],"returns":[]}}]},{"noun":"http","doc":{"desc":["The network, through the host."],"params":[],"example":[],"returns":[]},"members":[{"name":"fetch","optional":false,"kind":"verb","sig":"(url: string, init?: HttpInit) => Promise<HttpResponse>","doc":{"desc":["Fetches `url` through the host (never the plugin's own network) and","resolves `{ status, ok, headers, text }` once the body is read.","","http or https, to whatever the host reaches, unless the organization's","web-fetch policy refuses it. `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`","refuses a built-in's request, and any plugin's that carries `auth`."],"params":[["url","the URL (http or https)"],["init","`{ method, headers, body, auth, socketPath }` (body a             string; socketPath a Unix socket to go over instead of TCP)"]],"example":["const { ok, text } = await $.http.fetch(\"https://example.com/status\")","await $.http.fetch(\"http://bridge/reload\", {","  method: \"POST\",","  socketPath: `${runDirectory}/bridge.sock`,","})"],"returns":["`{ status, ok, headers, text }` once the body is read"]}}]},{"noun":"process","doc":{"desc":["Commands on the host, run as the user the session runs as. CLI only.","","Local execution, not a network path: what a command of its own reaches","is its own, as for the Bash tool and a settings `command` hook."],"params":[],"example":[],"returns":[]},"members":[{"name":"run","optional":false,"kind":"verb","sig":"(argv: readonly string[], init?: ProcessRunInit) => Promise<ProcessRunResult>","doc":{"desc":["Runs a command on the host by its argument vector (no shell) and","resolves `{ exitCode, stdout, stderr }` once it exits, any exit code.","","One shot: the whole output is read, so a background process left","writing holds the call until the timeout. Rejects when the command","cannot start or is still running then. Git runs with repo hooks off."],"params":[["argv","the command and its arguments, `argv[0]` the executable"],["init","`{ cwd, env, stdin, timeoutMs }` (cwd the session's by             default; timeout 30 s by default, ten minutes at most)"]],"example":["const { exitCode, stdout } = await $.process.run([\"git\", \"status\"])"],"returns":["`{ exitCode, stdout, stderr }`, each stream's first 4194304","         bytes (`isStdoutTruncated`, `isStderrTruncated` say when cut)"]}},{"name":"spawn","optional":false,"kind":"verb","sig":"(request: ProcessSpawnRequest) => HookStream<ProcessSpawnChunk, ProcessSpawnResult>","doc":{"desc":["Starts a command on the host by its argument vector (no shell) and","streams what it writes, piece by piece, then how it ended.","","The loop is the child's life: leaving it, `return()` on the stream,","`next.signal` aborting or the module unloading kills the child, and","nothing else does, a hook's return included: end the loop to end it."],"params":[["request","`{ argv, cwd, env, input }`, `$.process.run`'s rules;   `e` for a hook on `process.spawn` (a generator, its budget per piece)"]],"example":["// inline: the hook's dispatch waits on the loop; leaving it kills make","const make = $.process.spawn({ argv: [\"make\"], cwd: \"build\" })","for await (const { stream, text } of make) {","  if (stream === \"stderr\" && text.includes(\"error\")) break","}","// a child for the session's life: the loop runs on after the hook","// returns, and ends with the child or with the module","on(\"session.start\", async ($, e, next) => {","  const started = await next(e)","  void (async () => {","    const bridge = $.process.spawn({ argv: [\"bridge\", \"watch\", e.cwd] })","    for await (const { text } of bridge) $.ui.log(text, { to: \"debug\" })","  })()","  return started","})","// above another plugin's spawn: redact each piece before it reads it","on(\"process.spawn\", async function* ($, e, next) {","  for await (const chunk of next(e)) {","    yield { ...chunk, text: chunk.text.replaceAll(token, \"***\") }","  }","})"],"returns":["the pieces `{ stream, text }` (text as it came, not lines),","  then `{ code, signal }`; rejects its first pull if it cannot start"]}}]},{"noun":"settings","doc":{"desc":["What the settings files, `--settings` and managed policy hold, as the","engine runs under it; read only.","","Every key crosses as the source holds it, `env` and the helper commands","included: nothing is filtered. The OAuth session and the global config","(~/.claude.json) are not settings and are never read."],"params":[],"example":[],"returns":[]},"members":[{"name":"read","optional":false,"kind":"verb","sig":"SettingsReadOverloads","doc":{"desc":["Resolves with the settings merged over every source, with one","source's settings as loaded (`{ source }`), or with the value of one","top-level key (`{ key }`), undefined when the settings hold none.","","A snapshot in plain data each call; a source with no file answers","`{}`. Every read raises `settings.read` once, its layers on `e`","(SettingsReadInput); a read of one key is the read of the object,","projected, and raises no event of its own.","","The sources (SettingsSource) rise in precedence from `user` to","`policy`; with no hook the object is the engine's merge: a scalar","from the last source that has it, lists joined, objects merged.","","Raised by a plugin's call, and by the engine for its own merge once","the loaded plugins or the settings have changed, `next.origin` then","the engine. What the hooks answer there is what every reader of the","merged settings reads, and a changed answer takes effect as a changed","settings file does.","","No key is closed to a hook, the keys that decide which plugins load","included: those are read before any plugin is loaded, so the first set","loads by the files' own values and an answer applies from the load","after. A merge that never settles, an answer changing which plugins","load and those answering otherwise, is told in the settings error","list, and the files' own value stands for that key."],"params":[["args","`{ source }` for one source, `{ key }` for one key's             value, nothing for the merge"]],"example":["const { permissions } = await $.settings.read()","const policy = await $.settings.read({ source: \"policy\" })","const days = await $.settings.read({ key: \"cleanupPeriodDays\" })"],"returns":["the settings object, keyed as a settings.json is, or the","         key's value"]}}]},{"noun":"env","doc":{"desc":["The environment of this process, the one every Bash child, MCP server","and `$.process.run` command started after inherits.","","`get` and `set` take the variable's name as a string literal, so what a","module reads and writes is read off its source: `claude plugin validate`","lists the names, and a name the module does not spell is refused."],"params":[],"example":[],"returns":[]},"members":[{"name":"get","optional":false,"kind":"verb","sig":"(name: string) => Promise<string | undefined>","doc":{"desc":["Resolves with the variable's value, or `undefined` when it is unset.","","`name` must be a string literal; `claude plugin validate` lists the","names your module reads and writes."],"params":[],"example":["const home = await $.env.get(\"HOME\")"],"returns":[]}},{"name":"set","optional":false,"kind":"verb","sig":"(name: string, value: string | undefined) => Promise<EnvSetResult>","doc":{"desc":["Sets the variable for this process and everything it starts after, or","unsets it when `value` is `undefined`.","","`name` must be a string literal; `claude plugin validate` lists the","names your module reads and writes."],"params":[],"example":["await $.env.set(\"GIT_PAGER\", \"cat\")"],"returns":["`{}` once it is set or unset, or `{ deny }` saying why not"]}}]}],"events":{"EngineEventOf":[{"event":"tool.call","optional":false,"type":"ToolCallInput","doc":{"desc":["Fires when the engine is about to run a tool. Each `next(e)` runs the","hooks beneath, then core (the permission prompt, the tool itself).","","`{ deny: reason }` refuses and `{ result }` answers in place of `next`: a","deny after `next(e)` resolved undoes nothing it ran; returning with `next`","pending aborts what runs beneath. Managed-settings hooks' deny comes first."],"params":[],"example":[],"returns":[]}},{"event":"tool.check","optional":false,"type":"ToolCheckInput","doc":{"desc":["Fires when the engine decides whether a tool call may run, after the","`tool.call` and PreToolUse hooks and before the mode settles an ask.","","`next(e)` resolves to the engine's verdict (rules, mode, the tool's own","check, PreToolUse's decision) and runs no tool: return any `{ decision }`,","a deny after it too. `$.tool.check` runs the same chain, executing nothing."],"params":[],"example":["on(\"tool.check\", { tool: \"Read\" }, () => ({ decision: \"allow\" }))"],"returns":[]}},{"event":"ui.render","optional":false,"type":"RenderInput","doc":{"desc":["Fires when the engine is about to draw a component: once per input value","(props, viewport width), plugin load or `$.ui.invalidate(\"ui.render\")`.","","A repaint reuses the answer; a clock invalidates. `next(e)` resolves to the","drawing: return it, wrap it, draw your own, or rewrite `props`. An invalid","tree, or a throw while drawn, draws the engine's; `--plugin-dir` is told."],"params":[],"example":[],"returns":[]}},{"event":"ui.resolve","optional":false,"type":"ResolveInput","doc":{"desc":["Fires when the plugins load (not per draw), once per surface, component","and plugin: `e` names the surface and component, never the props.","","`next(e)` resolves to the surface's table, which `$.ui.resolve(e)` then","reads. Return it, one with an element restyled for every other plugin,","or one with a key left out (a fragment there); own table: hook skipped."],"params":[],"example":[],"returns":[]}},{"event":"ui.press","optional":false,"type":"UiPressArgument","doc":{"desc":["Fires when a `Button` a render hook drew is pressed on a surface; `e` is","`{ plugin, element, component, surface }`, `element` the button's `key`.","","`next(e)` runs the hooks beneath, then core: the element's own `onPress`","closure, in its plugin's environment, resolving to `{ element }`. Return","`next(e)` to let the press through, or `{ element }` to take it."],"params":[],"example":[],"returns":[]}},{"event":"ui.input","optional":false,"type":"UiInputArgument","doc":{"desc":["Fires when an `Input` a render hook drew changes or is submitted; `e` is","`{ plugin, element, component, surface, kind, value }`.","","`next(e)` runs the hooks beneath, then the element's own `onInput` or","`onSubmit` with `e.value` as the chain left it, resolving to `{ element,","value }`; `next({ ...e, value })` rewrites the typing, an answer takes it."],"params":[],"example":[],"returns":[]}},{"event":"ui.select","optional":false,"type":"UiSelectArgument","doc":{"desc":["Fires when a `Select` a render hook drew is picked from; `e` is","`{ plugin, element, component, surface, value }`.","","`next(e)` runs the hooks beneath, then the element's own `onSelect` with","`e.value` as the chain left it, resolving to `{ element, value }`;","`next({ ...e, value })` rewrites the pick, an answer takes it."],"params":[],"example":[],"returns":[]}},{"event":"ui.message","optional":false,"type":"UiMessageArgument","doc":{"desc":["Fires when a `Client` THIS plugin drew posts from its surface module","(`surface.post(data)`); only this plugin's hooks see it.","","`next.origin` names `client`: `data` came from code. Core answers `{}`;","`next({ ...e, data })` rewrites the data; `{ props }` hands the posting","instance its next props without a redraw. One per instance per frame."],"params":[],"example":[],"returns":[]}},{"event":"ui.fault","optional":false,"type":"UiFaultInput","doc":{"desc":["Fires when a `Client` THIS plugin drew failed on a surface: its module","did not load, its drawing failed, or its code failed after it had drawn.","","Only this plugin's hooks see it; `e.phase` says when, `e.reason` why.","Observe only: core answers `{}`. The engine then draws that site again,","unasked: fall back by leaving the `Client` out."],"params":[],"example":["on(\"ui.fault\", ($, e, next) => ($.ui.log(e.reason), next(e)))"],"returns":[]}},{"event":"ui.scroll","optional":false,"type":"UiScrollInput","doc":{"desc":["Fires before a site's window moves: the person's wheel or scroll keys on","a `Pane` body or the `AbovePrompt` band, at its edges too; `$.ui.scroll`.","","`next(e)` moves it to `e.offset` and draws: `{}`; `next({ ...e, offset","})` elsewhere; no `next` (`{}` or `{ deny }`) leaves it undrawn, so a hook","drawing its own rows under a header moves them by `e.by` and invalidates."],"params":[],"example":["on(\"ui.scroll\", { requestId: \"log\" }, ($, e) => (scrollOwnRows(e.by), {}))"],"returns":[]}},{"event":"ui.focus","optional":false,"type":"UiFocusInput","doc":{"desc":["Fires before a site's focus ring moves: the person's Tab, arrows or click","in a `Pane` or the band; an `autoFocus` element taking it; `$.ui.focus`.","","`next(e)` lands it on `e.element` (absent: one of the engine's stops) and","draws: `{}`; `next({ ...e, element })` on another of `e.plugin`'s; no","`next` (`{}` or `{ deny }`) keeps it where it was, drawn as it was."],"params":[],"example":["on(\"ui.focus\", { requestId: \"list\" }, ($, e, next) => (mark(e), next(e)))"],"returns":[]}},{"event":"agent.offer","optional":false,"type":"AgentOfferInput","doc":{"desc":["Fires when the engine offers an agent type to the model, in the agent","listing and again at dispatch; `next(e)` resolves to `{ isOffered: true }`.","","Return `{ isOffered: false }` to keep the type out of the listing and","refuse its dispatch. A hook that fails passes it through."],"params":[],"example":["on(\"agent.offer\", { agent: \"Plan\" }, () => ({ isOffered: false }))"],"returns":[]}},{"event":"agent.spawn","optional":false,"type":"AgentSpawnInput","doc":{"desc":["Fires when the Agent tool, or a workflow script's `agent()`","(`e.workflow`), is about to start an agent, its model not yet resolved.","","`next(e)` resolves to `{ model }`. Return it, `next({ ...e, model })`,","`{ model }` of your own (an alias resolves like the tool's parameter), or","`{ deny: reason }`."],"params":[],"example":[],"returns":[]}},{"event":"prompt.submit","optional":false,"type":"PromptSubmitInput","doc":{"desc":["Fires when a prompt is submitted, before the turn starts. `next(e)` runs","the hooks beneath and the UserPromptSubmit settings hooks, then it enters.","","Rewrite with `next({ ...e, text })` (the user message on screen follows)","or, in its place, stop it with `{ drop: reason }`; a broken plugin never","blocks one. Typed while a turn ran, it fires at Enter, with that turn's id."],"params":[],"example":[],"returns":[]}},{"event":"prompt.fill","optional":false,"type":"PromptFillInput","doc":{"desc":["Fires when a text is about to be put in the prompt box as the person's","draft (a plugin's `$.prompt.fill`); `next(e)` writes it by `e.mode`.","","`replace` over the draft, `append` after it, `insert` at the cursor;","rewrite `text` or `mode` going down, or answer `{ isFilled: false }`","without `next` to keep it out, as core does under a dialog or headless."],"params":[],"example":["on(\"prompt.fill\", ($, e, next) => next({ ...e, text: e.text.trim() }))"],"returns":[]}},{"event":"prompt.suggest","optional":false,"type":"PromptSuggestInput","doc":{"desc":["Fires when a text is proposed as the prompt box's dim suggestion, Tab to","take: the engine's guess after a turn, or a plugin's `$.prompt.suggest`.","","`next(e)` shows it: `{ isShown }`. Rewrite with `next({ ...e, text })`,","or answer `{ isShown: false }` without `next` to drop it; core answers","that too while the box holds text or a turn runs."],"params":[],"example":["on(\"prompt.suggest\", () => ({ isShown: false }))"],"returns":[]}},{"event":"prompt.edit","optional":false,"type":"PromptEditInput","doc":{"desc":["Fires when the person edits the main prompt box: a key the editor took as","an edit, or a paste; `next(e)` resolves the box the editor shows.","","`e` is the draft before and the splice (`start`, `end`, `inputText`); a","burst of keys is one edit. Rewrite `inputText` going down or the box","coming up; `{ text: e.text, cursor: e.cursor }` without `next` consumes."],"params":[],"example":["on(\"prompt.edit\", ($, e) => ({ text: e.text, cursor: e.cursor }))"],"returns":[]}},{"event":"prompt.change","optional":false,"type":"PromptChangeInput","doc":{"desc":["Fires after the main prompt box's text changed and no `prompt.edit`","carried it: a recalled history entry, a clear, a plugin's fill.","","`e` is the box as it stands and `e.origin` who changed it. Observe only:","the change is in the box. One per batch of changes, one at a time."],"params":[],"example":["on(\"prompt.change\", ($, e, next) => ($.ui.status(e.origin.kind), next(e)))"],"returns":[]}},{"event":"prompt.autocomplete","optional":false,"type":"PromptAutocompleteInput","doc":{"desc":["Fires as the person types in the main prompt box, for the token at the","cursor; `next(e)` resolves to `{ suggestions }`, rows for the typeahead.","","Nothing waits on it: the engine's own rows draw first and these join","beneath them, unhighlighted, for the word still being typed. Taking one","writes its `text` over the token. Only while a plugin hooks it."],"params":[],"example":["on(\"prompt.autocomplete\", () => ({ suggestions: [{ text: \"#123\" }] }))"],"returns":[]}},{"event":"prompt.section","optional":false,"type":"PromptSectionInput","doc":{"desc":["Fires once per named section of the system prompt, when the engine","assembles it; `next(e)` resolves to `{ text }` as core computed it.","","`e.name` is the section's id, on every model the one `prompt.compose`","lists. Cached, so keep it steady: after `$.ui.invalidate(\"prompt.section\")`","a changed answer goes out next turn over the text the main thread sent,","which loses its thinking and the cache. A failed hook passes through."],"params":[],"example":["on(\"prompt.section\", { name: \"memory\" }, () => ({ text: null }))"],"returns":[]}},{"event":"prompt.context","optional":false,"type":"PromptContextInput","doc":{"desc":["Fires once per conversation, when the engine computes the context blocks","its first user message carries; `next(e)` resolves to `{ blocks }`.","","Append, drop, reorder or rewrite with `next({ ...e, blocks })`; the","answer stands until `$.ui.invalidate(\"prompt.context\")` or a re-read","(compaction, `/clear`). `PromptContextResult` says what the model is sent."],"params":[],"example":["on(\"prompt.context\", () => ({ blocks: [] }))"],"returns":[]}},{"event":"prompt.compose","optional":false,"type":"PromptComposeInput","doc":{"desc":["Fires when the engine renders a system prompt; `next(e)` resolves to","`{ sections }`, each `{ id, text, scope }`, in the order they are sent.","","The ids depend on the prompt composed (`lean`, `bare` in `e.traits`): read","them off `next(e)`. Append (as `session`), replace, reorder or drop; a list","with a `shared` section after a `session` one skips the hook."],"params":[],"example":[],"returns":[]}},{"event":"prompt.attachment","optional":false,"type":"PromptAttachmentInput","doc":{"desc":["Fires once per message the engine injects for the model on its own (a","reminder, a mode transition, a mentioned file), as a request carries it.","","`next(e)` resolves to `{ text }`; `{ text: null }` leaves it out. The","answer holds per attachment for the process (asked again on resume or","`$.ui.invalidate`); the transcript keeps the engine's record."],"params":[],"example":["on(\"prompt.attachment\", { type: \"todo_reminder\" }, () => ({ text: null }))"],"returns":[]}},{"event":"prompt.mention","optional":false,"type":"PromptMentionInput","doc":{"desc":["Fires once per path a prompt names after an `@`, a directory aside,","before the engine reads it; `next(e)` reads it and resolves `{ type }`.","","No `tool.call` is raised for this read. Add `context` to what `next`","gave, read another `path` with `next({ ...e, path })`, or answer","`{ deny: reason }` so nothing is read."],"params":[],"example":["on(\"prompt.mention\", { path: /\\.env$/ }, () => ({ deny: \"a secret\" }))"],"returns":[]}},{"event":"tool.describe","optional":false,"type":"ToolDescribeInput","doc":{"desc":["Fires when the engine first renders the tool's schema in a session;","`next(e)` resolves to `{ description, isDeferred? }`.","","An MCP tool behind ToolSearch fires twice: its short text, then the one","loaded. Cached until `$.ui.invalidate(\"tool.describe\")`: a changed answer","for a tool a thread has sent goes out next turn over that text, which","loses its thinking and the whole prompt cache."],"params":[],"example":["on(\"tool.describe\", { tool: \"Bash\" }, ($, e) => ({ ...e, description }))","on(\"tool.describe\", { tool: \"Monitor\" }, pin) // {...e, isDeferred: false}"],"returns":[]}},{"event":"command.run","optional":false,"type":"CommandRunInput","doc":{"desc":["Fires when a slash command is about to run (`/name args` typed, or a","plugin's `$.command.run`); `next(e)` resolves to `{ text }`, its output.","","Core is the engine's command (a registered one has none). Rewrite `args`","with `next`, or return `{ text }` without it to answer in its place; one","after `next` replaces a printed output, not a panel or prompt it opened."],"params":[],"example":["on(\"command.run\", { command: \"hello\" }, () => ({ text: \"hello\" }))"],"returns":[]}},{"event":"command.describe","optional":false,"type":"CommandDescribeInput","doc":{"desc":["Fires once per command, when the engine lists it for the typeahead and","`/help`; `next(e)` resolves to `{ description, argumentHint, isHidden }`.","","Listed answers are cached for the session until","`$.ui.invalidate(\"command.describe\")`. A hook that fails passes it","through."],"params":[],"example":["on(\"command.describe\", ($, e, next) => next({ ...e, isHidden: true }))"],"returns":[]}},{"event":"config.set","optional":false,"type":"ConfigSetInput","doc":{"desc":["Fires when a `/config` row is about to change, from the menu or a","plugin's `$.config.set`; `next(e)` resolves to `{ value }` once written.","","Return `{ deny: reason }` to leave the row as it is (the menu says why),","or `next({ ...e, value })` to clamp it; a value of the wrong kind for","the row is refused. A row a trusted source owns is core's to refuse."],"params":[],"example":["on(\"config.set\", { key: \"theme\" }, () => ({ deny: \"the theme stays\" }))"],"returns":[]}},{"event":"config.describe","optional":false,"type":"ConfigDescribeInput","doc":{"desc":["Fires once per `/config` row, when the menu lists it and for","`$.config.list`; `next(e)` resolves to `{ label, description, isHidden }`.","","Relabel, re-describe or hide with `next({ ...e, isHidden: true })`; the","answers are cached until `$.ui.invalidate(\"config.describe\")` or the","loaded plugins change. A hook that fails passes the row through."],"params":[],"example":["on(\"config.describe\", { key: \"tips\" }, hide) // answers isHidden: true"],"returns":[]}},{"event":"telemetry.log","optional":false,"type":"TelemetryLogInput","doc":{"desc":["Fires when a record is about to be logged to the destination `e.to`","names: a built-in's `$.telemetry.log`, or the engine's own events.","","`e.to` is pinned: a hook rewrites what the record carries, never where","it goes. `next(e)` resolves `{ value: undefined }`; `{ deny }` rejects the","caller. Beneath the hooks the engine exports its own collector records."],"params":[],"example":["on(\"telemetry.log\", { to: \"collector\" }, ($, e, next) => next(e))"],"returns":[]}},{"event":"telemetry.mark","optional":false,"type":"TelemetryMarkInput","doc":{"desc":["Fires when one use of a feature is marked (`$.telemetry.mark`), as the","CLI's own feature events mark one; always for `anthropic`, no `to`.","","`next(e)` resolves `{ value: undefined }`; `{ deny }` rejects the caller.","The engine does nothing with a mark: the built-ins hooked here do."],"params":[],"example":["on(\"telemetry.mark\", { kind: \"bad\" }, ($, e, next) => next(e))"],"returns":[]}},{"event":"skill.prompt","optional":false,"type":"SkillPromptInput","doc":{"desc":["Fires when the engine expands a skill's prompt for the model (`/name`,","the Skill tool, a preload); `next(e)` resolves to `{ text }` as computed.","","Return `{ text }` with the text the model reads instead. A hook that","fails passes it through."],"params":[],"example":["on(\"skill.prompt\", { skill: \"commit\" }, () => ({ text: \"A haiku.\" }))"],"returns":[]}},{"event":"attribution.text","optional":false,"type":"AttributionTextInput","doc":{"desc":["Fires when the engine composes a git text the model is to write (`kind`:","`commit`, `pr`, `exemption`, `remedy`); `next(e)` resolves to `{ text }`.","","Return `{ text }` with the text the model reads instead. A hook that","fails passes it through."],"params":[],"example":["on(\"attribution.text\", { kind: \"commit\" }, () => ({ text: \"\" }))"],"returns":[]}},{"event":"session.start","optional":false,"type":"SessionStartInput","doc":{"desc":["Fires once per process for each loaded plugin, before the first prompt,","then once per fresh load of one (never `/clear`); `next(e)` is `{ cwd }`.","","Observe. The first is awaited: a `$.tool.register` is listed by turn one.","A later one runs its hooks alone: an enable, a worker respawn, or a reload","(changed modules only; all if one hooks `engine.create`/`plugin.register`)."],"params":[],"example":["on(\"session.start\", ($, e, next) => $.tool.register(t).then(() => next(e)))"],"returns":[]}},{"event":"session.receive","optional":false,"type":"SessionReceiveInput","doc":{"desc":["Fires when a delivery reaches the session, before it is queued: a relay's","event, a peer's message, a Remote Control prompt, room events; `{ text }`.","","Rewrite with `next({ ...e, text })`, or return `{ consumed: reason }` to","take it: nothing is queued, shown or read by the model. `origin`,","`event` and `agentId` pass on as received; `session.send` is its dual."],"params":[],"example":["on(\"session.receive\", { origin: \"peer\" }, () => ({ consumed: \"muted\" }))"],"returns":[]}},{"event":"session.append","optional":false,"type":"SessionAppendInput","doc":{"desc":["Fires once per row a conversation of this session keeps (a prompt, a","response block, a tool result, a notice), before it is stored.","","`next({ ...e, message })` rewrites `content`: stored and sent after. The","screen, an SDK stream or Remote Control may show the row just before its","rewrite; the model and the transcript file never read that form."],"params":[],"example":["on(\"session.append\", { door: \"tool-result\" }, ($, e, n) => n(scrub(e)))"],"returns":[]}},{"event":"session.send","optional":false,"type":"SessionSendInput","doc":{"desc":["Fires when a plain-text message is about to leave this conversation for","another agent or session (the SendMessage tool, or `$.session.send`).","","`e.origin` says who sends, `e.agentId` which loop. Rewrite `text` or","readdress `to` with `next` (a new `to` is judged again); `{ isDelivered:","false, reason }` without `next` refuses it. `next(e)` resolves queued."],"params":[],"example":["on(\"session.send\", ($, e, next) => next({ ...e, text: redact(e.text) }))"],"returns":[]}},{"event":"session.compact","optional":false,"type":"SessionCompactInput","doc":{"desc":["Fires when the conversation is about to be compacted (`/compact`, the","threshold, a plugin, or ahead of time); `next(e)` resolves `{ messages }`.","","Rewrite `instructions` or `messages` on the way down, the messages on","the way up, or answer `{ messages }` of your own; `{ skip: reason }`","leaves the conversation as it is. `trigger` passes on as received."],"params":[],"example":["on(\"session.compact\", { trigger: \"precompute\" }, () => ({ skip: \"off\" }))"],"returns":[]}},{"event":"session.attach","optional":false,"type":"SessionAttachInput","doc":{"desc":["Fires when a remote client joins the session's roster of attached","surfaces: it said so (ui_attach), or it first asked to draw.","","Observe (a phone joined: draw the lobby); `next(e)` resolves to","`{ clientId }`, a different return changes nothing. `$.session.surfaces()`","reads the roster; a render hook still reads `e.surface` per ask."],"params":[],"example":["on(\"session.attach\", { surface: \"mobile\" }, ($, e, next) => next(e))"],"returns":[]}},{"event":"session.detach","optional":false,"type":"SessionDetachInput","doc":{"desc":["Fires when a client leaves the roster: it detached, or the session ended","with it attached (`e.reason`). Observe; `next(e)` echoes `{ clientId }`.","","With reason `end` it runs inside `session.end`'s one short bound: there","`next.budget` reads that bound and `next.signal` aborts at it."],"params":[],"example":[],"returns":[]}},{"event":"session.measure","optional":false,"type":"SessionMeasureInput","doc":{"desc":["Fires when the engine measures the session and a unit moved: after each","main-thread turn, and when a rate-limit window moves a whole point.","","Observe; `next(e)` echoes `{ changed }`. `$.session.usage()`'s figures,","pushed, not polled: compare them with your own threshold here, call the","op for the breakdown. One at a time, a burst folding into one more."],"params":[],"example":["on(\"session.measure\", ($, e, next) => (toastPast90(e.rateLimits), next(e)))"],"returns":[]}},{"event":"session.end","optional":false,"type":"SessionEndInput","doc":{"desc":["Fires once when the session ends (exit, /clear, resume, logout, signal, a","`-p` run done), after its SessionEnd settings hooks; `e.reason` says which.","","`next(e)` runs the engine's end step, `{ sessionId }`; `e.resume.id` is","`--resume`'s. Exits stay fast whatever is loaded: the whole chain shares","one short wall-clock bound, which `next.budget` reads (SessionEndInput)."],"params":[],"example":["on(\"session.end\", async ($, e, next) => (await save(next.budget), next(e)))"],"returns":[]}},{"event":"plugin.register","optional":false,"type":"PluginRegisterInput","doc":{"desc":["Fires once per hooks module about to join the chain, at load (the set","folded and built, nothing swapped in) and at reload; core allows.","","Return `{ refuse: reason }` and it never joins: no hook, no noun, no tool","of it; the debug log names who refused. Its judges, `$` whole, are the","plugins admitted before it and the binary's; judge by `tier` and `uses`."],"params":[],"example":["on(\"plugin.register\", { tier: \"user\" }, () => ({ refuse: \"managed only\" }))"],"returns":[]}},{"event":"turn.start","optional":false,"type":"TurnStartInput","doc":{"desc":["Fires when a model turn begins, main's or a subagent's (`e.agentId`),","before its first model call; `next(e)` resolves to `{ turnId }`.","","Observe: a different return changes nothing. For the main loop alone,","return `next(e)` first when `e.agentId !== undefined`. An agent's start","skips the hooks its spawn was nested in, as its `turn.step`s do."],"params":[],"example":[],"returns":[]}},{"event":"turn.step","optional":false,"type":"TurnStepInput","doc":{"desc":["Fires when the engine is about to send a model request of a turn, main's","or a subagent's (`e.agentId`); `next(e)` resolves to the whole response.","","`next({ ...e, model })` or `effort` sends another; the turn, the index and","the message count are pinned. An answer without `next` sends no request.","It streams (StreamNext): the hook's budget counts its own code alone."],"params":[],"example":[],"returns":[]}},{"event":"turn.complete","optional":false,"type":"TurnCompleteInput","doc":{"desc":["Fires when a model turn has ended, at the point its duration is reported;","`next(e)` resolves to `{ text }`, the answer. `e.reason` says why.","","Return `{ text }` with a different text to show it beneath the answer (a","synopsis, a TL;DR line); the transcript's record is never rewritten. A","hook that fails leaves the answer as it was."],"params":[],"example":[],"returns":[]}},{"event":"engine.create","optional":false,"type":"EngineCreateInput","doc":{"desc":["Runs while `$` is being built, once per load or reload of this plugin","and before any other hook of it; `next(e)` resolves to `$` built so far.","","A step may ADD nouns and, outside `user`, WITHHOLD them (leave one out, or","return without `next`). It fails, and its plugin unloads, when it REPLACES","another's; in `user`, also past its own stub, or adding a seated name."],"params":[],"example":[],"returns":[]}}],"EngineResultOf":[{"event":"tool.call","optional":false,"type":"ToolCallResult","doc":{"desc":["`{ result, context? }`, `{ deny }`, or core's `{ ref, result }`."],"params":[],"example":[],"returns":[]}},{"event":"tool.check","optional":false,"type":"ToolCheckResult","doc":{"desc":["`{ decision, reason?, rule?, hook?, setting?, plugin?, ceiling? }`."],"params":[],"example":[],"returns":[]}},{"event":"ui.render","optional":false,"type":"RenderElement","doc":{"desc":["The tree to draw; `{ type: \"engine\", ref }` is core's own drawing."],"params":[],"example":[],"returns":[]}},{"event":"ui.resolve","optional":false,"type":"ElementTable","doc":{"desc":["The surface's element table (Elements[e.surface]): constructors from props","to a RenderElement."],"params":[],"example":[],"returns":[]}},{"event":"ui.press","optional":false,"type":"UiPressResult","doc":{"desc":["`{ element }`: the element whose handler the press reached."],"params":[],"example":[],"returns":[]}},{"event":"ui.input","optional":false,"type":"UiInputResult","doc":{"desc":["`{ element, value }`: the field whose handler the input reached, and","the text it received."],"params":[],"example":[],"returns":[]}},{"event":"ui.select","optional":false,"type":"UiSelectResult","doc":{"desc":["`{ element, value }`: the picker whose handler the pick reached, and","the value it received."],"params":[],"example":[],"returns":[]}},{"event":"ui.message","optional":false,"type":"UiMessageResult","doc":{"desc":["`{ props? }`: the posting instance's next props, when a hook hands some."],"params":[],"example":[],"returns":[]}},{"event":"ui.fault","optional":false,"type":"UiFaultResult","doc":{"desc":["`{}`: the fault was heard."],"params":[],"example":[],"returns":[]}},{"event":"ui.scroll","optional":false,"type":"UiScrollResult","doc":{"desc":["`{}` once the window moved, or `{ deny }`."],"params":[],"example":[],"returns":[]}},{"event":"ui.focus","optional":false,"type":"UiFocusResult","doc":{"desc":["`{}` once the ring moved, or `{ deny }`."],"params":[],"example":[],"returns":[]}},{"event":"agent.offer","optional":false,"type":"AgentOfferResult","doc":{"desc":["`{ isOffered }`."],"params":[],"example":[],"returns":[]}},{"event":"agent.spawn","optional":false,"type":"AgentSpawnResult","doc":{"desc":["`{ model }` or `{ deny }`."],"params":[],"example":[],"returns":[]}},{"event":"prompt.submit","optional":false,"type":"PromptSubmitResult","doc":{"desc":["`{ text, context? }` or `{ drop }`."],"params":[],"example":[],"returns":[]}},{"event":"prompt.fill","optional":false,"type":"PromptFillResult","doc":{"desc":["`{ isFilled }`."],"params":[],"example":[],"returns":[]}},{"event":"prompt.suggest","optional":false,"type":"PromptSuggestResult","doc":{"desc":["`{ isShown }`."],"params":[],"example":[],"returns":[]}},{"event":"prompt.edit","optional":false,"type":"PromptEditResult","doc":{"desc":["`{ text, cursor }`, the box the editor shows next."],"params":[],"example":[],"returns":[]}},{"event":"prompt.change","optional":false,"type":"PromptChangeResult","doc":{"desc":["`{ text }`."],"params":[],"example":[],"returns":[]}},{"event":"prompt.autocomplete","optional":false,"type":"PromptAutocompleteResult","doc":{"desc":["`{ suggestions }`, the rows the plugins add to the typeahead."],"params":[],"example":[],"returns":[]}},{"event":"prompt.section","optional":false,"type":"PromptSectionResult","doc":{"desc":["`{ text }` (null leaves the section out)."],"params":[],"example":[],"returns":[]}},{"event":"prompt.context","optional":false,"type":"PromptContextResult","doc":{"desc":["`{ blocks }` (a block left out is not sent)."],"params":[],"example":[],"returns":[]}},{"event":"prompt.compose","optional":false,"type":"PromptComposeResult","doc":{"desc":["`{ sections }`, every `shared` one ahead of every `session` one (a","section left out is not sent)."],"params":[],"example":[],"returns":[]}},{"event":"prompt.attachment","optional":false,"type":"PromptAttachmentResult","doc":{"desc":["`{ text }` (null leaves the attachment out)."],"params":[],"example":[],"returns":[]}},{"event":"prompt.mention","optional":false,"type":"PromptMentionResult","doc":{"desc":["`{ type, context? }` (null when nothing was attached) or `{ deny }`."],"params":[],"example":[],"returns":[]}},{"event":"tool.describe","optional":false,"type":"ToolDescribeResult","doc":{"desc":["`{ description, isDeferred? }`."],"params":[],"example":[],"returns":[]}},{"event":"command.run","optional":false,"type":"CommandRunResult","doc":{"desc":["`{ text }` (the command's output, when it printed one)."],"params":[],"example":[],"returns":[]}},{"event":"command.describe","optional":false,"type":"CommandDescribeResult","doc":{"desc":["`{ description, argumentHint, isHidden }`."],"params":[],"example":[],"returns":[]}},{"event":"config.set","optional":false,"type":"ConfigSetResult","doc":{"desc":["`{ value }` once written, or `{ deny }`."],"params":[],"example":[],"returns":[]}},{"event":"config.describe","optional":false,"type":"ConfigDescribeResult","doc":{"desc":["`{ label, description, isHidden }`."],"params":[],"example":[],"returns":[]}},{"event":"telemetry.log","optional":false,"type":"TelemetryLogResult","doc":{"desc":["`{ value: undefined }`, or `{ deny }`."],"params":[],"example":[],"returns":[]}},{"event":"telemetry.mark","optional":false,"type":"TelemetryMarkResult","doc":{"desc":["`{ value: undefined }`, or `{ deny }`."],"params":[],"example":[],"returns":[]}},{"event":"skill.prompt","optional":false,"type":"SkillPromptResult","doc":{"desc":["`{ text }`."],"params":[],"example":[],"returns":[]}},{"event":"attribution.text","optional":false,"type":"AttributionTextResult","doc":{"desc":["`{ text }`."],"params":[],"example":[],"returns":[]}},{"event":"session.start","optional":false,"type":"SessionStartResult","doc":{"desc":["`{ cwd }`."],"params":[],"example":[],"returns":[]}},{"event":"session.receive","optional":false,"type":"SessionReceiveResult","doc":{"desc":["`{ text }`, or `{ consumed }`."],"params":[],"example":[],"returns":[]}},{"event":"session.append","optional":false,"type":"SessionAppendResult","doc":{"desc":["`{ message, uuid }`, the row as stored."],"params":[],"example":[],"returns":[]}},{"event":"session.send","optional":false,"type":"SessionSendResult","doc":{"desc":["`{ isDelivered: true }`, or `{ isDelivered: false, reason }`."],"params":[],"example":[],"returns":[]}},{"event":"session.compact","optional":false,"type":"SessionCompactResult","doc":{"desc":["`{ messages, tokensBefore?, tokensAfter? }`, or `{ skip }`."],"params":[],"example":[],"returns":[]}},{"event":"session.attach","optional":false,"type":"SessionAttachResult","doc":{"desc":["`{ clientId }`."],"params":[],"example":[],"returns":[]}},{"event":"session.detach","optional":false,"type":"SessionDetachResult","doc":{"desc":["`{ clientId }`."],"params":[],"example":[],"returns":[]}},{"event":"session.measure","optional":false,"type":"SessionMeasureResult","doc":{"desc":["`{ changed }`."],"params":[],"example":[],"returns":[]}},{"event":"session.end","optional":false,"type":"SessionEndResult","doc":{"desc":["`{ sessionId }`."],"params":[],"example":[],"returns":[]}},{"event":"plugin.register","optional":false,"type":"PluginRegisterResult","doc":{"desc":["`{ allow: true }`, or `{ refuse }`."],"params":[],"example":[],"returns":[]}},{"event":"turn.start","optional":false,"type":"TurnStartResult","doc":{"desc":["`{ turnId }`."],"params":[],"example":[],"returns":[]}},{"event":"turn.step","optional":false,"type":"TurnStepResult","doc":{"desc":["The response: `{ turnId, index, answer, toolUses, stopReason, usage }`,","and `serverToolUses` when the API ran tools of its own in the request."],"params":[],"example":[],"returns":[]}},{"event":"turn.complete","optional":false,"type":"TurnCompleteResult","doc":{"desc":["`{ text }`."],"params":[],"example":[],"returns":[]}},{"event":"engine.create","optional":false,"type":"EngineCreateResult","doc":{"desc":["`$` as built so far, with this plugin's interface added and any it","withheld left out; `next(e)` resolves to EngineInterfaceBuilt."],"params":[],"example":[],"returns":[]}}],"OpEventOf":[{"event":"model.complete","optional":false,"type":"ModelCompleteInput","doc":{"desc":["The argument of `$.model.complete(request, { signal })`, its text as","strings and its blocks beside them (ModelCompleteInput).","","The signal does not cross, it aborts the call."],"params":[],"example":[],"returns":[]}},{"event":"model.fork","optional":false,"type":"ModelForkRequest","doc":{"desc":["The argument of `$.model.fork(request)`."],"params":[],"example":[],"returns":[]}},{"event":"audio.speak","optional":false,"type":"SpeakRequest","doc":{"desc":["The argument of `$.audio.speak(text, { voice })`."],"params":[],"example":[],"returns":[]}},{"event":"session.cwd","optional":false,"type":"NoArgs","doc":{"desc":["The argument of `$.session.cwd()`."],"params":[],"example":[],"returns":[]}},{"event":"session.root","optional":false,"type":"NoArgs","doc":{"desc":["The argument of `$.session.root()`."],"params":[],"example":[],"returns":[]}},{"event":"session.model","optional":false,"type":"NoArgs","doc":{"desc":["The argument of `$.session.model()`."],"params":[],"example":[],"returns":[]}},{"event":"session.turns","optional":false,"type":"NoArgs","doc":{"desc":["The argument of `$.session.turns()`."],"params":[],"example":[],"returns":[]}},{"event":"session.id","optional":false,"type":"NoArgs","doc":{"desc":["The argument of `$.session.id()`."],"params":[],"example":[],"returns":[]}},{"event":"session.messages","optional":false,"type":"SessionMessagesArgs","doc":{"desc":["The argument of `$.session.messages(args)`: `{}` for the main","conversation, `{ agentId }` for one of its agents, `as` for the form."],"params":[],"example":[],"returns":[]}},{"event":"session.repo","optional":false,"type":"NoArgs","doc":{"desc":["The argument of `$.session.repo()`."],"params":[],"example":[],"returns":[]}},{"event":"session.surface","optional":false,"type":"NoArgs","doc":{"desc":["The argument of `$.session.surface()`."],"params":[],"example":[],"returns":[]}},{"event":"session.surfaces","optional":false,"type":"NoArgs","doc":{"desc":["The argument of `$.session.surfaces()`."],"params":[],"example":[],"returns":[]}},{"event":"session.authorize","optional":false,"type":"NoArgs","doc":{"desc":["The argument of `$.session.authorize()`."],"params":[],"example":[],"returns":[]}},{"event":"session.identity","optional":false,"type":"NoArgs","doc":{"desc":["The argument of `$.session.identity()`."],"params":[],"example":[],"returns":[]}},{"event":"session.usage","optional":false,"type":"SessionUsageArgs","doc":{"desc":["The argument of `$.session.usage({ breakdown, columns })`."],"params":[],"example":[],"returns":[]}},{"event":"session.version","optional":false,"type":"NoArgs","doc":{"desc":["The argument of `$.session.version()`."],"params":[],"example":[],"returns":[]}},{"event":"prompt.read","optional":false,"type":"NoArgs","doc":{"desc":["The argument of `$.prompt.read()`."],"params":[],"example":[],"returns":[]}},{"event":"prompt.paint","optional":false,"type":"PromptPaintArgs","doc":{"desc":["The argument of `$.prompt.paint(...)`: the draft and this plugin's runs."],"params":[],"example":[],"returns":[]}},{"event":"tool.list","optional":false,"type":"NoArgs","doc":{"desc":["The argument of `$.tool.list()`."],"params":[],"example":[],"returns":[]}},{"event":"tool.register","optional":false,"type":"RegisteredToolSpec","doc":{"desc":["The argument of `$.tool.register(spec)`."],"params":[],"example":[],"returns":[]}},{"event":"command.list","optional":false,"type":"NoArgs","doc":{"desc":["The argument of `$.command.list()`."],"params":[],"example":[],"returns":[]}},{"event":"command.register","optional":false,"type":"CommandSpec","doc":{"desc":["The argument of `$.command.register(spec)`."],"params":[],"example":[],"returns":[]}},{"event":"config.list","optional":false,"type":"NoArgs","doc":{"desc":["The argument of `$.config.list()`."],"params":[],"example":[],"returns":[]}},{"event":"agent.list","optional":false,"type":"NoArgs","doc":{"desc":["The argument of `$.agent.list()`."],"params":[],"example":[],"returns":[]}},{"event":"agent.register","optional":false,"type":"AgentSpec","doc":{"desc":["The argument of `$.agent.register(spec)`: the agent type as the plugin","defined it. A hook above rewrites any of it; the type stays the caller's."],"params":[],"example":[],"returns":[]}},{"event":"ui.open","optional":false,"type":"PaneOpenArgs","doc":{"desc":["The argument of `$.ui.open({ id, title, focus })`; a hook above the","opener may retitle it or refuse it with `{ deny }`, never rename it."],"params":[],"example":[],"returns":[]}},{"event":"ui.close","optional":false,"type":"PaneCloseInput","doc":{"desc":["The argument of `$.ui.close({ id })` with `origin` `plugin`; the engine","raises it too, for the person (`person`) and an unload (`unload`)."],"params":[],"example":[],"returns":[]}},{"event":"ui.panes","optional":false,"type":"NoArgs","doc":{"desc":["The argument of `$.ui.panes()`."],"params":[],"example":[],"returns":[]}},{"event":"ui.place","optional":false,"type":"UiPlaceArgs","doc":{"desc":["The argument of `$.ui.place({ id })`."],"params":[],"example":[],"returns":[]}},{"event":"theme.set","optional":false,"type":"ThemeSetArgs","doc":{"desc":["The argument of `$.theme.set(attributes)`: the attributes themselves."],"params":[],"example":[],"returns":[]}},{"event":"theme.clear","optional":false,"type":"NoArgs","doc":{"desc":["The argument of `$.theme.clear()`."],"params":[],"example":[],"returns":[]}},{"event":"ui.selection","optional":false,"type":"NoArgs","doc":{"desc":["The argument of `$.ui.selection()`."],"params":[],"example":[],"returns":[]}},{"event":"ui.copy","optional":false,"type":"UiCopyArgs","doc":{"desc":["The argument of `$.ui.copy({ text, surface })`, `surface` filled with","the session's first when left out; rewritable, deniable, answerable."],"params":[],"example":[],"returns":[]}},{"event":"ui.view","optional":false,"type":"SiteView","doc":{"desc":["The argument of `$.ui.view({ agentId })`: whose transcript the main view","is to show, none for the main conversation; rewritable and deniable."],"params":[],"example":[],"returns":[]}},{"event":"ui.blit","optional":false,"type":"UiBlitArgs","doc":{"desc":["The argument of `$.ui.blit(...)`: a Raster's `cells` or a keyed Image's","`source`; a hook above may rewrite either with `next`, or `{ deny }`."],"params":[],"example":[],"returns":[]}},{"event":"fs.ancestors","optional":false,"type":"FsAncestorsRequest","doc":{"desc":["The argument of `$.fs.ancestors({ names, of, below })`."],"params":[],"example":[],"returns":[]}},{"event":"store.keys","optional":false,"type":"NoArgs","doc":{"desc":["The argument of `$.store.keys()`."],"params":[],"example":[],"returns":[]}},{"event":"state.get","optional":false,"type":"StateGetEvent","doc":{"desc":["The argument of `$.state.get(ref)`: the reference itself, `plugin`, `key`","and a family member's `id`; identity, pinned."],"params":[],"example":[],"returns":[]}},{"event":"state.set","optional":false,"type":"StateSetEvent","doc":{"desc":["The argument of `$.state.set(ref, value, { ifVersion })`: the reference,","the value, the condition, and `previous`, what stood there (the host's).","","A hook above rewrites `value` with `next({ ...e, value })`; the","reference is identity, pinned. Raised by the value's owner alone. A","`{ deny }` after `next(e)` was answered, a `.catch`'s too, fails the hook."],"params":[],"example":[],"returns":[]}},{"event":"clock.now","optional":false,"type":"NoArgs","doc":{"desc":["The argument of `$.clock.now()`."],"params":[],"example":[],"returns":[]}},{"event":"clock.sleep","optional":false,"type":"ClockWait","doc":{"desc":["The argument of `$.clock.sleep(ms, { signal })`; the signal does not","cross, it aborts the dispatch."],"params":[],"example":[],"returns":[]}},{"event":"clock.after","optional":false,"type":"ClockWait","doc":{"desc":["The argument of `$.clock.after(ms, fn)`: the wait before `fn`, which","stays in the plugin's environment and runs once the dispatch resolves."],"params":[],"example":[],"returns":[]}},{"event":"clock.every","optional":false,"type":"ClockWait","doc":{"desc":["The argument of `$.clock.every(ms, fn)`, dispatched once per period:","`fn` runs each time a dispatch resolves, and the next period is asked."],"params":[],"example":[],"returns":[]}},{"event":"process.spawn","optional":false,"type":"ProcessSpawnRequest","doc":{"desc":["The argument of `$.process.spawn(request)`: the request itself.","","A hook's `{ deny }` rejects the caller's stream and lets the child go","(one still running is killed). Once a child of the call handed up a","piece or its exit, the rejection says it started or ran."],"params":[],"example":[],"returns":[]}},{"event":"settings.read","optional":false,"type":"SettingsReadInput","doc":{"desc":["The argument of `$.settings.read({ source })`, and the layers the read","is made of, which the engine fills; rewritable, deniable."],"params":[],"example":[],"returns":[]}}]},"declarations":[{"name":"AgentCallRecord","kind":"type","line":109,"doc":{"desc":["What an Agent call a plugin raised (`$.tool.call({ tool: \"Agent\", ... })`)","answers as `result` once the agent settles; `text` is its final answer.","","A plugin's spawn always runs in the background, so the call resolves with","this record and not the Agent tool's own (BuiltinToolResults), which is","what a model's Agent call carries at `tool.call`."],"params":[],"example":[],"returns":[]},"text":"  export type AgentCallRecord = {\n      /**\n       * The spawned agent's id, as `$.agent.list()` names it.\n       */\n      agentId: string;\n      /**\n       * The model the agent resolved to, when one is known.\n       */\n      resolvedModel?: string;\n  };"},{"name":"AgentInfo","kind":"type","line":124,"doc":{"desc":["One agent loop of this session as `$.agent.list()` returns it: a subagent","or a teammate."],"params":[],"example":[],"returns":[]},"text":"  export type AgentInfo = {\n      /**\n       * The agent's one id: `agent.spawn` answers it as `agentId`, its loop's\n       * events carry it as `agentId`, a spawn inside it as `parentAgentId`.\n       *\n       * The Agent tool's record spells it `agentId` too, the classic events\n       * (SubagentStart, SubagentStop, TeammateIdle) `agent_id`. A teammate in a\n       * terminal pane of its own runs no loop here: its id is its address.\n       */\n      id: string;\n      /**\n       * A teammate's address in its team, `<name>@<team>`, which the roster keys\n       * it by; absent for any other agent.\n       *\n       * It joins `agent.spawn`'s `teammateId` and the Agent tool's `teammate_id`,\n       * and no event's `agentId`: that is `id`. A respawn under the name keeps it.\n       */\n      teammateId?: string;\n      /**\n       * The Agent call's own `description` of the task (a few words), as an\n       * `agent.spawn` hook left it.\n       */\n      description: string;\n      /**\n       * The agent type it was spawned as, `agent.spawn`'s `subagentType`\n       * (`general-purpose`, `Explore`, ...); `teammate` for one spawned as none.\n       *\n       * A teammate's classic events give its `name` as `agent_type`, not this.\n       */\n      type: string;\n      /**\n       * Where its loop stands now (AgentStatus): a teammate that waits for a\n       * message is `idle`, not `running`.\n       *\n       * One in a terminal pane of its own is `running` or `idle` by what it last\n       * wrote in its team's roster, at a turn's start and at its end: a pane that\n       * is closed or dies leaves that word standing.\n       */\n      status: AgentStatus;\n      /**\n       * The id of the agent whose loop spawned it; absent when the main loop\n       * did.\n       */\n      parentId?: string;\n      /**\n       * The plugin whose `$.agent.spawn` (or Agent `$.tool.call`) started it;\n       * absent when the model or the person did.\n       *\n       * The origin axis: which plugin caused it, whichever loop that hook ran in.\n       */\n      spawnedBy?: string;\n      /**\n       * What SendMessage addresses it by (`Agent({ name })`, or the engine's own\n       * for a background agent), when it has one; not `description` or `type`.\n       *\n       * A teammate's is its name in the team, with a suffix when the call's was\n       * taken. Two agents may hold one name: `id` tells them apart.\n       */\n      name?: string;\n  };"},{"name":"AgentLoop","kind":"type","line":193,"doc":{"desc":["Which model loop an event happened in: the loop's agent id inside a","subagent's or a teammate's loop, absent on the main loop.","","The agent axis, not the origin axis: `next.origin` names the plugin whose","hook frame caused the dispatch (the recursion skip), whichever loop it ran","in; `agentId` names the loop, whoever caused the call."],"params":[],"example":[],"returns":[]},"text":"  export type AgentLoop = {\n      /**\n       * The id of the loop this call runs in: for a subagent or a teammate, the\n       * `id` `$.agent.list()` gives it; absent on the main loop.\n       *\n       * A workflow's agents and the engine's own forks (compaction, memory) carry\n       * ids no list names. Pinned: a different value is refused, one left out is\n       * kept. Which loop, not which plugin caused it (that is `next.origin`).\n       */\n      agentId?: string;\n  };"},{"name":"AgentOfferInput","kind":"type","line":213,"doc":{"desc":["The input of `agent.offer`: one agent type, at the moment the engine","offers it to the model.","","Listed for the model (the agent listing) or named by it at dispatch","(`subagent_type`): the same event at each. Model-facing only: a plugin's","own `$.agent.spawn` of a type is no offer, and `agent.spawn` governs it."],"params":[],"example":[],"returns":[]},"text":"  export type AgentOfferInput = {\n      /**\n       * Which type (`Explore`, `Plan`, a plugin's agent); the key a matcher\n       * narrows on.\n       */\n      agent: string;\n      /**\n       * Its listing line's text as the definition states it (`whenToUse`).\n       */\n      description: string;\n      /**\n       * Where the definition came from (`built-in`, `plugin`, a settings\n       * source), so a matcher tells a built-in from a user's agent of its name.\n       */\n      source: string;\n      /**\n       * Who provides this agent: the plugin and its tier; `{ plugin: \"engine\",\n       * tier: \"core\" }` for a built-in. Pinned: a rewrite is refused.\n       */\n      provider: Origin;\n  };"},{"name":"AgentOfferResult","kind":"type","line":239,"doc":{"desc":["What an `agent.offer` hook returns: whether the model is offered the agent","type, in its listing and at dispatch."],"params":[],"example":[],"returns":[]},"text":"  export type AgentOfferResult = {\n      isOffered: boolean;\n  };"},{"name":"AgentSpawnArgs","kind":"type","line":250,"doc":{"desc":["`agent.spawn`'s input as the call takes it: what the Agent tool's caller","says; the engine fills the rest.","","A call's spawn runs in the background: it resolves once the subagent","started, and nothing holds it in the foreground."],"params":[],"example":[],"returns":[]},"text":"  export type AgentSpawnArgs = Pick<AgentSpawnInput, 'prompt'> & Partial<Pick<AgentSpawnInput, 'description' | 'subagentType' | 'model' | 'name' | 'cwd'>>;"},{"name":"AgentSpawnInput","kind":"type","line":260,"doc":{"desc":["The input of `agent.spawn`: what is decided about an agent about to start,","before its model is resolved.","","A subagent, a teammate, a workflow agent or a resumed run. A hook rewrites","content (prompt, description, subagentType, model, background, cwd) unless","`resume` fixes it, or `workflow` all but two; every other key is pinned."],"params":[],"example":[],"returns":[]},"text":"  export type AgentSpawnInput = {\n      /**\n       * The Agent tool call this spawn belongs to (for `$.ui.notice`). Pinned:\n       * the spawn's identity.\n       *\n       * For a workflow agent, the Workflow tool call that started its run, shared\n       * by all of the run's agents and possibly empty on a resumed or\n       * server-launched run.\n       */\n      tool_use_id: string;\n      /**\n       * The task the subagent is given: the Agent tool's `prompt` parameter. A\n       * rewrite is the prompt the subagent runs with.\n       *\n       * A workflow agent's is a fixed placeholder on a run that keeps its script\n       * out of SDK events (Code Review's, say): a hook has not seen the prompt, so\n       * a rewrite of it is not applied, and the agent starts with the script's own.\n       */\n      prompt: string;\n      /**\n       * The Agent tool's short `description` of the task (a few words). A rewrite\n       * is what the task shows as.\n       */\n      description: string;\n      /**\n       * The resolved agent type (`general-purpose`, `Explore`, a plugin's agent,\n       * `fork`). A rewrite names another agent this call can dispatch, exactly.\n       *\n       * That definition is the one spawned; a name matching none refuses the\n       * spawn, and a fork dispatches no other. A teammate's may be a role no\n       * definition has, as the call spelled it, or `teammate` when it named none.\n       */\n      subagentType: string;\n      /**\n       * Who provides this agent: the plugin and its tier; `{ plugin: \"engine\",\n       * tier: \"core\" }` for a built-in. Pinned with the spawn's identity.\n       */\n      provider: Origin;\n      /**\n       * The Agent tool's `model` parameter as given, an alias (`haiku`) or a\n       * full id; undefined lets the agent's own model, then the parent's, decide.\n       *\n       * Ignored for forks, which always inherit. A hook sets this to pick the\n       * subagent's model; where the session forces one model on every subagent,\n       * that outranks a workflow agent's, a hook's included.\n       */\n      model?: string;\n      /**\n       * The parent's effective model, what `inherit` resolves to. Pinned: a fact\n       * of the parent (set `model` to change what the subagent runs on).\n       */\n      parentModel: string;\n      /**\n       * The id of the loop the spawn happens in (its `tool.call` `agentId`; for a\n       * subagent or teammate its `$.agent.list()` id); absent from main.\n       *\n       * Pinned: a different value is refused, one left out is kept. The agent\n       * axis, not the origin: `next.origin` names the plugin whose hook frame\n       * caused the spawn, this names the model loop it happened in.\n       */\n      parentAgentId?: string;\n      /**\n       * The parent's permission mode (`default`, `acceptEdits`, `plan`, ...), which\n       * the subagent inherits. Pinned: a fact of the parent.\n       */\n      permissionMode?: string;\n      /**\n       * True when the subagent will run in the background (or remotely). A\n       * rewrite is read back as the call's `run_in_background`.\n       *\n       * The agent's own definition and remote isolation can still force it on,\n       * and disabled background tasks force it off. A teammate's is true: a\n       * rewrite is left out, said once in the plugin's failure line.\n       */\n      background: boolean;\n      /**\n       * True for a fork of the parent: it inherits the parent's context and model,\n       * and `model` is ignored. Pinned: the spawn's identity.\n       */\n      fork: boolean;\n      /**\n       * Present, and true, when the call starts a teammate: a named agent of the\n       * session's team, which goes idle between turns and wakes on a message.\n       *\n       * Absent for any other agent. Pinned: the spawn's identity.\n       */\n      isTeammate?: true;\n      /**\n       * Present when a workflow script's `agent()` starts the agent, absent for\n       * any other. Pinned: the spawn's identity.\n       *\n       * A rewrite of its `prompt` and `model` applies; `description`,\n       * `subagentType`, `background` and `cwd` do not apply to it, and one is left\n       * out and said once. A deny is the error the script's `agent()` call throws.\n       *\n       * `next` settles with the first attempt's `agentId`; a stalled agent's\n       * retry is not raised again. With `isolation: 'remote'` (internal builds\n       * only) no `turn.complete`, loop event or list row carries that id.\n       */\n      workflow?: {\n          /**\n           * The run's id, which starts `wf_` (empty only outside a real run).\n           *\n           * A child `workflow()`'s agents carry their parent run's, and a resume\n           * keeps it; a Workflow call that starts a fresh run gets a new id.\n           */\n          runId: string;\n          /**\n           * This agent's place among the run's `agent()` calls, from 1. Agents\n           * replayed from the run's journal count but are not raised.\n           *\n           * The journal knows an agent by what the script asked, before any hook.\n           * It restarts whenever the run's script starts over (a new run, a resume\n           * or a background hand-off of the same `runId`); a call that reopens a\n           * settled run keeps counting. A cap across resumes keeps its own count.\n           */\n          agentIndex: number;\n      };\n      /**\n       * Present when the run resumes a subagent or brings a teammate back from\n       * disk (`isTeammate` beside it), absent for a new agent.\n       *\n       * A hook can only refuse it; a changed content key is ignored, said once.\n       * `prompt` is the resuming message (empty where none is appended). A deny\n       * starts no run and ends nothing: a denied wake leaves its agent parked.\n       */\n      resume?: {\n          /**\n           * The id the run continues under, as `$.agent.list()` lists it; `next`\n           * settles with it. An agent started with no event raised has one too.\n           */\n          agentId: string;\n      };\n      /**\n       * Given by the call (`Agent({ name })`, addressable by SendMessage);\n       * undefined when unnamed. Pinned: the address the parent routes by.\n       *\n       * A teammate whose name the team has already gets a suffix (`scout-2`),\n       * which the answer's `teammateId` and `$.agent.list()` show.\n       */\n      name?: string;\n      /**\n       * The directory the subagent runs in when the call set one (`cwd`); undefined\n       * means the parent's. A rewrite is where the subagent runs.\n       *\n       * A teammate runs in the session's: a rewrite is left out, as `background`'s.\n       */\n      cwd?: string;\n  };"},{"name":"AgentSpawnResult","kind":"type","line":421,"doc":{"desc":["What an `agent.spawn` hook returns and what `next(e)` resolves to: the","started subagent's `{ model, agentId }`, or `{ deny: reason }`, refusing it.","","It and `$.agent.spawn(input)` resolve once the subagent started; its answer","is its own `turn.complete`, carrying this `agentId`. Keep the id and set","`got[agentId]` to what waits; a `turn.complete` hook resolves it:"],"params":[],"example":["on(\"turn.complete\", ($, e, next) => (got[e.agentId]?.(e.answer), next(e)))"],"returns":[]},"text":"  export type AgentSpawnResult = {\n      /**\n       * What the subagent runs on: from core the resolved id; from a hook an\n       * alias (`haiku`) or an id.\n       */\n      model: string;\n      /**\n       * The started subagent's id: the same string its loop's `tool.call`\n       * events carry as `agentId` and `$.agent.list()` lists it by.\n       *\n       * A workflow's remote agent has no local loop, so nothing else carries\n       * it. Set by core; a hook that answers without `next` started none.\n       */\n      agentId?: string;\n      /**\n       * A started teammate's address in its team, `<name>@<team>`, as\n       * `$.agent.list()` gives it; absent for any other agent.\n       *\n       * Set by core. It joins the list's `teammateId` and the tool's\n       * `teammate_id`; every event of the teammate's loop carries `agentId`.\n       */\n      teammateId?: string;\n      deny?: undefined;\n  } | {\n      /**\n       * Refuses the spawn, so nothing starts; the text is the Agent tool's\n       * error, or the error a workflow script's `agent()` call throws.\n       *\n       * Returned after a `next(e)` was answered it fails the hook: its\n       * `.catch` is asked (a deny from it fails too), or it is skipped by\n       * name and its last `next` stands.\n       */\n      deny: string;\n      model?: undefined;\n      agentId?: undefined;\n      teammateId?: undefined;\n  };"},{"name":"AgentSpec","kind":"type","line":466,"doc":{"desc":["What `$.agent.register` takes: an agent type this plugin defines, spelled","as an agent definition in settings JSON is, plus its `name`.","","Every field an agent file or `--agents` entry may carry is here and takes","effect as it does there; the engine validates it with the same schema."],"params":[],"example":[],"returns":[]},"text":"  type AgentSpec = {\n      /**\n       * The type's short name (letters, digits, `_`, `-`; up to 64); the type is\n       * `<plugin>:<name>`, as a plugin's agent file `agents/<name>.md` names one.\n       */\n      name: string;\n      /**\n       * When to delegate to this agent: the line the model reads in its listing\n       * of agent types, and `agent.offer`'s `description`.\n       */\n      description: string;\n      /**\n       * The agent's system prompt, whole: it replaces the session's.\n       */\n      prompt: string;\n      /**\n       * What the agent may call, by tool name (`Read`, `Bash`, `mcp__x__y`); a\n       * call to any other is refused. Left out: every tool the parent has.\n       */\n      tools?: readonly string[];\n      /**\n       * Tools withheld from the agent, by name, out of whatever `tools` allows.\n       */\n      disallowedTools?: readonly string[];\n      /**\n       * The agent's model: an alias (`haiku`, `sonnet`, `opus`), a full id, or\n       * `inherit` for the parent's. Left out: the session's subagent default.\n       */\n      model?: string;\n      /**\n       * The agent's effort: a level (`low`, `medium`, `high`, `xhigh`, `max`)\n       * or an integer budget.\n       */\n      effort?: string | number;\n      /**\n       * How the agent's permission asks are decided, a mode: `default`,\n       * `acceptEdits`, `plan`, `auto`, `dontAsk` or `bypassPermissions`.\n       *\n       * Left out: the parent's.\n       */\n      permissionMode?: string;\n      /**\n       * Servers connected over MCP for the agent's run: a configured server's\n       * name, or `{ \"<name>\": { command, args } }`, one server's config inline.\n       */\n      mcpServers?: readonly (string | Record<string, unknown>)[];\n      /**\n       * Settings hooks in force while the agent runs, in settings.json's `hooks`\n       * shape (`{ PreToolUse: [{ matcher, hooks: [...] }] }`).\n       */\n      hooks?: Record<string, unknown>;\n      /**\n       * The most turns the agent takes before it stops.\n       */\n      maxTurns?: number;\n      /**\n       * Token count, 100000 to 1000000, at which the agent compacts its own\n       * conversation as a subagent. It only lowers the window the agent would\n       * otherwise get.\n       */\n      autoCompactWindow?: number;\n      /**\n       * Preloaded into the agent's context before its first turn: skill names.\n       */\n      skills?: readonly string[];\n      /**\n       * The agent's first user turn; `{{intent}}` in it takes the spawn's prompt.\n       * Left out: the spawn's prompt is the first turn.\n       */\n      initialPrompt?: string;\n      /**\n       * A persistent memory the agent keeps between runs, and where: `user`,\n       * `project` or `local`.\n       */\n      memory?: 'user' | 'project' | 'local';\n      /**\n       * Set so that every spawn of the agent runs in the background.\n       */\n      background?: true;\n      /**\n       * Set so that the agent's context carries no CLAUDE.md block (the person's,\n       * the project's, the rules): it takes what it needs from its prompt.\n       */\n      omitClaudeMd?: true;\n      /**\n       * Where the agent runs apart from the session: `worktree`, a git worktree\n       * of its own; `remote`, a cloud session where the build allows one.\n       */\n      isolation?: 'worktree' | 'remote';\n  };"},{"name":"AgentStatus","kind":"type","line":565,"doc":{"desc":["Where an agent's loop stands: `pending` (not started), `running` a turn,","`waiting` (held), `idle` (between turns, until a message wakes it), or ended.","","`waiting` is on background work it owns, on a plan's approval or, in a","background subagent, on an Agent call alone. Ended is `completed`, `failed`","or `killed` (stopped); a message may yet resume one, under the same id."],"params":[],"example":[],"returns":[]},"text":"  export type AgentStatus = 'pending' | 'running' | 'waiting' | 'idle' | 'completed' | 'failed' | 'killed';"},{"name":"AgentTeammateRecord","kind":"type","line":574,"doc":{"desc":["What an Agent call that started a teammate answers as `result` at","`tool.call`: the started teammate's two ids, its name and its model.","","The call answers once the teammate started; each of its turns ends in its","own `turn.complete`, carrying `agentId` (none here from a terminal pane)."],"params":[],"example":[],"returns":[]},"text":"  export type AgentTeammateRecord = {\n      status: 'teammate_spawned';\n      /**\n       * The teammate's one id, as every Agent record spells it: `agent.spawn`'s\n       * `agentId`, its loop's events' `agentId`, its `$.agent.list()` `id`.\n       *\n       * For one in a terminal pane, which runs no loop here, its address. Absent\n       * from a record an earlier version wrote, which a resumed transcript holds.\n       */\n      agentId?: string;\n      /**\n       * The same id in this record's older spelling, which the classic events\n       * share (`classic.SubagentStop`'s `agent_id`).\n       */\n      agent_id: string;\n      /**\n       * Its address in its team, `<name>@<team>`: `$.agent.list()`'s\n       * `teammateId`, and no event's `agentId`.\n       */\n      teammate_id: string;\n      /**\n       * What SendMessage addresses it by: the call's `name`, any `@` replaced,\n       * with a suffix (`scout-2`) when the team already has it.\n       */\n      name: string;\n      /**\n       * The team it joined: the session's own.\n       */\n      team_name?: string;\n      /**\n       * What it was spawned as, when the call named a type.\n       */\n      agent_type?: string;\n      /**\n       * What it was started on, an alias resolved, as every Agent record spells\n       * it: `agent.spawn`'s `model`.\n       *\n       * Absent where `agentId` is: `model` has it then, an alias as spelled.\n       */\n      resolvedModel?: string;\n      /**\n       * The older spelling of that, an alias left as the call spelled it.\n       */\n      model?: string;\n      /**\n       * The task it was given, as an `agent.spawn` hook left it.\n       */\n      prompt: string;\n  };"},{"name":"AnyEventHook","kind":"type","line":635,"doc":{"desc":["The hook `on(\"*\", hook)` takes: it runs on every event, plugin nouns no","declaration names included, so `e` is `unknown` and `next` is StarNext.","","Until `next.is(pattern, e)` narrows `e`, all a hook can do with it is pass","it on, time it, log it, or fail it; once narrowed it is an ordinary hook on","those events."],"params":[["$","the engine interface; at `engine.create` the empty table, so a hook          that reads `$` tests `next.is(\"engine.create\", e)` first"]],"example":[],"returns":[]},"text":"  export type AnyEventHook = ($: EngineInterface, e: unknown, next: StarNext) => unknown;"},{"name":"AnyKeyOf","kind":"type","line":640,"doc":{"desc":["Every key of every variant, index signatures included."],"params":[],"example":[],"returns":[]},"text":"  type AnyKeyOf<I> = I extends unknown ? keyof I : never;"},{"name":"ApiContentBlock","kind":"type","line":650,"doc":{"desc":["One content block of an ApiMessage: `type` names its kind (`text`,","`tool_use`, `tool_result`, `image`, `document`, `thinking`, ...).","","The other fields are that kind's as the Messages API defines them (see its","reference); the engine hands the block over as it holds it, nothing renamed","or dropped."],"params":[],"example":[],"returns":[]},"text":"  type ApiContentBlock = {\n      /**\n       * The block's kind; the rest of the block is that kind's fields.\n       */\n      type: string;\n      [field: string]: unknown;\n  };"},{"name":"ApiMessage","kind":"type","line":666,"doc":{"desc":["One message of the conversation in Messages API form, as","`$.session.messages({ as: \"api\" })` returns it.","","The messages are the ones the next request is built from, after the","engine's normalization (the last compaction's summary in place of what it","replaced, reminders as text blocks); at most 4096, opening on a user one."],"params":[],"example":[],"returns":[]},"text":"  type ApiMessage = {\n      /**\n       * Who wrote it.\n       */\n      role: 'user' | 'assistant';\n      /**\n       * Its blocks in order, always an array: text, tool_use and tool_result\n       * (paired across an assistant message and the next), image and document.\n       *\n       * Media inline as the engine holds it, thinking as it goes back. In no\n       * message: the system prompt, the tool list, and what one send adds for\n       * its model (cache marks, reminders promoted to system turns).\n       */\n      content: ApiContentBlock[];\n  };"},{"name":"Args","kind":"type","line":686,"doc":{"desc":["The argument of event `N`: `e` in its hooks, and what its call takes. For a","union of names, the union of their arguments."],"params":[],"example":[],"returns":[]},"text":"  export type Args<N extends EventName = EventName> = EventOf[N];"},{"name":"AskOptions","kind":"type","line":691,"doc":{"desc":["Options of `$.ui.ask`."],"params":[],"example":[],"returns":[]},"text":"  export type AskOptions = {\n      /**\n       * 2-4 option labels; fewer than two are padded with Yes/No; free text is the\n       * dialog's Other.\n       */\n      options?: readonly string[];\n      /**\n       * A short chip beside the question (`Approach`, 12 characters at most).\n       */\n      header?: string;\n      /**\n       * Allow several options; the answer comes back comma-joined.\n       */\n      multiSelect?: true;\n  };"},{"name":"Atom","kind":"type","line":714,"doc":{"desc":["A named value with its initial, as `atom(ref, initial)` makes it: read, it","is never `undefined`; while nothing is written it reads as the initial.","","Plain frozen data, the plugin's own: pass it to `read`, `update`, `derive`","and `memberOf`. The engine knows nothing of it."],"params":[],"example":[],"returns":[]},"text":"  export type Atom<T> = {\n      readonly ref: StateAddress;\n      readonly initial: T;\n      /**\n       * The tag the value is kept under, when the atom was given one: a stored\n       * value under another tag reads as absent (Shaped).\n       */\n      readonly shape?: string;\n  };"},{"name":"AtomFunction","kind":"type","line":734,"doc":{"desc":["`atom(ref, initial)`: a named value with its initial, so a read is never","`undefined`; given `{ shape }`, for a key declared `Shaped<T>`.","","Pure: it builds a frozen description and calls nothing. A family's","reference is given without its `id`, which `memberOf` adds."],"params":[],"example":["const count = atom({ plugin: \"counter\", key: \"count\" } as const, 0)"],"returns":[]},"text":"  export type AtomFunction = {\n      <P extends keyof PluginState & string, K extends keyof PluginState[P] & string>(ref: StateName<P, K> & Readonly<Pick<StateAddress, 'id'>>, initial: StateValue<P, K>): Atom<StateValue<P, K>>;\n      <P extends keyof PluginState & string, K extends keyof PluginState[P] & string>(ref: StateName<P, K> & Readonly<Pick<StateAddress, 'id'>>, initial: ShapedValue<StateValue<P, K>>, options: AtomOptions): Atom<ShapedValue<StateValue<P, K>>>;\n  };"},{"name":"AtomOptions","kind":"type","line":746,"doc":{"desc":["The options of `atom`: `shape`, a tag the value is kept under, so a reload","of the plugin's code that names another tag finds the value absent.","","Bump it when the code's idea of the value changed; the engine keeps whole","what the old code wrote, and the tag is how the new code declines it."],"params":[],"example":[],"returns":[]},"text":"  export type AtomOptions = {\n      shape: string;\n  };"},{"name":"AttributionTextInput","kind":"type","line":757,"doc":{"desc":["The input of `attribution.text`: one text the engine asks the model to","write into a commit or a pull request, at the moment it is composed.","","Composed for the Bash description, the commit skills, a PR's body, the","pre-ship mandate and the commit gate's deny: the same event at each."],"params":[],"example":[],"returns":[]},"text":"  export type AttributionTextInput = {\n      /**\n       * Which text (`commit`, `pr`, `exemption`, `remedy`); the key a matcher\n       * narrows on.\n       */\n      kind: AttributionTextKind;\n      /**\n       * As the engine composed it, the settings applied.\n       */\n      text: string;\n  };"},{"name":"AttributionTextKind","kind":"type","line":773,"doc":{"desc":["Which git text `attribution.text` carries: the commit trailer, the PR","footer, the mandate's or the commit gate's sentence naming the exemption."],"params":[],"example":[],"returns":[]},"text":"  export type AttributionTextKind = 'commit' | 'pr' | 'exemption' | 'remedy';"},{"name":"AttributionTextResult","kind":"type","line":779,"doc":{"desc":["What an `attribution.text` hook returns: the text the model reads in","that place."],"params":[],"example":[],"returns":[]},"text":"  export type AttributionTextResult = {\n      text: string;\n  };"},{"name":"AudioClip","kind":"type","line":786,"doc":{"desc":["What `$.audio.play` plays: a URL the engine fetches, or the bytes."],"params":[],"example":[],"returns":[]},"text":"  export type AudioClip = {\n      /**\n       * A file of the calling plugin's own, relative to the plugin's\n       * directory (`fx/open.wav`); no `.`, no leading slash.\n       *\n       * The engine resolves it and loads the file from disk.\n       */\n      asset: string;\n      url?: undefined;\n      base64?: undefined;\n      mime?: undefined;\n  } | {\n      /**\n       * The clip's URL; the engine fetches it (never the plugin), or refuses\n       * it as `$.http.fetch` would refuse the same URL.\n       */\n      url: string;\n      asset?: undefined;\n      base64?: undefined;\n      mime?: undefined;\n  } | {\n      /**\n       * The clip's bytes, base64.\n       */\n      base64: string;\n      /**\n       * What the bytes are (`audio/mpeg`, `audio/wav`).\n       */\n      mime: string;\n      asset?: undefined;\n      url?: undefined;\n  };"},{"name":"BackgroundTaskSummary","kind":"type","line":819,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"  type BackgroundTaskSummary = {\n      id: string;\n      /**\n       * Friendly task-type label (e.g. 'shell', 'subagent', 'monitor', 'workflow'). Falls back to the raw discriminant for unknown types.\n       */\n      type: string;\n      status: string;\n      /**\n       * Free-text description. Capped at 1000 chars; clipped values append an in-string \"... [+N chars]\" marker.\n       */\n      description: string;\n      /**\n       * Shell command line. Only present for 'shell' tasks. Capped at 1000 chars with the same \"... [+N chars]\" marker.\n       */\n      command?: string;\n      /**\n       * Subagent type name. Only present for 'subagent' tasks.\n       */\n      agent_type?: string;\n      /**\n       * MCP server name. Only present for 'monitor' / 'MCP task' tasks.\n       */\n      server?: string;\n      /**\n       * MCP tool name. Only present for 'monitor' / 'MCP task' tasks.\n       */\n      tool?: string;\n      /**\n       * Workflow name. Only present for 'workflow' tasks.\n       */\n      name?: string;\n  };"},{"name":"BaseHookInput","kind":"type","line":852,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"  type BaseHookInput = {\n      session_id: string;\n      transcript_path: string;\n      cwd: string;\n      /**\n       * UUID correlating a user prompt with all subsequent events until the next prompt. Same value emitted on OpenTelemetry events as the `prompt.id` attribute, so hook output can be joined to OTel events at prompt grain. Absent until the first user input of the process lifetime.\n       */\n      prompt_id?: string;\n      permission_mode?: string;\n      /**\n       * Subagent identifier. Present only when the hook fires from within a subagent (e.g., a tool called by an AgentTool worker). Absent for the main thread, even in --agent sessions. Use this field (not agent_type) to distinguish subagent calls from main-thread calls.\n       */\n      agent_id?: string;\n      /**\n       * Agent type name (e.g., \"general-purpose\", \"code-reviewer\"). Present when the hook fires from within a subagent (alongside agent_id), or on the main thread of a session started with --agent (without agent_id).\n       */\n      agent_type?: string;\n      /**\n       * Reasoning effort applied to the current turn. Same shape as StatusLineCommandInput.effort. Present for hooks that fire within a tool-use context (PreToolUse, PostToolUse, Stop, SubagentStop, etc.) on a model that supports the effort parameter; absent for session-lifecycle hooks and models without effort support.\n       */\n      effort?: {\n          /**\n           * Active effort level for the current turn (e.g., \"low\", \"medium\", \"high\", \"xhigh\", \"max\"), after any silent downgrade for the selected model. Also exposed to hook commands and Bash as the CLAUDE_EFFORT env var.\n           */\n          level: string;\n      };\n  };"},{"name":"BoxHoverProps","kind":"type","line":888,"doc":{"desc":["The `Box` props a `hover` may override, none of which moves the Box's","siblings, and `scope`, which names the hover group the Box joins.","","The surface applies a hover as the pointer moves and as what is drawn","under a resting pointer changes; a reveal that keeps moving what it rests","on settles, never loops."],"params":[],"example":[],"returns":[]},"text":"  export type BoxHoverProps = {\n      /**\n       * Names a hover group of this plugin's: every element it draws with the\n       * same `scope`, in any site, lights while any is hovered, reveals included.\n       *\n       * A Pane row and a mark on a transcript message can share one. Another\n       * plugin's elements under the same string are a different group. One to\n       * 64 characters, no control characters; no keyed Box needed; no hook runs.\n       */\n      scope?: string;\n      /**\n       * Restyles a border the Box has; it adds none.\n       */\n      borderStyle?: string;\n      borderColor?: Color;\n      borderDimColor?: boolean;\n      backgroundColor?: Color;\n      /**\n       * `\"flex\"` alone, on a Box drawn `display: \"none\"`: with a `scope`, every\n       * member of the lit group is revealed, in whichever site it sits.\n       *\n       * So a pointer on a glyph in the transcript can swap an entry into a fixed\n       * row of the band, or reveal an absolutely positioned card.\n       */\n      display?: 'flex';\n      /**\n       * Moves a Box drawn `position: \"absolute\"`, as `left`, `right` and\n       * `bottom` do; none of the four moves a Box in the flow.\n       */\n      top?: number;\n      left?: number;\n      right?: number;\n      bottom?: number;\n  };"},{"name":"BoxProps","kind":"type","line":927,"doc":{"desc":["The props of `Box`: the layout, position, margin, padding and border props","of Ink's Box a tree may set, and the two of hover."],"params":[],"example":[],"returns":[]},"text":"  export type BoxProps = {\n      /**\n       * Makes the Box a hover scope: while the pointer is anywhere over it, its\n       * own `hover` and that of every element beneath it apply.\n       *\n       * A nested Box with a `key` of its own scopes what is beneath it, a placed\n       * card outside its rows included. A key a sibling Box already took, or one\n       * that is no plain string, names no scope: hovers beneath it stay inert.\n       */\n      key?: string;\n      /**\n       * Style overrides applied by the surface while the pointer is over the\n       * nearest keyed `Box`, this one included, or, given a `scope`, its group.\n       *\n       * No hook runs and nothing crosses to the plugin. To reveal on hover, draw\n       * the Box `display: \"none\"` with `hover: { display: \"flex\" }` in a visible\n       * keyed Box or under a `scope`; on a `position: \"absolute\"` Box, no reflow.\n       */\n      hover?: BoxHoverProps;\n      /**\n       * `\"absolute\"` leaves the flow, as in CSS: placed against its parent by\n       * the offsets, no room among its siblings, painted over those before it.\n       *\n       * So showing or moving it (a hover may) moves nothing; the pointer on it is\n       * on its parent. Clipped, pointer and paint, by the region its site is in\n       * (viewport, pane, band), by the site itself on the main screen or export.\n       *\n       * @example <Box key=\"k\"><Text>glyph</Text><Box position=\"absolute\" top={-2}\n       *   left={2} display=\"none\" hover={{ display: 'flex' }}>the card</Box></Box>\n       */\n      position?: 'relative' | 'absolute';\n      /**\n       * Rows from the parent's top edge, in character cells: an integer,\n       * negative above the edge.\n       *\n       * With `bottom` and no `height` the Box spans the two.\n       */\n      top?: number;\n      /**\n       * Columns from the parent's left edge, in character cells: an integer,\n       * negative left of the edge.\n       *\n       * With `right` and no `width` the Box spans the two.\n       */\n      left?: number;\n      /**\n       * Columns from the parent's right edge, in character cells: an integer,\n       * negative right of the edge.\n       */\n      right?: number;\n      /**\n       * Rows from the parent's bottom edge, in character cells: an integer,\n       * negative below the edge.\n       */\n      bottom?: number;\n      flexDirection?: 'row' | 'column' | 'row-reverse' | 'column-reverse';\n      flexGrow?: number;\n      flexShrink?: number;\n      flexWrap?: 'nowrap' | 'wrap' | 'wrap-reverse';\n      alignItems?: 'flex-start' | 'center' | 'flex-end' | 'stretch';\n      alignSelf?: 'flex-start' | 'center' | 'flex-end' | 'auto';\n      justifyContent?: 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly';\n      /**\n       * Space between the children, across and down, in cells or a step name.\n       * Spacing flows from the parent: set `gap` on the Box rather than a margin\n       * on each child. A graphical surface draws `xs` between the Buttons of a\n       * row Box with no gap; the terminal draws them as written.\n       */\n      gap?: Space;\n      columnGap?: Space;\n      rowGap?: Space;\n      width?: number | string;\n      height?: number | string;\n      minWidth?: number | string;\n      minHeight?: number | string;\n      margin?: Space;\n      marginX?: Space;\n      marginY?: Space;\n      marginTop?: Space;\n      marginBottom?: Space;\n      marginLeft?: Space;\n      marginRight?: Space;\n      padding?: Space;\n      paddingX?: Space;\n      paddingY?: Space;\n      paddingTop?: Space;\n      paddingBottom?: Space;\n      paddingLeft?: Space;\n      paddingRight?: Space;\n      borderStyle?: string;\n      borderColor?: Color;\n      borderDimColor?: boolean;\n      backgroundColor?: Color;\n      overflow?: 'visible' | 'hidden';\n      display?: 'flex' | 'none';\n  };"},{"name":"BuiltinToolCallInput","kind":"type","line":1028,"doc":{"desc":["One variant per built-in tool; with none in the table (a plugin author's","project with no tools entry laid), one loose variant over every name."],"params":[],"example":[],"returns":[]},"text":"  export type BuiltinToolCallInput = [BuiltinToolName] extends [never] ? BuiltinToolCallInputFallback : {\n      [N in BuiltinToolName]: ToolInputOf<N, BuiltinToolInputs[N]>;\n  }[BuiltinToolName];"},{"name":"BuiltinToolCallInputFallback","kind":"type","line":1036,"doc":{"desc":["The built-in branch's answer when no built-in tool is declared: every","name, its args unconstrained."],"params":[],"example":[],"returns":[]},"text":"  type BuiltinToolCallInputFallback = {\n      /**\n       * The name of the tool being called (`Bash`); comparing it narrows `e` once\n       * the table has entries. Reserved: a rewrite of it is ignored by core.\n       */\n      tool: string;\n      /**\n       * The tool_use block's id: the same at every event of the call and in\n       * `$.ui.notice`. Reserved: a rewrite of it is ignored by core.\n       */\n      tool_use_id: string;\n      [argument: string]: unknown;\n  };"},{"name":"BuiltinToolInputs","kind":"interface","line":1061,"doc":{"desc":["The arguments of each built-in tool by name, for declaration merging;","empty until a declaration file adds entries, then `e.tool === \"Bash\"`","narrows `e` to Bash's arguments.","","The engine lays this build's set beside a mod it loads","(claude-code-tools/index.d.ts), from each tool's input schema."],"params":[],"example":["interface BuiltinToolInputs { Bash: { command: string; timeout?: number } }"],"returns":[]},"text":"  export interface BuiltinToolInputs {\n  }"},{"name":"BuiltinToolName","kind":"type","line":1067,"doc":{"desc":["The names of the built-in tools."],"params":[],"example":[],"returns":[]},"text":"  export type BuiltinToolName = keyof BuiltinToolInputs & string;"},{"name":"BuiltinToolResults","kind":"interface","line":1081,"doc":{"desc":["The structured result of each built-in tool by name, for declaration","merging; empty until a declaration file adds entries, then after","`e.tool === \"Bash\"` the `result` of `next(e)` is Bash's record.","","The engine lays this build's set beside a mod it loads","(claude-code-tools/index.d.ts), from each tool's output schema; a tool","without one is `unknown`."],"params":[],"example":["interface BuiltinToolResults { Bash: { stdout: string; stderr: string } }"],"returns":[]},"text":"  export interface BuiltinToolResults {\n  }"},{"name":"ButtonProps","kind":"type","line":1092,"doc":{"desc":["The props of `Button`, every surface's pressable: an address, a label or","children, the closure a press runs, and the styles a hover overrides.","","The terminal draws `[ label ]` (when `plain`, `1: label` or the label","alone), a desktop a native button; a click, a `hotkey`, the chord for its","`action`, or Enter under the focus raises `ui.press`, its bottom `onPress`."],"params":[],"example":[],"returns":[]},"text":"  export type ButtonProps = {\n      /**\n       * The element's address: `e.element` at `ui.press`, what a matcher names.\n       * Defaults to the `label`, or the one string child.\n       *\n       * Needed where the Button holds other children and no `label`: a row's\n       * text holds what changes (a count, an age), its address must not.\n       *\n       * Give every Button in a list its own: a surface finds one again by it\n       * after a redraw, and cannot tell apart two that share it.\n       */\n      key?: string;\n      /**\n       * The text drawn on the button; or the one string child.\n       *\n       * Children of strings and `Text` (a chip, a dim part) are drawn in its\n       * place, one press wherever on them it lands; any other element is refused.\n       * The label then names the control; absent, it is the children's text.\n       *\n       * @example\n       * <Button key={id} onPress={open}>{name} <Text dimColor>2m</Text></Button>\n       */\n      label?: string;\n      /**\n       * One digit (`\"1\"`) or one lowercase letter (`\"w\"`) that presses it while\n       * the plugin's site holds the focus; anything else is refused.\n       *\n       * Its site holds it after ctrl+x tab, a click or `open({ focus })`: the band\n       * or its `Pane`; never the composer, save that a bare digit in an empty one\n       * answers a band Button (a survey). Shift+w is `\"w\"`; two clash, later wins.\n       */\n      hotkey?: string;\n      /**\n       * An engine keybinding action (`\"app:cycleDiffBase\"`) whose chord, as the\n       * person bound it, presses this from the prompt; unknown names refused.\n       *\n       * Chords, or a modified key Global or an active context binds, on the\n       * terminal while mounted, no dialog up and no engine handler of the action\n       * mounted; a pane's over the band's over another's, then the last drawn.\n       */\n      action?: string;\n      /**\n       * Drawn without chrome: the hotkey in the accent color, a colon, the\n       * label (`1: Yes`), as a survey's row reads; no `hotkey`, the label alone.\n       *\n       * A one-glyph label (`'\\u{1F50A}'`, a speaker) is then a control by\n       * itself: the focus and the pointer still invert it, `dimColor` and `hover`\n       * still apply. A desktop draws its native button either way.\n       */\n      plain?: true;\n      /**\n       * The label drawn dim at rest, as `Text`'s `dimColor`, and at full strength\n       * under the pointer or the focus: a secondary control, a path in a list.\n       */\n      dimColor?: boolean;\n      /**\n       * Which button of several is the main action: `\"primary\"` is drawn as the\n       * surface marks the one to press, `\"secondary\"`, and absent, as before.\n       *\n       * The terminal draws a primary `[ label ]` in the accent color, a desktop\n       * its own primary button; `dimColor`, `hover`, the focus and the pointer\n       * apply to both. `plain` wins: a plain Button draws the same either way.\n       *\n       * @example <Button variant=\"primary\" onPress={save}>Save</Button>\n       */\n      variant?: 'primary' | 'secondary';\n      /**\n       * Marks the Button that closes its site: a drawing hint only. `onPress`\n       * still does the dismissing and the press is raised as for any Button.\n       *\n       * The terminal draws it as without the prop; a desktop draws its native\n       * close control at the site's trailing edge, the label its accessible name.\n       *\n       * @example <Button role=\"dismiss\" onPress={close}>Dismiss</Button>\n       */\n      role?: 'dismiss';\n      /**\n       * The site's focus ring starts here when the site takes the keyboard,\n       * instead of on nothing, as the DOM's `autofocus`: Enter acts on it at once.\n       *\n       * A pane opened with `focus`, or the person's focus chord or click, is the\n       * take. Of several in one site the first drawn wins; it raises `ui.focus`,\n       * origin this plugin. A ring the person has moved stays where it was put.\n       */\n      autoFocus?: true;\n      /**\n       * Label style overrides (the `Text` set) applied by the surface while the\n       * nearest enclosing keyed `Box`, or given a `scope` its group, is hovered.\n       *\n       * No hook runs and nothing crosses to the plugin; under the pointer itself\n       * the button inverts as it always has. Refused outside a keyed Box unless\n       * it names a `scope`.\n       */\n      hover?: TextHoverProps;\n      /**\n       * What the press runs, in the plugin's own environment: the bottom of the\n       * `ui.press` chain. The host holds only a handle, for the drawing's life.\n       *\n       * Run with the `ui.press` argument as the chain above left it: `e.surface`\n       * names the surface the press came from, which a copy passes on.\n       *\n       * @example\n       * onPress: press => $.ui.copy({ text: url, surface: press.surface })\n       */\n      onPress: (e: UiPressArgument) => void;\n  };"},{"name":"CatchHandler","kind":"type","line":1207,"doc":{"desc":["The handler `on(...).catch(handler)` takes for a hook of type `F`: the","hook's `($, e, next)`, run afresh when it throws, misreturns or overruns.","","`next` carries `error` and `called` (Caught) and is replay-safe; a return","within the grace is the hook's result, `undefined` the hook absent. On a","streaming event the handler is a generator too, continuing the stream."],"params":[],"example":[],"returns":[]},"text":"  export type CatchHandler<F> = F extends ($: infer D, e: infer E, next: infer N) => infer R ? [R] extends [AsyncGenerator<unknown, unknown, unknown>] ? ($: D, e: E, next: N & Caught) => R : ($: D, e: E, next: N & Caught) => R | undefined | Promise<Awaited<R> | undefined> : never;"},{"name":"Caught","kind":"type","line":1217,"doc":{"desc":["What `next` carries into a `.catch` handler and nowhere else: why the","hook failed, and whether it had called `next` before it did.","","There `next` is replay-safe: when `called`, `next(e)` resolves to what the","hook's last call settled to, nothing beneath running again, the argument","unread; when not, it runs the hooks beneath once and a later call replays."],"params":[],"example":[],"returns":[]},"text":"  export type Caught = {\n      /**\n       * Why the hook failed (HookFailure); undefined on an ordinary hook's\n       * `next`, so its presence says a handler is running.\n       */\n      readonly error: HookFailure;\n      /**\n       * True when the failed hook had called `next()` or `next.to()` at least\n       * once, settled or in flight; the handler runs once that call settled.\n       */\n      readonly called: boolean;\n  };"},{"name":"Chunk","kind":"type","line":1234,"doc":{"desc":["What a hook on streaming event `N` yields, and what its `next(e)` yields","to it (ChunkOf by name)."],"params":[],"example":[],"returns":[]},"text":"  export type Chunk<N extends StreamingEventName = StreamingEventName> = ChunkOf[N];"},{"name":"ChunkOf","kind":"type","line":1239,"doc":{"desc":["The chunk type of each streaming event, by name: what its stream yields."],"params":[],"example":[],"returns":[]},"text":"  export type ChunkOf = {\n      /**\n       * One piece of the model's response (TurnStepChunk).\n       */\n      'turn.step': TurnStepChunk;\n      /**\n       * One piece of the child's output (ProcessSpawnChunk).\n       */\n      'process.spawn': ProcessSpawnChunk;\n  };"},{"name":"ChunkRef","kind":"type","line":1258,"doc":{"desc":["What every `turn.step` chunk may carry: the engine's handle on the item","of its own stream the chunk was read off, absent on a chunk a hook made.","","A hook that passes a chunk on, or rewrites it by spreading it, keeps the","handle, and whatever it left unchanged reaches the engine as the engine","streamed it; a chunk built afresh has none and is taken at its word."],"params":[],"example":[],"returns":[]},"text":"  type ChunkRef = {\n      /**\n       * The engine's handle on its own streamed item; opaque, this step's only.\n       */\n      ref?: number;\n  };"},{"name":"ClassicEventName","kind":"type","line":1273,"doc":{"desc":["The name of a classic hook event as a function-hooks event: the settings","hook's own name under `classic` (`classic.Stop`, `classic.PreToolUse`).","","Each fires wherever the engine runs the classic hook, whether or not any","settings hook is configured, and reaches a `*` or `classic.*` hook as it","reaches a named one."],"params":[],"example":[],"returns":[]},"text":"  export type ClassicEventName = `classic.${ClassicHookEvent}`;"},{"name":"ClassicEventOf","kind":"type","line":1286,"doc":{"desc":["The classic (settings) hook events, one per classic event name: `e` is the","hook's whole stdin input, base fields (`transcript_path`, `cwd`) included.","","The chain is [managed settings hooks, ...hooks modules, the other settings","hooks as core], so a managed block ends it above every module. In shape","`classic.PreToolUse` alone differs: its `e` is ToolCallEnvelope, no more."],"params":[],"example":[],"returns":[]},"text":"  export type ClassicEventOf = {\n      [E in ClassicHookEvent as `classic.${E}`]: E extends 'PreToolUse' ? ToolCallEnvelope : ClassicHookInputs[E];\n  };"},{"name":"ClassicHookEvent","kind":"type","line":1293,"doc":{"desc":["The name of a classic hook event: `PreToolUse`, `Stop`, and the rest."],"params":[],"example":[],"returns":[]},"text":"  export type ClassicHookEvent = HookInput['hook_event_name'];"},{"name":"ClassicHookInputs","kind":"type","line":1299,"doc":{"desc":["What a classic hook receives on stdin for each event, by event name: the","Agent SDK's `<Event>HookInput`."],"params":[],"example":[],"returns":[]},"text":"  export type ClassicHookInputs = {\n      [I in HookInput as I['hook_event_name']]: I;\n  };"},{"name":"ClassicResult","kind":"type","line":1311,"doc":{"desc":["Everything a classic hook event's answer can carry, named as the classic","hook's JSON output names it; each event reads its subset (ClassicResultOf).","","The settings hooks below fold into one of these (last write wins, contexts","concatenate); a hooks module returns `next(e)`, a copy with fields changed,","or its own. A field of the wrong shape fails the hook, which is skipped."],"params":[],"example":[],"returns":[]},"text":"  export type ClassicResult = {\n      /**\n       * `decision: \"block\"` with this text as `reason` (a command hook's exit\n       * code 2): the event's block, veto or re-prompt.\n       */\n      block?: string;\n      /**\n       * `continue: false`: the session stops after this event.\n       */\n      preventContinuation?: true;\n      /**\n       * Shown when `preventContinuation` stops the session (`stopReason`).\n       */\n      stopReason?: string;\n      /**\n       * `hookSpecificOutput.additionalContext`, one entry per hook: text handed\n       * to the model with the event.\n       */\n      additionalContext?: string[];\n      /**\n       * `hookSpecificOutput.sessionTitle` (UserPromptSubmit, SessionStart).\n       */\n      sessionTitle?: string;\n      /**\n       * `hookSpecificOutput.suppressOriginalPrompt` (UserPromptSubmit,\n       * UserPromptExpansion).\n       */\n      suppressOriginalPrompt?: true;\n      /**\n       * `hookSpecificOutput.initialUserMessage` (SessionStart).\n       */\n      initialUserMessage?: string;\n      /**\n       * `hookSpecificOutput.watchPaths` (SessionStart).\n       */\n      watchPaths?: string[];\n      /**\n       * `hookSpecificOutput.reloadSkills` (SessionStart).\n       */\n      reloadSkills?: true;\n      /**\n       * `hookSpecificOutput.permissionDecision` (PreModelSwitch).\n       */\n      permissionDecision?: 'allow' | 'deny' | 'ask';\n      /**\n       * `hookSpecificOutput.permissionDecisionReason` (PreModelSwitch).\n       */\n      permissionDecisionReason?: string;\n      /**\n       * `hookSpecificOutput.decision` (PermissionRequest).\n       */\n      decision?: PermissionRequestDecision;\n      /**\n       * `hookSpecificOutput.updatedToolOutput` (PostToolUse): replaces what the\n       * model sees of the tool's result.\n       */\n      updatedToolOutput?: unknown;\n      /**\n       * `hookSpecificOutput.updatedMCPToolOutput` (PostToolUse, MCP tools only).\n       */\n      updatedMCPToolOutput?: unknown;\n      /**\n       * `hookSpecificOutput.retry` (PermissionDenied).\n       */\n      retry?: true;\n      /**\n       * `hookSpecificOutput.displayContent` (MessageDisplay).\n       */\n      displayContent?: string;\n      /**\n       * `hookSpecificOutput.worktreePath` (WorktreeCreate; a command hook prints\n       * it): the worktree the hook created, absolute or relative to its cwd.\n       *\n       * Left unset, the session creates its git worktree as it would unhooked.\n       */\n      worktreePath?: string;\n  };"},{"name":"ClassicResultFields","kind":"type","line":1395,"doc":{"desc":["The event-specific fields of ClassicResult each classic event reads (its","`hookSpecificOutput`), by event; an event absent here reads none of them.","","`block`, `preventContinuation` and `stopReason` are every event's."],"params":[],"example":[],"returns":[]},"text":"  export type ClassicResultFields = {\n      UserPromptSubmit: 'additionalContext' | 'sessionTitle' | 'suppressOriginalPrompt';\n      UserPromptExpansion: 'additionalContext' | 'suppressOriginalPrompt';\n      SessionStart: 'additionalContext' | 'initialUserMessage' | 'sessionTitle' | 'watchPaths' | 'reloadSkills';\n      Setup: 'additionalContext';\n      PreModelSwitch: 'permissionDecision' | 'permissionDecisionReason';\n      PostModelSwitch: 'additionalContext';\n      SubagentStart: 'additionalContext';\n      PostToolUse: 'additionalContext' | 'updatedToolOutput' | 'updatedMCPToolOutput';\n      PostToolUseFailure: 'additionalContext';\n      PostToolBatch: 'additionalContext';\n      Stop: 'additionalContext';\n      SubagentStop: 'additionalContext';\n      PermissionDenied: 'retry';\n      PermissionRequest: 'decision';\n      MessageDisplay: 'displayContent';\n      WorktreeCreate: 'worktreePath';\n  };"},{"name":"ClassicResultOf","kind":"type","line":1421,"doc":{"desc":["What each classic hook event's hook returns and its `next(e)` resolves to:","the event's own subset of ClassicResult.","","`classic.PreToolUse` keeps its `allow` / `ask` / `deny` result","(PreToolUseResult)."],"params":[],"example":[],"returns":[]},"text":"  export type ClassicResultOf = {\n      [E in ClassicHookEvent as `classic.${E}`]: E extends 'PreToolUse' ? PreToolUseResult : Pick<ClassicResult, 'block' | 'preventContinuation' | 'stopReason' | (E extends keyof ClassicResultFields ? ClassicResultFields[E] : never)>;\n  };"},{"name":"ClassifyOptions","kind":"type","line":1428,"doc":{"desc":["Options of `$.model.classify`."],"params":[],"example":[],"returns":[]},"text":"  export type ClassifyOptions = {\n      /**\n       * An alias (`haiku`) or a full model id; default the engine's small fast\n       * model.\n       */\n      model?: string;\n  };"},{"name":"ClientElements","kind":"type","line":1444,"doc":{"desc":["The element table a surface module draws with, `surface.elements`: the","terminal's (Elements) less `Client` (none nests), `Raster` and `Image`.","","What `$.ui.resolve(e)` is to a hooks module; a Button, Input or Select","keeps its handler here. A tree of them keeps every tree's bounds (20,000","nodes, 32 deep, 100,000 characters serialized) or the instance unmounts."],"params":[],"example":[],"returns":[]},"text":"  export type ClientElements = Omit<Elements['terminal'], 'Client' | 'Raster' | 'Image'>;"},{"name":"ClientKeyEvent","kind":"type","line":1450,"doc":{"desc":["One key the person pressed while a `Client` had the focus, as","`surface.onKey` hands it. Escape never arrives: it returns the focus."],"params":[],"example":[],"returns":[]},"text":"  export type ClientKeyEvent = {\n      /**\n       * A special key's name (`up`, `down`, `left`, `right`, `return`, `tab`,\n       * `backspace`, `delete`, `pageup`, `home`, ...) or the character typed.\n       */\n      key: string;\n      /**\n       * Modifier keys held with it, each present only when true.\n       */\n      ctrl?: true;\n      shift?: true;\n      meta?: true;\n  };"},{"name":"ClientModule","kind":"type","line":1475,"doc":{"desc":["The component a surface module exports (default, or its one PascalCase","export): from props and surface to the tree drawn (no nested `Client`).","","Runs on the drawing thread, a second per call at most; `h` and `Fragment`","are the environment's, so nothing of the module's takes those names. A","throw, an overrun or a tree past the bounds (ClientElements) unmounts it."],"params":[],"example":["const Tag: ClientModule<string> = (t, s) => s.elements.Text({ children: t })"],"returns":[]},"text":"  export type ClientModule<P extends JsonValue = JsonValue, S = unknown> = (props: P, surface: ClientSurface<S>) => RenderElement;"},{"name":"ClientPointerEvent","kind":"type","line":1485,"doc":{"desc":["One pointer event over a `Client`'s region, as `surface.onPointer` hands","it: region-relative cells, and the sub-cell position where known.","","After a `down` in the region the instance holds the pointer until the","`up`: every `move` reaches it, past the edges too (negative, or beyond","`columns`/`rows`), and the transcript neither selects nor scrolls."],"params":[],"example":[],"returns":[]},"text":"  export type ClientPointerEvent = {\n      type: ClientPointerType;\n      /**\n       * The column under the pointer, 0 at the region's left edge; on `enter`\n       * and `leave`, the last column a move reported.\n       */\n      x: number;\n      /**\n       * The row under the pointer, 0 at the region's top edge.\n       */\n      y: number;\n      /**\n       * The same position with the fraction of a cell kept (`x: 12`, `fine.x:\n       * 12.375`), where the surface knows it: a terminal that reports pixels.\n       *\n       * kitty, Ghostty, iTerm2, WezTerm and foot do; tmux passes none through.\n       * Absent elsewhere and on `enter`/`leave`; present, a `move` comes within\n       * a cell too. What a module showing another program's pixels forwards.\n       *\n       * @example\n       * surface.onPointer(e => click((e.fine?.x ?? e.x + 0.5) * pixelsPerCell))\n       */\n      fine?: {\n          x: number;\n          y: number;\n      };\n      /**\n       * Which button is down (`down`, `move` while held) or came up (`up`);\n       * absent on a hover `move`, `enter` and `leave`.\n       */\n      button?: 'left' | 'middle' | 'right';\n      /**\n       * Modifier keys the terminal reported held, each present only when true.\n       */\n      shift?: true;\n      alt?: true;\n      ctrl?: true;\n  };"},{"name":"ClientPointerType","kind":"type","line":1528,"doc":{"desc":["What the pointer did over a `Client`'s region: a button went down, the","pointer moved, the button came up, or the pointer crossed the region's edge."],"params":[],"example":[],"returns":[]},"text":"  export type ClientPointerType = 'down' | 'move' | 'up' | 'enter' | 'leave';"},{"name":"ClientProps","kind":"type","line":1534,"doc":{"desc":["The props of `Client`: which of the plugin's surface modules draws here,","under what key, with what data, in how much room."],"params":[],"example":[],"returns":[]},"text":"  export type ClientProps = {\n      /**\n       * The instance's address within the drawing: two `Client`s of one plugin in\n       * one tree take two keys. What `e.element` carries at `ui.message`.\n       *\n       * The engine keeps the instance (its local state, its timers) across the\n       * plugin's redraws while a `Client` under this key stays in the tree.\n       */\n      key: string;\n      /**\n       * The surface module's path, a string literal relative to this file:\n       * `module: \"./<name>.tsx\"` (or `.jsx`, `.ts`, `.js`, `.mjs`).\n       *\n       * Read off the source: a variable there is refused at load, as is a path\n       * outside the plugin or naming no file. Its default export draws, else\n       * its one PascalCase export; loaded, the tree carries the plugin's path.\n       */\n      module: string;\n      /**\n       * Plain data (JsonValue) handed to the module function; a new value on a\n       * redraw reaches the running instance, its state kept.\n       *\n       * At most 100000 characters serialized; not a channel for closures.\n       * Typed `unknown` so a matcher over a tree stays shallow.\n       */\n      props?: unknown;\n      /**\n       * Columns the instance's region takes: a count, or a percentage of the\n       * parent. Absent, the region is as wide as what the module draws.\n       */\n      width?: number | string;\n      /**\n       * Rows the instance's region takes: a count, or a percentage of the parent.\n       * Absent, the region is as tall as what the module draws.\n       */\n      height?: number | string;\n      /**\n       * How the region grows into free room along the parent's direction, as a\n       * Box's `flexGrow`.\n       */\n      flexGrow?: number;\n  };"},{"name":"ClientSurface","kind":"type","line":1585,"doc":{"desc":["What a surface module's function receives as its second argument: its","elements, the instance's local state, its region, input, clock and port.","","Called again (same `surface`, same `state`) on new props, after","`setState`, and on a resize; what it returns is drawn in the region. No","`$` here: the hooks module has it, and `post` is the way to reach it."],"params":[],"example":[],"returns":[]},"text":"  export type ClientSurface<S = unknown> = {\n      /**\n       * The surface's element table (ClientElements), the tags the module draws\n       * with: `const { Box, Text } = surface.elements`. No `Client` in it.\n       */\n      readonly elements: ClientElements;\n      /**\n       * The instance's local state: `undefined` until the first `setState`.\n       * Kept across the plugin's redraws; dropped with the instance.\n       */\n      readonly state: S | undefined;\n      /**\n       * Replaces the local state and schedules one more call of the function on\n       * the next frame; several calls before it coalesce into one redraw.\n       *\n       * A `setState` on each of three renders in a row with no key, pointer,\n       * tick, press or props between is a render loop: the instance unmounts.\n       */\n      setState: (next: S) => void;\n      /**\n       * The region's width in cells, as last laid out (0 before the first\n       * layout).\n       */\n      readonly columns: number;\n      /**\n       * The region's height in cells, as last laid out (0 before the first\n       * layout).\n       */\n      readonly rows: number;\n      /**\n       * Calls `fn` every `ms` milliseconds on the surface's frame clock until\n       * the returned function is called or the instance unmounts.\n       *\n       * Start it once (while `state` is still undefined), not on every call.\n       */\n      every: (ms: number, fn: () => void) => () => void;\n      /**\n       * Sets the instance's pointer listener (one; a later call replaces it)\n       * and returns what clears it. See ClientPointerEvent for capture.\n       */\n      onPointer: (fn: (event: ClientPointerEvent) => void) => () => void;\n      /**\n       * Sets the instance's key listener (one; a later call replaces it),\n       * reached while a click has given it the focus; Escape returns that.\n       */\n      onKey: (fn: (event: ClientKeyEvent) => void) => () => void;\n      /**\n       * Sends plain data to the plugin's hooks module: `e.data` of a\n       * `ui.message` only that plugin's hooks see, one per frame at most.\n       *\n       * A later post in the same frame replaces an undelivered one; a hook\n       * answering `{ props }` hands this instance its next props. At most\n       * 20,000 values, 32 deep, 100,000 characters, or the post is not sent.\n       */\n      post: (data: JsonValue) => void;\n  };"},{"name":"ClockWait","kind":"type","line":1646,"doc":{"desc":["The argument of the `$.clock` waits (`sleep`, `after`, `every`): how long,","in milliseconds, before the dispatch resolves."],"params":[],"example":[],"returns":[]},"text":"  type ClockWait = {\n      /**\n       * The wait, a non-negative number of milliseconds.\n       */\n      ms: number;\n  };"},{"name":"CodeProps","kind":"type","line":1661,"doc":{"desc":["The props of `Code`, source text every surface draws with the engine's own","highlighter: coloured tokens, a line gutter on request, or a unified diff.","","A leaf: no children. `source` is the element's data as a string is a","Text's, free of control characters the same way; the colour","on screen is the engine's, never the plugin's."],"params":[],"example":[],"returns":[]},"text":"  export type CodeProps = {\n      /**\n       * The text drawn: source code, or under `format: 'diff'` one or more\n       * unified-diff hunks.\n       *\n       * Of any length, one drawing drawing 100000 characters in all; tab and\n       * newline its only control characters. A diff cut mid-hunk does not parse.\n       */\n      source: string;\n      /**\n       * A highlighter language id or alias (`typescript`, `ts`, `py`), a\n       * plugin-contributed grammar's included.\n       *\n       * Absent, the language is inferred from `path`; when neither resolves,\n       * the text is drawn plain.\n       */\n      language?: string;\n      /**\n       * A file path the language is inferred from when `language` is absent:\n       * its extension or name, else a shebang on the first line.\n       *\n       * Drawn nowhere and never read: nothing touches the disk.\n       */\n      path?: string;\n      /**\n       * The 1-based number of the first line of `source`: present, a dim\n       * right-aligned gutter numbers the lines from it; absent, no gutter.\n       *\n       * Ignored under `format: 'diff'`, whose hunks carry their own numbers.\n       */\n      startLine?: number;\n      /**\n       * `'source'` (the default) draws `source` as code; `'diff'` reads it as\n       * unified-diff hunks and draws gutters, markers, add and remove colouring.\n       *\n       * A hunk is `@@ -a,b +c,d @@` then ` `, `+` or `-` lines; a `---`/`+++`\n       * pair and `\\ No newline at end of file` are read past. A source that\n       * parses as no hunks is drawn as plain code, unnumbered; the log says so.\n       */\n      format?: 'source' | 'diff';\n      /**\n       * What a line wider than the room does, in Text's `wrap` vocabulary:\n       * `'wrap'` (the default) continues it on rows under the gutter.\n       *\n       * `'truncate-end'` cuts it at the edge with an ellipsis; Text's other\n       * spellings are refused, since a gutter leaves them no sense here.\n       */\n      wrap?: 'wrap' | 'truncate-end';\n  };"},{"name":"Color","kind":"type","line":1718,"doc":{"desc":["What a prop that paints may hold: a theme key, which follows the person's","theme, or any other string, a raw color (a name such as `\"red\"`, or hex).","","The keys are named so that an editor lists them; every string is","admitted. What a surface draws for one it does not know is its own."],"params":[],"example":[],"returns":[]},"text":"  export type Color = ThemeKey | (string & {});"},{"name":"CommandDescribeInput","kind":"type","line":1724,"doc":{"desc":["The input of `command.describe`: how one slash command presents in the","typeahead and `/help`, at the moment the engine lists it."],"params":[],"example":[],"returns":[]},"text":"  export type CommandDescribeInput = {\n      /**\n       * Names the command without its slash; the key a matcher narrows on. A\n       * rewrite is refused.\n       */\n      command: string;\n      /**\n       * The one-line description the menu shows, as the command declares it.\n       */\n      description: string;\n      /**\n       * The hint drawn dim after the name (`[name]`), when the command has one.\n       */\n      argumentHint?: string;\n      /**\n       * Whether the typeahead and `/help` leave the command out; a hidden\n       * command still runs when typed in full.\n       */\n      isHidden: boolean;\n      /**\n       * Whether the command declares it runs at once when typed mid-turn,\n       * instead of waiting for the turn to end.\n       *\n       * One that decides per invocation reads false. Read only: not part of\n       * what a hook answers, and a rewrite is refused.\n       */\n      immediate: boolean;\n      /**\n       * Who provides this command: the plugin and its tier; `{ plugin: \"engine\",\n       * tier: \"core\" }` for a built-in. Pinned: a rewrite is refused.\n       */\n      provider: Origin;\n  };"},{"name":"CommandDescribeResult","kind":"type","line":1762,"doc":{"desc":["What a `command.describe` hook returns: the description, hint and hidden","flag the menu uses; the name, `immediate` and `provider` stay as they were."],"params":[],"example":[],"returns":[]},"text":"  export type CommandDescribeResult = Omit<CommandDescribeInput, 'command' | 'immediate' | 'provider'>;"},{"name":"CommandInfo","kind":"type","line":1767,"doc":{"desc":["One slash command as `$.command.list()` returns it."],"params":[],"example":[],"returns":[]},"text":"  export type CommandInfo = {\n      /**\n       * What the person runs it by, without the slash.\n       */\n      name: string;\n      /**\n       * The one line the typeahead shows for it.\n       */\n      description: string;\n      /**\n       * Where it comes from (CommandSource).\n       */\n      source: CommandSource;\n      /**\n       * Which plugin added it, when `source` is `plugin` and the engine knows:\n       * the one that registered it, or whose manifest carries it.\n       */\n      plugin?: string;\n  };"},{"name":"CommandPresentation","kind":"type","line":1796,"doc":{"desc":["Where a command's answer will show: which of the terminal's two layouts","the surface renders, and how wide it is when the command runs.","","A fact the engine stamps on `command.run`, so a command that draws (opens","a pane, prints a wide table) can suit the room it has: the fullscreen","layout docks a pane beside the transcript from 110 columns, the main","screen places it inline above the prompt at any width."],"params":[],"example":[],"returns":[]},"text":"  export type CommandPresentation = {\n      /**\n       * True under the fullscreen (alternate-screen) layout; false on the main\n       * screen (`CLAUDE_CODE_NO_FLICKER=0`, tmux by default) and headless.\n       *\n       * The fact `RenderViewport`'s `isFullscreen` carries on every terminal\n       * drawing, from the same source: the two agree.\n       */\n      isFullscreen: boolean;\n      /**\n       * The terminal's width in cells as the command runs; 80 where no terminal\n       * has measured (headless with no tty).\n       */\n      columns: number;\n  };"},{"name":"CommandRunArgs","kind":"type","line":1816,"doc":{"desc":["`command.run`'s input as a plugin's `$.command.run` takes it: `args` may","be left out (`/command`, bare); `origin` and `presentation` the engine sets."],"params":[],"example":[],"returns":[]},"text":"  export type CommandRunArgs = Omit<CommandRunInput, 'origin' | 'args' | 'presentation'> & {\n      /**\n       * Everything after the name, as the person would type it; left out, `\"\"`.\n       */\n      args?: string;\n  };"},{"name":"CommandRunInput","kind":"type","line":1827,"doc":{"desc":["The input of `command.run`: one slash command about to run, the way the","person typed it (`/name args`), and where the run came from."],"params":[],"example":[],"returns":[]},"text":"  export type CommandRunInput = {\n      /**\n       * Names the command without its slash (`compact`, `hello`), aliases and\n       * folds resolved; the key a matcher narrows on. A rewrite is refused.\n       */\n      command: string;\n      /**\n       * Everything after the name, as typed (`\"\"` when nothing was); a hook\n       * rewrites it with `next({ ...e, args })`.\n       */\n      args: string;\n      /**\n       * Where the run came from, in `prompt.submit`'s words (PromptOrigin):\n       * the person's Enter (`composer`), the bridge, the SDK, or a plugin.\n       *\n       * A plugin's `$.command.run` reads `{ kind: 'plugin', name }`. `next(e)`\n       * passes it on as received.\n       */\n      origin: PromptOrigin;\n      /**\n       * Where the command's answer will show (CommandPresentation): the\n       * fullscreen layout or the main screen, and the terminal's width.\n       *\n       * Pinned: the engine stamps it, `next(e)` passes it on, a rewrite that\n       * leaves it out keeps it and one that changes it is refused.\n       */\n      presentation: CommandPresentation;\n  };"},{"name":"CommandRunResult","kind":"type","line":1872,"doc":{"desc":["What a `command.run` hook returns and what `next(e)` and `$.command.run`","resolve to: the command's output text and the notes it leaves the model.","","From core, `text` is what the command printed (a `local` command's","returned text; a panel command may print nothing), `context` what it","recorded for the model beside that, and `ref` names the run.","","A hook's own answer without `next` runs no command: its `text` is shown","as the command's output, under the names of the plugins hooking the","command unless each is bundled with Claude Code, whose answer reads as","the built-in command's own, and its `context` is recorded after it.","","Both are the plugin's to size, as a core command's output is; what bounds","them is what bounds any transcript row where a surface draws it."],"params":[],"example":[],"returns":[]},"text":"  export type CommandRunResult = {\n      /**\n       * The command's output as a transcript line, or undefined when the\n       * command showed nothing as text (a panel, a prompt for the model).\n       */\n      text?: string;\n      /**\n       * What the model reads after the command's output and the person never\n       * sees, each entry one hidden user message recorded after the output row.\n       *\n       * From core, the notes the command left the model, absent when none. Kept\n       * whole from `next`: left out after `next`, the last answer's notes ride\n       * along; written, it keeps every entry that answer had (none empty).\n       */\n      context?: readonly string[];\n      /**\n       * Whether `text` is for the person alone and `context` is all the model\n       * reads: the output row is drawn and kept, and goes in no request.\n       *\n       * Read on a hook's own answer without `next`, when every plugin hooking the\n       * command is bundled with Claude Code, whose answer reads as the built-in\n       * command's own, on the queued lanes: a panel answered mid-turn keeps its\n       * text in requests. Any other plugin's text stays in requests.\n       */\n      isTextDisplayOnly?: true;\n      /**\n       * What the process exits with when this command was the whole prompt of a\n       * headless run (`claude -p \"/lint\"`): a whole number from 0 to 255.\n       *\n       * Left out, the run exits as it would have; any other value fails the\n       * hook. An interactive session ignores it, and core never sets it. The\n       * answer the chain ends on decides: a hook above answering its own drops it.\n       *\n       * @example\n       * on(\"command.run\", { command: \"lint\" }, () => ({ text, exitCode: 3 }))\n       */\n      exitCode?: number;\n      /**\n       * Set by core on what `next(e)` resolves to: names the engine's run of\n       * the command (its result stays on the host side).\n       *\n       * A hook that returns the object it got makes the engine use that run\n       * verbatim. Absent on a hook's own `{ text }` and on `$.command.run`'s.\n       */\n      ref?: number;\n  };"},{"name":"CommandSource","kind":"type","line":1926,"doc":{"desc":["Where a slash command comes from, as `$.command.list()` tells them apart.","","`builtin` ships with Claude Code; `plugin` is a plugin's markdown command,","skill or `$.command.register`; `user` is the user's or project's own","file; `mcp` an MCP server's prompt."],"params":[],"example":[],"returns":[]},"text":"  export type CommandSource = 'builtin' | 'plugin' | 'user' | 'mcp';"},{"name":"CommandSpec","kind":"type","line":1931,"doc":{"desc":["What `$.command.register` takes: the slash command this plugin serves."],"params":[],"example":[],"returns":[]},"text":"  export type CommandSpec = {\n      /**\n       * The command's name without the slash (letters, digits, `_`, `-`; up to\n       * 64); the person runs it as `/<name>`.\n       */\n      name: string;\n      /**\n       * The one line the typeahead and `/help` show for it.\n       */\n      description: string;\n      /**\n       * The hint drawn dim after the name (`[name]`), when it takes arguments.\n       */\n      argumentHint?: string;\n      /**\n       * Set so that `/<name>` typed while a turn is in flight runs at once\n       * instead of waiting for the turn to end, as it does when left out.\n       *\n       * Its `command.run` hook then runs while a turn may still be streaming and\n       * must not assume the turn's state (what the transcript holds, whether a\n       * tool is mid-call); its `{ text }` prints as an idle run's does.\n       */\n      immediate?: true;\n  };"},{"name":"ConfigChangeHookInput","kind":"type","line":1956,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"  type ConfigChangeHookInput = BaseHookInput & {\n      hook_event_name: 'ConfigChange';\n      source: 'user_settings' | 'project_settings' | 'local_settings' | 'policy_settings' | 'skills';\n      file_path?: string;\n  };"},{"name":"ConfigDescribeInput","kind":"type","line":1966,"doc":{"desc":["The input of `config.describe`: how one `/config` row presents, at the","moment the menu lists it (and for `$.config.list`)."],"params":[],"example":[],"returns":[]},"text":"  export type ConfigDescribeInput = {\n      /**\n       * Names the row, as `config.set`'s `key` does; the key a matcher narrows\n       * on. Pinned: a rewrite is refused.\n       */\n      key: string;\n      /**\n       * What the menu draws for the row, before its value.\n       */\n      label: string;\n      /**\n       * The help text beneath the label, when the row has one (a plugin\n       * field's `description`); absent for the panel's own rows.\n       */\n      description?: string;\n      /**\n       * Whether the menu leaves the row out; a hidden row still answers\n       * `$.config.set` and `/config key=value`.\n       */\n      isHidden: boolean;\n      /**\n       * Who owns the row, as `config.set`'s `provider`. Pinned.\n       */\n      provider: Origin;\n  };"},{"name":"ConfigDescribeResult","kind":"type","line":1996,"doc":{"desc":["What a `config.describe` hook returns: the label, help text and hidden","flag the menu uses; the key and provider stay as they were."],"params":[],"example":[],"returns":[]},"text":"  export type ConfigDescribeResult = Omit<ConfigDescribeInput, 'key' | 'provider'>;"},{"name":"ConfigKind","kind":"type","line":2002,"doc":{"desc":["How a `/config` row takes its value: `boolean` toggles, `choice` picks one","of its `options`, `text` takes a string, `number` a number."],"params":[],"example":[],"returns":[]},"text":"  export type ConfigKind = 'boolean' | 'choice' | 'text' | 'number';"},{"name":"ConfigOrigin","kind":"type","line":2010,"doc":{"desc":["Where a `config.set` came from, in `prompt.submit`'s words: the person","in the `/config` menu (`composer`), the bridge, or a plugin, named.","","Set by the engine; `next(e)` passes it on as received and none sets it."],"params":[],"example":[],"returns":[]},"text":"  export type ConfigOrigin = {\n      /**\n       * The person's own change in the `/config` menu (a toggle, a pick, a\n       * typed value), or their `/config key=value`.\n       */\n      kind: 'composer';\n  } | {\n      /**\n       * A `/config key=value` that arrived over the Remote Control bridge (a\n       * phone or web client, or a relay): not attestably the owner's hand.\n       */\n      kind: 'bridge';\n  } | {\n      /**\n       * A plugin's `$.config.set`; that plugin's own hooks do not see it.\n       */\n      kind: 'plugin';\n      /**\n       * The calling plugin's name.\n       */\n      name: string;\n  };"},{"name":"ConfigRow","kind":"type","line":2037,"doc":{"desc":["One `/config` row as `$.config.list()` returns it: what the menu would","draw now, after every `config.describe` hook, a hidden row left out."],"params":[],"example":[],"returns":[]},"text":"  export type ConfigRow = {\n      /**\n       * Names the row: the panel's id for a built-in, `<plugin>.<field>` for a\n       * plugin's `userConfig` field; what `$.config.set` takes.\n       */\n      key: string;\n      /**\n       * What the menu draws for the row, before its value.\n       */\n      label: string;\n      /**\n       * The help text under the label, when the row has one.\n       */\n      description?: string;\n      /**\n       * How the row takes its value (ConfigKind).\n       */\n      kind: ConfigKind;\n      /**\n       * What the row holds now.\n       */\n      value: ConfigValue;\n      /**\n       * The values a `choice` row takes, in order (a plugin string field's\n       * declared `options` for its row); absent otherwise.\n       */\n      options?: readonly string[];\n      /**\n       * Who owns the row: the engine for the panel's own, else the plugin.\n       */\n      provider: Origin;\n      /**\n       * Whether a trusted source (managed settings, the organization's policy)\n       * owns the value, so the menu shows it and refuses a change.\n       */\n      isLocked: boolean;\n  };"},{"name":"ConfigSetArgs","kind":"type","line":2079,"doc":{"desc":["`config.set`'s input as a plugin's `$.config.set(args)` takes it: the","row's key and the value; the engine fills the rest."],"params":[],"example":[],"returns":[]},"text":"  export type ConfigSetArgs = Pick<ConfigSetInput, 'key' | 'value'>;"},{"name":"ConfigSetInput","kind":"type","line":2085,"doc":{"desc":["The input of `config.set`: one `/config` row about to change, from the","menu or a plugin's `$.config.set`, with what it holds now and who owns it."],"params":[],"example":[],"returns":[]},"text":"  export type ConfigSetInput = {\n      /**\n       * Names the row: the panel's own id for a built-in (`theme`, `verbose`,\n       * `autoCompact`), `<plugin>.<field>` for a plugin's `userConfig` field.\n       *\n       * The key a matcher narrows on; pinned: a rewrite is refused.\n       */\n      key: string;\n      /**\n       * What the row is being set to; `next({ ...e, value })` clamps or\n       * replaces it, held to the row's kind (a toggle takes a boolean).\n       */\n      value: ConfigValue;\n      /**\n       * What the row holds before the change, as the menu shows it. Pinned.\n       */\n      previous: ConfigValue;\n      /**\n       * Who owns the row: `{ plugin: \"engine\", tier: \"core\" }` for the panel's\n       * own, the plugin and its tier for a `userConfig` field. Pinned.\n       */\n      provider: Origin;\n      /**\n       * Where the change came from (ConfigOrigin): the person in the menu\n       * (`composer`) or a plugin's `$.config.set`. Pinned.\n       */\n      origin: ConfigOrigin;\n  };"},{"name":"ConfigSetResult","kind":"type","line":2122,"doc":{"desc":["What a `config.set` hook returns and what `next(e)` resolves to:","`{ value }` once written, or `{ deny: reason }`, the row left as it was.","","The menu shows a deny's reason; `$.config.set` resolves with it. A deny","after a `next(e)` was answered fails the hook: its `.catch` is asked (a","deny from it fails too), or it is skipped by name and its last `next` stands."],"params":[],"example":[],"returns":[]},"text":"  export type ConfigSetResult = {\n      value: ConfigValue;\n      deny?: undefined;\n  } | {\n      deny: string;\n      value?: undefined;\n  };"},{"name":"ConfigValue","kind":"type","line":2134,"doc":{"desc":["A `/config` row's value as a hook and `$.config` see it: a toggle's","boolean, a choice's or a text's string, a number, or a list of strings."],"params":[],"example":[],"returns":[]},"text":"  export type ConfigValue = boolean | string | number | readonly string[];"},{"name":"ContextAgent","kind":"type","line":2140,"doc":{"desc":["One custom agent whose description the Agent tool's prompt carries;","built-in agents are left out."],"params":[],"example":[],"returns":[]},"text":"  export type ContextAgent = {\n      /**\n       * The agent's type, as the Agent tool names it.\n       */\n      agentType: string;\n      /**\n       * Where it was defined, by the engine's word (`projectSettings`,\n       * `userSettings`, `plugin`); the display label is the renderer's.\n       */\n      source: string;\n      /**\n       * The description's estimated tokens.\n       */\n      tokens: number;\n  };"},{"name":"ContextBreakdownDetail","kind":"type","line":2162,"doc":{"desc":["How a context breakdown is counted: `full` with the token-count API per","category, `summary` from the last response's usage and local estimates.","","The SDK's `get_context_usage` takes the same two words as its `detail`."],"params":[],"example":[],"returns":[]},"text":"  export type ContextBreakdownDetail = 'summary' | 'full';"},{"name":"ContextCategory","kind":"type","line":2168,"doc":{"desc":["One row of the breakdown, as /context lists it beside the grid (`System","prompt`, `Messages`, `Free space`, `Autocompact buffer`)."],"params":[],"example":[],"returns":[]},"text":"  export type ContextCategory = {\n      /**\n       * The row's label as /context prints it.\n       */\n      name: string;\n      /**\n       * The row's estimated tokens; a `deferred` row's do not count toward the\n       * total.\n       */\n      tokens: number;\n      /**\n       * The theme colour /context draws the row and its squares in, by its key\n       * in the theme (`promptBorder`, `inactive`, `permission`).\n       */\n      color: string;\n      /**\n       * Whether the row is tool schemas loaded on demand, which the grid leaves\n       * out; the same fact as `kind` `deferred`.\n       */\n      isDeferred: boolean;\n      /**\n       * What the row is (ContextCategoryKind), stamped by the engine.\n       */\n      kind: ContextCategoryKind;\n  };"},{"name":"ContextCategoryKind","kind":"type","line":2201,"doc":{"desc":["What a breakdown row is; branch on this, never on the row's `name`.","","`used` content occupies the window, `free` is the window left, `buffer`","the compaction reserve, `deferred` tool schemas loaded on demand and","outside the window."],"params":[],"example":[],"returns":[]},"text":"  export type ContextCategoryKind = 'used' | 'free' | 'buffer' | 'deferred';"},{"name":"ContextGridSquare","kind":"type","line":2207,"doc":{"desc":["One square of the grid /context draws: which row it belongs to and how","full it is."],"params":[],"example":[],"returns":[]},"text":"  export type ContextGridSquare = {\n      /**\n       * The theme colour of the square's row, by its key in the theme.\n       */\n      color: string;\n      /**\n       * Whether the square holds any of its row's tokens.\n       */\n      isFilled: boolean;\n      /**\n       * The `name` of the row the square belongs to (`Free space` for the\n       * window left).\n       */\n      categoryName: string;\n      /**\n       * The row's tokens, repeated on each of its squares.\n       */\n      tokens: number;\n      /**\n       * The row's share of the window as a whole percentage, repeated likewise.\n       */\n      percentage: number;\n      /**\n       * How full this one square is, 0 to 1: a row's last square is the partial\n       * one (/context draws it hollow under 0.7).\n       */\n      squareFullness: number;\n  };"},{"name":"ContextMcpTool","kind":"type","line":2239,"doc":{"desc":["One MCP tool's schema as the context carries it."],"params":[],"example":[],"returns":[]},"text":"  export type ContextMcpTool = {\n      /**\n       * The tool's wire name (`mcp__linear__create_issue`).\n       */\n      name: string;\n      /**\n       * The server it belongs to, as /mcp lists it.\n       */\n      serverName: string;\n      /**\n       * The schema's estimated tokens.\n       */\n      tokens: number;\n      /**\n       * Whether the schema is inside the window now: always, unless tool\n       * schemas load on demand and this one has not been searched for yet.\n       */\n      isLoaded: boolean;\n  };"},{"name":"ContextMemoryFile","kind":"type","line":2263,"doc":{"desc":["One memory file the context carries (a CLAUDE.md, a rules file, an","auto-memory entry)."],"params":[],"example":[],"returns":[]},"text":"  export type ContextMemoryFile = {\n      /**\n       * The file's path, absolute.\n       */\n      path: string;\n      /**\n       * The display label of where it was loaded from (`Project`, `User`,\n       * `Local`, `Managed`, `AutoMem`).\n       */\n      type: string;\n      /**\n       * The file's estimated tokens.\n       */\n      tokens: number;\n  };"},{"name":"ContextSkill","kind":"type","line":2282,"doc":{"desc":["One skill whose listing the context carries."],"params":[],"example":[],"returns":[]},"text":"  export type ContextSkill = {\n      /**\n       * The skill's name as `/skills` lists it.\n       */\n      name: string;\n      /**\n       * Where it came from, by the engine's word (`userSettings`, `plugin`,\n       * `built-in`, `mcp`, `syncedSkills`); the display label is the renderer's.\n       */\n      source: SkillSource;\n      /**\n       * The providing plugin's name, when the skill comes from one.\n       */\n      pluginName?: string;\n      /**\n       * The listing's estimated tokens.\n       */\n      tokens: number;\n  };"},{"name":"ContextSkills","kind":"type","line":2306,"doc":{"desc":["The skills the context lists for the model: how many there are, how many","fit the listing's budget, and each one's share."],"params":[],"example":[],"returns":[]},"text":"  export type ContextSkills = {\n      /**\n       * How many skills the session has.\n       */\n      totalSkills: number;\n      /**\n       * How many the listing included within its token budget.\n       */\n      includedSkills: number;\n      /**\n       * The listing's tokens in all.\n       */\n      tokens: number;\n      /**\n       * One entry per listed skill.\n       */\n      skillFrontmatter: ContextSkill[];\n  };"},{"name":"ContextSlashCommands","kind":"type","line":2328,"doc":{"desc":["The slash commands the Skill tool's prompt lists, counted."],"params":[],"example":[],"returns":[]},"text":"  export type ContextSlashCommands = {\n      /**\n       * How many commands the session has.\n       */\n      totalCommands: number;\n      /**\n       * How many the listing included.\n       */\n      includedCommands: number;\n      /**\n       * The listing's tokens in all.\n       */\n      tokens: number;\n  };"},{"name":"ContextWindowSource","kind":"type","line":2351,"doc":{"desc":["How the window the breakdown measures against was settled; /context","prints its `Auto-compact window` line off this.","","`auto` is the model's own limit; the rest name a compaction window by who","set it: the `CLAUDE_CODE_AUTO_COMPACT_WINDOW` variable, the settings, the","account, an experiment, the model's default, or an unrecognised model's."],"params":[],"example":[],"returns":[]},"text":"  export type ContextWindowSource = 'env' | 'settings' | 'clientdata' | 'experiment' | 'model-default' | 'unknown-model' | 'auto';"},{"name":"CoreEngineInterface","kind":"interface","line":2360,"doc":{"desc":["The plugin's identity (`plugin`) and the nouns core contributes to `$` as","the innermost step of the `engine.create` fold.","","A plugin's finished `$` (EngineInterface) has every core noun an outer","step did not withhold, and every noun the plugins' steps added."],"params":[],"example":[],"returns":[]},"text":"  export interface CoreEngineInterface {\n      /**\n       * This plugin, as loaded: its manifest name and its directory.\n       */\n      plugin: {\n          /**\n           * From plugin.json; debug-log and `$.ui.log` lines carry it.\n           */\n          name: string;\n          /**\n           * The plugin's directory (the one holding plugin.json), absolute.\n           */\n          root: string;\n      };\n      /**\n       * Display: a line under an open dialog, a redraw or a repaint, a log line,\n       * panes the surface places, a window or ring, a surface's clipboard.\n       */\n      ui: {\n          /**\n           * Shows `text` as one line under the dialog open for `tool_use_id`, or\n           * removes the line when `text` is undefined.\n           *\n           * Core removes the line when the call resolves. A call that is not open\n           * is refused, as is another plugin's `$.tool.call` run.\n           *\n           * @param tool_use_id the call whose open dialog gets the line\n           * @param text the line to show; undefined removes it\n           * @example\n           * $.ui.notice(e.tool_use_id, \"checked by my-plugin\"); return next(e)\n           */\n          notice: (tool_use_id: string, text: string | undefined) => void;\n          /**\n           * Re-runs an event whose results the engine caches: `ui.render` draws the\n           * instances this plugin may draw again; the others drop the cached answers.\n           *\n           * A redraw: ten a second at most, thirty in the terminal for a shown pane,\n           * expanded band and prompt hint (sooner calls fold). A cached answer drops\n           * next turn; a changed tool or section text rewrites what a thread sent,\n           * which loses its thinking and the prompt cache, so do not call it for\n           * these once a thread has sent.\n           *\n           * @remarks An ask ends with the process: a resumed thread sends what it\n           *   recorded; asked again, a `tool.describe` hook's answer goes over the\n           *   recorded description where it differs.\n           * @param event `ui.render`, or a cached-answer event: `prompt.section`,\n           *   `prompt.context`, `prompt.attachment`, `tool/command/config.describe`\n           */\n          invalidate: (event: InvalidatableEventName) => void;\n          /**\n           * Repaints a mounted `Raster` this plugin's own render hook drew with new\n           * cells, or swaps a keyed `Image` it drew to a new source; no redraw.\n           *\n           * The surface paints the cells or source at its next frame, so blits\n           * between frames fold into one: up to 120 a second taken, some sixty\n           * shown. An Image swap sends one small command; a resize is a redraw.\n           *\n           * @param args `requestId` (the site), `key`, and `cells` (RasterProps) or\n           *             `source` (ImageSource); `columns`, `rows` (the mounted size)\n           * @returns `{}` once the cells or source are its next frame, or `{ deny }`\n           *          (not mounted, not this plugin's, another size, cells that do\n           *          not decode, a bad source, or an Image drawing its alt there:\n           *          no placeholder images, or a file this terminal cannot read)\n           * @example\n           * $.clock.every(33, () => $.ui.blit({ requestId, key, cells: frame() }))\n           * @example\n           * await $.ui.blit({ requestId: 'browser', key: 'view',\n           *   source: { shm: name, format: 'rgb', width, height } })\n           */\n          blit: (args: UiBlitArgs) => Promise<UiBlitResult>;\n          /**\n           * The elements of the surface `e` is drawn on (Elements[e.surface]): a\n           * frozen table of constructors, the JSX tags a render hook draws with.\n           *\n           * A read, not a dispatch: the engine ran `ui.resolve` (the other hooks,\n           * then core) at load, per surface and component. Narrowed `e.surface`:\n           * that table exactly; unnarrowed: the union, so shared names type-check.\n           *\n           * @param e this hook's own `ui.render` argument (its surface and\n           *          component pick the table)\n           * @returns the surface's frozen element table (`Elements[e.surface]`)\n           * @example\n           * const { Box, Text } = $.ui.resolve(e)\n           * return <Box>{await next(e)}<Text dimColor>done</Text></Box>\n           */\n          resolve: <E extends ResolveInput>(e: E) => Elements[E['surface']];\n          /**\n           * Appends one line to the transcript, drawn like a system notice (dim;\n           * not sent to the model), or with `{ to: \"debug\" }` to the debug log alone.\n           *\n           * A row of its own at the next frame, in logging order; a `-p` or SDK\n           * host receives it as `ui_log`; the debug log has it either way, to 10000\n           * characters. Raised as `ui.log`: a hook above may rewrite `e.to`.\n           *\n           * @param text the line's text, of any length: the terminal draws its\n           *   first 2000 characters, a remote surface 10000\n           * @param options `to`: `transcript` (the default) or `debug`\n           * @example\n           * $.ui.log(`prompt from ${e.origin.kind}: ${e.text.length} chars`)\n           * @example\n           * $.ui.log(`cache miss for ${e.tool_use_id}`, { to: \"debug\" })\n           */\n          log: (text: string, options?: UiLogOptions) => void;\n          /**\n           * Asks the user `question` in the engine's own AskUserQuestion dialog and\n           * resolves to the label they chose, or the text typed under \"Other\".\n           *\n           * A `tool.call` of `AskUserQuestion` through every hook but the calling\n           * one, drawn by `ui.render` on `AskUserQuestion`; a multi-select answer is\n           * comma-joined. Rejects when dismissed, and in a `-p` run (no one to ask).\n           *\n           * @param question the question, ending in a question mark\n           * @param options 2-4 option labels, or `{ options, header, multiSelect }`\n           * @returns the label chosen, the chosen labels comma-joined, or free text\n           *          typed under \"Other\" (so compare it with the labels exactly)\n           * @example\n           * const mood = await $.ui.ask(\"How careful?\", [\"Bold\", \"Careful\"])\n           */\n          ask: (question: string, options?: readonly string[] | AskOptions) => Promise<string>;\n          /**\n           * Shows `text` for a few seconds under the plugin's name: a small box on\n           * the stack of plugin toasts over the transcript's top right corner.\n           *\n           * A click takes it off, the pointer over it holds it. Where the transcript\n           * is printed into scrollback (nothing to float over) it is one line on the\n           * notification bar. It leaves the transcript and the model untouched.\n           *\n           * @remarks While the pane shown was opened `holdToasts`, by any plugin, it\n           *   waits undrawn, its timer not started; past 50 waiting, an older leaves.\n           * @param text the line to show, its first 2000 characters drawn (10000\n           *   remotely); an unpaired surrogate half in it is drawn as U+FFFD\n           * @param options `timeoutMs`: how long it stays (default 4000)\n           * @example\n           * $.ui.toast(`turn took ${Math.round(e.durationMs / 1000)} s`)\n           */\n          toast: (text: string, options?: ToastOptions) => void;\n          /**\n           * Raises a native notification of `text` through the person's own\n           * notification channel, the one their `preferredNotifChannel` names.\n           *\n           * Their `Notification` hooks run first, reading `plugin_notification`,\n           * then the channel writes. Raised as `ui.notify`; nothing limits how\n           * often. With no terminal the hooks alone run; unbound or exiting, none.\n           *\n           * @remarks A hook that notifies is left out of the hooks its own call\n           *   runs. Rejects on a hook's `{ deny }`, and on a failed write.\n           * @param text the notification's body, sent as given, of any length\n           * @param options `title`: what heads it (default: the plugin's name)\n           * @returns `{ isSent: true, channel }`, or `{ isSent: false, reason }`:\n           *          turned off (`disabled`), `no-channel`, `no-surface`, `refused`\n           * @example\n           * const sent = await $.ui.notify(\"tests passed\", { title: \"CI\" })\n           */\n          notify: (text: string, options?: NotifyOptions) => Promise<UiNotifyResult>;\n          /**\n           * Pins `text` as this plugin's status line under the prompt, beside the\n           * engine's own pinned notices, until the next call replaces it.\n           *\n           * One per plugin; `undefined` removes it.\n           *\n           * @param text the line to keep on screen, its first 2000 characters drawn\n           *   (10000 remotely); undefined clears it\n           * @example\n           * $.ui.status(\"thinking...\"); return next(e)\n           */\n          status: (text: string | undefined) => void;\n          /**\n           * Opens a pane, a framed region the surface places and this plugin draws\n           * by hooking `ui.render` for `{ component: \"Pane\" }`; says if it is drawn.\n           *\n           * One per id (an open id retitles; a `ui.open` hook may refuse). Asked,\n           * the person's command, prompt or press behind it (not `focus`), it is\n           * placed at any width; unasked, from 144 columns, 110 for one once asked.\n           *\n           * @remarks Below that it waits undrawn (`$.ui.panes()`: `isPlaced` false)\n           *   for their open or a wider terminal; with no surface attached, for one.\n           * @param pane `id` (1-64 of letters, digits, `_`, `-`), `title`, `focus`,\n           *   `closeOnEscape` and `holdToasts` (a dialog), `backgroundColor` (what\n           *   is painted under its body), `rows` / `columns` wanted\n           * @returns `{ isPlaced: true }` once drawn (or retitled), else `{ isPlaced:\n           *   false, reason }` (UiOpenResult); `dock` or `inline` is on `Pane` props\n           * @example\n           * await $.ui.open({ id: \"clock\", title: \"Clock\" })\n           * @example\n           * await $.ui.open({ id: \"ask\", focus: true, closeOnEscape: true, rows: 9 })\n           * @example\n           * const opened = await $.ui.open({ id: \"clock\" })\n           * if (!opened.isPlaced) $.ui.log(\"clock: \" + opened.reason)\n           */\n          open: (pane: PaneOpenArgs) => Promise<UiOpenResult>;\n          /**\n           * Closes one of the open panes; an id that is not open is left alone.\n           *\n           * Every close raises `ui.close`, `e.origin` naming whose it is: this call\n           * (`plugin`), the person's mark or key (`person`), an unload (`unload`).\n           * A hook answering without `next` keeps the pane open, save on an unload.\n           *\n           * @param pane `id`: the id the pane was opened under\n           * @returns settles once the pane is gone or a hook answered for it;\n           *          rejects on a hook's `{ deny }`\n           * @example\n           * onPress: () => $.ui.close({ id: \"clock\" })\n           */\n          close: (pane: PaneCloseArgs) => Promise<void>;\n          /**\n           * Lists this plugin's own open panes (UiPane): each one's id and title,\n           * and whether it is shown, holds the keyboard, and is placed.\n           *\n           * The engine's record, not the module's: a module reloaded while its\n           * pane stayed up finds it here. Another plugin's panes are not listed.\n           *\n           * @returns the panes in open order, placed ones first; empty with none\n           * @example\n           * const isUp = (await $.ui.panes()).some(pane => pane.id === \"clock\")\n           * if (!isUp) await $.ui.open({ id: \"clock\", title: \"Clock\" })\n           */\n          panes: () => Promise<readonly UiPane[]>;\n          /**\n           * Places one row at the transcript's end, which scrolls with the\n           * conversation and draws what `ui.render` answers for `Placed`.\n           *\n           * A hook reads `e.props.id` and `e.props.plugin`. Display only: the model\n           * and the transcript file never read it, and `--resume` brings none back. A\n           * hook that passes draws nothing; the same id answers the row that stands.\n           *\n           * @example\n           * await $.ui.place({ id: \"build\" })\n           */\n          place: (args: UiPlaceArgs) => Promise<UiPlaceResult>;\n          /**\n           * Scrolls something into view as the DOM's `scrollIntoView` would: a\n           * render instance by `requestId`, an element by `key`, a site's edge.\n           *\n           * A site of this plugin's (its pane, the band it draws into) moves under\n           * the event `ui.scroll`, origin `plugin`. A transcript row moves only\n           * while this call answers the person's own input, where one scrolls.\n           *\n           * @param args `to` (what), `in` (which site, required for `start` and\n           *             `end`), `block` (where it lands; `nearest` by default)\n           * @returns `{}` once it moved, or `{ deny }` saying why not\n           * @example\n           * onPress: () => $.ui.scroll({ in: \"log\", to: \"end\" })\n           */\n          scroll: (args: UiScrollArgs) => Promise<UiScrollResult>;\n          /**\n           * Moves the focus ring of one of this plugin's sites onto an element it\n           * drew there, as the DOM's `element.focus()`, while it holds the keys.\n           *\n           * Raised as `ui.focus`, origin `plugin`; the engine's inverse marks it.\n           * A site not holding the keys, or holding them on another's element, is\n           * `{ deny }`; an element not yet drawn is awaited, bounded: no retrying.\n           *\n           * @param args `requestId` (which site: a pane's id, the band's) and `key`\n           *             (the element's, as drawn)\n           * @returns `{}` once it moved, or `{ deny }` saying why not\n           * @example\n           * await $.ui.open({ id: \"files\", focus: true })\n           * await $.ui.focus({ requestId: \"files\", key: \"row:0\" })\n           */\n          focus: (args: UiFocusArgs) => Promise<UiFocusResult>;\n          /**\n           * Puts `text` on the clipboard of a surface the session draws on, as the\n           * DOM's `navigator.clipboard.writeText`, and says whether it took.\n           *\n           * `surface` names which (a press hook passes `e.surface`); left out, the\n           * session's first. Raised as `ui.copy` with that target on `e`. The\n           * terminal writes as `/copy` does; a remote surface has no path yet.\n           *\n           * @param args `text`, what the person pastes; `surface`, where\n           * @returns `{ isCopied: true }`, or `{ isCopied: false, reason }`\n           * @example\n           * onPress: press => $.ui.copy({ text: url, surface: press.surface })\n           */\n          copy: (args: UiCopyArgs) => Promise<UiCopyResult>;\n          /**\n           * Returns what the person last selected with the mouse: the text as a\n           * copy would take it, and the transcript row it lies in.\n           *\n           * A key or a click takes the highlight down before a command or a press\n           * runs, so the answer stays what the person last selected, until they\n           * select again, dismiss it, or their next prompt or command has run.\n           *\n           * @returns the selection; `undefined` with nothing selected, and where\n           *          none is seen: fullscreen off, -p, a surface that answers none\n           * @example\n           * const selected = await $.ui.selection()\n           */\n          selection: () => Promise<UiSelection | undefined>;\n          /**\n           * Puts an agent's transcript in the main view, as the person's own\n           * switch from the tasks list does; `{}` goes back to the main one.\n           *\n           * Only while the call answers the person's own input (a press, a pick,\n           * their prompt or command): the viewed agent takes the prompt's next\n           * Enter. A site reads the view in force as `e.props.view`.\n           *\n           * @param view `agentId`: the agent's `id` in `$.agent.list()`; absent for\n           *             the main conversation\n           * @returns `{}` once the view shows it, or `{ deny }` saying why not\n           * @example\n           * onPress: () => $.ui.view({ agentId: agent.id })\n           * @example\n           * onPress: () => $.ui.view({})\n           */\n          view: (view: SiteView) => Promise<UiViewResult>;\n      };\n      /**\n       * The session's one theme: how the app looks behind and around the\n       * conversation. One theme stands at a time, the latest set, whichever plugin\n       * set it; there is no stack.\n       */\n      theme: {\n          /**\n           * Sets the session's theme from one object of named top-level attributes.\n           * `backdrop` is drawn behind the conversation by what `ui.render` answers\n           * for `Backdrop`: full window on desktop under its frosted panels, full\n           * screen on mobile under one veil (`tint` and `opacity`, not yet `blur`).\n           * Display only: `--resume` brings none back and a plugin that unloads\n           * takes its own with it, so set it at `session.start`.\n           *\n           * @param attributes `backdrop`: `id`, `glass` (`blur`, `tint`, `opacity`) or\n           *   `false`, and `colorScheme` (`light` or `dark`)\n           * @returns `{ isDrawn: true, requestId }`, or `isDrawn: false` and why\n           * @example\n           * await $.theme.set({ backdrop: { id: \"lagoon\", glass: { blur: 14, opacity: 0.55 } } })\n           */\n          set: (attributes: ThemeSetArgs) => Promise<ThemeResult>;\n          /**\n           * Clears the session's theme, back to the app's own look.\n           *\n           * IT CLEARS WHATEVER THEME STANDS, WHICHEVER PLUGIN SET IT: there is one\n           * theme, so a clear is the session's and not the caller's own. Clear on a\n           * person's ask (a command, a button), never at `session.start` or on a\n           * reload: a plugin that clears there wipes another plugin's theme each time.\n           *\n           * @returns `isDrawn: false` and why\n           * @example\n           * await $.theme.clear() // a preview ends with no theme to go back to\n           */\n          clear: () => Promise<ThemeResult>;\n      };\n      /**\n       * Completions through the session's own client and credentials.\n       */\n      model: {\n          /**\n           * Runs one text completion through the session's own API client and\n           * resolves a result: the reply's text and cost, or why there is no text.\n           *\n           * No tools, no history, no system prompt beyond the CLI's identity block\n           * and `request.system`; ModelCompleteRequest says the rest. Only a request\n           * the engine refuses to send (a blocked model, a bad cap) rejects.\n           *\n           * @param request the model (an alias such as `haiku`, or a full id\n           *                resolved like `--model`), prompt, cap, effort, time limit\n           * @param options `signal`: the plugin's own AbortSignal; aborting it\n           *   cuts the call while it runs, which then resolves `aborted`\n           * @returns the reply (`isAnswered`, `text`, `usage`), else the `reason`:\n           *          `api-error` with `status` and `error`, `empty-reply`, `aborted`\n           * @example\n           * const r = await $.model.complete({ model: \"haiku\", prompt, effort })\n           * @example\n           * // one handler starts it, a later one cancels it while it runs\n           * let stop = new AbortController()\n           * const start = async () => {\n           *   stop = new AbortController()\n           *   const r = await $.model.complete(ask, { signal: stop.signal })\n           *   if (!r.isAnswered && r.reason === \"aborted\") $.ui.log(\"cancelled\")\n           * }\n           * const cancel = () => stop.abort()\n           */\n          complete: (request: ModelCompleteRequest, options?: ModelCompleteOptions) => Promise<ModelCompleteResult>;\n          /**\n           * Runs one tool-less completion over the session's OWN transcript as the\n           * main thread last sent it, so the API serves that prefix from its cache.\n           *\n           * The main thread's last request again (its model, system prompt, tools,\n           * messages) with `prompt` after it: every tool denied, its own tail never\n           * cached, the prefix billed afresh once the entry lapsed or after `/model`.\n           * It thinks as hard as the session does unless `effort` says otherwise;\n           * ModelForkRequest says what holds that level and when it costs the cache.\n           *\n           * @param request the one user message the fork answers, and its effort\n           * @returns always a result, never null: the reply (`isAnswered`, `text`,\n           *          `usage`, the `effort` sent), or why there is no text (`reason`:\n           *          `nothing-to-fork` before the first request and after `/clear`,\n           *          `api-error` with its HTTP `status` and `error` kind,\n           *          `empty-reply`, or `aborted` when the turn whose hook forked was\n           *          interrupted); a request of the wrong shape (no prompt, an\n           *          `effort` that is no level) rejects instead\n           * @example\n           * const reply = await $.model.fork({ prompt: \"One line to learn?\" })\n           * $.ui.log(reply.isAnswered ? reply.text : `no reply: ${reply.reason}`)\n           * @example\n           * // a quick side job in a session the person runs at max\n           * const cut = await $.model.fork({ prompt: \"Shorter.\", effort: \"low\" })\n           */\n          fork: (request: ModelForkRequest) => Promise<ModelForkResult>;\n          /**\n           * Picks one of `labels` for `text` with one completion over\n           * `$.model.complete` and a fixed classifier prompt.\n           *\n           * `text` is data; the model answers with a label alone. It resolves\n           * `undefined` when the answer named none of `labels`. A failed request,\n           * an abort or a reply with no text rejects, naming the cause.\n           *\n           * @param text what to classify\n           * @param labels the labels to choose from (2 or more)\n           * @param options `model`: an alias or id; default the engine's small\n           *   fast model\n           * @returns the label the model named, or undefined when it named none;\n           *          rejects when the request fails or the reply has no text\n           * @example\n           * const kind = await $.model.classify(e.text, [\"bug\", \"feature\"])\n           * if (kind === undefined) return next(e)\n           */\n          classify: (text: string, labels: readonly string[], options?: ClassifyOptions) => Promise<string | undefined>;\n      };\n      /**\n       * Sound: clip playback and platform speech.\n       */\n      audio: {\n          /**\n           * Plays one audio clip, starting now; clips are not queued, so two calls\n           * play together (a bed under speech).\n           *\n           * `{ asset }` is the plugin's own file; `afplay` plays it on macOS, and a\n           * Linux or Windows terminal, having no player, plays nothing. Resolves once\n           * played or skipped; rejects, naming the cause, when the clip cannot play.\n           *\n           * @param clip the plugin's own file (`{ asset }`), a URL the engine\n           *   fetches, or the bytes as base64 with their MIME type\n           * @param options `shouldLoop`, `gain`, and an AbortSignal that stops the\n           *   clip\n           * @example\n           * await $.audio.play({ asset: \"sounds/done.wav\" })\n           */\n          play: (clip: AudioClip, options?: PlayOptions) => Promise<void>;\n          /**\n           * Speaks `text` with the platform's own synthesizer (`say` on macOS).\n           * Plain text.\n           *\n           * Utterances are queued among themselves; clips are not. Resolves when\n           * the utterance has ended; rejects, naming the cause, when there is no\n           * synthesizer, the voice is not installed, or the utterance failed.\n           *\n           * @param text what to say, as plain text\n           * @param options `voice`: the system voice's exact name (`Samantha`);\n           *   absent, the synthesizer's default\n           * @returns which synthesizer spoke, once the utterance has ended\n           */\n          speak: (text: string, options?: SpeakOptions) => Promise<SpeakResult>;\n      };\n      /**\n       * The engine's MCP servers: calling a connected one's tools, and\n       * connecting one the plugin lists itself.\n       */\n      mcp: {\n          /**\n           * Calls `tool` on one of the engine's connected MCP servers with the\n           * engine's own connection and credentials.\n           *\n           * A `cached` server is dialed on first use. No permission prompt: the\n           * plugin's call, seen by the hooks above it, is the grant. Positional, not\n           * the `{ tool: \"mcp__server__tool\", ... }` shape a `tool.call` hook sees.\n           *\n           * @param server the server's name as /mcp lists it (`claude.ai Gmail`;\n           *   the tool-name spelling `claude_ai_Gmail` is accepted too)\n           * @param tool the tool's name on that server (`create_draft`)\n           * @param args the tool's arguments; none when absent\n           * @returns the tool's result as MCP returns it: `content` blocks and\n           *          `isError`\n           * @example\n           * const { content } = await $.mcp.call(\"claude.ai Gmail\", \"create_draft\", {\n           *   to: \"team@example.com\",\n           *   subject: \"Release notes\",\n           * })\n           */\n          call: (server: string, tool: string, args?: Record<string, unknown>) => Promise<McpToolResult>;\n          /**\n           * Connects one of the MCP servers this plugin's own manifest lists, if\n           * the session has not already: a listed server joins it at its start.\n           *\n           * So listing a server defers nothing: to hold its tools back, refuse\n           * their calls at `tool.check`. The same server run under another name\n           * answers with that name; a refusal resolves with `reason`, `message`.\n           *\n           * @remarks Under `allowManagedHooksOnly` a `user`-tier plugin loads no\n           *   hooks: its gate is absent, yet its server connects. Ship it as managed.\n           * @param server the server's key in this plugin's manifest\n           * @returns connected, with the name `call` takes, or why not\n           * @example\n           * const browser = await $.mcp.connect(\"browser\")\n           * if (browser.isConnected) $.mcp.call(browser.server, \"open\", { url })\n           */\n          connect: (server: string) => Promise<McpConnectResult>;\n      };\n      /**\n       * The running session, read as plain data; compacting it; and sending a\n       * message from it to another agent or session.\n       */\n      session: {\n          /**\n           * Returns the transcript so far, one SessionMessage per user or assistant\n           * message; progress rows, `$.ui.log` lines and notices are not messages.\n           *\n           * With `{ agentId }`, one of this session's agents' instead (a subagent, a\n           * fork, a teammate in this process): what the session saved for it joined\n           * with what the engine holds. With `{ as: \"api\" }`, either as ApiMessage.\n           *\n           * @param args `agentId`, the id `tool.call`, `turn.complete` and `$.agent\n           *             .list()` carry; `as: \"api\"` for ApiMessage; hooks see both\n           * @returns the newest 4096 entries, `{ role, text, toolUses }` (a user\n           *          message may add `toolResults`; a `toolUses` entry adds `result`\n           *          and `text` once answered, an Agent tool use its `agentId`), or\n           *          with `as` `{ role, content }`, blocks intact, at most 4096\n           *          opening on a user message; for an `agentId` the session\n           *          cannot read, `{ deny }` (SessionMessagesDeny), never main\n           * @example\n           * const last = (await $.session.messages()).at(-1)\n           * @example\n           * const request = await $.session.messages({ as: \"api\" })\n           * await $.http.fetch(AUDIT_URL, {\n           *   method: \"POST\",\n           *   body: JSON.stringify({ session: await $.session.id(), request }),\n           * })\n           * @example\n           * on(\"turn.complete\", async ($, e, next) => {\n           *   if (e.agentId === undefined) return next(e)\n           *   const found = await $.session.messages({ agentId: e.agentId })\n           *   if (!(\"deny\" in found)) $.ui.log(`${found.length} messages`)\n           *   return next(e)\n           * })\n           */\n          messages: SessionMessagesCall;\n          /**\n           * Returns the directory the session runs in, absolute.\n           *\n           * A timer that outlives its hook reads the session's directory; keep the\n           * value read inside the hook if you need the hook's (a subagent's own).\n           */\n          cwd: () => Promise<string>;\n          /**\n           * Returns the session's project root, absolute: where it started, or\n           * where `/cd`, a host's directory change or a worktree move took it.\n           *\n           * A shell `cd` during the session does not move it; nested instruction\n           * files are read only beneath it.\n           */\n          root: () => Promise<string>;\n          /**\n           * Returns the main loop's model, as `/model` shows it.\n           */\n          model: () => Promise<string>;\n          /**\n           * Returns how many prompts the user has sent this session (user turns in\n           * the transcript).\n           */\n          turns: () => Promise<number>;\n          /**\n           * Returns the session's id (the transcript file's name).\n           */\n          id: () => Promise<string>;\n          /**\n           * Returns the git repository the session runs in, read from the working\n           * copy on each call; null when the directory is not inside one.\n           *\n           * @example\n           * const repo = await $.session.repo(); const publicRepo = !repo?.internal\n           */\n          repo: () => Promise<SessionRepo | null>;\n          /**\n           * Returns every surface the session draws on, each once: `terminal` under\n           * the REPL first, then the remote ones in the order they attached.\n           *\n           * A session may draw on several at once (a terminal and two phones):\n           * clients attach (`session.attach`) and detach, and a render hook still\n           * reads `e.surface` per ask. Empty in a plain -p run; never rejects.\n           *\n           * @example\n           * const inApp = (await $.session.surfaces()).some(s => s !== \"terminal\")\n           */\n          surfaces: () => Promise<readonly RenderSurface[]>;\n          /**\n           * Returns the first of `$.session.surfaces()`, or null where nothing\n           * draws.\n           *\n           * @deprecated use `surfaces()`; a session may draw on several surfaces at\n           *             once\n           */\n          surface: () => Promise<RenderSurface | null>;\n          /**\n           * Returns when the session began, and the context window's fill, the\n           * rate-limit windows and the cost as the status line has them, itemized.\n           *\n           * The plain call costs nothing; `\"full\"` counts each category with the\n           * token-count API as /context does, `\"summary\"` estimates locally, and\n           * `context.breakdown` comes back in the SDK's `get_context_usage` shape.\n           *\n           * @param args `{ breakdown, columns }`: how the breakdown is counted and\n           *   the width its grid is drawn in; nothing for the status line's figures\n           * @returns `{ startedAt, context, rateLimits, cost }` as the status line\n           *   has them\n           * @example\n           * const { context } = await $.session.usage()\n           * if ((context.percent ?? 0) >= 85) await $.session.compact()\n           * @example\n           * const isOlder = stat.mtimeMs < (await $.session.usage()).startedAt\n           * @example\n           * const usage = await $.session.usage({ breakdown: \"full\", columns })\n           * for (const row of usage.context.breakdown?.gridRows ?? []) draw(row)\n           */\n          usage: (args?: SessionUsageArgs) => Promise<SessionUsage>;\n          /**\n           * Returns the version of the engine the session runs on, the release it\n           * is built from, and when it was built.\n           *\n           * The same three values the engine's own analytics rows carry, answered\n           * in every mode and build; `base` is absent when the version is not\n           * spelled as a release, `builtAt` in a run from source that stamps none.\n           *\n           * @returns the full `version`, its release `base` (`2.1.280`, or\n           *          `2.1.280-dev` for a development build) and an ISO `builtAt`\n           * @example\n           * const { version, base, builtAt } = await $.session.version()\n           * row.env = { version, version_base: base, build_time: builtAt }\n           * @example\n           * const isRelease = !(await $.session.version()).base?.endsWith(\"-dev\")\n           */\n          version: () => Promise<SessionVersion>;\n          /**\n           * Compacts the conversation: the event `session.compact` with `trigger`\n           * `plugin`, the same call `/compact` makes, between turns.\n           *\n           * It runs through every hook but the calling one, then core: a summary\n           * and the kept messages in the transcript's place. Resolves `{ skip }`\n           * when a hook vetoed it; rejects while a turn runs.\n           *\n           * @example\n           * const { skip } = await $.session.compact({ instructions: \"the plan\" })\n           */\n          compact: EventCalls['session']['compact'];\n          /**\n           * Sends a plain-text message to another agent or session: the event\n           * `session.send`, the model's SendMessage tool's own call and delivery.\n           *\n           * `to` is the tool's spelling (a name, an agent id, a received `from`\n           * address) or `{ sessionId }` / `{ agentId }`; framed at the receiver as a\n           * peer's, `origin.plugin` naming this plugin there. Resolves once queued.\n           *\n           * @example\n           * const sent = await $.session.send({ to: { sessionId }, text: \"ok\" })\n           * @example\n           * await $.session.send({ to: { agentId }, text: \"stop after this file\" })\n           */\n          send: EventCalls['session']['send'];\n          /**\n           * Appends a row to a conversation of the session: the event\n           * `session.append`, the engine's own call for every row it keeps.\n           *\n           * A user-role row the person does not see as typed or a notice, of text\n           * blocks alone in this release (else refused with the reason): listed at\n           * once. `{ deny: reason }` when a plugin above refused it, nothing stored.\n           *\n           * @example\n           * await $.session.append({ message: { type: \"user\", content: [note] } })\n           */\n          append: (args: SessionAppendArgs) => Promise<SessionAppendResult>;\n          /**\n           * Holds the session's Anthropic credential on the host and answers an\n           * opaque handle and its kind; the secret never reaches the plugin.\n           *\n           * The handle is spent through `$.http.fetch(url, { auth: handle })`,\n           * which sets the credential header, only for a first-party host. Null\n           * with no first-party credential (a 3P provider, a gateway, no login).\n           *\n           * @example\n           * await $.http.fetch(url, { auth: (await $.session.authorize())?.handle })\n           */\n          authorize: () => Promise<SessionAuthorization>;\n          /**\n           * Returns how the session is signed in, to a mod the organization's\n           * managed settings install; `{ deny }` to any other. No request is made.\n           *\n           * The account (organization, plan, email) only where managed\n           * `forceLoginOrgUUID` lists its organization; else `kind` alone. A\n           * contract, not a wall: any mod can read the person's own config file.\n           *\n           * @example\n           * const { kind, organizationId, email } = await $.session.identity()\n           */\n          identity: () => Promise<SessionIdentity>;\n      };\n      /**\n       * The running model turn: ending it.\n       */\n      turn: {\n          /**\n           * Cancels the main loop's running model turn (the id its `turn.start`\n           * handed this plugin), its running tools stopped, no interruption marker.\n           *\n           * The event `turn.abort`, seen by the hooks above; the prompt this\n           * plugin submits next is the context. Rejects, naming both ids, when\n           * `turnId` is not the running turn's; a hook may end its own turn.\n           *\n           * @param input `turnId`: the id the main loop's `turn.start` carried\n           * @example\n           * on(\"turn.start\", ($, e, next) => {\n           *   if (e.agentId === undefined) held = e.turnId\n           *   return next(e)\n           * })\n           */\n          abort: (input: OpEventOf['turn.abort']) => Promise<void>;\n      };\n      /**\n       * Submitting a prompt the model reads as a user turn, and the person's\n       * prompt box: read as it stands, written, or proposed into.\n       */\n      prompt: {\n          /**\n           * Submits a prompt: the event `prompt.submit`, the same call the engine\n           * makes for a typed prompt; a turn of its own, once the session is idle.\n           *\n           * It goes through every hook but the calling one (the plugin's others\n           * see it) with `e.origin` `{ kind: 'plugin', name }`, the name the\n           * model reads it under unless a hook leaves it out of its answer.\n           *\n           * @example\n           * void $.prompt.submit({ text: \"List the TODOs you just mentioned.\" })\n           */\n          submit: EventCalls['prompt']['submit'];\n          /**\n           * Returns the prompt box as it stands, the draft typed so far and the\n           * cursor's offset into it, so a `fill` can keep what the person typed.\n           *\n           * Never rejects: `{ text: '', cursor: 0 }` where the session draws no box\n           * (a -p run, an SDK host) or none is mounted yet.\n           *\n           * @example\n           * const { text, cursor } = await $.prompt.read()\n           */\n          read: () => Promise<PromptBox>;\n          /**\n           * Returns one image or document of the prompt being submitted, by the\n           * `id` `e.attachments` lists it under: its bytes, base64, 4 MiB a call.\n           *\n           * For a `prompt.submit` hook; else `{ deny }`, as once the submission\n           * has settled. The engine's own read, no event: no hook answers for it.\n           * `{ unreadable }`: no image.\n           *\n           * @example\n           * const media = id ? await $.prompt.media({ id }) : undefined\n           */\n          media: (args: PromptMediaArgs) => Promise<PromptMedia>;\n          /**\n           * Puts `input.text` in the prompt box as the draft, by `mode`: `replace`\n           * (the default) over it, `append` after it, `insert` at the cursor.\n           *\n           * The event `prompt.fill` through the other plugins' hooks; `isFilled:\n           * false` under a dialog or headless. To hand the model text WITH the next\n           * prompt instead, a `prompt.submit` hook adds `context` (second example).\n           *\n           * @example\n           * await $.prompt.fill({ text: `> ${quote}\\n`, mode: \"insert\" })\n           * @example\n           * ($, e, next) => next({ ...e, context: [...(e.context ?? []), hunk] })\n           */\n          fill: (input: PromptFillArgs) => Promise<PromptFilled>;\n          /**\n           * Sets this plugin's own decorations over the draft and nothing else.\n           *\n           * No text, caret or undo entry, no `prompt.change` or `prompt.edit`. Hooks\n           * may rewrite or `{ deny }` it. `isPainted: false`, the box handed back,\n           * when the draft no longer reads `text`, or another plugin hooks its read.\n           *\n           * @example\n           * await $.prompt.paint({ text, decorations: [{ start, end, bold: true }] })\n           */\n          paint: (input: PromptPaintArgs) => Promise<PromptPainted>;\n          /**\n           * Proposes `input.text` as the prompt box's dim suggestion, Tab to take:\n           * the event `prompt.suggest`, as the engine's own guess after a turn.\n           *\n           * It goes through every other plugin's hook with `e.origin` `{ kind:\n           * 'plugin', name }`, the engine's own suggestions on or off; `{ isShown:\n           * false }` while the box holds text, a turn runs, or headless (no box).\n           *\n           * @example\n           * void $.prompt.suggest({ text: \"run the tests you just wrote\" })\n           */\n          suggest: EventCalls['prompt']['suggest'];\n          /**\n           * Returns the system prompt's sections for `facts`: the event\n           * `prompt.compose`, the call the engine makes for every prompt it sends.\n           *\n           * A fact left out is the session's own (its model, its tools). Through\n           * every other plugin's hook, over the engine's own composition; composed\n           * for nobody to send, so nothing the session holds is written.\n           *\n           * @example\n           * const ids = (await $.prompt.compose()).sections.map(s => s.id)\n           */\n          compose: EventCalls['prompt']['compose'];\n      };\n      /**\n       * The tools the model has in this session, and running one.\n       */\n      tool: {\n          /**\n           * Returns the tools the model can call now, built-in and MCP alike, in\n           * the order the model sees them.\n           *\n           * @example\n           * const names = (await $.tool.list()).map(t => t.name)\n           */\n          list: () => Promise<ToolInfo[]>;\n          /**\n           * Calls a tool: the event `tool.call`, the same call the engine makes for\n           * the model's tool calls, under a `tool_use_id` of its own.\n           *\n           * It runs through every hook but the calling one (the plugin's others\n           * see it), the permission check and its dialog, then the tool. Rejects\n           * when no tool has that name or the call is aborted.\n           *\n           * @example\n           * const { text } = await $.tool.call({ tool: \"Read\", file_path: \"a.md\" })\n           */\n          call: EventCalls['tool']['call'];\n          /**\n           * Asks the engine's permission decision for a tool call now: the event\n           * `tool.check`, resolved to its verdict (`{ decision, reason?, ... }`).\n           *\n           * The hooks run (the calling hook's own frame skipped, `next.origin` this\n           * plugin, no `tool_use_id`); nothing runs, no dialog opens, no PreToolUse\n           * hook or classifier is asked.\n           *\n           * @example\n           * const { decision } = await $.tool.check({ tool: \"Read\", input })\n           */\n          check: EventCalls['tool']['check'];\n          /**\n           * Declares a tool the model can call from the next prompt on: the name,\n           * description and input schema of `mcp__<plugin>__<name>`.\n           *\n           * Serve it with a `tool.call` hook on `{ tool: \"mcp__<plugin>__<name>\" }`\n           * that returns the result (a call no hook answers fails); a name registered\n           * again is replaced. Rejects until the session binds, at `session.start`.\n           *\n           * @param tool `name`, `description` (what the model reads), `inputSchema`\n           *             (default `{ type: \"object\" }`), `isDeferred` (ToolSpec)\n           * @returns `{ tool }`, the registered tool's full name\n           *          `mcp__<plugin>__<name>`\n           * @example\n           * await $.tool.register({ name: \"weather\", description: \"Weather.\" })\n           */\n          register: (tool: ToolSpec) => Promise<OpValueOf['tool.register']>;\n      };\n      /**\n       * The slash commands the person can run in this session, and running one.\n       */\n      command: {\n          /**\n           * Returns the slash commands the person can run now, built-in, plugin\n           * and MCP alike, in the order the typeahead lists them.\n           *\n           * @example\n           * const names = (await $.command.list()).map(c => c.name)\n           */\n          list: () => Promise<CommandInfo[]>;\n          /**\n           * Runs a slash command as if the person typed `/command args`: the\n           * event `command.run`, queued and run once the session is idle.\n           *\n           * It runs through every hook but the calling one with `e.origin` `{ kind:\n           * 'plugin', name }`, its lines in the transcript. Rejects an unknown name,\n           * inside a hook the turn or the session's start waits on, past a Stop or\n           * a host's limit.\n           *\n           * @example\n           * const { text } = await $.command.run({ command: \"status\" })\n           */\n          run: EventCalls['command']['run'];\n          /**\n           * Declares the slash command `/<name>` for this session, listed in the\n           * typeahead from the next keystroke on.\n           *\n           * Serve it with a `command.run` hook on `{ command: \"<name>\" }` that\n           * returns `{ text }`; a run no hook answers says so as its output.\n           * Registering a name again replaces it; a built-in's name is refused.\n           *\n           * @param command `name`, `description` (what the menu shows),\n           *   `argumentHint` (dim after the name), `immediate` (runs mid-turn)\n           * @returns `{ command }`, the registered name\n           * @example\n           * await $.command.register({ name: \"hello\", description: \"Says hi.\" })\n           */\n          register: (command: CommandSpec) => Promise<OpValueOf['command.register']>;\n      };\n      /**\n       * Every row of the settings menu (`/config`), the panel's own and each\n       * enabled plugin's `userConfig` fields alike: listing and changing them.\n       */\n      config: {\n          /**\n           * Returns the rows the `/config` menu would draw now, in its order,\n           * each with its current value, its kind, its owner and its lock.\n           *\n           * After every `config.describe` hook: a hidden row is left out, a\n           * relabelled one carries the new label.\n           *\n           * @example\n           * const theme = (await $.config.list()).find(row => row.key === \"theme\")\n           */\n          list: () => Promise<ConfigRow[]>;\n          /**\n           * Changes one row as if the person did in the menu: the event\n           * `config.set` with `origin` `{ kind: 'plugin', name }`, then the writer.\n           *\n           * Through the other plugins' hooks, this plugin's own skipped; `{ deny }`\n           * when a hook refused, the value does not fit, a trusted source owns the\n           * row or only its dialog changes it. Rejects a key no row has.\n           *\n           * @param args `key` (as `list` names it) and `value` (the row's kind)\n           * @returns `{ value }` once written, or `{ deny }`\n           * @example\n           * const { deny } = await $.config.set({ key: \"verbose\", value: true })\n           */\n          set: EventCalls['config']['set'];\n      };\n      /**\n       * Analytics: first-party rows and feature marks for Anthropic, and records\n       * for the telemetry collector the session's operator configured.\n       */\n      telemetry: {\n          /**\n           * Logs one record to the destination `entry.to` names, the event\n           * `telemetry.log`; `e.to` is pinned, and `anthropic` when left out.\n           *\n           * A first-party row is queued by the built-in plugin that hooks the\n           * event, for built-ins and the engine alone. A collector record reaches\n           * the collector only when the engine raised it; any plugin may hook.\n           *\n           * @param entry a first-party row, or a collector record\n           * @returns once the hooks have answered; rejects when one denies\n           * @example\n           * await $.telemetry.log({\n           *   to: \"anthropic\",\n           *   event: \"survey_answered\",\n           *   props: { answer: 2, page: { value: \"ready\", of: [\"ready\", \"later\"] } },\n           * })\n           */\n          log: (entry: TelemetryLogArgs) => Promise<void>;\n          /**\n           * Marks one use of a feature as the CLI's own feature events do, the\n           * event `telemetry.mark`; it takes no `to` and always means `anthropic`.\n           *\n           * The engine does nothing with it: the built-in plugins that hook the\n           * event queue the row. They serve built-ins and the engine alone; any\n           * plugin may hook it.\n           *\n           * @param entry the feature, how its use went, why, and its properties\n           * @returns once the hooks have answered; rejects when one denies\n           * @example\n           * await $.telemetry.mark({ feature: \"learn_page\", kind: \"sad\",\n           *   reason: \"blocked\" })\n           */\n          mark: (entry: TelemetryMarkInput) => Promise<void>;\n      };\n      /**\n       * Subagents.\n       */\n      agent: {\n          /**\n           * Spawns a subagent: the event `agent.spawn`, the same call the engine\n           * makes when the Agent tool starts one; the engine fills the rest.\n           *\n           * It runs every hook but the calling one, then the Agent tool in the\n           * background under this call's origin: `{ model, agentId }` once the\n           * subagent started (its answer is its `turn.complete`), or `{ deny }`.\n           *\n           * `{ deny }` is a hook's refusal, or the engine's own with its reason:\n           * past a Stop or a host's limit nothing is spawned, as for a prompt.\n           *\n           * @example\n           * const { agentId } = await $.agent.spawn({ prompt: \"Read README.md.\" })\n           */\n          spawn: EventCalls['agent']['spawn'];\n          /**\n           * Returns the session's agents so far, subagents and teammates: the ones\n           * the model spawned and the ones plugins did alike.\n           *\n           * One entry an agent, until the engine drops its task: as a teammate ends\n           * or seconds after, a subagent's later. Loops the engine tracks as agents\n           * with no `agent.spawn` (a forked skill) are here; a workflow's are not.\n           */\n          list: () => Promise<AgentInfo[]>;\n          /**\n           * Defines an agent type the Agent tool dispatches from the next turn on,\n           * named `<plugin>:<name>`: the event `agent.register`.\n           *\n           * Every field takes effect as in an agent file; re-registered, a name is\n           * replaced; unloaded, a plugin's types go. `agent.offer` hides it from\n           * the model alone; any plugin's `$.agent.spawn` answers to `agent.spawn`.\n           *\n           * @param spec `name`, `description` (when to delegate), `prompt` (its\n           *             system prompt), and any other field of an agent definition\n           * @returns `{ agent }`, the full name; rejects until the session binds,\n           *          on a spec the schema refuses (its reason), on a hook's deny\n           * @example\n           * await $.agent.register({ name: \"runner\", description: \"Runs a spec\",\n           *   prompt: RUNNER_PROMPT, tools: [\"Read\", \"Bash\"], omitClaudeMd: true })\n           * @example\n           * // runner-only: hidden from the model, spawned by this plugin's tool,\n           * // answered by the subagent's turn.complete (matched by agentId)\n           * on(\"agent.offer\", { agent: \"lab:runner\" }, () => ({ isOffered: false }))\n           * on(\"tool.call\", { tool: \"mcp__lab__run\" }, async ($, e) => {\n           *   const { agentId, deny } = await $.agent.spawn({\n           *     subagentType: \"lab:runner\", prompt: e.spec, description: \"run\" })\n           *   return { result: deny ?? (await answerOf(agentId)) }\n           * })\n           */\n          register: (spec: AgentSpec) => Promise<OpValueOf['agent.register']>;\n      };\n      /**\n       * The file system as the engine's own process reaches it; a relative path\n       * is under the session's working directory, and text is UTF-8.\n       *\n       * An absolute path is used as given; where one may go is an `fs.*` hook's\n       * to say. A read or write over 4 MiB rejects, the implementation beneath the\n       * hooks rejects a network location untouched, an OS refusal with its errno.\n       */\n      fs: {\n          /**\n           * Reads a file and returns its text, or with `{ as: \"bytes\" }` its bytes\n           * as `{ base64 }`.\n           *\n           * Rejects when missing, or over 4 MiB, which bounds what one read copies\n           * into the plugin's environment. A file the plugin ships is under\n           * `$.plugin.root`.\n           *\n           * @param path relative to the working directory, or absolute\n           * @param options `as`: `\"text\"` (the default) or `\"bytes\"`\n           * @returns the file's text, or `{ base64 }`\n           * @example\n           * const readme = await $.fs.read(\"README.md\")\n           * @example\n           * const { base64 } = await $.fs.read(\n           *   `${$.plugin.root}/hooks/weights.bin`, { as: \"bytes\" })\n           * const weights = Uint8Array.fromBase64(base64)\n           */\n          read: FsReadCall;\n          /**\n           * Writes `text` to a file, creating it and its directories as needed.\n           *\n           * @param path relative to the working directory, or absolute\n           * @param text the whole new content\n           */\n          write: (path: string, text: string) => Promise<void>;\n          /**\n           * Lists a directory by name: `{ name, kind, size, mtimeMs, isLink }` per\n           * entry, each entry as it stands.\n           *\n           * A symbolic link is `other` with `isLink`; `size` and `mtimeMs` are a\n           * regular file's own and 0 for every other kind (`$.fs.stat` has those).\n           *\n           * @param path the directory's path; absent, the working directory\n           * @returns the entries, `{ name, kind, size, mtimeMs, isLink }` each\n           * @example\n           * const logs = await $.fs.list(\"logs\")\n           * const newest = [...logs].sort((a, b) => b.mtimeMs - a.mtimeMs)[0]\n           */\n          list: (path?: string) => Promise<FsEntry[]>;\n          /**\n           * Returns whether the path exists; rejects only a network location, which\n           * the implementation beneath the hooks never touches.\n           */\n          exists: (path: string) => Promise<boolean>;\n          /**\n           * Returns `{ kind, size, mtimeMs, isLink }` of the path: what it leads to,\n           * and whether it is itself a symbolic link. Rejects when missing.\n           *\n           * With `{ resolve: true }` also `realPath`, where the path lands, absent\n           * when it leads nowhere; a guard matches it and denies without it, since a\n           * spelling it cannot resolve (`~`, a file not there yet) the tool may open.\n           *\n           * @param path relative to the working directory, or absolute\n           * @param options `resolve`: also answer `realPath` (one more file system\n           *                call)\n           * @returns the stat, `realPath` with it when asked and resolvable; rejects\n           *          `ENOENT` for a missing path\n           * @example\n           * // ROOT was resolved the same way and SEP is its separator; an\n           * // allow-list under it is the robust guard, a deny-list on spellings\n           * // only best effort (a hard link or a case alias keeps its own)\n           * on(\"tool.call\", { tool: \"Read\" }, async ($, e, next) => {\n           *   const stat = await $.fs.stat(e.file_path, { resolve: true })\n           *     .catch(() => undefined)\n           *   const real = stat?.realPath\n           *   const isInside = real !== undefined && real.startsWith(ROOT + SEP)\n           *   return isInside ? next(e) : { deny: \"outside the project\" }\n           * })\n           * @example\n           * // a Write may name a file not there yet: `placed` answers where the\n           * // path lands or undefined, and the guard denies on undefined or\n           * // outside ROOT. Unplaceable by spelling first, with no file system\n           * // call (drive-relative `D:x`, a `\\\\` or `//` network or device path,\n           * // a name that is empty, \".\", \"..\" or itself `C:...`); then the file\n           * // if it stats; else its folder, cut after the last separator and\n           * // keeping it so a drive or share root stays that root, plus the name\n           * const placed = async (path) => {\n           *   const cut = Math.max(path.lastIndexOf(\"/\"), path.lastIndexOf(\"\\\\\"))\n           *   const name = path.slice(cut + 1)\n           *   const isPlaceable = !/^[A-Za-z]:(?![\\\\/])/.test(path) &&\n           *     !/^[\\\\/][\\\\/]/.test(path) && !/^[A-Za-z]:/.test(name) &&\n           *     name !== \"\" && name !== \".\" && name !== \"..\"\n           *   if (!isPlaceable) return undefined\n           *   const own = await $.fs.stat(path, { resolve: true })\n           *     .catch(() => undefined)\n           *   if (own) return own.realPath\n           *   const folder = cut < 0 ? \".\" : path.slice(0, cut + 1)\n           *   const dir = await $.fs.stat(folder, { resolve: true })\n           *     .catch(() => undefined)\n           *   return dir?.realPath === undefined ? undefined\n           *     : `${dir.realPath.replace(/[\\\\/]$/, \"\")}${SEP}${name}`\n           * }\n           * const real = await placed(e.file_path)\n           * const isInside = real !== undefined && real.startsWith(ROOT + SEP)\n           * return isInside ? next(e) : { deny: \"cannot place it, or outside\" }\n           */\n          stat: (path: string, options?: FsStatOptions) => Promise<FsStat>;\n          /**\n           * Reads the named instruction files in every directory above the\n           * session's original working directory, the way the engine reads CLAUDE.md.\n           *\n           * Root first, each `{ dir, name, content }` that exists, the content\n           * with its `@include`s after it; `of` and `below` together are the\n           * engine's own walk for a nested CLAUDE.md between root and read file.\n           *\n           * @param request `names`, relative `.md` file names (no `..`); `of`, the\n           * file walked down to; `below`, the directory the walk stays inside\n           * @returns the files found, root first\n           * @example\n           * const found = await $.fs.ancestors({ names: [\"AGENTS.md\"] })\n           * const stack = await $.fs.ancestors({ names: [\"AGENTS.md\"], of: path })\n           * const nested = await $.fs.ancestors({\n           *   names: [\"AGENTS.md\"],\n           *   of: e.file_path,\n           *   below: await $.session.root(),\n           * })\n           */\n          ancestors: (request: FsAncestorsRequest) => Promise<readonly FsAncestor[]>;\n      };\n      /**\n       * This plugin's own key-value store, kept between sessions and hot\n       * reloads; values are JSON data.\n       *\n       * A JSON file of the plugin's own under the user's Claude Code\n       * configuration directory.\n       */\n      store: {\n          /**\n           * Returns the value under `key`, or `undefined` when unset.\n           *\n           * @example\n           * const count = Number((await $.store.get(\"count\")) ?? 0) + 1\n           */\n          get: (key: string) => Promise<unknown>;\n          /**\n           * Sets `key` to `value`, which must be JSON data.\n           *\n           * `get` reads back `JSON.parse(JSON.stringify(value))`: a Date is its ISO\n           * string, an `undefined` field is dropped, a Map or Set is `{}`. Rejects\n           * a function, a cycle, or a store over 4 MiB of JSON text in all.\n           */\n          set: (key: string, value: unknown) => Promise<void>;\n          /**\n           * Removes `key` from the store.\n           */\n          delete: (key: string) => Promise<void>;\n          /**\n           * Returns every key set, in insertion order.\n           */\n          keys: () => Promise<string[]>;\n      };\n      /**\n       * Named values held by the host for the session, each with a version: plain\n       * data that survives a hot reload of the plugin's code.\n       *\n       * A `get` made while a `ui.render` hook draws subscribes that instance: a\n       * later `set` draws it again, nobody calling `$.ui.invalidate`. Any plugin\n       * reads any value; its owner alone writes it. Persist through `$.store`.\n       */\n      state: {\n          /**\n           * Resolves the value under `ref` and the version it stands at; a value\n           * never written is `undefined` at version 0.\n           *\n           * Every `get` of one dispatch reads one moment, whatever is written\n           * meanwhile. `plugin` and `key` must be literals in source (`claude plugin\n           * validate` lists them); only a family member's `id` may be computed.\n           *\n           * @param ref `{ plugin, key }` as the owner's contract declares it in\n           *   PluginState, with `id` for a StateFamily key\n           * @returns `{ value, version }`\n           * @example\n           * const workers = { plugin: \"swarm\", key: \"workers\" } as const\n           * const { value = [] } = await $.state.get(workers)\n           */\n          get: <P extends keyof PluginState & string, K extends keyof PluginState[P] & string>(ref: StateRef<P, K>) => Promise<StateRead<StateValue<P, K>>>;\n          /**\n           * Writes `value` under `ref`, which must be this plugin's own; the sites\n           * that read it while drawing are drawn again, at the redraw rate.\n           *\n           * Refused while a `ui.render` hook draws (write from `onPress` or another\n           * event) and for another plugin's value (hook its `state.set` and rewrite\n           * `e.value`). JSON data, as `$.store.set` takes; never `undefined`.\n           *\n           * @param ref `{ plugin, key }`, with `id` for a StateFamily key\n           * @param value the value, of the type the contract declares\n           * @param options `ifVersion`: write only while it stands at that version\n           * @returns `{ isSet, version }`; `isSet` false when `ifVersion` missed\n           * @example\n           * await $.state.set(count, held.value + 1, { ifVersion: held.version })\n           */\n          set: <P extends keyof PluginState & string, K extends keyof PluginState[P] & string>(ref: StateRef<P, K>, value: StateValue<P, K>, options?: StateSetOptions) => Promise<StateSetResult>;\n      };\n      /**\n       * The time and timers, each an event through the host: `clock.now` reads\n       * the time; `clock.sleep`, `after` and `every` wait until it has passed.\n       *\n       * A timer's callback is the plugin's own function, kept in its environment\n       * and run there when the wait resolves; a hot reload of the plugin cancels\n       * its pending waits with the old environment.\n       */\n      clock: {\n          /**\n           * Resolves milliseconds since the epoch, now.\n           *\n           * @example\n           * const startedAt = await $.clock.now()\n           */\n          now: () => Promise<number>;\n          /**\n           * Resolves after `ms` milliseconds; rejects at once when `signal` aborts.\n           *\n           * The wait is the hook's own time and its budget runs on through it, as\n           * through no other `$` call: a `turn.step` generator that polls with it\n           * pays every sleep out of its one budget (`next.budget.remainingMs`).\n           *\n           * @param ms how long, in milliseconds\n           * @param options `signal`: ends the wait early with a rejection (pass\n           *   `next.signal` so a hook's wait ends with its dispatch)\n           * @example\n           * await $.clock.sleep(500, { signal: next.signal })\n           */\n          sleep: (ms: number, options?: SleepOptions) => Promise<void>;\n          /**\n           * Calls `fn` once after `ms` milliseconds; `cancel()` before then stops it.\n           *\n           * One `clock.after` dispatch: `fn` runs when it resolves, and never when\n           * a hook refuses it.\n           */\n          after: TimerCall;\n          /**\n           * Calls `fn` every `ms` milliseconds (at least 1) until `cancel()`.\n           *\n           * One `clock.every` dispatch per period: `fn` runs when it resolves and\n           * the next period is asked; a refused period ends the interval.\n           *\n           * @example\n           * const tick = $.clock.every(1000, () => $.ui.status(\"polling\"))\n           */\n          every: TimerCall;\n      };\n      /**\n       * The network, through the host.\n       */\n      http: {\n          /**\n           * Fetches `url` through the host (never the plugin's own network) and\n           * resolves `{ status, ok, headers, text }` once the body is read.\n           *\n           * http or https, to whatever the host reaches, unless the organization's\n           * web-fetch policy refuses it. `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`\n           * refuses a built-in's request, and any plugin's that carries `auth`.\n           *\n           * @param url the URL (http or https)\n           * @param init `{ method, headers, body, auth, socketPath }` (body a\n           *             string; socketPath a Unix socket to go over instead of TCP)\n           * @returns `{ status, ok, headers, text }` once the body is read\n           * @example\n           * const { ok, text } = await $.http.fetch(\"https://example.com/status\")\n           * @example\n           * await $.http.fetch(\"http://bridge/reload\", {\n           *   method: \"POST\",\n           *   socketPath: `${runDirectory}/bridge.sock`,\n           * })\n           */\n          fetch: (url: string, init?: HttpInit) => Promise<HttpResponse>;\n      };\n      /**\n       * Commands on the host, run as the user the session runs as. CLI only.\n       *\n       * Local execution, not a network path: what a command of its own reaches\n       * is its own, as for the Bash tool and a settings `command` hook.\n       */\n      process: {\n          /**\n           * Runs a command on the host by its argument vector (no shell) and\n           * resolves `{ exitCode, stdout, stderr }` once it exits, any exit code.\n           *\n           * One shot: the whole output is read, so a background process left\n           * writing holds the call until the timeout. Rejects when the command\n           * cannot start or is still running then. Git runs with repo hooks off.\n           *\n           * @param argv the command and its arguments, `argv[0]` the executable\n           * @param init `{ cwd, env, stdin, timeoutMs }` (cwd the session's by\n           *             default; timeout 30 s by default, ten minutes at most)\n           * @returns `{ exitCode, stdout, stderr }`, each stream's first 4194304\n           *          bytes (`isStdoutTruncated`, `isStderrTruncated` say when cut)\n           * @example\n           * const { exitCode, stdout } = await $.process.run([\"git\", \"status\"])\n           */\n          run: (argv: readonly string[], init?: ProcessRunInit) => Promise<ProcessRunResult>;\n          /**\n           * Starts a command on the host by its argument vector (no shell) and\n           * streams what it writes, piece by piece, then how it ended.\n           *\n           * The loop is the child's life: leaving it, `return()` on the stream,\n           * `next.signal` aborting or the module unloading kills the child, and\n           * nothing else does, a hook's return included: end the loop to end it.\n           *\n           * @param request `{ argv, cwd, env, input }`, `$.process.run`'s rules;\n           *   `e` for a hook on `process.spawn` (a generator, its budget per piece)\n           * @returns the pieces `{ stream, text }` (text as it came, not lines),\n           *   then `{ code, signal }`; rejects its first pull if it cannot start\n           * @example\n           * // inline: the hook's dispatch waits on the loop; leaving it kills make\n           * const make = $.process.spawn({ argv: [\"make\"], cwd: \"build\" })\n           * for await (const { stream, text } of make) {\n           *   if (stream === \"stderr\" && text.includes(\"error\")) break\n           * }\n           * @example\n           * // a child for the session's life: the loop runs on after the hook\n           * // returns, and ends with the child or with the module\n           * on(\"session.start\", async ($, e, next) => {\n           *   const started = await next(e)\n           *   void (async () => {\n           *     const bridge = $.process.spawn({ argv: [\"bridge\", \"watch\", e.cwd] })\n           *     for await (const { text } of bridge) $.ui.log(text, { to: \"debug\" })\n           *   })()\n           *   return started\n           * })\n           * @example\n           * // above another plugin's spawn: redact each piece before it reads it\n           * on(\"process.spawn\", async function* ($, e, next) {\n           *   for await (const chunk of next(e)) {\n           *     yield { ...chunk, text: chunk.text.replaceAll(token, \"***\") }\n           *   }\n           * })\n           */\n          spawn: (request: ProcessSpawnRequest) => HookStream<ProcessSpawnChunk, ProcessSpawnResult>;\n      };\n      /**\n       * What the settings files, `--settings` and managed policy hold, as the\n       * engine runs under it; read only.\n       *\n       * Every key crosses as the source holds it, `env` and the helper commands\n       * included: nothing is filtered. The OAuth session and the global config\n       * (~/.claude.json) are not settings and are never read.\n       */\n      settings: {\n          /**\n           * Resolves with the settings merged over every source, with one\n           * source's settings as loaded (`{ source }`), or with the value of one\n           * top-level key (`{ key }`), undefined when the settings hold none.\n           *\n           * A snapshot in plain data each call; a source with no file answers\n           * `{}`. Every read raises `settings.read` once, its layers on `e`\n           * (SettingsReadInput); a read of one key is the read of the object,\n           * projected, and raises no event of its own.\n           *\n           * The sources (SettingsSource) rise in precedence from `user` to\n           * `policy`; with no hook the object is the engine's merge: a scalar\n           * from the last source that has it, lists joined, objects merged.\n           *\n           * Raised by a plugin's call, and by the engine for its own merge once\n           * the loaded plugins or the settings have changed, `next.origin` then\n           * the engine. What the hooks answer there is what every reader of the\n           * merged settings reads, and a changed answer takes effect as a changed\n           * settings file does.\n           *\n           * No key is closed to a hook, the keys that decide which plugins load\n           * included: those are read before any plugin is loaded, so the first set\n           * loads by the files' own values and an answer applies from the load\n           * after. A merge that never settles, an answer changing which plugins\n           * load and those answering otherwise, is told in the settings error\n           * list, and the files' own value stands for that key.\n           *\n           * @param args `{ source }` for one source, `{ key }` for one key's\n           *             value, nothing for the merge\n           * @returns the settings object, keyed as a settings.json is, or the\n           *          key's value\n           * @example\n           * const { permissions } = await $.settings.read()\n           * const policy = await $.settings.read({ source: \"policy\" })\n           * const days = await $.settings.read({ key: \"cleanupPeriodDays\" })\n           */\n          read: SettingsReadOverloads;\n      };\n      /**\n       * The environment of this process, the one every Bash child, MCP server\n       * and `$.process.run` command started after inherits.\n       *\n       * `get` and `set` take the variable's name as a string literal, so what a\n       * module reads and writes is read off its source: `claude plugin validate`\n       * lists the names, and a name the module does not spell is refused.\n       */\n      env: {\n          /**\n           * Resolves with the variable's value, or `undefined` when it is unset.\n           *\n           * `name` must be a string literal; `claude plugin validate` lists the\n           * names your module reads and writes.\n           *\n           * @example\n           * const home = await $.env.get(\"HOME\")\n           */\n          get: (name: string) => Promise<string | undefined>;\n          /**\n           * Sets the variable for this process and everything it starts after, or\n           * unsets it when `value` is `undefined`.\n           *\n           * `name` must be a string literal; `claude plugin validate` lists the\n           * names your module reads and writes.\n           *\n           * @returns `{}` once it is set or unset, or `{ deny }` saying why not\n           * @example\n           * await $.env.set(\"GIT_PAGER\", \"cat\")\n           */\n          set: (name: string, value: string | undefined) => Promise<EnvSetResult>;\n      };\n  }"},{"name":"CoreEventName","kind":"type","line":3808,"doc":{"desc":["The name of an event the engine defines itself (a key of CoreEventOf);","EventName adds the declared plugin nouns' events."],"params":[],"example":[],"returns":[]},"text":"  type CoreEventName = keyof CoreEventOf;"},{"name":"CoreEventOf","kind":"type","line":3814,"doc":{"desc":["The argument of each event the engine defines itself: its call sites'","(EngineEventOf), the classic hooks' (ClassicEventOf), the calls on `$`."],"params":[],"example":[],"returns":[]},"text":"  type CoreEventOf = EngineEventOf & ClassicEventOf & OpEventOf;"},{"name":"CwdChangedHookInput","kind":"type","line":3816,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"  type CwdChangedHookInput = BaseHookInput & {\n      hook_event_name: 'CwdChanged';\n      old_cwd: string;\n      new_cwd: string;\n  };"},{"name":"DeclaredAttachmentInput","kind":"type","line":3829,"doc":{"desc":["One `prompt.attachment` input of a type PromptAttachmentDetailOf names:","the attachment's text, and under `detail` the facts it was rendered from.","","A row the engine made holds them, unless its session keeps no plan file. That","one, or one edited by hand, carries no `detail` key: read it as it may be."],"params":[],"example":[],"returns":[]},"text":"  type DeclaredAttachmentInput<K extends keyof PromptAttachmentDetailOf> = {\n      /**\n       * As the engine names the attachment's kind, one of the names that\n       * carry a `detail`; the key a matcher narrows on. Pinned.\n       */\n      type: K;\n      /**\n       * What the model reads for this attachment, inside the engine's framing;\n       * rewritable with `next({ ...e, text })`.\n       *\n       * The `<system-reminder>` wrapper (or the system channel that replaces\n       * it) goes around what the chain answers, never inside it.\n       */\n      text: string;\n      /**\n       * Who authored the text (PromptAttachmentOrigin): the engine, a settings\n       * hook, or a plugin's chain context.\n       *\n       * Pinned: a different value is refused, one left out is kept.\n       */\n      origin: PromptAttachmentOrigin;\n      /**\n       * The loop whose request carries the attachment: a subagent's id, the\n       * `id` `$.agent.list()` gives it; absent on main.\n       *\n       * Pinned: a different value is refused, one left out is kept. A loop\n       * forked from another carries the rows made for that one.\n       */\n      agentId?: string;\n      /**\n       * Facts of the row the engine computed as it rendered `text`, by `type`:\n       * what a hook with words of its own reads in place of the engine's.\n       *\n       * Pinned: a different value is refused, one left out is kept. Not all\n       * the text says: a host's own plan instructions are in `text` alone.\n       * Absent on a row that does not hold its facts.\n       *\n       * @example\n       * if (e.detail === undefined) return next(e)\n       */\n      detail?: PromptAttachmentDetailOf[K];\n  };"},{"name":"DeclaredEvents","kind":"type","line":3876,"doc":{"desc":["The state events of each declared value in a union of `[plugin, key]`","pairs, one variant per pair (it distributes), so a matcher narrows `e`."],"params":[],"example":[],"returns":[]},"text":"  type DeclaredEvents<Pair> = Pair extends readonly [\n  infer P extends keyof PluginState & string,"},{"name":"DeclaredEventsOf","kind":"type","line":3885,"doc":{"desc":["`e` of `state.get` and of `state.set` for one declared value: its typed","reference, and for a write the change, of the declared type."],"params":[],"example":[],"returns":[]},"text":"  type DeclaredEventsOf<P extends keyof PluginState & string, K extends keyof PluginState[P] & string> = {\n      get: StateRef<P, K>;\n      set: StateRef<P, K> & DeclaredStateChange<P, K>;\n  };"},{"name":"DeclaredPair","kind":"type","line":3894,"doc":{"desc":["Every named value the enabled contracts declare, as one union of","`[plugin, key]` pairs; `never` while PluginState is empty."],"params":[],"example":[],"returns":[]},"text":"  type DeclaredPair = {\n      [P in keyof PluginState & string]: {\n          [K in keyof PluginState[P] & string]: readonly [plugin: P, key: K];\n      }[keyof PluginState[P] & string];\n  }[keyof PluginState & string];"},{"name":"DeclaredStateChange","kind":"type","line":3904,"doc":{"desc":["What a `state.set` on one declared value carries beside its reference:","the value being written and the one that stood there, of the declared type."],"params":[],"example":[],"returns":[]},"text":"  type DeclaredStateChange<P extends keyof PluginState & string, K extends keyof PluginState[P] & string> = {\n      value: StateValue<P, K>;\n      previous: StateValue<P, K> | undefined;\n      /**\n       * The version the caller's write is conditional on, when it gave one.\n       */\n      ifVersion?: number;\n  };"},{"name":"Derived","kind":"type","line":3920,"doc":{"desc":["A value computed from other values, as `derive(sources, fn)` makes it:","`read` runs `fn` again only when a source's version moved.","","It holds nothing on the host: the cache is the plugin's own, lost with a","reload of its code, and rebuilt by the next read."],"params":[],"example":[],"returns":[]},"text":"  export type Derived<T> = {\n      /**\n       * The atoms and references it is computed from, read in this order.\n       */\n      readonly sources: readonly (Atom<unknown> | StateAddress)[];\n      /**\n       * The function over the sources' values, in the order they were given.\n       */\n      readonly compute: (...values: never[]) => T;\n  };"},{"name":"DeriveFunction","kind":"type","line":3941,"doc":{"desc":["`derive(sources, fn)`: a value computed from atoms and references, cached","by their versions: `read` runs `fn` again only when one moved.","","Pure: it builds a description and calls nothing; reading it while drawing","subscribes the drawing to every source."],"params":[],"example":["const busy = derive([workers], list => list.filter(w => w.isBusy).length)"],"returns":[]},"text":"  export type DeriveFunction = <const S extends readonly unknown[], T>(sources: S, compute: (...values: SourceValues<S>) => T) => Derived<T>;"},{"name":"DirectoryAddedHookInput","kind":"type","line":3943,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"  type DirectoryAddedHookInput = BaseHookInput & {\n      hook_event_name: 'DirectoryAdded';\n      /**\n       * Absolute path of the directory that was added.\n       */\n      directory: string;\n      /**\n       * How the directory was added: \"slash_command\" for /add-dir, \"register_repo_root\" for the SDK control_request.\n       */\n      source: 'slash_command' | 'register_repo_root';\n  };"},{"name":"ElementChildren","kind":"type","line":3963,"doc":{"desc":["The `children` field every element constructor's props carry, appended","beside its own props type: one child, or a list that may nest.","","JSX types a lone child as the child itself (`<Text dimColor>done</Text>`","passes the string, `<Text>{count}</Text>` the number), and a mapped list","beside a sibling as a nested list (`<Box>{rows.map(row)}<Text>ok</Text>`)."],"params":[],"example":[],"returns":[]},"text":"  export type ElementChildren = {\n      children?: RenderChildren;\n  };"},{"name":"ElementConstructor","kind":"type","line":3975,"doc":{"desc":["An element as `$.ui.resolve(e)` hands it out: a constructor from props to","the frozen plain-data element, `children` among the props as JSX passes.","","`const { Box } = $.ui.resolve(e)` then `<Box gap={1}>...</Box>` compiles to","`h(Box, { gap: 1 }, ...children)`, and `h` calls a function tag with its","props, so the table's constructors are the JSX tags."],"params":[],"example":[],"returns":[]},"text":"  export type ElementConstructor<P> = (props: P & ElementChildren) => RenderElement;"},{"name":"ElementName","kind":"type","line":3981,"doc":{"desc":["Every element name of every surface: what a table handed out is completed to","(an omitted one draws a fragment; see `ui.resolve`)."],"params":[],"example":[],"returns":[]},"text":"  export type ElementName = {\n      [P in RenderSurface]: keyof Elements[P];\n  }[RenderSurface];"},{"name":"Elements","kind":"interface","line":3998,"doc":{"desc":["Each surface's primitive tags and their prop types, by `e.surface`, for","the surfaces the plugin was compiled against.","","A surface declares its own three (jsx, elements, components): an interface,","so one not listed here adds its table by declaration merging. With the","surface fixed, that table exactly; with none fixed, only what all share."],"params":[],"example":["declare module \"claude-code\" { interface Elements { slack: SlackTable } }"],"returns":[]},"text":"  export interface Elements {\n      /**\n       * Ink's: beside `Box`, `Text`, `Button`, `Link`, `Code` and `Markdown`,\n       * which every surface here carries, `Input`, `Select` and `Client`.\n       *\n       * The one surface with `Raster` and `Image`, and the one without `Svg`.\n       */\n      terminal: {\n          Box: ElementConstructor<BoxProps>;\n          Text: ElementConstructor<TextProps>;\n          Button: ElementConstructor<ButtonProps>;\n          Input: ElementConstructor<InputProps>;\n          Select: ElementConstructor<SelectProps>;\n          Link: ElementConstructor<LinkProps>;\n          Code: ElementConstructor<CodeProps>;\n          Markdown: ElementConstructor<MarkdownProps>;\n          /**\n           * A region one of the plugin's surface modules draws (ClientModule), named\n           * by `module`: a string literal, the module's path relative to this file.\n           *\n           * The engine reads the surface module off the hooks module's source\n           * before anything runs, so a variable, a template with a substitution or\n           * a computed path as `module` is refused at load, naming the line.\n           */\n          Client: ElementConstructor<ClientProps>;\n          Raster: ElementConstructor<RasterProps>;\n          Image: ElementConstructor<ImageProps>;\n      };\n      /**\n       * Claude Code Desktop's: the six every surface here carries, `Input`,\n       * `Select`, `Svg` and `Client`.\n       */\n      desktop: {\n          Box: ElementConstructor<BoxProps>;\n          Text: ElementConstructor<TextProps>;\n          Button: ElementConstructor<ButtonProps>;\n          Input: ElementConstructor<InputProps>;\n          Select: ElementConstructor<SelectProps>;\n          Svg: ElementConstructor<SvgProps>;\n          Link: ElementConstructor<LinkProps>;\n          Code: ElementConstructor<CodeProps>;\n          Markdown: ElementConstructor<MarkdownProps>;\n          Client: ElementConstructor<ClientProps>;\n      };\n      /**\n       * An app is sent an `Input` or `Select` only if it named it in `draws` on\n       * its `ui_attach`, and an empty Box otherwise; a hook cannot tell which the\n       * app got.\n       *\n       * On a tool row (`ToolUse`) in mobile apps, a `borderStyle` or\n       * `backgroundColor` on the Box that holds the row and something else asks for\n       * a card under the row;\n       * otherwise a tree that keeps the row usually draws as one quiet line under\n       * it, with the rest behind a tap, so plain Text suits a small status.\n       */\n      mobile: {\n          Box: ElementConstructor<BoxProps>;\n          Text: ElementConstructor<TextProps>;\n          Button: ElementConstructor<ButtonProps>;\n          Input: ElementConstructor<InputProps>;\n          Select: ElementConstructor<SelectProps>;\n          Svg: ElementConstructor<SvgProps>;\n          Link: ElementConstructor<LinkProps>;\n          Code: ElementConstructor<CodeProps>;\n          Markdown: ElementConstructor<MarkdownProps>;\n      };\n      /**\n       * The desktop's table without `Client`: a remote `Client`'s module, presses\n       * and posts (ui_client_module, ui_client_press, ui_message) name no surface.\n       *\n       * They are the desktop's alone until those asks name a surface, no limit of\n       * the editor's webview.\n       */\n      vscode: {\n          Box: ElementConstructor<BoxProps>;\n          Text: ElementConstructor<TextProps>;\n          Button: ElementConstructor<ButtonProps>;\n          Input: ElementConstructor<InputProps>;\n          Select: ElementConstructor<SelectProps>;\n          Svg: ElementConstructor<SvgProps>;\n          Link: ElementConstructor<LinkProps>;\n          Code: ElementConstructor<CodeProps>;\n          Markdown: ElementConstructor<MarkdownProps>;\n      };\n  }"},{"name":"ElementTable","kind":"type","line":4087,"doc":{"desc":["The table `ui.resolve` answers for an argument of surface `P`."],"params":[],"example":[],"returns":[]},"text":"  export type ElementTable<P extends RenderSurface = RenderSurface> = Elements[P];"},{"name":"ElicitationHookInput","kind":"type","line":4092,"doc":{"desc":["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."],"params":[],"example":[],"returns":[]},"text":"  type ElicitationHookInput = BaseHookInput & {\n      hook_event_name: 'Elicitation';\n      mcp_server_name: string;\n      message: string;\n      mode?: 'form' | 'url';\n      url?: string;\n      elicitation_id?: string;\n      requested_schema?: Record<string, unknown>;\n  };"},{"name":"ElicitationResultHookInput","kind":"type","line":4105,"doc":{"desc":["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."],"params":[],"example":[],"returns":[]},"text":"  type ElicitationResultHookInput = BaseHookInput & {\n      hook_event_name: 'ElicitationResult';\n      mcp_server_name: string;\n      elicitation_id?: string;\n      mode?: 'form' | 'url';\n      action: 'accept' | 'decline' | 'cancel';\n      content?: Record<string, unknown>;\n  };"},{"name":"EngineCreateInput","kind":"type","line":4122,"doc":{"desc":["The input of `engine.create`: the fold that builds `$`, once per load,","core innermost.","","A hook is written in post-order: `const built = await next(e)` is `$` as","built so far; `return { ...built, voice: { say } }` adds this plugin's noun.","See EngineEventOf's `engine.create` for what a step may and may not do."],"params":[],"example":[],"returns":[]},"text":"  export type EngineCreateInput = {\n      /**\n       * The modules this fold builds, in list order, first outermost (managed\n       * plugins first, so an org plugin's withholding wins).\n       *\n       * The whole set at a load, this plugin alone at its reload, the ones added\n       * or changed at a refresh that keeps the rest: a module added later that\n       * does not hook this event is built against the table as it stands.\n       */\n      plugins: readonly string[];\n  };"},{"name":"EngineCreateResult","kind":"type","line":4141,"doc":{"desc":["What an `engine.create` hook returns: `$` as built so far with this","plugin's nouns added, less any it withheld.","","Every declared noun is optional here. Between hooks it crosses the chain","as interface descriptors; a hook sees objects (EngineInterfaceBuilt)."],"params":[],"example":[],"returns":[]},"text":"  export type EngineCreateResult = Partial<EngineInterface> & {\n      readonly [noun: string]: unknown;\n  };"},{"name":"EngineEventOf","kind":"type","line":4156,"doc":{"desc":["The events the engine raises at its call sites, and `engine.create`; the","classic settings hooks' events are ClassicEventOf.","","At every one, a hook that fails (throws, overruns its budget: HookBudget,","answers a wrong shape) is skipped: the hooks beneath and core run in its","place, or its last `next` result stands; the failure is reported by name."],"params":[],"example":[],"returns":[]},"text":"  export type EngineEventOf = {\n      /**\n       * Fires when the engine is about to run a tool. Each `next(e)` runs the\n       * hooks beneath, then core (the permission prompt, the tool itself).\n       *\n       * `{ deny: reason }` refuses and `{ result }` answers in place of `next`: a\n       * deny after `next(e)` resolved undoes nothing it ran; returning with `next`\n       * pending aborts what runs beneath. Managed-settings hooks' deny comes first.\n       *\n       * @remarks A guard that fails is skipped and the tool runs, so give it\n       *   `.catch(($, e, next) => next.called ? next(e) : { deny: \"no\" })`.\n       */\n      'tool.call': ToolCallInput;\n      /**\n       * Fires when the engine decides whether a tool call may run, after the\n       * `tool.call` and PreToolUse hooks and before the mode settles an ask.\n       *\n       * `next(e)` resolves to the engine's verdict (rules, mode, the tool's own\n       * check, PreToolUse's decision) and runs no tool: return any `{ decision }`,\n       * a deny after it too. `$.tool.check` runs the same chain, executing nothing.\n       *\n       * @remarks A guard that fails is skipped, leaving the verdict beneath.\n       *   Nothing has run, so give it `.catch(() => ({ decision: \"deny\" }))`.\n       * @example\n       * on(\"tool.check\", { tool: \"Read\" }, () => ({ decision: \"allow\" }))\n       */\n      'tool.check': ToolCheckInput;\n      /**\n       * Fires when the engine is about to draw a component: once per input value\n       * (props, viewport width), plugin load or `$.ui.invalidate(\"ui.render\")`.\n       *\n       * A repaint reuses the answer; a clock invalidates. `next(e)` resolves to the\n       * drawing: return it, wrap it, draw your own, or rewrite `props`. An invalid\n       * tree, or a throw while drawn, draws the engine's; `--plugin-dir` is told.\n       *\n       * @remarks Also on a write of `$.state` it read while drawn, at the redraw\n       *   rate; an invalidate is any plugin's whose matcher may select it.\n       */\n      'ui.render': RenderInput;\n      /**\n       * Fires when the plugins load (not per draw), once per surface, component\n       * and plugin: `e` names the surface and component, never the props.\n       *\n       * `next(e)` resolves to the surface's table, which `$.ui.resolve(e)` then\n       * reads. Return it, one with an element restyled for every other plugin,\n       * or one with a key left out (a fragment there); own table: hook skipped.\n       */\n      'ui.resolve': ResolveInput;\n      /**\n       * Fires when a `Button` a render hook drew is pressed on a surface; `e` is\n       * `{ plugin, element, component, surface }`, `element` the button's `key`.\n       *\n       * `next(e)` runs the hooks beneath, then core: the element's own `onPress`\n       * closure, in its plugin's environment, resolving to `{ element }`. Return\n       * `next(e)` to let the press through, or `{ element }` to take it.\n       */\n      'ui.press': UiPressArgument;\n      /**\n       * Fires when an `Input` a render hook drew changes or is submitted; `e` is\n       * `{ plugin, element, component, surface, kind, value }`.\n       *\n       * `next(e)` runs the hooks beneath, then the element's own `onInput` or\n       * `onSubmit` with `e.value` as the chain left it, resolving to `{ element,\n       * value }`; `next({ ...e, value })` rewrites the typing, an answer takes it.\n       */\n      'ui.input': UiInputArgument;\n      /**\n       * Fires when a `Select` a render hook drew is picked from; `e` is\n       * `{ plugin, element, component, surface, value }`.\n       *\n       * `next(e)` runs the hooks beneath, then the element's own `onSelect` with\n       * `e.value` as the chain left it, resolving to `{ element, value }`;\n       * `next({ ...e, value })` rewrites the pick, an answer takes it.\n       */\n      'ui.select': UiSelectArgument;\n      /**\n       * Fires when a `Client` THIS plugin drew posts from its surface module\n       * (`surface.post(data)`); only this plugin's hooks see it.\n       *\n       * `next.origin` names `client`: `data` came from code. Core answers `{}`;\n       * `next({ ...e, data })` rewrites the data; `{ props }` hands the posting\n       * instance its next props without a redraw. One per instance per frame.\n       */\n      'ui.message': UiMessageArgument;\n      /**\n       * Fires when a `Client` THIS plugin drew failed on a surface: its module\n       * did not load, its drawing failed, or its code failed after it had drawn.\n       *\n       * Only this plugin's hooks see it; `e.phase` says when, `e.reason` why.\n       * Observe only: core answers `{}`. The engine then draws that site again,\n       * unasked: fall back by leaving the `Client` out.\n       *\n       * @remarks A `Client` born in that redraw that fails is heard too, and the\n       *   engine draws nothing again for it: to go on, ask (`$.ui.invalidate`).\n       * @example\n       * on(\"ui.fault\", ($, e, next) => ($.ui.log(e.reason), next(e)))\n       */\n      'ui.fault': UiFaultInput;\n      /**\n       * Fires before a site's window moves: the person's wheel or scroll keys on\n       * a `Pane` body or the `AbovePrompt` band, at its edges too; `$.ui.scroll`.\n       *\n       * `next(e)` moves it to `e.offset` and draws: `{}`; `next({ ...e, offset\n       * })` elsewhere; no `next` (`{}` or `{ deny }`) leaves it undrawn, so a hook\n       * drawing its own rows under a header moves them by `e.by` and invalidates.\n       *\n       * @example\n       * on(\"ui.scroll\", { requestId: \"log\" }, ($, e) => (scrollOwnRows(e.by), {}))\n       */\n      'ui.scroll': UiScrollInput;\n      /**\n       * Fires before a site's focus ring moves: the person's Tab, arrows or click\n       * in a `Pane` or the band; an `autoFocus` element taking it; `$.ui.focus`.\n       *\n       * `next(e)` lands it on `e.element` (absent: one of the engine's stops) and\n       * draws: `{}`; `next({ ...e, element })` on another of `e.plugin`'s; no\n       * `next` (`{}` or `{ deny }`) keeps it where it was, drawn as it was.\n       *\n       * @example\n       * on(\"ui.focus\", { requestId: \"list\" }, ($, e, next) => (mark(e), next(e)))\n       */\n      'ui.focus': UiFocusInput;\n      /**\n       * Fires when the engine offers an agent type to the model, in the agent\n       * listing and again at dispatch; `next(e)` resolves to `{ isOffered: true }`.\n       *\n       * Return `{ isOffered: false }` to keep the type out of the listing and\n       * refuse its dispatch. A hook that fails passes it through.\n       *\n       * @remarks So give a guard here\n       *   `.catch(($, e, next) => next.called ? next(e) : { isOffered: false })`.\n       * @example\n       * on(\"agent.offer\", { agent: \"Plan\" }, () => ({ isOffered: false }))\n       */\n      'agent.offer': AgentOfferInput;\n      /**\n       * Fires when the Agent tool, or a workflow script's `agent()`\n       * (`e.workflow`), is about to start an agent, its model not yet resolved.\n       *\n       * `next(e)` resolves to `{ model }`. Return it, `next({ ...e, model })`,\n       * `{ model }` of your own (an alias resolves like the tool's parameter), or\n       * `{ deny: reason }`.\n       *\n       * @remarks A guard that fails is skipped and the subagent starts, so give\n       *   it `.catch(($, e, next) => next.called ? next(e) : { deny: \"no\" })`.\n       */\n      'agent.spawn': AgentSpawnInput;\n      /**\n       * Fires when a prompt is submitted, before the turn starts. `next(e)` runs\n       * the hooks beneath and the UserPromptSubmit settings hooks, then it enters.\n       *\n       * Rewrite with `next({ ...e, text })` (the user message on screen follows)\n       * or, in its place, stop it with `{ drop: reason }`; a broken plugin never\n       * blocks one. Typed while a turn ran, it fires at Enter, with that turn's id.\n       *\n       * @remarks So a guard that fails lets the prompt through, unless given\n       *   `.catch(($, e, next) => next.called ? next(e) : { drop: \"no\" })`.\n       */\n      'prompt.submit': PromptSubmitInput;\n      /**\n       * Fires when a text is about to be put in the prompt box as the person's\n       * draft (a plugin's `$.prompt.fill`); `next(e)` writes it by `e.mode`.\n       *\n       * `replace` over the draft, `append` after it, `insert` at the cursor;\n       * rewrite `text` or `mode` going down, or answer `{ isFilled: false }`\n       * without `next` to keep it out, as core does under a dialog or headless.\n       *\n       * @example\n       * on(\"prompt.fill\", ($, e, next) => next({ ...e, text: e.text.trim() }))\n       */\n      'prompt.fill': PromptFillInput;\n      /**\n       * Fires when a text is proposed as the prompt box's dim suggestion, Tab to\n       * take: the engine's guess after a turn, or a plugin's `$.prompt.suggest`.\n       *\n       * `next(e)` shows it: `{ isShown }`. Rewrite with `next({ ...e, text })`,\n       * or answer `{ isShown: false }` without `next` to drop it; core answers\n       * that too while the box holds text or a turn runs.\n       *\n       * @example\n       * on(\"prompt.suggest\", () => ({ isShown: false }))\n       */\n      'prompt.suggest': PromptSuggestInput;\n      /**\n       * Fires when the person edits the main prompt box: a key the editor took as\n       * an edit, or a paste; `next(e)` resolves the box the editor shows.\n       *\n       * `e` is the draft before and the splice (`start`, `end`, `inputText`); a\n       * burst of keys is one edit. Rewrite `inputText` going down or the box\n       * coming up; `{ text: e.text, cursor: e.cursor }` without `next` consumes.\n       *\n       * @example\n       * on(\"prompt.edit\", ($, e) => ({ text: e.text, cursor: e.cursor }))\n       */\n      'prompt.edit': PromptEditInput;\n      /**\n       * Fires after the main prompt box's text changed and no `prompt.edit`\n       * carried it: a recalled history entry, a clear, a plugin's fill.\n       *\n       * `e` is the box as it stands and `e.origin` who changed it. Observe only:\n       * the change is in the box. One per batch of changes, one at a time.\n       *\n       * @example\n       * on(\"prompt.change\", ($, e, next) => ($.ui.status(e.origin.kind), next(e)))\n       */\n      'prompt.change': PromptChangeInput;\n      /**\n       * Fires as the person types in the main prompt box, for the token at the\n       * cursor; `next(e)` resolves to `{ suggestions }`, rows for the typeahead.\n       *\n       * Nothing waits on it: the engine's own rows draw first and these join\n       * beneath them, unhighlighted, for the word still being typed. Taking one\n       * writes its `text` over the token. Only while a plugin hooks it.\n       *\n       * @example\n       * on(\"prompt.autocomplete\", () => ({ suggestions: [{ text: \"#123\" }] }))\n       */\n      'prompt.autocomplete': PromptAutocompleteInput;\n      /**\n       * Fires once per named section of the system prompt, when the engine\n       * assembles it; `next(e)` resolves to `{ text }` as core computed it.\n       *\n       * `e.name` is the section's id, on every model the one `prompt.compose`\n       * lists. Cached, so keep it steady: after `$.ui.invalidate(\"prompt.section\")`\n       * a changed answer goes out next turn over the text the main thread sent,\n       * which loses its thinking and the cache. A failed hook passes through.\n       *\n       * @example\n       * on(\"prompt.section\", { name: \"memory\" }, () => ({ text: null }))\n       */\n      'prompt.section': PromptSectionInput;\n      /**\n       * Fires once per conversation, when the engine computes the context blocks\n       * its first user message carries; `next(e)` resolves to `{ blocks }`.\n       *\n       * Append, drop, reorder or rewrite with `next({ ...e, blocks })`; the\n       * answer stands until `$.ui.invalidate(\"prompt.context\")` or a re-read\n       * (compaction, `/clear`). `PromptContextResult` says what the model is sent.\n       *\n       * @example\n       * on(\"prompt.context\", () => ({ blocks: [] }))\n       */\n      'prompt.context': PromptContextInput;\n      /**\n       * Fires when the engine renders a system prompt; `next(e)` resolves to\n       * `{ sections }`, each `{ id, text, scope }`, in the order they are sent.\n       *\n       * The ids depend on the prompt composed (`lean`, `bare` in `e.traits`): read\n       * them off `next(e)`. Append (as `session`), replace, reorder or drop; a list\n       * with a `shared` section after a `session` one skips the hook.\n       */\n      'prompt.compose': PromptComposeInput;\n      /**\n       * Fires once per message the engine injects for the model on its own (a\n       * reminder, a mode transition, a mentioned file), as a request carries it.\n       *\n       * `next(e)` resolves to `{ text }`; `{ text: null }` leaves it out. The\n       * answer holds per attachment for the process (asked again on resume or\n       * `$.ui.invalidate`); the transcript keeps the engine's record.\n       *\n       * @example\n       * on(\"prompt.attachment\", { type: \"todo_reminder\" }, () => ({ text: null }))\n       */\n      'prompt.attachment': PromptAttachmentInput;\n      /**\n       * Fires once per path a prompt names after an `@`, a directory aside,\n       * before the engine reads it; `next(e)` reads it and resolves `{ type }`.\n       *\n       * No `tool.call` is raised for this read. Add `context` to what `next`\n       * gave, read another `path` with `next({ ...e, path })`, or answer\n       * `{ deny: reason }` so nothing is read.\n       *\n       * @remarks A guard that fails is skipped and the file is read, so give it\n       *   `.catch(($, e, next) => next.called ? next(e) : { deny: \"no\" })`.\n       * @example\n       * on(\"prompt.mention\", { path: /\\.env$/ }, () => ({ deny: \"a secret\" }))\n       */\n      'prompt.mention': PromptMentionInput;\n      /**\n       * Fires when the engine first renders the tool's schema in a session;\n       * `next(e)` resolves to `{ description, isDeferred? }`.\n       *\n       * An MCP tool behind ToolSearch fires twice: its short text, then the one\n       * loaded. Cached until `$.ui.invalidate(\"tool.describe\")`: a changed answer\n       * for a tool a thread has sent goes out next turn over that text, which\n       * loses its thinking and the whole prompt cache.\n       *\n       * @remarks Twice for an MCP tool behind ToolSearch: its short text, then\n       *   the one loaded.\n       * @remarks An explicit `isDeferred` moves the tool behind ToolSearch (true)\n       *   or into the prompt's list (false).\n       * @example\n       * on(\"tool.describe\", { tool: \"Bash\" }, ($, e) => ({ ...e, description }))\n       * @example\n       * on(\"tool.describe\", { tool: \"Monitor\" }, pin) // {...e, isDeferred: false}\n       */\n      'tool.describe': ToolDescribeInput;\n      /**\n       * Fires when a slash command is about to run (`/name args` typed, or a\n       * plugin's `$.command.run`); `next(e)` resolves to `{ text }`, its output.\n       *\n       * Core is the engine's command (a registered one has none). Rewrite `args`\n       * with `next`, or return `{ text }` without it to answer in its place; one\n       * after `next` replaces a printed output, not a panel or prompt it opened.\n       *\n       * @remarks A guard that fails is skipped and the command runs, so give it\n       *   `.catch(($, e, next) => next.called ? next(e) : { text: \"no\" })`.\n       * @example\n       * on(\"command.run\", { command: \"hello\" }, () => ({ text: \"hello\" }))\n       */\n      'command.run': CommandRunInput;\n      /**\n       * Fires once per command, when the engine lists it for the typeahead and\n       * `/help`; `next(e)` resolves to `{ description, argumentHint, isHidden }`.\n       *\n       * Listed answers are cached for the session until\n       * `$.ui.invalidate(\"command.describe\")`. A hook that fails passes it\n       * through.\n       *\n       * @example\n       * on(\"command.describe\", ($, e, next) => next({ ...e, isHidden: true }))\n       */\n      'command.describe': CommandDescribeInput;\n      /**\n       * Fires when a `/config` row is about to change, from the menu or a\n       * plugin's `$.config.set`; `next(e)` resolves to `{ value }` once written.\n       *\n       * Return `{ deny: reason }` to leave the row as it is (the menu says why),\n       * or `next({ ...e, value })` to clamp it; a value of the wrong kind for\n       * the row is refused. A row a trusted source owns is core's to refuse.\n       *\n       * @remarks A guard that fails is skipped and the row is written, so give\n       *   it `.catch(($, e, next) => next.called ? next(e) : { deny: \"no\" })`.\n       * @example\n       * on(\"config.set\", { key: \"theme\" }, () => ({ deny: \"the theme stays\" }))\n       */\n      'config.set': ConfigSetInput;\n      /**\n       * Fires once per `/config` row, when the menu lists it and for\n       * `$.config.list`; `next(e)` resolves to `{ label, description, isHidden }`.\n       *\n       * Relabel, re-describe or hide with `next({ ...e, isHidden: true })`; the\n       * answers are cached until `$.ui.invalidate(\"config.describe\")` or the\n       * loaded plugins change. A hook that fails passes the row through.\n       *\n       * @example\n       * on(\"config.describe\", { key: \"tips\" }, hide) // answers isHidden: true\n       */\n      'config.describe': ConfigDescribeInput;\n      /**\n       * Fires when a record is about to be logged to the destination `e.to`\n       * names: a built-in's `$.telemetry.log`, or the engine's own events.\n       *\n       * `e.to` is pinned: a hook rewrites what the record carries, never where\n       * it goes. `next(e)` resolves `{ value: undefined }`; `{ deny }` rejects the\n       * caller. Beneath the hooks the engine exports its own collector records.\n       *\n       * @example\n       * on(\"telemetry.log\", { to: \"collector\" }, ($, e, next) => next(e))\n       */\n      'telemetry.log': TelemetryLogInput;\n      /**\n       * Fires when one use of a feature is marked (`$.telemetry.mark`), as the\n       * CLI's own feature events mark one; always for `anthropic`, no `to`.\n       *\n       * `next(e)` resolves `{ value: undefined }`; `{ deny }` rejects the caller.\n       * The engine does nothing with a mark: the built-ins hooked here do.\n       *\n       * @example\n       * on(\"telemetry.mark\", { kind: \"bad\" }, ($, e, next) => next(e))\n       */\n      'telemetry.mark': TelemetryMarkInput;\n      /**\n       * Fires when the engine expands a skill's prompt for the model (`/name`,\n       * the Skill tool, a preload); `next(e)` resolves to `{ text }` as computed.\n       *\n       * Return `{ text }` with the text the model reads instead. A hook that\n       * fails passes it through.\n       *\n       * @example\n       * on(\"skill.prompt\", { skill: \"commit\" }, () => ({ text: \"A haiku.\" }))\n       */\n      'skill.prompt': SkillPromptInput;\n      /**\n       * Fires when the engine composes a git text the model is to write (`kind`:\n       * `commit`, `pr`, `exemption`, `remedy`); `next(e)` resolves to `{ text }`.\n       *\n       * Return `{ text }` with the text the model reads instead. A hook that\n       * fails passes it through.\n       *\n       * @example\n       * on(\"attribution.text\", { kind: \"commit\" }, () => ({ text: \"\" }))\n       */\n      'attribution.text': AttributionTextInput;\n      /**\n       * Fires once per process for each loaded plugin, before the first prompt,\n       * then once per fresh load of one (never `/clear`); `next(e)` is `{ cwd }`.\n       *\n       * Observe. The first is awaited: a `$.tool.register` is listed by turn one.\n       * A later one runs its hooks alone: an enable, a worker respawn, or a reload\n       * (changed modules only; all if one hooks `engine.create`/`plugin.register`).\n       *\n       * @example\n       * on(\"session.start\", ($, e, next) => $.tool.register(t).then(() => next(e)))\n       */\n      'session.start': SessionStartInput;\n      /**\n       * Fires when a delivery reaches the session, before it is queued: a relay's\n       * event, a peer's message, a Remote Control prompt, room events; `{ text }`.\n       *\n       * Rewrite with `next({ ...e, text })`, or return `{ consumed: reason }` to\n       * take it: nothing is queued, shown or read by the model. `origin`,\n       * `event` and `agentId` pass on as received; `session.send` is its dual.\n       *\n       * @example\n       * on(\"session.receive\", { origin: \"peer\" }, () => ({ consumed: \"muted\" }))\n       */\n      'session.receive': SessionReceiveInput;\n      /**\n       * Fires once per row a conversation of this session keeps (a prompt, a\n       * response block, a tool result, a notice), before it is stored.\n       *\n       * `next({ ...e, message })` rewrites `content`: stored and sent after. The\n       * screen, an SDK stream or Remote Control may show the row just before its\n       * rewrite; the model and the transcript file never read that form.\n       *\n       * @example\n       * on(\"session.append\", { door: \"tool-result\" }, ($, e, n) => n(scrub(e)))\n       */\n      'session.append': SessionAppendInput;\n      /**\n       * Fires when a plain-text message is about to leave this conversation for\n       * another agent or session (the SendMessage tool, or `$.session.send`).\n       *\n       * `e.origin` says who sends, `e.agentId` which loop. Rewrite `text` or\n       * readdress `to` with `next` (a new `to` is judged again); `{ isDelivered:\n       * false, reason }` without `next` refuses it. `next(e)` resolves queued.\n       *\n       * @example\n       * on(\"session.send\", ($, e, next) => next({ ...e, text: redact(e.text) }))\n       */\n      'session.send': SessionSendInput;\n      /**\n       * Fires when the conversation is about to be compacted (`/compact`, the\n       * threshold, a plugin, or ahead of time); `next(e)` resolves `{ messages }`.\n       *\n       * Rewrite `instructions` or `messages` on the way down, the messages on\n       * the way up, or answer `{ messages }` of your own; `{ skip: reason }`\n       * leaves the conversation as it is. `trigger` passes on as received.\n       *\n       * @example\n       * on(\"session.compact\", { trigger: \"precompute\" }, () => ({ skip: \"off\" }))\n       */\n      'session.compact': SessionCompactInput;\n      /**\n       * Fires when a remote client joins the session's roster of attached\n       * surfaces: it said so (ui_attach), or it first asked to draw.\n       *\n       * Observe (a phone joined: draw the lobby); `next(e)` resolves to\n       * `{ clientId }`, a different return changes nothing. `$.session.surfaces()`\n       * reads the roster; a render hook still reads `e.surface` per ask.\n       *\n       * @example\n       * on(\"session.attach\", { surface: \"mobile\" }, ($, e, next) => next(e))\n       */\n      'session.attach': SessionAttachInput;\n      /**\n       * Fires when a client leaves the roster: it detached, or the session ended\n       * with it attached (`e.reason`). Observe; `next(e)` echoes `{ clientId }`.\n       *\n       * With reason `end` it runs inside `session.end`'s one short bound: there\n       * `next.budget` reads that bound and `next.signal` aborts at it.\n       */\n      'session.detach': SessionDetachInput;\n      /**\n       * Fires when the engine measures the session and a unit moved: after each\n       * main-thread turn, and when a rate-limit window moves a whole point.\n       *\n       * Observe; `next(e)` echoes `{ changed }`. `$.session.usage()`'s figures,\n       * pushed, not polled: compare them with your own threshold here, call the\n       * op for the breakdown. One at a time, a burst folding into one more.\n       *\n       * @example\n       * on(\"session.measure\", ($, e, next) => (toastPast90(e.rateLimits), next(e)))\n       */\n      'session.measure': SessionMeasureInput;\n      /**\n       * Fires once when the session ends (exit, /clear, resume, logout, signal, a\n       * `-p` run done), after its SessionEnd settings hooks; `e.reason` says which.\n       *\n       * `next(e)` runs the engine's end step, `{ sessionId }`; `e.resume.id` is\n       * `--resume`'s. Exits stay fast whatever is loaded: the whole chain shares\n       * one short wall-clock bound, which `next.budget` reads (SessionEndInput).\n       *\n       * @example\n       * on(\"session.end\", async ($, e, next) => (await save(next.budget), next(e)))\n       */\n      'session.end': SessionEndInput;\n      /**\n       * Fires once per hooks module about to join the chain, at load (the set\n       * folded and built, nothing swapped in) and at reload; core allows.\n       *\n       * Return `{ refuse: reason }` and it never joins: no hook, no noun, no tool\n       * of it; the debug log names who refused. Its judges, `$` whole, are the\n       * plugins admitted before it and the binary's; judge by `tier` and `uses`.\n       *\n       * @remarks A judge that fails is skipped and the module joins, so give it\n       *   `.catch(($, e, next) => next.called ? next(e) : { refuse: \"no\" })`.\n       * @example\n       * on(\"plugin.register\", { tier: \"user\" }, () => ({ refuse: \"managed only\" }))\n       */\n      'plugin.register': PluginRegisterInput;\n      /**\n       * Fires when a model turn begins, main's or a subagent's (`e.agentId`),\n       * before its first model call; `next(e)` resolves to `{ turnId }`.\n       *\n       * Observe: a different return changes nothing. For the main loop alone,\n       * return `next(e)` first when `e.agentId !== undefined`. An agent's start\n       * skips the hooks its spawn was nested in, as its `turn.step`s do.\n       */\n      'turn.start': TurnStartInput;\n      /**\n       * Fires when the engine is about to send a model request of a turn, main's\n       * or a subagent's (`e.agentId`); `next(e)` resolves to the whole response.\n       *\n       * `next({ ...e, model })` or `effort` sends another; the turn, the index and\n       * the message count are pinned. An answer without `next` sends no request.\n       * It streams (StreamNext): the hook's budget counts its own code alone.\n       */\n      'turn.step': TurnStepInput;\n      /**\n       * Fires when a model turn has ended, at the point its duration is reported;\n       * `next(e)` resolves to `{ text }`, the answer. `e.reason` says why.\n       *\n       * Return `{ text }` with a different text to show it beneath the answer (a\n       * synopsis, a TL;DR line); the transcript's record is never rewritten. A\n       * hook that fails leaves the answer as it was.\n       *\n       * @remarks Every hook hears an agent's end (`e.agentId`), the spawner's\n       *   too; a hook that heard the turn's start hears its end after it.\n       */\n      'turn.complete': TurnCompleteInput;\n      /**\n       * Runs while `$` is being built, once per load or reload of this plugin\n       * and before any other hook of it; `next(e)` resolves to `$` built so far.\n       *\n       * A step may ADD nouns and, outside `user`, WITHHOLD them (leave one out, or\n       * return without `next`). It fails, and its plugin unloads, when it REPLACES\n       * another's; in `user`, also past its own stub, or adding a seated name.\n       */\n      'engine.create': EngineCreateInput;\n  };"},{"name":"EngineInterface","kind":"interface","line":4720,"doc":{"desc":["`$`, the first parameter of every hook. Frozen; core's interface plus","every noun the plugins' `engine.create` steps added.","","Flat, `<noun>.<event>`; it does not carry `on`, since registration happens","before `$` exists. An interface so a plugin types the noun it provides by","declaration merging, the way a jQuery plugin types `$.fn`."],"params":[],"example":["declare module \"claude-code\" { interface EngineInterface { voice: Voice } }"],"returns":[]},"text":"  export interface EngineInterface extends CoreEngineInterface {\n  }"},{"name":"EngineInterfaceBuilt","kind":"type","line":4731,"doc":{"desc":["What `next(e)` resolves to at `engine.create`: `$` as the steps beneath","built it, typed as `$` is, open to nouns no declaration names yet.","","A withheld noun is on it as a stub (a step inside withheld it, or the","last fold did and this is a reload), and the host refuses an op on one a","step outside withholds later; a typed module bootstraps at load on it."],"params":[],"example":[],"returns":[]},"text":"  export type EngineInterfaceBuilt = EngineInterface & {\n      readonly [noun: string]: unknown;\n  };"},{"name":"EngineResultOf","kind":"type","line":4738,"doc":{"desc":["The engine's events' results."],"params":[],"example":[],"returns":[]},"text":"  export type EngineResultOf = {\n      /**\n       * `{ result, context? }`, `{ deny }`, or core's `{ ref, result }`.\n       */\n      'tool.call': ToolCallResult;\n      /**\n       * `{ decision, reason?, rule?, hook?, setting?, plugin?, ceiling? }`.\n       */\n      'tool.check': ToolCheckResult;\n      /**\n       * The tree to draw; `{ type: \"engine\", ref }` is core's own drawing.\n       */\n      'ui.render': RenderElement;\n      /**\n       * The surface's element table (Elements[e.surface]): constructors from props\n       * to a RenderElement.\n       */\n      'ui.resolve': ElementTable;\n      /**\n       * `{ element }`: the element whose handler the press reached.\n       */\n      'ui.press': UiPressResult;\n      /**\n       * `{ element, value }`: the field whose handler the input reached, and\n       * the text it received.\n       */\n      'ui.input': UiInputResult;\n      /**\n       * `{ element, value }`: the picker whose handler the pick reached, and\n       * the value it received.\n       */\n      'ui.select': UiSelectResult;\n      /**\n       * `{ props? }`: the posting instance's next props, when a hook hands some.\n       */\n      'ui.message': UiMessageResult;\n      /**\n       * `{}`: the fault was heard.\n       */\n      'ui.fault': UiFaultResult;\n      /**\n       * `{}` once the window moved, or `{ deny }`.\n       */\n      'ui.scroll': UiScrollResult;\n      /**\n       * `{}` once the ring moved, or `{ deny }`.\n       */\n      'ui.focus': UiFocusResult;\n      /**\n       * `{ isOffered }`.\n       */\n      'agent.offer': AgentOfferResult;\n      /**\n       * `{ model }` or `{ deny }`.\n       */\n      'agent.spawn': AgentSpawnResult;\n      /**\n       * `{ text, context? }` or `{ drop }`.\n       */\n      'prompt.submit': PromptSubmitResult;\n      /**\n       * `{ isFilled }`.\n       */\n      'prompt.fill': PromptFillResult;\n      /**\n       * `{ isShown }`.\n       */\n      'prompt.suggest': PromptSuggestResult;\n      /**\n       * `{ text, cursor }`, the box the editor shows next.\n       */\n      'prompt.edit': PromptEditResult;\n      /**\n       * `{ text }`.\n       */\n      'prompt.change': PromptChangeResult;\n      /**\n       * `{ suggestions }`, the rows the plugins add to the typeahead.\n       */\n      'prompt.autocomplete': PromptAutocompleteResult;\n      /**\n       * `{ text }` (null leaves the section out).\n       */\n      'prompt.section': PromptSectionResult;\n      /**\n       * `{ blocks }` (a block left out is not sent).\n       */\n      'prompt.context': PromptContextResult;\n      /**\n       * `{ sections }`, every `shared` one ahead of every `session` one (a\n       * section left out is not sent).\n       */\n      'prompt.compose': PromptComposeResult;\n      /**\n       * `{ text }` (null leaves the attachment out).\n       */\n      'prompt.attachment': PromptAttachmentResult;\n      /**\n       * `{ type, context? }` (null when nothing was attached) or `{ deny }`.\n       */\n      'prompt.mention': PromptMentionResult;\n      /**\n       * `{ description, isDeferred? }`.\n       */\n      'tool.describe': ToolDescribeResult;\n      /**\n       * `{ text }` (the command's output, when it printed one).\n       */\n      'command.run': CommandRunResult;\n      /**\n       * `{ description, argumentHint, isHidden }`.\n       */\n      'command.describe': CommandDescribeResult;\n      /**\n       * `{ value }` once written, or `{ deny }`.\n       */\n      'config.set': ConfigSetResult;\n      /**\n       * `{ label, description, isHidden }`.\n       */\n      'config.describe': ConfigDescribeResult;\n      /**\n       * `{ value: undefined }`, or `{ deny }`.\n       */\n      'telemetry.log': TelemetryLogResult;\n      /**\n       * `{ value: undefined }`, or `{ deny }`.\n       */\n      'telemetry.mark': TelemetryMarkResult;\n      /**\n       * `{ text }`.\n       */\n      'skill.prompt': SkillPromptResult;\n      /**\n       * `{ text }`.\n       */\n      'attribution.text': AttributionTextResult;\n      /**\n       * `{ cwd }`.\n       */\n      'session.start': SessionStartResult;\n      /**\n       * `{ text }`, or `{ consumed }`.\n       */\n      'session.receive': SessionReceiveResult;\n      /**\n       * `{ message, uuid }`, the row as stored.\n       */\n      'session.append': SessionAppendResult;\n      /**\n       * `{ isDelivered: true }`, or `{ isDelivered: false, reason }`.\n       */\n      'session.send': SessionSendResult;\n      /**\n       * `{ messages, tokensBefore?, tokensAfter? }`, or `{ skip }`.\n       */\n      'session.compact': SessionCompactResult;\n      /**\n       * `{ clientId }`.\n       */\n      'session.attach': SessionAttachResult;\n      /**\n       * `{ clientId }`.\n       */\n      'session.detach': SessionDetachResult;\n      /**\n       * `{ changed }`.\n       */\n      'session.measure': SessionMeasureResult;\n      /**\n       * `{ sessionId }`.\n       */\n      'session.end': SessionEndResult;\n      /**\n       * `{ allow: true }`, or `{ refuse }`.\n       */\n      'plugin.register': PluginRegisterResult;\n      /**\n       * `{ turnId }`.\n       */\n      'turn.start': TurnStartResult;\n      /**\n       * The response: `{ turnId, index, answer, toolUses, stopReason, usage }`,\n       * and `serverToolUses` when the API ran tools of its own in the request.\n       */\n      'turn.step': TurnStepResult;\n      /**\n       * `{ text }`.\n       */\n      'turn.complete': TurnCompleteResult;\n      /**\n       * `$` as built so far, with this plugin's interface added and any it\n       * withheld left out; `next(e)` resolves to EngineInterfaceBuilt.\n       */\n      'engine.create': EngineCreateResult;\n  };"},{"name":"EnvSetResult","kind":"type","line":4939,"doc":{"desc":["What `$.env.set` resolves to and what an `env.set` hook's `{ value }`","holds: `{}` once the variable is set or unset, or why it was not."],"params":[],"example":[],"returns":[]},"text":"  type EnvSetResult = {\n      /**\n       * Absent when the write was made; else why not, in one line.\n       *\n       * In a session that takes its settings from its organization, the engine\n       * holds a write a plugin that is not built in stands behind where a\n       * person's own settings file could not set the variable there.\n       *\n       * @remarks The engine's hold resolves; a hook's own `{ deny }` rejects the\n       *   caller, and one given after `next(e)` was answered fails the hook: deny\n       *   in its place. A hook above may answer another `{ value }`: no write.\n       */\n      deny?: string;\n  };"},{"name":"EventCalls","kind":"type","line":4962,"doc":{"desc":["The engine's own events as calls on `$`, one signature each:","`$.<noun>.<event>(input)` resolves to its result, or to its stream.","","The engine raises its events through these same calls; a plugin's call","runs the same chain with the calling hook alone skipped. `input` may leave","out what the engine fills (`tool_use_id`, the parent agent)."],"params":[],"example":[],"returns":[]},"text":"  export type EventCalls = {\n      tool: {\n          call: ToolCallOverloads;\n          check: (input: ToolCheckArgs) => Promise<ToolCheckResult>;\n          describe: (input: ToolDescribeInput) => Promise<ToolDescribeResult>;\n      };\n      command: {\n          run: (input: CommandRunArgs) => Promise<CommandRunResult>;\n          describe: (input: CommandDescribeInput) => Promise<CommandDescribeResult>;\n      };\n      config: {\n          set: (input: ConfigSetArgs) => Promise<ConfigSetResult>;\n          describe: (input: ConfigDescribeInput) => Promise<ConfigDescribeResult>;\n      };\n      prompt: {\n          submit: (input: PromptSubmitArgs) => Promise<PromptSubmitResult>;\n          fill: (input: PromptFillArgs) => Promise<PromptFillResult>;\n          suggest: (input: PromptSuggestArgs) => Promise<PromptSuggestResult>;\n          section: (input: PromptSectionInput) => Promise<PromptSectionResult>;\n          context: (input: PromptContextInput) => Promise<PromptContextResult>;\n          attachment: (input: PromptAttachmentInput) => Promise<PromptAttachmentResult>;\n          mention: (input: PromptMentionInput) => Promise<PromptMentionResult>;\n          compose: (input?: PromptComposeArgs) => Promise<PromptComposeResult>;\n      };\n      skill: {\n          prompt: (input: SkillPromptArgs) => Promise<SkillPromptResult>;\n      };\n      attribution: {\n          text: (input: AttributionTextInput) => Promise<AttributionTextResult>;\n      };\n      agent: {\n          offer: (input: AgentOfferInput) => Promise<AgentOfferResult>;\n          spawn: (input: AgentSpawnArgs) => Promise<AgentSpawnResult>;\n      };\n      session: {\n          start: (input: SessionStartInput) => Promise<SessionStartResult>;\n          receive: (input: SessionReceiveInput) => Promise<SessionReceiveResult>;\n          append: (input: SessionAppendInput) => Promise<SessionAppendResult>;\n          send: (input: SessionSendArgs) => Promise<SessionSendResult>;\n          compact: (input?: SessionCompactArgs) => Promise<SessionCompactResult>;\n          attach: (input: SessionAttachInput) => Promise<SessionAttachResult>;\n          detach: (input: SessionDetachInput) => Promise<SessionDetachResult>;\n          measure: (input: SessionMeasureInput) => Promise<SessionMeasureResult>;\n          end: (input: SessionEndInput) => Promise<SessionEndResult>;\n      };\n      telemetry: {\n          log: (input: TelemetryLogArgs) => Promise<TelemetryLogResult>;\n          mark: (input: TelemetryMarkInput) => Promise<TelemetryMarkResult>;\n      };\n      turn: {\n          start: (input: TurnStartInput) => Promise<TurnStartResult>;\n          step: (input: TurnStepInput) => HookStream<TurnStepChunk, TurnStepResult>;\n          complete: (input: TurnCompleteInput) => Promise<TurnCompleteResult>;\n      };\n      ui: {\n          render: <C extends RenderComponent>(input: RenderInput<C>) => Promise<RenderElement>;\n          resolve: <E extends ResolveInput>(e: E) => Elements[E['surface']];\n          scroll: (input: UiScrollArgs) => Promise<UiScrollResult>;\n          focus: (input: UiFocusArgs) => Promise<UiFocusResult>;\n      };\n  };"},{"name":"EventName","kind":"type","line":5028,"doc":{"desc":["The name of an event: a key of EventOf, the engine's own (CoreEventName)","and the declared plugin nouns' (NounEventName)."],"params":[],"example":[],"returns":[]},"text":"  export type EventName = keyof EventOf;"},{"name":"EventOf","kind":"type","line":5038,"doc":{"desc":["The argument of each event, by event name: what a hook receives as `e`","and what the call on `$` takes. Plain data, frozen to every depth.","","The engine's own events (CoreEventOf: a plugin's `$.fs.write(...)` is","a dispatch the hooks above it see) and the methods of the plugin nouns","declared on EngineInterface (NounEventOf)."],"params":[],"example":[],"returns":[]},"text":"  export type EventOf = CoreEventOf & NounEventOf;"},{"name":"EventResult","kind":"type","line":5044,"doc":{"desc":["The result of event `N`: what its hooks return and what their `next(e)`","resolves to."],"params":[],"example":[],"returns":[]},"text":"  export type EventResult<N extends EventName = EventName> = ResultOf[N];"},{"name":"Events","kind":"type","line":5061,"doc":{"desc":["The hook signature of each event, `($, e, next)`, as one mapped type over","EventOf; a streaming event's is the generator form (StreamHook).","","With one handler type per event, `Events[E]` for a generic E would be a","union; as one mapped type it stays a single function type the engine","calls without a cast (TS 4.6 correlated unions)."],"params":[["$","the engine interface, frozen, the same object at every invocation;   at `engine.create` the empty table, since `$` exists after the fold"],["e","the event's argument, frozen to every depth (`e.command = \"ls\"`   is a type error and throws); a rewrite is a copy passed to `next`"],["next","the rest of the chain; a chain a hook raises through `$` skips   this hook and runs every other, its plugin's others too"]],"example":[],"returns":[]},"text":"  export type Events = {\n      [E in keyof EventOf]: E extends StreamingEventName ? StreamHook<E> : ($: E extends 'engine.create' ? NoEngineInterface : EngineInterface, e: Frozen<Args<E>>, next: Next<E>) => EventResult<E> | Promise<EventResult<E>>;\n  };"},{"name":"ExitReason","kind":"type","line":5065,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"  type ExitReason = 'clear' | 'resume' | 'logout' | 'prompt_input_exit' | 'other';"},{"name":"FileChangedHookInput","kind":"type","line":5067,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"  type FileChangedHookInput = BaseHookInput & {\n      hook_event_name: 'FileChanged';\n      file_path: string;\n      event: 'change' | 'add' | 'unlink';\n  };"},{"name":"Frozen","kind":"type","line":5080,"doc":{"desc":["`T` with every property read-only to every depth, arrays and tuples kept","as declared: how a hook's `e` is typed.","","`e.command = 'x'` is a type error; `next({ ...e, command: 'x' })` compiles.","A string is kept as typed, so a union that names some strings keeps them."],"params":[],"example":[],"returns":[]},"text":"  export type Frozen<T> = T extends string | ((...args: never[]) => unknown) ? T : T extends readonly unknown[] ? {\n      [K in keyof T]: Frozen<T[K]>;\n  } : T extends object ? {\n      readonly [K in keyof T]: Frozen<T[K]>;\n  } : T;"},{"name":"FsAncestor","kind":"type","line":5090,"doc":{"desc":["One file `$.fs.ancestors` found: the directory it stands in, the name it","was asked for by, and its text as the engine's memory loader reads it."],"params":[],"example":[],"returns":[]},"text":"  export type FsAncestor = {\n      /**\n       * The directory the file stands in, absolute.\n       */\n      dir: string;\n      /**\n       * The spelling the caller asked for it by.\n       */\n      name: string;\n      /**\n       * The file's text, with what its `@include`s bring after it.\n       */\n      content: string;\n      /**\n       * The file and then each file its `@` imports brought, in load order,\n       * path and text apiece; `content` is these texts joined.\n       */\n      parts: readonly FsAncestorPart[];\n  };"},{"name":"FsAncestorPart","kind":"type","line":5113,"doc":{"desc":["One file of an ancestor entry: the file itself or one it imported."],"params":[],"example":[],"returns":[]},"text":"  export type FsAncestorPart = {\n      /**\n       * The file's path, absolute.\n       */\n      path: string;\n      /**\n       * Its text as the engine's memory loader reads it.\n       */\n      content: string;\n  };"},{"name":"FsAncestorsRequest","kind":"type","line":5132,"doc":{"desc":["The argument of `$.fs.ancestors`: the file names to look for in each","directory, the file to walk down to, and the directory to walk beneath.","","Where a rule or a hold confines the session's reads, a file is found","only where every name its path goes by may be read; under a hold a","folder above the working directory gives only instruction files of its own."],"params":[],"example":[],"returns":[]},"text":"  export type FsAncestorsRequest = {\n      /**\n       * Relative `.md` file names, each looked for in every directory.\n       */\n      names: readonly string[];\n      /**\n       * The file the walk goes on down to the directory of, relative to the\n       * working directory or absolute; absent, it ends at the working directory.\n       *\n       * Without `below`, a plain name or one under `.claude`, in the working\n       * directory or above it, is judged as the engine's start-up load is; any\n       * other file by the main session, and with none bound the call rejects.\n       */\n      of?: string;\n      /**\n       * The directory the walk starts beneath, relative to the working directory\n       * or absolute; absent, the walk starts at the filesystem root.\n       *\n       * Only directories strictly inside it are read, each file as the main\n       * session's rules on reads judge it, as the engine reads a nested\n       * CLAUDE.md; a file not inside it finds nothing.\n       */\n      below?: string;\n  };"},{"name":"FsBytes","kind":"type","line":5161,"doc":{"desc":["What `$.fs.read(path, { as: \"bytes\" })` resolves with: the file's bytes,","base64, since only plain data crosses into a plugin's environment."],"params":[],"example":[],"returns":[]},"text":"  export type FsBytes = {\n      /**\n       * The file's content, standard padded base64;\n       * `Uint8Array.fromBase64(base64)` gives the bytes back.\n       */\n      base64: string;\n  };"},{"name":"FsEntry","kind":"type","line":5172,"doc":{"desc":["One entry of `$.fs.list`: the entry itself, a link not followed."],"params":[],"example":[],"returns":[]},"text":"  export type FsEntry = {\n      /**\n       * The entry's name (no directory part).\n       */\n      name: string;\n      /**\n       * `file`, `dir`, or `other`, of the entry itself: a symbolic link is\n       * `other` (`$.fs.stat` says what it leads to, and with `resolve` where).\n       */\n      kind: 'file' | 'dir' | 'other';\n      /**\n       * Bytes, for a file.\n       */\n      size: number;\n      /**\n       * Last modification, milliseconds since the epoch, for a file, as\n       * `$.fs.stat` spells it; 0 for a directory, a link or any other kind.\n       *\n       * The listing reads a regular file's size and time in its one call and\n       * looks no other entry up: `$.fs.stat` answers a directory's.\n       *\n       * @example\n       * const newest = [...entries].sort((a, b) => b.mtimeMs - a.mtimeMs)[0]\n       */\n      mtimeMs: number;\n      /**\n       * True when the entry is a symbolic link.\n       */\n      isLink: boolean;\n  };"},{"name":"FsReadAs","kind":"type","line":5206,"doc":{"desc":["How `$.fs.read` answers: `text` (UTF-8, the default) or `bytes` (base64)."],"params":[],"example":[],"returns":[]},"text":"  export type FsReadAs = 'text' | 'bytes';"},{"name":"FsReadBytesOptions","kind":"type","line":5212,"doc":{"desc":["The options of `$.fs.read` that ask for the bytes: the call answers","`{ base64 }`."],"params":[],"example":[],"returns":[]},"text":"  export type FsReadBytesOptions = {\n      /**\n       * `bytes`.\n       */\n      as: 'bytes';\n  };"},{"name":"FsReadCall","kind":"type","line":5223,"doc":{"desc":["`$.fs.read`: the file's text, or with `{ as: \"bytes\" }` its bytes as","`{ base64 }`."],"params":[],"example":[],"returns":[]},"text":"  export type FsReadCall = {\n      (path: string): Promise<string>;\n      (path: string, options: FsReadBytesOptions): Promise<FsBytes>;\n      (path: string, options: FsReadOptions): Promise<string | FsBytes>;\n  };"},{"name":"FsReadOptions","kind":"type","line":5232,"doc":{"desc":["The options of `$.fs.read`."],"params":[],"example":[],"returns":[]},"text":"  export type FsReadOptions = {\n      /**\n       * `bytes` answers `{ base64 }` for a binary file; `text` (the default) the\n       * file's text.\n       */\n      as: FsReadAs;\n  };"},{"name":"FsStat","kind":"type","line":5244,"doc":{"desc":["What `$.fs.stat` resolves with: what the path leads to, whether the path","itself is a symbolic link, and where it lands when asked."],"params":[],"example":[],"returns":[]},"text":"  export type FsStat = {\n      /**\n       * `file`, `dir`, or `other`, of what the path leads to: a link is\n       * followed, and one that leads nowhere is `other`.\n       */\n      kind: 'file' | 'dir' | 'other';\n      /**\n       * Bytes, for a file.\n       */\n      size: number;\n      /**\n       * Last modification, milliseconds since the epoch.\n       */\n      mtimeMs: number;\n      /**\n       * True when the path itself is a symbolic link; `kind`, `size` and\n       * `mtimeMs` then describe what it points at, or the link when that is gone.\n       */\n      isLink: boolean;\n      /**\n       * Where the path landed when asked with `{ resolve: true }`: absolute,\n       * every symbolic link followed, `.` and `..` folded; else absent.\n       *\n       * Absent too when the path leads nowhere or a hook above withheld it, so\n       * a guard denies without it; and a hard link, a volume or file-id spelling\n       * (macOS `/.vol/`) or a case alias keeps its own spelling, `isLink` false.\n       *\n       * @remarks a deny-list on spellings is thus best effort; an allow-list on\n       *          `realPath` under a root resolved the same way is the robust guard.\n       */\n      realPath?: string;\n  };"},{"name":"FsStatOptions","kind":"type","line":5280,"doc":{"desc":["The options of `$.fs.stat`."],"params":[],"example":[],"returns":[]},"text":"  export type FsStatOptions = {\n      /**\n       * True to resolve where the path lands as well.\n       *\n       * The answer then carries `realPath` when the path leads somewhere, at\n       * the cost of one more file system call: where it landed then, not a hold\n       * on what a tool opens afterwards.\n       */\n      resolve: boolean;\n  };"},{"name":"Glob","kind":"type","line":5298,"doc":{"desc":["Every event (`*`), or every event under a namespace (`classic.*`: each","one whose name starts with `classic.`).","","But a telemetry event, which is hooked by name (`telemetry.log`, or","`telemetry.*` for all): `*` does not select one for an installed plugin."],"params":[],"example":[],"returns":[]},"text":"  export type Glob = '*' | `${Namespace}.*`;"},{"name":"GlobHook","kind":"type","line":5308,"doc":{"desc":["The hook `on(pattern, hook)` takes for a glob or a negation: one function","placed on every selected event, `e` and the result typed as their union.","","`next.event` says which event a run is; `next.is(pattern, e)` narrows `e`","to one of them. At `engine.create` (a negation may select it) `$` is the","empty table and the hook observes the fold, as a `*` hook does."],"params":[],"example":[],"returns":[]},"text":"  export type GlobHook<P extends Pattern, N extends EventName = Selected<P>> = ($: EngineInterface, e: Frozen<Args<N>>, next: GlobNext<P>) => EventResult<N> | Promise<EventResult<N>>;"},{"name":"GlobNext","kind":"type","line":5317,"doc":{"desc":["`next` in a hook on a glob or a negation: an overload per selected event,","then one over their union for an `e` not yet narrowed.","","`is` narrows `e` to the selected events its pattern names; `event` is one","of the selected names."],"params":[],"example":[],"returns":[]},"text":"  export type GlobNext<P extends Pattern, N extends EventName = Selected<P>> = OrderedOverloads<N> & {\n      (e: Args<N>): Promise<GlobNextResult<N>>;\n      /**\n       * Continues this dispatch at a tier, as Next's `to` (a managed hook's),\n       * over the selected events' union for an `e` not yet narrowed.\n       */\n      readonly to: (e: Args<N>, tier: TargetTier) => Promise<GlobNextResult<N>>;\n      readonly signal: AbortSignal;\n      readonly is: <M extends PatternOver<N>>(pattern: M, e: unknown) => e is Frozen<Args<Extract<N, Selected<M>>>>;\n      readonly event: N;\n      readonly origin: Origin;\n      readonly trace: readonly TraceEntry<N, Args<N>, GlobNextResult<N>>[];\n      readonly budget: NextBudget;\n  };"},{"name":"GlobNextResult","kind":"type","line":5336,"doc":{"desc":["What `next(e)` resolves to in a glob hook before `e` is narrowed: the","NextResult of each selected event, as a union."],"params":[],"example":[],"returns":[]},"text":"  type GlobNextResult<N extends EventName> = {\n      [K in N]: NextResult<K>;\n  }[N];"},{"name":"Hook","kind":"type","line":5343,"doc":{"desc":["One hook, `($, e, next)`, on event `E`."],"params":[],"example":[],"returns":[]},"text":"  export type Hook<E extends EventName = EventName> = Events[E];"},{"name":"HookBudget","kind":"type","line":5356,"doc":{"desc":["The time bounds every hook runs under, in milliseconds: the engine's own","constants are typed by these members, and `next.budget` reads the live one.","","Each bounds the hook's OWN time: the clock stops while a `next(e)` call or","any `$` call of the hook's is in flight (a `$.clock` wait excepted), so a","slow chain beneath or a minute-long `$.model.complete` costs it nothing."],"params":[],"example":["await $.model.complete(ask) // a minute; next.budget.remainingMs unmoved"],"returns":[]},"text":"  export type HookBudget = {\n      /**\n       * A hook's budget per dispatch, from its call to its return; past it the\n       * hook is absent (its `.catch` asked, else `next(e)` run on its behalf).\n       *\n       * A streaming hook's (an async generator) counts only while its own code\n       * runs, never at a `yield` or while it reads beneath: on `turn.step` the\n       * sum over the response; on `process.spawn` per piece, anew at each pull.\n       */\n      readonly ms: 10_000;\n      /**\n       * A `.catch` handler's grace: a fresh budget from the moment it is called,\n       * on the same clock (its `next` replay and its `$` calls are free).\n       *\n       * Past it the hook is absent as if it had no handler; `next.error.budget`\n       * and `next.budget.ms` both read it there. `engine.create` has no budget.\n       */\n      readonly catchMs: 1_000;\n      /**\n       * How long a hook may keep running after `next.signal` aborted (the person\n       * interrupted, a hook above settled first, its own budget ran out).\n       *\n       * Past it the hook is reported as lingering; the dispatch had already gone\n       * on without it when the signal aborted.\n       */\n      readonly lingerMs: 5_000;\n  };"},{"name":"HookFailure","kind":"type","line":5392,"doc":{"desc":["Why a hook failed, as its `.catch` handler reads it on `next.error`: plain","frozen data.","","`throw`: it threw, returned what the site refuses, or its hooks worker","ended under it, `message` saying what; `timeout`: it outran its budget,","`message` then what its last `next()` rejected with, if it did."],"params":[],"example":[],"returns":[]},"text":"  export type HookFailure = {\n      readonly kind: 'throw' | 'timeout';\n      /**\n       * What was thrown or why the worker ended, or for a timeout what the last\n       * `next()` rejected with; absent for a timeout with nothing rejected.\n       */\n      readonly message?: string;\n      /**\n       * The grace the handler runs under, in milliseconds; past it, the hook is\n       * absent as if it had no handler.\n       */\n      readonly budget: number;\n  };"},{"name":"HookFor","kind":"type","line":5414,"doc":{"desc":["The hook type per pattern: an event's own (Events), `*`'s (AnyEventHook),","or a glob's over the events it selects (GlobHook), as one conditional type.","","One type, so the two-argument `on` stays ONE generic signature: as an","overload set the language service offers no tool-name completions inside","`e.tool === \"`; as an index into a table TS intersects every argument."],"params":[],"example":[],"returns":[]},"text":"  export type HookFor<P extends Pattern> = P extends '*' ? AnyEventHook : P extends EventName ? Events[P] : GlobHook<P>;"},{"name":"HookInput","kind":"type","line":5416,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"  type HookInput = PreToolUseHookInput | PostToolUseHookInput | PostToolUseFailureHookInput | PostToolBatchHookInput | PermissionDeniedHookInput | NotificationHookInput | UserPromptSubmitHookInput | UserPromptExpansionHookInput | SessionStartHookInput | SessionEndHookInput | StopHookInput | StopFailureHookInput | SubagentStartHookInput | SubagentStopHookInput | PreCompactHookInput | PostCompactHookInput | PreModelSwitchHookInput | PostModelSwitchHookInput | PermissionRequestHookInput | SetupHookInput | TeammateIdleHookInput | TaskCreatedHookInput | TaskCompletedHookInput | ElicitationHookInput | ElicitationResultHookInput | ConfigChangeHookInput | InstructionsLoadedHookInput | WorktreeCreateHookInput | WorktreeRemoveHookInput | CwdChangedHookInput | FileChangedHookInput | DirectoryAddedHookInput | MessageDisplayHookInput;"},{"name":"HookOf","kind":"type","line":5422,"doc":{"desc":["The hook event `E` takes: an async generator over its chunks for a","streaming event (StreamingEventName), `($, e, next) => result` otherwise."],"params":[],"example":[],"returns":[]},"text":"  export type HookOf<E extends EventName> = Events[E];"},{"name":"HooksModule","kind":"type","line":5428,"doc":{"desc":["What a hooks module exports: `register`, and nothing the loader reads","besides."],"params":[],"example":[],"returns":[]},"text":"  export type HooksModule = {\n      register: Register;\n  };"},{"name":"HookStream","kind":"type","line":5440,"doc":{"desc":["What `next(e)` returns on a streaming event: the stream of everything","beneath, chunk by chunk, whose return value is the result from beneath.","","`yield* next(e)` forwards the chunks and evaluates to that result; a","transforming hook reads `for await (const chunk of stream)` and then","`await stream.result`. Each call runs what is beneath afresh."],"params":[],"example":[],"returns":[]},"text":"  export type HookStream<C, R> = AsyncGenerator<C, R> & {\n      /**\n       * Settles with what beneath returned once the stream has been read to\n       * its end; rejects if the stream is closed before that.\n       */\n      readonly result: Promise<R>;\n  };"},{"name":"HttpInit","kind":"type","line":5451,"doc":{"desc":["Options of `$.http.fetch`."],"params":[],"example":[],"returns":[]},"text":"  export type HttpInit = {\n      /**\n       * `GET` (default), `POST`, ...\n       */\n      method?: string;\n      /**\n       * Request headers.\n       */\n      headers?: Record<string, string>;\n      /**\n       * The request body, as text.\n       */\n      body?: string;\n      /**\n       * The handle `$.session.authorize()` answered: the engine sets the\n       * session's credential header itself, only for a first-party host.\n       *\n       * It rides https only. While `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`\n       * is set, a request that carries it is refused, whichever plugin asks.\n       */\n      auth?: string;\n      /**\n       * The absolute path of a Unix domain socket the request goes over instead\n       * of TCP (near 100 B at most): one per session, in a private directory.\n       *\n       * The URL still gives path, query and Host; redirects stay on it; no proxy;\n       * `https:` is TLS verified against the URL's host (always, once `auth`\n       * rides), so a credential reaches only its host. No relative path, no NUL.\n       *\n       * @example\n       * await $.http.fetch(url, { socketPath: `${runDirectory}/bridge.sock` })\n       */\n      socketPath?: string;\n  };"},{"name":"HttpResponse","kind":"type","line":5489,"doc":{"desc":["What `$.http.fetch` resolves with."],"params":[],"example":[],"returns":[]},"text":"  export type HttpResponse = {\n      /**\n       * The HTTP status code.\n       */\n      status: number;\n      /**\n       * True for a 2xx status.\n       */\n      ok: boolean;\n      /**\n       * Response headers, lower-cased names.\n       */\n      headers: Record<string, string>;\n      /**\n       * The body, as text.\n       */\n      text: string;\n  };"},{"name":"ImageBlitArgs","kind":"type","line":5519,"doc":{"desc":["A `$.ui.blit` argument swapping one of the caller's mounted keyed Images","to its next picture; every call sends it, so a stream needs no generation.","","The surface writes them with its frames, some sixty a second: byte and","`file` sources fold to the last per frame; every `shm` source reaches the","terminal (it unlinks each), and is denied while frames are not written."],"params":[],"example":["await $.ui.blit({ requestId: 'browser', key: 'view',","  source: { shm: '/tb-4', format: 'rgb', width: 1280, height: 720 } })"],"returns":[]},"text":"  export type ImageBlitArgs = {\n      /**\n       * The site the Image is drawn in, by the `requestId` this plugin draws it\n       * under.\n       */\n      requestId: string;\n      /**\n       * The Image's `key` in that drawing.\n       */\n      key: string;\n      /**\n       * The next picture (ImageSource): bytes, or a name the terminal reads.\n       */\n      source: ImageSource;\n      /**\n       * Refused unless it is the mounted Image's width in cells. Absent, that.\n       */\n      columns?: number;\n      /**\n       * Refused unless it is the mounted Image's height in cells. Absent, that.\n       */\n      rows?: number;\n  };"},{"name":"ImageProps","kind":"type","line":5559,"doc":{"desc":["The props of `Image`, the terminal surface's picture leaf: pixels over a","box of cells where the terminal can (kitty and Ghostty, or iTerm2 3.5 and","later for `png` and `rgba` bytes under fullscreen rendering; inside tmux","too, for bytes only, with tmux's `allow-passthrough` and `focus-events`","on), the `alt` elsewhere.","","A leaf: no children, `hover` or `onPress`; the cells are text, so the","picture scrolls and clips as a word does. Drawn again with another `source`","it is replaced in place; keyed, `$.ui.blit` swaps it at the frame rate."],"params":[],"example":["const { bytes } = await $.fs.read('chart.png', { as: 'bytes' })","<Image source={{ png: bytes.toBase64() }} columns={40} rows={12} alt=\"p95\" />","<Image key=\"view\" source={{ shm: '/tb-7', format: 'rgb', width: 960,","  height: 600 }} columns={80} rows={25} alt=\"the page\" />"],"returns":[]},"text":"  export type ImageProps = {\n      /**\n       * The element's address within the drawing: what `$.ui.blit` names to swap.\n       *\n       * Unique among the Images of one tree; absent, only a redraw changes it.\n       */\n      key?: string;\n      /**\n       * The picture (ImageSource): `{ png }` or `{ rgba, width, height }` bytes,\n       * or `{ file, format }` / `{ shm, format, width, height }` read here.\n       */\n      source: ImageSource;\n      /** How many terminal columns wide, 1 to 255; the picture is scaled to fill\n       * the box and the site clips what its body cannot show. */\n      columns: number;\n      /**\n       * How many terminal rows tall, 1 to 255.\n       */\n      rows: number;\n      /**\n       * What the picture says, drawn dim in its place where the picture cannot\n       * be (and read by a screen reader); required, may be a single space.\n       */\n      alt: string;\n  };"},{"name":"ImageSource","kind":"type","line":5602,"doc":{"desc":["The picture an `Image` shows: base64 bytes the plugin holds (at most 2 MiB","decoded), or the name of a file or POSIX shared-memory object it does not.","","A name is one another process on this machine wrote; the terminal, running","as the person, opens, reads and decodes it itself, so no pixel crosses `$`","and the engine never touches it. One it will not read (not a regular file,","under `/proc`, `/sys` or `/dev`, gone, across ssh) draws a blank box, its","words in the debug log; it unlinks a shared-memory object once read, so","each frame is a fresh one. A source equal to the last drawn sends nothing;","`generation` makes new content under an unchanged name a new source."],"params":[],"example":["{ rgba: pixels.toBase64(), width: 64, height: 32 }","{ file: '/dev/shm/frame-3.rgba', format: 'rgba', width: 640,","  height: 400 }","{ shm: '/tb-view-2', format: 'rgb', width: 1280, height: 720 }"],"returns":[]},"text":"  export type ImageSource = {\n      /**\n       * A whole PNG file, base64.\n       */\n      png: string;\n  } | {\n      /**\n       * `width * height` RGBA pixels, 4 bytes each, base64.\n       */\n      rgba: string;\n      /**\n       * Pixels per row, 1 to 2048.\n       */\n      width: number;\n      /**\n       * Rows of pixels, 1 to 2048.\n       */\n      height: number;\n  } | {\n      /**\n       * The absolute path of a regular file holding a whole PNG, at most\n       * 3072 bytes of path; read by the terminal, left in place.\n       */\n      file: string;\n      /**\n       * The file is a whole PNG; the terminal decodes it and sizes it itself.\n       */\n      format: 'png';\n      /**\n       * A whole number that changes when the file's content does under the\n       * same path, so a redraw reads it again; absent, the path alone tells.\n       */\n      generation?: number;\n  } | {\n      /**\n       * The absolute path of a regular file of `width * height` raw pixels, at\n       * most 3072 bytes of path; read by the terminal, left in place.\n       *\n       * On Linux a file under `/dev/shm` is memory.\n       */\n      file: string;\n      /**\n       * `rgba`, 4 bytes a pixel, or `rgb`, 3.\n       */\n      format: 'rgba' | 'rgb';\n      /**\n       * Pixels per row, 1 to 4096.\n       */\n      width: number;\n      /**\n       * Rows of pixels, 1 to 4096.\n       */\n      height: number;\n      /**\n       * A whole number that changes when the file's content does under the\n       * same path, so a redraw reads it again; absent, the path alone tells.\n       */\n      generation?: number;\n  } | {\n      /**\n       * The name of a POSIX shared-memory object of `width * height` raw\n       * pixels: `/` then up to 254 of `A-Z a-z 0-9 . _ -` (macOS takes 30).\n       *\n       * The terminal unlinks it after reading, so a name feeds one Image\n       * drawn once and is never sent again on a redraw; POSIX terminals only.\n       */\n      shm: string;\n      /**\n       * `rgba`, 4 bytes a pixel, or `rgb`, 3.\n       */\n      format: 'rgba' | 'rgb';\n      /**\n       * Pixels per row, 1 to 4096.\n       */\n      width: number;\n      /**\n       * Rows of pixels, 1 to 4096.\n       */\n      height: number;\n      /**\n       * A whole number that changes when a fresh object reuses a name, so a\n       * redraw reads it again; absent, the name alone tells.\n       */\n      generation?: number;\n  };"},{"name":"ImpossibleKeys","kind":"type","line":5695,"doc":{"desc":["The keys of object pattern `P` that object member `E` cannot satisfy, `D`","levels down; `never` when there is none, which is what keeps the member.","","A key `E` does not have (an open record has every string key), or one","whose value `P` narrows to nothing."],"params":[],"example":[],"returns":[]},"text":"  type ImpossibleKeys<E, P, D extends readonly unknown[]> = {\n      [K in keyof P]-?: K extends keyof E ? [NarrowedValue<Exclude<E[K], undefined>, P[K], D>] extends [never] ? K : never : K;\n  }[keyof P];"},{"name":"IndexFree","kind":"type","line":5703,"doc":{"desc":["An object with the declared keys of `T` and no other: its string and","number index signatures are left out. What KnownKeys reads the keys of."],"params":[],"example":[],"returns":[]},"text":"  type IndexFree<T> = {\n      [K in keyof T as string extends K ? never : number extends K ? never : K]: 0;\n  };"},{"name":"InputProps","kind":"type","line":5715,"doc":{"desc":["The props of `Input`, every surface's text field: an address, optional","texts, and the closures a change and a submit run. A leaf.","","One line, or with `rows` several. Focused through the same ring as `Button`","(`abovePrompt:focus`); while it has focus every printable key reaches it","alone and Esc returns them. A change and Enter raise `ui.input`."],"params":[],"example":[],"returns":[]},"text":"  export type InputProps = {\n      /**\n       * The element's address: `e.element` at `ui.input`, what a matcher names.\n       */\n      key: string;\n      /**\n       * Text drawn before the field.\n       */\n      label?: string;\n      /**\n       * Text drawn dim in an empty field.\n       */\n      placeholder?: string;\n      /**\n       * The text the field holds when drawn; the person's typing replaces it\n       * until the hook draws another.\n       */\n      value?: string;\n      /**\n       * What Enter does, in a word or two, drawn beside the field while it has\n       * focus (`send`). Defaults to `submit`.\n       */\n      submitLabel?: string;\n      /**\n       * How many lines tall the field is, a whole number of at least 1; from 2\n       * it holds several lines, as the DOM's `<textarea rows>`. Defaults to 1.\n       *\n       * Drawn that tall whatever it holds, its site's window at most; a longer\n       * text scrolls within. Enter submits; a newline is typed as in the prompt\n       * box. Up and Down walk its rows, then go to the element before or after.\n       */\n      rows?: number;\n      /**\n       * The site's focus ring starts here when the site takes the keyboard,\n       * instead of on nothing, as the DOM's `autofocus`: Enter acts on it at once.\n       *\n       * A pane opened with `focus`, or the person's focus chord or click, is the\n       * take. Of several in one site the first drawn wins; it raises `ui.focus`,\n       * origin this plugin. A ring the person has moved stays where it was put.\n       */\n      autoFocus?: true;\n      /**\n       * Runs on every change of the text, in the plugin's own environment: the\n       * bottom of a `ui.input` chain of kind `change`.\n       *\n       * The text is whole, its lines joined by `\\n`.\n       */\n      onInput?: (value: string, e: UiInputArgument) => void;\n      /**\n       * Runs on Enter with the text, in the plugin's own environment: the bottom\n       * of a `ui.input` chain of kind `submit`. No model turn unless it asks one.\n       *\n       * The text is whole, newlines kept and nothing trimmed.\n       */\n      onSubmit: (value: string, e: UiInputArgument) => void;\n  };"},{"name":"INSTRUCTION_FILE_KINDS","kind":"const","line":5776,"doc":{"desc":["Every tier an instruction file can belong to, for checking a hook's","answer; the kind type is derived from this list."],"params":[],"example":[],"returns":[]},"text":"  const INSTRUCTION_FILE_KINDS: readonly [\"managed\", \"user\", \"project\", \"local\", \"memory\"];"},{"name":"InstructionFile","kind":"type","line":5782,"doc":{"desc":["One instruction file behind the `claudeMd` block: where it was read, its","tier, its text as loaded, and the file that `@`-imported it if one did."],"params":[],"example":[],"returns":[]},"text":"  export type InstructionFile = {\n      /**\n       * The file's path, absolute.\n       */\n      path: string;\n      /**\n       * Its tier.\n       */\n      kind: InstructionFileKind;\n      /**\n       * The text as loaded (comments and frontmatter already stripped).\n       */\n      content: string;\n      /**\n       * The path of the file whose `@` import brought this one, when one did.\n       */\n      parent?: string;\n      /**\n       * Present where this session's own account could have written the file,\n       * or where a person's own plugin added or rewrote a `managed` file.\n       *\n       * It is then not told as the organization's. The host stamps it; a hook's\n       * own value for it is ignored.\n       */\n      isUnverified?: true;\n  };"},{"name":"InstructionFileKind","kind":"type","line":5813,"doc":{"desc":["What tier an instruction file belongs to: the organization's managed","policy, the person's own, the project's checked-in or private ones, memory."],"params":[],"example":[],"returns":[]},"text":"  export type InstructionFileKind = (typeof INSTRUCTION_FILE_KINDS)[number];"},{"name":"InstructionsLoadedHookInput","kind":"type","line":5815,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"  type InstructionsLoadedHookInput = BaseHookInput & {\n      hook_event_name: 'InstructionsLoaded';\n      file_path: string;\n      memory_type: 'User' | 'Project' | 'Local' | 'Managed';\n      load_reason: 'session_start' | 'nested_traversal' | 'path_glob_match' | 'include' | 'compact';\n      globs?: string[];\n      trigger_file_path?: string;\n      parent_file_path?: string;\n  };"},{"name":"InvalidatableEventName","kind":"type","line":5833,"doc":{"desc":["What `$.ui.invalidate` takes: a render event, or one of the six events","whose answers the engine caches for the session.","","For `ui.render`, the instances this plugin's matchers on it may select: one","naming no `requestId`, every instance of its component. For a thread resumed","in a new process the recorded `prompt.section` text stands, asked or not."],"params":[],"example":[],"returns":[]},"text":"  export type InvalidatableEventName = RenderEventName | 'prompt.section' | 'prompt.context' | 'prompt.attachment' | 'tool.describe' | 'command.describe' | 'config.describe';"},{"name":"IsDiscriminant","kind":"type","line":5843,"doc":{"desc":["Whether tag key `K` selects members of `I`: it does when each member gives","it ONE literal (`component: \"ToolUse\"` on the ToolUse variant).","","A key that is the same union on every member is a filter at runtime; it","is left out of the selection so that it cannot defeat the narrowing the","other keys give."],"params":[],"example":[],"returns":[]},"text":"  type IsDiscriminant<I, K> = I extends unknown ? K extends KnownKeys<I> ? IsSingleLiteral<I[K & keyof I]> : true : never;"},{"name":"IsLiteralValued","kind":"type","line":5848,"doc":{"desc":["Whether `V` is made of literals only: `\"a\" | \"b\"` is, `string` is not."],"params":[],"example":[],"returns":[]},"text":"  type IsLiteralValued<V> = string extends V ? false : number extends V ? false : boolean extends V ? false : [V] extends [string | number | boolean] ? true : false;"},{"name":"IsSingleLiteral","kind":"type","line":5853,"doc":{"desc":["Whether `V` is exactly one string, number or boolean literal."],"params":[],"example":[],"returns":[]},"text":"  type IsSingleLiteral<V> = [V] extends [string | number | boolean] ? IsUnion<V> extends true ? false : true : false;"},{"name":"IsUnion","kind":"type","line":5858,"doc":{"desc":["Whether `T` is a union of two or more members."],"params":[],"example":[],"returns":[]},"text":"  type IsUnion<T, U = T> = T extends unknown ? [U] extends [T] ? false : true : never;"},{"name":"JsonValue","kind":"type","line":5867,"doc":{"desc":["Plain data: what JSON holds, and what crosses between a plugin's hooks","module and its surface module whole (a `Client`'s props, a post's data).","","A function, a class instance, `undefined` or a cycle is not plain data;","the engine refuses one where it checks, and drops it where it clones."],"params":[],"example":[],"returns":[]},"text":"  export type JsonValue = string | number | boolean | null | readonly JsonValue[] | {\n      readonly [key: string]: JsonValue;\n  };"},{"name":"KeptEvent","kind":"type","line":5875,"doc":{"desc":["What `next` takes in a matched hook: the variants of `e` the matcher can","match (KeptMembers), as declared, so a rewrite of a pinned field passes."],"params":[],"example":[],"returns":[]},"text":"  type KeptEvent<P extends Pattern, M> = MatchedNames<P, M> extends infer N extends EventName ? N extends unknown ? KeptMembers<Args<N>, M> : never : never;"},{"name":"KeptMembers","kind":"type","line":5884,"doc":{"desc":["The members of the argument union `E` matcher `P` can match, as declared;","what `next` takes, so a rewrite may change a field the matcher pinned.","","A member is dropped when `P` names a key it lacks, or gives a key, at any","depth, a value none of that key's values can equal (ImpossibleKeys)."],"params":[],"example":[],"returns":[]},"text":"  type KeptMembers<E, P> = E extends unknown ? [ImpossibleKeys<E, P, []>] extends [never] ? E : never : never;"},{"name":"KnownKeys","kind":"type","line":5893,"doc":{"desc":["The declared keys of `T`, the string and number index signatures left out.","","A type with an index signature is mapped to be rid of it (IndexFree); any","other is read as it stands, which costs nothing per key. A key of these","indexes `T` as `T[K & keyof T]`."],"params":[],"example":[],"returns":[]},"text":"  type KnownKeys<T> = keyof (string extends keyof T ? IndexFree<T> : number extends keyof T ? IndexFree<T> : T);"},{"name":"LateOverload","kind":"type","line":5901,"doc":{"desc":["The events whose overload must come after the rest, lest it shadow them.","","`classic.PreToolUse` shares `tool.call`'s envelope, `turn.abort` every","turn event's `turnId`, and an object of any shape is assignable to NoArgs."],"params":[],"example":[],"returns":[]},"text":"  type LateOverload = 'classic.PreToolUse' | 'turn.abort' | NoArgsEvent;"},{"name":"LinkProps","kind":"type","line":5911,"doc":{"desc":["The props of `Link`, a hyperlink every surface draws: an OSC 8 span on the","terminal (else its text then the URL in dim), an anchor on desktop.","","An inline element: its children are the text, strings and inline","elements; absent children the `label`, absent both the URL. What `href`","spells is the plugin's own; what a click opens is the surface's."],"params":[],"example":[],"returns":[]},"text":"  export type LinkProps = {\n      /**\n       * Where the link goes, as written: any scheme, host and port; at most\n       * 2048 characters once what a terminal acts on is percent-encoded.\n       *\n       * A blank or no string, and on a remote surface anything but the\n       * `https:` URL its wire promises: the text is drawn plain, and said so;\n       * the tree stands. A click opens what the terminal, or the surface, opens.\n       */\n      href: string;\n      /**\n       * The text drawn when the element has no children; absent both, the URL\n       * itself is the text.\n       */\n      label?: string;\n  };"},{"name":"Literal","kind":"type","line":5932,"doc":{"desc":["What a matcher value selects by: itself, or `unknown` for a RegExp, which","selects nothing."],"params":[],"example":[],"returns":[]},"text":"  type Literal<X> = X extends RegExp ? unknown : X;"},{"name":"MarkdownLeafProps","kind":"type","line":5938,"doc":{"desc":["What a `Markdown` carries across the boundary: its address, text, dimness","and which links it answers; `onLinkPress` stays behind, a `press` instead."],"params":[],"example":[],"returns":[]},"text":"  export type MarkdownLeafProps = {\n      /**\n       * The element's address: what `e.element` carries and what a matcher\n       * names; present whenever the element carries a `press`.\n       */\n      key?: string;\n      /**\n       * The markdown drawn, checked as a Text's string is.\n       */\n      text: string;\n      /**\n       * The whole block dim, as `Text`'s `dimColor`; absent draws as false.\n       */\n      dimColor?: boolean;\n      /**\n       * Which links a press belongs to, by `href` as written; absent, with a\n       * `press`, every link drawn. Compared with the pressed target only.\n       */\n      pressableLinks?: readonly string[];\n  };"},{"name":"MarkdownProps","kind":"type","line":5967,"doc":{"desc":["The props of `Markdown`, a block of markdown every surface draws as it","draws an assistant reply's text: its own renderer, links, tables, fences.","","A leaf: no children. `text` is the element's data as a `Text`'s string is,","checked the same way. With `onLinkPress` the links it draws are the","plugin's to answer: a press on one raises `ui.press` addressed to `key`."],"params":[],"example":[],"returns":[]},"text":"  export type MarkdownProps = {\n      /**\n       * The element's address: `e.element` at `ui.press`, what a matcher names.\n       * Required with `onLinkPress`, since a press needs one; else optional.\n       */\n      key?: string;\n      /**\n       * The markdown drawn, as an assistant reply would write it; a `<context>`\n       * block, hidden in a reply's own text, is drawn here as written.\n       *\n       * Of any length (one drawing draws 100000 characters in all), tab and\n       * newline its only control characters; a link not `https:`, `http:` or\n       * `file:` draws as text. The terminal refuses it by the question dialog.\n       */\n      text: string;\n      /**\n       * The whole block dim, as `Text`'s `dimColor`: a thought, an aside.\n       */\n      dimColor?: boolean;\n      /**\n       * What a press on a link in `text` runs, in the plugin's own environment:\n       * the bottom of a `ui.press` chain whose `e.link` names the link.\n       *\n       * A press is a plain single click where the surface reports clicks (the\n       * fullscreen terminal): it opens nothing and lands once no double-click\n       * followed; a ctrl, alt or terminal-kept cmd click opens it as before.\n       */\n      onLinkPress?: (link: PressedLink, e: UiPressArgument) => void;\n      /**\n       * Which links in `text` a press belongs to, by `href` as the markdown\n       * writes it; absent, every link drawn. Only with `onLinkPress`.\n       *\n       * A link left out keeps the surface's own behaviour. At most 256 entries\n       * of at most 2048 characters, compared with the pressed link's target;\n       * none where the drawing has no room left for them.\n       */\n      pressableLinks?: readonly string[];\n  };"},{"name":"MatchedEvent","kind":"type","line":6010,"doc":{"desc":["The argument a matched hook receives: `e` narrowed by `M` (Narrowed), per","event the registration covers."],"params":[],"example":[],"returns":[]},"text":"  export type MatchedEvent<P extends Pattern, M> = MatchedNames<P, M> extends infer N extends EventName ? N extends unknown ? Narrowed<Args<N>, M> : never : never;"},{"name":"MatchedHook","kind":"type","line":6020,"doc":{"desc":["The hook `on(pattern, matcher, hook)` takes: `($, e, next)` with `e`","narrowed by the matcher (MatchedEvent), and a tagged result the same way.","","On a streaming event it is the generator form (MatchedStreamHook). `next`","takes the variants the matcher keeps, as declared (KeptEvent); `next.is`","names the events the registration covers and narrows as the matcher does."],"params":[],"example":[],"returns":[]},"text":"  export type MatchedHook<P extends Pattern, M> = P extends StreamingEventName ? MatchedStreamHook<P, M> : ($: EngineInterface, e: Frozen<MatchedEvent<P, M>>, next: Next<MatchedNames<P, M>, KeptEvent<P, M>, MatchedResult<P, M>, {\n      [K in MatchedNames<P, M>]: Narrowed<Args<K>, M>;\n  }>) => MatchedResult<P, M> | Promise<MatchedResult<P, M>>;"},{"name":"MatchedNames","kind":"type","line":6032,"doc":{"desc":["The events a matched registration on `P` covers: the event named, or for a","glob every selected event whose input has each key the matcher names.","","Settled by `infer`: while `P` is open the compiler reads them as EventName","and selects nothing; a type keyed by them is worked out once, for the `P`","a registration gives."],"params":[],"example":[],"returns":[]},"text":"  type MatchedNames<P, M = never> = (P extends EventName ? P : {\n      [N in Selected<P & string>]: [M] extends [never] ? N : keyof M extends AnyKeyOf<Args<N>> ? N : never;\n  }[Selected<P & string>]) extends infer Names extends EventName ? Names : never;"},{"name":"MatchedResult","kind":"type","line":6040,"doc":{"desc":["What a matched hook returns: the event's result, narrowed by `M` where the","result is a union tagged by the matcher's tag keys."],"params":[],"example":[],"returns":[]},"text":"  export type MatchedResult<P extends Pattern, M> = MatchedNames<P, M> extends infer N extends EventName ? N extends unknown ? Select<EventResult<N>, Selection<Args<N>, M>> : never : never;"},{"name":"MatchedStreamHook","kind":"type","line":6046,"doc":{"desc":["The hook `on(event, matcher, hook)` takes on a streaming event: the","generator form, `e` narrowed by the matcher, `next(e)` the stream beneath."],"params":[],"example":[],"returns":[]},"text":"  export type MatchedStreamHook<P extends StreamingEventName, M> = ($: EngineInterface, e: Frozen<MatchedEvent<P, M>>, next: MatchedStreamNext<P, M>) => StreamHookBody<Chunk<P>, MatchedResult<P, M>>;"},{"name":"MatchedStreamNarrowings","kind":"type","line":6052,"doc":{"desc":["What a matched streaming hook's `next.is(pattern, e)` narrows `e` to:","the streaming event's argument narrowed by the matcher."],"params":[],"example":[],"returns":[]},"text":"  type MatchedStreamNarrowings<P extends StreamingEventName, M> = {\n      [K in P]: Narrowed<Args<K>, M>;\n  };"},{"name":"MatchedStreamNext","kind":"type","line":6060,"doc":{"desc":["A matched streaming hook's `next`: the variants the matcher keeps, the","result tagged the same way, `next.is` narrowing as the matcher does."],"params":[],"example":[],"returns":[]},"text":"  type MatchedStreamNext<P extends StreamingEventName, M> = StreamNext<P, KeptEvent<P, M>, MatchedResult<P, M>, MatchedStreamNarrowings<P, M>>;"},{"name":"Matcher","kind":"type","line":6070,"doc":{"desc":["What `on(event, matcher, hook)` takes for an argument of type `I`: the","shape of the `e` the hook wants, a partial of it at any depth.","","A leaf is `===` or a RegExp (`{ command: /^p4 / }`); an array is any-of;","an object is a partial of an OBJECT, so `{ command: { startsWith } }` is","a type error where `e` is typed and free where it is `unknown`."],"params":[],"example":[],"returns":[]},"text":"  export type Matcher<I, All = I> = I extends unknown ? {\n      readonly [K in KnownKeys<I>]?: MatcherValue<I[K & keyof I], MatcherValueOf<All, K>>;\n  } & (string extends keyof I ? OpenMatcher<I, All> : unknown) : never;"},{"name":"MatcherData","kind":"type","line":6082,"doc":{"desc":["Any matcher at all, for a field typed `unknown` (a tool's input, a","result's output): the kinds the engine accepts, unchecked there.","","The four kinds: a scalar is `===`; a RegExp tests the value as a string","(`{ command: /^p4 / }`); an array matches if any element does; an object","is a partial of an object. `{ startsWith: 'p4' }` never matches a string."],"params":[],"example":[],"returns":[]},"text":"  type MatcherData = string | number | boolean | null | RegExp | readonly MatcherData[] | {\n      readonly [key: string]: MatcherData;\n  };"},{"name":"MatcherFor","kind":"type","line":6094,"doc":{"desc":["The matcher type per pattern: a Matcher of the `e` of the event named, or","of each event a glob or a negation selects.","","Settled by `infer`: while `P` is open the bound reads as `unknown`; once","`P` is known it is that Matcher exactly. A mistake on a name is refused","where it is written; a pattern takes what any event it selects takes."],"params":[],"example":[],"returns":[]},"text":"  type MatcherFor<P extends Pattern> = Matcher<Args<MatchedNames<P>>> extends infer Settled ? Settled : never;"},{"name":"MatcherKeys","kind":"type","line":6099,"doc":{"desc":["The declared keys of every variant of `I` (index signatures aside)."],"params":[],"example":[],"returns":[]},"text":"  type MatcherKeys<I> = I extends unknown ? KnownKeys<I> : never;"},{"name":"MatcherOne","kind":"type","line":6109,"doc":{"desc":["What matches one value of type `V`, by the runtime's kinds:","a scalar leaf takes the value or a RegExp; an object, a partial of it.","","For an array, what matches one ELEMENT of it, since a pattern against an","array value holds when some element matches; for `unknown`, any matcher.","A scalar matches by `===`, a RegExp tests the value as a string."],"params":[],"example":[],"returns":[]},"text":"  type MatcherOne<V> = unknown extends V ? MatcherData : V extends readonly (infer Item)[] ? MatcherOne<Item> : V extends string | number | boolean | null ? V | RegExp : V extends object ? Matcher<V> : V extends undefined ? never : unknown;"},{"name":"MatcherValue","kind":"type","line":6119,"doc":{"desc":["What a matcher gives a key whose value is `V` on this variant and `Across`","over every variant: one MatcherOne, or an array of them matched as one-of.","","The one-of is typed over every variant, so `{ tool: ['Bash', 'Read'] }`","types on the Bash variant; with a nested pattern beside it, the pattern is","checked against a variant the one-of names, not against each of them."],"params":[],"example":[],"returns":[]},"text":"  type MatcherValue<V, Across = V> = MatcherOne<V> | readonly MatcherOne<Across>[];"},{"name":"MatcherValueAcross","kind":"type","line":6125,"doc":{"desc":["The type of key `K` across the variants of `I` that declare it, read","variant by variant: what MatcherValueOf reads for a key as wide as `symbol`."],"params":[],"example":[],"returns":[]},"text":"  type MatcherValueAcross<I, K> = I extends unknown ? K extends KnownKeys<I> ? I[K & keyof I] : never : never;"},{"name":"MatcherValueOf","kind":"type","line":6135,"doc":{"desc":["The type of key `K` across the variants of `I` that declare it: one read","of their table by key (MatcherValues), for a key some variant declares.","","A key as wide as `symbol` is an index signature's, which the table's own","would meet with `never`: it is read variant by variant. While `I` is open","the table is left unmade, since the variants of `I` are what it is made of."],"params":[],"example":[],"returns":[]},"text":"  type MatcherValueOf<I, K> = [I] extends [unknown] ? symbol extends K ? MatcherValueAcross<I, K> : MatcherValues<I>[K & PropertyKey] : never;"},{"name":"MatcherValues","kind":"type","line":6145,"doc":{"desc":["The type of each declared key of `I` across the variants that declare it,","as one table by key: made once per `I`, then read at a key.","","Each variant gives an entry per key it declares; the entries of one key","fall into one property, their values a union. Read at a key some variant","declares."],"params":[],"example":[],"returns":[]},"text":"  type MatcherValues<I> = {\n      [Entry in I extends unknown ? {\n          [K in KnownKeys<I>]-?: [key: K, value: I[K & keyof I]];\n      }[KnownKeys<I>] : never as Entry[0]]: Entry[1];\n  } & Record<PropertyKey, never>;"},{"name":"McpConnectRefusal","kind":"type","line":6159,"doc":{"desc":["Why `$.mcp.connect` left a server unconnected, in one word; `unlisted`","too where the session's host runs the plugin's servers itself.","","`unlisted`: not in the caller's own manifest. `unapproved`: a repository","server not approved. `disabled`: turned off. `policy`: enterprise MCP","policy. `auth`: needs sign-in. `failed`: not resolved, or did not connect."],"params":[],"example":[],"returns":[]},"text":"  type McpConnectRefusal = 'unlisted' | 'unapproved' | 'disabled' | 'policy' | 'auth' | 'failed';"},{"name":"McpConnectResult","kind":"type","line":6168,"doc":{"desc":["What `$.mcp.connect` resolves to and what an `mcp.connect` hook's","`{ value }` holds: the server connected, or why not."],"params":[],"example":["const browser = await $.mcp.connect(\"browser\")"],"returns":[]},"text":"  type McpConnectResult = {\n      /**\n       * True: the server is connected and its tools are the session's.\n       */\n      isConnected: true;\n      /**\n       * The name /mcp lists it under and `$.mcp.call` takes: usually\n       * `plugin:<plugin>:<server>`.\n       *\n       * Or the name the session already runs the same server under.\n       */\n      server: string;\n  } | {\n      /**\n       * False: the server is not connected.\n       */\n      isConnected: false;\n      /**\n       * Why, in one word.\n       */\n      reason: McpConnectRefusal;\n      /**\n       * The same as one plain sentence, to log or toast.\n       */\n      message: string;\n  };"},{"name":"McpContentBlock","kind":"type","line":6198,"doc":{"desc":["One block of an MCP result: `type` and the fields that kind of block carries."],"params":[],"example":[],"returns":[]},"text":"  export type McpContentBlock = {\n      /**\n       * The block's kind: `text`, `image`, `audio`, `resource`, `resource_link`.\n       */\n      type: string;\n      /**\n       * Set on a `text` block.\n       */\n      text?: string;\n      /**\n       * Set on a `resource_link` (or embedded `resource`) block.\n       */\n      uri?: string;\n      /**\n       * Declared by an image, audio or resource block.\n       */\n      mimeType?: string;\n      [field: string]: unknown;\n  };"},{"name":"McpServerProvenance","kind":"type","line":6221,"doc":{"desc":["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."],"params":[],"example":[],"returns":[]},"text":"  type McpServerProvenance = {\n      name: string;\n      /**\n       * sdk | plugin | user | project | local | dynamic | managed | enterprise | claudeai | agent - an open set; treat unknown values as an unrecognized configured source, never as sdk.\n       */\n      source: string;\n  };"},{"name":"McpToolCallInput","kind":"type","line":6236,"doc":{"desc":["The MCP branch of a `tool.call` hook's `e` (and of `$.tool.call`'s input):","one variant per declared tool, else the loose McpToolCallInputFallback.","","`$.mcp.call(server, tool, args)` takes none of these: its parameters are","positional, the server and tool by name, then the arguments object."],"params":[],"example":[],"returns":[]},"text":"  export type McpToolCallInput = [keyof McpToolInputs] extends [never] ? McpToolCallInputFallback : {\n      [N in keyof McpToolInputs & string]: ToolInputOf<N, McpToolInputs[N] & Record<string, unknown>>;\n  }[keyof McpToolInputs & string];"},{"name":"McpToolCallInputFallback","kind":"type","line":6251,"doc":{"desc":["The `e` a `tool.call` (or `classic.PreToolUse`) hook receives for an MCP","tool while no MCP tool is declared: every `mcp__*` name, loose arguments.","","McpToolInputs has no entries until a type root's MCP entry declares the","connected tools; also the `input` of `$.tool.call({ tool:","\"mcp__<server>__<tool>\", ... })`. Not `$.mcp.call`'s, which is positional:"],"params":[],"example":["on(\"tool.call\", { tool: \"mcp__gh__issue\" }, ($, e, next) => audit(e.title))"],"returns":[]},"text":"  type McpToolCallInputFallback = {\n      /**\n       * The name of the tool being called (`mcp__<server>__<tool>`); comparing\n       * it narrows `e`. Reserved: a rewrite of it is ignored by core.\n       */\n      tool: McpToolName;\n      /**\n       * The tool_use block's id: the same at every event of the call and in\n       * `$.ui.notice`. Reserved: a rewrite of it is ignored by core.\n       */\n      tool_use_id: string;\n      [argument: string]: unknown;\n  };"},{"name":"McpToolInputs","kind":"interface","line":6276,"doc":{"desc":["The inputs of the MCP tools this project knows, keyed by full tool name,","for declaration merging; empty by default, then every MCP tool is loose.","","A `.d.ts` in the author's project (the type root's MCP entry, laid from","the connected servers' JSON Schemas, or one written by hand) adds entries","under `declare module \"claude-code\"`; `e.tool === <name>` narrows to them."],"params":[],"example":["interface McpToolInputs { \"mcp__my_server__send\": { to: string } }"],"returns":[]},"text":"  export interface McpToolInputs {\n  }"},{"name":"McpToolName","kind":"type","line":6282,"doc":{"desc":["The name of an MCP tool as the engine spells it: `mcp__<server>__<tool>`."],"params":[],"example":[],"returns":[]},"text":"  export type McpToolName = `mcp__${string}__${string}`;"},{"name":"McpToolResult","kind":"type","line":6287,"doc":{"desc":["An MCP tools/call result as the SDK returns it, plain data."],"params":[],"example":[],"returns":[]},"text":"  export type McpToolResult = {\n      /**\n       * The result's content blocks, in order (text, image, resource,\n       * resource_link, ...).\n       */\n      content: McpContentBlock[];\n      /**\n       * True when the server reported the call as failed; the blocks then describe\n       * the error.\n       */\n      isError: boolean;\n      /**\n       * The server's structured result, when its tool declares an output schema.\n       */\n      structuredContent?: unknown;\n  };"},{"name":"MemberOfFunction","kind":"type","line":6311,"doc":{"desc":["`memberOf(family, e)`: the member of a family for the instance being","drawn, keyed by `e.requestId`; of an atom over a family, that member's."],"params":[],"example":["const open = await read($, memberOf(isOpen, e))"],"returns":[]},"text":"  export type MemberOfFunction = {\n      <T>(family: Atom<T>, e: Pick<RenderInput, 'requestId'>): Atom<T>;\n      <P extends string, K extends string>(family: StateName<P, K>, e: Pick<RenderInput, 'requestId'>): StateName<P, K> & Readonly<Required<Pick<StateAddress, 'id'>>>;\n  };"},{"name":"MessageDisplayHookInput","kind":"type","line":6319,"doc":{"desc":["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."],"params":[],"example":[],"returns":[]},"text":"  type MessageDisplayHookInput = BaseHookInput & {\n      hook_event_name: 'MessageDisplay';\n      /**\n       * UUID of the current turn.\n       */\n      turn_id: string;\n      /**\n       * UUID of the assistant message being displayed. Stable across every flush of the same message. Not the API msg_... id.\n       */\n      message_id: string;\n      /**\n       * Zero-based index of this delta within the message. Increments by one per flush.\n       */\n      index: number;\n      /**\n       * True on the message's last flush. Exactly one flush per message has it.\n       */\n      final: boolean;\n      /**\n       * The newly completed lines since the prior flush. Always whole lines, except on the final flush which may end mid-line. The delta of the final flush is empty when the message ends on a newline; treat final as the end-of-message signal regardless.\n       */\n      delta: string;\n  };"},{"name":"ModelApiError","kind":"type","line":6351,"doc":{"desc":["Which kind of API failure ended a model call (a completion, a fork), in","the word Claude Code classifies every API error with (StopFailure's).","","`rate_limit`, `overloaded` and `server_error` may clear on their own;","`authentication_failed`, `billing_error`, `invalid_request`,","`model_not_found` will not; `unknown` fits none of the named kinds."],"params":[],"example":[],"returns":[]},"text":"  export type ModelApiError = ClassicHookInputs['StopFailure']['error'];"},{"name":"ModelCompleteInput","kind":"type","line":6364,"doc":{"desc":["What a hook on `model.complete` reads as `e`: the request with its text as","strings, as it always was, and the caller's blocks beside them.","","A hook written when `prompt` was only ever a string reads what it read. A","caller's list of blocks arrives joined in `prompt` (or `system`) and, as","given, in `promptBlocks` (or `systemBlocks`), where its cache marks are."],"params":[],"example":["on(\"model.complete\", ($, e, next) => (BAD.test(e.prompt) ? NO : next(e)))"],"returns":[]},"text":"  export type ModelCompleteInput = {\n      /**\n       * Which model answers, as the request named it (ModelCompleteRequest).\n       */\n      model: string;\n      /**\n       * The one user message, as text: a string as the caller gave it, or the\n       * texts of its blocks joined in order with nothing between them.\n       *\n       * It is what the model is sent: a hook that passes another string down\n       * has rewritten the prompt, whatever `promptBlocks` still says.\n       */\n      prompt: string;\n      /**\n       * What precedes the completion as its system prompt, as text joined as\n       * `prompt` is; absent when the caller gave none.\n       *\n       * Passing `null` or `false` down sends none.\n       */\n      system?: string;\n      /**\n       * The caller's blocks of `prompt`, as given, when it gave a list: where\n       * the cache marks are. Absent for a string.\n       *\n       * They place marks and change no text. The leading blocks whose texts,\n       * joined, still open `prompt` are sent as they stand, marks kept; what is\n       * left of `prompt` follows unmarked, so a rewritten opening keeps no mark.\n       *\n       * @remarks A hook that strips or adds a `cache` here and leaves the texts\n       *   is taken at its word; one that rewrites both keeps them in step.\n       * @example\n       * next({ ...e, prompt: e.prompt + NOTE }) // the marks ahead of NOTE hold\n       */\n      promptBlocks?: readonly ModelTextBlock[];\n      /**\n       * The caller's blocks of `system`, read against `system` exactly as\n       * `promptBlocks` is against `prompt`. Absent for a string or none.\n       */\n      systemBlocks?: readonly ModelTextBlock[];\n      /**\n       * The reply's token cap, as the request gave it.\n       */\n      maxTokens?: number;\n      /**\n       * How hard the model thinks about it, as the request gave it.\n       */\n      effort?: ModelEffort;\n      /**\n       * How long the whole call may take, in milliseconds, as the request gave\n       * it.\n       */\n      timeoutMs?: number;\n  };"},{"name":"ModelCompleteOptions","kind":"type","line":6422,"doc":{"desc":["Options of `$.model.complete`: what is no part of the request, so no hook","on `model.complete` reads it on `e`."],"params":[],"example":[],"returns":[]},"text":"  export type ModelCompleteOptions = {\n      /**\n       * Aborting it cuts the call while it runs: it resolves `aborted`, as when\n       * its dispatch is aborted. Already aborted, no request is made.\n       *\n       * The plugin's own (`new AbortController()`), kept where a later handler\n       * reaches it, so a Cancel button stops a call an earlier press started;\n       * it never leaves the plugin's environment, only its firing does.\n       *\n       * @example\n       * const r = await $.model.complete(ask, { signal: stop.signal })\n       */\n      signal?: AbortSignal;\n  };"},{"name":"ModelCompleteRequest","kind":"type","line":6440,"doc":{"desc":["What `$.model.complete` takes."],"params":[],"example":[],"returns":[]},"text":"  export type ModelCompleteRequest = {\n      /**\n       * An alias (`haiku`) or a full model id; resolved and allowlist-checked like\n       * a `--model` value.\n       */\n      model: string;\n      /**\n       * The one user message: a string, or blocks of text sent in order\n       * (ModelTextBlock), any of which may be marked for the prompt cache.\n       *\n       * The result always says what happened: the reply's text and usage when\n       * the model answered, else a `reason` (an API error with its status, a\n       * reply with no text, or the call cut short).\n       *\n       * @remarks Marks go uncounted: one too many is the API's own `api-error`\n       *   (status 400). A hook reads the text joined (ModelCompleteInput).\n       * @example\n       * await $.model.complete({ model, prompt: [{ text: RULES, cache: true }] })\n       */\n      prompt: string | readonly ModelTextBlock[];\n      /**\n       * Precedes the completion as its system prompt, after the CLI's identity\n       * block: a string, or blocks of text as `prompt` takes. Default none.\n       *\n       * @remarks On Bedrock, Vertex, Foundry or behind a gateway, text marked here\n       *   is found again only while `prompt` opens the same: mark it there.\n       */\n      system?: string | readonly ModelTextBlock[];\n      /**\n       * The reply's token cap: any positive integer up to what one reply can\n       * hold, the model's own output limit or 64000, whichever is lower.\n       *\n       * Default 1024. The reply comes back whole, not streamed, and a provider\n       * ends such a request at ten minutes, hence the 64000. One past the limit\n       * is refused, naming it.\n       */\n      maxTokens?: number;\n      /**\n       * How hard the model thinks about it (ModelEffort): `low` for a cheap\n       * label, `max` for a hard judgment. Default: the model's own.\n       *\n       * Sent as the request's effort where the model takes one and dropped\n       * where it does not, as the session's own requests do; a value outside\n       * the five levels is refused.\n       *\n       * @example\n       * await $.model.complete({ model: \"haiku\", prompt, effort: \"low\" })\n       */\n      effort?: ModelEffort;\n      /**\n       * How long the whole call may take, in milliseconds, before it resolves\n       * `aborted` and the request is abandoned; default none.\n       *\n       * A `$` call's time never counts against the calling hook's budget, so this\n       * is how a hook bounds the completion itself, by the clock. A positive whole\n       * number, held to what a timer holds (2147483647); anything else is refused.\n       *\n       * @example\n       * await $.model.complete({ model: \"haiku\", prompt, timeoutMs: 8000 })\n       */\n      timeoutMs?: number;\n  };"},{"name":"ModelCompleteResult","kind":"type","line":6514,"doc":{"desc":["What one model call resolves to: the reply when the model answered","(`isAnswered`), else which of three things left it without text (`reason`).","","`$.model.complete`'s result whole, and `$.model.fork`'s once it had","something to fork. What the provider did never rejects the call, so a","plugin branches on `isAnswered` and `reason`; `usage` rides every arm."],"params":[],"example":["const r = await $.model.complete(ask); if (!r.isAnswered) log(r.reason)"],"returns":[]},"text":"  export type ModelCompleteResult = {\n      /**\n       * True: the model answered; `text` and `usage` are its reply.\n       *\n       * @example\n       * if (r.isAnswered) spent += r.usage.output_tokens\n       */\n      isAnswered: true;\n      /**\n       * The reply's text: a completion's text blocks joined; on a fork, the\n       * non-error replies' text joined by newlines.\n       */\n      text: string;\n      /**\n       * What the call cost (ModelUsage); on a fork its completions summed.\n       *\n       * On a fork `cache_read_input_tokens` is how much of the transcript\n       * the main thread's prompt cache served: near zero, the fork paid for\n       * the whole prefix (the entry lapsed, the model changed since, or its\n       * `effort` could not ride its own message: ModelForkRequest).\n       */\n      usage: ModelUsage;\n      /**\n       * On a fork, the effort its last response was asked for: what the\n       * request's `effort` came to under its limits, or the session's own\n       * level when it named none. The level stated after `prompt` where the\n       * model takes effort per message, else the request's own setting. A\n       * completion's result carries none.\n       *\n       * Absent too when the fork's request carried no named level: a model\n       * that takes none, `CLAUDE_CODE_EFFORT_LEVEL` set to `auto` or `unset`\n       * with no `maxEffortLevel` setting, or a fork that ran as if it had named\n       * none in a session on a numeric level.\n       *\n       * @example\n       * if (r.isAnswered) $.ui.log(`${r.effort}: ${r.usage.output_tokens}`)\n       */\n      effort?: ModelEffort;\n  } | {\n      isAnswered: false;\n      /**\n       * The API answered with an error and no reply carried text.\n       *\n       * @example\n       * if (!r.isAnswered && r.reason === \"api-error\") retry(r.status)\n       */\n      reason: 'api-error';\n      /**\n       * The error reply's HTTP status (429, 500, 529, ...); null when no\n       * response arrived at all (a dropped connection, a provider timeout).\n       */\n      status: number | null;\n      /**\n       * Which kind of failure, as Claude Code classifies API errors; never\n       * the error's text or body.\n       *\n       * `rate_limit`, `overloaded`, `invalid_request`,\n       * `authentication_failed`, `server_error`, ...; `unknown` when it fits\n       * none of the named kinds.\n       */\n      error: ModelApiError;\n      /**\n       * What the call cost before it failed: all zeros for a completion (its\n       * one request was the one refused); on a fork, the turns before it.\n       */\n      usage: ModelUsage;\n      /**\n       * On a fork, the effort of the last response before the error, as on\n       * the answered arm; absent when its first request was the one refused.\n       */\n      effort?: ModelEffort;\n  } | {\n      isAnswered: false;\n      /**\n       * The model replied and its reply carried no text.\n       *\n       * A completion whose content held no text block, or a fork answered\n       * with a tool attempt alone (denied, as every fork tool is) or nothing.\n       *\n       * @example\n       * if (!r.isAnswered && r.reason === \"empty-reply\") $.ui.log(\"no words\")\n       */\n      reason: 'empty-reply';\n      /**\n       * What the call cost.\n       */\n      usage: ModelUsage;\n      /**\n       * On a fork, the effort of its last response, as on the answered arm.\n       */\n      effort?: ModelEffort;\n  } | {\n      isAnswered: false;\n      /**\n       * The call was cut before a reply came; whatever had come back is\n       * discarded.\n       *\n       * The dispatch that made the call was aborted while it ran (escape on\n       * the turn whose hook called; the plugin's environment unloaded), or a\n       * completion's own `options.signal` aborted or `timeoutMs` elapsed.\n       *\n       * @example\n       * if (!r.isAnswered && r.reason === \"aborted\") return next(e)\n       */\n      reason: 'aborted';\n      /**\n       * What the call cost before it was cut: all zeros for a completion (no\n       * response arrived); on a fork, what came back before the abort.\n       */\n      usage: ModelUsage;\n      /**\n       * On a fork, the effort of the last response that had started, as on\n       * the answered arm; absent when none had.\n       */\n      effort?: ModelEffort;\n  };"},{"name":"ModelEffort","kind":"type","line":6637,"doc":{"desc":["How hard a request asks the model to think, by the levels the engine and","`turn.step` name: `low` to `max`, `xhigh` between `high` and `max`.","","A model that takes no effort setting is sent none, whatever is asked."],"params":[],"example":[],"returns":[]},"text":"  export type ModelEffort = 'low' | 'medium' | 'high' | 'xhigh' | 'max';"},{"name":"ModelForkRequest","kind":"type","line":6642,"doc":{"desc":["What `$.model.fork` takes."],"params":[],"example":[],"returns":[]},"text":"  export type ModelForkRequest = {\n      /**\n       * The one user message, appended to the session's own transcript as the\n       * main thread last sent it.\n       *\n       * The result always says what happened: the reply's text and usage when\n       * the fork answered, else a `reason` (nothing to fork yet, an API error\n       * with its status, a reply with no text, or the turn's abort cut it).\n       */\n      prompt: string;\n      /**\n       * How hard the fork thinks about it (ModelEffort): `low` for a quick side\n       * job, whatever the person chose for the main work. Default: the level the\n       * session runs at, which is the main thread's and no ceiling: a fork may ask\n       * for more. Where the model does not take effort per message, a level other\n       * than the session's costs a cache write of the whole conversation: see the\n       * remarks.\n       *\n       * Held to what the person and the organization allow: the organization's\n       * cap, the `maxEffortLevel` setting and the model's own levels lower what is\n       * asked, and a model that takes no effort is sent none. A level that\n       * `CLAUDE_CODE_EFFORT_LEVEL` names is a ceiling: a fork may go under it, and\n       * one that asks for more runs as if it had named none, as every fork does\n       * where that variable is `auto` or `unset` (the session then sends no effort,\n       * or under a `maxEffortLevel` setting the model's default). The result's\n       * `effort` is what was sent. A value outside the five levels rejects the\n       * call. The main thread keeps its own level, and its next request and its\n       * cache entry are as after any fork.\n       *\n       * @remarks What a level other than the main thread's costs turns on how\n       *   the model takes effort. Per message: the level is stated after\n       *   `prompt`, everything before it stands as the main thread sent it, and\n       *   the cached transcript is read as for any fork. As one setting of the\n       *   whole request (a model or provider with no per-message effort, a\n       *   conversation whose per-message effort the API refused, a session on a\n       *   numeric level): the level is applied all the same, but the first fork\n       *   at it reads at most the system prompt and tools from the cache and\n       *   writes the whole conversation again as an entry of its own, billed as\n       *   `usage.cache_creation_input_tokens` and waited for, the longer the\n       *   conversation the longer; later forks at that level read that entry\n       *   while it lives. The main thread's entry stands. There are two ways\n       *   round that cost. The person can have the session's model take effort per\n       *   message, with `CLAUDE_CODE_MODEL_CAPABILITIES=per_turn_effort` in their\n       *   shell or in the `env` of their user or managed settings: first-party API\n       *   only, and until the API refuses it. Or the fork can name no effort and\n       *   ask for haste in `prompt` (that it has no tools, and should answer\n       *   straight away without thinking it over), which moves nothing ahead of\n       *   `prompt`, so the cache is read on every model.\n       * @example\n       * await $.model.fork({ prompt: \"Say that again, shorter.\", effort: \"low\" })\n       */\n      effort?: ModelEffort;\n  };"},{"name":"ModelForkResult","kind":"type","line":6707,"doc":{"desc":["What `$.model.fork` resolves to: a completion's result (ModelCompleteResult)","or that there was nothing to fork yet.","","The completion's arms are the reply when the fork answered, else","`api-error`, `empty-reply` or `aborted`, `usage` on each and beside it,","once a response came back at a named level, the `effort` it ran at."],"params":[],"example":["const r = await $.model.fork({ prompt }); if (!r.isAnswered) log(r.reason)"],"returns":[]},"text":"  export type ModelForkResult = ModelCompleteResult | {\n      isAnswered: false;\n      /**\n       * Nothing to fork, so no request was made: the session holds no\n       * snapshot of this conversation's main thread that a fork may share.\n       *\n       * Until a turn has run to its end, that is while none of its requests\n       * is out, and on a host that keeps none; again after a `/clear`, or a\n       * resume that starts the conversation afresh.\n       *\n       * @example\n       * if (!r.isAnswered && r.reason === \"nothing-to-fork\") return next(e)\n       */\n      reason: 'nothing-to-fork';\n  };"},{"name":"ModelTextBlock","kind":"type","line":6733,"doc":{"desc":["One block of text in a `$.model.complete` request's `prompt` or `system`:","sent as written, in the order given, and markable for the prompt cache.","","Put the text every call repeats first and mark its last block (`cache`);","whatever follows the last mark is paid for whole on every call."],"params":[],"example":["const prompt = [{ text: RULES, cache: true }, { text: diff }]"],"returns":[]},"text":"  export type ModelTextBlock = {\n      /**\n       * The block's text, sent as written; an empty one is the API's to\n       * refuse, as an `api-error` of status 400.\n       */\n      text: string;\n      /**\n       * Keeps the request up to and including this block in the prompt cache; a\n       * call within five minutes that opens with the same text reads it there.\n       *\n       * The result's `usage` shows it: `cache_creation_input_tokens` when the\n       * call wrote, `cache_read_input_tokens` when it read. Both zero, nothing\n       * was cached: text under the model's minimum, or caching switched off.\n       *\n       * @remarks On Bedrock, Vertex, Foundry or behind a gateway the text is found\n       *   again only while `prompt` opens the same way: put the fixed text first.\n       */\n      cache?: true;\n  };"},{"name":"ModelUsage","kind":"type","line":6768,"doc":{"desc":["What one model call cost, as the API counted it: the four token counts in","the API's spelling, summed over the call's responses when it made several.","","The one shape every place that reports a call's cost uses:","`$.model.complete`'s result on every arm and `$.model.fork`'s on each arm","where a request was made (ModelCompleteResult), `session.compact`'s result","when core ran the summarizer, `turn.step` and `turn.complete` (TurnUsage,","which adds the `model` that answered), and the context breakdown's","`apiUsage` (the live window's last response). All four counts are always","present; a count the response left out reads as zero."],"params":[],"example":["const r = await $.model.complete(ask); if (r.isAnswered) spend(r.usage)"],"returns":[]},"text":"  export type ModelUsage = {\n      /**\n       * Uncached input tokens the call was answered over: the part of the\n       * prompt neither read from nor written to the prompt cache.\n       */\n      input_tokens: number;\n      /**\n       * Tokens the call generated.\n       */\n      output_tokens: number;\n      /**\n       * Input tokens the prompt cache served.\n       *\n       * On a fork, how much of the main thread's transcript the cache still\n       * held: near zero, the fork paid for the whole prefix (the entry had\n       * lapsed, the model changed since it was made, or the fork's `effort`\n       * could not ride its own message: ModelForkRequest).\n       */\n      cache_read_input_tokens: number;\n      /**\n       * Input tokens the call wrote to the prompt cache.\n       */\n      cache_creation_input_tokens: number;\n  };"},{"name":"Namespace","kind":"type","line":6797,"doc":{"desc":["The prefixes a glob may name: one or more whole leading segments of an","event name (`tool` of `tool.call`), derived, plugin nouns included."],"params":[],"example":[],"returns":[]},"text":"  export type Namespace<N extends string = EventName> = N extends `${infer Head}.${infer Rest}` ? Head | `${Head}.${Namespace<Rest>}` : never;"},{"name":"NarrowDepth","kind":"type","line":6805,"doc":{"desc":["How many object or array levels a matcher narrows `e` through, counted as","a tuple's length: the runtime's own limit, which refuses a deeper matcher.","","Past it a field keeps its declared type; nothing becomes `any`."],"params":[],"example":[],"returns":[]},"text":"  type NarrowDepth = 8;"},{"name":"Narrowed","kind":"type","line":6815,"doc":{"desc":["`e` in a matched hook: the members of the argument union `E` matcher `P`","can match, each with the keys `P` names narrowed to what a match implies.","","A scalar narrows to the literal, a one-of to what its alternatives give,","an object key recursively, an array some element of which must match to","a non-empty tuple; other keys, `unknown` and RegExp-matched fields keep."],"params":[],"example":[],"returns":[]},"text":"  export type Narrowed<E, P> = E extends unknown ? NarrowedMember<E, P, []> : never;"},{"name":"NarrowedByAny","kind":"type","line":6825,"doc":{"desc":["A value of declared type `V` under a one-of, folded over the tuple into","`Found`: the union of what each alternative narrows `V` to (NarrowedByOne).","","An alternative that cannot match adds nothing, so a one-of none of whose","alternatives can is `never`; a one-of typed as a plain array rather than","a tuple narrows by the union of its elements at once."],"params":[],"example":[],"returns":[]},"text":"  type NarrowedByAny<V, Alternatives extends readonly unknown[], D extends readonly unknown[], Found = never> = Alternatives extends readonly [infer First, ...infer Rest] ? NarrowedByAny<V, Rest, D, Found | NarrowedByOne<V, First, D>> : Alternatives extends readonly [] ? Found : Found | NarrowedByOne<V, Alternatives[number], D>;"},{"name":"NarrowedByOne","kind":"type","line":6835,"doc":{"desc":["A value of declared type `V` under one matcher node `Q` that is not a","one-of, member of `V` by member; a member that cannot match is `never`.","","An array some element of which must match becomes NonEmpty; a RegExp","keeps the member; an object pattern recurses into an object member, one","level down; a scalar keeps a member as narrow, and replaces a wider one."],"params":[],"example":[],"returns":[]},"text":"  type NarrowedByOne<V, Q, D extends readonly unknown[]> = V extends readonly (infer Item)[] ? [NarrowedValue<Item, Q, [...D, unknown]>] extends [never] ? never : NonEmpty<V, Item> : Q extends RegExp ? V : Q extends object ? V extends object ? NarrowedMember<V, Q, [...D, unknown]> : never : V extends Q ? V : Q extends V ? Q : never;"},{"name":"NarrowedMember","kind":"type","line":6844,"doc":{"desc":["One object member `E` under object pattern `P`, `D` levels down: `never`","when a key of `P` is impossible on it (ImpossibleKeys), else `E` narrowed.","","Each key `P` names is narrowed (NarrowedValue); every other key, and each","key's optionality, stays as declared."],"params":[],"example":[],"returns":[]},"text":"  type NarrowedMember<E, P, D extends readonly unknown[]> = [\n  ImpossibleKeys<E, P, D>"},{"name":"NarrowedValue","kind":"type","line":6857,"doc":{"desc":["A value of declared type `V` where the matcher gives `Q`, `D` levels","down: NarrowedByAny under a one-of (an array), NarrowedByOne otherwise.","","As declared once `D` reaches NarrowDepth, or for a field typed `unknown`","(a tool's input), which no pattern narrows."],"params":[],"example":[],"returns":[]},"text":"  type NarrowedValue<V, Q, D extends readonly unknown[]> = D['length'] extends NarrowDepth ? V : unknown extends V ? V : Q extends readonly unknown[] ? NarrowedByAny<V, Q, D> : NarrowedByOne<V, Q, D>;"},{"name":"Negation","kind":"type","line":6866,"doc":{"desc":["`!` before a name or a glob: every event except the ones it selects. `!*`","would select none, so it is no pattern.","","It names no event, so like `*` it selects no telemetry event for an","installed plugin: those are hooked by name."],"params":[],"example":[],"returns":[]},"text":"  type Negation = `!${Exclude<EventName | Glob, '*'>}`;"},{"name":"Next","kind":"type","line":6881,"doc":{"desc":["The rest of the chain, as one hook receives it: made once per dispatch per","hook, frozen; `next(e)` resolves to the downstream result.","","Each call runs the hooks below again; core is the last, and below it `next`","rejects. Called with no argument it rejects, naming the hook. A hook that","returns without calling it ends the chain; returning nothing is a failure."],"params":[],"example":[],"returns":[]},"text":"  export type Next<N extends EventName = EventName, E = Args<N>, O = NextResult<N>, S extends {\n      [K in N]?: unknown;\n  } = {\n      [K in N]: Args<K>;\n  }> = {\n      <T extends string>(e: E & ToolNamed<T>): Promise<NextResultFor<N, O, T>>;\n      (e: E): Promise<O>;\n      /**\n       * Continues this dispatch at a tier: `next(e)` with every link between\n       * this hook's own tier and that one skipped, by tier and narrowing only.\n       *\n       * A managed hook's: prepend may name user, append, builtin or core, append\n       * core; it never skips a tier with more authority, so no user hook skips\n       * the org's. `user` skips each prepend peer below the hook, never one\n       * above it, and an outer `next.to` to a deeper tier still wins. A literal\n       * on the hook's own `next`; skipped links are traced.\n       */\n      readonly to: {\n          <T extends string>(e: E & ToolNamed<T>, tier: TargetTier): Promise<NextResultFor<N, O, T>>;\n          (e: E, tier: TargetTier): Promise<O>;\n      };\n      /**\n       * Aborts when the call this dispatch belongs to is abandoned: the user\n       * interrupted, a hook above settled first, or this hook ran out of budget.\n       *\n       * Anything the hook started (timers, requests) should stop on it. It is an\n       * AbortSignal of the plugin's own environment, driven by the chain's.\n       */\n      readonly signal: AbortSignal;\n      /**\n       * Whether this dispatch's event is selected by `pattern` (a name, a glob,\n       * a negation), as a type predicate on `e`: `next.is(\"tool.call\", e)`.\n       *\n       * Under a matcher the narrowing includes it. `pattern` names events this\n       * hook covers (PatternOver); a name outside them is a compile error.\n       */\n      readonly is: <M extends PatternOver<N>>(pattern: M, e: unknown) => e is Frozen<S[Extract<N, Selected<M>>]>;\n      /**\n       * The name of this dispatch's event, as a value, for a glob hook to log or\n       * switch on.\n       */\n      readonly event: N;\n      /**\n       * Who raised this dispatch: the calling plugin's name and the tier it sits\n       * in (Origin); the engine reads `{ plugin: \"engine\", tier: \"core\" }`.\n       *\n       * Set by the host alone, from the environment the call came from (its own\n       * MessagePort) and that plugin's seat; nothing a plugin writes reaches it.\n       * Every hook of one dispatch sees the same origin, and `next.to` keeps it.\n       *\n       * @example\n       * return next.origin.tier === \"prepend\" ? next.to(e, \"append\") : next(e)\n       */\n      readonly origin: Origin;\n      /**\n       * What settled beneath this hook on its latest `next()` call, the one\n       * started last: an entry per link beneath, nearest first, the engine's last.\n       *\n       * Empty before `next` is called; filled even when `next` rejected; a link\n       * still running joins in place later, nothing listed leaves; it ends short\n       * of the engine at a link that answered its last call itself. Data, frozen.\n       */\n      readonly trace: readonly TraceEntry<N, E, O>[];\n      /**\n       * How much time this hook runs under and how much is left (NextBudget),\n       * read fresh on each access; HookBudget says what the clock counts.\n       *\n       * It stands still while a `next` or `$` call of the hook's is in flight;\n       * in a `.catch` handler it is the grace, `ms` being `next.error.budget`;\n       * at `session.end` it reads the exit's one short bound, which never stops.\n       *\n       * @example\n       * if (next.budget.remainingMs < 2_000) return next(e) // skip the polish\n       */\n      readonly budget: NextBudget;\n  };"},{"name":"NextBudget","kind":"type","line":6969,"doc":{"desc":["The budget the code reading `next.budget` runs under: the whole allowance","and what is left of it now, plain data read fresh on each access.","","In a hook `ms` is HookBudget's `ms`; in a `.catch` handler its `catchMs`","(what `next.error.budget` names); on a `next` nothing meters (the engine's","own, a test's root one) `ms` is 0 and `remainingMs` Infinity."],"params":[],"example":["if (next.budget.remainingMs < 2_000) return next(e) // skip the slow path"],"returns":[]},"text":"  export type NextBudget = {\n      /**\n       * The whole budget in milliseconds; 0 where nothing meters this `next`.\n       *\n       * On a dispatch the engine cuts short as a whole (`session.end`: one short\n       * wall-clock bound for the entire chain, so an exit stays fast whatever is\n       * loaded) it is no more than that cut left when the hook started, 0 past it.\n       */\n      readonly ms: number;\n      /**\n       * What is left of it now, in milliseconds, never below 0; Infinity where\n       * nothing meters. It stands still while a `next` or `$` call is in flight.\n       *\n       * Except under a cut of the whole dispatch (`session.end`): the cut's clock\n       * never stops, `$` waits included, and this reads no more than it leaves,\n       * so a later hook in that chain starts with what the earlier ones left.\n       */\n      readonly remainingMs: number;\n  };"},{"name":"NextResult","kind":"type","line":6996,"doc":{"desc":["What `next(e)` resolves to for event `N`: the event's result, except at","`engine.create`, where the steps beneath return `$` as built so far.","","A withheld noun is on that `$` as a stub, so the built table is typed","whole where what a hook returns (EngineCreateResult) is partial."],"params":[],"example":[],"returns":[]},"text":"  export type NextResult<N extends EventName> = N extends 'engine.create' ? EngineInterfaceBuilt : EventResult<N>;"},{"name":"NextResultFor","kind":"type","line":7005,"doc":{"desc":["What `next(e)` resolves to once `e.tool` is the literal `T`: on `tool.call`","the result typed for that tool; on every other event, `O` as declared.","","`result` is Bash's record after `e.tool === \"Bash\"`; an un-narrowed `e`","names every tool, and `result` stays `unknown`."],"params":[],"example":[],"returns":[]},"text":"  export type NextResultFor<N extends EventName, O, T extends string> = [\n  N"},{"name":"NoArgs","kind":"type","line":7013,"doc":{"desc":["The argument of a call on `$` that takes nothing (`$.session.cwd()`): an","object with no keys."],"params":[],"example":[],"returns":[]},"text":"  type NoArgs = Record<never, never>;"},{"name":"NoArgsEvent","kind":"type","line":7019,"doc":{"desc":["The events whose argument is exactly NoArgs (`session.cwd`, a declared","plugin noun's `() => ...`); their overloads come last (LateOverload)."],"params":[],"example":[],"returns":[]},"text":"  type NoArgsEvent = {\n      [N in EventName]: Args<N> extends NoArgs ? NoArgs extends Args<N> ? N : never : never;\n  }[EventName];"},{"name":"NoEngineInterface","kind":"type","line":7027,"doc":{"desc":["What an `engine.create` hook receives as `$`: nothing. Every property","reads as `never`, so `$.model` inside the hook is a compile error."],"params":[],"example":[],"returns":[]},"text":"  export type NoEngineInterface = {\n      readonly [noun: string]: never;\n  };"},{"name":"NonEmpty","kind":"type","line":7038,"doc":{"desc":["Array type `V`, of element `Item`, once some element of it is known to","match: a tuple of at least one `Item`, readonly when `V` is.","","So `e` still passes wherever the declared array is taken; a `V` that is","already a non-empty tuple is kept as it is."],"params":[],"example":[],"returns":[]},"text":"  type NonEmpty<V, Item> = V extends readonly [unknown, ...unknown[]] ? V : V extends Item[] ? [Item, ...Item[]] : readonly [Item, ...Item[]];"},{"name":"NotificationHookInput","kind":"type","line":7040,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"  type NotificationHookInput = BaseHookInput & {\n      hook_event_name: 'Notification';\n      message: string;\n      title?: string;\n      notification_type: string;\n  };"},{"name":"NotifyOptions","kind":"type","line":7050,"doc":{"desc":["Options of `$.ui.notify`."],"params":[],"example":[],"returns":[]},"text":"  export type NotifyOptions = {\n      /**\n       * What heads the notification, sent as the mod gives it: the engine puts\n       * no name of its own beside it. Left out or empty, the plugin's name.\n       */\n      title?: string;\n  };"},{"name":"NounEvent","kind":"type","line":7062,"doc":{"desc":["The declared plugin nouns' methods as event rows (NounEventRow), one per","`<noun>.<method>` that is a function; a member that is not is no event."],"params":[],"example":[],"returns":[]},"text":"  type NounEvent = {\n      [K in PluginNoun]: {\n          [M in keyof EngineInterface[K] & string]: EngineInterface[K][M] extends (...args: infer Parameters) => infer Result ? NounEventRow<`${K}.${M}`, Parameters extends readonly [] ? NoArgs : Parameters[0], Awaited<Result>> : never;\n      }[keyof EngineInterface[K] & string];\n  }[PluginNoun];"},{"name":"NounEventName","kind":"type","line":7071,"doc":{"desc":["The name of a declared plugin noun's event (`voice.speak`)."],"params":[],"example":[],"returns":[]},"text":"  type NounEventName = keyof NounEventOf & string;"},{"name":"NounEventOf","kind":"type","line":7080,"doc":{"desc":["The events of the plugin nouns declared on EngineInterface, by name: the","argument of each `<noun>.<method>`. Empty until a plugin declares a noun."],"params":[],"example":["declare module \"claude-code\" { interface EngineInterface { voice: Voice } }"],"returns":[]},"text":"  export type NounEventOf = {\n      [E in NounEvent as E['name']]: E['args'];\n  };"},{"name":"NounEventResult","kind":"type","line":7088,"doc":{"desc":["The result of a declared plugin noun's event as its hooks see it:","`{ value }` (the method's answer) or `{ deny }`."],"params":[],"example":[],"returns":[]},"text":"  type NounEventResult<N extends NounEventName> = ValueOrDeny<NounValueOf[N]>;"},{"name":"NounEventRow","kind":"type","line":7094,"doc":{"desc":["One method of a declared plugin noun as an event row: its event's name,","argument (the method's first parameter) and value (its awaited result)."],"params":[],"example":[],"returns":[]},"text":"  type NounEventRow<Name extends string, Args, Value> = {\n      name: Name;\n      args: Args;\n      value: Value;\n  };"},{"name":"NounValueOf","kind":"type","line":7104,"doc":{"desc":["What each declared plugin noun's method answers (the `value` of its","event's result), by event name."],"params":[],"example":[],"returns":[]},"text":"  type NounValueOf = {\n      [E in NounEvent as E['name']]: E['value'];\n  };"},{"name":"On","kind":"type","line":7119,"doc":{"desc":["Registers `hook` on the events `pattern` selects: one by name, every one","under a namespace (`classic.*`), all (`*`), or all but some (`!tool.*`).","","One function stands on every selected event (`next.event` says which),","under a matcher for the inputs it matches; a plugin's registrations nest","in order, first outermost; a repeat throws. Returns the Registration."],"params":[],"example":[],"returns":[]},"text":"  export type On = {\n      <P extends Pattern>(pattern: P, hook: NoInfer<HookFor<P>>): Registration<HookFor<P>>;\n      <P extends Pattern, const M extends MatcherFor<P>>(pattern: P, matcher: M, hook: NoInfer<MatchedHook<P, M>>): Registration<MatchedHook<P, M>>;\n  };"},{"name":"OnScreen","kind":"type","line":7137,"doc":{"desc":["The part of a transcript message the surface that drew it has on screen:","units `first` to `last` of the message's `of`, counted from its start.","","The terminal counts the rows the site laid out, from its first (the blank","row the engine draws above a message is its row 0; a hook's tree starts at","its own); other surfaces count in their unit, so compare `first / of` there."],"params":[],"example":["if (e.props.onScreen) shown.set(e.requestId, e.props.onScreen)","  else shown.delete(e.requestId) // the band's legend lists `shown`"],"returns":[]},"text":"  type OnScreen = {\n      /**\n       * The unit inside the viewport, from 0: on the terminal, `7` when the\n       * message's top seven rows are scrolled away.\n       */\n      first: number;\n      /**\n       * The unit inside the viewport, inclusive; at least `first`.\n       */\n      last: number;\n      /**\n       * The message's whole extent in the same unit, as laid out (a hook's tree\n       * taller than the engine's counts its own rows); more than `last`.\n       *\n       * One surface's numbers say nothing of another's: what the phone shows the\n       * terminal may not, and each `ui.render` carries its own surface's.\n       */\n      of: number;\n  };"},{"name":"OpenMatcher","kind":"type","line":7164,"doc":{"desc":["The keys a variant with a string index signature (an MCP tool's input)","takes beyond its own: another variant's key as typed there; others free.","","So a misspelt value for a key some variant declares (`command: 5`) is","refused on every variant, not admitted by the open one."],"params":[],"example":[],"returns":[]},"text":"  type OpenMatcher<I, All> = {\n      readonly [K in Exclude<MatcherKeys<All>, keyof IndexFree<I>>]?: MatcherValue<MatcherValueOf<All, K>>;\n  } & Readonly<Record<string, unknown>>;"},{"name":"OpEventName","kind":"type","line":7171,"doc":{"desc":["The name of a call on `$` the host serves, as an event."],"params":[],"example":[],"returns":[]},"text":"  export type OpEventName = keyof OpEventOf;"},{"name":"OpEventOf","kind":"type","line":7184,"doc":{"desc":["The calls on `$` the host serves, as events: `e` is the call's argument as","it crosses to the host, and every one is hookable by name and by `on(\"*\")`.","","A hook above the caller passes it on, rewrites it, refuses it with","`{ deny }` or answers with `{ value }`; core is the host's implementation.","The calling hook alone is skipped, and `next.origin` names the caller."],"params":[],"example":[],"returns":[]},"text":"  export type OpEventOf = {\n      /**\n       * The argument of `$.model.complete(request, { signal })`, its text as\n       * strings and its blocks beside them (ModelCompleteInput).\n       *\n       * The signal does not cross, it aborts the call.\n       */\n      'model.complete': ModelCompleteInput;\n      /**\n       * The argument of `$.model.classify(text, labels, options)`.\n       */\n      'model.classify': {\n          text: string;\n          labels: readonly string[];\n          options?: ClassifyOptions;\n      };\n      /**\n       * The argument of `$.model.fork(request)`.\n       */\n      'model.fork': ModelForkRequest;\n      /**\n       * The clip and how to play it (`shouldLoop`, `gain`); the signal does not\n       * cross.\n       */\n      'audio.play': {\n          clip: AudioClip;\n          shouldLoop: boolean;\n          gain?: number;\n      };\n      /**\n       * The argument of `$.audio.speak(text, { voice })`.\n       */\n      'audio.speak': SpeakRequest;\n      /**\n       * The argument of `$.mcp.call(server, tool, args)`.\n       */\n      'mcp.call': {\n          server: string;\n          tool: string;\n          args: Record<string, unknown>;\n      };\n      /**\n       * The argument of `$.mcp.connect(server)`.\n       */\n      'mcp.connect': {\n          server: string;\n      };\n      /**\n       * The argument of `$.session.cwd()`.\n       */\n      'session.cwd': NoArgs;\n      /**\n       * The argument of `$.session.root()`.\n       */\n      'session.root': NoArgs;\n      /**\n       * The argument of `$.session.model()`.\n       */\n      'session.model': NoArgs;\n      /**\n       * The argument of `$.session.turns()`.\n       */\n      'session.turns': NoArgs;\n      /**\n       * The argument of `$.session.id()`.\n       */\n      'session.id': NoArgs;\n      /**\n       * The argument of `$.session.messages(args)`: `{}` for the main\n       * conversation, `{ agentId }` for one of its agents, `as` for the form.\n       */\n      'session.messages': SessionMessagesArgs;\n      /**\n       * The argument of `$.session.repo()`.\n       */\n      'session.repo': NoArgs;\n      /**\n       * The argument of `$.session.surface()`.\n       *\n       * @deprecated with `$.session.surface()`; hook `session.surfaces`\n       */\n      'session.surface': NoArgs;\n      /**\n       * The argument of `$.session.surfaces()`.\n       */\n      'session.surfaces': NoArgs;\n      /**\n       * The argument of `$.session.authorize()`.\n       */\n      'session.authorize': NoArgs;\n      /**\n       * The argument of `$.session.identity()`.\n       */\n      'session.identity': NoArgs;\n      /**\n       * The argument of `$.session.usage({ breakdown, columns })`.\n       */\n      'session.usage': SessionUsageArgs;\n      /**\n       * The argument of `$.session.version()`.\n       */\n      'session.version': NoArgs;\n      /**\n       * The argument of `$.turn.abort({ turnId })`.\n       */\n      'turn.abort': {\n          turnId: string;\n      };\n      /**\n       * The argument of `$.prompt.read()`.\n       */\n      'prompt.read': NoArgs;\n      /**\n       * The argument of `$.prompt.paint(...)`: the draft and this plugin's runs.\n       */\n      'prompt.paint': PromptPaintArgs;\n      /**\n       * The argument of `$.tool.list()`.\n       */\n      'tool.list': NoArgs;\n      /**\n       * The argument of `$.tool.register(spec)`.\n       */\n      'tool.register': RegisteredToolSpec;\n      /**\n       * The argument of `$.command.list()`.\n       */\n      'command.list': NoArgs;\n      /**\n       * The argument of `$.command.register(spec)`.\n       */\n      'command.register': CommandSpec;\n      /**\n       * The argument of `$.config.list()`.\n       */\n      'config.list': NoArgs;\n      /**\n       * The argument of `$.agent.list()`.\n       */\n      'agent.list': NoArgs;\n      /**\n       * The argument of `$.agent.register(spec)`: the agent type as the plugin\n       * defined it. A hook above rewrites any of it; the type stays the caller's.\n       */\n      'agent.register': AgentSpec;\n      /**\n       * The argument of `$.ui.toast(text, { timeoutMs })`.\n       */\n      'ui.toast': {\n          text: string;\n          timeoutMs?: number;\n      };\n      /**\n       * The argument of `$.ui.status(text)`; `text` undefined clears the line.\n       */\n      'ui.status': {\n          text: string | undefined;\n      };\n      /**\n       * The argument of `$.ui.log(text, { to })`; `to` is always present\n       * (UiLogSink), and `next({ ...e, to: \"debug\" })` keeps a line off screen.\n       */\n      'ui.log': {\n          text: string;\n          to: UiLogSink;\n      };\n      /**\n       * The argument of `$.ui.notice(tool_use_id, text)`.\n       */\n      'ui.notice': {\n          tool_use_id: string;\n          text: string | undefined;\n      };\n      /**\n       * The argument of `$.ui.invalidate(event)`.\n       */\n      'ui.invalidate': {\n          event: InvalidatableEventName;\n      };\n      /**\n       * The argument of `$.ui.open({ id, title, focus })`; a hook above the\n       * opener may retitle it or refuse it with `{ deny }`, never rename it.\n       */\n      'ui.open': PaneOpenArgs;\n      /**\n       * The argument of `$.ui.close({ id })` with `origin` `plugin`; the engine\n       * raises it too, for the person (`person`) and an unload (`unload`).\n       */\n      'ui.close': PaneCloseInput;\n      /**\n       * The argument of `$.ui.panes()`.\n       */\n      'ui.panes': NoArgs;\n      /**\n       * The argument of `$.ui.place({ id })`.\n       */\n      'ui.place': UiPlaceArgs;\n      /**\n       * The argument of `$.theme.set(attributes)`: the attributes themselves.\n       */\n      'theme.set': ThemeSetArgs;\n      /**\n       * The argument of `$.theme.clear()`.\n       */\n      'theme.clear': NoArgs;\n      /**\n       * The argument of `$.ui.selection()`.\n       */\n      'ui.selection': NoArgs;\n      /**\n       * The argument of `$.ui.copy({ text, surface })`, `surface` filled with\n       * the session's first when left out; rewritable, deniable, answerable.\n       */\n      'ui.copy': UiCopyArgs;\n      /**\n       * The argument of `$.ui.view({ agentId })`: whose transcript the main view\n       * is to show, none for the main conversation; rewritable and deniable.\n       */\n      'ui.view': SiteView;\n      /**\n       * The argument of `$.ui.notify(text, { title })`, `title` the plugin's\n       * name when left out or empty; rewritable, deniable, answerable.\n       *\n       * A notification is heard twice: here, and by `classic.Notification`\n       * hooks. Two mods that each notify again from a timer on hearing one\n       * echo each other without end: nothing in the engine stops them.\n       */\n      'ui.notify': {\n          text: string;\n          title?: string;\n      };\n      /**\n       * The argument of `$.ui.blit(...)`: a Raster's `cells` or a keyed Image's\n       * `source`; a hook above may rewrite either with `next`, or `{ deny }`.\n       */\n      'ui.blit': UiBlitArgs;\n      /**\n       * The argument of `$.fs.read(path, { as })`: `as` is `text` unless the\n       * caller asked for `bytes`.\n       */\n      'fs.read': {\n          path: string;\n          as: FsReadAs;\n      };\n      /**\n       * The argument of `$.fs.write(path, text)`.\n       */\n      'fs.write': {\n          path: string;\n          text: string;\n      };\n      /**\n       * The argument of `$.fs.list(path)`.\n       */\n      'fs.list': {\n          path: string;\n      };\n      /**\n       * The argument of `$.fs.exists(path)`.\n       */\n      'fs.exists': {\n          path: string;\n      };\n      /**\n       * The argument of `$.fs.stat(path, { resolve })`: `resolve` is false\n       * unless the caller asked where the path lands.\n       */\n      'fs.stat': {\n          path: string;\n          resolve: boolean;\n      };\n      /**\n       * The argument of `$.fs.ancestors({ names, of, below })`.\n       */\n      'fs.ancestors': FsAncestorsRequest;\n      /**\n       * The argument of `$.store.get(key)`.\n       */\n      'store.get': {\n          key: string;\n      };\n      /**\n       * The argument of `$.store.set(key, value)`.\n       */\n      'store.set': {\n          key: string;\n          value: unknown;\n      };\n      /**\n       * The argument of `$.store.delete(key)`.\n       */\n      'store.delete': {\n          key: string;\n      };\n      /**\n       * The argument of `$.store.keys()`.\n       */\n      'store.keys': NoArgs;\n      /**\n       * The argument of `$.state.get(ref)`: the reference itself, `plugin`, `key`\n       * and a family member's `id`; identity, pinned.\n       */\n      'state.get': StateGetEvent;\n      /**\n       * The argument of `$.state.set(ref, value, { ifVersion })`: the reference,\n       * the value, the condition, and `previous`, what stood there (the host's).\n       *\n       * A hook above rewrites `value` with `next({ ...e, value })`; the\n       * reference is identity, pinned. Raised by the value's owner alone. A\n       * `{ deny }` after `next(e)` was answered, a `.catch`'s too, fails the hook.\n       */\n      'state.set': StateSetEvent;\n      /**\n       * The argument of `$.clock.now()`.\n       */\n      'clock.now': NoArgs;\n      /**\n       * The argument of `$.clock.sleep(ms, { signal })`; the signal does not\n       * cross, it aborts the dispatch.\n       */\n      'clock.sleep': ClockWait;\n      /**\n       * The argument of `$.clock.after(ms, fn)`: the wait before `fn`, which\n       * stays in the plugin's environment and runs once the dispatch resolves.\n       */\n      'clock.after': ClockWait;\n      /**\n       * The argument of `$.clock.every(ms, fn)`, dispatched once per period:\n       * `fn` runs each time a dispatch resolves, and the next period is asked.\n       */\n      'clock.every': ClockWait;\n      /**\n       * The argument of `$.http.fetch(url, init)`.\n       */\n      'http.fetch': {\n          url: string;\n          init?: HttpInit;\n      };\n      /**\n       * The argument of `$.process.run(argv, init)`.\n       */\n      'process.run': {\n          argv: readonly string[];\n          init?: ProcessRunInit;\n      };\n      /**\n       * The argument of `$.process.spawn(request)`: the request itself.\n       *\n       * A hook's `{ deny }` rejects the caller's stream and lets the child go\n       * (one still running is killed). Once a child of the call handed up a\n       * piece or its exit, the rejection says it started or ran.\n       */\n      'process.spawn': ProcessSpawnRequest;\n      /**\n       * The argument of `$.settings.read({ source })`, and the layers the read\n       * is made of, which the engine fills; rewritable, deniable.\n       */\n      'settings.read': SettingsReadInput;\n      /**\n       * The argument of `$.env.get(name)`; `name` is identity, pinned.\n       */\n      'env.get': {\n          name: string;\n      };\n      /**\n       * The argument of `$.env.set(name, value)`; `name` is identity, pinned,\n       * and no `value` unsets.\n       *\n       * A `{ deny }` after `next(e)` was answered, a `.catch`'s too, fails the\n       * hook: deny in its place.\n       */\n      'env.set': {\n          name: string;\n          value?: string;\n      };\n  };"},{"name":"OpEventResult","kind":"type","line":7565,"doc":{"desc":["The result of a call on `$` as its event's hooks see it: `{ value }` (the","call's answer) or `{ deny }`."],"params":[],"example":[],"returns":[]},"text":"  export type OpEventResult<N extends OpEventName = OpEventName> = ValueOrDeny<OpValueOf[N]>;"},{"name":"OpValueOf","kind":"type","line":7571,"doc":{"desc":["What each call on `$` answers (the `value` of its event's result), by event","name."],"params":[],"example":[],"returns":[]},"text":"  export type OpValueOf = {\n      'model.complete': ModelCompleteResult;\n      'model.classify': string | undefined;\n      'model.fork': ModelForkResult;\n      'audio.play': void;\n      'audio.speak': SpeakResult;\n      'mcp.call': McpToolResult;\n      'mcp.connect': McpConnectResult;\n      'session.cwd': string;\n      'session.root': string;\n      'session.model': string;\n      'session.turns': number;\n      'session.id': string;\n      /**\n       * The conversation's messages, as rows or in Messages API form; `{ deny }`\n       * for an `agentId` the session cannot read.\n       */\n      'session.messages': SessionMessagesValue;\n      'session.repo': SessionRepo | null;\n      'session.surface': RenderSurface | null;\n      'session.surfaces': readonly RenderSurface[];\n      /**\n       * The credential handle, or null where the session holds no first-party\n       * credential (a third-party provider, a cloud gateway, no login or key).\n       */\n      'session.authorize': SessionAuthorization;\n      /**\n       * How the session is signed in and, under a pin of its organization, as\n       * whom, for a plugin managed settings install; the refusal for any other.\n       */\n      'session.identity': SessionIdentity;\n      'session.usage': SessionUsage;\n      /**\n       * The engine's version, its release, and its build time when stamped.\n       */\n      'session.version': SessionVersion;\n      'turn.abort': void;\n      /**\n       * The box as it stands; the empty box where the session draws none.\n       */\n      'prompt.read': PromptBox;\n      /**\n       * Whether the runs were painted, and the box as it stands.\n       */\n      'prompt.paint': PromptPainted;\n      'tool.list': ToolInfo[];\n      'tool.register': {\n          tool: string;\n      };\n      'command.list': CommandInfo[];\n      'command.register': {\n          command: string;\n      };\n      'config.list': ConfigRow[];\n      'agent.list': AgentInfo[];\n      'agent.register': {\n          agent: string;\n      };\n      'ui.toast': void;\n      'ui.status': void;\n      'ui.log': void;\n      'ui.notice': void;\n      'ui.invalidate': void;\n      /**\n       * Whether a surface draws the pane now, or why it waits undrawn.\n       */\n      'ui.open': UiOpenResult;\n      'ui.close': void;\n      /**\n       * The calling plugin's open panes, placed then unplaced, in open order.\n       */\n      'ui.panes': readonly UiPane[];\n      /**\n       * The row's id, or why nothing draws it.\n       */\n      'ui.place': UiPlaceResult;\n      /**\n       * The backdrop's request id, or why nothing draws it.\n       */\n      'theme.set': ThemeResult;\n      /**\n       * `isDrawn: false`, and whether a theme stood to be cleared.\n       */\n      'theme.clear': ThemeResult;\n      /**\n       * What the person last selected; `undefined` when there is nothing.\n       */\n      'ui.selection': UiSelection | undefined;\n      'ui.copy': UiCopyResult;\n      'ui.view': UiViewResult;\n      /**\n       * The channel that sent the notification, or why none did.\n       */\n      'ui.notify': UiNotifyResult;\n      'ui.blit': UiBlitResult;\n      /**\n       * The text; `{ base64 }` when asked for bytes.\n       */\n      'fs.read': string | FsBytes;\n      'fs.write': void;\n      'fs.list': FsEntry[];\n      'fs.exists': boolean;\n      'fs.stat': FsStat;\n      'fs.ancestors': readonly FsAncestor[];\n      'store.get': unknown;\n      'store.set': void;\n      'store.delete': void;\n      'store.keys': string[];\n      /**\n       * The value and the version it stands at; `undefined` at 0 when never\n       * written.\n       */\n      'state.get': StateRead;\n      /**\n       * Whether the write landed, and the version the value stands at now.\n       */\n      'state.set': StateSetResult;\n      /**\n       * Milliseconds since the epoch.\n       */\n      'clock.now': number;\n      'clock.sleep': void;\n      'clock.after': void;\n      'clock.every': void;\n      'http.fetch': HttpResponse;\n      'process.run': ProcessRunResult;\n      'process.spawn': ProcessSpawnResult;\n      'settings.read': Settings;\n      'env.get': string | undefined;\n      'env.set': EnvSetResult;\n  };"},{"name":"OrderedOverloads","kind":"type","line":7709,"doc":{"desc":["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)."],"params":[],"example":[],"returns":[]},"text":"  type OrderedOverloads<Names extends EventName> = Overloads<Exclude<Names, LateOverload>> & Overloads<Extract<Names, 'classic.PreToolUse'>> & Overloads<Extract<Names, 'turn.abort'>> & Overloads<Extract<Names, NoArgsEvent>>;"},{"name":"Origin","kind":"type","line":7719,"doc":{"desc":["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."],"params":[],"example":[],"returns":[]},"text":"  export type Origin = {\n      /**\n       * Whose hook made the `$` call, by name; `\"engine\"` for a call site,\n       * `\"client\"` for a `Client` surface module's `ui.message` post.\n       */\n      readonly plugin: string;\n      /**\n       * Where that plugin sits among the chain's tiers (Tier); `\"core\"` for the\n       * engine, the owning plugin's for a `client` post.\n       */\n      readonly tier: Tier;\n  };"},{"name":"Overloads","kind":"type","line":7735,"doc":{"desc":["One call signature per event in `Names`, intersected into an overload set."],"params":[],"example":[],"returns":[]},"text":"  type Overloads<Names extends EventName> = UnionToIntersection<{\n      [N in Names]: (e: Args<N>) => Promise<NextResult<N>>;\n  }[Names]>;"},{"name":"PaneCloseArgs","kind":"type","line":7743,"doc":{"desc":["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."],"params":[],"example":[],"returns":[]},"text":"  export type PaneCloseArgs = Omit<PaneCloseInput, 'origin'>;"},{"name":"PaneCloseInput","kind":"type","line":7749,"doc":{"desc":["The input of `ui.close`: the pane closing and why (PaneCloseOrigin).","Closing an id that is not open does nothing."],"params":[],"example":[],"returns":[]},"text":"  export type PaneCloseInput = {\n      /**\n       * What `$.ui.open` named the pane; pinned: `next(e)` passes it on.\n       */\n      id: string;\n      /**\n       * Who closes it, set by the engine: a hook that answers without `next`\n       * keeps the pane open on `plugin` and `person`, never on `unload`.\n       */\n      origin: PaneCloseOrigin;\n  };"},{"name":"PaneCloseOrigin","kind":"type","line":7768,"doc":{"desc":["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."],"params":[],"example":[],"returns":[]},"text":"  export type PaneCloseOrigin = {\n      /**\n       * `plugin`, a plugin's `$.ui.close`; `person`, the person's close mark or\n       * close key; `unload`, the engine's own.\n       */\n      kind: 'plugin' | 'person' | 'unload';\n  };"},{"name":"PaneOpenArgs","kind":"type","line":7786,"doc":{"desc":["The argument of `$.ui.open`: which pane, its title, whether it asks the","person's keyboard, its dialog manners, its size: rows inline, columns docked.","","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."],"params":[],"example":[],"returns":[]},"text":"  export type PaneOpenArgs = {\n      /**\n       * Names the pane: 1-64 of letters, digits, `_` and `-`. One pane per id:\n       * opening an open id delivers the new title, never a second instance.\n       *\n       * Pinned at the hooks: `next(e)` passes it on; the title and focus rewrite.\n       */\n      id: string;\n      /**\n       * The pane's tab while more than one pane is open (with one, no title is\n       * drawn), and the `title` its hook sees; the id when omitted.\n       *\n       * An unpaired surrogate half (a `.slice()` through an emoji) is drawn as\n       * U+FFFD; a control character is refused.\n       */\n      title?: string;\n      /**\n       * A request, not a grant: the surface focuses (and raises) the pane only\n       * while the prompt has the keys over an empty composer.\n       *\n       * An element of the band or a pane the person holds, text in the\n       * composer, a dialog or a survey each refuse it: the pane opens without\n       * the keyboard.\n       */\n      focus?: true;\n      /**\n       * While the pane holds the keyboard, the key that hands it back (Escape)\n       * also closes it as the person's close does: `ui.close`, origin `person`.\n       *\n       * So does Escape at an idle, empty prompt once the prompt has the keys\n       * again (the person typed, or `focus` was refused); over text, a turn, a\n       * dialog, a footer selection, a viewed agent or a prompt mode it is theirs.\n       *\n       * @remarks A hook may refuse that close and keep it open. Left out, Escape\n       *   returns the keys and the pane stays. Each open sets it anew, as a title.\n       */\n      closeOnEscape?: true;\n      /**\n       * While the pane is the one shown the surface holds every transient toast:\n       * each other plugin's `$.ui.toast` and the engine's own, as this plugin's.\n       *\n       * The toast stack is not drawn, its timers waiting; the notification line\n       * queues all but the engine's standing warnings, and one up as the pane opens\n       * may end unseen. After, the stack draws its newest few, the line one by one.\n       *\n       * @remarks For a dialog the person answers and leaves, not a pane that stays.\n       *   Left out, toasts show. Every open sets it; a `ui.open` hook may drop it.\n       */\n      holdToasts?: true;\n      /**\n       * What the surface paints under the pane's body while it is the one shown, as\n       * a Box takes it: a theme key, a raw color, or `\"transparent\"`.\n       *\n       * `\"transparent\"` paints nothing, so what lies behind the pane shows through;\n       * a color stops at the body. Left out, the surface's own look stands. Anything\n       * else is refused. Each open sets it anew; a `ui.open` hook may drop it.\n       *\n       * @remarks A request, not a grant: a surface with no counterpart for a theme\n       *   key keeps its own look.\n       */\n      backgroundColor?: Color;\n      /**\n       * The body rows the pane's content wants while seated inline above the\n       * prompt: it opens that tall, up to what the layout spares, not a third.\n       *\n       * A request, not a grant: a size the person dragged or keyed the block\n       * to wins, this session's or a kept one, and the dock ignores it. A\n       * positive whole number; left out, a third. Each open sets it anew.\n       */\n      rows?: number;\n      /**\n       * The body columns the pane's content wants while docked beside a\n       * fullscreen transcript: the dock opens that wide, at most 45% of the\n       * terminal's columns and at least 24. Each open sets it anew.\n       *\n       * A request, not a grant: a width the person dragged or keyed the dock to,\n       * this session's or a kept one, wins under the same ceiling, and the\n       * inline block ignores it. A positive whole number; left out, the share.\n       *\n       * @example\n       * await $.ui.open({ id: \"browser\", focus: true, rows: 24, columns: 60 })\n       */\n      columns?: number;\n  };"},{"name":"Pattern","kind":"type","line":7875,"doc":{"desc":["What `on(pattern, hook)` and `next.is(pattern, e)` take: an event's name,","a glob (`*`, `classic.*`), or a negation of either (`!tool.describe`)."],"params":[],"example":[],"returns":[]},"text":"  export type Pattern = EventName | Glob | Negation;"},{"name":"PatternOver","kind":"type","line":7884,"doc":{"desc":["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."],"params":[],"example":[],"returns":[]},"text":"  type PatternOver<N extends EventName> = N | '*' | `${Namespace<N>}.*` | Negation;"},{"name":"PermissionBehavior","kind":"type","line":7886,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"  type PermissionBehavior = 'allow' | 'deny' | 'ask';"},{"name":"PermissionDeniedHookInput","kind":"type","line":7888,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"  type PermissionDeniedHookInput = BaseHookInput & {\n      hook_event_name: 'PermissionDenied';\n      tool_name: string;\n      tool_input: unknown;\n      tool_use_id: string;\n      reason: string;\n      mcp_server?: McpServerProvenance;\n  };"},{"name":"PermissionMode","kind":"type","line":7900,"doc":{"desc":["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."],"params":[],"example":[],"returns":[]},"text":"  type PermissionMode = 'default' | 'acceptEdits' | 'bypassPermissions' | 'plan' | 'dontAsk' | 'auto';"},{"name":"PermissionRequestDecision","kind":"type","line":7906,"doc":{"desc":["A `classic.PermissionRequest` answer's `decision`, as the classic hook's","`hookSpecificOutput.decision`: allow (with a rewrite or rules) or deny."],"params":[],"example":[],"returns":[]},"text":"  export type PermissionRequestDecision = {\n      behavior: 'allow';\n      updatedInput?: Record<string, unknown>;\n      updatedPermissions?: PermissionUpdates;\n  } | {\n      behavior: 'deny';\n      message?: string;\n      interrupt?: true;\n  };"},{"name":"PermissionRequestHookInput","kind":"type","line":7916,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"  type PermissionRequestHookInput = BaseHookInput & {\n      hook_event_name: 'PermissionRequest';\n      tool_name: string;\n      tool_input: unknown;\n      permission_suggestions?: PermissionUpdate[];\n      mcp_server?: McpServerProvenance;\n  };"},{"name":"PermissionRuleValue","kind":"type","line":7924,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"  type PermissionRuleValue = {\n      toolName: string;\n      ruleContent?: string;\n  };"},{"name":"PermissionUpdate","kind":"type","line":7929,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"  type PermissionUpdate = {\n      type: 'addRules';\n      rules: PermissionRuleValue[];\n      behavior: PermissionBehavior;\n      destination: PermissionUpdateDestination;\n  } | {\n      type: 'replaceRules';\n      rules: PermissionRuleValue[];\n      behavior: PermissionBehavior;\n      destination: PermissionUpdateDestination;\n  } | {\n      type: 'removeRules';\n      rules: PermissionRuleValue[];\n      behavior: PermissionBehavior;\n      destination: PermissionUpdateDestination;\n  } | {\n      type: 'setMode';\n      mode: PermissionMode;\n      destination: PermissionUpdateDestination;\n  } | {\n      type: 'addDirectories';\n      directories: string[];\n      destination: PermissionUpdateDestination;\n  } | {\n      type: 'removeDirectories';\n      directories: string[];\n      destination: PermissionUpdateDestination;\n  };"},{"name":"PermissionUpdateDestination","kind":"type","line":7958,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"  type PermissionUpdateDestination = 'userSettings' | 'projectSettings' | 'localSettings' | 'session' | 'cliArg';"},{"name":"PermissionUpdates","kind":"type","line":7964,"doc":{"desc":["The permission rules a PermissionRequest allow may add: the shape of the","request's own `permission_suggestions` (the SDK's PermissionUpdate list)."],"params":[],"example":[],"returns":[]},"text":"  type PermissionUpdates = NonNullable<ClassicHookInputs['PermissionRequest']['permission_suggestions']>;"},{"name":"PlanModeDetail","kind":"type","line":7970,"doc":{"desc":["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."],"params":[],"example":[],"returns":[]},"text":"  type PlanModeDetail = {\n      /**\n       * Which wording the row carries: `full`, the whole workflow, or `sparse`,\n       * the one line that restates it between two full ones.\n       *\n       * A row made for a subagent reads the same under either.\n       */\n      reminder: 'full' | 'sparse';\n      /**\n       * Where the plan is kept, as the text names it: the file the model\n       * writes its plan to, of the loop the row was made for.\n       */\n      planFilePath: string;\n      /**\n       * True when the engine found that file as it made the row.\n       */\n      hasPlan: boolean;\n  };"},{"name":"PlanModeExitDetail","kind":"type","line":7993,"doc":{"desc":["What the engine knew as it made the note that plan mode has ended:","where the plan is kept, whether one is there."],"params":[],"example":[],"returns":[]},"text":"  type PlanModeExitDetail = {\n      /**\n       * Where the plan is kept; the text names it only when `hasPlan`.\n       */\n      planFilePath: string;\n      /**\n       * True when the engine found that file as it made the row.\n       */\n      hasPlan: boolean;\n  };"},{"name":"PlanModeReentryDetail","kind":"type","line":8008,"doc":{"desc":["What the engine knew as it made the note that plan mode is entered","again: where the plan of the earlier planning is kept."],"params":[],"example":[],"returns":[]},"text":"  type PlanModeReentryDetail = {\n      /**\n       * Where the earlier plan is kept, as the text names it; the note is made\n       * only when the engine finds that file.\n       */\n      planFilePath: string;\n  };"},{"name":"PlayOptions","kind":"type","line":8021,"doc":{"desc":["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."],"params":[],"example":[],"returns":[]},"text":"  export type PlayOptions = {\n      /**\n       * Repeat the clip until `signal` aborts (the promise then resolves).\n       */\n      shouldLoop: true;\n      /**\n       * Linear gain, from 0 to 4; default 1.\n       */\n      gain?: number;\n      /**\n       * Stops the clip: playback ends at once and the promise resolves.\n       */\n      signal: AbortSignal;\n  } | {\n      /**\n       * Play once.\n       */\n      shouldLoop?: false;\n      /**\n       * Linear gain, from 0 to 4; default 1.\n       */\n      gain?: number;\n      /**\n       * Stops the clip early, as above.\n       */\n      signal?: AbortSignal;\n  };"},{"name":"PluginNoun","kind":"type","line":8057,"doc":{"desc":["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."],"params":[],"example":[],"returns":[]},"text":"  type PluginNoun = Exclude<keyof EngineInterface & string, keyof CoreEngineInterface | Namespace<CoreEventName>>;"},{"name":"PluginOptions","kind":"type","line":8071,"doc":{"desc":["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`)."],"params":[],"example":[],"returns":[]},"text":"  export type PluginOptions = Readonly<Record<string, string | number | boolean | readonly string[]>>;"},{"name":"PluginRegisterInput","kind":"type","line":8081,"doc":{"desc":["The input of `plugin.register`: one hooks module the engine is about to","load, read off its manifest and its scanned source. Every field is pinned.","","`tier` and `uses` are the host's reading of the module, 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."],"params":[],"example":[],"returns":[]},"text":"  export type PluginRegisterInput = {\n      /**\n       * The plugin's name, as its own plugin.json declares it.\n       */\n      name: string;\n      /**\n       * Where its hooks would stand among the chain's tiers (Tier); never\n       * `core`, the engine's own.\n       */\n      tier: Exclude<Tier, 'core'>;\n      /**\n       * The plugin's directory (the one holding plugin.json), absolute.\n       */\n      root: string;\n      /**\n       * Its manifest's `version`, when it states one.\n       */\n      version?: string;\n      /**\n       * Where the plugin came from, as the loader keys it: `<name>@<marketplace>`\n       * installed, `<name>@inline` by `--plugin-dir`, `<name>@builtin` bundled.\n       */\n      provenance: string;\n      /**\n       * What the module hooks and calls, as scanned (PluginRegisterUses).\n       */\n      uses: PluginRegisterUses;\n  };"},{"name":"PluginRegisterResult","kind":"type","line":8114,"doc":{"desc":["What a `plugin.register` hook returns and what `next(e)` resolves to:","`{ allow: true }` from core, or `{ refuse: reason }`."],"params":[],"example":[],"returns":[]},"text":"  export type PluginRegisterResult = {\n      /**\n       * The module loads: its `engine.create` step runs and its hooks join.\n       */\n      allow: true;\n      refuse?: undefined;\n  } | {\n      /**\n       * The module does not load: no step, no hooks, no tools or commands;\n       * the debug log names the plugin that refused and this reason.\n       */\n      refuse: string;\n      allow?: undefined;\n  };"},{"name":"PluginRegisterUses","kind":"type","line":8136,"doc":{"desc":["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."],"params":[],"example":[],"returns":[]},"text":"  export type PluginRegisterUses = {\n      /**\n       * The patterns its `on(...)` registrations name, as written (`tool.call`,\n       * `*`, `classic.*`, `!tool.describe`), in registration order, each once.\n       */\n      events: readonly string[];\n      /**\n       * What it calls on `$`, spelled `noun.method` (`fs.write`, `http.fetch`),\n       * sorted, each once.\n       */\n      calls: readonly string[];\n      /**\n       * The environment variables its `$.env.get` and `$.env.set` calls name;\n       * absent when it calls neither.\n       */\n      env?: {\n          /**\n           * The names its `$.env.get` calls spell, sorted, each once.\n           */\n          reads: readonly string[];\n          /**\n           * The names its `$.env.set` calls spell, sorted, each once.\n           */\n          writes: readonly string[];\n      };\n      /**\n       * The named values its `$.state.get` and `$.state.set` calls refer to by\n       * literal, each `{ plugin, key }`; absent when it calls neither.\n       */\n      state?: {\n          /**\n           * The values its `$.state.get` calls spell, sorted, each once.\n           */\n          reads: readonly StateName[];\n          /**\n           * The values its `$.state.set` calls spell, sorted, each once.\n           */\n          writes: readonly StateName[];\n      };\n  };"},{"name":"PluginStamp","kind":"type","line":8184,"doc":{"desc":["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."],"params":[],"example":[],"returns":[]},"text":"  type PluginStamp = {\n      plugin: string;\n  };"},{"name":"PluginState","kind":"interface","line":8199,"doc":{"desc":["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`."],"params":[],"example":["interface PluginState { swarm: { workers: Worker[] } }"],"returns":[]},"text":"  export interface PluginState {\n  }"},{"name":"PostCompactHookInput","kind":"type","line":8202,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"  type PostCompactHookInput = BaseHookInput & {\n      hook_event_name: 'PostCompact';\n      trigger: 'manual' | 'auto';\n      /**\n       * The conversation summary produced by compaction\n       */\n      compact_summary: string;\n  };"},{"name":"PostModelSwitchHookInput","kind":"type","line":8211,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"  type PostModelSwitchHookInput = (BaseHookInput & {\n      hook_event_name: 'PostModelSwitch';\n  }) & {\n      /**\n       * Resolved model id the session was running before the switch\n       */\n      from_model: string;\n      /**\n       * Resolved model id the session runs after the switch\n       */\n      to_model: string;\n      /**\n       * What was asked for (alias such as \"opus\", a full id, or null for \"default\")\n       */\n      requested_model: string | null;\n      /**\n       * command: /model <name>, the /config Model row, or enabling fast mode when that promotes the model; picker: an interactive model picker; sdk: headless set_model (SDK, Remote Control, IDE); auto: automatic fallback or other programmatic change; resume: model restored while resuming a session\n       */\n      source: 'command' | 'picker' | 'sdk' | 'auto' | 'resume';\n      /**\n       * Prompt tokens the next request re-sends: the last main-thread response's input + cache_read + cache_creation + output tokens (0 before the first response; for a server-side tool loop, its last iteration's window, not the summed totals)\n       */\n      context_tokens: number;\n      /**\n       * Whether the current model's prompt cache is likely still warm (a switch then forfeits it)\n       */\n      prompt_cache_warm: boolean;\n      cache_ttl: '5m' | '1h';\n      /**\n       * Estimated cost of re-caching context_tokens on to_model at its cache-write rate - the managed modelPricing when set, otherwise list price; excludes the response\n       */\n      estimated_cache_write_usd: number;\n      /**\n       * configured: priced at the managed modelPricing setting; catalog: list price; default: to_model unknown, the default tier was assumed\n       */\n      pricing: 'configured' | 'catalog' | 'default';\n  };"},{"name":"PostToolBatchHookInput","kind":"type","line":8252,"doc":{"desc":["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."],"params":[],"example":[],"returns":[]},"text":"  type PostToolBatchHookInput = BaseHookInput & {\n      hook_event_name: 'PostToolBatch';\n      tool_calls: PostToolBatchToolCall[];\n  };"},{"name":"PostToolBatchToolCall","kind":"type","line":8257,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"  type PostToolBatchToolCall = {\n      tool_name: string;\n      tool_input: unknown;\n      tool_use_id: string;\n      tool_response?: unknown;\n  };"},{"name":"PostToolUseFailureHookInput","kind":"type","line":8264,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"  type PostToolUseFailureHookInput = BaseHookInput & {\n      hook_event_name: 'PostToolUseFailure';\n      tool_name: string;\n      tool_input: unknown;\n      tool_use_id: string;\n      error: string;\n      is_interrupt?: boolean;\n      /**\n       * Tool execution time in milliseconds. Excludes permission-prompt and hook time.\n       */\n      duration_ms?: number;\n      mcp_server?: McpServerProvenance;\n  };"},{"name":"PostToolUseHookInput","kind":"type","line":8278,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"  type PostToolUseHookInput = BaseHookInput & {\n      hook_event_name: 'PostToolUse';\n      tool_name: string;\n      tool_input: unknown;\n      tool_response: unknown;\n      tool_use_id: string;\n      /**\n       * Tool execution time in milliseconds. Excludes permission-prompt and hook time.\n       */\n      duration_ms?: number;\n      mcp_server?: McpServerProvenance;\n  };"},{"name":"PreCompactHookInput","kind":"type","line":8291,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"  type PreCompactHookInput = BaseHookInput & {\n      hook_event_name: 'PreCompact';\n      trigger: 'manual' | 'auto';\n      custom_instructions: string | null;\n  };"},{"name":"PreModelSwitchHookInput","kind":"type","line":8297,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"  type PreModelSwitchHookInput = (BaseHookInput & {\n      hook_event_name: 'PreModelSwitch';\n  }) & {\n      /**\n       * Resolved model id the session was running before the switch\n       */\n      from_model: string;\n      /**\n       * Resolved model id the session runs after the switch\n       */\n      to_model: string;\n      /**\n       * What was asked for (alias such as \"opus\", a full id, or null for \"default\")\n       */\n      requested_model: string | null;\n      /**\n       * command: /model <name>, the /config Model row, or enabling fast mode when that promotes the model; picker: an interactive model picker; sdk: headless set_model (SDK, Remote Control, IDE)\n       */\n      source: 'command' | 'picker' | 'sdk';\n      /**\n       * Prompt tokens the next request re-sends: the last main-thread response's input + cache_read + cache_creation + output tokens (0 before the first response; for a server-side tool loop, its last iteration's window, not the summed totals)\n       */\n      context_tokens: number;\n      /**\n       * Whether the current model's prompt cache is likely still warm (a switch then forfeits it)\n       */\n      prompt_cache_warm: boolean;\n      cache_ttl: '5m' | '1h';\n      /**\n       * Estimated cost of re-caching context_tokens on to_model at its cache-write rate - the managed modelPricing when set, otherwise list price; excludes the response\n       */\n      estimated_cache_write_usd: number;\n      /**\n       * configured: priced at the managed modelPricing setting; catalog: list price; default: to_model unknown, the default tier was assumed\n       */\n      pricing: 'configured' | 'catalog' | 'default';\n  };"},{"name":"PressedLink","kind":"type","line":8342,"doc":{"desc":["The link a press landed on: one a `Markdown` drew, pressed where the","surface reports presses (a plain click in the fullscreen terminal).","","What the surface knows of the cell pressed, not which occurrence: two","links written with one target read the same here."],"params":[],"example":[],"returns":[]},"text":"  export type PressedLink = {\n      /**\n       * The link's target as the surface drew it: for an `https:` link, the\n       * href as the markdown wrote it.\n       */\n      href: string;\n  };"},{"name":"PreToolUseDecision","kind":"type","line":8354,"doc":{"desc":["The decision of a `classic.PreToolUse` result: `allow`, `ask`, `deny`, or","none."],"params":[],"example":[],"returns":[]},"text":"  export type PreToolUseDecision = {\n      /**\n       * Lets the call run without a permission prompt (the managed-settings\n       * hooks ran first; a deny from them ended the chain above).\n       */\n      allow: true;\n      ask?: undefined;\n      deny?: undefined;\n  } | {\n      /**\n       * Asks the user before the call runs; the text is shown as the reason.\n       */\n      ask: string;\n      allow?: undefined;\n      deny?: undefined;\n  } | {\n      /**\n       * Refuses the call; the model receives the text as the reason.\n       */\n      deny: string;\n      allow?: undefined;\n      ask?: undefined;\n  } | {\n      allow?: undefined;\n      ask?: undefined;\n      deny?: undefined;\n  };"},{"name":"PreToolUseHookInput","kind":"type","line":8382,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"  type PreToolUseHookInput = BaseHookInput & {\n      hook_event_name: 'PreToolUse';\n      tool_name: string;\n      tool_input: unknown;\n      tool_use_id: string;\n      mcp_server?: McpServerProvenance;\n  };"},{"name":"PreToolUseResult","kind":"type","line":8397,"doc":{"desc":["What a `classic.PreToolUse` hook returns: one of `allow`, `ask`, `deny`,","or none of them, which passes the call on to the normal permission flow.","","The event fires inside `tool.call`, beneath every plugin's `tool.call` hook","(a test raises it by calling `$.tool.call`)."],"params":[],"example":[],"returns":[]},"text":"  export type PreToolUseResult = PreToolUseDecision & {\n      /**\n       * Replaces the tool's arguments; validated against the tool's schema before\n       * the tool runs.\n       */\n      updatedInput?: Record<string, unknown>;\n      /**\n       * Extra context handed to the model with the call, one entry per note.\n       */\n      additionalContext?: string[];\n  };"},{"name":"ProcessRunInit","kind":"type","line":8412,"doc":{"desc":["Options of `$.process.run`."],"params":[],"example":[],"returns":[]},"text":"  export type ProcessRunInit = {\n      /**\n       * The child's working directory, relative to the session's or absolute;\n       * absent, the session's working directory.\n       */\n      cwd?: string;\n      /**\n       * Variables set over the host process's own environment.\n       */\n      env?: Record<string, string>;\n      /**\n       * Text written to the child's standard input, then closed.\n       */\n      stdin?: string;\n      /**\n       * How long the child may run before it is killed and the call rejects,\n       * in milliseconds; 30 seconds when absent, ten minutes at most.\n       */\n      timeoutMs?: number;\n  };"},{"name":"ProcessRunResult","kind":"type","line":8439,"doc":{"desc":["What `$.process.run` resolves with once the child has exited."],"params":[],"example":["const { stdout, isStdoutTruncated } = await $.process.run([\"git\", \"log\"])"],"returns":[]},"text":"  export type ProcessRunResult = {\n      /**\n       * The child's exit status; a child ended by a signal reads as 1.\n       */\n      exitCode: number;\n      /**\n       * What the child wrote to standard output, as text: its first 4194304\n       * bytes (4 MiB), the rest read and dropped (`isStdoutTruncated`).\n       *\n       * The limit counts bytes, not characters, and is standard output's own:\n       * standard error has the same limit again. A cut inside a multi-byte\n       * character drops that character.\n       */\n      stdout: string;\n      /**\n       * What the child wrote to standard error, as text: its first 4194304\n       * bytes (4 MiB), the rest read and dropped (`isStderrTruncated`).\n       */\n      stderr: string;\n      /**\n       * True when the child wrote more than 4194304 bytes to standard output\n       * and `stdout` is only the first of them; false when `stdout` is whole.\n       */\n      isStdoutTruncated: boolean;\n      /**\n       * True when the child wrote more than 4194304 bytes to standard error\n       * and `stderr` is only the first of them; false when `stderr` is whole.\n       */\n      isStderrTruncated: boolean;\n  };"},{"name":"ProcessSpawnChunk","kind":"type","line":8478,"doc":{"desc":["One piece of a spawned child's output as `$.process.spawn` streams it:","which pipe it came from, and the text.","","The text is UTF-8 decoded as it arrived, in order per pipe: a piece ends","wherever the child's write did, so a line may span two pieces and one","piece may hold several lines; a multi-byte character is never split."],"params":[],"example":[],"returns":[]},"text":"  export type ProcessSpawnChunk = {\n      /**\n       * The pipe the text came from.\n       */\n      stream: 'stdout' | 'stderr';\n      /**\n       * What the child wrote, decoded; never empty, and never cut.\n       *\n       * Nothing of the stream is dropped: once 1048576 characters wait unread,\n       * the child blocks on its next write until the loop pulls.\n       */\n      text: string;\n  };"},{"name":"ProcessSpawnRequest","kind":"type","line":8499,"doc":{"desc":["The argument of `$.process.spawn(request)`, and the `e` its hooks see:","the command by its argument vector and how the child is started.","","The same rules as `$.process.run`: no shell, the session's working","directory unless one is named, the host's environment with `env` over it."],"params":[],"example":[],"returns":[]},"text":"  export type ProcessSpawnRequest = {\n      /**\n       * The command and its arguments, `argv[0]` the executable.\n       */\n      argv: readonly string[];\n      /**\n       * The child's working directory, relative to the session's or absolute;\n       * absent, the session's working directory.\n       */\n      cwd?: string;\n      /**\n       * Variables set over the host process's own environment.\n       */\n      env?: Record<string, string>;\n      /**\n       * Text written to the child's standard input, which is then closed;\n       * absent, standard input is closed from the start.\n       *\n       * A string today; a later form may take the text in pieces.\n       */\n      input?: string;\n  };"},{"name":"ProcessSpawnResult","kind":"type","line":8526,"doc":{"desc":["How a spawned child ended, as the stream of `$.process.spawn` returns it","once every piece has been read: its exit code, or the signal that did it."],"params":[],"example":[],"returns":[]},"text":"  export type ProcessSpawnResult = {\n      /**\n       * The child's exit status; null when a signal ended it.\n       */\n      code: number | null;\n      /**\n       * What ended the child from outside (`SIGTERM`); null when it exited on\n       * its own. On Windows a killed child reads as an exit code, this null.\n       */\n      signal: string | null;\n  };"},{"name":"PromptAttachmentDetailOf","kind":"type","line":8546,"doc":{"desc":["The facts `prompt.attachment` pins under `e.detail`, by attachment type:","what the engine computed for the row, as it rendered the row's text.","","A type named here carries them on every row the engine made for a session","whose plan goes in a file; a type not named carries no `detail` at all. Read","off the row, never computed again: sent again, it says what it was made with."],"params":[],"example":[],"returns":[]},"text":"  export type PromptAttachmentDetailOf = {\n      /**\n       * The reminder a request carries while plan mode is on: `full` the first\n       * of a planning session and after a compaction, `sparse` most others.\n       *\n       * @example\n       * const isSparse = e.detail?.reminder === \"sparse\"\n       */\n      plan_mode: PlanModeDetail;\n      /**\n       * The note made when plan mode is entered again by the process that left\n       * it, the earlier plan still in its file; it precedes the reminder.\n       *\n       * @example\n       * const planFilePath = e.detail?.planFilePath\n       */\n      plan_mode_reentry: PlanModeReentryDetail;\n      /**\n       * The note made once when plan mode has ended: the model may act again,\n       * and is told where its plan is when there is one.\n       *\n       * @example\n       * const hasPlan = e.detail?.hasPlan === true\n       */\n      plan_mode_exit: PlanModeExitDetail;\n  };"},{"name":"PromptAttachmentInput","kind":"type","line":8581,"doc":{"desc":["The input of `prompt.attachment`: one message the engine injects into the","conversation for the model on its own, as a request is about to carry it.","","A reminder, a mode transition, a listing, a mentioned file, a hook's","context: only one that carries text for the model is raised. A union on","`type`: a name PromptAttachmentDetailOf declares carries its `detail`."],"params":[],"example":[],"returns":[]},"text":"  export type PromptAttachmentInput = {\n      [K in keyof PromptAttachmentDetailOf]: DeclaredAttachmentInput<K>;\n  }[keyof PromptAttachmentDetailOf] | UndeclaredAttachmentInput;"},{"name":"PromptAttachmentOrigin","kind":"type","line":8593,"doc":{"desc":["Who authored the text an injected attachment carries, as the engine knows","it from the attachment itself; a closed set, pinned on the event.","","A hooks module reads `e.origin.kind` to tell the engine's own prose from a","settings hook's output or another plugin's context. `next(e)` passes it on","as received; one left out is put back; no hook sets one."],"params":[],"example":[],"returns":[]},"text":"  export type PromptAttachmentOrigin = {\n      /**\n       * The engine's own prose or framing: a reminder, a mode transition, a\n       * listing, a notice, an announced context block.\n       *\n       * A file the person mentioned, as the engine presents it, and a prompt\n       * or notification delivered into a running turn are the engine's too.\n       */\n      kind: 'engine';\n  } | {\n      /**\n       * A settings hook's output the engine injects for the model: its\n       * additional context, a blocking error's note, a stopped continuation.\n       */\n      kind: 'hook';\n      /**\n       * The settings hook event that produced it (`SessionStart`,\n       * `UserPromptSubmit`, `PostToolUse`, ...).\n       */\n      event: string;\n  } | {\n      /**\n       * Text a plugin's hook attached through a chain's `context`, as the\n       * model reads it.\n       *\n       * The chains that carry one: `prompt.submit`, `prompt.mention`,\n       * `tool.call`.\n       */\n      kind: 'plugin';\n      /**\n       * The chain's event that attached it.\n       */\n      event: string;\n  };"},{"name":"PromptAttachmentResult","kind":"type","line":8632,"doc":{"desc":["What a `prompt.attachment` hook returns: the text the model reads for that","attachment, or null to leave the attachment out of the request."],"params":[],"example":[],"returns":[]},"text":"  export type PromptAttachmentResult = {\n      text: string | null;\n  };"},{"name":"PromptAutocompleteInput","kind":"type","line":8643,"doc":{"desc":["The input of `prompt.autocomplete`: the prompt box as the person left it","and the token at its cursor, which a taken suggestion replaces.","","All four are pinned, facts of the box: a rewrite that changes one is","refused, one left out is kept. Offsets count UTF-16 code units."],"params":[],"example":[],"returns":[]},"text":"  export type PromptAutocompleteInput = {\n      /**\n       * The whole draft in the prompt box.\n       */\n      text: string;\n      /**\n       * Where the person's caret stands in `text`, 0 to `text.length`.\n       */\n      cursor: number;\n      /**\n       * The run of characters that are not whitespace and that ends at the\n       * cursor: `text.slice(start, cursor)`, never empty.\n       *\n       * What a matcher names to answer one lead character only.\n       *\n       * @example\n       * on(\"prompt.autocomplete\", { token: /^#/ }, hook)\n       */\n      token: string;\n      /**\n       * Where `token` begins in `text`.\n       */\n      start: number;\n  };"},{"name":"PromptAutocompleteResult","kind":"type","line":8672,"doc":{"desc":["What a `prompt.autocomplete` hook returns and what `next(e)` resolves to:","the rows the plugins add to the typeahead for the token."],"params":[],"example":[],"returns":[]},"text":"  export type PromptAutocompleteResult = {\n      /**\n       * The rows, in the order drawn beneath the engine's own; from core, none.\n       *\n       * A hook puts its rows before or after what `next(e)` gave; the engine's\n       * own rows are not on this event and stay where they were drawn.\n       *\n       * @example\n       * return { suggestions: [...(await next(e)).suggestions, mine] }\n       */\n      suggestions: readonly PromptAutocompleteSuggestion[];\n  };"},{"name":"PromptAutocompleteSuggestion","kind":"type","line":8689,"doc":{"desc":["One row a `prompt.autocomplete` hook adds to the prompt box's typeahead:","what taking it writes, what the row shows, and a dim line beside it."],"params":[],"example":[],"returns":[]},"text":"  export type PromptAutocompleteSuggestion = {\n      /**\n       * What taking the row writes in place of the token, the cursor after it;\n       * never empty. The box's new token is then asked again.\n       */\n      text: string;\n      /**\n       * What the row shows, on one line; the `text` when absent.\n       */\n      label?: string;\n      /**\n       * The dim line drawn beside the label, cut to the row by the surface.\n       */\n      description?: string;\n  };"},{"name":"PromptBox","kind":"type","line":8712,"doc":{"desc":["The person's prompt box as it stands: the draft and where the cursor is in","it; what `$.prompt.read()` resolves and `$.prompt.fill` hands back.","","No selection: the terminal's box has none of its own, and a surface that","binds one adds it here."],"params":[],"example":[],"returns":[]},"text":"  export type PromptBox = {\n      /**\n       * The draft as typed so far; `''` where the session draws no box.\n       */\n      text: string;\n      /**\n       * Where the next typed character lands: an offset into `text` in UTF-16\n       * code units, 0 at the start, `text.length` at the end.\n       */\n      cursor: number;\n  };"},{"name":"PromptChangeInput","kind":"type","line":8731,"doc":{"desc":["The input of `prompt.change` (prompt-change/): the prompt box after a","change of its text that no `prompt.edit` carried, and who made it.","","The change is already in the box. Every field is the engine's: a hook","observes, and `next(e)` passes them on as received."],"params":[],"example":[],"returns":[]},"text":"  export type PromptChangeInput = {\n      /**\n       * The draft as it stands when the event is raised; what `$.prompt.read()`\n       * answers then.\n       */\n      text: string;\n      /**\n       * Where the caret stands in `text` then, 0 to `text.length`.\n       */\n      cursor: number;\n      /**\n       * Who changed the box (PromptChangeOrigin), set by the engine: the act\n       * that left the box as it stands.\n       *\n       * @example on('prompt.change', { origin: { kind: 'history' } },\n       *   ($, e, next) => next(e))\n       */\n      origin: PromptChangeOrigin;\n  };"},{"name":"PromptChangeOrigin","kind":"type","line":8758,"doc":{"desc":["Who changed the prompt box at `prompt.change`, as the engine stamps it","where the text is written; a matcher narrows on its `kind`.","","The set of kinds may grow: treat a kind you do not know as `engine`.","`next(e)` passes it on as received; no hook sets one."],"params":[],"example":[],"returns":[]},"text":"  export type PromptChangeOrigin = {\n      /**\n       * A recalled entry of the prompt history was put in the box: the up\n       * and down arrows, the history search, the history picker.\n       *\n       * Stepping back out of a recall is `history` too: the newest entry\n       * passed, the search cancelled, the person's own draft put back.\n       */\n      kind: 'history';\n  } | {\n      /**\n       * The box was emptied by something other than an edit or an undo: a\n       * submit took the draft, a clear, a stash.\n       *\n       * `text` is the box when raised: a key typed since is in it.\n       */\n      kind: 'clear';\n  } | {\n      /**\n       * The person took an edit back (`chat:undo`): the box holds an\n       * earlier text of theirs, which may be empty.\n       */\n      kind: 'undo';\n  } | {\n      /**\n       * A plugin's `$.prompt.fill` landed, as its `prompt.fill` chain left it\n       * and as the engine finished it (an over-long text collapsed).\n       */\n      kind: 'plugin';\n      /**\n       * The filling plugin's name; a hook that fills tells its own fill by it.\n       */\n      name: string;\n  } | {\n      /**\n       * A remote surface's own Composer changed by the app's hand; reserved,\n       * nothing raises it as shipped.\n       */\n      kind: 'app';\n  } | {\n      /**\n       * Every other write: a draft put back, an accepted completion,\n       * dictation, a prefill, and an edit `prompt.edit` does not carry.\n       */\n      kind: 'engine';\n  };"},{"name":"PromptChangeResult","kind":"type","line":8809,"doc":{"desc":["What a `prompt.change` hook returns and what `next(e)` resolves to:","`{ text }`, echoed by core; a hook's own value changes nothing."],"params":[],"example":[],"returns":[]},"text":"  export type PromptChangeResult = {\n      text: string;\n  };"},{"name":"PromptComposeArgs","kind":"type","line":8817,"doc":{"desc":["What a plugin passes `$.prompt.compose`: the facts it wants composed for,","each one it leaves out read off the session (its model, its tools)."],"params":[],"example":[],"returns":[]},"text":"  export type PromptComposeArgs = Partial<PromptComposeInput>;"},{"name":"PromptComposeInput","kind":"type","line":8823,"doc":{"desc":["The input of `prompt.compose`: the facts a system prompt is composed from,","each already resolved by the engine, at the moment it renders one."],"params":[],"example":[],"returns":[]},"text":"  export type PromptComposeInput = {\n      /**\n       * The id of the model the request is for; pinned, the field a matcher\n       * narrows on.\n       */\n      model: string;\n      /**\n       * The model whose prompt is rendered: `model`, unless the engine renders\n       * another model's prompt for it (a model it holds no prompt of its own for).\n       */\n      promptModel: string;\n      /**\n       * Where the session draws at this render, as `$.session.surfaces()`\n       * answers: `terminal` first under the REPL; empty where nothing draws.\n       */\n      surfaces: readonly RenderSurface[];\n      /**\n       * The names of the tools the request offers the model; the engine's own\n       * composition reads them against the session's, an unknown name ignored.\n       */\n      tools: readonly string[];\n      /**\n       * What the person chose in place of the default way of answering, and\n       * whether it keeps the coding instructions; null for the default style.\n       */\n      outputStyle: {\n          name: string;\n          isKeepingCodingInstructions: boolean;\n      } | null;\n      traits: readonly PromptComposeTrait[];\n  };"},{"name":"PromptComposeResult","kind":"type","line":8863,"doc":{"desc":["What a `prompt.compose` hook returns: the sections of the system prompt,","in order, every `shared` one ahead of every `session` one.","","A section left out is not sent; a hook that never calls `next` answers","the whole list. The engine joins each side, places the cache boundary","between them and every cache marker itself."],"params":[],"example":[],"returns":[]},"text":"  export type PromptComposeResult = {\n      sections: readonly PromptComposeSection[];\n  };"},{"name":"PromptComposeScope","kind":"type","line":8875,"doc":{"desc":["Which side of the prompt cache's boundary a section of the system prompt","sits on: `shared` before it, `session` after it.","","`shared` text reads the same for everyone on this build and model: the API","may cache it across organizations, and text that varies hits that cache for","nobody. `session` text varies. In a list every `shared` section comes first."],"params":[],"example":[],"returns":[]},"text":"  export type PromptComposeScope = 'shared' | 'session';"},{"name":"PromptComposeSection","kind":"type","line":8884,"doc":{"desc":["One section of the system prompt as `prompt.compose` answers it: a stable","id, the text the model reads, and the side of the cache boundary it is on."],"params":[],"example":["const POLICY = { id: \"acme:policy\", text: \"...\", scope: \"session\" } as const"],"returns":[]},"text":"  export type PromptComposeSection = {\n      /**\n       * What a hook above finds the section by, to replace, move or drop it;\n       * never empty, and unique in one list.\n       *\n       * A plugin's own is `<plugin>:<name>`; a bare name is the engine's. The full\n       * prompt opens `intro`, `system`, `doing_tasks`, `actions`, `tools`, `tone`;\n       * the short one opens `lean_body` instead; `--bare`'s one section is `bare`.\n       */\n      id: string;\n      /**\n       * The section's text, sent as written; sections on one side of the\n       * boundary are joined by a blank line, in the list's order.\n       */\n      text: string;\n      /**\n       * The side of the cache boundary the section is sent on; in one list\n       * every `shared` section comes before every `session` one.\n       *\n       * A section added at the end of what `next(e)` answered is `session`.\n       */\n      scope: PromptComposeScope;\n  };"},{"name":"PromptComposeTrait","kind":"type","line":8935,"doc":{"desc":["One branch the engine's own composition of the system prompt takes on the","request or the session before it computes any section: a closed set.","","`bare`: the session runs with the one-line prompt (`--bare`). `lean`: the","prompt model takes the short body. `sdk-preset`: the SDK's `claude_code`","preset, whose per-person sections ride the first user message instead.","","`teammate`: an in-process teammate's render of its lead's prompt.","`analysis`: a render that measures the prompt (`/context`) and sends","nothing. `print`: a session with no terminal behind it (`-p`, the SDK).","","`skills`: the Skill tool has commands to list. `send-user-message`: the","session speaks to the person through a message tool.","","Rewritten going down, `sdk-preset`, `teammate` and `analysis` steer the","engine's composition; the rest it derives itself, so they tell a hook what","it will do. What one section's own text turns on (a flag) is not here.","","`bare` and `lean` say which sections come back. With `bare`: one, `bare`.","With `lean`: `lean_body`, where the full prompt opens `intro`, `system`,","`doing_tasks`, `actions`, `tools`, `tone`.","","Past that opening the full and the short prompt hold the session's","sections (`communication`, `pronouns`, `memory`, ...), each left out when","it has no text."],"params":[],"example":[],"returns":[]},"text":"  export type PromptComposeTrait = 'bare' | 'lean' | 'sdk-preset' | 'teammate' | 'analysis' | 'print' | 'skills' | 'send-user-message';"},{"name":"PromptContextBlock","kind":"type","line":8941,"doc":{"desc":["One block of the context the first user message carries: a name the","engine keys it by and the text under it."],"params":[],"example":[],"returns":[]},"text":"  export type PromptContextBlock = {\n      /**\n       * The key the block renders under (`# name`): `claudeMd`, `userEmail`,\n       * `attachedProject`, `currentDate`, or a plugin's own.\n       *\n       * The field a matcher narrows on; unique among one context's blocks.\n       */\n      name: string;\n      /**\n       * The block's text; `claudeMd`'s is the instruction files framed as the\n       * engine frames them, empty when it announces none.\n       */\n      text: string;\n  };"},{"name":"PromptContextBlocks","kind":"type","line":8960,"doc":{"desc":["The context blocks of a conversation's first user message, in the order","the engine renders them: what `prompt.context` takes and answers alike."],"params":[],"example":[],"returns":[]},"text":"  export type PromptContextBlocks = {\n      /**\n       * From core: `claudeMd` (when instruction files are loaded), `userEmail`,\n       * `attachedProject`, `currentDate`, each only when present.\n       */\n      blocks: readonly PromptContextBlock[];\n  };"},{"name":"PromptContextInput","kind":"type","line":8972,"doc":{"desc":["The input of `prompt.context`: the context blocks the engine prepends to a","conversation's first user message, and the files behind `claudeMd`."],"params":[],"example":[],"returns":[]},"text":"  export type PromptContextInput = {\n      /**\n       * From core: `claudeMd` (when instruction files are loaded), `userEmail`,\n       * `attachedProject`, `currentDate`, each only when present.\n       */\n      blocks: readonly PromptContextBlock[];\n      /**\n       * The files behind `claudeMd`, in the order it renders them, `@` imports\n       * included; empty when it renders none.\n       *\n       * Undefined when a hook above rewrote the `claudeMd` text: the files\n       * behind that text are then unknown, and a hook adds none of its own.\n       */\n      instructionFiles?: readonly InstructionFile[];\n  };"},{"name":"PromptContextResult","kind":"type","line":8999,"doc":{"desc":["What a `prompt.context` hook returns: the blocks the conversation","carries, in order; one left out is not sent.","","By name: `userEmail`, `attachedProject` and `perforceMode` are sent again","when the text differs, `workerToolsContext` too where coordinator mode","announces it; for `gitStatus` and `currentDate` the engine sends its own."],"params":[],"example":[],"returns":[]},"text":"  export type PromptContextResult = {\n      /**\n       * What the conversation carries, in order.\n       *\n       * A block whose name the engine does not route reaches the model in one copy,\n       * made when the conversation holds none (first request, after a compaction).\n       * While it stands, a later answer adds, changes and takes back none.\n       *\n       * @remarks Text that changes goes in `instructionFiles`, sent again when\n       *   a file differs, or in a `prompt.submit` hook's `context`.\n       */\n      blocks: readonly PromptContextBlock[];\n      /**\n       * The files now behind `claudeMd`; left out, the ones from below stand.\n       *\n       * Kept in step with the `claudeMd` text at every link: a changed list\n       * renders the text the next reader gets, a rewritten text makes the files\n       * unknown from there on. Every kind is the hook's to add, drop or rewrite;\n       * a `managed` file a person's own plugin added or rewrote keeps its text\n       * and is marked `isUnverified`.\n       */\n      instructionFiles?: readonly InstructionFile[];\n  };"},{"name":"PromptDecoration","kind":"type","line":9034,"doc":{"desc":["One styled run a surface paints over the prompt draft: `[start, end)` of","a text, in UTF-16 code units like PromptBox `cursor`. Paint only.","","Clamped into the text, an empty range with no `virtualText` dropped, and a","boundary moved back to its grapheme's start. Later entries win per key. The","caret's cell keeps its run's style, less a color that would hide the caret:","`color` matching its background, or an end matching the terminal's other one."],"params":[],"example":["{ start: 4, end: 8, color: 'warning', bold: true }"],"returns":[]},"text":"  export type PromptDecoration = {\n      /**\n       * The first code unit painted: an integer offset into the text the list\n       * travels beside, clamped into it.\n       */\n      start: number;\n      /**\n       * The code unit past the last one painted; a run with `end <= start`,\n       * once clamped, paints nothing.\n       */\n      end: number;\n      /**\n       * Drawn in bold; a decoration takes no `weight`.\n       */\n      bold?: boolean;\n      /**\n       * A text drawn before the character at `start`, in this entry's own style\n       * keys: never in the draft, counted by no offset, never holding the cursor.\n       *\n       * Typed text at `start` lands before it. A tab is drawn as four spaces, and\n       * control characters but a newline are dropped. Not drawn in the empty box,\n       * by a remote host, or in screen-reader mode, where it is heard as typed.\n       *\n       * @example { start: 7, end: 7, virtualText: ' bug', dimColor: true }\n       */\n      virtualText?: string;\n  } & Pick<TextProps, 'color' | 'backgroundColor' | 'dimColor' | 'italic' | 'underline' | 'strikethrough'>;"},{"name":"PromptEditInput","kind":"type","line":9066,"doc":{"desc":["The input of `prompt.edit` (prompt-edit/): one edit the person makes in the","prompt box, as the draft before it and the splice the editor made of it."],"params":[],"example":[],"returns":[]},"text":"  export type PromptEditInput = {\n      /**\n       * Who edits (PromptEditOrigin): the person at the composer. Pinned:\n       * `next(e)` passes it on as received.\n       */\n      origin: PromptEditOrigin;\n      /**\n       * The one key that made the edit, in `Client` `onKey`'s shape; absent for\n       * a paste, a keybinding's newline and a burst of keys folded into one edit.\n       *\n       * Pinned: which key the person pressed is a fact, not the hook's to change.\n       */\n      key?: ClientKeyEvent;\n      /**\n       * The draft before the edit. `next({ ...e, text })` applies the edit to\n       * another draft instead.\n       */\n      text: string;\n      /**\n       * Where the person's caret stood in `text` before the edit, 0 to\n       * `text.length`.\n       */\n      cursor: number;\n      /**\n       * Where in `text` the edit begins: the start of the span it replaces, or\n       * where what was typed goes in; a bare cursor move begins where it lands.\n       */\n      start: number;\n      /**\n       * Where the replaced span of `text` ends: `start` for an insertion or a\n       * move, past it for a deletion (Backspace, a kill).\n       */\n      end: number;\n      /**\n       * What goes in between `start` and `end`: the typed or pasted text, `''` for\n       * a deletion or a move.\n       *\n       * `next({ ...e, inputText })` puts in another; the cursor lands after it.\n       */\n      inputText: string;\n  };"},{"name":"PromptEditOrigin","kind":"type","line":9114,"doc":{"desc":["Who edits the prompt box at `prompt.edit`, as the engine stamps it where","the edit starts; a closed set a matcher narrows on.","","`next(e)` passes it on as received; no hook sets one."],"params":[],"example":[],"returns":[]},"text":"  export type PromptEditOrigin = {\n      /**\n       * The person, typing or pasting into the main prompt box.\n       */\n      kind: 'composer';\n  };"},{"name":"PromptEditResult","kind":"type","line":9129,"doc":{"desc":["What a `prompt.edit` hook returns and what `next(e)` resolves to: the box","after the edit (PromptBox), which the editor then shows.","","From core, `e.text` with the splice applied and the cursor after what went","in. Rewrite it (`{ ...r, text, cursor }`) to change what lands; answer","`{ text: e.text, cursor: e.cursor }` without `next` to consume the key."],"params":[],"example":[],"returns":[]},"text":"  export type PromptEditResult = PromptBox & {\n      /**\n       * Runs to paint over this answer's own `text` (PromptDecoration); none\n       * when absent.\n       *\n       * Kept on the same characters while the next edit's answer is pending,\n       * then replaced by that answer's list (or by none).\n       *\n       * @example const r = await next(e)\n       * return { ...r, decorations: [...(r.decorations ?? []), mine] }\n       */\n      decorations?: PromptDecoration[];\n  };"},{"name":"PromptFillArgs","kind":"type","line":9147,"doc":{"desc":["`prompt.fill`'s input as a plugin's `$.prompt.fill(args)` takes it: no","`origin` (the engine sets the calling plugin's), `mode` optional."],"params":[],"example":[],"returns":[]},"text":"  export type PromptFillArgs = {\n      /**\n       * What the box is to take (PromptFillInput `text`).\n       */\n      text: string;\n      /**\n       * Where it goes (PromptFillMode); `replace` when left out.\n       */\n      mode?: PromptFillMode;\n      /**\n       * Runs to paint over `text` (PromptDecoration), offsets into `text` as\n       * given; the engine moves them to where it lands. None when absent.\n       *\n       * Replaced by the next edit's `prompt.edit` answer; with no hook on it,\n       * gone at the draft's next change.\n       *\n       * @example $.prompt.fill({ text: ' next', mode: 'append',\n       *   decorations: [{ start: 1, end: 5, italic: true }] })\n       */\n      decorations?: PromptDecoration[];\n      /**\n       * Where the caret stands after the write, counted as PromptFilled `cursor`\n       * is: an offset into the whole draft the box then holds.\n       *\n       * In every `mode`, hidden code points gone, accents counted as NFC; clamped\n       * to the draft, moved to the start of a character or chip it falls inside;\n       * not an integer is refused. Left out: past an `insert`, else at the end.\n       *\n       * @example const box = await $.prompt.read()\n       *   await $.prompt.fill({ text: box.text.toUpperCase(), cursor: box.cursor })\n       */\n      cursor?: number;\n  };"},{"name":"PromptFilled","kind":"type","line":9188,"doc":{"desc":["What `$.prompt.fill` resolves to: whether the box took the text, and the","box afterwards (PromptBox) as the caller's own `$.prompt.read()` reads it.","","The box goes to a plugin whose module calls `$.prompt.read`, through the","hooks on it; one that never does, or is refused there, gets the empty box."],"params":[],"example":[],"returns":[]},"text":"  export type PromptFilled = {\n      /**\n       * True once the box holds the text; false where no box could take it or a\n       * hook kept it out (PromptFillResult).\n       */\n      isFilled: boolean;\n      /**\n       * Why the box did not take the text, when the engine itself refused\n       * (PromptFillResult): `no_composer` where the session binds no box,\n       * `dialog` while one holds the keys. A hook's refusal carries none, so\n       * a caller choosing a fallback treats an absent cause as unknown and\n       * does not act as if no box existed.\n       */\n      refusal?: 'no_composer' | 'dialog';\n      /**\n       * The draft after the fill; unchanged when `isFilled` is false; `''` where\n       * no box is drawn or the caller may not read it (see above).\n       */\n      text: string;\n      /**\n       * Where the person types next: an offset into `text`, where the call's\n       * `cursor` stood it, else past the fill's text for `insert`, at the end\n       * for `replace` and `append`.\n       */\n      cursor: number;\n  };"},{"name":"PromptFillInput","kind":"type","line":9219,"doc":{"desc":["The input of `prompt.fill` (prompt-fill/): a text about to be put in the","prompt box as the person's draft, over it, after it, or at the cursor."],"params":[],"example":[],"returns":[]},"text":"  export type PromptFillInput = {\n      /**\n       * What the box takes; the person edits it or presses Enter.\n       * `next({ ...e, text })` writes another.\n       *\n       * The box takes it without the code points a terminal draws as nothing, as\n       * the composer removes them when a person sends; all else lands as written.\n       */\n      text: string;\n      /**\n       * Where the text goes (PromptFillMode): over the draft, after it, or in at\n       * the cursor. `next({ ...e, mode })` moves it; left out of a rewrite, kept.\n       */\n      mode: PromptFillMode;\n      /**\n       * Who writes (PromptFillOrigin), set by the engine where the write\n       * starts. Pinned: `next(e)` passes it on as received.\n       */\n      origin: PromptFillOrigin;\n      /**\n       * Runs to paint over `text` once it lands (PromptDecoration), offsets\n       * into `text`; absent when the call named none.\n       *\n       * What the chain passes down is what paints: a hook strips them so.\n       *\n       * @example on('prompt.fill', ($, e, next) =>\n       *   next({ ...e, decorations: [] }))\n       */\n      decorations?: PromptDecoration[];\n      /**\n       * Where the caret stands after the write (PromptFillArgs `cursor`), an\n       * offset into the whole draft; absent when the call named none.\n       *\n       * What the chain passes down is what moves it: left out of a rewrite, the\n       * box stands the caret by `mode`.\n       *\n       * @example on('prompt.fill', ($, e, next) => next({ ...e, cursor: 0 }))\n       */\n      cursor?: number;\n  };"},{"name":"PromptFillMode","kind":"type","line":9269,"doc":{"desc":["Where a `prompt.fill` puts its text: over the whole draft, after it, or","into it at the cursor.","","`replace` empties the box first and leaves the cursor at the text's end;","`append` keeps the draft and adds the text after it, cursor at the end;","`insert` splices the text in at the cursor and moves the cursor past it,","so what the person had typed stays on either side."],"params":[],"example":[],"returns":[]},"text":"  export type PromptFillMode = 'replace' | 'append' | 'insert';"},{"name":"PromptFillOrigin","kind":"type","line":9277,"doc":{"desc":["Who writes the prompt box at `prompt.fill`, as the engine stamps it where","the write starts; a closed set a matcher narrows on.","","`next(e)` passes it on as received; no hook sets one."],"params":[],"example":[],"returns":[]},"text":"  export type PromptFillOrigin = {\n      /**\n       * The engine writing the box on its own account; reserved for its own\n       * sites, none of which raises `prompt.fill` as shipped.\n       */\n      kind: 'engine';\n  } | {\n      /**\n       * A plugin's `$.prompt.fill`.\n       */\n      kind: 'plugin';\n      /**\n       * The filling plugin's name.\n       */\n      name: string;\n  };"},{"name":"PromptFillResult","kind":"type","line":9298,"doc":{"desc":["What a `prompt.fill` hook returns and what `next(e)` resolves to: whether","the text went into the prompt box."],"params":[],"example":[],"returns":[]},"text":"  export type PromptFillResult = {\n      /**\n       * True once the box holds the text; false where no box can take it (a\n       * dialog holds the keys, a headless session has none).\n       *\n       * A hook answering `{ isFilled: false }` without `next` keeps the text\n       * out.\n       */\n      isFilled: boolean;\n      /**\n       * Why the box did not take the text, on the two refusals the engine\n       * itself answers: the session binds no prompt box (`no_composer`:\n       * headless, or a surface that draws its own composer), or a dialog holds\n       * the keys (`dialog`), so the write would land under it, unseen. A hook's\n       * own refusal carries none: the site strips a cause a hook writes itself,\n       * keeping only one its `next` gave it, passed up as it was. A caller\n       * branching on the cause treats an absent one as unknown and takes its\n       * refusing arm; `no_composer` is the only value that says no box exists\n       * to protect.\n       */\n      refusal?: 'no_composer' | 'dialog';\n  };"},{"name":"PromptMedia","kind":"type","line":9329,"doc":{"desc":["What `$.prompt.media({ id })` answers: one attached item's bytes as the","engine would send them now, or why there are none to read.","","An image is read after the engine's own resize, a document as held. One","call answers at most 4 MiB: `size` is the whole item's, `next` goes on.","Only a hook on the `prompt.submit` that lists the item is answered."],"params":[],"example":[],"returns":[]},"text":"  export type PromptMedia = {\n      /**\n       * The item's kind.\n       */\n      type: 'image' | 'document';\n      /**\n       * The MIME type of the bytes answered (`image/png`), after the resize.\n       */\n      mediaType: string;\n      /**\n       * This call's slice of the item, base64. The slices' strings, joined in\n       * order, are the whole item's base64.\n       */\n      base64: string;\n      /**\n       * How many bytes the whole item holds, decoded.\n       */\n      size: number;\n      /**\n       * The offset the following slice starts at; absent on the last one.\n       */\n      next?: number;\n      unreadable?: undefined;\n      deny?: undefined;\n  } | {\n      /**\n       * Why the model will not receive the item as media: the engine could\n       * not process it, and sends a line of text in its place.\n       */\n      unreadable: string;\n      type?: undefined;\n      mediaType?: undefined;\n      base64?: undefined;\n      size?: undefined;\n      next?: undefined;\n      deny?: undefined;\n  } | {\n      /**\n       * Why this read is refused: no submission in flight carries the id\n       * for this caller, the item is not held as inline bytes, or the offset\n       * is past its end.\n       */\n      deny: string;\n      type?: undefined;\n      mediaType?: undefined;\n      base64?: undefined;\n      size?: undefined;\n      next?: undefined;\n      unreadable?: undefined;\n  };"},{"name":"PromptMediaArgs","kind":"type","line":9384,"doc":{"desc":["What `$.prompt.media(args)` takes: which attached item of the prompt","being submitted to read, and from where in it."],"params":[],"example":[],"returns":[]},"text":"  export type PromptMediaArgs = {\n      /**\n       * The item's handle, as `e.attachments` of the `prompt.submit` in flight\n       * lists it.\n       */\n      id: string;\n      /**\n       * Where the slice starts, in bytes of the item: an earlier read's `next`.\n       * Absent, the start.\n       */\n      offset?: number;\n  };"},{"name":"PromptMentionAttached","kind":"type","line":9405,"doc":{"desc":["How the engine attached a mentioned file, in the names `prompt.attachment`","gives its `type`.","","`file`: read now, whole or in part. `already_read_file`: the model holds","it unchanged, nothing is sent again. `pdf_reference`: a PDF too long to","inline, named for the model to open by pages."],"params":[],"example":[],"returns":[]},"text":"  export type PromptMentionAttached = 'file' | 'already_read_file' | 'pdf_reference';"},{"name":"PromptMentionInput","kind":"type","line":9415,"doc":{"desc":["The input of `prompt.mention`: one file a prompt names after an `@`, as","the engine resolved it and before it is read for the model.","","A hook rewrites what is read (`path`, `offset`, `limit`); `mention` and","`agentId` are pinned. A directory and a path a deny rule covers raise","nothing; whether a file is there is the read's to find."],"params":[],"example":[],"returns":[]},"text":"  export type PromptMentionInput = {\n      /**\n       * What followed the `@`, a path as the person typed it, a fragment\n       * included (`#L10-20`). Pinned: what the prompt said.\n       */\n      mention: string;\n      /**\n       * The file's absolute path, as the engine resolved the mention.\n       *\n       * `next({ ...e, path })` reads another file, judged by the deny rules\n       * where it lands, links followed. One read per mention: a second `next`\n       * settles with the first's.\n       */\n      path: string;\n      /**\n       * The first line read, counted from 1, when the mention names lines\n       * (`#L10`); absent for a whole file. A rewrite is where the read starts.\n       */\n      offset?: number;\n      /**\n       * How many lines are read when the mention names lines (`#L10-20` reads\n       * 11); absent for a whole file. A rewrite is how many are read.\n       */\n      limit?: number;\n      /**\n       * The loop whose prompt carries the mention: a subagent's id, the `id`\n       * `$.agent.list()` gives it; absent on main.\n       *\n       * Pinned: a different value is refused, one left out is kept.\n       */\n      agentId?: string;\n  };"},{"name":"PromptMentionResult","kind":"type","line":9455,"doc":{"desc":["What a `prompt.mention` hook returns and what `next(e)` resolves to: how","the file was attached (`{ type, context? }`), or `{ deny: reason }`.","","The file's text is its attachment's, which `prompt.attachment` rewrites.","A hook that answers without `next` had no file read."],"params":[],"example":[],"returns":[]},"text":"  export type PromptMentionResult = {\n      /**\n       * How the engine attached the file; null when it attached nothing: no\n       * file is there, it is too large, or it cannot be read.\n       *\n       * From a hook answering without `next`: null, nothing was read.\n       */\n      type: PromptMentionAttached | null;\n      /**\n       * What the model reads after the prompt's mentioned files and the\n       * person never sees, each entry one block. From core, none.\n       *\n       * An answer keeps every entry its `next` gave, none empty: one with\n       * no `context` over a `next` that had one is refused. Past 100,000\n       * characters (200,000 together) the model reads a head and a path.\n       *\n       * @example\n       * return { ...result, context: [...(result.context ?? []), mine] }\n       */\n      context?: readonly string[];\n      deny?: undefined;\n  } | {\n      /**\n       * Refuses the mention: nothing of the file is attached, and a read\n       * already made is forgotten. The debug log names the reason.\n       *\n       * From core: a deny rule covers the path a hook passed on. A context\n       * beside it is dropped. A hook that throws or outlasts its budget is\n       * skipped, and the file is read as if the hook were not there.\n       */\n      deny: string;\n      type?: undefined;\n      context?: undefined;\n  };"},{"name":"PromptOrigin","kind":"type","line":9498,"doc":{"desc":["Where a `prompt.submit` submission came from, as the engine knows it at","the site it was queued from; a closed set, never a text prefix.","","A hooks module reads `e.origin.kind` to tell the user's own Enter from a","notification, a peer session, a schedule or another plugin. `next(e)`","passes it on as received; an answer may leave it out; no hook sets one."],"params":[],"example":[],"returns":[]},"text":"  export type PromptOrigin = {\n      /**\n       * The user's own gesture at the terminal, as the engine stamped it\n       * (never presumed from an unstamped command).\n       *\n       * Enter at the prompt, typed or queued, or a click on a transcript\n       * link; a channel the engine cannot attest (a same-user socket) is\n       * never stamped, and arrives as `unclassified`.\n       */\n      kind: 'composer';\n  } | {\n      /**\n       * The user's message through the Remote Control bridge (a phone or\n       * web client).\n       */\n      kind: 'bridge';\n  } | {\n      /**\n       * The SDK host's own turn (`claude -p`, the Agent SDK), not typed at\n       * a terminal.\n       */\n      kind: 'sdk';\n  } | {\n      /**\n       * A background task's notification, dequeued when the session went\n       * idle or delivered into a running turn (`turnId` set).\n       */\n      kind: 'task-notification';\n  } | {\n      /**\n       * A scheduled task or /loop firing its stored prompt.\n       */\n      kind: 'scheduled-trigger';\n  } | {\n      /**\n       * Another Claude session's message (\"Another Claude session sent a\n       * message\"), as a turn of its own or delivered into a running one.\n       */\n      kind: 'peer';\n  } | {\n      /**\n       * Another session's SendMessage delivery, model-authored and framed\n       * as a notification.\n       */\n      kind: 'peer-send-message';\n  } | {\n      /**\n       * A delivery a coordinating session composed for one of its threads.\n       */\n      kind: 'projects-relay';\n  } | {\n      /**\n       * A message from a channel an MCP server relays (Slack, Telegram).\n       */\n      kind: 'channel';\n      /**\n       * The channel server's name.\n       */\n      server: string;\n  } | {\n      /**\n       * A coordinating session's hand-off to a worker session.\n       */\n      kind: 'coordinator';\n  } | {\n      /**\n       * A background observer agent's report to the agent it observes.\n       */\n      kind: 'observer';\n  } | {\n      /**\n       * An activity digest delivered to an observer agent.\n       */\n      kind: 'observer-activity';\n  } | {\n      /**\n       * A programmatic follow-up to a user's UI action, user-initiated but\n       * not typed this turn.\n       */\n      kind: 'auto-continuation';\n  } | {\n      /**\n       * A turn with no provenance the engine can name: one the ingress\n       * could not classify, or a command queued with no stamp at all.\n       *\n       * An idle notice or a delivery receipt the engine queued isMeta with\n       * no stamp is one too; the engine frames that shape as a non-user\n       * source.\n       */\n      kind: 'unclassified';\n  } | {\n      /**\n       * The session's owner pinging it from Slack.\n       */\n      kind: 'slack-ping';\n  } | {\n      /**\n       * A plugin's `$.prompt.submit`.\n       *\n       * The model reads the prompt under the plugin's name (\"The <name> plugin\n       * sent a message: ...\") unless the plugin submitted it `asUser`.\n       */\n      kind: 'plugin';\n      /**\n       * The submitting plugin's name.\n       */\n      name: string;\n      /**\n       * True when the plugin submitted the text as the person's own words\n       * (`$.prompt.submit({ text, asUser: true })`).\n       *\n       * The model reads it bare; the origin is still the plugin's for every\n       * hook and provenance gate.\n       */\n      asUser?: true;\n  };"},{"name":"PromptPaintArgs","kind":"type","line":9621,"doc":{"desc":["What a plugin's `$.prompt.paint(args)` takes, and a hook on `prompt.paint`","sees as `e` and may rewrite.","","Whose runs they are is the caller's name, which no argument or hook sets."],"params":[],"example":[],"returns":[]},"text":"  export type PromptPaintArgs = {\n      /**\n       * The draft `decorations` were computed for: nothing paints unless the box\n       * reads exactly this. May be left out only with an empty list.\n       */\n      text?: string;\n      /**\n       * This plugin's runs over the draft (PromptDecoration), replacing those it\n       * painted before; an empty list clears them.\n       *\n       * Another plugin's stand, a later one winning per style key. The draft's next\n       * change drops them, but for a `prompt.edit` hook in the terminal.\n       *\n       * @example await $.prompt.paint({ text,\n       *   decorations: [{ start: 0, end: 4, underline: true }] })\n       */\n      decorations: PromptDecoration[];\n  };"},{"name":"PromptPainted","kind":"type","line":9649,"doc":{"desc":["What `$.prompt.paint` resolves to: whether the runs were painted, and the","box as it stands (PromptBox).","","A mod whose text went stale computes again from `text`.","","The box goes to a plugin whose module calls `$.prompt.read`, through the","hooks on it; one that never does, or is refused there, gets the empty box."],"params":[],"example":[],"returns":[]},"text":"  export type PromptPainted = {\n      /**\n       * True once the runs stand over the draft, or a clear took them off; false\n       * where the box does not read `text`, or no box can take them.\n       */\n      isPainted: boolean;\n      /**\n       * The draft as it stands, which the call did not change; `''` where no box\n       * is drawn or the caller may not read it (see above).\n       */\n      text: string;\n      /**\n       * Where the person types next: an offset into `text`, which the call did\n       * not move.\n       */\n      cursor: number;\n  };"},{"name":"PromptSectionInput","kind":"type","line":9671,"doc":{"desc":["The input of `prompt.section`: one named section of the system prompt, at","the moment the engine assembles it."],"params":[],"example":[],"returns":[]},"text":"  export type PromptSectionInput = {\n      /**\n       * The section's id (`env_info_simple`, `memory`, ...), the same on every\n       * model and the one `prompt.compose` lists; the key a matcher narrows on.\n       */\n      name: string;\n      /**\n       * The section's text as core computed it, or null when core omits it.\n       */\n      text: string | null;\n  };"},{"name":"PromptSectionResult","kind":"type","line":9687,"doc":{"desc":["What a `prompt.section` hook returns: the text the prompt carries for that","section, or null to leave it out."],"params":[],"example":[],"returns":[]},"text":"  export type PromptSectionResult = {\n      text: string | null;\n  };"},{"name":"PromptSubmitArgs","kind":"type","line":9698,"doc":{"desc":["`prompt.submit`'s input as a plugin's call takes it: `origin`, `turnId`","and `wait` are the engine's to set, `context` the hooks' to attach.","","`origin` is the calling plugin's name; `turnId` is the turn a prompt typed","mid-turn ran over; `wait` is false, as a plugin's prompt runs once idle."],"params":[],"example":[],"returns":[]},"text":"  export type PromptSubmitArgs = Omit<PromptSubmitInput, 'origin' | 'turnId' | 'wait' | 'context' | 'command' | 'isMeta'> & {\n      /**\n       * Submit the text as the person's own words, read bare without the \"The\n       * <plugin> plugin sent a message\" frame; absent means framed.\n       *\n       * The origin every hook sees stays `{ kind: 'plugin', name, asUser: true }`\n       * and the transcript still names the plugin; `@file` mentions and pasted\n       * images are not expanded for a plugin's prompt, `asUser` or not.\n       *\n       * @example\n       * await $.prompt.submit({ text: 'what the person typed', asUser: true })\n       */\n      asUser?: true;\n  };"},{"name":"PromptSubmitAttachment","kind":"type","line":9717,"doc":{"desc":["A pasted or attached non-text item of a submitted prompt; its kind, never","its bytes, which `$.prompt.media` reads by the item's `id`."],"params":[],"example":[],"returns":[]},"text":"  export type PromptSubmitAttachment = {\n      /**\n       * The item's kind.\n       */\n      type: 'image' | 'audio' | 'document';\n      /**\n       * The item's MIME type (`image/png`), when known.\n       */\n      mediaType?: string;\n      /**\n       * The pasted file's name, when it had one.\n       */\n      filename?: string;\n      /**\n       * The engine's handle for the item while this `prompt.submit` is in flight:\n       * `$.prompt.media({ id })` reads its bytes.\n       *\n       * Opaque, and the engine's to set, as the whole list is: whatever a hook\n       * passes down for it, the hooks beneath read the engine's.\n       */\n      id?: string;\n  };"},{"name":"PromptSubmitCommand","kind":"type","line":9747,"doc":{"desc":["The slash command a submission runs, as the engine tells `prompt.submit`:","the command as `command.run`'s hooks left it, their change of arguments included."],"params":[],"example":["const typed = { name: 'review', args: 'the diff' } // \"/review the diff\""],"returns":[]},"text":"  export type PromptSubmitCommand = {\n      /**\n       * Which command, without its slash (`compact`, `hello`), aliases and\n       * folds resolved: `command.run`'s `command`.\n       */\n      name: string;\n      /**\n       * Everything after the command: what was typed, or what a\n       * `command.run` hook left of it; `\"\"` when there was nothing.\n       */\n      args: string;\n  };"},{"name":"PromptSubmitInput","kind":"type","line":9764,"doc":{"desc":["The input of `prompt.submit`: the prompt as typed, after the input became","a user message and before it enters the session."],"params":[],"example":[],"returns":[]},"text":"  export type PromptSubmitInput = {\n      /**\n       * The prompt's text as typed, pastes already expanded: what will reach\n       * the model, or a slash command's line as `command.run` left it (`command`).\n       */\n      text: string;\n      /**\n       * The slash command the submission runs (PromptSubmitCommand), set by the\n       * engine; a rewrite of `text` is then not applied, and the person is told.\n       *\n       * A `{ drop }` stops a skill or prompt command before it is rendered, and only\n       * the turn of a built-in that asks the model, which has run. A command that\n       * runs as a fork raises no `prompt.submit`. Mask arguments at `command.run`, a\n       * skill's body at `skill.prompt`. Pinned: left out it is put back, changed it\n       * fails the hook.\n       *\n       * @example\n       * on('prompt.submit', ($, e, next) => next(e.command ? e : masked(e)))\n       */\n      command?: PromptSubmitCommand;\n      /**\n       * True, set by the engine, on a prompt the person does not see as typed.\n       * Delivered into a running turn it takes a rewrite; starting a turn, none.\n       *\n       * Pinned: left out it is put back, changed it fails the hook.\n       *\n       * @example\n       * ($, e, next) => (e.isMeta && bad(e) ? { drop: 'no' } : next(masked(e)))\n       */\n      isMeta?: true;\n      /**\n       * Present only when the submission carried images or other non-text items.\n       */\n      attachments?: readonly PromptSubmitAttachment[];\n      /**\n       * What the model reads beside the prompt and the user never sees, each\n       * entry one block after the prompt as typed; absent as the engine raises it.\n       *\n       * A hook attaches on the way down: `next({ ...e, context: [...(e.context\n       * ?? []), mine] })`, keeping which it likes; none empty, any length: past\n       * 100,000 characters (200,000 together) the model reads a head and path.\n       */\n      context?: readonly string[];\n      /**\n       * The id of the model turn that was running when the prompt was submitted\n       * (`turn.start`'s `turnId`): typed over that turn, or delivered into it.\n       *\n       * A queued delivery (a peer session's message) reaches the model inside a\n       * running turn. Absent for a prompt submitted while the session was idle,\n       * and for a plugin's own (`$.prompt.submit`), which runs once it is idle.\n       */\n      turnId?: string;\n      /**\n       * Whether the user asked the prompt to wait its turn (`chat:queueSubmit`,\n       * `ctrl+x enter` by default): true for that submission, false otherwise.\n       *\n       * The engine queues every prompt typed mid-turn either way; the flag is\n       * for hooks, so one that cancels the running turn on a plain Enter can\n       * leave a waiting prompt alone. False for a prompt a plugin submitted.\n       */\n      wait: boolean;\n      /**\n       * Where the submission came from (PromptOrigin), set by the engine where\n       * it was queued: the user's Enter, a notification, a peer, a plugin.\n       *\n       * `next(e)` passes it on as received; no hook may set one.\n       */\n      origin: PromptOrigin;\n  };"},{"name":"PromptSubmitResult","kind":"type","line":9842,"doc":{"desc":["What a `prompt.submit` hook returns and what `next(e)` resolves to: the","prompt that entered, `{ text, context?, origin? }`, or `{ drop: reason }`.","","`next(e)` resolves once the prompt entered the session and its turn","started, or it was queued behind the running one; not when the turn ends,","which is `turn.complete`. A hook answering without `next` enters nothing."],"params":[],"example":[],"returns":[]},"text":"  export type PromptSubmitResult = {\n      /**\n       * The prompt that entered; from core, the text that arrived at the\n       * bottom. A rewrite passes it down, `next({ ...e, text })`.\n       */\n      text: string;\n      /**\n       * What entered beside the prompt for the model, never shown the user:\n       * from core, the context that arrived (`e.context`).\n       *\n       * Each entry is one block after the prompt as typed. A hook attaches\n       * context on the way down; one put here after `next` resolved is not\n       * attached (the prompt had entered), and is logged.\n       */\n      context?: readonly string[];\n      /**\n       * Where the prompt entered from: from core, `e.origin` as received;\n       * absent, the prompt is the user's own.\n       *\n       * A hook may put back the origin it received; it may not set another.\n       */\n      origin?: PromptOrigin;\n      drop?: undefined;\n  } | {\n      /**\n       * The prompt did not enter: a hook's refusal, a settings hook's block\n       * beneath, or the engine's own (a Stop stands, a host's limit reached).\n       *\n       * A hook's text is shown to the user as the reason; the engine's is\n       * logged. After a `next(e)` of the hook's was answered, a drop fails it:\n       * its `.catch` is asked, or it is skipped by name, its last `next` kept.\n       */\n      drop: string;\n      text?: undefined;\n      context?: undefined;\n      origin?: undefined;\n  };"},{"name":"PromptSuggestArgs","kind":"type","line":9884,"doc":{"desc":["`prompt.suggest`'s input as a plugin's `$.prompt.suggest(args)` takes it:","`origin` is the engine's to set (the calling plugin's name)."],"params":[],"example":[],"returns":[]},"text":"  export type PromptSuggestArgs = Omit<PromptSuggestInput, 'origin'>;"},{"name":"PromptSuggestInput","kind":"type","line":9890,"doc":{"desc":["The input of `prompt.suggest` (prompt-suggest/): a text about to be shown","dim in the empty prompt box, for Tab (or the right arrow) to take."],"params":[],"example":[],"returns":[]},"text":"  export type PromptSuggestInput = {\n      /**\n       * The proposed prompt: shown, not written; taking it puts it in the box\n       * for editing. `next({ ...e, text })` proposes another.\n       */\n      text: string;\n      /**\n       * Who proposes (PromptSuggestOrigin), set by the engine where the\n       * proposal starts. Pinned: `next(e)` passes it on as received.\n       */\n      origin: PromptSuggestOrigin;\n  };"},{"name":"PromptSuggestOrigin","kind":"type","line":9909,"doc":{"desc":["Who proposes the text at `prompt.suggest`, as the engine stamps it where","the proposal starts; a closed set a matcher narrows on.","","`next(e)` passes it on as received; no hook sets one."],"params":[],"example":[],"returns":[]},"text":"  export type PromptSuggestOrigin = {\n      /**\n       * The engine's own guess at the person's next prompt, generated after\n       * a turn (the prompt-suggestion service).\n       */\n      kind: 'suggestion';\n  } | {\n      /**\n       * A plugin's `$.prompt.suggest`.\n       */\n      kind: 'plugin';\n      /**\n       * The proposing plugin's name.\n       */\n      name: string;\n  };"},{"name":"PromptSuggestResult","kind":"type","line":9930,"doc":{"desc":["What a `prompt.suggest` hook returns and what `next(e)` resolves to:","whether the text is now the box's dim suggestion."],"params":[],"example":[],"returns":[]},"text":"  export type PromptSuggestResult = {\n      /**\n       * True once the box has the suggestion to show, at once or as soon as a\n       * dialog gives the box back; false where it cannot show.\n       *\n       * It cannot while the box holds text, a turn runs, the text is blank, or\n       * the session is headless. A hook answering `{ isShown: false }` without\n       * `next` keeps it from showing.\n       */\n      isShown: boolean;\n  };"},{"name":"RasterBlitArgs","kind":"type","line":9948,"doc":{"desc":["A `$.ui.blit` argument repainting one of the caller's mounted Rasters.","","`columns` and `rows`, when given, must be the mounted size (a resize is a","redraw, `$.ui.invalidate(\"ui.render\")`, not a blit)."],"params":[],"example":[],"returns":[]},"text":"  export type RasterBlitArgs = {\n      /**\n       * The site the Raster is drawn in, by the `requestId` this plugin draws\n       * it under: one of its panes' ids, a tool row's `tool_use_id`, the band's.\n       */\n      requestId: string;\n      /**\n       * The Raster's `key` in that drawing.\n       */\n      key: string;\n      /**\n       * The new cells, encoded as the element's `cells` are (RasterProps), for\n       * the mounted `columns * rows`.\n       */\n      cells: string;\n      /**\n       * The width the cells are laid out for; refused unless it is the mounted\n       * Raster's. Absent, the mounted width.\n       */\n      columns?: number;\n      /**\n       * The height the cells are laid out for; refused unless it is the mounted\n       * Raster's. Absent, the mounted height.\n       */\n      rows?: number;\n  };"},{"name":"RasterProps","kind":"type","line":9983,"doc":{"desc":["The props of `Raster`, the terminal surface's cell-grid leaf: a fixed box","of cells, each a glyph, a foreground and a background, packed in `cells`.","","A leaf: no children, `hover` or `onPress` yet; repainted in place by","`$.ui.blit`. Terminal only for now (elsewhere a fragment); its palette","paints 1024 distinct color pairs at once and the rest as their nearest."],"params":[],"example":[],"returns":[]},"text":"  export type RasterProps = {\n      /**\n       * The element's address within the drawing: what `$.ui.blit` names to\n       * repaint it, unique among the Rasters of one tree.\n       */\n      key: string;\n      /**\n       * How many terminal columns wide, 1 to 512; the site clips what its body\n       * cannot show.\n       */\n      columns: number;\n      /**\n       * How many terminal rows tall, 1 to 256.\n       */\n      rows: number;\n      /**\n       * Every cell, row-major: standard padded base64 of `columns * rows`\n       * little-endian u32 triplets `[codePoint, foreground, background]`.\n       *\n       * A code point is one printable width-1 BMP character (blocks, box drawing,\n       * braille too), or the tree is refused naming the cell's index; a color is\n       * `0x00RRGGBB`, or `0x01000000` (bit 24 alone) for the terminal's default.\n       *\n       * @example const words = Uint32Array.of(0x2588, 0xff8800, 0x01000000)\n       * const cells = new Uint8Array(words.buffer).toBase64() // one orange cell\n       */\n      cells: string;\n  };"},{"name":"ReadFunction","kind":"type","line":10022,"doc":{"desc":["`read($, source)`: the value of an atom (its initial while absent), of a","derived value, or under a plain reference; one `$.state.get` per value.","","Made while a `ui.render` hook draws, it subscribes the drawing as the","calls it makes would."],"params":[],"example":["const n = await read($, count)"],"returns":[]},"text":"  export type ReadFunction = {\n      <T>($: StateDollar, source: Atom<T>): Promise<T>;\n      <T>($: StateDollar, source: Derived<T>): Promise<T>;\n      <P extends keyof PluginState & string, K extends keyof PluginState[P] & string>($: StateDollar, source: StateRef<P, K>): Promise<StateValue<P, K> | undefined>;\n  };"},{"name":"Register","kind":"type","line":10039,"doc":{"desc":["The hooks module's entry: `export function register(on, options)`. `on`","registers hooks; `options` is the plugin's configuration (PluginOptions).","","The options are fixed for this activation: a change to them reloads the","plugin and `register` runs again with the new object. Hooks close over it.","Its return is dropped, a promise awaited: `on => on(...)` is a module."],"params":[],"example":["on(\"tool.call\", ($, e, next) => e.tool === \"Bash\" ? { deny: \"no\" } : next(e))"],"returns":[]},"text":"  export type Register = (on: On, options: PluginOptions) => unknown;"},{"name":"RegisteredToolSpec","kind":"type","line":10045,"doc":{"desc":["A ToolSpec as `$.tool.register` hands it on: the input schema filled in,","`isDeferred` as the plugin gave it."],"params":[],"example":[],"returns":[]},"text":"  export type RegisteredToolSpec = {\n      name: string;\n      description: string;\n      inputSchema: Record<string, unknown>;\n      isDeferred?: ToolDeferral;\n  };"},{"name":"Registration","kind":"type","line":10065,"doc":{"desc":["What `on(...)` returns for a hook of type `F`: the registration, which","takes one `.catch` (CatchHandler); without it a failed hook is absent.","","A second `.catch` on one registration throws, as does one after","register() returned and one on `engine.create`, whose hook has no budget","and whose failure is the load's."],"params":[],"example":["on(...).catch(($, e, next) => next.called ? next(e) : { deny: \"no\" })"],"returns":[]},"text":"  export type Registration<F> = {\n      /**\n       * Sets the handler run when the hook throws or overruns its budget; its\n       * answer within the grace stands as the hook's result for the dispatch.\n       *\n       * The budget is HookBudget's `ms` and the grace its `catchMs`, both on\n       * the clock that stops while the code waits on `next` or `$`.\n       *\n       * @remarks `claude plugin validate` lists each gating hook with or\n       *   without one.\n       */\n      readonly catch: (handler: CatchHandler<F>) => void;\n  };"},{"name":"RenderChildren","kind":"type","line":10087,"doc":{"desc":["What an element takes as `children`, as JSX passes them: a node, a number","(drawn as its string), a value the factory drops, or a list that may nest.","","`false`, `null` and `undefined` are dropped, so `{ok && <Text>hi</Text>}`","and `{n > 0 ? <Text>{n}</Text> : null}` type; a mapped list beside a","sibling nests. The element holds the flat, normalized list of RenderNode."],"params":[],"example":[],"returns":[]},"text":"  export type RenderChildren = RenderNode | number | boolean | null | undefined | readonly RenderChildren[];"},{"name":"RenderComponent","kind":"type","line":10100,"doc":{"desc":["Everything `ui.render` can draw: one name per component that has a render","site; a matcher narrows on it.","","The permission dialog is drawn by the engine alone, since its answer","authorises an action; a plugin adds context with `$.ui.notice`. `Pane` is","a component whose instances a plugin opens (`$.ui.open`), `Placed`","another (`$.ui.place`), and `Backdrop` the one a plugin sets","(`$.theme.set`), drawn behind the conversation by the desktop and mobile","apps alone."],"params":[],"example":[],"returns":[]},"text":"  export type RenderComponent = 'AskUserQuestion' | 'UserMessage' | 'AssistantMessage' | 'ToolUse' | 'ToolResult' | 'ToolGroup' | 'ToolProgress' | 'CommandOutput' | 'Spinner' | 'TurnDuration' | 'InfoNotice' | 'SessionMode' | 'PromptHint' | 'AbovePrompt' | 'Pane' | 'Placed' | 'Backdrop';"},{"name":"RenderElement","kind":"type","line":10110,"doc":{"desc":["What a render hook returns, and what `next(e)` resolves to: a plain-data","tree of elements (a Box or Text is a StyledElement), strings as children.","","Props are an allowlisted subset of Ink's Box/Text props (the ones","ElementProps declares); a tree with any other prop fails validation as a","whole and the engine's own component is drawn with the original props."],"params":[],"example":[],"returns":[]},"text":"  export type RenderElement = StyledElement<'Box', BoxHoverProps> | StyledElement<'Text', TextHoverProps> | {\n      /**\n       * A button, on every surface: `[ label ]` on the terminal, a native\n       * button on a desktop; a press raises `ui.press` (`e.element` the key).\n       *\n       * Built by `<Button>` or the table's `t.Button`. The `onPress` closure\n       * stays in the plugin's own environment under `press.handle`; the host\n       * holds the handle for the lifetime of the drawing.\n       */\n      type: 'Button';\n      props: {\n          /**\n           * The element's address: what `e.element` carries and what a matcher\n           * names (`{ element: \"explain\" }`).\n           */\n          key: string;\n          /**\n           * The text drawn on the button; where it holds `children`, the name\n           * of the control, which a surface that draws no children draws.\n           */\n          label: string;\n          /**\n           * One digit (`\"1\"`) or one lowercase letter (`\"w\"`) that presses it\n           * while the plugin's site holds the focus; anything else is refused.\n           *\n           * The band after ctrl+x tab or a click, a focused `Pane`: on keydown,\n           * lowercased; never from the composer, save a bare digit in an empty\n           * one pressing a band Button. Two on one hotkey: the later wins.\n           */\n          hotkey?: string;\n          /**\n           * An engine keybinding action (`\"app:cycleDiffBase\"`) whose chord\n           * presses the Button from the prompt; an unknown name is refused.\n           *\n           * Chords, or a modified key Global or an active context binds, on\n           * the terminal while mounted, no dialog up, no engine handler of it\n           * mounted; a pane's over the band's over another's, the last drawn.\n           */\n          action?: string;\n          /**\n           * Drawn without chrome: the hotkey in the accent color, a colon,\n           * then the label (`1: Yes`); without a `hotkey`, the label alone.\n           *\n           * The focus still inverts it. In JSX the label may be the one string\n           * child (`<Button hotkey=\"1\" plain onPress={...}>Yes</Button>`); the\n           * key defaults to the label.\n           */\n          plain?: true;\n          /**\n           * The label dim at rest, as `Text`'s `dimColor`, and at full strength\n           * under the pointer or the focus; absent draws as false.\n           */\n          dimColor?: TextProps['dimColor'];\n          /**\n           * `\"primary\"` marks the main action of several, drawn as the surface\n           * marks the one to press; `\"secondary\"`, and absent, draw as before.\n           *\n           * The terminal draws a primary in the accent color; `plain` wins over\n           * it. Carried to every surface as written, never filled in.\n           *\n           * @example { key: 'save', label: 'Save', variant: 'primary' }\n           */\n          variant?: ButtonProps['variant'];\n          /**\n           * `\"dismiss\"` marks the Button that closes its site, a drawing hint\n           * only: the terminal draws it as without, a desktop its close control.\n           *\n           * Carried to every surface as written, never filled in.\n           *\n           * @example { key: 'dismiss', label: 'Dismiss', role: 'dismiss' }\n           */\n          role?: ButtonProps['role'];\n          /**\n           * The site's ring starts on this element when the site takes the\n           * keyboard; the first drawn of several. Absent draws as before.\n           */\n          autoFocus?: true;\n      };\n      /**\n       * Where the handler lives: the plugin whose hook drew the element, and\n       * the handle its environment keeps the `onPress` closure under.\n       *\n       * The runtime stamps the plugin as the tree leaves that hook.\n       */\n      press: {\n          plugin: string;\n          handle: number;\n      };\n      /**\n       * Label style overrides (the Text set) the surface applies while the\n       * nearest keyed Box, or the group `scope` names, is hovered; plain data.\n       */\n      hover?: TextHoverProps;\n      /**\n       * What is drawn in the label's place, all of it one pressable: strings\n       * and `Text` (a chip, a dim part), any other element refused.\n       *\n       * Absent for a Button of a label alone, drawn as it always was.\n       */\n      children?: RenderNode[];\n  } | {\n      /**\n       * A text field on every surface, of one line or of `rows`; a change and\n       * Enter raise `ui.input` (`e.element`, `e.kind`, `e.value` the text).\n       *\n       * Built by `<Input>` or the table's `t.Input`. The `onInput` and\n       * `onSubmit` closures stay in the plugin's own environment under\n       * `press.handle`, held as a Button's is. A leaf: no children.\n       */\n      type: 'Input';\n      props: {\n          /**\n           * The element's address: what `e.element` carries and what a matcher\n           * names (`{ element: \"reply\" }`).\n           */\n          key: string;\n          /**\n           * Text drawn before the field.\n           */\n          label?: string;\n          /**\n           * Text drawn dim in an empty field.\n           */\n          placeholder?: string;\n          /**\n           * The text the field holds when drawn.\n           */\n          value?: string;\n          /**\n           * What Enter does, drawn beside the field while it has focus.\n           */\n          submitLabel?: string;\n          /**\n           * How many lines tall the field is; from 2 it holds several lines.\n           * Absent is one.\n           */\n          rows?: number;\n          /**\n           * The site's ring starts on this element when the site takes the\n           * keyboard; the first drawn of several. Absent draws as before.\n           */\n          autoFocus?: true;\n      };\n      /**\n       * Where the handlers live: the plugin whose hook drew the element, and\n       * the handle its environment keeps the closures under.\n       *\n       * The runtime stamps the plugin as the tree leaves that hook.\n       */\n      press: {\n          plugin: string;\n          handle: number;\n      };\n      children?: undefined;\n  } | {\n      /**\n       * A one-of-several picker on every surface; a pick raises `ui.select`\n       * (`e.element` the key, `e.value` the option's value).\n       *\n       * Built by `<Select>` or the table's `t.Select`. The `onSelect` closure\n       * stays in the plugin's own environment under `press.handle`, held as\n       * a Button's is. A leaf: no children.\n       */\n      type: 'Select';\n      props: {\n          /**\n           * The element's address: what `e.element` carries and what a matcher\n           * names (`{ element: \"peer\" }`).\n           */\n          key: string;\n          /**\n           * Text drawn before the current value.\n           */\n          label?: string;\n          /**\n           * What can be picked, in the order drawn: each a value and the text\n           * drawn for it.\n           */\n          options: readonly SelectOption[];\n          /**\n           * Which option is selected when drawn.\n           */\n          value?: string;\n          /**\n           * The site's ring starts on this element when the site takes the\n           * keyboard; the first drawn of several. Absent draws as before.\n           */\n          autoFocus?: true;\n      };\n      /**\n       * Where the handler lives: the plugin whose hook drew the element, and\n       * the handle its environment keeps the closure under.\n       *\n       * The runtime stamps the plugin as the tree leaves that hook.\n       */\n      press: {\n          plugin: string;\n          handle: number;\n      };\n      children?: undefined;\n  } | {\n      /**\n       * A hyperlink every surface draws: an OSC 8 span on the terminal (its\n       * text then the URL in dim where unsupported), an anchor on desktop.\n       *\n       * Inline: its children are the text, strings and inline elements;\n       * absent children the label, absent both the URL. `href` is drawn as\n       * written; one that is no string draws the text plain.\n       */\n      type: 'Link';\n      props: LinkProps;\n      children?: RenderNode[];\n  } | {\n      /**\n       * Source code every surface draws with the engine's highlighter, tokens\n       * coloured by language; under `format: 'diff'`, unified-diff hunks.\n       *\n       * A leaf: a dim gutter numbers the lines from `startLine`; a diff has\n       * both gutters, markers, add and remove backgrounds. `source` is\n       * checked as a Text's string is, or the tree is refused.\n       */\n      type: 'Code';\n      props: CodeProps;\n      children?: undefined;\n  } | {\n      /**\n       * A block of markdown every surface draws as it draws an assistant\n       * reply's text: its own renderer, theme, hyperlinks and highlighting.\n       *\n       * Built by `<Markdown>` or the table's `t.Markdown`. A leaf: `text` is\n       * checked as a Text's string is, or the tree is refused. Without a\n       * `press` its links are the surface's own, opened as it opens links.\n       */\n      type: 'Markdown';\n      props: MarkdownLeafProps;\n      /**\n       * Whose `key` it is, set by the engine on a keyed one as the tree\n       * leaves its hook, as a Box's `part` is.\n       */\n      part?: PluginStamp;\n      children?: undefined;\n  } | {\n      /**\n       * A `Markdown` whose plugin answers the links it drew (`onLinkPress`):\n       * a press on one raises `ui.press` with `e.link`, the surface opens none.\n       */\n      type: 'Markdown';\n      props: MarkdownLeafProps;\n      /**\n       * Where the `onLinkPress` handler lives: the plugin whose hook drew\n       * the element, and the handle its environment keeps the closure under.\n       *\n       * The runtime stamps the plugin as the tree leaves that hook.\n       */\n      press: {\n          plugin: string;\n          handle: number;\n      };\n      children?: undefined;\n  } | {\n      /**\n       * A region one of the plugin's SURFACE MODULES, named by path, draws and\n       * handles input for on the drawing thread, without `$` (ClientModule).\n       *\n       * `Client` from the table. One instance per plugin, drawing and `key`\n       * lives while the node stays in the tree, and talks to the plugin's\n       * hooks through `ui.message`. The desktop carries it as data.\n       */\n      type: 'Client';\n      props: ClientProps;\n      /**\n       * Whose surface module `props.module` names: the plugin whose hook\n       * drew the element, stamped by the runtime as the tree leaves it.\n       */\n      client: {\n          plugin: string;\n      };\n      children?: undefined;\n  } | {\n      /**\n       * A vector drawing, the remote surfaces' alone: the SVG markup is the\n       * element's data, drawn in an isolated box, off the page.\n       *\n       * A leaf: hooks above wrap or replace it whole, nothing reaches inside;\n       * a press other plugins should see goes on an enclosing Button. On a\n       * surface whose table lacks it the tree is refused.\n       */\n      type: 'Svg';\n      props: SvgProps;\n      children?: undefined;\n  } | {\n      /**\n       * A grid of terminal cells, the terminal surface's alone: each cell a\n       * glyph, a foreground and a background, packed in `props.cells`.\n       *\n       * A leaf, one node however many cells; hooks above wrap or replace it\n       * whole. A mounted one is repainted in place by its plugin's\n       * `$.ui.blit`. On a surface whose table lacks it the tree is refused.\n       */\n      type: 'Raster';\n      props: RasterProps;\n      /**\n       * Whose Raster: the plugin whose hook drew the element, stamped by the\n       * runtime as the tree leaves it; the one plugin whose blit reaches it.\n       */\n      raster: {\n          plugin: string;\n      };\n      children?: undefined;\n  } | {\n      /**\n       * A picture, the terminal surface's alone: `props.source` drawn over a\n       * box of cells where the terminal can, `props.alt` where it cannot.\n       *\n       * A leaf: hooks above wrap or replace it whole; a press other plugins\n       * should see goes on an enclosing Button; keyed, its plugin's\n       * `$.ui.blit` swaps it. On a surface without it the tree is refused.\n       */\n      type: 'Image';\n      props: ImageProps;\n      /**\n       * Whose Image: the plugin whose hook drew the element, stamped by the\n       * runtime as the tree leaves it; the one plugin whose blit reaches it.\n       */\n      image: {\n          plugin: string;\n      };\n      children?: undefined;\n  } | {\n      /**\n       * The component core draws itself, with the props held under `ref`.\n       */\n      type: 'engine';\n      /**\n       * Which drawing: the number core answered from `next(e)`, under which\n       * it holds the props it received; 0 draws the original props.\n       */\n      ref: number;\n  };"},{"name":"RenderEventName","kind":"type","line":10454,"doc":{"desc":["The render event: `ui.render`, one event for every component that has a","render site."],"params":[],"example":[],"returns":[]},"text":"  export type RenderEventName = 'ui.render';"},{"name":"RenderInput","kind":"type","line":10460,"doc":{"desc":["The input of `ui.render`: a union discriminated by `component`, one member","per RenderComponent and per RenderSurface."],"params":[],"example":[],"returns":[]},"text":"  export type RenderInput<C extends RenderComponent = RenderComponent, P extends RenderSurface = RenderSurface> = C extends RenderComponent ? P extends RenderSurface ? RenderInputOf<C, P> : never : never;"},{"name":"RenderInputOf","kind":"type","line":10465,"doc":{"desc":["One `ui.render` input, for a component narrowed to one surface."],"params":[],"example":[],"returns":[]},"text":"  export type RenderInputOf<C extends RenderComponent, P extends RenderSurface> = {\n      /**\n       * Where the tree will be drawn; one literal per member, so\n       * `if (e.surface === \"terminal\")` narrows `e` and `$.ui.resolve(e)`.\n       *\n       * Over the wire it is what the client declared, a rendering fact and not a\n       * trust signal: do not key policy on it.\n       */\n      surface: P;\n      /**\n       * Which component this instance is; the key a matcher narrows on.\n       */\n      component: C;\n      /**\n       * The instance: the tool_use_id for a dialog or tool row, the message id\n       * for a message, the agent id for a spinner.\n       *\n       * Two drawings of one component are two instances.\n       */\n      requestId: string;\n      /**\n       * The size of what the surface draws into, in character cells, and whether\n       * its layout docks a pane; absent where no surface has measured.\n       *\n       * Part of the envelope: a rewrite keeps it. On the terminal, the interactive\n       * screen's, where a change of width re-draws every hooked site once the\n       * resize settles; on a remote surface, what it reported.\n       */\n      viewport?: RenderViewport;\n      /**\n       * The component's plain-data props.\n       */\n      props: RenderPropsOf[C];\n  };"},{"name":"RenderNode","kind":"type","line":10503,"doc":{"desc":["A node of a render tree: an element, or a string (text)."],"params":[],"example":[],"returns":[]},"text":"  export type RenderNode = RenderElement | string;"},{"name":"RenderPropsOf","kind":"type","line":10513,"doc":{"desc":["The plain-data props of each renderable component, as `ui.render` sees","them under `e.props`; a hook rewrites them with `next({ ...e, props })`.","","A rewrite is validated by the component and an invalid one draws the","original. This table is the plugin-facing render contract; the author's","file notes which surfaces raise each member (RENDER_SURFACES_OF)."],"params":[],"example":[],"returns":[]},"text":"  export type RenderPropsOf = {\n      /**\n       * The dialog the AskUserQuestion tool opens.\n       *\n       * A tree for it holds the engine's node once, nothing below it, in at most\n       * 12 rows on the terminal and 48 on desktop, vscode and mobile, counted at\n       * 40 columns; Markdown on those three alone; no size or place on any.\n       *\n       * Raised on every attached surface.\n       */\n      AskUserQuestion: {\n          /**\n           * The name of the tool whose call opened the dialog (`AskUserQuestion`).\n           */\n          tool: string;\n          /**\n           * The tool's `questions` input, as the dialog will draw them; a rewrite\n           * must still fit the tool's schema or the original is drawn.\n           */\n          questions: unknown[];\n          /**\n           * The call's `metadata.source` (who asked) when the model gave one.\n           * Analytics only; never drawn.\n           */\n          metadataSource?: string;\n      };\n      /**\n       * A user-role transcript row: the person's prompt (`> ...`), a background\n       * task's notification, or a message another agent, teammate or session sent.\n       *\n       * `origin`, `task` and `from` tell them apart and are read-only; a rewrite\n       * of `text` draws in the row alone: the stored message, and the model's\n       * framing of another party's words as that party's, stay as they were.\n       *\n       * Raised on every attached surface.\n       */\n      UserMessage: {\n          /**\n           * What the row shows: the prompt as typed, a notification's summary, or\n           * a message's body less the engine's framing (summary line included).\n           * A plugin's prompt is the text it sent; `origin.name` names the plugin.\n           *\n           * A rewrite is printable text, drawn up to its first 100000 characters\n           * where the engine draws the body; a teammate block of several frames or\n           * with a summary line keeps the engine's drawing: one string is not those.\n           */\n          text: string;\n          /**\n           * Where the stored message came from, as `prompt.submit` named it: the\n           * composer's, a task notification's, a peer's, a channel's, a plugin's.\n           *\n           * `unclassified` for a teammate's (its drain stamps none) and for a\n           * message stored before stamps. Read-only.\n           */\n          origin: PromptOrigin;\n          /**\n           * Whether the view draws the row in full: the ctrl+o transcript,\n           * `--verbose`, a surface with no ctrl+o (an export). Read-only.\n           *\n           * So does a row under a speaker label whose body fits the label view's\n           * cap. False, a message row is one dim line naming its sender (under a\n           * speaker label, the capped head of a long body).\n           *\n           * @remarks A hook that draws a compact row of its own passes when true,\n           *   so ctrl+o shows all.\n           */\n          isExpanded: boolean;\n          /**\n           * What a notification row (`origin.kind` `task-notification`) reports\n           * on: its background task; absent on every other row. Read-only.\n           */\n          task?: UserMessageTask;\n          /**\n           * Who sent the message the row carries: another agent of this session, a\n           * teammate, another session, a channel; absent otherwise. Read-only.\n           */\n          from?: UserMessageFrom;\n          /**\n           * Which of its rows the transcript's viewport shows now: `null` while\n           * drawn outside it, absent where the surface does not say. Read-only.\n           *\n           * Reported once drawn and again when it changes: on a scroll, for the\n           * messages at the viewport's edges only. A rewrite carries it on as\n           * received; one that changes or drops it is refused.\n           */\n          onScreen?: OnScreen | null;\n      };\n      /**\n       * One block of an assistant reply in the transcript: its text, or a summary\n       * of the text the model wrote between two tool calls.\n       *\n       * A rewrite changes the drawing and leaves the stored message alone\n       * (ctrl+o). `isSummary` tells the two apart.\n       *\n       * Raised on every attached surface.\n       */\n      AssistantMessage: {\n          /**\n           * The block's text, markdown, as the surface's transcript will draw it:\n           * what it hides of a reply (the terminal's, a `<context>` block) is gone.\n           */\n          text: string;\n          /**\n           * True on the block that draws the bullet opening a reply.\n           */\n          isFirstOfReply: boolean;\n          /**\n           * True on a block that holds a summary of the model's text, not the text\n           * itself; absent on any other block, and where the surface does not say.\n           *\n           * Where the terminal marks such a row (a faint ` \u00b7 summary` after its last\n           * line), it marks a rewritten `text` too; a hook's own tree draws without\n           * the mark. Read-only.\n           *\n           * @remarks A rewrite carries it on as received; one that changes or drops\n           *   it, or adds it, is refused, the hook that passed it failing.\n           */\n          isSummary?: true;\n          /**\n           * Which of its rows the transcript's viewport shows now: `null` while\n           * drawn outside it, absent where the surface does not say. Read-only.\n           *\n           * Reported once drawn and again when it changes: on a scroll, for the\n           * messages at the viewport's edges only. A rewrite carries it on as\n           * received; one that changes or drops it is refused.\n           */\n          onScreen?: OnScreen | null;\n      };\n      /**\n       * A tool call's row in the transcript (`Bash(ls -la)` and its result); the\n       * call was decided by `tool.call`, so a rewrite here changes the row alone.\n       *\n       * In mobile apps, a `borderStyle` or `backgroundColor` on the Box that holds\n       * the row and something else asks for a card under the row; otherwise a tree\n       * that keeps the row usually draws as one quiet line under it, with the rest\n       * behind a tap, so plain Text suits a small status.\n       *\n       * Raised on every attached surface.\n       */\n      ToolUse: {\n          /**\n           * The id `tool.call` carried for this call (`e.tool_use_id` there); the\n           * same value as the row's `requestId`, where it is looked for. Read-only.\n           */\n          tool_use_id: string;\n          /**\n           * Which one the row draws (`Bash`, `Read`, a plugin's tool), as\n           * `tool.call` named it.\n           */\n          tool: string;\n          /**\n           * The call's input, as the model sent it.\n           */\n          input: unknown;\n          /**\n           * True while the call is still running.\n           */\n          isRunning: boolean;\n          /**\n           * True when the call ended in an error (a refusal at the dialog is one).\n           */\n          isErrored: boolean;\n          /**\n           * True when an abort ended the call: the user's Esc or a plugin's\n           * `$.turn.abort` cut it while it ran, or dropped it before it ran.\n           *\n           * The row draws `Interrupted` for it, as the transcript marker does.\n           */\n          isInterrupted: boolean;\n          /**\n           * Whether the view draws the row in full: the ctrl+o transcript,\n           * `--verbose`, or a `ToolGroup` that a hook unfolded into rows. Absent\n           * where the surface does not say. Read-only.\n           *\n           * A hook that draws a compact row of its own passes when true, so ctrl+o\n           * shows all.\n           */\n          isExpanded?: boolean;\n          /**\n           * The stored result once the call has resolved (`{ stdout, stderr, ... }`\n           * for Bash: `BuiltinToolResults[tool]`); undefined while it runs.\n           *\n           * For a call that errored, was refused or an abort cut, it is the text\n           * the model read (an `isInterrupted` call: the abort's own). An expanded\n           * group's rows draw it inline; a standalone row's is its own `ToolResult`.\n           */\n          output?: unknown;\n          /**\n           * Which of its rows the transcript's viewport shows now: `null` while\n           * drawn outside it, absent where the surface does not say. Read-only.\n           *\n           * Reported once drawn and again when it changes: on a scroll, for the\n           * messages at the viewport's edges only. A rewrite carries it on as\n           * received; one that changes or drops it is refused.\n           */\n          onScreen?: OnScreen | null;\n      };\n      /**\n       * The result block drawn under a standalone tool row in the transcript,\n       * which the tool's own result renderer draws from `output`.\n       *\n       * A rewrite of `output` is checked against the tool's output schema (one\n       * that does not fit draws nothing; one the renderer cannot read hits the\n       * row's error boundary). The stored result is untouched.\n       *\n       * Raised on every attached surface.\n       */\n      ToolResult: {\n          /**\n           * The id `tool.call` carried for the call this result belongs to\n           * (`e.tool_use_id` there); the same value as `requestId`. Read-only.\n           */\n          tool_use_id: string;\n          /**\n           * Which one the result belongs to (`Bash`, `Read`, a plugin's tool).\n           * Read-only.\n           */\n          tool: string;\n          /**\n           * The tool's own result object (`{ stdout, stderr, interrupted, ... }` for\n           * Bash), the same one `ToolUse.output` carries; a rewrite is drawn.\n           *\n           * A built-in tool's is `BuiltinToolResults[tool]`, the record\n           * `tool.call` resolved as `result`.\n           */\n          output: unknown;\n          /**\n           * True when the call ended in an error, which draws the error text and not\n           * `output`. Read-only.\n           */\n          isErrored: boolean;\n          /**\n           * Whether the view draws the row in full: the ctrl+o transcript,\n           * `--verbose`. Absent where the surface does not say. Read-only.\n           *\n           * A hook that draws a compact row of its own passes when true, so ctrl+o\n           * shows all.\n           */\n          isExpanded?: boolean;\n          /**\n           * Which of its rows the transcript's viewport shows now: `null` while\n           * drawn outside it, absent where the surface does not say. Read-only.\n           *\n           * Reported once drawn and again when it changes: on a scroll, for the\n           * messages at the viewport's edges only. A rewrite carries it on as\n           * received; one that changes or drops it is refused.\n           */\n          onScreen?: OnScreen | null;\n      };\n      /**\n       * A run of tool calls the transcript folds into one count line (`Read 3\n       * files, ran 2 shell commands`): reads, searches, listings.\n       *\n       * A hook that sets `isExpanded` unfolds the group where it is, and each row\n       * it unfolds into is a `ToolUse` drawing a `ToolUse` hook then sees.\n       *\n       * @remarks In fullscreen mode the ctrl+o transcript does not fold runs: each\n       *   call there is a `ToolUse` row and no `ToolGroup` is drawn.\n       *\n       * Raised on every attached surface.\n       */\n      ToolGroup: {\n          /**\n           * In the order the model made them.\n           */\n          calls: ReadonlyArray<ToolGroupCall>;\n          /**\n           * True while the group is the live one: a call in it may still be\n           * running and the model's next call may join it.\n           */\n          isActive: boolean;\n          /**\n           * Whether each call draws as its own `ToolUse` row, or the group draws\n           * one line.\n           *\n           * True under `--verbose` and in the non-fullscreen ctrl+o transcript. The\n           * only prop a rewrite changes on the screen.\n           */\n          isExpanded: boolean;\n          /**\n           * True when the group holds nothing but `calls` and the model's thinking\n           * between them, and no call errored or was interrupted: no recalled\n           * memory, hook timing or other row. What the line shows from the calls'\n           * own input and output (paths, patterns, git results) counts as calls.\n           * Absent where the surface does not say. Read-only.\n           *\n           * A hook that draws a group of its own calls in its own way checks it is\n           * true. Such a hook still replaces the summary of the current task that\n           * the live group's line can show in place of its counts.\n           */\n          isCallsOnly?: boolean;\n          /**\n           * Which of its rows the transcript's viewport shows now: `null` while\n           * drawn outside it, absent where the surface does not say. Read-only.\n           *\n           * Reported once drawn and again when it changes: on a scroll, for the\n           * messages at the viewport's edges only. A rewrite carries it on as\n           * received; one that changes or drops it is refused.\n           */\n          onScreen?: OnScreen | null;\n      };\n      /**\n       * The output row a slash command printed in the transcript, under its echo\n       * (`/cost`'s lines, the `text` a `command.run` hook answered).\n       *\n       * What the run resolved as text, a `local` command's or a plugin's alike. A\n       * rewrite of `text` draws there and the stored row keeps what the model\n       * reads; a hook's own tree draws in the row's place, the transcript's width.\n       *\n       * Raised on every attached surface.\n       */\n      CommandOutput: {\n          /**\n           * Which one printed the row, as `command.run` named it (no slash); a\n           * hook on its own command matches by it.\n           *\n           * Read-only: a rewrite carries it on as received; one that changes or\n           * drops it is refused and the engine draws its own row.\n           */\n          command: string;\n          /**\n           * The arguments the run had, as the echo above the row shows them\n           * (`***` for a command that marks its arguments sensitive). Read-only.\n           */\n          args: string;\n          /**\n           * The row's text: what the command printed, or the `text` a hook\n           * answered under its plugin's name; markdown, as the row draws it.\n           */\n          text: string;\n          /**\n           * True when the row is the run's error line (a command that threw),\n           * which draws in the error colour and not dim. Read-only.\n           */\n          isErrored: boolean;\n          /**\n           * Which of its rows the transcript's viewport shows now: `null` while\n           * drawn outside it, absent where the surface does not say. Read-only.\n           *\n           * Reported once drawn and again when it changes: on a scroll, for the\n           * messages at the viewport's edges only. A rewrite carries it on as\n           * received; one that changes or drops it is refused.\n           */\n          onScreen?: OnScreen | null;\n      };\n      /**\n       * One row of the live tool-progress region under a running tool call; today\n       * the run-in-background pill. One instance per row.\n       *\n       * A union on `kind`: other progress kinds join as their props become plain\n       * data, each with its own fields, so a hook matches `{ props: { kind:\n       * \"background_hint\" } }` or branches on `e.props.kind` and stays right.\n       *\n       * Raised on the terminal surface only.\n       */\n      ToolProgress: {\n          /**\n           * The tool call the row belongs to, as `tool.call` and the `ToolUse` row\n           * carry it. Read-only: a rewrite carries it on as received.\n           *\n           * While several foreground calls share one pill, the first of them.\n           */\n          tool_use_id: string;\n          /**\n           * Which progress row: the run-in-background pill. Read-only.\n           */\n          kind: 'background_hint';\n          /**\n           * The pill's text as the engine draws it, dim, under the tool call:\n           * `(ctrl+b to run in background)`, or with the person's own binding.\n           *\n           * A rewrite is drawn in its place, dim; `\"\"` draws nothing. A hook that\n           * returns a tree draws that instead.\n           */\n          hint: string;\n      };\n      /**\n       * The line that animates while a turn runs (`Sauteing... (12s, 300\n       * tokens)`); on the desktop, the row that carries the turn's mark.\n       *\n       * Reads `word` (or `message` while one overrides it), `suffix`, then what\n       * the surface keeps and no prop carries: elapsed time, tokens, effort. A\n       * hook rewrites the first three, or draws a tree in place of all of it.\n       *\n       * Raised on the terminal, desktop and vscode surfaces only.\n       */\n      Spinner: {\n          /**\n           * Animated by the line (`Sauteing`), as sampled for this turn.\n           *\n           * On the desktop, what the row says its step is doing (`Creating\n           * notes.md`), or `Working` while the row shows no words.\n           */\n          word: string;\n          /**\n           * The text drawn instead of the word while a state overrides it, else null.\n           */\n          message: string | null;\n          /**\n           * What the engine draws right after the word or message to say the turn is\n           * still going: one ellipsis character.\n           *\n           * Left off a text that already ends in an ellipsis, so a rewritten\n           * `message` ending in one shows one. A rewrite is drawn as given (`\"\"`\n           * draws the text bare, `\" ~\"` draws `Sauteing ~`); left out, the engine's.\n           */\n          suffix: string;\n          /**\n           * What the turn is doing. The desktop tells `thinking`, `requesting`,\n           * `tool-use` and `responding` apart and never says `tool-input`.\n           */\n          mode: 'requesting' | 'responding' | 'thinking' | 'tool-input' | 'tool-use';\n      };\n      /**\n       * The line that closes a turn in the transcript (`Baked for 3s`); a\n       * remote surface draws its own footer.\n       *\n       * Raised on the terminal surface only.\n       */\n      TurnDuration: {\n          /**\n           * The past-tense word the line drew (`Baked`), as sampled for this line.\n           */\n          word: string;\n          /**\n           * The turn's duration in milliseconds, as the line formats it (`3s`,\n           * `1m 4s`).\n           */\n          durationMs: number;\n          /**\n           * Whether the view is the ctrl+o transcript or `--verbose`. Absent where\n           * the surface does not say. Read-only.\n           *\n           * A hook that draws a compact row of its own passes when true, so ctrl+o\n           * shows all.\n           */\n          isExpanded?: boolean;\n          /**\n           * What the line waits on while it draws only its waiting text\n           * (`Waiting for 2 background agents to finish`: no budget, no\n           * hidden-messages count), read when the row mounts: the pending agents\n           * that started at or before the line's time. That can include an agent\n           * the line did not count, such as one resumed since the line, or, in a\n           * subagent's transcript, one that is not that subagent's child. Absent\n           * while it draws anything else, or when their count differs from the\n           * count it draws. Read-only.\n           *\n           * A hook that redraws the line for its own agents checks that each agent\n           * is its own and that `workflows` is 0.\n           */\n          waitingFor?: {\n              /**\n               * Each background agent the line waits on.\n               */\n              agents: ReadonlyArray<{\n                  /**\n                   * The same id as `task.id` on the UserMessage notification row that\n                   * reports its end.\n                   */\n                  id: string;\n                  /**\n                   * Which agent it runs (`general-purpose`, `<plugin>:<agent>`).\n                   */\n                  agentType: string;\n                  /**\n                   * The call that started it, as `tool.call` carried it\n                   * (`e.tool_use_id`), when its task records one.\n                   */\n                  tool_use_id?: string;\n              }>;\n              /**\n               * How many workflows the line waits on.\n               */\n              workflows: number;\n          };\n          /**\n           * Which of its rows the transcript's viewport shows now: `null` while\n           * drawn outside it, absent where the surface does not say. Read-only.\n           *\n           * Reported once drawn and again when it changes: on a scroll, for the\n           * messages at the viewport's edges only. A rewrite carries it on as\n           * received; one that changes or drops it is refused.\n           */\n          onScreen?: OnScreen | null;\n      };\n      /**\n       * One dim status line under the logo (the model source, an experiment\n       * enrollment, a settings hint), with a trailing `/command`.\n       *\n       * Raised on the terminal surface only.\n       */\n      InfoNotice: {\n          /**\n           * The notice's text, flattened to one string.\n           */\n          text: string;\n          /**\n           * The slash command appended after the text, or null when the notice has\n           * none.\n           */\n          command: string | null;\n          /**\n           * Which of its rows the transcript's viewport shows now: `null` while\n           * drawn outside it, absent where the surface does not say. Read-only.\n           *\n           * Reported once drawn and again when it changes: on a scroll, for the\n           * messages at the viewport's edges only. A rewrite carries it on as\n           * received; one that changes or drops it is refused.\n           */\n          onScreen?: OnScreen | null;\n      };\n      /**\n       * The dim mode labels at the right of the prompt footer (`focus`, `memory\n       * paused`), joined by ` & `. One instance.\n       *\n       * A hook adds a mode by rewriting `modes`, removes one by filtering, or\n       * draws its own tree.\n       *\n       * Raised on the terminal and desktop surfaces only.\n       */\n      SessionMode: {\n          /**\n           * The labels the footer shows, in order; empty when there are none.\n           */\n          modes: readonly string[];\n      };\n      /**\n       * The dim hint line under the prompt (`? for shortcuts`, `esc to\n       * interrupt`, the pills beside them). One instance.\n       *\n       * A hook rewrites `hint`, drawn in the line's place, sets `tail` to add to\n       * the line as the engine draws it, or draws its own tree; `isDraft` and\n       * `isWorking` say what the line is for.\n       *\n       * @remarks On the terminal, until a new answer lands the last keeps its row\n       *   (the engine's line before any).\n       *\n       * Raised on the terminal and desktop surfaces only.\n       */\n      PromptHint: {\n          /**\n           * True while the prompt holds typed text. Read-only.\n           */\n          isDraft: boolean;\n          /**\n           * True while a model turn is running. Read-only.\n           */\n          isWorking: boolean;\n          /**\n           * The line's text as the engine draws it; one string, so a rewrite\n           * replaces the line.\n           *\n           * Read from the drawn line the way the screen reader reads it, one space\n           * between parts.\n           */\n          hint: string;\n          /**\n           * Text a hook adds after the line; absent as the engine hands it.\n           *\n           * The terminal keeps the engine's line (its pills stay live) and draws\n           * `tail` dim at its end, cut where the row ends and left out where under\n           * four columns of it would show; no other surface draws it yet.\n           *\n           * @remarks A rewritten `hint` replaces the line, `tail` with it.\n           */\n          tail?: string;\n      };\n      /**\n       * The band directly above the prompt input, where the surveys draw; of its\n       * own the engine draws a `[-]` beside the tree, an `n more` row under it.\n       *\n       * A hook draws a tree, or passes; one instance. The person collapses it\n       * (ctrl+x ctrl+a, `[-]`) or focuses it (a click, ctrl+x tab): an Input\n       * types, a Button arms the hotkeys, a tree taller than it scrolls.\n       *\n       * Raised on the terminal and desktop surfaces only.\n       */\n      AbovePrompt: {\n          /**\n           * True while a survey holds the band; a hook yields to it. Read-only.\n           */\n          hasSurvey: boolean;\n          /**\n           * True while a model turn is running. Read-only.\n           */\n          isWorking: boolean;\n          /**\n           * Rows the band may take: in fullscreen, what the bottom slot has left\n           * above the prompt; otherwise the terminal's height. Read-only.\n           *\n           * That slot is capped at half the terminal's rows, the prompt's included.\n           * A tree of at most `maxRows` rows shows whole; a taller one scrolls in a\n           * window of `scroll.bodyRows`.\n           *\n           * @remarks A bare digit arms only the hotkeys of the Buttons wholly inside\n           *   that window, never one scrolled out of view.\n           */\n          maxRows: number;\n          /**\n           * Cells the band's tree is laid out in, none under a mark of the engine's:\n           * its column's width less the engine's five at the right end. Read-only.\n           *\n           * The column is the terminal, or the transcript's beside a docked `Pane`;\n           * the five hold the `[-]`. A wider tree wraps or truncates as its Text\n           * props say; size a table to it rather than to `viewport.columns`.\n           */\n          bodyColumns: number;\n          /**\n           * The band's window over a tree taller than `maxRows`: engine-owned,\n           * moved by the wheel, and by the person's keys while the band is focused.\n           *\n           * `bodyRows` is `maxRows` less the `n more` row. Read-only.\n           */\n          scroll: SiteScroll;\n          /**\n           * Which transcript is on screen above the band: the main conversation's\n           * (no `agentId`) or one agent's, opened from the tasks list.\n           *\n           * The same band under either; a switch re-runs the hook with the new\n           * view. Read-only: a rewrite carries it on as received; one that changes\n           * or drops it is refused, the hook that passed it failing.\n           */\n          view: SiteView;\n      };\n      /**\n       * The framed region a plugin opened with `$.ui.open({ id })`: one instance\n       * per id (`requestId`), its body the hook's tree, one shown, the rest tabs.\n       *\n       * Placed by the surface (docked in fullscreen, else above the prompt) and\n       * keyed by the person (ctrl+x tab, Esc), who closes it from the engine's mark\n       * or ctrl+x x: `ui.close` with origin `person`, which a hook may refuse.\n       *\n       * Raised on every attached surface.\n       */\n      Pane: {\n          /**\n           * Its tab's label while more than one pane is open (with one, the engine\n           * draws no title): the `title` it was opened with, or its id.\n           *\n           * A click on a tab, or Tab onto it and Enter, shows that pane. Read-only\n           * here; another `$.ui.open` (or a hook on `ui.open`) retitles.\n           */\n          title: string;\n          /**\n           * True while the person has given the pane the keyboard: Tab walks its\n           * elements, a Button's `hotkey` presses it, the arrows scroll. Read-only.\n           */\n          isFocused: boolean;\n          /**\n           * Cells across the body, inside the frame, none under a mark of the\n           * engine's: the close mark sits on a row of the frame's own. Read-only.\n           */\n          bodyColumns: number;\n          /**\n           * Where the surface seated the pane: `dock` beside the transcript (the\n           * terminal in fullscreen from 110 columns), or `inline` above the prompt.\n           *\n           * Read-only: a rewrite carries it on as received; one that changes or\n           * drops it is refused, the hook that passed it failing.\n           */\n          placement: 'dock' | 'inline';\n          /**\n           * The body's window over the tree: engine-owned, moved by the person's\n           * keys while the pane is focused. Read-only.\n           *\n           * `bodyRows` is the room's rows, never the rows showing: the most the frame\n           * may take less the engine's (an inline border's two, the tab row while one\n           * shows, a dock's row for the close mark). Inline the frame fits the tree.\n           */\n          scroll: SiteScroll;\n          /**\n           * Which transcript is on screen beside the pane: the main conversation's\n           * (no `agentId`) or one agent's, opened from the tasks list.\n           *\n           * The pane stays open across a switch, one instance re-rendered for the\n           * view, so a hook draws for the agent in view. Read-only: a rewrite carries\n           * it on as received; one that changes or drops it is refused.\n           */\n          view: SiteView;\n      };\n      /**\n       * A row a plugin placed in the transcript (`$.ui.place`): empty until a hook\n       * draws it, in the row's place in the conversation.\n       *\n       * Every plugin's hook hears every row, so read `plugin` beside `id`. Outside\n       * fullscreen a compaction ends the row, and the same id then places a new one.\n       *\n       * Raised on every attached surface.\n       */\n      Placed: {\n          /**\n           * What `$.ui.place` was given, unique among that plugin's rows. Read-only.\n           */\n          id: string;\n          /**\n           * Who placed the row, so a hook can leave another's alone. Read-only.\n           */\n          plugin: string;\n          /**\n           * Which of its rows the transcript's viewport shows now: `null` while\n           * drawn outside it, absent where the surface does not say. Read-only.\n           *\n           * Reported once drawn and again when it changes: on a scroll, for the\n           * messages at the viewport's edges only. A rewrite carries it on as\n           * received; one that changes or drops it is refused.\n           */\n          onScreen?: OnScreen | null;\n      };\n      /**\n       * The session's backdrop (`$.theme.set`), drawn behind the conversation by\n       * the desktop and mobile apps alone: empty until a hook draws it.\n       *\n       * Every plugin's hook hears it, so read `plugin` beside `id`. The surface\n       * sizes the drawing to its window or screen and lets presses through to what\n       * is over it. Each surface asks separately, so a hook can read `e.surface` to\n       * draw a different scene on each; a `Client` draws nothing on mobile.\n       *\n       * Raised on the desktop and mobile surfaces only.\n       */\n      Backdrop: {\n          /**\n           * What `$.theme.set` was given as `backdrop`. Read-only.\n           */\n          id: string;\n          /**\n           * Who set the backdrop, so a hook can leave another's alone. Read-only.\n           */\n          plugin: string;\n          /**\n           * How the surface frosts its panels over the drawing, defaults filled in;\n           * `false` where they stay as they are. Read-only.\n           */\n          glass: {\n              blur: number;\n              tint?: string;\n              opacity: number;\n          } | false;\n          /**\n           * Whether the scene is `light` or `dark`; absent where the plugin did not\n           * say. Read-only.\n           */\n          colorScheme?: 'light' | 'dark';\n      };\n  };"},{"name":"RenderResultOf","kind":"type","line":11262,"doc":{"desc":["What a `ui.render` hook returns and what `next(e)` resolves to: a","RenderElement tree, the same for every component."],"params":[],"example":[],"returns":[]},"text":"  export type RenderResultOf = {\n      [C in RenderComponent]: RenderElement;\n  };"},{"name":"RenderSurface","kind":"type","line":11281,"doc":{"desc":["The surface a render event's component is drawn on, by name. Plugins draw","into surfaces; they do not provide them.","","The surfaces the plugin was compiled against (the keys of Elements):","`terminal` is Ink, drawing the hook's whole tree; `desktop`, `mobile` and","`vscode` (Claude Code Desktop, the mobile app, VS Code) ask over the wire.","","A name here is no promise that its host draws. Under a host that attaches","no surface, hooks, tools and commands run and nothing drawn shows:","`$.session.surfaces()` is empty there."],"params":[],"example":[],"returns":[]},"text":"  export type RenderSurface = keyof Elements & string;"},{"name":"RenderViewport","kind":"type","line":11291,"doc":{"desc":["The size of what a surface draws into, in character cells of the","surface's monospace metric, and whether its layout docks a pane.","","On the terminal, the conversation's columns and screen rows; on a remote","surface, the pane's width and height over the advance and line height of","its code font. Cell-based until the first element lays out in pixels."],"params":[],"example":[],"returns":[]},"text":"  export type RenderViewport = {\n      /**\n       * Cells across. A tree wider than this wraps or truncates, as its Text\n       * props say.\n       */\n      columns: number;\n      /**\n       * Cells down the whole surface, not the room left for this component.\n       *\n       * Informational: a change of height alone re-draws nothing and keys no\n       * new evaluation, so a hook reads it as of the last width or props change.\n       */\n      rows: number;\n      /**\n       * Whether this surface docks a pane beside the transcript, so a pane a\n       * plugin opens unasked is a sidebar, not a takeover; absent is unknown.\n       *\n       * What `command.run`'s `presentation.isFullscreen` says. The terminal always\n       * says: `true` fullscreen, `false` on the main screen, fixed per session; a\n       * remote surface once its client reports it with the size, absent before.\n       *\n       * @remarks A remote surface that reports it places panes (`$.ui.open` is\n       *   placed there); the mobile app reports `false`. A change re-draws.\n       * @example if (e.viewport?.isFullscreen === true) void $.ui.open({ id })\n       */\n      isFullscreen?: boolean;\n  };"},{"name":"ResolveInput","kind":"type","line":11327,"doc":{"desc":["The input of `ui.resolve`: which surface's elements, for which component;","a union with one member per surface (ResolveInputOf).","","Resolved when the plugins load, ahead of any drawing, so it names the","surface and the component and not the props; a `ui.render` argument is","one (it carries both), which is what `$.ui.resolve(e)` takes."],"params":[],"example":[],"returns":[]},"text":"  export type ResolveInput<C extends RenderComponent = RenderComponent, P extends RenderSurface = RenderSurface> = P extends RenderSurface ? ResolveInputOf<C, P> : never;"},{"name":"ResolveInputOf","kind":"type","line":11332,"doc":{"desc":["One `ui.resolve` input, for a component on one surface."],"params":[],"example":[],"returns":[]},"text":"  export type ResolveInputOf<C extends RenderComponent, P extends RenderSurface> = {\n      /**\n       * Where the table draws; one literal per member, so a hook that narrows\n       * it narrows the table `next(e)` resolves to.\n       */\n      surface: P;\n      /**\n       * Which drawing the table is resolved for; the key a matcher narrows on.\n       */\n      component: C;\n  };"},{"name":"ResultOf","kind":"type","line":11348,"doc":{"desc":["What each event's hook returns, and what its `next(e)` resolves to, by event","name."],"params":[],"example":[],"returns":[]},"text":"  export type ResultOf = EngineResultOf & ClassicResultOf & {\n      [N in OpEventName]: OpEventResult<N>;\n  } & {\n      [N in NounEventName]: NounEventResult<N>;\n  };"},{"name":"SDKAssistantMessageError","kind":"type","line":11354,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"  type SDKAssistantMessageError = 'authentication_failed' | 'oauth_org_not_allowed' | 'account_on_hold' | 'verification_required' | 'billing_error' | 'rate_limit' | 'overloaded' | 'invalid_request' | 'model_not_found' | 'server_error' | 'unknown' | 'max_output_tokens' | 'cloud_credential_error';"},{"name":"Select","kind":"type","line":11359,"doc":{"desc":["The members of `T` assignable to `S`; all of `T` when none is."],"params":[],"example":[],"returns":[]},"text":"  type Select<T, S> = [Extract<T, S>] extends [never] ? T : Extract<T, S>;"},{"name":"Selected","kind":"type","line":11365,"doc":{"desc":["The events a pattern selects, as a union of names: the one named, every","one under a glob's namespace, or every one a negation does not exclude."],"params":[],"example":[],"returns":[]},"text":"  export type Selected<P extends string> = P extends '*' ? EventName : P extends `!${infer Negated}` ? Exclude<EventName, Selected<Negated>> : P extends `${infer Prefix}.*` ? Extract<EventName, `${Prefix}.${string}`> : Extract<EventName, P>;"},{"name":"Selection","kind":"type","line":11371,"doc":{"desc":["The literal each tag key of `I` is held to by matcher `M`: one-of arrays","flattened, RegExps widened to `unknown`."],"params":[],"example":[],"returns":[]},"text":"  type Selection<I, M> = {\n      [K in keyof M & TagKeys<I, keyof M>]: Literal<M[K] extends readonly (infer One)[] ? One : M[K]>;\n  };"},{"name":"SelectOption","kind":"type","line":11379,"doc":{"desc":["One option of a `Select`: the value `onSelect` and `ui.select` carry, and","the text drawn for it (the value when absent)."],"params":[],"example":[],"returns":[]},"text":"  export type SelectOption = {\n      value: string;\n      label?: string;\n  };"},{"name":"SelectProps","kind":"type","line":11392,"doc":{"desc":["The props of `Select`, every surface's one-of-several picker: an address,","a label, the options, the one selected, the closure a pick runs. A leaf.","","Focused through the same ring as `Button` (`abovePrompt:focus`); keys reach","it only while it has focus (arrows move, Enter picks) and Esc always","returns to the prompt; a pick raises `ui.select`, its bottom `onSelect`."],"params":[],"example":[],"returns":[]},"text":"  export type SelectProps = {\n      /**\n       * The element's address: `e.element` at `ui.select`, what a matcher names.\n       */\n      key: string;\n      /**\n       * Text drawn before the current value.\n       */\n      label?: string;\n      /**\n       * What can be picked, in the order drawn; at least one, values unique.\n       */\n      options: readonly SelectOption[];\n      /**\n       * Which option is selected when drawn; the person's pick replaces it\n       * until the hook draws another.\n       */\n      value?: string;\n      /**\n       * The site's focus ring starts here when the site takes the keyboard,\n       * instead of on nothing, as the DOM's `autofocus`: Enter acts on it at once.\n       *\n       * A pane opened with `focus`, or the person's focus chord or click, is the\n       * take. Of several in one site the first drawn wins; it raises `ui.focus`,\n       * origin this plugin. A ring the person has moved stays where it was put.\n       */\n      autoFocus?: true;\n      /**\n       * Runs on a pick with the option's value, in the plugin's own environment:\n       * the bottom of a `ui.select` chain. No model turn unless it asks one.\n       */\n      onSelect: (value: string, e: UiSelectArgument) => void;\n  };"},{"name":"SessionAppendArgs","kind":"type","line":11434,"doc":{"desc":["`session.append`'s input as a plugin's `$.session.append(args)` takes it:","the row's kind and text, and the loop it joins.","","Its door (`note`), origin (the calling plugin) and id are the engine's to","set; a hook above, or the organization's policy plugin, may rewrite or","refuse it like any call on `$`."],"params":[],"example":[],"returns":[]},"text":"  type SessionAppendArgs = {\n      /**\n       * The row: `type: \"user\"` for a user-role row the person does not see as\n       * typed (the model reads it), `\"system\"` for a notice the model never reads.\n       *\n       * Its `content` is text blocks alone (one, for a notice): the bottom\n       * refuses any other block, and any other row type, with the reason.\n       */\n      message: {\n          type: 'user' | 'system';\n          content: ApiContentBlock[];\n      };\n      /**\n       * The running subagent whose conversation the row joins; absent for main.\n       * One that names no running loop is refused.\n       */\n      agentId?: string;\n  };"},{"name":"SessionAppendDoor","kind":"type","line":11462,"doc":{"desc":["Which door a row came in by, decided from the row alone; a closed set,","pinned on the event and the key a matcher narrows on.","","`queue` is no row of the conversation: it is the text of a message","queue record (the transcript file's `queue-operation` entries), a","prompt's or a machine-made one's alike, raised as a user row the","conversation never keeps, a prompt's as `prompt.submit` left it."],"params":[],"example":[],"returns":[]},"text":"  type SessionAppendDoor = 'prompt' | 'command' | 'response' | 'tool-result' | 'tool-message' | 'delivery' | 'attachment' | 'hook-context' | 'note' | 'compaction' | 'notice' | 'queue';"},{"name":"SessionAppendInput","kind":"type","line":11472,"doc":{"desc":["The input of `session.append`: one row being appended to a conversation of","this session, by the engine site that originates it or by a plugin's call.","","Not on `e`, so stored as made: a tool result's structured record, the row's","timestamps, parent links and provenance stamps, an attachment's payload","(the model reads its recorded rendering, which `content` rewrites)."],"params":[],"example":[],"returns":[]},"text":"  type SessionAppendInput = {\n      /**\n       * The row as it will be kept (SessionAppendMessage). Its `content` is a\n       * hook's to rewrite; the engine puts back what it pins.\n       */\n      message: SessionAppendMessage;\n      /**\n       * Which door the row came in by (SessionAppendDoor); the key a matcher\n       * narrows on. Pinned.\n       */\n      door: SessionAppendDoor;\n      /**\n       * Who caused the row (SessionAppendOrigin): the person, the model, a tool,\n       * the engine, a settings hook, a plugin. Pinned.\n       */\n      origin: SessionAppendOrigin;\n      /**\n       * The row's id, the same in the transcript file and on every later read,\n       * so a hook can keep a table by row before calling `next`. Pinned.\n       */\n      uuid: string;\n      /**\n       * The loop whose conversation keeps the row: a subagent's id, as `turn.step`\n       * and `tool.call` carry it; absent on main.\n       *\n       * Pinned: a different value is refused, one left out is kept.\n       */\n      agentId?: string;\n  };"},{"name":"SessionAppendMessage","kind":"type","line":11509,"doc":{"desc":["One row of a conversation as `session.append` hands it: how the transcript","files it, under which role a request carries it, and its blocks.","","`{ role, content }` of a row a request carries is an ApiMessage, so code","written for `$.session.messages({ as: \"api\" })` reads it unchanged."],"params":[],"example":[],"returns":[]},"text":"  type SessionAppendMessage = {\n      /**\n       * How the transcript files the row: `user`, `assistant`, `attachment` (what\n       * the engine injects beside the conversation), `system` (a notice).\n       *\n       * Pinned, as `name`, `role` and `isMeta` are: left out it is kept, changed\n       * it fails the hook.\n       */\n      type: 'user' | 'assistant' | 'attachment' | 'system';\n      /**\n       * An attachment's type (`queued_command`, `nested_memory`, ...) or a\n       * notice's subtype (`compact_boundary`, `local_command`, ...). Pinned.\n       *\n       * Absent on user and assistant rows. Builds add and retire names.\n       */\n      name?: string;\n      /**\n       * Under which role a request carries the row; absent when none does (a\n       * notice, a record with no bytes on the wire, a virtual row). Pinned.\n       */\n      role?: 'user' | 'assistant';\n      /**\n       * True on a user-side row the person does not see as typed (a reminder, a\n       * nudge, a delivery's text). Pinned.\n       */\n      isMeta?: true;\n      /**\n       * The row's blocks in order (ApiContentBlock): an attachment's as the\n       * engine recorded its rendering, a notice's as one text block.\n       *\n       * Rewritable: text blocks, a tool_result's `content` and `is_error`. Media\n       * blocks may be dropped or moved, not changed or added. Thinking, tool_use,\n       * unknown kinds and every tool_result's `tool_use_id` are put back.\n       */\n      content: ApiContentBlock[];\n  };"},{"name":"SessionAppendOrigin","kind":"type","line":11550,"doc":{"desc":["Who caused a row, as the engine knows it from the row itself: a submission's","sender, an injected row's author, the model, or the tool that was called."],"params":[],"example":[],"returns":[]},"text":"  type SessionAppendOrigin = PromptOrigin | PromptAttachmentOrigin | {\n      /**\n       * A block of the model's response, or the engine's stand-in for one.\n       */\n      kind: 'model';\n      /**\n       * Whose response it is: the id the response names.\n       */\n      model: string;\n  } | {\n      /**\n       * A tool call's result, or a row a tool handed over beside it.\n       */\n      kind: 'tool';\n      /**\n       * Which one was called, by name; `unknown` when no call of that id is\n       * found.\n       */\n      tool: string;\n  };"},{"name":"SessionAppendResult","kind":"type","line":11579,"doc":{"desc":["What a `session.append` hook returns and what `next(e)` resolves to: the","row as the session stored it, or `{ deny: reason }` for a plugin's own call.","","`next(e)` resolves once the row is kept. A hook relays it unchanged: one","that answers without `next`, or another row, is skipped. Only a plugin's own","append (door `note`) may be refused, in place of `next`: nothing is stored."],"params":[],"example":[],"returns":[]},"text":"  type SessionAppendResult = {\n      /**\n       * The row as stored: what arrived at the bottom, the pinned parts put\n       * back.\n       */\n      message: SessionAppendMessage;\n      /**\n       * The stored row's id: the same in the transcript file and on every\n       * later read.\n       */\n      uuid: string;\n      deny?: undefined;\n  } | {\n      /**\n       * Refuses a plugin's own append, so nothing is stored: the call\n       * resolves to this, the reason the refusing hook gave.\n       */\n      deny: string;\n      message?: undefined;\n      uuid?: undefined;\n  };"},{"name":"SessionAttachInput","kind":"type","line":11609,"doc":{"desc":["The input of `session.attach`: a surface joined the session's roster of","attached clients (a phone opened the session; the desktop app connected).","","A remote client attaches by saying so (ui_attach) or by its first ask to","draw; the terminal's attachment is the REPL's binding and raises nothing.","Every field is the engine's: a hook observes, `next(e)` passes them on."],"params":[],"example":[],"returns":[]},"text":"  export type SessionAttachInput = {\n      /**\n       * Where the client draws: what it declared, a rendering fact.\n       */\n      surface: RenderSurface;\n      /**\n       * The client's own id, unique in the roster; two phones are two clients on\n       * one surface. A client that never named itself is `<surface>:default`.\n       */\n      clientId: string;\n      /**\n       * The size the client draws into, in character cells, and whether its\n       * layout docks a pane, when it said.\n       */\n      viewport?: RenderViewport;\n  };"},{"name":"SessionAttachResult","kind":"type","line":11630,"doc":{"desc":["What a `session.attach` hook returns and what `next(e)` resolves to:","`{ clientId }`, echoed by core; a hook's own value changes nothing."],"params":[],"example":[],"returns":[]},"text":"  export type SessionAttachResult = {\n      clientId: string;\n  };"},{"name":"SessionAuthorization","kind":"type","line":11641,"doc":{"desc":["What `$.session.authorize()` answers: an opaque handle for the session's","Anthropic credential and its kind, or null when there is none to hold.","","The secret itself stays with the engine; the handle is its plugin-side","face, spent through `$.http.fetch(url, { auth: handle })`."],"params":[],"example":[],"returns":[]},"text":"  export type SessionAuthorization = {\n      handle: string;\n      kind: 'bearer' | 'api-key';\n  } | null;"},{"name":"SessionCompactArgs","kind":"type","line":11650,"doc":{"desc":["`session.compact`'s input as a plugin's `$.session.compact(args)` takes","it: `trigger` (`plugin`), `messages` and `agentId` are the engine's."],"params":[],"example":[],"returns":[]},"text":"  export type SessionCompactArgs = {\n      /**\n       * What the summary should keep or stress, as typed after `/compact`;\n       * absent, the engine's own compaction prompt alone.\n       */\n      instructions?: string;\n  };"},{"name":"SessionCompacted","kind":"type","line":11662,"doc":{"desc":["A compaction that stands: the conversation as it reads afterwards, and the","counts and request usage the engine recorded when it was the one compacting."],"params":[],"example":[],"returns":[]},"text":"  export type SessionCompacted = {\n      /**\n       * The conversation after the compaction, oldest first: from core, its\n       * summary and the messages it kept; from a hook, whatever it hands up.\n       *\n       * What the transcript becomes (kept, on `precompute`, for the compaction\n       * that comes). A message with the engine's `handle` stands as the engine\n       * has it; one without is built from its `role`, `text` and tool blocks.\n       */\n      messages: readonly SessionMessage[];\n      /**\n       * The conversation's size before, in tokens; absent when core did not\n       * record it.\n       */\n      tokensBefore?: number;\n      /**\n       * Its size afterwards, in tokens; absent on `precompute` and when core\n       * did not record it.\n       */\n      tokensAfter?: number;\n      /**\n       * What the compaction's own model request cost (ModelUsage), when core\n       * made one: the summarizer's token counts as the API reported them.\n       *\n       * Absent when a hook answered in core's place, when core reused a summary\n       * already computed, and when the response reported none. Accounting only:\n       * the session's cost ledger (`session.measure`'s `cost`) already holds it.\n       *\n       * @example\n       * const { usage } = await next(e); if (usage) spent += usage.output_tokens\n       */\n      usage?: ModelUsage;\n      skip?: undefined;\n  };"},{"name":"SessionCompactInput","kind":"type","line":11701,"doc":{"desc":["The input of `session.compact`: one compaction of the conversation, about","to run; `messages` is the transcript it runs over."],"params":[],"example":[],"returns":[]},"text":"  export type SessionCompactInput = {\n      /**\n       * What is compacting (SessionCompactTrigger); the key a matcher narrows\n       * on. Pinned: `next(e)` passes it on as received.\n       */\n      trigger: SessionCompactTrigger;\n      /**\n       * The id of the loop compacting, for a subagent's or a fork's own\n       * transcript; absent for the main conversation (tool.call's `agentId`).\n       *\n       * Pinned: left out of a rewrite it is put back, changed it fails the hook.\n       * `e.messages` is this loop's transcript; `$.session.messages()` stays the\n       * main conversation, and `$.session.messages({ agentId })` reads this one.\n       */\n      agentId?: string;\n      /**\n       * What the summary should keep or stress: the text after `/compact`, a\n       * plugin's, or absent.\n       *\n       * `next({ ...e, instructions })` changes what the summarizer is told.\n       */\n      instructions?: string;\n      /**\n       * The transcript being compacted, in `$.session.messages()`'s shape, each\n       * message carrying the engine's `handle`; a subagent's own under `agentId`.\n       *\n       * `next({ ...e, messages })` changes what is summarized: a message kept\n       * with its handle is the engine's own, whole; one without is read as built.\n       */\n      messages: readonly SessionMessage[];\n  };"},{"name":"SessionCompactResult","kind":"type","line":11739,"doc":{"desc":["What a `session.compact` hook returns and what `next(e)` resolves to: the","compaction (`{ messages, tokensBefore?, tokensAfter?, usage? }`) or a skip.","","There is no summary string: the summary is a message."],"params":[],"example":[],"returns":[]},"text":"  export type SessionCompactResult = SessionCompacted | SessionCompactSkipped;"},{"name":"SessionCompactSkipped","kind":"type","line":11747,"doc":{"desc":["A compaction vetoed: on `precompute` nothing is computed or kept; on any","other trigger the conversation stays as it is and one line says why.","","Core answers it too, when a classic PreCompact hook blocks."],"params":[],"example":[],"returns":[]},"text":"  export type SessionCompactSkipped = {\n      /**\n       * Why, as the notice reads.\n       */\n      skip: string;\n      messages?: undefined;\n  };"},{"name":"SessionCompactTrigger","kind":"type","line":11762,"doc":{"desc":["Who compacts: the person's `/compact` (`manual`), the engine at its","threshold or on a prompt too long (`auto`), a plugin, or a `precompute`.","","`precompute` is the one dispatch that installs nothing: its result is kept","for the next compaction, if the conversation still holds what it ran over."],"params":[],"example":[],"returns":[]},"text":"  export type SessionCompactTrigger = 'manual' | 'auto' | 'plugin' | 'precompute';"},{"name":"SessionContextBreakdown","kind":"type","line":11772,"doc":{"desc":["The context window broken down as /context breaks it down: the rows, the","grid and the lists beneath it, in the SDK's `get_context_usage` shape.","","Less that reply's internal-build sections. Token counts are the engine's","estimates as numbers, never formatted: a `full` breakdown counts with the","token-count API where it can, a `summary` one estimates throughout."],"params":[],"example":[],"returns":[]},"text":"  export type SessionContextBreakdown = {\n      /**\n       * One row per category, the free space and the compaction buffer among\n       * them; `kind` says which is which.\n       */\n      categories: ContextCategory[];\n      /**\n       * Tokens in use, unclamped: past `rawMaxTokens` when over the window.\n       */\n      totalTokens: number;\n      /**\n       * The window measured against, the same figure as `rawMaxTokens`.\n       */\n      maxTokens: number;\n      /**\n       * The window measured against, in tokens: the model's limit, or a smaller\n       * compaction window (`autocompactSource` says which).\n       */\n      rawMaxTokens: number;\n      /**\n       * How that window was settled (ContextWindowSource); the SDK's reply\n       * carries it under this name too, outside its typed schema.\n       */\n      autocompactSource: ContextWindowSource;\n      /**\n       * `totalTokens` over `rawMaxTokens` as a whole percentage, 0 to 100 and\n       * past it when over.\n       */\n      percentage: number;\n      /**\n       * The grid, row by row: 10 by 10, 20 by 10 for a window of a million or\n       * more, 5 wide when asked for under 80 `columns`.\n       */\n      gridRows: ContextGridSquare[][];\n      /**\n       * Which model the breakdown was computed for, as `/model` shows it.\n       */\n      model: string;\n      /**\n       * Each memory file in the context, with its path and tokens.\n       */\n      memoryFiles: ContextMemoryFile[];\n      /**\n       * Each MCP tool's schema, with its server and tokens.\n       */\n      mcpTools: ContextMcpTool[];\n      /**\n       * The custom agents the Agent tool describes, each with its tokens.\n       */\n      agents: ContextAgent[];\n      /**\n       * The slash-command listing, counted; absent when the session lists none.\n       */\n      slashCommands?: ContextSlashCommands;\n      /**\n       * The skill listing, counted, with one entry per skill; absent when the\n       * session lists none.\n       */\n      skills?: ContextSkills;\n      /**\n       * The token count at which auto-compaction runs; absent when it is off.\n       */\n      autoCompactThreshold?: number;\n      /**\n       * Whether auto-compaction is on for the session.\n       */\n      isAutoCompactEnabled: boolean;\n      /**\n       * The token counts (ModelUsage) the live window's last API response\n       * reported, or null before one came back.\n       *\n       * The breakdown's `Messages` row is reconciled to it.\n       */\n      apiUsage: ModelUsage | null;\n  };"},{"name":"SessionContextUsage","kind":"type","line":11856,"doc":{"desc":["The live context window as the status line reads it, and by category as","/context breaks it down when the call asked (`{ breakdown }`).","","`tokens` and `percent` are the last API response's input side against the","model's window, absent until the first response of the live window: a","fresh session, or one just compacted, until its next response."],"params":[],"example":[],"returns":[]},"text":"  export type SessionContextUsage = {\n      /**\n       * Input tokens the last response was answered over: uncached, cache-written\n       * and cache-read together (the status line's `total_input_tokens`).\n       */\n      tokens?: number;\n      /**\n       * The context window of the session's model, in tokens (the status line's\n       * `context_window_size`).\n       */\n      window: number;\n      /**\n       * `tokens` over `window` as a whole percentage, 0 to 100 (the status\n       * line's `used_percentage`).\n       */\n      percent?: number;\n      /**\n       * The window by category, as /context breaks it down: present only when\n       * the call passed `breakdown`, and only with a session bound.\n       *\n       * It measures against the compaction window (`rawMaxTokens`), which may be\n       * smaller than `window`, and estimates every category, so its\n       * `totalTokens` need not equal `tokens`.\n       */\n      breakdown?: SessionContextBreakdown;\n  };"},{"name":"SessionCost","kind":"type","line":11886,"doc":{"desc":["What the session has cost, as `/cost` and the status line total it."],"params":[],"example":[],"returns":[]},"text":"  export type SessionCost = {\n      /**\n       * US dollars, summed over every priced API response this session.\n       */\n      usd: number;\n  };"},{"name":"SessionCronSummary","kind":"type","line":11893,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"  type SessionCronSummary = {\n      id: string;\n      /**\n       * Cron expression, e.g. \"0 9 * * 1-5\".\n       */\n      schedule: string;\n      /**\n       * False for one-shot wakeups whose cron field encodes a single fire time; true for tasks that re-fire on every match.\n       */\n      recurring: boolean;\n      /**\n       * Prompt text submitted when the cron fires. Capped at 1000 chars; clipped values append an in-string \"... [+N chars]\" marker.\n       */\n      prompt: string;\n  };"},{"name":"SessionDetachInput","kind":"type","line":11913,"doc":{"desc":["The input of `session.detach`: a client left the session's roster. Every","field is the engine's: a hook observes, and `next(e)` passes them on."],"params":[],"example":[],"returns":[]},"text":"  export type SessionDetachInput = {\n      /**\n       * Where the client drew.\n       */\n      surface: RenderSurface;\n      /**\n       * The id it attached under.\n       */\n      clientId: string;\n      /**\n       * Why it left: it detached, or the session ended under it.\n       */\n      reason: SessionDetachReason;\n  };"},{"name":"SessionDetachReason","kind":"type","line":11932,"doc":{"desc":["Why a client left the roster: `detach`, it said so (ui_detach); `end`, the","session ended with it still attached."],"params":[],"example":[],"returns":[]},"text":"  export type SessionDetachReason = 'detach' | 'end';"},{"name":"SessionDetachResult","kind":"type","line":11938,"doc":{"desc":["What a `session.detach` hook returns and what `next(e)` resolves to:","`{ clientId }`, echoed by core; a hook's own value changes nothing."],"params":[],"example":[],"returns":[]},"text":"  export type SessionDetachResult = {\n      clientId: string;\n  };"},{"name":"SessionEndHookInput","kind":"type","line":11942,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"  type SessionEndHookInput = BaseHookInput & {\n      hook_event_name: 'SessionEnd';\n      reason: ExitReason;\n  };"},{"name":"SessionEndInput","kind":"type","line":11955,"doc":{"desc":["The input of `session.end`: the session is ending, why, and how to come back","to it; every field is the engine's: a hook observes, `next(e)` passes it on.","","One short wall-clock bound (1.5 s by default) covers every hook, its `$`","waits and core, and `next.budget` reads it: at it `next.signal` aborts, a","`$` call in flight with it; only a process a command let go of outlives it."],"params":[],"example":[],"returns":[]},"text":"  export type SessionEndInput = {\n      /**\n       * Why it ends (SessionEndReason), the word the classic SessionEnd hook\n       * receives as its `reason`.\n       *\n       * `clear` is how a hook sees a `/clear`: the conversation ends, the process\n       * goes on under a new session id, and no `session.start` fires for it.\n       */\n      reason: SessionEndReason;\n      /**\n       * The ending session's id (`$.session.id()` until now); after a `/clear`\n       * or a resume the process goes on under another.\n       */\n      sessionId: string;\n      /**\n       * What `claude --resume` takes to return to it.\n       */\n      resume: SessionResume;\n  };"},{"name":"SessionEndReason","kind":"type","line":11983,"doc":{"desc":["Why the session ended: the classic SessionEnd hook's own `reason`, word for","word.","","`prompt_input_exit`, the person left (/exit, ctrl+c, ctrl+d); `clear`, a","/clear started a fresh one; `resume`, another took its place; `logout`;","`other`, a `-p` run finished or the process got SIGINT, SIGTERM or SIGHUP."],"params":[],"example":[],"returns":[]},"text":"  export type SessionEndReason = ClassicHookInputs['SessionEnd']['reason'];"},{"name":"SessionEndResult","kind":"type","line":11989,"doc":{"desc":["What a `session.end` hook returns and what `next(e)` resolves to:","`{ sessionId }`, echoed by core; a hook's own value changes nothing."],"params":[],"example":[],"returns":[]},"text":"  export type SessionEndResult = {\n      sessionId: string;\n  };"},{"name":"SessionIdentity","kind":"type","line":12001,"doc":{"desc":["What `$.session.identity()` answers: how the session is signed in and,","under a managed pin of its organization, the account the session holds.","","Answered only to a mod the organization's managed settings install. That","is a contract, not a wall: any mod can read the person's own config file,","where a login keeps the same facts."],"params":[],"example":[],"returns":[]},"text":"  export type SessionIdentity = {\n      /**\n       * How the session is authenticated: `claude.ai`, `console`, `api-key`,\n       * `oauth-token` (a token its host handed it), `none`, or a cloud\n       * provider's name (`bedrock`, `vertex`, ...).\n       *\n       * Builds add kinds: read an unknown one as a session with no identity.\n       */\n      kind: string;\n      /**\n       * The organization the account belongs to, by its id, only where\n       * managed `forceLoginOrgUUID` lists that organization.\n       *\n       * Absent everywhere else, as are the two fields below: with no pin, a\n       * pin on another organization, an API key or a cloud provider. So an\n       * organization's mod never learns of another organization's account.\n       */\n      organizationId?: string;\n      /**\n       * The organization's plan as the server names it (`claude_team`,\n       * `claude_enterprise`, ...), when the login recorded one.\n       *\n       * Always read from the login record on disk, which the person can\n       * edit, whatever `isVerified` says.\n       */\n      organizationType?: string;\n      /**\n       * The account's email address, where the session holds one.\n       */\n      email?: string;\n      /**\n       * Whether `organizationId` and `email` are the account the server told\n       * this process its credential signed in as, not the login record on disk.\n       *\n       * The person can edit that record. False until the server has answered\n       * this process, as with nonessential traffic off, and with no account.\n       */\n      isVerified: boolean;\n      deny?: undefined;\n  } | {\n      /**\n       * Why nothing is answered: the calling mod is not one managed settings\n       * enable and load in place from a source they name.\n       */\n      deny: string;\n      kind?: undefined;\n      organizationId?: undefined;\n      organizationType?: undefined;\n      email?: undefined;\n      isVerified?: undefined;\n  };"},{"name":"SessionMeasureInput","kind":"type","line":12061,"doc":{"desc":["The input of `session.measure`: what `$.session.usage()` answers at this","moment, and which of its units moved since the last measurement a hook saw.","","The same figures the op reads, without `context.breakdown`: call","`$.session.usage({ breakdown })` from the hook when the categories matter.","Every field is the engine's: a hook observes, and `next(e)` passes them on."],"params":[],"example":[],"returns":[]},"text":"  export type SessionMeasureInput = {\n      /**\n       * The live context window (`$.session.usage()`'s `context`): the window,\n       * and its fill once a response of the live window reported one.\n       *\n       * Never carries `breakdown` here.\n       */\n      context: SessionContextUsage;\n      /**\n       * The rate-limit windows the last response reported, each with its\n       * `percentUsed`; empty off a subscription or before the first reading.\n       */\n      rateLimits: SessionRateLimit[];\n      /**\n       * What the session has cost so far; absent where the host keeps no ledger.\n       */\n      cost?: SessionCost;\n      /**\n       * Which units differ from the last measurement raised (UsageUnit), never\n       * empty; the first measurement names every unit it has a figure for.\n       *\n       * `context`: the fill moved; `rateLimits`: a window moved a whole point,\n       * appeared or left, or the account's limit status changed; `cost`: the\n       * total grew.\n       */\n      changed: UsageUnit[];\n  };"},{"name":"SessionMeasureResult","kind":"type","line":12093,"doc":{"desc":["What a `session.measure` hook returns and what `next(e)` resolves to:","`{ changed }`, echoed by core; a hook's own value changes nothing."],"params":[],"example":[],"returns":[]},"text":"  export type SessionMeasureResult = {\n      changed: UsageUnit[];\n  };"},{"name":"SessionMessage","kind":"type","line":12100,"doc":{"desc":["One message of the transcript as `$.session.messages()` returns it."],"params":[],"example":[],"returns":[]},"text":"  export type SessionMessage = {\n      /**\n       * Who wrote it.\n       */\n      role: 'user' | 'assistant';\n      /**\n       * Its text blocks joined; '' when it has none.\n       */\n      text: string;\n      /**\n       * The tool_use blocks of an assistant message, each with its outcome\n       * (`result`, `text`, `isError`) once the transcript holds it.\n       */\n      toolUses: ToolUseSummary[];\n      /**\n       * The tool_result blocks of a user message: `{ tool_use_id, text, isError,\n       * result }`.\n       */\n      toolResults?: ToolResultSummary[];\n      /**\n       * An opaque token the engine stamps on a message it hands a\n       * `session.compact` hook, so a list handed back maps to its own messages.\n       *\n       * Absent on `$.session.messages()` and on a message a hook built.\n       */\n      handle?: string;\n  };"},{"name":"SessionMessagesAgentArgs","kind":"type","line":12132,"doc":{"desc":["A `$.session.messages` call for the rows (SessionMessage) of the main","conversation or of one agent's: `agentId` alone, no `as`."],"params":[],"example":[],"returns":[]},"text":"  type SessionMessagesAgentArgs = {\n      /**\n       * Whose conversation; absent, the main one.\n       */\n      agentId?: string;\n      /**\n       * Left out: the rows.\n       */\n      as?: undefined;\n  };"},{"name":"SessionMessagesApiArgs","kind":"type","line":12147,"doc":{"desc":["A `$.session.messages` call for the Messages API form (ApiMessage) of the","main conversation or, with `agentId`, of one of this session's agents'."],"params":[],"example":[],"returns":[]},"text":"  type SessionMessagesApiArgs = {\n      /**\n       * `\"api\"`.\n       */\n      as: 'api';\n      /**\n       * Whose conversation; absent, the main one.\n       */\n      agentId?: string;\n  };"},{"name":"SessionMessagesApiResult","kind":"type","line":12165,"doc":{"desc":["What `$.session.messages({ as: \"api\", agentId })` resolves to: the","agent's conversation as ApiMessage, or `{ deny }` (SessionMessagesDeny).","","`Array.isArray` tells the two apart; without `agentId` it is always the","messages."],"params":[],"example":[],"returns":[]},"text":"  type SessionMessagesApiResult = ApiMessage[] | SessionMessagesDeny;"},{"name":"SessionMessagesArgs","kind":"type","line":12171,"doc":{"desc":["What `$.session.messages(args)` takes and a `session.messages` hook reads","on `e`: whose conversation (`agentId`) and in which form (`as`)."],"params":[],"example":[],"returns":[]},"text":"  type SessionMessagesArgs = {\n      /**\n       * Whose conversation to read: the id `tool.call`, `turn.step` and\n       * `turn.complete` carry inside that agent's loop. Absent, the main one.\n       *\n       * A subagent (foreground or background), a fork, or a teammate running in\n       * this process; `$.agent.list()` lists it, an Agent tool use's `toolUses`\n       * entry names it. Not an agent a workflow run filed under the run.\n       */\n      agentId?: string;\n      /**\n       * `\"api\"` for the Messages API form (ApiMessage: `{ role, content }` with\n       * the content blocks intact); absent, the rows (SessionMessage).\n       */\n      as?: 'api';\n  };"},{"name":"SessionMessagesCall","kind":"type","line":12192,"doc":{"desc":["`$.session.messages`: the main conversation's rows with no argument, with","`{ as: \"api\" }` its Messages API form; with `agentId` an agent's, or deny."],"params":[],"example":[],"returns":[]},"text":"  type SessionMessagesCall = {\n      (): Promise<SessionMessage[]>;\n      (args: SessionMessagesMainApiArgs): Promise<ApiMessage[]>;\n      (args: SessionMessagesApiArgs): Promise<SessionMessagesApiResult>;\n      (args: SessionMessagesAgentArgs): Promise<SessionMessagesResult>;\n      (args: SessionMessagesArgs): Promise<SessionMessagesValue>;\n  };"},{"name":"SessionMessagesDeny","kind":"type","line":12208,"doc":{"desc":["What `$.session.messages({ agentId })` resolves to when the id names no","conversation this session can read: why not, in `deny`.","","The id is not one of this session's agents, the agent runs in another","process (a pane-hosted teammate), or it finished and the session reads no","saved transcript back for it (none saved; a workflow run's). Never main."],"params":[],"example":[],"returns":[]},"text":"  type SessionMessagesDeny = {\n      /**\n       * Why no conversation was read, naming the id.\n       */\n      deny: string;\n  };"},{"name":"SessionMessagesMainApiArgs","kind":"type","line":12219,"doc":{"desc":["A `$.session.messages({ as: \"api\" })` call naming no agent: the main","conversation, whose answer is always the messages (ApiMessage)."],"params":[],"example":[],"returns":[]},"text":"  type SessionMessagesMainApiArgs = {\n      /**\n       * `\"api\"`.\n       */\n      as: 'api';\n      /**\n       * Left out: the main conversation.\n       */\n      agentId?: undefined;\n  };"},{"name":"SessionMessagesResult","kind":"type","line":12237,"doc":{"desc":["What `$.session.messages({ agentId })` resolves to: the messages","(SessionMessage), or `{ deny }` (SessionMessagesDeny).","","Without `agentId` it is always the messages; with one the session cannot","read, the deny. `Array.isArray` tells the two apart."],"params":[],"example":[],"returns":[]},"text":"  type SessionMessagesResult = SessionMessage[] | SessionMessagesDeny;"},{"name":"SessionMessagesValue","kind":"type","line":12243,"doc":{"desc":["What a `session.messages` hook's `{ value }` holds, for any call: the","rows (SessionMessage), the Messages API form (ApiMessage), or `{ deny }`."],"params":[],"example":[],"returns":[]},"text":"  type SessionMessagesValue = SessionMessagesResult | SessionMessagesApiResult;"},{"name":"SessionRateLimit","kind":"type","line":12248,"doc":{"desc":["One rate-limit window as the rate-limit notices read it."],"params":[],"example":[],"returns":[]},"text":"  export type SessionRateLimit = {\n      /**\n       * Which window: `five_hour`, `seven_day`, or a Claude gateway's\n       * `spend_limit`.\n       */\n      kind: string;\n      /**\n       * How much of the window is used, 0 to 100 with at most one decimal:\n       * 23.5, or 7, never 7.000000000000001; past 100 on an exceeded spend limit.\n       */\n      percentUsed: number;\n      /**\n       * When the window resets, as an ISO 8601 timestamp.\n       */\n      resetsAt?: string;\n  };"},{"name":"SessionReceiveEvent","kind":"type","line":12269,"doc":{"desc":["An external-event wake the delivery's text parsed as (a GitHub relay","event, a signal's notice): the envelope's attributes and its JSON body."],"params":[],"example":[],"returns":[]},"text":"  export type SessionReceiveEvent = {\n      /**\n       * The producing service (`github`; `artifact-room` for a page's events).\n       */\n      source: string;\n      /**\n       * The event's discriminator (`pull_request.closed`, `check_suite`).\n       */\n      kind: string;\n      /**\n       * The envelope's sender-kind attribute as the server stamped it (`system`\n       * for a relay's own event, `rc_owner` for the user's own relayed message);\n       * absent when the envelope carries none.\n       */\n      from?: string;\n      /**\n       * The envelope's JSON body (`{ pr: \"acme/app#12\", outcome: \"merged\" }`).\n       *\n       * For `artifact-room`, kind `events`: `{ artifact, events, overflow }`, one\n       * burst under origin `task-notification`, each event `{ topic, from,\n       * isOwnViewer, data, isTruncated }` as the page's viewers wrote it.\n       */\n      data: Record<string, unknown>;\n      /**\n       * The `data` keys whose values are free text a third party wrote (a\n       * commenter's `author` and `comment`), as the producer marked them.\n       *\n       * Empty when none; the server asserts every other key's value, not these.\n       */\n      untrustedKeys: readonly string[];\n  };"},{"name":"SessionReceiveInput","kind":"type","line":12305,"doc":{"desc":["The input of `session.receive`: one inbound delivery, sanitized, before it","is queued (a relay's event, a peer's message, a message for an agent)."],"params":[],"example":[],"returns":[]},"text":"  export type SessionReceiveInput = {\n      /**\n       * Where the delivery came from, as the bridge classified it; the key a\n       * matcher narrows on. `next(e)` passes it on as received.\n       */\n      origin: SessionReceiveOrigin;\n      /**\n       * The delivery's body as the model would read it (a content-block\n       * delivery's text blocks, joined).\n       */\n      text: string;\n      /**\n       * The external-event wake the text parsed as (`source` `github` for a\n       * subscribed pull request's event); passed on as received.\n       *\n       * Present only for a delivery the server itself rendered as a wake (a\n       * webhook relay, the session inbox), by its asserted origin; anyone else's\n       * wake-shaped text stays `text`. Its `untrustedKeys` name third-party text.\n       */\n      event?: SessionReceiveEvent;\n      /**\n       * The id of the loop the delivery is for, when it is one of this session's\n       * agents (`$.agent.list()` lists it); absent for the main conversation's.\n       *\n       * Pinned: a rewrite that changes it is refused. An agent's message raises\n       * `session.send` with the sender's `agentId`, then this with the receiver's\n       * inside its turn, where a hook awaiting its own `$.prompt.submit` hangs.\n       *\n       * @example\n       * on(\"session.receive\", { agentId: worker }, ($, e) => ({ consumed: \"no\" }))\n       */\n      agentId?: string;\n  };"},{"name":"SessionReceiveOrigin","kind":"type","line":12343,"doc":{"desc":["Where an inbound delivery came from, as the bridge classified it from the","server's stamps: `prompt.submit`'s `e.origin`, less what never arrives."],"params":[],"example":[],"returns":[]},"text":"  export type SessionReceiveOrigin = {\n      /**\n       * `bridge` the user's own from a Remote Control client; `unclassified`\n       * one nobody could place; the rest as at `prompt.submit`.\n       *\n       * `task-notification` a relay's event or a trigger.\n       */\n      kind: 'bridge' | 'task-notification' | 'scheduled-trigger' | 'peer-send-message' | 'projects-relay' | 'slack-ping' | 'unclassified';\n  } | {\n      /**\n       * `peer` another session's or agent's model; `coordinator` the main\n       * conversation to an agent of its own.\n       */\n      kind: 'peer' | 'coordinator';\n      /**\n       * Which plugin's `$.session.send` composed it, AS THE SENDER SAYS;\n       * absent for a message the sending model wrote itself.\n       *\n       * A claim over a same-user channel, exactly as trustworthy as the\n       * sender's name: name it in a log line, never key a guard on it.\n       */\n      plugin?: string;\n  } | {\n      /**\n       * A delivery through this session's agent-team mailbox: `coordinator`\n       * from the lead's harness, `peer` from a teammate's or when unverified.\n       */\n      kind: 'peer' | 'coordinator';\n      /**\n       * Which plugin's `$.session.send` composed it, as the mailbox entry\n       * says; absent for a message the sending model wrote itself.\n       */\n      plugin?: string;\n      /**\n       * The sending member's name in the team (`team-lead` for the lead):\n       * the harness's stamp when `isVerified`, else whatever the writer put.\n       *\n       * @example\n       * on(\"session.receive\", { origin: { teammate: \"researcher\" } }, hook)\n       */\n      teammate: string;\n      /**\n       * Whether this process's harness wrote the mailbox entry itself (an\n       * in-process teammate's or the lead's own send).\n       *\n       * `false`: read from the team's inbox file with nothing to check it\n       * against (a teammate in its own pane, the person editing the file, any\n       * same-user process); in an all-in-process team, one no member sent.\n       *\n       * @example\n       * on(\"session.receive\", { origin: { isVerified: false } }, hook)\n       */\n      isVerified: boolean;\n  };"},{"name":"SessionReceiveResult","kind":"type","line":12405,"doc":{"desc":["What a `session.receive` hook returns and what `next(e)` resolves to: the","delivery that was queued, `{ text }`, or `{ consumed: reason }`.","","`next(e)` resolves once the delivery is queued; a hook answering without","`next` queues nothing."],"params":[],"example":[],"returns":[]},"text":"  export type SessionReceiveResult = {\n      /**\n       * The body the delivery was queued with; from core, `e.text` as it\n       * arrived at the bottom.\n       *\n       * A rewrite passes it down, `next({ ...e, text })`.\n       */\n      text: string;\n      consumed?: undefined;\n  } | {\n      /**\n       * Takes the delivery, answered without `next`: it is not queued, not\n       * written to the transcript and never reaches the model.\n       *\n       * The reason is logged, the plugin named.\n       */\n      consumed: string;\n      text?: undefined;\n  };"},{"name":"SessionRepo","kind":"type","line":12429,"doc":{"desc":["What `$.session.repo()` answers: the repository's root and its origin remote,","when the session is in one."],"params":[],"example":[],"returns":[]},"text":"  export type SessionRepo = {\n      /**\n       * The repository's root, absolute: the main working tree's for a worktree.\n       */\n      root: string;\n      /**\n       * The `origin` remote's URL as git has it (push URL preferred), or null when\n       * the repository has none.\n       */\n      remote: string | null;\n      /**\n       * Whether the remote is one of the repositories this build treats as its\n       * own; false in a build that has none or when the remote is unrecognized.\n       *\n       * The engine matches the build's own list of repositories with its\n       * hardened remote parser. A plugin reads this to behave differently in a\n       * public repository; which repositories are the build's is its to say.\n       */\n      internal: boolean;\n      /**\n       * The repository the allowlist matched, as `owner/name`; null when\n       * `internal` is false.\n       *\n       * A working copy without a remote that the engine still recognises is\n       * named by its own checkout configuration; a remote's name is its path.\n       */\n      name: string | null;\n  };"},{"name":"SessionResume","kind":"type","line":12461,"doc":{"desc":["How to come back to the session that ended: what `claude --resume` takes."],"params":[],"example":[],"returns":[]},"text":"  export type SessionResume = {\n      /**\n       * What `claude --resume <id>` takes, the ending session's own.\n       *\n       * It resumes a session that wrote a transcript: one that never ran a\n       * prompt, or ran with persistence off, left nothing under this id.\n       */\n      id: string;\n  };"},{"name":"SessionSendAddress","kind":"type","line":12479,"doc":{"desc":["Whom `$.session.send` addresses: a recipient as the SendMessage tool","names one (a string), or a session or an agent of this session by id.","","The engine spells the two id forms the tool's way before the send, and a","`session.send` hook reads that spelling on `e.to`: `{ agentId }` as the","id (a live teammate's as its name), `{ sessionId }` as its address."],"params":[],"example":[],"returns":[]},"text":"  export type SessionSendAddress = string | {\n      /**\n       * One of the person's own sessions: what its `$.session.id()` answers\n       * on this machine, or a Remote Control or cloud id (`session_...`).\n       *\n       * A session that is not running now is not delivered to: the result\n       * says so.\n       */\n      sessionId: string;\n  } | {\n      /**\n       * A subagent or teammate of this session: the id `$.agent.list()`\n       * lists and `agent.spawn` answered.\n       *\n       * A finished subagent is resumed from its transcript with the message,\n       * as the tool does. A live teammate's `teammateId` reaches it too.\n       */\n      agentId: string;\n  };"},{"name":"SessionSendArgs","kind":"type","line":12503,"doc":{"desc":["`session.send`'s input as a plugin's `$.session.send(args)` takes it:","`origin` (the calling plugin) and `agentId` are the engine's to set."],"params":[],"example":[],"returns":[]},"text":"  export type SessionSendArgs = {\n      /**\n       * The recipient: the tool's own spelling (a name, an agent id, a received\n       * `from` address), or `{ sessionId }` / `{ agentId }`.\n       */\n      to: SessionSendAddress;\n      /**\n       * The message's text, non-empty.\n       */\n      text: string;\n  };"},{"name":"SessionSendInput","kind":"type","line":12519,"doc":{"desc":["The input of `session.send`: one plain-text message about to leave this","conversation for another agent or session; the dual of `session.receive`."],"params":[],"example":[],"returns":[]},"text":"  export type SessionSendInput = {\n      /**\n       * Whom it goes to, as the SendMessage tool spells a recipient: a name as\n       * ListAgents lists it, an agent id, or a received `from` address.\n       *\n       * A plugin's `{ sessionId }` or `{ agentId }` arrives already spelled so.\n       * `next({ ...e, to })` readdresses it, judged again as the tool judges a\n       * send there; a name nobody carries is refused after the hooks.\n       */\n      to: string;\n      /**\n       * The message's text as the recipient will read it inside the engine's\n       * envelope; `next({ ...e, text })` is what is sent, with no new approval.\n       */\n      text: string;\n      /**\n       * Who is sending: the model through its SendMessage tool, or a plugin\n       * through `$.session.send`. Pinned: a rewrite that changes it is refused.\n       */\n      origin: SessionSendOrigin;\n      /**\n       * The id of the loop sending, when a subagent's or teammate's model sends\n       * (`$.agent.list()` lists it); absent for the main conversation's send.\n       *\n       * Pinned: the agent axis, not the origin. A message between two subagents\n       * carries the sender's id here and reaches the receiver's\n       * `session.receive` with that loop's own `agentId`.\n       */\n      agentId?: string;\n  };"},{"name":"SessionSendOrigin","kind":"type","line":12557,"doc":{"desc":["Who is sending at `session.send`: the model through its SendMessage tool,","or a plugin through `$.session.send`; stamped by the engine, pinned.","","The receiver's `session.receive` reads a plugin's name on its own","`e.origin.plugin`, beside the `peer` or `coordinator` kind it keeps."],"params":[],"example":[],"returns":[]},"text":"  export type SessionSendOrigin = {\n      /**\n       * The model's own SendMessage tool call, in the main conversation or\n       * in a subagent's or teammate's loop (`e.agentId` says which).\n       */\n      kind: 'model';\n  } | {\n      /**\n       * A plugin's `$.session.send`, its `$.tool.call` of SendMessage, or the\n       * model inside an agent it spawned; its other hooks still see it.\n       */\n      kind: 'plugin';\n      /**\n       * The sending plugin's name, which the receiver reads as its\n       * `session.receive` origin's `plugin` and shows beside the sender.\n       */\n      name: string;\n  };"},{"name":"SessionSendResult","kind":"type","line":12587,"doc":{"desc":["What a `session.send` hook returns and `next(e)` and `$.session.send`","resolve to: whether the message was delivered, and why not when not.","","Delivered means queued at the recipient (an agent's inbox, another","session's socket, the server for a remote session), never read: the","receiver's turn is its own, and it may hold the message for its person."],"params":[],"example":["const { isDelivered, reason } = await $.session.send({ to, text })"],"returns":[]},"text":"  export type SessionSendResult = {\n      /**\n       * True: the message reached its recipient's queue or inbox.\n       */\n      isDelivered: true;\n      reason?: undefined;\n  } | {\n      /**\n       * False: nothing was delivered. A hook answering this without `next`\n       * refuses the send, and the model reads `reason` as the tool's result.\n       */\n      isDelivered: false;\n      /**\n       * Why not, as the SendMessage tool words it: nobody by that name,\n       * several by it, the recipient gone or refusing, or a hook's refusal.\n       *\n       * @example\n       * on('session.send', { to: 'prod' }, () => NOT_FROM_HERE)\n       */\n      reason: string;\n  };"},{"name":"SessionStartHookInput","kind":"type","line":12609,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"  type SessionStartHookInput = BaseHookInput & {\n      hook_event_name: 'SessionStart';\n      source: 'startup' | 'resume' | 'clear' | 'compact' | 'fork';\n      agent_type?: string;\n      model?: string;\n      session_title?: string;\n      /**\n       * resume/fork: seconds since the resumed transcript's last assistant response\n       */\n      seconds_since_last_response?: number;\n      /**\n       * resume/fork: the resumed transcript's last response input + cache_read + cache_creation + output tokens (for a server-side tool loop, its last iteration's window, not the summed totals)\n       */\n      context_tokens?: number;\n      /**\n       * resume/fork: seconds_since_last_response exceeds the prompt-cache TTL, so the first request re-caches context_tokens\n       */\n      prompt_cache_likely_expired?: boolean;\n      /**\n       * resume/fork: estimated cost of re-caching context_tokens on the session model - the managed modelPricing when set, otherwise list price; excludes the response\n       */\n      estimated_cache_write_usd?: number;\n  };"},{"name":"SessionStartInput","kind":"type","line":12637,"doc":{"desc":["The input of `session.start`: the session the process starts with, read the","way `$.session` reads it at that moment."],"params":[],"example":[],"returns":[]},"text":"  export type SessionStartInput = {\n      /**\n       * The directory the session runs in, absolute (`$.session.cwd()`).\n       */\n      cwd: string;\n      /**\n       * Where the session draws at start (`$.session.surfaces()[0]`): `terminal`\n       * under the REPL; null for a `-p` run or the SDK, which draw nowhere yet.\n       */\n      surface: RenderSurface | null;\n      /**\n       * Whether a person is at the prompt: true under the REPL, false for a `-p`\n       * run or the SDK.\n       */\n      isInteractive: boolean;\n  };"},{"name":"SessionStartResult","kind":"type","line":12658,"doc":{"desc":["What a `session.start` hook returns and what `next(e)` resolves to:","`{ cwd }`, echoed by core; a hook's own value does not change the session."],"params":[],"example":[],"returns":[]},"text":"  export type SessionStartResult = {\n      cwd: string;\n  };"},{"name":"SessionUsage","kind":"type","line":12670,"doc":{"desc":["What `$.session.usage()` answers: when the session began, the context","window's fill, the account's rate-limit windows and the session's cost.","","The status line's figures. One the engine does not have is left out, never","zeroed: `rateLimits` is empty off a subscription, `cost` absent where the","host keeps no ledger."],"params":[],"example":[],"returns":[]},"text":"  export type SessionUsage = {\n      /**\n       * When the session these figures count from began, in `$.clock.now()`'s\n       * milliseconds: its launch, or for a resumed session its first launch.\n       *\n       * So what happened while a resumed or continued session was away still\n       * counts as its own; `/clear` starts it over at that moment. The line the\n       * engine's diff panel draws between this session's edits and earlier ones.\n       *\n       * @example\n       * const isOlder = stat.mtimeMs < (await $.session.usage()).startedAt\n       */\n      startedAt: number;\n      /**\n       * The live context window: the status line's `context_window` figures.\n       */\n      context: SessionContextUsage;\n      /**\n       * The rate-limit windows the last API response reported (`five_hour`,\n       * `seven_day`, a gateway's `spend_limit`); empty when none has a reading.\n       */\n      rateLimits: SessionRateLimit[];\n      /**\n       * What the session has cost so far, as /cost totals it; absent only where\n       * the host keeps no cost ledger (the CLI always has one).\n       */\n      cost?: SessionCost;\n  };"},{"name":"SessionUsageArgs","kind":"type","line":12703,"doc":{"desc":["What `$.session.usage(args)` takes: nothing for the status line's figures","alone; `breakdown` to have the window broken down as /context breaks it."],"params":[],"example":[],"returns":[]},"text":"  export type SessionUsageArgs = {\n      /**\n       * Asks for `context.breakdown` and says how it is counted\n       * (ContextBreakdownDetail); absent, none is computed and the call is free.\n       *\n       * `full` sends one token-count request per tool and memory file, as\n       * /context does; `summary` estimates locally and sends none.\n       */\n      breakdown?: ContextBreakdownDetail;\n      /**\n       * The width the breakdown's grid will be drawn in, in terminal columns;\n       * absent, the full-width grid. Read only with `breakdown`.\n       *\n       * Under 80 the grid is the narrow one /context draws there, 5 wide. A thin\n       * client's breakdown is the remote workspace's, whose grid ignores this.\n       */\n      columns?: number;\n  };"},{"name":"SessionVersion","kind":"type","line":12730,"doc":{"desc":["What `$.session.version()` answers: the version of the engine the session","runs on, the release that version is built from, and when it was built.","","The three are what the engine's own analytics rows carry as `version`,","`version_base` and `build_time`, so a row a plugin sends and a row the","engine sends from the same binary agree."],"params":[],"example":[],"returns":[]},"text":"  export type SessionVersion = {\n      /**\n       * The engine's full version, as `claude --version` prints it.\n       *\n       * A release's is `2.1.280`; a development build's adds the build's date,\n       * time and commit (`2.1.280-dev.20260920.t101500.sha1a2b3c4`).\n       */\n      version: string;\n      /**\n       * The release the version is built from, its semantic core and channel:\n       * `2.1.280` for that release, `2.1.280-dev` for a development build of it.\n       *\n       * Absent when the version is not spelled as a release.\n       */\n      base?: string;\n      /**\n       * When the binary was built, an ISO 8601 timestamp\n       * (`2026-09-20T10:15:00Z`). Absent in a run from source that stamps none.\n       */\n      builtAt?: string;\n  };"},{"name":"Settings","kind":"type","line":12760,"doc":{"desc":["What `$.settings.read` answers: an object keyed as a settings.json is","(`permissions`, `env`, `hooks`, `model`, `enabledPlugins`, ...).","","Each key is as https://code.claude.com/docs/en/settings documents it and","https://json.schemastore.org/claude-code-settings.json types it. A","snapshot in plain data: a write to it changes nothing the engine reads."],"params":[],"example":[],"returns":[]},"text":"  export type Settings = Readonly<Record<string, unknown>>;"},{"name":"SettingsKeyRead","kind":"type","line":12766,"doc":{"desc":["A read of one key: the key, and optionally the one source asked. It is","the read of the object, projected: no event of its own."],"params":[],"example":[],"returns":[]},"text":"  type SettingsKeyRead = {\n      key: string;\n      source?: SettingsSource;\n  };"},{"name":"SettingsLayer","kind":"type","line":12775,"doc":{"desc":["One layer a settings read is made of: what one source holds, as that","source loads. The engine's merge is a fold over the layers."],"params":[],"example":[],"returns":[]},"text":"  type SettingsLayer = {\n      /**\n       * Pinned: whose settings these are. `policy` is the managed settings,\n       * every managed tier merged; a matcher cannot narrow on it.\n       */\n      source: SettingsLayerSource;\n      /**\n       * As a person or an administrator wrote them, so a value may be of any\n       * type.\n       */\n      settings: Settings;\n  };"},{"name":"SettingsLayerSource","kind":"type","line":12792,"doc":{"desc":["Whose settings one layer of a read holds: a settings source, or `plugin`,","the base the enabled plugins' own settings make, beneath `user`."],"params":[],"example":[],"returns":[]},"text":"  type SettingsLayerSource = 'plugin' | SettingsSource;"},{"name":"SettingsObjectRead","kind":"type","line":12798,"doc":{"desc":["A read of a settings object: the settings merged over every source, or","the one source asked. It names no key."],"params":[],"example":[],"returns":[]},"text":"  type SettingsObjectRead = {\n      source?: SettingsSource;\n      key?: undefined;\n  };"},{"name":"SettingsReadArgs","kind":"type","line":12807,"doc":{"desc":["What a `settings.read` call carries to the host: the one source asked,","or none for the settings merged over every source."],"params":[],"example":[],"returns":[]},"text":"  export type SettingsReadArgs = {\n      /**\n       * The one source read, as loaded; absent, the settings merged over every\n       * source, as the engine runs under them.\n       */\n      source?: SettingsSource;\n      /**\n       * The engine's to fill, for the event (SettingsReadInput): what a call\n       * passes here is replaced.\n       */\n      layers?: readonly SettingsLayer[];\n  };"},{"name":"SettingsReadInput","kind":"type","line":12828,"doc":{"desc":["The event `settings.read` as a hook receives it: what was asked, and the","layers the answer is made of. One event, one granularity: the whole read.","","A hook awaits `next(e)` and answers the settings object rewritten; the","law it keeps is that its answer is a function of `layers` and of what","`next` gave, so the same read gives the same answer."],"params":[],"example":[],"returns":[]},"text":"  type SettingsReadInput = {\n      /**\n       * Present for a read of one source, as loaded: its one layer.\n       *\n       * Pinned: changed, the hook fails and is skipped; left out, kept.\n       */\n      source?: SettingsSource;\n      /**\n       * What each source holds, lowest precedence first; a source with no\n       * settings, or that the engine bars from the read, is left out.\n       *\n       * The engine's: whatever is passed down in their place, the same ones\n       * reach the hooks beneath.\n       */\n      layers: readonly SettingsLayer[];\n  };"},{"name":"SettingsReadOverloads","kind":"type","line":12849,"doc":{"desc":["`$.settings.read` by what it is asked: a key resolves to that key's","value, anything else to a settings object."],"params":[],"example":[],"returns":[]},"text":"  type SettingsReadOverloads = {\n      (args: SettingsKeyRead): Promise<unknown>;\n      (args?: SettingsObjectRead): Promise<Settings>;\n  };"},{"name":"SettingsSource","kind":"type","line":12863,"doc":{"desc":["One source of settings by the name a plugin gives it, lowest precedence","first; the engine's own name is the same word with `Settings` appended.","","`user` is ~/.claude/settings.json, `project` .claude/settings.json,","`local` .claude/settings.local.json, `flag` what `--settings` and the","SDK's inline settings carry, and `policy` the managed settings, every","managed tier merged."],"params":[],"example":[],"returns":[]},"text":"  export type SettingsSource = 'user' | 'project' | 'local' | 'flag' | 'policy';"},{"name":"SetupHookInput","kind":"type","line":12865,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"  type SetupHookInput = BaseHookInput & {\n      hook_event_name: 'Setup';\n      trigger: 'init' | 'maintenance';\n  };"},{"name":"Shaped","kind":"type","line":12880,"doc":{"desc":["A value kept with a shape tag, as an `atom` given `{ shape }` keeps it: a","reload whose code names another tag reads the value as absent.","","Declare the key as `Shaped<T>` in PluginState when its atom names a shape;","the atom reads and takes `T`."],"params":[],"example":["interface PluginState { board: { cells: Shaped<Cell[]> } }"],"returns":[]},"text":"  export type Shaped<T> = {\n      shape: string;\n      value: T;\n  };"},{"name":"ShapedValue","kind":"type","line":12889,"doc":{"desc":["What an atom given a shape reads and takes for a key declared `Shaped<T>`:","`T`; `never` for a key declared otherwise, so that atom does not compile."],"params":[],"example":[],"returns":[]},"text":"  export type ShapedValue<V> = V extends Shaped<infer T> ? T : never;"},{"name":"SiteScroll","kind":"type","line":12895,"doc":{"desc":["Where a site's window sits over the tree a hook drew in it (a pane's body,","the band): the engine's to move (the person scrolls), the plugin's to read."],"params":[],"example":[],"returns":[]},"text":"  export type SiteScroll = {\n      /**\n       * The first row of the tree the window showed when the hook was asked; 0\n       * at the top. Read-only.\n       *\n       * A move through `ui.scroll` (the person's, `$.ui.scroll`) asks again. On\n       * the terminal the engine's own does not (an end followed, a clamp, a held\n       * element kept in view): the next ask reads where the window stands then.\n       */\n      offset: number;\n      /**\n       * How many rows of the tree the window may show at once: the rows the\n       * surface gave the body, whatever the tree's own height. Read-only.\n       */\n      bodyRows: number;\n  };"},{"name":"SiteView","kind":"type","line":12920,"doc":{"desc":["Which transcript the person has on screen where a site draws: the main","conversation's, or one agent's, opened from the tasks list.","","A site reads it: a switch re-runs the site's hooks with the new view, the","site itself staying where it is. `$.ui.view` takes the same shape to ask","for a switch, which only the person's own input brings about."],"params":[],"example":[],"returns":[]},"text":"  export type SiteView = {\n      /**\n       * The agent whose transcript is in view: the `id` `$.agent.list()` gives\n       * it, the `agentId` its `turn.step` and `tool.call` events carry.\n       *\n       * Absent while the main conversation is in view. Read-only on a site.\n       */\n      agentId?: string;\n  };"},{"name":"SkillFrontmatter","kind":"interface","line":12938,"doc":{"desc":["What a skill's file declares above its text, parsed and JSON-safe: each","key as YAML reads it, none respelled, each value whatever JSON holds.","","Plain data within its bounds (32 levels, 20,000 values, 100,000","characters): a block past them is handed as `{}`. An interface, since a","JSON type that is one recursive alias fails where `e` is passed to `next`."],"params":[],"example":[],"returns":[]},"text":"  export interface SkillFrontmatter {\n      readonly [key: string]: SkillFrontmatterValue;\n  }"},{"name":"SkillFrontmatterList","kind":"interface","line":12945,"doc":{"desc":["A YAML sequence in a skill's frontmatter, as JSON holds it."],"params":[],"example":[],"returns":[]},"text":"  export interface SkillFrontmatterList extends ReadonlyArray<SkillFrontmatterValue> {\n  }"},{"name":"SkillFrontmatterValue","kind":"type","line":12955,"doc":{"desc":["One value in a skill's frontmatter: what JSON holds, and assignable to","and from `JsonValue`.","","A date is the text its author wrote. What JSON cannot hold (NaN, an","infinity) is null."],"params":[],"example":[],"returns":[]},"text":"  export type SkillFrontmatterValue = null | boolean | number | string | SkillFrontmatterList | SkillFrontmatter;"},{"name":"SkillPromptArgs","kind":"type","line":12964,"doc":{"desc":["`skill.prompt`'s input as a call takes it: `frontmatter` and `source` may","be left out, as a caller written before the event carried them does.","","Left out, they read `{}` and `built-in`: a skill with no file. What a","call states is the caller's word, which the hooks it reaches are handed."],"params":[],"example":[],"returns":[]},"text":"  export type SkillPromptArgs = Omit<SkillPromptInput, 'frontmatter' | 'source'> & Partial<Pick<SkillPromptInput, 'frontmatter' | 'source'>>;"},{"name":"SkillPromptInput","kind":"type","line":12974,"doc":{"desc":["The input of `skill.prompt`: one skill's prompt, at the moment the engine","expanded it for the model.","","Typed as `/name`, run by the Skill tool, or preloaded into a subagent","(named there as its agent wrote it). `text` and `frontmatter` are a hook's","to rewrite for the hooks beneath it; the rest is pinned."],"params":[],"example":[],"returns":[]},"text":"  export type SkillPromptInput = {\n      /**\n       * Which skill (`commit`); the key a matcher narrows on.\n       */\n      skill: string;\n      /**\n       * The prompt's text as the skill computed it (its text blocks, joined).\n       */\n      text: string;\n      /**\n       * What the skill's file declares above its text, as its author wrote it: keys\n       * as YAML reads them, a remote author's strings scrubbed.\n       *\n       * No key `__proto__`, `constructor` or `prototype` (left out of a file, the\n       * last two named in `frontmatterProblem`). Not the effective grants: a plugin\n       * manifest or managed setting may differ; a call's are read at `tool.check`.\n       */\n      frontmatter: SkillFrontmatter;\n      /**\n       * Why the file's frontmatter was left out (`{}`), or a key of it: prose for\n       * a person, not to match on; absent if handed whole or none exists.\n       *\n       * The engine refuses nothing for it: a hook that decides on frontmatter\n       * is the one to refuse a skill whose problem is set.\n       */\n      frontmatterProblem?: string;\n      /**\n       * Whose words these are, in `SkillSource`'s words.\n       *\n       * A `projectSettings` skill's words are its repository's, wherever its\n       * checkout is read (another machine's too), an `mcp` skill's its server's:\n       * as loaded, vouched for by none. A call's is the caller's word.\n       */\n      source: SkillSource;\n      /**\n       * An installed plugin's name, when the skill comes from one.\n       */\n      pluginName?: string;\n      /**\n       * Where the file it was loaded from is, as an absolute path: a skill's\n       * SKILL.md, or a command's own `.md` file.\n       *\n       * As the loader joined it, no link resolved; on a call, the caller's word.\n       * Absent with no file on this machine: a built-in, an MCP server's, a\n       * plugin command written inline in its manifest.\n       */\n      path?: string;\n  };"},{"name":"SkillPromptResult","kind":"type","line":13027,"doc":{"desc":["What a `skill.prompt` hook returns: the text the model reads for that","skill."],"params":[],"example":[],"returns":[]},"text":"  export type SkillPromptResult = {\n      text: string;\n  };"},{"name":"SkillSource","kind":"type","line":13039,"doc":{"desc":["Whose words a skill is, in the engine's own words: the settings tier whose","skills folder holds it, or what else provides it.","","`built-in` ships in the build, which holds no file: its frontmatter is","`{}`. `plugin` comes with a plugin, `mcp` from a server, `syncedSkills`","from the account. The list is open: a newer source is a word of its own."],"params":[],"example":[],"returns":[]},"text":"  export type SkillSource = 'userSettings' | 'projectSettings' | 'policySettings' | 'plugin' | 'built-in' | 'mcp' | 'syncedSkills' | (string & {});"},{"name":"SleepOptions","kind":"type","line":13044,"doc":{"desc":["Options of `$.clock.sleep`."],"params":[],"example":[],"returns":[]},"text":"  export type SleepOptions = {\n      /**\n       * Aborting it rejects the sleep at once.\n       */\n      signal?: AbortSignal;\n  };"},{"name":"SourceValues","kind":"type","line":13055,"doc":{"desc":["The values `derive`'s function receives for its sources, in their order:","an atom's or a derived value's own, a plain reference's or `undefined`."],"params":[],"example":[],"returns":[]},"text":"  export type SourceValues<S extends readonly unknown[]> = {\n      [I in keyof S]: S[I] extends Atom<infer V> ? V : S[I] extends Derived<infer V> ? V : S[I] extends StateName<infer P, infer K> ? P extends keyof PluginState & string ? K extends keyof PluginState[P] & string ? StateValue<P, K> | undefined : unknown : unknown : unknown;\n  };"},{"name":"Space","kind":"type","line":13067,"doc":{"desc":["A Box's spacing: a number of character cells, the same on every surface,","or a step name that each surface sizes its own way. The terminal and VS","Code draw a step as cells: across, `xs` and `sm` 1, `md` 2, `lg` 3, `xl` 4;","down, `xs` and `sm` 0, `md` and `lg` 1, `xl` 2. Desktop and the phones each","use their own spacing scale, so there a step can be larger or smaller than","those cells."],"params":[],"example":[],"returns":[]},"text":"  export type Space = number | 'xs' | 'sm' | 'md' | 'lg' | 'xl';"},{"name":"SpeakOptions","kind":"type","line":13072,"doc":{"desc":["Options of `$.audio.speak`."],"params":[],"example":[],"returns":[]},"text":"  export type SpeakOptions = {\n      /**\n       * The system voice's exact name as the platform lists it (`Samantha`, or the\n       * name of a voice you installed). Absent: the synthesizer's default voice.\n       */\n      voice?: string;\n  };"},{"name":"SpeakRequest","kind":"type","line":13083,"doc":{"desc":["The argument of `$.audio.speak(text, options)` as the event carries it."],"params":[],"example":[],"returns":[]},"text":"  type SpeakRequest = SpeakOptions & {\n      /**\n       * What to say, as plain text: its first 4096 characters are spoken.\n       */\n      text: string;\n  };"},{"name":"SpeakResult","kind":"type","line":13093,"doc":{"desc":["What `$.audio.speak` resolves with once the utterance has ended."],"params":[],"example":[],"returns":[]},"text":"  export type SpeakResult = {\n      /**\n       * Which synthesizer spoke: `system`, the platform's own (`say` on macOS).\n       */\n      via: 'system';\n  };"},{"name":"StarNext","kind":"type","line":13108,"doc":{"desc":["`next` in a `*` hook: the set of events is open at runtime, so `e` is","`unknown` until `next.is(pattern, e)` narrows it to events it knows.","","The callable is an overload per known event (OrderedOverloads), then","`(e: unknown) => Promise<unknown>` last: `next(e)` with `e` still unknown","resolves to `unknown`."],"params":[],"example":[],"returns":[]},"text":"  export type StarNext = OrderedOverloads<EventName> & {\n      (e: unknown): Promise<unknown>;\n      /**\n       * Continues this dispatch at a tier, as Next's `to` (a managed hook's):\n       * `e` still unknown resolves to `unknown`.\n       */\n      readonly to: (e: unknown, tier: TargetTier) => Promise<unknown>;\n      readonly signal: AbortSignal;\n      readonly is: <M extends Pattern>(pattern: M, e: unknown) => e is Frozen<Args<Selected<M>>>;\n      readonly event: EventName;\n      readonly origin: Origin;\n      readonly trace: readonly TraceEntry<EventName, unknown, unknown>[];\n      readonly budget: NextBudget;\n  };"},{"name":"StateAddress","kind":"type","line":13129,"doc":{"desc":["Which named value a `$.state` call is about, as it crosses to the host: the","owning plugin, the key, and a family member's `id`.","","The untyped form of a StateRef; identity, pinned on every `next`."],"params":[],"example":[],"returns":[]},"text":"  export type StateAddress = {\n      plugin: string;\n      key: string;\n      id?: string;\n  };"},{"name":"StateDollar","kind":"type","line":13139,"doc":{"desc":["What the state library's `read` and `update` take of `$`: its `state` noun,","on which they make the calls a hook would make itself."],"params":[],"example":[],"returns":[]},"text":"  export type StateDollar = Pick<CoreEngineInterface, 'state'>;"},{"name":"StateFamily","kind":"type","line":13152,"doc":{"desc":["A key of PluginState that holds one value of type `T` per `id` (one per","drawn row, per worker): its reference must carry `id: string`.","","Only a marker in the registry; no value has this shape. `$.state.get` on a","member answers `T`, and a reference to the family without an `id` does not","compile."],"params":[],"example":["interface PluginState { notes: { isOpen: StateFamily<boolean> } }"],"returns":[]},"text":"  export type StateFamily<T> = {\n      readonly byId: T;\n  };"},{"name":"StateGetEvent","kind":"type","line":13163,"doc":{"desc":["`e` of `state.get`: one variant per value a contract declares, so a matcher","on `plugin` and `key` narrows it; the untyped address while none does."],"params":[],"example":["on(\"state.get\", { plugin: \"swarm\" }, ($, e, next) => next(e))"],"returns":[]},"text":"  export type StateGetEvent = [DeclaredPair] extends [never] ? StateAddress : DeclaredEvents<DeclaredPair>['get'];"},{"name":"StateName","kind":"type","line":13169,"doc":{"desc":["Which named value: the plugin that owns it and its key there, both","literals where a contract declares the value."],"params":[],"example":[],"returns":[]},"text":"  type StateName<P extends string = string, K extends string = string> = {\n      readonly plugin: P;\n      readonly key: K;\n  };"},{"name":"StateRead","kind":"type","line":13181,"doc":{"desc":["What `$.state.get` answers: the value and the version it stands at; a","value never written is `undefined` at version 0.","","The version goes up by one on every write that lands; hand it back as","`ifVersion` to write only if nobody wrote in between."],"params":[],"example":[],"returns":[]},"text":"  export type StateRead<T = unknown> = {\n      value: T | undefined;\n      version: number;\n  };"},{"name":"StateRef","kind":"type","line":13197,"doc":{"desc":["A typed reference to one named value: the owning plugin and the key, both","literals, and for a StateFamily key the member's `id`.","","Written once as a constant and passed to `$.state.get` and `$.state.set`;","`plugin` and `key` must be literals in source so `claude plugin validate`","lists what a module reads and writes. Only `id` may be computed."],"params":[],"example":["const workers = { plugin: \"swarm\", key: \"workers\" } as const"],"returns":[]},"text":"  export type StateRef<P extends keyof PluginState & string, K extends keyof PluginState[P] & string> = StateName<P, K> & (PluginState[P][K] extends StateFamily<unknown> ? Readonly<Required<Pick<StateAddress, 'id'>>> : Readonly<Partial<Record<'id', undefined>>>);"},{"name":"StateSetEvent","kind":"type","line":13209,"doc":{"desc":["`e` of `state.set`: one variant per value a contract declares, so a matcher","on `plugin` and `key` narrows `e.value`; the untyped write while none does.","","`plugin`, `key` and `id` are identity, pinned; `value` is a hook's to","rewrite, which is how a plugin that does not own a value changes it."],"params":[],"example":["on(\"state.set\", DRIVE, ($, e, next) => next({ ...e, value: false }))"],"returns":[]},"text":"  export type StateSetEvent = [DeclaredPair] extends [never] ? StateWrite : DeclaredEvents<DeclaredPair>['set'];"},{"name":"StateSetOptions","kind":"type","line":13215,"doc":{"desc":["The options of `$.state.set`: `ifVersion` makes the write conditional on","the value still standing at that version (compare-and-set)."],"params":[],"example":[],"returns":[]},"text":"  export type StateSetOptions = {\n      ifVersion?: number;\n  };"},{"name":"StateSetResult","kind":"type","line":13226,"doc":{"desc":["What `$.state.set` answers: whether the write landed, and the version the","value stands at now (a landed write's own, a missed one's the current).","","`isSet` is false only for a write given `ifVersion` that another write beat;","nothing changed then, and a `$.state.get` reads what stands."],"params":[],"example":[],"returns":[]},"text":"  export type StateSetResult = {\n      isSet: true;\n      version: number;\n  } | {\n      isSet: false;\n      version: number;\n  };"},{"name":"StateValue","kind":"type","line":13238,"doc":{"desc":["The type of the value under key `K` of plugin `P`, as its contract declares","it in PluginState; a StateFamily's member type for a family key."],"params":[],"example":[],"returns":[]},"text":"  export type StateValue<P extends keyof PluginState & string, K extends keyof PluginState[P] & string> = PluginState[P][K] extends StateFamily<infer Member> ? Member : PluginState[P][K];"},{"name":"StateWrite","kind":"type","line":13247,"doc":{"desc":["A `$.state.set` as it crosses to the host and as its hooks see it when no","contract declares the value: the address, the value, and the condition.","","`previous` is the host's, put on `e` ahead of every hook: what stood there","when the write was raised."],"params":[],"example":[],"returns":[]},"text":"  export type StateWrite = StateAddress & {\n      value: unknown;\n      previous?: unknown;\n      ifVersion?: number;\n  };"},{"name":"StopFailureHookInput","kind":"type","line":13253,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"  type StopFailureHookInput = BaseHookInput & {\n      hook_event_name: 'StopFailure';\n      error: SDKAssistantMessageError;\n      error_details?: string;\n      last_assistant_message?: string;\n  };"},{"name":"StopHookInput","kind":"type","line":13260,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"  type StopHookInput = BaseHookInput & {\n      hook_event_name: 'Stop';\n      stop_hook_active: boolean;\n      /**\n       * Text content of the last assistant message before stopping. Avoids the need to read and parse the transcript file.\n       */\n      last_assistant_message?: string;\n      /**\n       * In-flight background work (running/pending + backgrounded) registered in this session. Lets hooks distinguish \"session is done\" from \"session is paused waiting for background work to wake it\". Empty array when nothing is in flight.\n       */\n      background_tasks?: BackgroundTaskSummary[];\n      /**\n       * Session-scoped cron tasks (CronCreate, ScheduleWakeup, /loop) that will wake this session later. Empty array when none are scheduled.\n       */\n      session_crons?: SessionCronSummary[];\n  };"},{"name":"StreamHook","kind":"type","line":13288,"doc":{"desc":["The hook a streaming event takes: `async function* ($, e, next) {}`,","yielding the event's chunks and returning its result.","","`return yield* next(e)` passes; `for await (const c of next(e)) yield","f(c)` transforms; yielding without `next` answers alone. A chunk yielded","stays: a hook that fails mid-stream is left, the rest from beneath it."],"params":[],"example":["on('turn.step', async function* ($, e, next) {","  const r = yield* next(e); return { ...r } })"],"returns":[]},"text":"  export type StreamHook<N extends StreamingEventName> = ($: EngineInterface, e: Frozen<Args<N>>, next: StreamNext<N>) => StreamHookBody<Chunk<N>, EventResult<N>>;"},{"name":"StreamHookBody","kind":"type","line":13298,"doc":{"desc":["What a hook on a streaming event evaluates to: the async generator an","`async function*` makes, yielding `C` and returning `R` or nothing.","","Returning nothing lets its last `next(e)`'s result stand. A plain","function is a type error here even when it returns `next(e)`: the hook","is the generator, not a function that hands one back."],"params":[],"example":[],"returns":[]},"text":"  export type StreamHookBody<C, R> = AsyncGenerator<C, R | void> & {\n      /**\n       * Absent on a generator; present on `next(e)`, which is not a hook body.\n       */\n      readonly result?: never;\n  };"},{"name":"StreamingEventName","kind":"type","line":13314,"doc":{"desc":["The events that stream: their hooks are async generators, `next(e)` is","the stream of everything beneath, and the result is what it returns.","","Two events stream: `turn.step`, the model's response arriving in pieces,","where a hook that saw it whole could not change what had already been","shown; and `process.spawn`, a call on `$` whose child's output arrives in","pieces for as long as the child runs."],"params":[],"example":[],"returns":[]},"text":"  export type StreamingEventName = 'turn.step' | 'process.spawn';"},{"name":"StreamNext","kind":"type","line":13328,"doc":{"desc":["The rest of the chain as a hook on a streaming event receives it: Next,","except that `next(e)` is the stream beneath (HookStream), not a promise.","","Each call opens a fresh stream (for `turn.step` a model request, for","`process.spawn` a child), so a hook that calls it twice makes two. Not","calling it yields the hook's own chunks and result; nothing beneath runs."],"params":[],"example":[],"returns":[]},"text":"  export type StreamNext<N extends StreamingEventName = StreamingEventName, E = Args<N>, O = EventResult<N>, S extends {\n      [K in N]?: unknown;\n  } = {\n      [K in N]: Args<K>;\n  }> = Pick<Next<N, E, O, S>, 'signal' | 'is' | 'event' | 'origin' | 'budget'> & {\n      (e: E): HookStream<Chunk<N>, O>;\n      /**\n       * Continues this dispatch at a tier, as Next's `to`: the stream beneath\n       * with the links between this hook's tier and that one skipped.\n       */\n      readonly to: (e: E, tier: TargetTier) => HookStream<Chunk<N>, O>;\n      /**\n       * What settled beneath on the latest `next()` stream, as Next's; a\n       * streaming link's entry counts the chunks it yielded up (`chunks`).\n       */\n      readonly trace: readonly TraceEntry<N, E, O>[];\n  };"},{"name":"StyledElement","kind":"type","line":13355,"doc":{"desc":["The shape a `Box` and a `Text` share in a render tree: allowlisted props,","an optional `hover`, the group stamp a `hover.scope` earns, the mark of","the plugin whose drawing starts there, and children.","","`Tag` is which of the two; `Hover` is that element's hover props. Every","surface draws both: Ink's Box and Text on the terminal, a flex div and a","styled span on the desktop."],"params":[],"example":[],"returns":[]},"text":"  type StyledElement<Tag extends 'Box' | 'Text', Hover> = {\n      type: Tag;\n      /**\n       * A Box's layout, position, spacing and border props and the `key` that\n       * makes it a hover scope; a Text's colors and styles. Others are refused.\n       */\n      props?: Record<string, string | number | boolean>;\n      /**\n       * Style overrides the surface applies while the pointer is over the\n       * nearest keyed Box, or over any member of the group `scope` names.\n       *\n       * Plain data, no hook. Nothing that moves a sibling: `borderStyle`\n       * restyles a border the Box has, `display` only reveals a Box drawn\n       * `\"none\"` (under a keyed Box or in a scope), an offset moves a placed Box.\n       */\n      hover?: Hover;\n      /**\n       * Whose group `hover.scope` names; absent without a `scope`.\n       */\n      group?: PluginStamp;\n      /**\n       * Whose part of the drawing starts here, set by the engine on each hook's\n       * returned root. A hook's own mark is kept; another plugin's at most as\n       * often as `next(e)` handed it, and it may move. It proves no author.\n       */\n      part?: PluginStamp;\n      /**\n       * In order: a Box holds elements and strings (core wraps each string in\n       * a Text); a Text holds strings and inline elements, never an engine node.\n       */\n      children?: RenderNode[];\n  };"},{"name":"SubagentStartHookInput","kind":"type","line":13388,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"  type SubagentStartHookInput = BaseHookInput & {\n      hook_event_name: 'SubagentStart';\n      agent_id: string;\n      agent_type: string;\n  };"},{"name":"SubagentStopHookInput","kind":"type","line":13394,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"  type SubagentStopHookInput = BaseHookInput & {\n      hook_event_name: 'SubagentStop';\n      stop_hook_active: boolean;\n      agent_id: string;\n      agent_transcript_path: string;\n      agent_type: string;\n      /**\n       * Text content of the last assistant message before stopping. Avoids the need to read and parse the transcript file.\n       */\n      last_assistant_message?: string;\n      /**\n       * In-flight background work (running/pending + backgrounded) registered in this session. Lets hooks distinguish \"session is done\" from \"session is paused waiting for background work to wake it\". Empty array when nothing is in flight.\n       */\n      background_tasks?: BackgroundTaskSummary[];\n      /**\n       * Session-scoped cron tasks (CronCreate, ScheduleWakeup, /loop) that will wake this session later. Empty array when none are scheduled.\n       */\n      session_crons?: SessionCronSummary[];\n  };"},{"name":"SvgProps","kind":"type","line":13423,"doc":{"desc":["The props of `Svg`, the remote surfaces' vector leaf: the markup is the","element's data, as a string is a Text's, drawn isolated.","","A leaf: no children. The surface never lets the markup reach the page","(the engine bounds it; the desktop draws it as an image, or in a sandboxed","frame when `isInteractive`; the editor as an image; the mobile app in a","web view)."],"params":[],"example":[],"returns":[]},"text":"  export type SvgProps = {\n      /**\n       * The SVG document, `<svg ...>...</svg>`, at most 131072 characters.\n       */\n      source: string;\n      /**\n       * What the drawing says, for a reader that cannot see it; required, since\n       * a surface without the element draws nothing else of it.\n       */\n      alt: string;\n      /**\n       * CSS pixels; absent, the box takes the markup's own width up to the slot.\n       */\n      width?: number;\n      /**\n       * CSS pixels; absent, the markup's own height at the drawn width.\n       */\n      height?: number;\n      /**\n       * `true` draws the SVG in a script-less sandboxed frame so hover, CSS\n       * `:hover`, SMIL animation and `<title>` tooltips work; absent, an image.\n       * The editor ignores it and always draws an image, where SMIL and CSS\n       * animation can run but hover, CSS `:hover` and `<title>` tooltips never\n       * work.\n       *\n       * It never enables script or event-handler attributes (the frame has no\n       * allow-scripts and the scrub strips them); presses that other plugins\n       * should observe go on an enclosing element.\n       */\n      isInteractive?: boolean;\n  };"},{"name":"TagKeys","kind":"type","line":13462,"doc":{"desc":["The keys among `Among` a matcher may select variants of `I` by: valued by","literals in every variant, one literal per variant (IsDiscriminant).","","Asked of each key given and of no other: of a matcher's own keys, never","of every key of every variant."],"params":[],"example":[],"returns":[]},"text":"  type TagKeys<I, Among> = Among extends MatcherKeys<I> ? IsLiteralValued<MatcherValueOf<I, Among>> extends true ? IsDiscriminant<I, Among> extends true ? Among : never : never : never;"},{"name":"TargetTier","kind":"type","line":13469,"doc":{"desc":["A tier `next.to(e, tier)` may name: one a floor can reach past links of","less authority to, so never `prepend`, which nothing skips to; `user` is","for a prepend hook alone, and skips the peers below it."],"params":[],"example":[],"returns":[]},"text":"  export type TargetTier = Exclude<Tier, 'prepend'>;"},{"name":"TaskCompletedHookInput","kind":"type","line":13471,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"  type TaskCompletedHookInput = BaseHookInput & {\n      hook_event_name: 'TaskCompleted';\n      task_id: string;\n      task_subject: string;\n      task_description?: string;\n      teammate_name?: string;\n      /**\n       * @deprecated Sessions have a single implicit team; this carries the session-derived team name and will be removed in a future release.\n       */\n      team_name?: string;\n  };"},{"name":"TaskCreatedHookInput","kind":"type","line":13483,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"  type TaskCreatedHookInput = BaseHookInput & {\n      hook_event_name: 'TaskCreated';\n      task_id: string;\n      task_subject: string;\n      task_description?: string;\n      teammate_name?: string;\n      /**\n       * @deprecated Sessions have a single implicit team; this carries the session-derived team name and will be removed in a future release.\n       */\n      team_name?: string;\n  };"},{"name":"TeammateIdleHookInput","kind":"type","line":13495,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"  type TeammateIdleHookInput = BaseHookInput & {\n      hook_event_name: 'TeammateIdle';\n      teammate_name: string;\n      /**\n       * @deprecated Sessions have a single implicit team; this carries the session-derived team name and will be removed in a future release.\n       */\n      team_name: string;\n  };"},{"name":"TelemetryAttribute","kind":"type","line":13507,"doc":{"desc":["One attribute of a collector record, as the collector receives it."],"params":[],"example":[],"returns":[]},"text":"  export type TelemetryAttribute = string | number | boolean | readonly string[];"},{"name":"TelemetryChoice","kind":"type","line":13519,"doc":{"desc":["A string property of a first-party row: the value and the list it is","chosen from, so no free text reaches a row.","","Every member of `of` is a lowercase token of letters, digits, `_` and `-`,","at most 32 of them; `value` is one of them."],"params":[],"example":["const page = { value: \"ready\", of: [\"ready\", \"later\"] }"],"returns":[]},"text":"  export type TelemetryChoice = {\n      /**\n       * What the row carries, one member of `of`.\n       */\n      value: string;\n      /**\n       * Every value the property may take.\n       */\n      of: readonly string[];\n  };"},{"name":"TelemetryDestination","kind":"type","line":13541,"doc":{"desc":["Where a telemetry record goes: `anthropic`, Anthropic's first-party","analytics, or `collector`, the one the session's operator configured.","","A closed union and the record's identity: `e.to` reads the same at every","hook as it was raised, so a hook may rewrite what a record carries, never","redirect or copy it. A hook picks its stream with the matcher."],"params":[],"example":["on(\"telemetry.log\", { to: \"collector\" }, ($, e, next) => next(e))"],"returns":[]},"text":"  export type TelemetryDestination = 'anthropic' | 'collector';"},{"name":"TelemetryLogArgs","kind":"type","line":13547,"doc":{"desc":["What a call of `$.telemetry.log` passes: a first-party row, `to` optional,","or a collector record."],"params":[],"example":[],"returns":[]},"text":"  export type TelemetryLogArgs = TelemetryRowArgs | TelemetryRecordEntry;"},{"name":"TelemetryLogInput","kind":"type","line":13553,"doc":{"desc":["The input of `telemetry.log`: one record about to be logged to the","destination `to` names, which is always present and pinned."],"params":[],"example":[],"returns":[]},"text":"  export type TelemetryLogInput = TelemetryRowEntry | TelemetryRecordEntry;"},{"name":"TelemetryLogResult","kind":"type","line":13559,"doc":{"desc":["What a `telemetry.log` hook returns and `next(e)` resolves to:","`{ value: undefined }`, or `{ deny }`, which rejects the caller's promise."],"params":[],"example":[],"returns":[]},"text":"  export type TelemetryLogResult = ValueOrDeny<undefined>;"},{"name":"TelemetryMarkInput","kind":"type","line":13567,"doc":{"desc":["The input of `telemetry.mark`: one use of a feature, as the CLI's own","feature events mark one.","","A mark takes no `to`: it always means `anthropic`."],"params":[],"example":[],"returns":[]},"text":"  export type TelemetryMarkInput = {\n      /**\n       * Which feature was used, by its snake_case name.\n       */\n      feature: string;\n      /**\n       * How the use went (TelemetryMarkKind).\n       */\n      kind: TelemetryMarkKind;\n      /**\n       * Why it went so, as a short token.\n       */\n      reason?: string;\n      /**\n       * The mark's properties, by name.\n       */\n      props?: Readonly<Record<string, TelemetryProp>>;\n  };"},{"name":"TelemetryMarkKind","kind":"type","line":13592,"doc":{"desc":["How one use of a feature went, as the CLI's own feature events count it.","","`ok`: used, the person got what they asked. `sad`: degraded, they still","got something. `bad`: failed, they got nothing."],"params":[],"example":[],"returns":[]},"text":"  export type TelemetryMarkKind = 'ok' | 'sad' | 'bad';"},{"name":"TelemetryMarkResult","kind":"type","line":13598,"doc":{"desc":["What a `telemetry.mark` hook returns and `next(e)` resolves to:","`{ value: undefined }`, or `{ deny }`, which rejects the caller's promise."],"params":[],"example":[],"returns":[]},"text":"  export type TelemetryMarkResult = ValueOrDeny<undefined>;"},{"name":"TelemetryProp","kind":"type","line":13604,"doc":{"desc":["One property of a first-party row or a mark: a number, a boolean, or a","string chosen from a list (TelemetryChoice)."],"params":[],"example":[],"returns":[]},"text":"  export type TelemetryProp = number | boolean | TelemetryChoice;"},{"name":"TelemetryRecordEntry","kind":"type","line":13609,"doc":{"desc":["A record for the telemetry collector the session's operator configured."],"params":[],"example":[],"returns":[]},"text":"  export type TelemetryRecordEntry = {\n      /**\n       * The operator's collector. Pinned.\n       */\n      to: 'collector';\n      /**\n       * The record's event; it leaves named `claude_code.<event>`.\n       */\n      event: string;\n      /**\n       * The record's attributes; they go out as they stand, in the order\n       * written.\n       */\n      attributes: Readonly<Record<string, TelemetryAttribute>>;\n      /**\n       * When it was logged: an ISO 8601 instant to the millisecond.\n       */\n      loggedAt: string;\n      /**\n       * Where in a trace the record belongs, when it belongs to one.\n       */\n      span?: TelemetrySpan;\n  };"},{"name":"TelemetryRowArgs","kind":"type","line":13637,"doc":{"desc":["A first-party row as a call passes it: `to` left out reads as","`anthropic`."],"params":[],"example":[],"returns":[]},"text":"  export type TelemetryRowArgs = {\n      /**\n       * The destination, Anthropic's first-party analytics; optional here.\n       */\n      to?: 'anthropic';\n      /**\n       * The row's event name.\n       */\n      event: string;\n      /**\n       * The row's properties, by name.\n       */\n      props?: Readonly<Record<string, TelemetryProp>>;\n  };"},{"name":"TelemetryRowEntry","kind":"type","line":13656,"doc":{"desc":["A first-party row as a hook reads it: `to` is always present, the engine","having completed it before any hook or matcher reads `e`."],"params":[],"example":[],"returns":[]},"text":"  export type TelemetryRowEntry = {\n      /**\n       * Anthropic's first-party analytics. Pinned.\n       */\n      to: 'anthropic';\n      /**\n       * The row's event name.\n       */\n      event: string;\n      /**\n       * The row's properties, by name.\n       */\n      props?: Readonly<Record<string, TelemetryProp>>;\n  };"},{"name":"TelemetrySpan","kind":"type","line":13675,"doc":{"desc":["The span a collector record belongs to, as W3C trace context spells it:","the ids in lowercase hex."],"params":[],"example":[],"returns":[]},"text":"  export type TelemetrySpan = {\n      /**\n       * The trace's id, 32 hex digits.\n       */\n      traceId: string;\n      /**\n       * The span's id, 16 hex digits.\n       */\n      spanId: string;\n      /**\n       * Bit 0 set when the trace is sampled, as W3C trace context spells it.\n       */\n      traceFlags: number;\n  };"},{"name":"TextHoverProps","kind":"type","line":13694,"doc":{"desc":["The `Text` props a `hover` may override (its colors and styles, not its","wrapping) and `scope`, the hover group it joins; a `Button`'s label too."],"params":[],"example":[],"returns":[]},"text":"  export type TextHoverProps = {\n      /**\n       * Names a hover group of this plugin's: every element it draws with the\n       * same `scope`, in any site on the surface, lights while any is hovered.\n       *\n       * Another plugin's elements under the same string are a different group.\n       * One to 64 characters, no control characters; no keyed Box needed. On the\n       * terminal a Text nested in a Text follows its group but cannot heat it.\n       */\n      scope?: string;\n      color?: Color;\n      backgroundColor?: Color;\n      dimColor?: boolean;\n      bold?: boolean;\n      italic?: boolean;\n      underline?: boolean;\n      strikethrough?: boolean;\n      inverse?: boolean;\n  };"},{"name":"TextProps","kind":"type","line":13718,"doc":{"desc":["The props of `Text`: colors, styles, and the size, weight, face and digits","each surface draws its own way. Colors are a theme key or a raw color."],"params":[],"example":[],"returns":[]},"text":"  export type TextProps = {\n      /**\n       * Style overrides applied by the surface while the pointer is over the\n       * nearest enclosing keyed `Box`, or, given a `scope`, over its group.\n       *\n       * No hook runs and nothing crosses to the plugin. Refused outside a keyed\n       * Box unless it names a `scope`.\n       */\n      hover?: TextHoverProps;\n      color?: Color;\n      backgroundColor?: Color;\n      /**\n       * The run dimmed: on the terminal, drawn in the theme's dim color.\n       *\n       * Faint too where that color is the palette's own white or black, as\n       * plain text is, unless the run is bold, inverse or on a background of\n       * any other color.\n       */\n      dimColor?: boolean;\n      /**\n       * The text size, a step on a scale each surface maps to its own type sizes.\n       *\n       * Absent, the enclosing Text's, or `body`. The terminal has one size and\n       * ignores it.\n       */\n      size?: 'caption' | 'footnote' | 'body' | 'heading' | 'title';\n      /**\n       * How heavy the text is, drawn at the nearest weight the surface has.\n       *\n       * Absent, the enclosing Text's. The terminal draws `semibold` and `bold`\n       * as bold and cannot draw a lighter weight inside a bold Text.\n       */\n      weight?: 'regular' | 'medium' | 'semibold' | 'bold';\n      /**\n       * The surface's monospaced face at the same size. The terminal is always\n       * monospaced and ignores it.\n       */\n      mono?: boolean;\n      /**\n       * Digits of one width, for a number that changes by itself on screen (a\n       * timer, a percentage) or numbers stacked in a column to line up.\n       *\n       * The terminal's digits are already one cell each.\n       */\n      tabular?: boolean;\n      /**\n       * The older spelling of a semibold weight.\n       *\n       * @deprecated Use `weight`. `bold: true` is read as `weight: 'semibold'`,\n       * and an explicit `weight` outranks it; a `hover`'s `bold` still applies.\n       */\n      bold?: boolean;\n      italic?: boolean;\n      underline?: boolean;\n      strikethrough?: boolean;\n      inverse?: boolean;\n      /**\n       * The direction the text reads in: `rtl` for a right-to-left script, so a\n       * row of it that opens with a Latin word or a number reads right to left.\n       *\n       * Absent, each row reads by its first strong letter. Where the engine\n       * orders the letters itself, `rtl` rows are also flush right; a terminal\n       * that reorders text by itself draws the Text exactly as without `dir`.\n       */\n      dir?: 'ltr' | 'rtl';\n      wrap?: 'wrap' | 'end' | 'middle' | 'truncate' | 'truncate-start' | 'truncate-middle' | 'truncate-end';\n  };"},{"name":"ThemeBackdrop","kind":"type","line":13790,"doc":{"desc":["The `backdrop` attribute of `$.theme.set`: what is drawn behind the","conversation, and how the surface frosts its panels over it."],"params":[],"example":[],"returns":[]},"text":"  export type ThemeBackdrop = {\n      /**\n       * Names the backdrop among this plugin's: 1 to 64 of letters, digits, `_`\n       * and `-`, as a pane's id. A `ui.render` hook reads it as `e.props.id`.\n       */\n      id: string;\n      /**\n       * How the surface frosts its panels over the backdrop: absent, the default\n       * glass; `false`, the panels stay as they are.\n       */\n      glass?: ThemeBackdropGlass | false;\n      /**\n       * Whether the scene is `light` or `dark`, so a surface can draw its own text\n       * to suit. Absent, the surface keeps its colors. The desktop app ignores it\n       * for now.\n       */\n      colorScheme?: 'light' | 'dark';\n  };"},{"name":"ThemeBackdropGlass","kind":"type","line":13814,"doc":{"desc":["How a surface keeps its text readable over a backdrop: the desktop app","frosts its own panels, and the mobile app lays one veil over the backdrop.","Each key absent takes the surface's default, so `{}` is the default glass."],"params":[],"example":[],"returns":[]},"text":"  export type ThemeBackdropGlass = {\n      /**\n       * How far the backdrop blurs behind a panel, in CSS pixels: 0 to 64.\n       * Absent, 16.\n       */\n      blur?: number;\n      /**\n       * What colours a panel or veil over the backdrop: a raw color, `#hex` or `rgb()`,\n       * `rgba()`, `hsl()` or `hsla()` of numbers; a theme key or a name is refused.\n       * Absent, the surface's own panel color.\n       */\n      tint?: string;\n      /**\n       * How opaque the tinted panel or veil is over the backdrop: 0 to 1. Absent,\n       * 0.6.\n       */\n      opacity?: number;\n  };"},{"name":"ThemeKey","kind":"type","line":13840,"doc":{"desc":["The theme keys named for what a color means: text, status, the prompt box","and its modes, and diffs, as the custom theme reference lists them.","","A tree that names one follows the person's theme. Another key the theme","holds resolves too, typed as any string is (Color)."],"params":[],"example":[],"returns":[]},"text":"  export type ThemeKey = 'text' | 'inverseText' | 'inactive' | 'subtle' | 'suggestion' | 'remember' | 'success' | 'error' | 'warning' | 'merged' | 'claude' | 'permission' | 'planMode' | 'autoAccept' | 'promptBorder' | 'bashBorder' | 'ide' | 'diffAdded' | 'diffRemoved' | 'diffAddedDimmed' | 'diffRemovedDimmed' | 'diffAddedWord' | 'diffRemovedWord';"},{"name":"ThemeResult","kind":"type","line":13852,"doc":{"desc":["What `$.theme.set` and `$.theme.clear` resolve to, and what a `theme.set` or","`theme.clear` hook's `{ value }` holds.","","A theme that was set stands for the session either way, so a surface that","attaches later draws it; a clear resolves `isDrawn: false` with its reason."],"params":[],"example":["const set = await $.theme.set({ backdrop: { id: \"lagoon\" } })"],"returns":[]},"text":"  export type ThemeResult = {\n      /**\n       * True: a surface is attached that draws backdrops.\n       */\n      isDrawn: true;\n      /**\n       * The backdrop's `e.requestId` at `ui.render`: `backdrop`, the same for\n       * every backdrop; `e.props.id` and `e.props.plugin` say which it is.\n       */\n      requestId: string;\n  } | {\n      /**\n       * False: nothing draws the backdrop now, for the `reason` given.\n       */\n      isDrawn: false;\n      /**\n       * The backdrop's id when it stands for a surface yet to attach.\n       */\n      requestId?: string;\n      /**\n       * Why nothing draws it, one line to show or log.\n       */\n      reason: string;\n  };"},{"name":"ThemeSetArgs","kind":"type","line":13885,"doc":{"desc":["The argument of `$.theme.set`: one object of named attributes, so a later","attribute is an addition and never a change of the call.","","`backdrop` is the one attribute this build knows; a palette is to follow as","a member of its own. An attribute the build does not know is refused by","name, never dropped."],"params":[],"example":[],"returns":[]},"text":"  export type ThemeSetArgs = {\n      /**\n       * What is drawn behind the conversation by what `ui.render` answers for\n       * `Backdrop`, the glass a surface frosts its panels with, and whether its\n       * scene is light or dark.\n       */\n      backdrop: ThemeBackdrop;\n  };"},{"name":"Tier","kind":"type","line":13902,"doc":{"desc":["One of the chain's five tiers (TIERS), outermost first; on every","`next.trace` entry, and what `next.to(e, tier)` names.","","`prepend` and `append` are the managed plugins an administrator lists,","`user` everything a person installs, `builtin` the plugins bundled in the","binary, `core` the engine's innermost link."],"params":[],"example":[],"returns":[]},"text":"  export type Tier = (typeof TIERS)[number];"},{"name":"TIERS","kind":"const","line":13912,"doc":{"desc":["The chain's five tiers, outermost first: earlier is outer is more","authority, and same-event hooks nest in this order and no other way.","","The managed plugins an administrator prepends, everything a person","installs, the managed plugins appended, the plugins bundled in the binary,","the engine's innermost link; a built-in's `$` calls still raise everywhere."],"params":[],"example":[],"returns":[]},"text":"  const TIERS: readonly [\"prepend\", \"user\", \"append\", \"builtin\", \"core\"];"},{"name":"Timer","kind":"type","line":13917,"doc":{"desc":["A pending timer from `$.clock.after` / `$.clock.every`."],"params":[],"example":[],"returns":[]},"text":"  export type Timer = {\n      /**\n       * Stops it; a stopped timer never fires again.\n       */\n      cancel: () => void;\n  };"},{"name":"TimerCall","kind":"type","line":13928,"doc":{"desc":["A timer on `$.clock` (`after`, `every`): `fn` runs after `ms` milliseconds,","once or until `cancel()`."],"params":[],"example":[],"returns":[]},"text":"  export type TimerCall = (ms: number, fn: () => void) => Timer;"},{"name":"ToastOptions","kind":"type","line":13933,"doc":{"desc":["Options of `$.ui.toast`."],"params":[],"example":[],"returns":[]},"text":"  export type ToastOptions = {\n      /**\n       * How long the line stays, in milliseconds; default 4000.\n       */\n      timeoutMs?: number;\n  };"},{"name":"ToolCallArgs","kind":"type","line":13946,"doc":{"desc":["`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.","","The run gets its own id and runs in the session's loop."],"params":[],"example":[],"returns":[]},"text":"  export type ToolCallArgs = ToolCallEnvelope extends infer I ? I extends ToolCallEnvelope ? Omit<I, 'tool_use_id'> & ToolCallReserved<I['tool']> : never : never;"},{"name":"ToolCallEnvelope","kind":"type","line":13956,"doc":{"desc":["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).","","A union discriminated by `tool`: after `if (e.tool === \"Bash\")`, `e.command`","is a string and a rewrite is checked against Bash's schema. The `e` of","`classic.PreToolUse` exactly; `tool.call`'s adds the loop (ToolCallInput)."],"params":[],"example":[],"returns":[]},"text":"  export type ToolCallEnvelope = BuiltinToolCallInput | McpToolCallInput;"},{"name":"ToolCallInput","kind":"type","line":13967,"doc":{"desc":["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.","","A union discriminated by `tool`: after `if (e.tool === \"Bash\")`, `e.command`","is a string and a rewrite is checked against Bash's schema. `tool`,","`tool_use_id` and `agentId` are reserved: a rewrite of any is refused.","`requestMeta` is a hook's to set (ToolRequestMeta)."],"params":[],"example":[],"returns":[]},"text":"  export type ToolCallInput = ToolCallEnvelope & AgentLoop & ToolRequestMeta;"},{"name":"ToolCallOverloads","kind":"type","line":13973,"doc":{"desc":["`$.tool.call(input)`: resolves with `result` typed for the tool `input`","names (ToolCallResult), or loosely for an input that names none literally."],"params":[],"example":[],"returns":[]},"text":"  type ToolCallOverloads = {\n      <T extends string>(input: ToolCallArgs & ToolNamed<T>): Promise<ToolCallResult<T>>;\n      (input: ToolCallArgs): Promise<ToolCallResult>;\n  };"},{"name":"ToolCallReserved","kind":"type","line":13986,"doc":{"desc":["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).","","`consent` is the person's own words for the press that raised the call","(`The user pressed \"1: Yes\" on ...`): the run's context carries it as a human","turn, which the permission path reads as the user's request."],"params":[],"example":[],"returns":[]},"text":"  export type ToolCallReserved<T> = {\n      tool: T;\n      tool_use_id?: string;\n      consent?: string;\n  };"},{"name":"ToolCallResult","kind":"type","line":14003,"doc":{"desc":["What a `tool.call` hook returns and what `next(e)` and `$.tool.call(input)`","resolve to: the tool's result (`{ result, context? }`) or `{ deny }`.","","From core the result is `{ ref, result, text }` or, when the tool reported","an error, `{ ref, result, text, isError }`, either with `isReadOnly` when","the tool held the input it ran read-only; `ref` names core's messages."],"params":[],"example":[],"returns":[]},"text":"  export type ToolCallResult<Name extends string = string> = {\n      /**\n       * Refuses the call: the model receives the text as an error result.\n       * Absent when the call was answered.\n       *\n       * Returned after the tool answered without error it withholds that\n       * result and undoes nothing: in its place the model reads `<tool> ran,\n       * and a plugin withheld its result: <text>`.\n       */\n      deny: string;\n      result?: undefined;\n      context?: undefined;\n      ref?: undefined;\n      text?: undefined;\n      isError?: undefined;\n      isReadOnly?: undefined;\n  } | {\n      /**\n       * The tool's output: from core the tool's record, typed per built-in\n       * tool once `e.tool` and `isError` are narrowed; from a hook, its own.\n       *\n       * Core validates a hook's answer against the tool's output schema when\n       * it has one, maps it for the model with the tool's own mapper, and\n       * records it in the transcript as the tool's result. Absent on a deny.\n       */\n      result: ToolResultOf<Name>;\n      /**\n       * What the model reads after the tool's result and the user never\n       * sees. From core, none.\n       *\n       * One reminder, as a PostToolUse hook's is, after the managed tier's\n       * review; none on a plugin's own `$.tool.call`. Kept whole from `next`,\n       * none empty, any length: past 100,000 (200,000 together) head + path.\n       */\n      context?: readonly string[];\n      /**\n       * Set by core on what `next(e)` resolves to: names the messages core\n       * produced for the call (they stay on the host side).\n       *\n       * A hook that returns the object it got makes core use them verbatim.\n       * Absent on a hook's own `{ result }` and on a deny.\n       */\n      ref?: number;\n      /**\n       * Set by core: the result as the model reads it (text blocks joined),\n       * present whatever the tool, where `result`'s shape varies per tool.\n       *\n       * Absent on a hook's own `{ result }`.\n       */\n      text?: string;\n      /**\n       * Set by core, present only when the tool held the input it executed\n       * read-only by its own check (the one its permissions use).\n       *\n       * It speaks for this call as run, rewrites included, not for calls it\n       * causes (a subagent's tools raise their own `tool.call`); for an MCP\n       * tool, its server's declaration. Bash `ls`: set; a hook's own: never.\n       */\n      isReadOnly?: true;\n      isError?: undefined;\n      deny?: undefined;\n  } | {\n      /**\n       * Set by core, present only when the tool reported an error (it threw,\n       * was interrupted, or answered an error): `text` is what the model read.\n       */\n      isError: true;\n      /**\n       * What the transcript stored for the errored call: the error text, or\n       * undefined when nothing was stored; never the tool's typed record.\n       */\n      result: unknown;\n      /**\n       * The error as the model reads it.\n       */\n      text?: string;\n      /**\n       * As on an answered result: names the messages core produced.\n       */\n      ref?: number;\n      /**\n       * As on an answered result.\n       */\n      context?: readonly string[];\n      /**\n       * As on an answered result: the tool held the input it ran read-only.\n       */\n      isReadOnly?: true;\n      deny?: undefined;\n  };"},{"name":"ToolCheckApprover","kind":"type","line":14100,"doc":{"desc":["Who answers the asks of a `tool.check` evaluation.","","`host`, the program that answers a hosted session's asks or a served call's","own session; `person`, a dialog or a card the person answers."],"params":[],"example":[],"returns":[]},"text":"  type ToolCheckApprover = 'host' | 'person';"},{"name":"ToolCheckArgs","kind":"type","line":14107,"doc":{"desc":["`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."],"params":[],"example":[],"returns":[]},"text":"  type ToolCheckArgs = Pick<ToolCheckInput, 'tool' | 'input'>;"},{"name":"ToolCheckDecision","kind":"type","line":14114,"doc":{"desc":["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."],"params":[],"example":[],"returns":[]},"text":"  type ToolCheckDecision = 'allow' | 'ask' | 'deny';"},{"name":"ToolCheckInput","kind":"type","line":14124,"doc":{"desc":["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`.","","All are the question's identity and are pinned: a hook decides about","this call, it does not change it (`tool.call` rewrites a call). A","`$.tool.check` query is asked outside any loop and carries no `agentId`."],"params":[],"example":[],"returns":[]},"text":"  type ToolCheckInput = {\n      /**\n       * As the model names it (`Bash`, `mcp__server__tool`); the key a matcher\n       * narrows on.\n       *\n       * A matcher on any name the host declares for the tool admits it.\n       */\n      tool: string;\n      /**\n       * The tool's arguments as the permission decision reads them\n       * (`{ command }` for Bash, `{ file_path, ... }` for the file tools).\n       */\n      input: unknown;\n      /**\n       * The call being decided, on a real call only; absent on a query.\n       *\n       * `next.origin` names who raised it: `{ plugin: 'engine', tier: 'core' }`\n       * for the model's own call, the plugin for its `$.tool.call` or its query.\n       */\n      tool_use_id?: string;\n      /**\n       * The id of the loop the call is decided in, on a real call inside a\n       * subagent's or a teammate's loop: the one its `tool.call` carried.\n       *\n       * Absent on the main loop and on a query. Which loop, not which plugin\n       * caused the call (that is `next.origin`).\n       */\n      agentId?: string;\n      /**\n       * The most permissive verdict the organization lets a call of the tool\n       * reach (`ask`), as its administrators set it on a connector's tool.\n       *\n       * Set by the engine, from the tool, never by a query, and pinned. A\n       * hook's own `ceiling`, on its answer, is dropped. Absent where none is\n       * set.\n       */\n      ceiling?: ToolCheckDecision;\n      /**\n       * Who answers this evaluation's asks, known before any hook runs.\n       *\n       * `host` where a host's permission callback does, `person` where a person\n       * can be asked, a pane's card included; absent where nobody can be. Pinned.\n       */\n      approver?: ToolCheckApprover;\n      /**\n       * Set by the engine, present only when the tool's own `isReadOnly` holds\n       * this input read-only, and pinned; a matcher can select reads, never writes.\n       *\n       * Absent also means the tool cannot say: a careful hook reads it as a write.\n       * It is the tool's word, no proof of no effect (a fetch, a sent message, an\n       * agent that delegates all say it); an MCP tool's is its server's, unproven.\n       */\n      isReadOnly?: true;\n  };"},{"name":"ToolCheckResult","kind":"type","line":14187,"doc":{"desc":["What a `tool.check` hook returns and what `next(e)` resolves to: the","verdict, why, and what stands behind it, never who answers it.","","From core, the engine's declarative decision for the session's mode and","rules. A hook may answer any verdict in either direction; the last word up","the chain is the decision."],"params":[],"example":[],"returns":[]},"text":"  type ToolCheckResult = {\n      /**\n       * `allow` runs the tool; `ask` puts it to the mode's decider, or to a\n       * person when a hook made it (`plugin`); `deny` refuses it, the reason the\n       * model's error.\n       *\n       * For a tool that requires the person (a question put to them, a plan to\n       * approve) a hook only tightens: its `allow` does not dismiss the dialog.\n       * In plan mode a hook only tightens a call not shown to be a read, too.\n       */\n      decision: ToolCheckDecision;\n      /**\n       * Why, in a sentence: from core the rule or check that decided; from a\n       * hook, what the model reads on a deny and the dialog shows on an ask.\n       */\n      reason?: string;\n      /**\n       * The settings rule that decided, as written (`Bash(git push:*)`).\n       *\n       * Absent for a mode or a tool's own check.\n       */\n      rule?: string;\n      /**\n       * The classic hook event that decided, or whose ask the verdict was reached\n       * under (`PreToolUse`), whoever configured the hook.\n       *\n       * Absent on a `$.tool.check` query, which runs no classic hook.\n       */\n      hook?: string;\n      /**\n       * The key of the option whose own check asked, whoever configured it\n       * (`permissions.blockReadsOutsideWorkingDirectories`).\n       *\n       * From core, for the read block: its ask on a shell command that reads\n       * outside the working directories or, the block on, leaves the sandbox.\n       */\n      setting?: string;\n      /**\n       * The plugin whose hook made this ask, set by the engine and pinned:\n       * whatever a hook writes here is dropped.\n       *\n       * On an `ask` a hook answered, rewording included; one it hands up as it\n       * heard it keeps what it carried, so core's own names none. Such an ask is\n       * a person's: the dialog, the host's callback or a PermissionRequest hook\n       * answers. No classifier's allow settles it, its block still refuses, and\n       * a rule for the whole tool is not kept; a narrower rule the person saves\n       * is theirs and settles nothing while the hook asks. Where nobody can be\n       * asked it is a deny, this verdict's reason the model's error. A tool no\n       * prompt is raised for keeps its own rule. A hook above may answer anything\n       * over it.\n       */\n      plugin?: string;\n      /**\n       * The most permissive verdict the organization lets a call of the tool\n       * reach (`ask`), as its administrators set it on a connector's tool.\n       *\n       * The question's own (`e.ceiling`), set by the engine, from the tool, on\n       * every verdict for it, core's and each hook's alike: a hook's own\n       * `ceiling` is dropped. Absent where none is set.\n       */\n      ceiling?: ToolCheckDecision;\n  };"},{"name":"ToolDeferral","kind":"type","line":14256,"doc":{"desc":["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.","","Left out of an answer, the placement beneath stands."],"params":[],"example":[],"returns":[]},"text":"  export type ToolDeferral = boolean;"},{"name":"ToolDescribeInput","kind":"type","line":14262,"doc":{"desc":["The input of `tool.describe`: one tool's description, at the moment the","engine first renders the tool's schema for the model."],"params":[],"example":[],"returns":[]},"text":"  export type ToolDescribeInput = {\n      /**\n       * As the model sees the name (`Bash`, `mcp__server__tool`); the key a\n       * matcher narrows on.\n       */\n      tool: string;\n      /**\n       * The tool's description as it computed it.\n       */\n      description: string;\n      /**\n       * Present, and true, when the engine lists the tool behind ToolSearch (its\n       * schema loads when the model asks for it by name); absent for one listed.\n       *\n       * By the engine's rule an MCP server's tool, or one that asks to be,\n       * unless a rule keeps it in front (a plugin's `$.tool.register` tool\n       * whose spec says `isDeferred: false` is kept in front).\n       */\n      isDeferred?: true;\n      /**\n       * Who provides this tool: the plugin and its tier; `{ plugin: \"engine\",\n       * tier: \"core\" }` for a built-in. Pinned: a rewrite is refused.\n       *\n       * A configured MCP server's tool is `mcp:<server>`, in `prepend` when the\n       * policy settings source configures the server, else `user`.\n       */\n      provider: Origin;\n  };"},{"name":"ToolDescribeResult","kind":"type","line":14299,"doc":{"desc":["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).","","`{ description }` alone, or `{ ...(await next(e)), description }`, changes","the text and keeps the engine's placement; `isDeferred: true` puts the tool","behind ToolSearch, `isDeferred: false` puts its schema in the prompt's list."],"params":[],"example":[],"returns":[]},"text":"  export type ToolDescribeResult = {\n      description: string;\n      isDeferred?: ToolDeferral;\n  };"},{"name":"ToolEnvelope","kind":"type","line":14308,"doc":{"desc":["`{ tool, tool_use_id, ...args }` as one flat object type, generic over","the tool name and its parsed arguments."],"params":[],"example":[],"returns":[]},"text":"  type ToolEnvelope<Name, Arguments> = {\n      /**\n       * The name of the tool being called (`Bash`, `mcp__<server>__<tool>`);\n       * comparing it narrows `e`. Reserved: a rewrite of it is ignored by core.\n       */\n      tool: Name;\n      /**\n       * The tool_use block's id: the same at every event of the call and in\n       * `$.ui.notice`. Reserved: a rewrite of it is ignored by core.\n       */\n      tool_use_id: string;\n  } & Arguments;"},{"name":"ToolGroupCall","kind":"type","line":14324,"doc":{"desc":["One tool call of a ToolGroup, as `ui.render` sees it under `calls`."],"params":[],"example":[],"returns":[]},"text":"  export type ToolGroupCall = {\n      /**\n       * The id `tool.call` carried for this call (`e.tool_use_id` there), so a\n       * hook that saw the call finds its row in the group. Read-only.\n       *\n       * Absent on a desktop host that predates it.\n       */\n      tool_use_id?: string;\n      /**\n       * Which one the call ran (`Bash`, `Read`, `Grep`, ...).\n       */\n      tool: string;\n      /**\n       * The call's input, as the model sent it.\n       */\n      input: unknown;\n      /**\n       * True while the call is still running.\n       */\n      isRunning: boolean;\n      /**\n       * True when the call ended in an error.\n       */\n      isErrored: boolean;\n      /**\n       * True when an abort ended the call, as on `ToolUse`.\n       */\n      isInterrupted: boolean;\n      /**\n       * As on `ToolUse`; undefined while the call runs.\n       */\n      output?: unknown;\n  };"},{"name":"ToolInfo","kind":"type","line":14361,"doc":{"desc":["One tool as `$.tool.list()` returns it."],"params":[],"example":[],"returns":[]},"text":"  export type ToolInfo = {\n      /**\n       * What the model calls it by.\n       */\n      name: string;\n      /**\n       * What it does, in the tool's own words (its description; a first sentence at\n       * most for MCP tools without one).\n       */\n      description: string;\n      /**\n       * True for an MCP server's tool.\n       */\n      mcp: boolean;\n  };"},{"name":"ToolInputOf","kind":"type","line":14383,"doc":{"desc":["`{ tool, tool_use_id, ...args }` as one flat object type.","","The docs of `tool` and `tool_use_id` live on the `keyof` operand: a mapped","type takes its properties' docs from there."],"params":[],"example":[],"returns":[]},"text":"  export type ToolInputOf<Name extends string, Arguments> = {\n      [K in keyof ToolEnvelope<Name, Arguments>]: ToolEnvelope<Name, Arguments>[K];\n  };"},{"name":"ToolNamed","kind":"type","line":14391,"doc":{"desc":["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)."],"params":[],"example":[],"returns":[]},"text":"  type ToolNamed<T extends string> = {\n      /**\n       * The name of the tool being called (`Bash`).\n       */\n      readonly tool: T;\n  };"},{"name":"ToolRequestMeta","kind":"type","line":14401,"doc":{"desc":["What a `tool.call` hook sets for the request of an MCP server's tool."],"params":[],"example":[],"returns":[]},"text":"  export type ToolRequestMeta = {\n      /**\n       * Entries for the `_meta` of the request this call sends its MCP server,\n       * set with `next({ ...e, requestMeta })`; never an argument of the tool.\n       *\n       * The one key a hook may set is `anthropic/sources`, its value a string\n       * (JSON for anything structured) of at most 256 KiB in UTF-8: any other\n       * shape is refused. It is carried only to the session's own relay to a\n       * connector, which takes it off before a vendor sees the call; a call to\n       * any other server, and any tool that is not an MCP server's, goes out\n       * without it. The engine's own request keys are not shown here and stay\n       * as they are. Left out of a rewrite, what a hook above set is kept; `{}`\n       * clears it.\n       */\n      requestMeta?: Record<string, string>;\n  };"},{"name":"ToolResultOf","kind":"type","line":14426,"doc":{"desc":["The structured result of the tool named `Name`: its BuiltinToolResults","entry for a built-in tool, else `unknown`.","","Agent's is its entry, an AgentTeammateRecord (a started teammate's) or an","AgentCallRecord (a plugin-raised call's). `unknown` covers an MCP tool, a","name the results table lacks, and `Name` left at `string`."],"params":[],"example":[],"returns":[]},"text":"  export type ToolResultOf<Name extends string> = string extends Name ? unknown : Name extends keyof BuiltinToolResults & string ? BuiltinToolResults[Name] | (Name extends 'Agent' ? AgentCallRecord | AgentTeammateRecord : never) : unknown;"},{"name":"ToolResultSummary","kind":"type","line":14431,"doc":{"desc":["One tool_result block of a user message."],"params":[],"example":[],"returns":[]},"text":"  export type ToolResultSummary = {\n      /**\n       * The id of the call this result answers (`tool.call`'s `e.tool_use_id`).\n       */\n      tool_use_id: string;\n      /**\n       * The result as the model read it (text blocks joined).\n       */\n      text: string;\n      /**\n       * True when the tool reported an error.\n       */\n      isError: boolean;\n      /**\n       * What the transcript stored for the call: the tool's record on an answered\n       * one (`tool.call`'s `result`), the error text when `isError`.\n       *\n       * Absent when nothing was stored. Headless (`-p`), a tool may store the\n       * record less its bulk (Bash blanks `stdout`), and a subagent's transcript\n       * stores none; `text` is what the model read either way.\n       */\n      result?: unknown;\n      /**\n       * What the tool's MCP server addressed to plugins in the stored result's\n       * `_meta`: its entries under `\"claude/plugins\"` and `\"anthropic/sources\"`,\n       * by key and as the server wrote them. The model never reads it.\n       * `anthropic/sources` is handed over only from the session's own relay to a\n       * connector; `claude/plugins` is any server's own claim. A key over\n       * 256 KiB is left out and named in the list under `\"claude/omitted\"`.\n       *\n       * Off by default. Absent on an error result, and when the server\n       * addressed nothing; a subagent's transcript keeps at most 8 KiB.\n       */\n      meta?: Record<string, unknown>;\n  };"},{"name":"ToolSpec","kind":"type","line":14470,"doc":{"desc":["What `$.tool.register` takes."],"params":[],"example":[],"returns":[]},"text":"  export type ToolSpec = {\n      /**\n       * The tool's short name (letters, digits, `_`, `-`; up to 64); the model\n       * calls it as `mcp__<plugin>__<name>`.\n       */\n      name: string;\n      /**\n       * What the tool does, for the model (and the person where tools are\n       * listed); an unpaired surrogate half in it is drawn as U+FFFD.\n       */\n      description: string;\n      /**\n       * A JSON schema object for the input (`{ type: \"object\", properties,\n       * required }`); default `{ type: \"object\" }`.\n       */\n      inputSchema?: Record<string, unknown>;\n      /**\n       * Where the tool waits: `false` puts its schema in the prompt's tool list,\n       * `true` behind ToolSearch.\n       *\n       * Left out, the engine's rule places it: behind ToolSearch, as it places\n       * an MCP server's tool. A `tool.describe` hook's answer is read first.\n       */\n      isDeferred?: ToolDeferral;\n  };"},{"name":"ToolUseSummary","kind":"type","line":14500,"doc":{"desc":["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`)."],"params":[],"example":[],"returns":[]},"text":"  export type ToolUseSummary = {\n      /**\n       * The call's id, as `tool.call` carried it (`e.tool_use_id` there).\n       */\n      tool_use_id: string;\n      /**\n       * Which one was called (`Read`, `Bash`, `mcp__server__tool`), as\n       * `tool.call` named it (`e.tool` there).\n       */\n      tool: string;\n      /**\n       * The arguments the model gave it.\n       */\n      input: Record<string, unknown>;\n      /**\n       * What the transcript stored for the call: the tool's record on an answered\n       * one (`tool.call`'s `result`), the error text on a refused or errored one.\n       *\n       * Absent while the call is in flight or when nothing was stored. Headless\n       * (`-p`), a tool may store the record less its bulk (Bash blanks `stdout`)\n       * and a subagent's transcript stores none; `text` holds either way.\n       */\n      result?: unknown;\n      /**\n       * The result as the model read it; absent while the call is in flight.\n       */\n      text?: string;\n      /**\n       * Present only when the tool reported an error, as on `tool.call`'s result.\n       */\n      isError?: true;\n      /**\n       * On an Agent tool use, the id of the agent it spawned: what\n       * `$.session.messages({ agentId })` reads and its `turn.complete` carries.\n       *\n       * Known while the session tracks the run and once the call is answered\n       * (from what it stored). Absent on every other tool, and on an Agent call\n       * the session refused before an agent started.\n       *\n       * @example\n       * if (use.agentId) child = await $.session.messages({ agentId: use.agentId })\n       */\n      agentId?: string;\n      /**\n       * On an answered Agent tool use that ran to completion, how long the agent\n       * ran, in milliseconds, as the call's stored record has it.\n       *\n       * Absent while it runs, on a background launch, and on every other tool.\n       */\n      durationMs?: number;\n      /**\n       * What the tool's MCP server addressed to plugins in the stored result's\n       * `_meta`: its entries under `\"claude/plugins\"` and `\"anthropic/sources\"`,\n       * by key and as the server wrote them. The model never reads it.\n       * `anthropic/sources` is handed over only from the session's own relay to a\n       * connector; `claude/plugins` is any server's own claim. A key over\n       * 256 KiB is left out and named in the list under `\"claude/omitted\"`.\n       *\n       * Off by default. Absent on an error result, and when the server\n       * addressed nothing; a subagent's transcript keeps at most 8 KiB.\n       */\n      meta?: Record<string, unknown>;\n  };"},{"name":"TraceEntry","kind":"type","line":14571,"doc":{"desc":["One settled run of a link beneath the caller, as `next.trace` lists it:","data, not a handle.","","`received` and `returned` are the live references where the hook runs","beside the chain; in a hooks module its own copies, as `e` is."],"params":[],"example":[],"returns":[]},"text":"  export type TraceEntry<N extends EventName = EventName, E = Args<N>, O = NextResult<N>> = {\n      /**\n       * The link's place in the chain, 0 the outermost.\n       */\n      readonly index: number;\n      /**\n       * The hook's plugin; `\"engine\"` for the engine's own core or bottom.\n       */\n      readonly plugin: string;\n      /**\n       * The link's tier (Tier); `\"core\"` for the engine's own core or bottom.\n       */\n      readonly tier: Tier;\n      readonly event: N;\n      readonly outcome: TraceOutcome;\n      /**\n       * Why the link was skipped without running, when it was: `bypassed by\n       * <plugin>`, whose `next.to` went beneath this tier. Absent when it ran.\n       */\n      readonly reason?: string;\n      /**\n       * Its own wall time, its `next()` calls' time in flight taken out.\n       *\n       * The engine entry's is everything beneath the last hook: in a hooks\n       * module, the host round trip.\n       */\n      readonly ms: number;\n      /**\n       * How many chunks the link yielded up, on a streaming event; absent on\n       * every other. A link left mid-stream counts what it yielded before.\n       */\n      readonly chunks?: number;\n      readonly received: E;\n      /**\n       * What the link settled on; undefined when it was skipped or rejected.\n       */\n      readonly returned: O | undefined;\n  };"},{"name":"TraceOutcome","kind":"type","line":14623,"doc":{"desc":["What the chain decided for one link, as `next.trace` names it.","","`returned`: its result stood; `passed`: it returned, by reference, what its","last `next()` resolved to (a hooks module's hook answers with a copy of its","own, so it reads `returned`); `skipped`: it failed before `next`, or a","`next.to` above continued beneath its tier (`reason` says which), and","beneath ran in its place; `kept`: it failed after `next`, and that run's","result stands; `expired`: its budget ran out (what stands follows","skipped/kept); `caught`: it threw or its budget ran out, and its `.catch`","handler's result stands; `rejected`: the link rejected; the deepest such","entry is where the rejection came from, and the ones above it let it pass."],"params":[],"example":[],"returns":[]},"text":"  export type TraceOutcome = 'caught' | 'expired' | 'kept' | 'passed' | 'rejected' | 'returned' | 'skipped';"},{"name":"TurnCompleteFields","kind":"type","line":14629,"doc":{"desc":["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."],"params":[],"example":[],"returns":[]},"text":"  type TurnCompleteFields = {\n      /**\n       * The assistant's final visible text this turn (\"\" if none, e.g.\n       * thinking-only).\n       *\n       * For a subagent's run that handed its report back to its spawner, the\n       * report delivered: whole, made safe as the spawner's copy is, and led by\n       * the review's warning if it raised one. A refused hand-back changes nothing.\n       */\n      answer: string;\n      /**\n       * Wall-clock length of the turn in milliseconds.\n       */\n      durationMs: number;\n      /**\n       * True when the turn ended by interruption (`reason === 'aborted'`).\n       */\n      isAborted: boolean;\n      /**\n       * The turn's id, the same one its `turn.start` and every `turn.step`\n       * carried, on the main loop and in a subagent's run alike.\n       *\n       * A hook that heard a turn's start hears its end after it, an aborted\n       * run's too. One that heard no start of an agent's turn hears the end\n       * alone: its spawn was nested in it, or the start was held past its bound.\n       */\n      turnId: string;\n      /**\n       * The loop the turn ran in: a subagent's id, as `$.agent.spawn` resolves\n       * it, each run of its loop one turn; absent on the main loop.\n       *\n       * Pinned: a different value is refused, one left out is kept. Every hook\n       * hears an agent's end, the spawner's too: so a plugin gets its child's\n       * answer, and a hook that spawns at each end sees them and bounds itself.\n       */\n      agentId?: string;\n      /**\n       * What the turn cost: its real requests' token counts, plus what a made-up\n       * response's stop stated, summed, and the model of the last that counted.\n       *\n       * A response a `turn.step` hook made up adds nothing unless its stop states\n       * usage; absent when nothing counted (an interrupt, an API error).\n       */\n      usage?: TurnUsage;\n  };"},{"name":"TurnCompleteInput","kind":"type","line":14681,"doc":{"desc":["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).","","`reason` says why it ended; `refusal` exists on a refusal alone."],"params":[],"example":[],"returns":[]},"text":"  export type TurnCompleteInput = TurnCompleteFields & (TurnCompleteRefused | TurnCompleteUnrefused);"},{"name":"TurnCompleteReason","kind":"type","line":14687,"doc":{"desc":["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."],"params":[],"example":[],"returns":[]},"text":"  export type TurnCompleteReason = 'answer' | 'aborted' | 'refusal' | 'error';"},{"name":"TurnCompleteRefused","kind":"type","line":14693,"doc":{"desc":["The end of a turn the model refused with no fallback model to retry on:","what the API said of the refusal rides along."],"params":[],"example":[],"returns":[]},"text":"  type TurnCompleteRefused = {\n      reason: 'refusal';\n      refusal: TurnRefusal;\n  };"},{"name":"TurnCompleteResult","kind":"type","line":14707,"doc":{"desc":["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.","","Core fills `usage` from `e.usage` when the turn had one; a hook above reads","it, and one that answers its own may leave it out. `by` is the engine's: the","plugins that wrote the text or rewrote the answer they passed down, which","head its note. What a hook puts there is replaced."],"params":[],"example":[],"returns":[]},"text":"  export type TurnCompleteResult = {\n      text: string;\n      usage?: TurnUsage;\n      by?: readonly string[];\n  };"},{"name":"TurnCompleteUnrefused","kind":"type","line":14717,"doc":{"desc":["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."],"params":[],"example":[],"returns":[]},"text":"  type TurnCompleteUnrefused = {\n      reason: Exclude<TurnCompleteReason, 'refusal'>;\n  };"},{"name":"TurnRefusal","kind":"type","line":14725,"doc":{"desc":["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."],"params":[],"example":[],"returns":[]},"text":"  export type TurnRefusal = {\n      category: string | null;\n      explanation: string | null;\n  };"},{"name":"TurnStartInput","kind":"type","line":14738,"doc":{"desc":["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`).","","On the main loop it comes after `prompt.submit` settled the text and the","UserPromptSubmit settings hooks ran; a hook that follows the main loop","alone returns `next(e)` first when `e.agentId !== undefined`."],"params":[],"example":[],"returns":[]},"text":"  export type TurnStartInput = {\n      /**\n       * The user's text as the turn proceeds with it (\"\" for a turn started without\n       * a typed prompt, e.g. a continuation).\n       *\n       * In a subagent's run, the prompt the run begins with: the Agent call's\n       * as the `agent.spawn` hooks left it, or the message that woke the loop;\n       * \"\" for a continued turn and for a run whose steps no hook sees.\n       */\n      text: string;\n      /**\n       * The turn's id, minted here; the same one every `turn.step` and the\n       * `turn.complete` of this turn carry.\n       */\n      turnId: string;\n      /**\n       * The loop the turn runs in: a subagent's or teammate's id, as `agent.spawn`\n       * answers it and `$.agent.list()` lists it; absent on the main loop.\n       *\n       * Each run of the loop is one turn. Pinned: a different value is refused,\n       * one left out is kept. The hooks an agent's spawn was nested in do not\n       * hear its start, as at its `turn.step`s; every other hook does.\n       */\n      agentId?: string;\n  };"},{"name":"TurnStartResult","kind":"type","line":14768,"doc":{"desc":["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."],"params":[],"example":[],"returns":[]},"text":"  export type TurnStartResult = {\n      turnId: string;\n  };"},{"name":"TurnStepChunk","kind":"type","line":14780,"doc":{"desc":["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.","","Text, thinking, a tool call's start and arguments, and the stop are","plain data a hook reads and rewrites; `engine` is the rest, passed on","unread. What leaves the outermost hook is what is shown and recorded."],"params":[],"example":[],"returns":[]},"text":"  export type TurnStepChunk = TurnStepTextChunk | TurnStepThinkingChunk | TurnStepToolChunk | TurnStepInputChunk | TurnStepStopChunk | TurnStepEngineChunk;"},{"name":"TurnStepEngineChunk","kind":"type","line":14790,"doc":{"desc":["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`.","","A tool call the API runs itself streams as these too: the step's result","lists it (`serverToolUses`). Pass each on where it came; a hook that","yields its own response has none, and the engine supplies the rest."],"params":[],"example":[],"returns":[]},"text":"  export type TurnStepEngineChunk = {\n      kind: 'engine';\n      /**\n       * The engine's handle on the item; opaque, this step's only.\n       */\n      ref: number;\n  };"},{"name":"TurnStepInput","kind":"type","line":14807,"doc":{"desc":["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.","","The transcript is not on it: `messageCount` says how many messages the","request carries, and `$.session.messages()` reads them (in a subagent's","loop, `$.session.messages({ agentId: e.agentId })`). A hook rewrites","`model` or `effort` going down; the rest is pinned."],"params":[],"example":[],"returns":[]},"text":"  export type TurnStepInput = {\n      /**\n       * The turn this step belongs to: its `turn.start`'s id, which its\n       * `turn.complete` will carry too. Pinned.\n       */\n      turnId: string;\n      /**\n       * The step's position in the turn, from 0. Pinned.\n       */\n      index: number;\n      /**\n       * Which model the request names, as the engine resolved it for this step\n       * (the session's, a fallback's). `next({ ...e, model })` names another, by\n       * an alias (`haiku`) or a full id.\n       */\n      model: string;\n      /**\n       * How hard the request asks the model to think: the session's setting or\n       * the model's default, absent for a model without effort; rewritable. On a\n       * model that takes effort per message a level stands from one message with\n       * input to the next: a change waits through steps whose new input is tool\n       * results, and one made on a step with input stays for the tool steps after\n       * it. A number goes out at once.\n       */\n      effort?: 'low' | 'medium' | 'high' | 'xhigh' | 'max' | number;\n      /**\n       * How many messages the request carries (the conversation so far, the\n       * turn's tool results included). Pinned: the messages are the engine's.\n       */\n      messageCount: number;\n      /**\n       * The loop the request is made in: a subagent's id, the `id`\n       * `$.agent.list()` gives it and its `tool.call`s carry; absent on main.\n       *\n       * Pinned: a different value is refused, one left out is kept. A subagent\n       * a hook spawned through `$.agent.spawn` steps past that hook, as its tool\n       * calls do; every other hook sees its steps.\n       */\n      agentId?: string;\n  };"},{"name":"TurnStepInputChunk","kind":"type","line":14856,"doc":{"desc":["A piece of a tool call's arguments as they arrive: JSON text, partial,","for the `tool` chunk of the same `index`.","","The arguments the tool runs with are the pieces concatenated and parsed","once the block ends; pieces that do not parse leave the call without","arguments it can run on, as a model that wrote broken JSON would."],"params":[],"example":[],"returns":[]},"text":"  export type TurnStepInputChunk = ChunkRef & {\n      kind: 'input';\n      index: number;\n      /**\n       * The next piece of the arguments' JSON text.\n       */\n      json: string;\n  };"},{"name":"TurnStepResult","kind":"type","line":14872,"doc":{"desc":["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.","","From the bottom, the response the engine streamed; a hook's own value","changes what the hooks above it read, never what the engine streamed."],"params":[],"example":[],"returns":[]},"text":"  export type TurnStepResult = {\n      /**\n       * The turn this step belongs to, as received.\n       */\n      turnId: string;\n      /**\n       * The step's position in the turn, as received.\n       */\n      index: number;\n      /**\n       * The visible text of the response (\"\" when it only called tools, only\n       * thought, or no request was made).\n       */\n      answer: string;\n      /**\n       * The tool calls the response asks the engine to run, in order; empty\n       * for a step that asks for none.\n       */\n      toolUses: readonly TurnStepToolUse[];\n      /**\n       * The tool calls the API ran itself inside the request (the advisor is\n       * one), in order, each with when it started and ended.\n       *\n       * Absent when the response made none. The engine runs nothing for them:\n       * no `tool.check` and no `tool.call` chain, so a hook reads them here and\n       * cannot refuse or rewrite one. `toolUses` never lists them.\n       *\n       * @example\n       * for (const use of response.serverToolUses ?? []) $.ui.log(use.name)\n       */\n      serverToolUses?: readonly TurnStepServerToolUse[];\n      /**\n       * Why the model stopped; null when no response arrived (the request\n       * failed or was interrupted before a message, or no request was made).\n       */\n      stopReason: TurnStopReason;\n      /**\n       * What the request cost as the API reported it, and the model that\n       * answered; null when no response arrived or it carried no usage.\n       */\n      usage: TurnUsage | null;\n  };"},{"name":"TurnStepServerToolUse","kind":"type","line":14923,"doc":{"desc":["One tool call of a step that the API ran itself, inside the request (the","advisor is one): the engine ran nothing for it.","","No `tool.check`, `tool.call` or `tool.describe` chain runs for it, and no","classic PreToolUse or PostToolUse hook: a hook cannot refuse, rewrite or","answer it. A tool the engine runs (`WebSearch` too) is in `toolUses`."],"params":[],"example":[],"returns":[]},"text":"  export type TurnStepServerToolUse = {\n      /**\n       * The call's id, as its result block names it (`tool_use_id` there).\n       */\n      id: string;\n      /**\n       * The server tool's name as the API spells it (`advisor`).\n       */\n      name: string;\n      /**\n       * The arguments the model gave it.\n       */\n      input: unknown;\n      /**\n       * When the model had written the call and the API began to run it, in\n       * `$.clock.now()`'s milliseconds.\n       */\n      startedAt: number;\n      /**\n       * When the call's result had arrived, in the same milliseconds.\n       *\n       * The API answers in the same response, so the step's result has it.\n       * Absent when the response ended before the result (a stream cut short,\n       * a turn paused); a response that came whole stamps both alike.\n       */\n      endedAt?: number;\n  };"},{"name":"TurnStepStopChunk","kind":"type","line":14955,"doc":{"desc":["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."],"params":[],"example":[],"returns":[]},"text":"  export type TurnStepStopChunk = ChunkRef & {\n      kind: 'stop';\n      stopReason: TurnStopReason;\n      usage: TurnUsage | null;\n  };"},{"name":"TurnStepTextChunk","kind":"type","line":14968,"doc":{"desc":["A piece of the response's visible text as it arrives, in block `index`.","","The text the person watches stream and the text the transcript records","are both the concatenation of these, in order, per block: a hook that","rewrites them rewrites both, one that drops them all drops the block."],"params":[],"example":[],"returns":[]},"text":"  export type TurnStepTextChunk = ChunkRef & {\n      kind: 'text';\n      /**\n       * The content block the piece belongs to, from 0 within one response.\n       */\n      index: number;\n      text: string;\n  };"},{"name":"TurnStepThinkingChunk","kind":"type","line":14985,"doc":{"desc":["A piece of the model's thinking as it arrives, in block `index`: what","the person sees of it live.","","The thinking block the transcript keeps is the one the model signed, as","the engine received it; thinking a hook streams without the engine's","block behind it is shown and not recorded."],"params":[],"example":[],"returns":[]},"text":"  export type TurnStepThinkingChunk = ChunkRef & {\n      kind: 'thinking';\n      index: number;\n      text: string;\n  };"},{"name":"TurnStepToolChunk","kind":"type","line":14998,"doc":{"desc":["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.","","A block whose `tool` chunk never comes out of the chain is no tool call:","the engine records none and runs none."],"params":[],"example":[],"returns":[]},"text":"  export type TurnStepToolChunk = ChunkRef & {\n      kind: 'tool';\n      index: number;\n      /**\n       * The call's `tool_use_id`.\n       */\n      id: string;\n      /**\n       * The tool's name (`Read`, `Bash`, `mcp__server__tool`).\n       */\n      name: string;\n  };"},{"name":"TurnStepToolUse","kind":"type","line":15015,"doc":{"desc":["One tool call the model asked for in a step: the tool's name and its","arguments."],"params":[],"example":[],"returns":[]},"text":"  export type TurnStepToolUse = {\n      /**\n       * The tool's name (`Read`, `Bash`, `mcp__server__tool`).\n       */\n      name: string;\n      /**\n       * The arguments the model gave it, as the tool schema shapes them.\n       */\n      input: unknown;\n  };"},{"name":"TurnStopReason","kind":"type","line":15030,"doc":{"desc":["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."],"params":[],"example":[],"returns":[]},"text":"  type TurnStopReason = 'end_turn' | 'max_tokens' | 'stop_sequence' | 'tool_use' | 'pause_turn' | 'compaction' | 'refusal' | 'model_context_window_exceeded' | null;"},{"name":"TurnUsage","kind":"type","line":15038,"doc":{"desc":["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.","","A turn's counts are its responses' summed; its model is the last response's."],"params":[],"example":[],"returns":[]},"text":"  export type TurnUsage = ModelUsage & {\n      /**\n       * Which model answered, by the id the API reports.\n       */\n      model: string;\n  };"},{"name":"UiBlitArgs","kind":"type","line":15053,"doc":{"desc":["What a plugin's `$.ui.blit(args)` takes: a Raster's next `cells`","(RasterBlitArgs) or a keyed Image's next `source` (ImageBlitArgs).","","Either names an element this plugin's own `ui.render` hook drew, still","mounted; a hook above may rewrite the cells or the source, never the","address or which kind it is."],"params":[],"example":[],"returns":[]},"text":"  export type UiBlitArgs = RasterBlitArgs | ImageBlitArgs;"},{"name":"UiBlitResult","kind":"type","line":15059,"doc":{"desc":["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."],"params":[],"example":[],"returns":[]},"text":"  export type UiBlitResult = {\n      /**\n       * Absent when the cells or source were taken; else why not.\n       *\n       * Nothing of this plugin's is mounted there (another plugin's reads so),\n       * the size is not the mounted one, the cells or source are bad, or the Image\n       * draws its `alt` there. With no surface attached `no-surface` heads it.\n       */\n      deny?: string;\n      /**\n       * With `deny`, a stable code to key on instead of the words of `deny`.\n       * `tmux-passthrough`: tmux 3.3 or later holds back images the terminal\n       * outside it can draw, because `allow-passthrough` or `focus-events` is off;\n       * both must be on. Absent for every other cause.\n       */\n      fix?: 'tmux-passthrough';\n  };"},{"name":"UiCopyArgs","kind":"type","line":15085,"doc":{"desc":["The argument of `$.ui.copy` and the input of `ui.copy`: the text, and","which surface's clipboard takes it, the caller's choice.","","A hook above the caller reads the same two fields: it may rewrite either","with `next`, refuse the copy with `{ deny }`, or answer `{ value }` itself","(a plugin whose `Client` runs on a remote surface can take copies for it)."],"params":[],"example":[],"returns":[]},"text":"  export type UiCopyArgs = {\n      /**\n       * What the person pastes afterwards, verbatim: any string, newlines and\n       * all; never shown on screen by the copy itself.\n       */\n      text: string;\n      /**\n       * Which surface to copy on; the caller's choice, one the session draws on:\n       * a press, field or message hook passes `e.surface`.\n       *\n       * Left out: the first of `$.session.surfaces()`, so a hook on `ui.copy`\n       * reads the target either way and a matcher narrows on it\n       * (`on(\"ui.copy\", { surface: \"desktop\" }, ...)`); absent: nothing draws.\n       */\n      surface?: RenderSurface;\n  };"},{"name":"UiCopyResult","kind":"type","line":15109,"doc":{"desc":["What `$.ui.copy` resolves to and what a `ui.copy` hook's `{ value }`","holds: whether the text reached a clipboard (`isCopied`), else why not."],"params":[],"example":["if (!(await $.ui.copy({ text, surface: e.surface })).isCopied) warn()"],"returns":[]},"text":"  export type UiCopyResult = {\n      /**\n       * True: the surface took the text: the terminal's clipboard tool or its\n       * OSC 52 write, or a remote surface's app writing its own clipboard.\n       *\n       * OSC 52 does not report back: a terminal that drops it, with no tool\n       * on the machine (pbcopy, wl-copy, xclip, PowerShell, tmux's buffer),\n       * still reads true.\n       */\n      isCopied: true;\n  } | {\n      /**\n       * False: nothing was copied.\n       */\n      isCopied: false;\n      /**\n       * Why not, a closed set: `no-surface`, `no-clipboard` or `refused`; a\n       * hook above answering without copying says `refused`.\n       *\n       * `no-surface`: nothing draws (a `-p` run, the SDK), or the named\n       * surface is not attached. `no-clipboard`: it draws but nothing was\n       * written (no clipboard tool ran and OSC 52 was past its bound or left\n       * out, as for VTE before 0.53; a remote app declined or was silent).\n       *\n       * @example\n       * on('ui.copy', { surface: 'mobile' }, () => ({ value: REFUSED }))\n       */\n      reason: 'no-surface' | 'no-clipboard' | 'refused';\n  };"},{"name":"UiFaultInput","kind":"type","line":15146,"doc":{"desc":["The input of `ui.fault`: a `Client` this plugin drew failed on a surface,","addressed by where the instance is drawn.","","Every key is the engine's word, pinned: `next(e)` passes them on, a","rewrite that leaves one out keeps it, one that changes it fails the hook."],"params":[],"example":[],"returns":[]},"text":"  type UiFaultInput = {\n      /**\n       * Where the instance failed: `terminal`, or the remote surface that told\n       * the engine (`desktop`).\n       */\n      surface: RenderSurface;\n      /**\n       * The render component the `Client` was drawn in (`AbovePrompt`, `Pane`,\n       * ...).\n       */\n      component: RenderComponent;\n      /**\n       * The engine's id for the drawing the `Client` sits in: the `requestId` the\n       * `ui.render` hook that drew it saw.\n       */\n      requestId: string;\n      /**\n       * The `Client`'s `key`: which instance failed.\n       */\n      element: string;\n      /**\n       * The `Client`'s `module`: which surface module ran there, as its path\n       * under the plugin's folder.\n       */\n      module: string;\n      /**\n       * When it failed (UiFaultPhase): loading, drawing, or running after it\n       * had drawn.\n       *\n       * A tree the terminal itself threw on while drawing it (`render`) is tried\n       * again, state dropped, once drawn with props of another value or at another\n       * terminal size, so an `element` may fail again; others wait for a reload.\n       */\n      phase: UiFaultPhase;\n      /**\n       * Why, as the surface said it: one line of 1 to 200 characters, no\n       * control character in it, a longer one cut and ended with an ellipsis.\n       *\n       * With no message: `the module failed without a message`, or in the\n       * terminal a named error's name (`RangeError`). Untrusted text, it may quote\n       * what the plugin's module threw: show or log it, never act on or parse it.\n       */\n      reason: string;\n  };"},{"name":"UiFaultPhase","kind":"type","line":15199,"doc":{"desc":["When a `Client` failed, as `ui.fault` names it; a closed set a matcher","narrows on.","","`load`: before its module ran (not fetched, refused, a throw at mount).","`render`: a throw while drawing, a tree the surface cannot draw, a render","that never answered. `run`: a listener, timer or handler; a loop; a flood."],"params":[],"example":[],"returns":[]},"text":"  type UiFaultPhase = 'load' | 'render' | 'run';"},{"name":"UiFaultResult","kind":"type","line":15212,"doc":{"desc":["What a `ui.fault` hook returns and what `next(e)` resolves to: `{}`, the","fault was heard.","","Observe only. Once the hooks have answered the engine draws the site the","`Client` failed in again, unasked: the plugin's `ui.render` hook falls back","by leaving the `Client` out of that drawing."],"params":[],"example":[],"returns":[]},"text":"  type UiFaultResult = Record<string, never>;"},{"name":"UiFocusArgs","kind":"type","line":15222,"doc":{"desc":["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.","","The engine resolves it to that site's ring and raises `ui.focus` under","the plugin's origin; the keyboard is the person's to give, so a site that","does not hold it, or holds it on another plugin's element, is `{ deny }`."],"params":[],"example":[],"returns":[]},"text":"  export type UiFocusArgs = {\n      /**\n       * The site, by the `requestId` this plugin draws it under: one of its\n       * panes' ids, or the band's.\n       */\n      requestId: string;\n      /**\n       * The element's `key`: a `Button`, `Input` or `Select` this plugin drew in\n       * that site; of several under one key, the first in document order.\n       *\n       * One the site's next drawing brings is waited for, bounded, except from\n       * inside that drawing's own hook, which cannot wait on itself; one it\n       * never draws is `{ deny }` once the wait is over.\n       */\n      key: string;\n  };"},{"name":"UiFocusComponent","kind":"type","line":15243,"doc":{"desc":["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."],"params":[],"example":[],"returns":[]},"text":"  export type UiFocusComponent = 'Pane' | 'AbovePrompt';"},{"name":"UiFocusInput","kind":"type","line":15253,"doc":{"desc":["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.","","Every key but `element` is the engine's word, pinned: `next(e)` passes","them on, a rewrite that leaves one out keeps it, one that changes it fails","the hook. `element` is the hook's to rewrite; the ring has not moved yet."],"params":[],"example":[],"returns":[]},"text":"  export type UiFocusInput = {\n      /**\n       * Which site: a `Pane` body or the `AbovePrompt` band.\n       */\n      component: UiFocusComponent;\n      /**\n       * The instance the `ui.render` hook drawing the site sees: the pane's id,\n       * or the band's one id.\n       */\n      requestId: string;\n      /**\n       * Whose `ui.render` hook drew the element taking the ring; absent with\n       * `element`. Read-only.\n       */\n      plugin?: string;\n      /**\n       * The `key` of the element taking the ring, as `ui.press` names it; absent\n       * for one of the engine's own stops (a pane's close mark or another's tab).\n       *\n       * `next({ ...e, element })` lands it on another element `plugin` drew in\n       * the site instead; one not drawn there is core's `{ deny }`.\n       */\n      element?: string;\n      /**\n       * Who moves it (UiFocusOrigin), set by the engine where the move starts.\n       */\n      origin: UiFocusOrigin;\n  };"},{"name":"UiFocusOrigin","kind":"type","line":15288,"doc":{"desc":["Who moves the ring at `ui.focus`, as the engine stamps it where the move","starts; a closed set a matcher narrows on.","","`next(e)` passes it on as received; no hook sets one."],"params":[],"example":[],"returns":[]},"text":"  export type UiFocusOrigin = {\n      /**\n       * The person, by Tab, the arrows or a click while the site holds the\n       * keyboard.\n       */\n      kind: 'person';\n  } | {\n      /**\n       * A plugin's `$.ui.focus`, or its `autoFocus` element taking the ring\n       * as the site takes the keyboard.\n       */\n      kind: 'plugin';\n      /**\n       * The focusing plugin's name.\n       */\n      name: string;\n  };"},{"name":"UiFocusResult","kind":"type","line":15312,"doc":{"desc":["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.","","As `ui.scroll` spells it."],"params":[],"example":[],"returns":[]},"text":"  export type UiFocusResult = {\n      /**\n       * Absent when the ring is where the chain left it; else why nothing\n       * moved.\n       *\n       * A hook kept the ring; the site is not this plugin's, holds no keyboard, or\n       * another plugin's element does; no element of `plugin` is drawn under\n       * `element`; another move came first. With no surface `no-surface` heads it.\n       *\n       * @remarks A `{ deny }` after `next(e)` was answered, a `.catch`'s too,\n       *   fails the hook, and its last `next` stands: deny in its place.\n       */\n      deny?: string;\n  };"},{"name":"UiInputArgument","kind":"type","line":15334,"doc":{"desc":["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.","","Another plugin addresses one field by matcher:","`on(\"ui.input\", { plugin: \"roster\", element: \"reply\" }, ...)`."],"params":[],"example":[],"returns":[]},"text":"  export type UiInputArgument = {\n      /**\n       * Whose `ui.render` hook drew the element.\n       */\n      plugin: string;\n      /**\n       * The `key` the hook gave its `Input`: its address, what a matcher names.\n       */\n      element: string;\n      /**\n       * The render component the element was drawn in (`AbovePrompt`,\n       * `ToolUse`, ...).\n       */\n      component: RenderComponent;\n      /**\n       * The instance the element was drawn in: the `requestId` the `ui.render`\n       * hook that drew it saw (a tool row's tool_use_id, a pane's id).\n       */\n      requestId: string;\n      /**\n       * Where the typing came from, one literal per member, so\n       * `if (e.surface === \"terminal\")` narrows `e`.\n       */\n      surface: RenderSurface;\n      /**\n       * `change` after every edit of the text; `submit` on Enter.\n       */\n      kind: 'change' | 'submit';\n      /**\n       * The field's whole text at that moment; a hook above may rewrite it for\n       * the plugins beneath and the element's own handler.\n       *\n       * A field of several lines joins them with `\\n`; a submit trims nothing.\n       */\n      value: string;\n  };"},{"name":"UiInputResult","kind":"type","line":15378,"doc":{"desc":["What a `ui.input` hook returns and what `next(e)` resolves to.","","Beneath every hook, core runs the element's `onInput` (kind `change`) or","`onSubmit` (kind `submit`) closure in its plugin's environment with the","value as the chain left it, and answers `{ element, value }`."],"params":[],"example":[],"returns":[]},"text":"  export type UiInputResult = {\n      /**\n       * Which handler the input reached, by its Input's `key`.\n       */\n      element: string;\n      /**\n       * The text the handler received.\n       */\n      value: string;\n  };"},{"name":"UiLogOptions","kind":"type","line":15392,"doc":{"desc":["Options of `$.ui.log`."],"params":[],"example":[],"returns":[]},"text":"  export type UiLogOptions = {\n      /**\n       * Where the line goes (UiLogSink); `transcript` when left out. A hook on\n       * `ui.log` reads it as `e.to` and may send the line elsewhere.\n       */\n      to?: UiLogSink;\n  };"},{"name":"UiLogSink","kind":"type","line":15407,"doc":{"desc":["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.","","The debug log is `claude --debug` or the `--debug-file`; either way the","line is led by the plugin's name."],"params":[],"example":[],"returns":[]},"text":"  export type UiLogSink = 'transcript' | 'debug';"},{"name":"UiMessageArgument","kind":"type","line":15417,"doc":{"desc":["The argument of `ui.message`: what a `Client` instance's surface module","posted (`surface.post(data)`), addressed by where the instance is drawn.","","The origin is `client`: code sent it, on nobody's behalf, so `data` is","input to validate, not a fact. Everything but `data` is the engine's word","and a hook may not rewrite it."],"params":[],"example":[],"returns":[]},"text":"  export type UiMessageArgument = {\n      /**\n       * Where the instance is drawn: `terminal`, or `desktop` once it has them.\n       */\n      surface: RenderSurface;\n      /**\n       * The render component the `Client` was drawn in (`AbovePrompt`, `Pane`,\n       * ...).\n       */\n      component: RenderComponent;\n      /**\n       * The engine's id for the drawing the `Client` sits in: the `requestId` the\n       * `ui.render` hook that drew it saw.\n       */\n      requestId: string;\n      /**\n       * The `Client`'s `key`: which instance posted.\n       */\n      element: string;\n      /**\n       * The `Client`'s `module`: which surface module runs there, as its path\n       * under the plugin's folder.\n       */\n      module: string;\n      /**\n       * What the instance posted: plain data (JsonValue) of at most 100000\n       * characters; typed `unknown` since it came from code. Rewritable.\n       */\n      data: unknown;\n  };"},{"name":"UiMessageResult","kind":"type","line":15456,"doc":{"desc":["What a `ui.message` hook returns and what `next(e)` resolves to.","","Core answers `{}`: the message was heard and nothing changes. A hook that","answers `{ props }` hands the posting instance its next props directly, its","local state kept, with no `ui.render` run; the plugin's next redraw hands","props again as usual."],"params":[],"example":[],"returns":[]},"text":"  export type UiMessageResult = {\n      /**\n       * The instance's next props, plain data (JsonValue) bounded as a `Client`'s\n       * props are; absent leaves the instance's props as they were.\n       */\n      props?: unknown;\n  };"},{"name":"UiNotifyResult","kind":"type","line":15471,"doc":{"desc":["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."],"params":[],"example":["if (!(await $.ui.notify(text)).isSent) $.ui.toast(text)"],"returns":[]},"text":"  export type UiNotifyResult = {\n      /**\n       * True: the person's notification channel wrote it to their terminal,\n       * as its notification sequence, its bell, or both.\n       *\n       * A terminal does not report back: one that drops the sequence, or a\n       * system that mutes its banners, still reads true.\n       */\n      isSent: true;\n      /**\n       * Which channel sent it, spelt as the `preferredNotifChannel` setting\n       * spells it; under `auto`, the one their terminal resolved to.\n       *\n       * `terminal_bell` rings and shows neither the text nor the title.\n       */\n      channel: 'iterm2' | 'iterm2_with_bell' | 'kitty' | 'ghostty' | 'terminal_bell';\n  } | {\n      /**\n       * False: no channel sent it.\n       */\n      isSent: false;\n      /**\n       * Why not, a closed set: `disabled`, `no-channel`, `no-surface` or\n       * `refused`, which a hook above says when it answers without sending.\n       *\n       * `disabled`: they set `notifications_disabled`. `no-channel`: `auto`\n       * found no terminal that notifies. `no-surface`: no terminal (a `-p`\n       * run, the SDK, the desktop), no session bound yet, or it is exiting.\n       *\n       * @example\n       * on('ui.notify', { title: 'CI' }, () => ({ value: REFUSED }))\n       */\n      reason: 'disabled' | 'no-channel' | 'no-surface' | 'refused';\n  };"},{"name":"UiOpenResult","kind":"type","line":15526,"doc":{"desc":["What `$.ui.open` resolves to and what a `ui.open` hook's `{ value }` holds.","","Whether a surface draws the pane now, in `$.ui.panes()`' word","(`isPlaced`).","","Asked (the hook of a command the person typed or a prompt they entered, a","Button, Input or Select they worked; never a timer, `session.start`, a","queued prompt, nor `focus`) a pane is placed at any width: docked beside a","fullscreen transcript from 110 columns, else inline above the prompt.","Unasked it is placed from 144 terminal columns (110 for an id the person","opened from this plugin before, in this session or an earlier one, and","has not closed by hand since) and waits undrawn below that, no","`ui.render` raised, until the person opens it or the terminal widens to","the floor. Where a surface seated it (`dock`, `inline`) is on the `Pane`","render props, per surface; a plugin's tests answer with a hook beneath."],"params":[],"example":["const opened = await $.ui.open({ id: \"clock\" })"],"returns":[]},"text":"  export type UiOpenResult = {\n      /**\n       * True: the pane is open and drawn (or retitled in place); the first\n       * `ui.render` for `{ component: \"Pane\", requestId: id }` follows.\n       */\n      isPlaced: true;\n  } | {\n      /**\n       * False: the pane is open but undrawn: opened unasked on a narrow\n       * terminal, or where no surface places panes, or none is attached.\n       *\n       * With none attached keep the pane, which stays open: `session.attach`\n       * is raised when one is, `$.ui.panes()` then says placed, and a surface\n       * that places panes asks the pane's `ui.render`.\n       */\n      isPlaced: false;\n      /**\n       * Why it waits and what seats it: the floor it fell under (144 columns\n       * unasked, 110 for an id the person once opened) and the width now.\n       *\n       * Or the attached surfaces that place nothing, until one that does\n       * attaches or they leave. Or, starting `no-surface` (`$.ui.copy`'s word),\n       * that none is: every open's in a `-p` run, and until a page attaches.\n       *\n       * @example\n       * on('ui.open', { id }, () => ({ value: { isPlaced: false, reason } }))\n       */\n      reason: string;\n  };"},{"name":"UiPane","kind":"type","line":15563,"doc":{"desc":["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.","","Where a surface seated it (`dock` or `inline`) is that surface's to say, on","the `Pane` render props (`placement`); a session may draw on several."],"params":[],"example":[],"returns":[]},"text":"  export type UiPane = {\n      /**\n       * What `$.ui.open({ id })` named it, which `$.ui.close` and its\n       * `ui.render` `requestId` name too.\n       */\n      id: string;\n      /**\n       * Its tab's label: the `title` of its latest open, or the id.\n       */\n      title: string;\n      /**\n       * True for the one pane the surface shows; the rest are tabs behind it.\n       */\n      isShown: boolean;\n      /**\n       * True while the person has given it the keyboard.\n       */\n      isFocused: boolean;\n      /**\n       * False while it waits undrawn: opened unasked on a terminal too narrow\n       * for an unrequested pane, its `$.ui.open` answered `{ isPlaced: false }`.\n       *\n       * It turns true when the person opens the pane or the terminal is widened\n       * to its floor (UiOpenResult `reason`). False on every row, none shown or\n       * focused, while an open answers `no-surface`.\n       */\n      isPlaced: boolean;\n  };"},{"name":"UiPlaceArgs","kind":"type","line":15595,"doc":{"desc":["The argument of `$.ui.place`."],"params":[],"example":[],"returns":[]},"text":"  type UiPlaceArgs = {\n      /**\n       * Names the row among this plugin's: 1 to 64 of letters, digits, `_` and\n       * `-`, as a pane's id. A `ui.render` hook reads it as `e.props.id`.\n       */\n      id: string;\n  };"},{"name":"UiPlaceResult","kind":"type","line":15612,"doc":{"desc":["What `$.ui.place` resolves to and what a `ui.place` hook's `{ value }` holds.","","The row stands in the conversation either way but past the cap and with no","conversation, where there is no `requestId`."],"params":[],"example":["const placed = await $.ui.place({ id: \"build\" })"],"returns":[]},"text":"  type UiPlaceResult = {\n      /**\n       * True: a surface is attached to draw the row.\n       */\n      isPlaced: true;\n      /**\n       * The row's `e.requestId` at `ui.render`, and what `$.ui.scroll` takes.\n       */\n      requestId: string;\n  } | {\n      /**\n       * False: nothing draws the row now, for the `reason` given.\n       */\n      isPlaced: false;\n      /**\n       * The row's id when it stands for a surface yet to attach.\n       */\n      requestId?: string;\n      /**\n       * Why nothing draws it, one line to show or log.\n       */\n      reason: string;\n  };"},{"name":"UiPressArgument","kind":"type","line":15643,"doc":{"desc":["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.","","Another plugin addresses one button by matcher:","`on(\"ui.press\", { plugin: \"explainer\", element: \"explain\" }, ...)`."],"params":[],"example":[],"returns":[]},"text":"  export type UiPressArgument = {\n      /**\n       * Whose `ui.render` hook drew the element.\n       */\n      plugin: string;\n      /**\n       * The `key` the hook gave its `Button` or `Markdown`: its address, what a\n       * matcher names.\n       */\n      element: string;\n      /**\n       * The render component the element was drawn in (`ToolUse`,\n       * `AssistantMessage`, ...).\n       */\n      component: RenderComponent;\n      /**\n       * The instance the element was drawn in: the `requestId` the `ui.render`\n       * hook that drew it saw (a tool row's tool_use_id, a pane's id).\n       */\n      requestId: string;\n      /**\n       * Where the press came from, one literal per member, so\n       * `if (e.surface === \"terminal\")` narrows `e`.\n       */\n      surface: RenderSurface;\n      /**\n       * Where the press landed, when the element is a `Markdown` whose links\n       * its plugin answers (`onLinkPress`); absent for a `Button`.\n       *\n       * A hook may rewrite its `href` for the hooks and the closure beneath; one\n       * that adds or drops it fails, and the press goes on beneath it.\n       */\n      link?: PressedLink;\n  };"},{"name":"UiPressResult","kind":"type","line":15685,"doc":{"desc":["What a `ui.press` hook returns and what `next(e)` resolves to.","","Beneath every hook, core runs the element's `onPress` closure in its","plugin's environment with `e` as the chain left it, and answers","`{ element }`."],"params":[],"example":[],"returns":[]},"text":"  export type UiPressResult = {\n      /**\n       * Which handler the press reached, by its Button's `key`.\n       */\n      element: string;\n  };"},{"name":"UiScrollArgs","kind":"type","line":15700,"doc":{"desc":["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.","","The engine resolves it to a window and an offset and raises `ui.scroll`","under the plugin's origin; a transcript row is the person's to move, so","it is revealed only while the plugin answers the person's own input."],"params":[],"example":[],"returns":[]},"text":"  export type UiScrollArgs = {\n      /**\n       * What to reveal (UiScrollTarget): a render instance by `requestId`, one\n       * of this plugin's elements by `key`, or the `start` or `end` of `in`.\n       */\n      to: UiScrollTarget;\n      /**\n       * The site to scroll, by the `requestId` this plugin draws it under: one\n       * of its panes' ids, or the band's.\n       *\n       * Required with `start` and `end`; with `{ key }` it picks the site when\n       * the key is drawn in several.\n       */\n      in?: string;\n      /**\n       * Where the target lands in the window (UiScrollBlock); `nearest` when\n       * left out, so a row already showing does not move.\n       */\n      block?: UiScrollBlock;\n  };"},{"name":"UiScrollBlock","kind":"type","line":15730,"doc":{"desc":["Where in its scrollable a revealed row lands, as the DOM's","`scrollIntoView({ block })` names it.","","`nearest` moves the least that shows the row whole, and not at all when","it already shows; `start`, `center` and `end` put its top, middle or","bottom at that edge of the window. A row taller than the window shows","its top."],"params":[],"example":[],"returns":[]},"text":"  export type UiScrollBlock = 'start' | 'center' | 'end' | 'nearest';"},{"name":"UiScrollComponent","kind":"type","line":15736,"doc":{"desc":["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."],"params":[],"example":[],"returns":[]},"text":"  export type UiScrollComponent = 'Pane' | 'AbovePrompt';"},{"name":"UiScrollInput","kind":"type","line":15746,"doc":{"desc":["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).","","Every key but `offset` is the engine's word, pinned: `next(e)` passes","them on, a rewrite that leaves one out keeps it, one that changes or adds","one fails the hook. `offset` is the hook's to rewrite; nothing moved yet."],"params":[],"example":[],"returns":[]},"text":"  export type UiScrollInput = {\n      /**\n       * Which site: a `Pane` body or the `AbovePrompt` band.\n       */\n      component: UiScrollComponent;\n      /**\n       * The instance the `ui.render` hook drawing the site sees: the pane's id,\n       * or the band's one id.\n       */\n      requestId: string;\n      /**\n       * The first row the window is to show, 0 at the top: the row it shows\n       * now plus `by`, clamped to the tree, or where `$.ui.scroll` resolved.\n       *\n       * `next({ ...e, offset })` moves it elsewhere (a clamp); one past the\n       * tree's end lands at the end. Nothing has moved when a hook reads it.\n       */\n      offset: number;\n      /**\n       * The rows the move asks for, signed, negative toward the top; what the\n       * DOM's `scrollBy` takes. Read-only.\n       *\n       * The person's: a wheel tick `-1` or `1` at rest, more as ticks crowd or\n       * summed in flight; an arrow a row while the engine has rows to scroll, a\n       * page key `bodyRows`, Home and End `contentRows`. A plugin's: its distance.\n       */\n      by: number;\n      /**\n       * How many rows of the tree the window shows at once, as drawn now.\n       * Read-only.\n       */\n      bodyRows: number;\n      /**\n       * How many rows the tree has, as drawn now: the window's last offset is\n       * `contentRows - bodyRows`, none when the tree fits. Read-only.\n       */\n      contentRows: number;\n      /**\n       * Who moves it (UiScrollOrigin), set by the engine where the move starts.\n       */\n      origin: UiScrollOrigin;\n      /**\n       * The body cell the person's wheel or trackpad was over (UiScrollPointer);\n       * absent for the scroll keys and for `$.ui.scroll`. Read-only.\n       *\n       * Moves summed while a dispatch was in flight carry the latest one's. A\n       * hook pinning a list over rows it scrolls itself tells a tick over the\n       * list (`row` among its list's rows) from one over the body.\n       */\n      pointer?: UiScrollPointer;\n  };"},{"name":"UiScrollOrigin","kind":"type","line":15804,"doc":{"desc":["Who moves the window at `ui.scroll`, as the engine stamps it where the","move starts; a closed set a matcher narrows on.","","`next(e)` passes it on as received; no hook sets one."],"params":[],"example":[],"returns":[]},"text":"  export type UiScrollOrigin = {\n      /**\n       * The person, by the wheel over the site or its scroll keys while\n       * they hold it.\n       */\n      kind: 'person';\n  } | {\n      /**\n       * A plugin's `$.ui.scroll`.\n       */\n      kind: 'plugin';\n      /**\n       * The scrolling plugin's name.\n       */\n      name: string;\n  };"},{"name":"UiScrollPointer","kind":"type","line":15829,"doc":{"desc":["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.","","The DOM's `clientY - body.top` in cells, the window's offset not added: a","hook drawing its own window reads `row` as its tree's row, one the engine","scrolls adds the row its window shows. The frame lies outside."],"params":[],"example":[],"returns":[]},"text":"  export type UiScrollPointer = {\n      /**\n       * 0 at the body's left edge, as `bodyColumns` counts them; negative, or\n       * `bodyColumns` and past, over an inline pane's sides or the band's `[-]`.\n       */\n      column: number;\n      /**\n       * 0 at the body's first showing row, as `bodyRows` counts them.\n       *\n       * The tree's row is `row` under a hook's own window, the window's row plus\n       * `row` under the engine's: the `scroll.offset` last read, short of a move\n       * the engine made since. Negative above the body, `bodyRows` or more below.\n       */\n      row: number;\n  };"},{"name":"UiScrollResult","kind":"type","line":15849,"doc":{"desc":["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."],"params":[],"example":[],"returns":[]},"text":"  export type UiScrollResult = {\n      /**\n       * Absent when the window is where the chain left it; else why nothing\n       * moved, as `tool.call` and `config.set` spell a refusal.\n       *\n       * A hook kept the window; the target is not this plugin's; another move came\n       * first (`the window moved meanwhile`); a transcript row was unasked (`not\n       * person-initiated`) or none scrolls. With no surface `no-surface` heads it.\n       *\n       * @remarks A `{ deny }` after `next(e)` was answered, a `.catch`'s too,\n       *   fails the hook, and its last `next` stands: deny in its place.\n       */\n      deny?: string;\n  };"},{"name":"UiScrollTarget","kind":"type","line":15875,"doc":{"desc":["What `$.ui.scroll` brings into view: never a row number, always a thing","drawn somewhere.","","`{ requestId }` names a render instance by the id its `ui.render` hook","saw (a transcript message's, a tool row's tool_use_id), scrolled into view","inside whatever scrolls it. `{ key }` names an element this plugin drew","with that `key`, inside the site it drew it in. `start` and `end` are the","top and bottom of the site `in` names; `end` keeps up with a tree that","grows (rows the plugin just added count) until anything next moves it."],"params":[],"example":[],"returns":[]},"text":"  export type UiScrollTarget = {\n      requestId: string;\n  } | {\n      key: string;\n  } | 'start' | 'end';"},{"name":"UiSelectArgument","kind":"type","line":15888,"doc":{"desc":["The argument of `ui.select`: a pick from a `Select` a render hook drew.","Flat and frozen like every event's.","","Another plugin addresses one picker by matcher:","`on(\"ui.select\", { plugin: \"roster\", element: \"peer\" }, ...)`."],"params":[],"example":[],"returns":[]},"text":"  export type UiSelectArgument = {\n      /**\n       * Whose `ui.render` hook drew the element.\n       */\n      plugin: string;\n      /**\n       * The `key` the hook gave its `Select`: its address, what a matcher names.\n       */\n      element: string;\n      /**\n       * The render component the element was drawn in (`AbovePrompt`,\n       * `ToolUse`, ...).\n       */\n      component: RenderComponent;\n      /**\n       * The instance the element was drawn in: the `requestId` the `ui.render`\n       * hook that drew it saw (a tool row's tool_use_id, a pane's id).\n       */\n      requestId: string;\n      /**\n       * Where the pick came from, one literal per member, so\n       * `if (e.surface === \"terminal\")` narrows `e`.\n       */\n      surface: RenderSurface;\n      /**\n       * The picked option's value; a hook above may rewrite it for the plugins\n       * beneath and the element's own handler.\n       */\n      value: string;\n  };"},{"name":"UiSelection","kind":"type","line":15926,"doc":{"desc":["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."],"params":[],"example":["const selected = await $.ui.selection()"],"returns":[]},"text":"  type UiSelection = {\n      /**\n       * The selected text as the person sees it: what a copy would put on the\n       * clipboard, wrapped rows joined back into their lines.\n       */\n      text: string;\n      /**\n       * The transcript row the selection lies in, by the id its `ui.render`\n       * hook reads as `e.requestId` and `$.ui.scroll` takes.\n       *\n       * A tool call's row by its `tool_use_id`. Absent when the selection spans\n       * several rows, lies outside the transcript (the prompt, a pane), or has\n       * scrolled out of the rows the transcript keeps drawn.\n       */\n      requestId?: string;\n  };"},{"name":"UiSelectResult","kind":"type","line":15950,"doc":{"desc":["What a `ui.select` hook returns and what `next(e)` resolves to.","","Beneath every hook, core runs the element's `onSelect` closure in its","plugin's environment with the value as the chain left it, and answers","`{ element, value }`."],"params":[],"example":[],"returns":[]},"text":"  export type UiSelectResult = {\n      /**\n       * Which handler the pick reached, by its Select's `key`.\n       */\n      element: string;\n      /**\n       * What the handler received: the option's value as the chain left it.\n       */\n      value: string;\n  };"},{"name":"UiViewResult","kind":"type","line":15970,"doc":{"desc":["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.","","As `ui.scroll` spells it."],"params":[],"example":["$.ui.view({ agentId }).then(shown => shown.deny && $.ui.toast(shown.deny))"],"returns":[]},"text":"  export type UiViewResult = {\n      /**\n       * Absent when the main view shows the transcript asked for; else why the\n       * view did not move.\n       *\n       * The call did not answer the person's own input; no agent holds the id,\n       * or the tasks list shows none for it; a teammate was stopped, or runs in\n       * a pane of its own; the view moved meanwhile; the session draws none.\n       */\n      deny?: string;\n  };"},{"name":"UndeclaredAttachmentInput","kind":"type","line":15986,"doc":{"desc":["One `prompt.attachment` input of every other type, the ones","PromptAttachmentDetailOf does not name: the attachment's text alone."],"params":[],"example":[],"returns":[]},"text":"  type UndeclaredAttachmentInput = {\n      /**\n       * As the engine names the attachment's kind; the key a matcher narrows on.\n       * Pinned. Builds add and retire kinds: match by name.\n       *\n       * Among them `todo_reminder`, `auto_mode`, `auto_mode_exit`, `instructions`,\n       * `nested_memory`, `skill_listing`, `deferred_tools_delta`, `file`,\n       * `edited_text_file`, `queued_command`; the plan rows carry a `detail`.\n       */\n      type: string;\n      /**\n       * What the model reads for this attachment, inside the engine's framing;\n       * rewritable with `next({ ...e, text })`.\n       *\n       * The `<system-reminder>` wrapper (or the system channel that replaces it)\n       * goes around what the chain answers, never inside it. An attachment\n       * rendered as several text blocks hands them joined by newlines.\n       */\n      text: string;\n      /**\n       * Who authored the text (PromptAttachmentOrigin): the engine, a settings\n       * hook, or a plugin's chain context.\n       *\n       * Pinned: a different value is refused, one left out is kept.\n       */\n      origin: PromptAttachmentOrigin;\n      /**\n       * The loop whose request carries the attachment: a subagent's id, the `id`\n       * `$.agent.list()` gives it and its `tool.call`s carry; absent on main.\n       *\n       * Pinned: a different value is refused, one left out is kept. A subagent\n       * a hook spawned through `$.agent.spawn` is resolved past that hook.\n       */\n      agentId?: string;\n      /**\n       * Absent, the key itself: the engine declares no facts for the type, and\n       * a rewrite that adds the key is refused.\n       *\n       * @example\n       * if (!(\"detail\" in e)) return next(e)\n       */\n      detail?: undefined;\n  };"},{"name":"UnionToIntersection","kind":"type","line":16034,"doc":{"desc":["The intersection of a union's members (`A | B` to `A & B`), by inferring","one parameter type from the contravariant positions."],"params":[],"example":[],"returns":[]},"text":"  type UnionToIntersection<U> = (U extends unknown ? (member: U) => void : never) extends (member: infer I) => void ? I : never;"},{"name":"UpdateFunction","kind":"type","line":16047,"doc":{"desc":["`update($, target, fn)`: reads the value, applies `fn` here in the","plugin's environment, writes with `ifVersion`, and tries again on a miss.","","What a handler closure uses in place of `$.state.set(ref, stale + 1)`:","two presses before a redraw both land. Functions do not cross to the host,","so the loop lives on the plugin's side. Resolves what it wrote."],"params":[],"example":["<Button key=\"more\" onPress={() => update($, count, n => n + 1)} />"],"returns":[]},"text":"  export type UpdateFunction = {\n      <T>($: StateDollar, target: Atom<T>, change: (value: T) => T): Promise<T>;\n      <P extends keyof PluginState & string, K extends keyof PluginState[P] & string>($: StateDollar, target: StateRef<P, K>, change: (value: StateValue<P, K> | undefined) => StateValue<P, K>): Promise<StateValue<P, K>>;\n  };"},{"name":"UsageUnit","kind":"type","line":16056,"doc":{"desc":["One unit of what `$.session.usage()` answers, by its key there: the","context window's fill, the rate-limit windows, the session's cost."],"params":[],"example":[],"returns":[]},"text":"  export type UsageUnit = 'context' | 'rateLimits' | 'cost';"},{"name":"UserMessageFrom","kind":"type","line":16065,"doc":{"desc":["Who sent the message a `UserMessage` row carries, when someone other than","the person did: another agent, a teammate, another session, a channel.","","Read-only. The sender's words are not the person's: the model reads them","framed as that sender's whatever a hook draws for the row."],"params":[],"example":[],"returns":[]},"text":"  type UserMessageFrom = {\n      /**\n       * The sender's name as the row shows it: a subagent's name, else its type;\n       * a teammate's; another session's title; a channel's sender, else server.\n       *\n       * One printable line: control and format characters stripped, whitespace\n       * collapsed, length bounded. Absent (no `from`) for a teammate block whose\n       * frames name different senders or none.\n       */\n      name: string;\n  };"},{"name":"UserMessageTask","kind":"type","line":16086,"doc":{"desc":["The background task a `UserMessage` notification row reports on: a","subagent, a background shell, a workflow, a remote agent, a monitor.","","Every field is the notification's own, so the row names the same task on","every draw, a resumed session's included; the session's record of it","(name, type, description) is `$.agent.list()`'s, by `id`. Each string is","one printable line, bounded (a forged envelope's bytes capped). Read-only."],"params":[],"example":[],"returns":[]},"text":"  type UserMessageTask = {\n      /**\n       * The task's id as the notification names it; for a subagent, the\n       * `agentId` its `turn.complete` carried and `$.agent.list()` keys.\n       */\n      id?: string;\n      /**\n       * How the task ended: `completed`, `failed` or `killed` (stopped, by the\n       * person or by Claude), or another word its producer wrote.\n       */\n      status?: string;\n      /**\n       * What kind of task, when the notification says (`remote_agent`, an\n       * artifact watch's kind); a subagent's and a shell's leave it out.\n       */\n      type?: string;\n      /**\n       * Which call started the task: its `tool_use_id`, when the notification\n       * carries it.\n       */\n      toolUseId?: string;\n      /**\n       * How long the task ran, in milliseconds, when the notification says; the\n       * row draws it after the summary (`2m 2s`).\n       */\n      durationMs?: number;\n  };"},{"name":"UserPromptExpansionHookInput","kind":"type","line":16114,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"  type UserPromptExpansionHookInput = BaseHookInput & {\n      hook_event_name: 'UserPromptExpansion';\n      expansion_type: 'slash_command' | 'mcp_prompt';\n      command_name: string;\n      command_args: string;\n      command_source?: string;\n      prompt: string;\n  };"},{"name":"UserPromptSubmitHookInput","kind":"type","line":16123,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"  type UserPromptSubmitHookInput = BaseHookInput & {\n      hook_event_name: 'UserPromptSubmit';\n      prompt: string;\n      /**\n       * Who authored/injected the prompt: `user` = submitted from the interactive composer, `sdk` = non-interactive entrypoint (`-p` / Agent SDK), `loop_wakeup` = dynamic /loop wakeup, `schedule_wakeup` = scheduled-task fire (CronCreate or a cloud scheduled task), `system` = other machine-injected turns (peer/channel messages, task notifications, auto-continuation), `poll_event` = the poll-event channel enqueue-time pass (the hook fires when the host submits an event, before its delivery ack exists - a blocking verdict rejects the event). Payloads may omit it while the field rolls out.\n       */\n      source?: 'user' | 'sdk' | 'system' | 'loop_wakeup' | 'schedule_wakeup' | 'poll_event';\n      session_title?: string;\n  };"},{"name":"ValueOrDeny","kind":"type","line":16137,"doc":{"desc":["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."],"params":[],"example":[],"returns":[]},"text":"  type ValueOrDeny<Value> = {\n      value: Value;\n      deny?: undefined;\n  } | {\n      deny: string;\n      value?: undefined;\n  };"},{"name":"WorktreeCreateHookInput","kind":"type","line":16145,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"  type WorktreeCreateHookInput = BaseHookInput & {\n      hook_event_name: 'WorktreeCreate';\n      name: string;\n  };"},{"name":"WorktreeRemoveHookInput","kind":"type","line":16150,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"  type WorktreeRemoveHookInput = BaseHookInput & {\n      hook_event_name: 'WorktreeRemove';\n      worktree_path: string;\n  };"},{"name":"atom","kind":"const","line":16163,"doc":{"desc":["A named value with its initial: `read` answers the initial while nothing","is written, so never `undefined`. Pure; runs in the plugin's environment."],"params":[],"example":["import { atom, read, update } from \"claude-code\"","const count = atom({ plugin: \"counter\", key: \"count\" } as const, 0)"],"returns":[]},"text":"  export const atom: AtomFunction\n"},{"name":"derive","kind":"const","line":16171,"doc":{"desc":["A value computed from atoms and references, cached by their versions."],"params":[],"example":["const busy = derive([workers], list => list.filter(w => w.isBusy).length)"],"returns":[]},"text":"  export const derive: DeriveFunction\n"},{"name":"memberOf","kind":"const","line":16179,"doc":{"desc":["A family's member for the instance being drawn, keyed by `e.requestId`."],"params":[],"example":["const open = await read($, memberOf(isOpen, e))"],"returns":[]},"text":"  export const memberOf: MemberOfFunction\n"},{"name":"read","kind":"const","line":16188,"doc":{"desc":["Reads an atom, a derived value or a reference through `$.state.get`;","while a `ui.render` hook draws, that subscribes the drawing."],"params":[],"example":["const n = await read($, count)"],"returns":[]},"text":"  export const read: ReadFunction\n"},{"name":"update","kind":"const","line":16197,"doc":{"desc":["Reads, applies `fn` in the plugin's environment, writes with","`ifVersion`, and tries again on a miss: what a handler closure calls."],"params":[],"example":["<Button key=\"more\" onPress={() => update($, count, n => n + 1)} />"],"returns":[]},"text":"  export const update: UpdateFunction\n"},{"name":"h","kind":"const","line":16223,"doc":{"desc":["The JSX factory (classic runtime, `@jsx h`; the engine prepends the","pragma): a plain-data element from a string tag or a component.","","JSX compiles to bare `h(...)` calls resolved by name, so a module (hooks or","surface) never declares, imports or takes as a parameter anything named","`h` or `Fragment` where it writes JSX, and carries no `@jsx` pragma of its","own: either silently points its JSX away from this factory, and a","`<Client>` tag written under another factory is not found when the","module's surface modules are read off its source."],"params":[],"example":[],"returns":[]},"text":"    const h: (\n      tag: string | ((props: never) => RenderNode | null | undefined),\n      props: Record<string, unknown> | null | undefined,\n      ...children: unknown[]\n    ) => RenderNode | null | undefined"},{"name":"Fragment","kind":"const","line":16232,"doc":{"desc":["`<>...</>`: a column Box around the children."],"params":[],"example":[],"returns":[]},"text":"    const Fragment: (props: { children?: RenderNode[] }) => RenderElement\n"},{"name":"JSX","kind":"namespace","line":16239,"doc":{"desc":["JSX over the element table: every tag is a constructor from","`$.ui.resolve(e)` (`const { Box, Text } = $.ui.resolve(e)`), typed by","its props; there are no intrinsic (string) tags."],"params":[],"example":[],"returns":[]},"text":"    namespace JSX {\n      type Element = RenderElement\n      type Children = RenderChildren\n      type ElementType = (props: never) => RenderNode | null | undefined\n      interface IntrinsicElements {}\n      interface ElementChildrenAttribute {\n        children: unknown\n      }\n      interface IntrinsicAttributes {\n        key?: string\n      }\n    }"},{"name":"AbortSignal","kind":"interface","line":16252,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"    interface AbortSignal {\n      readonly aborted: boolean\n      readonly reason: unknown\n      throwIfAborted(): void\n      addEventListener(\n        type: 'abort',\n        listener: () => void,\n        options?: { once?: boolean },\n      ): void\n      removeEventListener(type: 'abort', listener: () => void): void\n    }"},{"name":"AbortController","kind":"interface","line":16269,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"    interface AbortController {\n      readonly signal: AbortSignal\n      abort(reason?: unknown): void\n    }"},{"name":"TextEncoder","kind":"interface","line":16277,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"    interface TextEncoder {\n      readonly encoding: string\n      encode(input?: string): Uint8Array\n    }"},{"name":"TextDecoder","kind":"interface","line":16282,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"    interface TextDecoder {\n      readonly encoding: string\n      decode(input?: ArrayBufferView | ArrayBuffer): string\n    }"},{"name":"URLSearchParams","kind":"interface","line":16287,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"    interface URLSearchParams {\n      append(name: string, value: string): void\n      delete(name: string): void\n      get(name: string): string | null\n      getAll(name: string): string[]\n      has(name: string): boolean\n      set(name: string, value: string): void\n      toString(): string\n      forEach(callback: (value: string, key: string) => void): void\n    }"},{"name":"URL","kind":"interface","line":16301,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"    interface URL {\n      hash: string\n      host: string\n      hostname: string\n      href: string\n      readonly origin: string\n      password: string\n      pathname: string\n      port: string\n      protocol: string\n      search: string\n      readonly searchParams: URLSearchParams\n      username: string\n      toString(): string\n      toJSON(): string\n    }"},{"name":"atob","kind":"function","line":16322,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"    function atob(data: string): string\n    function btoa(data: string): string"},{"name":"structuredClone","kind":"function","line":16324,"doc":{"desc":[],"params":[],"example":[],"returns":[]},"text":"    function structuredClone<T>(value: T): T\n    var crypto: {\n      readonly subtle: {\n        digest(\n          algorithm: string | { name: string },\n          data: ArrayBufferView | ArrayBuffer,\n        ): Promise<ArrayBuffer>\n      }\n      randomUUID(): string\n      getRandomValues<T extends ArrayBufferView>(array: T): T\n    }"},{"name":"AsymmetricMatcher","kind":"type","line":16378,"doc":{"desc":["A value that matches by a rule inside `toEqual` and its kin","(`expect.any`, `expect.objectContaining`), known by its text in a failure."],"params":[],"example":[],"returns":[]},"text":"  export type AsymmetricMatcher = {\n      readonly text: string;\n  };"},{"name":"AsyncMatchers","kind":"type","line":16386,"doc":{"desc":["The same checks on what a promise received settles with, each resolving","once the promise has settled and the check passed."],"params":[],"example":[],"returns":[]},"text":"  export type AsyncMatchers = {\n      [K in keyof Matchers]: (...args: Parameters<Matchers[K]>) => Promise<void>;\n  };"},{"name":"ClassicEvent","kind":"type","line":16398,"doc":{"desc":["A classic hook event the engine raises on its own, by its own name","(`SessionStart`, `Stop`): all but `PreToolUse`, which rides `tool.call`.","","`$.tool.call` raises `classic.PreToolUse` as a session does: beneath every","plugin's `tool.call` hook and above the test's own, which a deny never","reaches (the call resolves errored, the reason its `text`)."],"params":[],"example":[],"returns":[]},"text":"  export type ClassicEvent = Exclude<ClassicEventName, 'classic.PreToolUse'> extends `classic.${infer E}` ? E : never;"},{"name":"ClassicFields","kind":"type","line":16408,"doc":{"desc":["What `$.classic.<Event>` takes: the event's own fields as its hook sees","them on `e`, less what the engine stamps at every call site.","","`hook_event_name` is the call's; `session_id`, `transcript_path` and","`cwd` are the session's unless the test gives them (the test session's","id, `''` for no local transcript, the plugin's folder)."],"params":[],"example":[],"returns":[]},"text":"  export type ClassicFields<E extends ClassicEvent> = Omit<ClassicEventOf[`classic.${E}`], 'hook_event_name' | 'session_id' | 'transcript_path' | 'cwd'> & Partial<Pick<ClassicEventOf[`classic.${E}`], 'session_id' | 'transcript_path' | 'cwd'>>;"},{"name":"ClientScope","kind":"type","line":16414,"doc":{"desc":["Which `Client` of a mounted drawing an act or a read means, by the `key`","its element carries; optional while the drawing holds exactly one."],"params":[],"example":[],"returns":[]},"text":"  export type ClientScope = {\n      in?: string;\n  };"},{"name":"Constructor","kind":"type","line":16421,"doc":{"desc":["A class, as `toThrow`, `toBeInstanceOf` and `expect.any` take it."],"params":[],"example":[],"returns":[]},"text":"  export type Constructor = abstract new (...args: never[]) => unknown;"},{"name":"describe","kind":"const","line":16430,"doc":{"desc":["A group of tests: its name leads the title of each test declared inside,","and its body runs at once, while the file loads."],"params":[["name","the group's name"],["body","declares the group's tests"]],"example":[],"returns":[]},"text":"  export const describe: (name: string, body: () => void) => void;"},{"name":"ElementOfAct","kind":"type","line":16440,"doc":{"desc":["The element each surface-dependent act of a mounted drawing reaches: a","handle carries the act only where the surface's table has the element.","","`input` needs `Input` and `select` needs `Select` (every surface today);","`key`, `pointer`, `post`, `advance` and `resize` reach a `Client`","(terminal and desktop today). The rest need nothing but a tree."],"params":[],"example":[],"returns":[]},"text":"  export type ElementOfAct = {\n      input: 'Input';\n      select: 'Select';\n      key: 'Client';\n      pointer: 'Client';\n      post: 'Client';\n      advance: 'Client';\n      resize: 'Client';\n  };"},{"name":"ElementQuery","kind":"type","line":16461,"doc":{"desc":["What a mounted drawing's `find` and `findAll` match an element on, every","field given at once: its tag, its `key`, and the text it shows.","","`text` matches the element's whole shown text (string children, a Button","or Link's label, a Markdown's text, a Code's source, an Input's value):","a string by inclusion, a RegExp by test."],"params":[],"example":["await ui.findAll({ type: 'Text', text: /overdue/, in: 'board' })"],"returns":[]},"text":"  export type ElementQuery = {\n      type?: string;\n      key?: string;\n      text?: string | RegExp;\n      /**\n       * Searches what this `Client`'s surface module drew (by the `Client`'s\n       * key) instead of the plugin's own tree.\n       */\n      in?: string;\n  };"},{"name":"Engine","kind":"type","line":16480,"doc":{"desc":["What a test holds as `$`, the engine's own: every call on it is made as","the REPL, the query loop and the render sites make theirs, over every plugin.","","`next.origin` is the engine, the chain every plugin loaded. `$.ui.mount`","is a surface drawing an instance; `press`, `input` and `select` a person","acting on an element the test drew; `$.classic` the classic hook events."],"params":[],"example":[],"returns":[]},"text":"  export type Engine = {\n      [N in keyof EventCalls]: N extends 'ui' ? EngineNoun<N> & EnginePress & EngineInput & EngineSelect & EngineMount : EngineNoun<N>;\n  } & {\n      classic: EngineClassic;\n  };"},{"name":"EngineCall","kind":"type","line":16490,"doc":{"desc":["One call on the engine's `$`: the event's input whole, as an engine call","site passes it, to its result, or for a streaming event to its stream."],"params":[],"example":[],"returns":[]},"text":"  export type EngineCall<E extends EventName> = E extends StreamingEventName ? (e: Args<E>) => HookStream<Chunk<E>, ResultOf[E]> : (e: Args<E>) => Promise<ResultOf[E]>;"},{"name":"EngineClassic","kind":"type","line":16503,"doc":{"desc":["The classic (settings) hook events as the engine raises them: each a call","running the `classic.<Event>` chain over every plugin hooked on it.","","No settings hook runs beneath, so the test's `on('classic.<Event>')` is the","bottom; the envelope (`hook_event_name`, `session_id`, `transcript_path`,","`cwd`) is stamped unless given. `PreToolUse` rides `$.tool.call` instead."],"params":[],"example":["await $.classic.SessionStart({ source: 'clear' })"],"returns":[]},"text":"  export type EngineClassic = {\n      [E in ClassicEvent]: (e: ClassicFields<E>) => Promise<ClassicResultOf[`classic.${E}`]>;\n  };"},{"name":"EngineInput","kind":"type","line":16511,"doc":{"desc":["A surface typing into an Input a test rendered: the `ui.input` chain over","every plugin hooked on it, the Input's own handler last."],"params":[],"example":[],"returns":[]},"text":"  export type EngineInput = {\n      /**\n       * Types into the Input, as an edit (`kind` `change`, reaching `onInput`) or\n       * Enter (`submit`, the default, reaching `onSubmit`) with that text.\n       *\n       * Resolves once the chain, the handler and the work it started settled.\n       * `e.surface` is the surface of the drawing that holds it.\n       *\n       * @param target whose Input, its key, the text, the kind, and the instance\n       *               and surface when several hold it\n       * @returns what the chain settled on; rejects when no such Input is drawn, or\n       *          several are and neither instance nor surface tells them apart\n       * @example\n       * await $.ui.input({ plugin: 'notes', key: 'q', text: 'g', kind: 'change' })\n       * await $.ui.input({ plugin: 'notes', key: 'q', text: 'groceries' })\n       */\n      input: (target: InputTarget) => Promise<UiInputResult | undefined>;\n  };"},{"name":"EngineMount","kind":"type","line":16541,"doc":{"desc":["A surface drawing a component instance through the plugins, then driven","by key through a handle typed by that surface (Mounted).","","`ui.render` raised there for those props, the tree validated by that","table, its `Client`s running; the reads and `press` on every surface,","`input` where the table has `Input`, the `Client` acts where `Client`."],"params":[],"example":["for (const surface of SURFACES) run(await $.ui.mount({ ...HINT, surface }))"],"returns":[]},"text":"  export type EngineMount = {\n      /**\n       * Raises the plugins' drawing of the component on the surface and holds\n       * it, as that surface showing the instance does.\n       *\n       * Resolves once the tree validated and every `Client` in it drew once.\n       *\n       * @param target whose elements, the surface, component, props and requestId\n       * @returns the mounted drawing; rejects when no `surface` (or an unknown\n       *   one) is named, when the surface cannot draw the tree returned (with\n       *   the reason: an element or a prop it lacks, a dialog's tree past its\n       *   rows), or when a `Client`'s module failed or drew nothing\n       */\n      mount: <P extends RenderSurface, C extends RenderComponent>(target: MountTarget<P, C>) => Promise<Mounted<P, C>>;\n  };"},{"name":"EngineNoun","kind":"type","line":16564,"doc":{"desc":["One noun of the engine's `$`: each of its events as the engine calls it,","`tool.call` typed per tool and `ui.render` per component, `ui.resolve` out.","","`skill.prompt` takes a call's input: its frontmatter and source may be","left out, as a test written before the event carried them does."],"params":[],"example":[],"returns":[]},"text":"  export type EngineNoun<N extends keyof EventCalls> = {\n      [V in EngineNounEvent<N>]: `${N}.${V}` extends 'tool.call' ? EngineToolCall : `${N}.${V}` extends 'ui.render' | 'skill.prompt' ? EventCalls[N][V] : EngineCall<`${N}.${V}` & EventName>;\n  };"},{"name":"EngineNounEvent","kind":"type","line":16572,"doc":{"desc":["The events of one noun a test's `$` carries: every one but `ui.resolve`,","which a render hook calls on its own `$` and the engine never raises."],"params":[],"example":[],"returns":[]},"text":"  export type EngineNounEvent<N extends keyof EventCalls> = Exclude<keyof EventCalls[N] & string, `${N}.resolve` extends 'ui.resolve' ? 'resolve' : never>;"},{"name":"EnginePress","kind":"type","line":16578,"doc":{"desc":["A surface pressing a Button a test rendered, or a Markdown's link: the","`ui.press` chain over every plugin hooked on it, its own closure last."],"params":[],"example":[],"returns":[]},"text":"  export type EnginePress = {\n      /**\n       * Presses the Button, as a click or its hotkey does; with `link`, the\n       * Markdown's link, as a click on it does.\n       *\n       * Resolves once the chain, `onPress` and any work `onPress` left running\n       * unawaited have settled (work asleep on `mock.clock` waits for the test\n       * to advance it). `e.surface` is the surface of the drawing that holds it.\n       *\n       * @param target whose element, its key, the instance and surface when\n       *   several hold it, and for a Markdown the link\n       * @returns what the chain settled on; rejects when no such element is\n       *   drawn, or several are and neither instance nor surface tells them apart\n       */\n      press: (target: PressTarget) => Promise<UiPressResult | undefined>;\n  };"},{"name":"EngineSelect","kind":"type","line":16599,"doc":{"desc":["A surface picking an option of a Select a test rendered: the `ui.select`","chain over every plugin hooked on it, the Select's own `onSelect` last."],"params":[],"example":[],"returns":[]},"text":"  export type EngineSelect = {\n      /**\n       * Picks the option, as choosing it on the surface does; resolves once the\n       * chain, `onSelect` and the work it started have settled.\n       *\n       * `e.surface` is the surface of the drawing that holds it.\n       *\n       * @param target whose Select, its key, the option's value, and the\n       *   instance and surface when several hold it\n       * @returns what the chain settled on; rejects when no such Select is\n       *   drawn, or several are and neither instance nor surface tells them apart\n       * @example\n       * await $.ui.select({ plugin: 'notes', key: 'sort', value: 'date' })\n       */\n      select: (target: SelectTarget) => Promise<UiSelectResult | undefined>;\n  };"},{"name":"EngineToolCall","kind":"type","line":16627,"doc":{"desc":["`$.tool.call` on a test's `$`: a call as the engine raises one, `agentId`","the loop it runs in (a subagent's, a teammate's); left out, the main loop.","","A hooked `tool.check` runs as for a background subagent: a test's","`classic.PermissionRequest` answers an ask; no test plays a person's yes. A","test states `isReadOnly` on `$.tool.check`; `$.ui.ask` states its own."],"params":[],"example":["await $.tool.call({ tool: 'Bash', command: 'ls', agentId: 'a1' })"],"returns":[]},"text":"  export type EngineToolCall = {\n      <T extends string>(input: ToolCallArgs & Pick<ToolCallReserved<T>, 'tool'> & AgentLoop): Promise<ToolCallResult<T>>;\n      (input: ToolCallArgs & AgentLoop): Promise<ToolCallResult>;\n  };"},{"name":"Expect","kind":"type","line":16640,"doc":{"desc":["The checks on a value (`expect(received)`), and with them the matchers","that stand inside an expected value (`expect.any(Number)`).","","A check that fails throws. In a hook the test registered with `on` the","engine skips the hook as it skips any that throws, and the test fails all","the same, with the check's message and the hook's event."],"params":[],"example":[],"returns":[]},"text":"  export type Expect = Expecting & Matching;"},{"name":"expect","kind":"const","line":16649,"doc":{"desc":["Checks a value: `expect(received).toEqual(expected)` throws an","AssertionError naming both sides when it fails, a message given leading.","","`.not` negates; `.resolves` and `.rejects` check what a promise settles","with; `expect.any(Number)` and its kin stand inside an expected value."],"params":[],"example":[],"returns":[]},"text":"  export const expect: Expect;"},{"name":"Expectation","kind":"type","line":16655,"doc":{"desc":["What `expect(received)` answers: the checks, their negation, and the","checks on what a promise received resolves or rejects with."],"params":[],"example":[],"returns":[]},"text":"  export type Expectation = Negatable<Matchers> & {\n      /**\n       * The checks on what the promise received resolves with; a rejection\n       * fails them.\n       */\n      resolves: Negatable<AsyncMatchers>;\n      /**\n       * The checks on what the promise received rejects with; a resolution\n       * fails them.\n       */\n      rejects: Negatable<AsyncMatchers>;\n  };"},{"name":"Expecting","kind":"type","line":16672,"doc":{"desc":["`expect(received, message?)`: the checks on a value, a message of the","test's own leading a failure's."],"params":[],"example":[],"returns":[]},"text":"  export type Expecting = (received: unknown, message?: string) => Expectation;"},{"name":"FoundElement","kind":"type","line":16681,"doc":{"desc":["One element of a mounted drawing as `find` returns it: the description","the plugin's hook (or a `Client`'s module) built, read as plain data.","","What every surface is handed to draw, not what any surface painted: the","same on the terminal, the desktop, VS Code and mobile."],"params":[],"example":[],"returns":[]},"text":"  export type FoundElement = {\n      /**\n       * The element's tag: `Box`, `Text`, `Button`, `Input`, `Client`, ...\n       */\n      type: string;\n      /**\n       * What its props carry as `key`, when they do.\n       */\n      key: string | undefined;\n      /**\n       * Its props, plain data: a Button's `label`, a Text's `color`, ...;\n       * handlers never cross (a Button's `onPress` is not here).\n       */\n      props: Record<string, unknown>;\n      /**\n       * What it shows: its string children in document order and, for the\n       * leaves that draw a prop as text, that prop (ElementQuery `text`).\n       */\n      text: string;\n      /**\n       * Its children as drawn: strings and element descriptions.\n       */\n      children: unknown[];\n  };"},{"name":"InputTarget","kind":"type","line":16710,"doc":{"desc":["What `$.ui.input` takes: the plugin whose hook drew the Input, its `key`,","the field's text, which input it is, instance and surface when several."],"params":[],"example":[],"returns":[]},"text":"  export type InputTarget = {\n      plugin: string;\n      key: string;\n      /**\n       * The field's whole text at that moment: `e.value` for the chain.\n       */\n      text: string;\n      /**\n       * `submit` (the default) is Enter with that text and reaches `onSubmit`;\n       * `change` is one edit left in the field and reaches `onInput`.\n       *\n       * A person typing is a run of `change`s, then a `submit`.\n       */\n      kind?: UiInputArgument['kind'];\n      /**\n       * Which instance holds it, when the plugin drew the key in several.\n       */\n      requestId?: string;\n      /**\n       * Which surface's drawing, when the key is drawn on more than one; the\n       * input carries the surface of the drawing it lands in either way.\n       */\n      surface?: RenderSurface;\n  };"},{"name":"Matchers","kind":"type","line":16739,"doc":{"desc":["The checks `expect(received)` offers; each throws an AssertionError when","it fails, naming what was expected and what was received."],"params":[],"example":[],"returns":[]},"text":"  export type Matchers = {\n      /**\n       * Passes when received is the value, by `Object.is`.\n       *\n       * @param expected the value\n       */\n      toBe: (expected: unknown) => void;\n      /**\n       * Passes when received equals the value in structure, properties holding\n       * undefined ignored; `expect.any` and its kin match inside it.\n       *\n       * @param expected the value\n       */\n      toEqual: (expected: unknown) => void;\n      /**\n       * As `toEqual`, but undefined properties and prototypes count.\n       *\n       * @param expected the value\n       */\n      toStrictEqual: (expected: unknown) => void;\n      /**\n       * Passes when received holds at least the object's properties, equal.\n       *\n       * @param expected the object\n       */\n      toMatchObject: (expected: object) => void;\n      /**\n       * Passes when a string received includes the item, or an iterable\n       * received has an element that is it.\n       *\n       * @param item the substring or element\n       */\n      toContain: (item: unknown) => void;\n      /**\n       * Passes when an iterable received has an element equal to the item.\n       *\n       * @param item the element\n       */\n      toContainEqual: (item: unknown) => void;\n      /**\n       * Passes when received's `length` is the number.\n       *\n       * @param length the number\n       */\n      toHaveLength: (length: number) => void;\n      /**\n       * Passes when received holds a property at the path (`a.b`, or the keys\n       * in order), equal to the value when one is given.\n       *\n       * @param path the property's path\n       * @param value what it must equal, when given\n       */\n      toHaveProperty: (path: string | readonly string[], value?: unknown) => void;\n      /**\n       * Passes when received is undefined.\n       */\n      toBeUndefined: () => void;\n      /**\n       * Passes when received is anything but undefined.\n       */\n      toBeDefined: () => void;\n      /**\n       * Passes when received is null.\n       */\n      toBeNull: () => void;\n      /**\n       * Passes when received is truthy.\n       */\n      toBeTruthy: () => void;\n      /**\n       * Passes when received is falsy.\n       */\n      toBeFalsy: () => void;\n      /**\n       * Passes when received is NaN.\n       */\n      toBeNaN: () => void;\n      /**\n       * Passes when received is greater than the bound.\n       *\n       * @param bound the bound\n       */\n      toBeGreaterThan: (bound: number | bigint) => void;\n      /**\n       * Passes when received is the bound or greater.\n       *\n       * @param bound the bound\n       */\n      toBeGreaterThanOrEqual: (bound: number | bigint) => void;\n      /**\n       * Passes when received is less than the bound.\n       *\n       * @param bound the bound\n       */\n      toBeLessThan: (bound: number | bigint) => void;\n      /**\n       * Passes when received is the bound or less.\n       *\n       * @param bound the bound\n       */\n      toBeLessThanOrEqual: (bound: number | bigint) => void;\n      /**\n       * Passes when a string received includes the text, or the pattern matches\n       * it.\n       *\n       * @param pattern the text or pattern\n       */\n      toMatch: (pattern: string | RegExp) => void;\n      /**\n       * Passes when a string received starts with the prefix.\n       *\n       * @param prefix the prefix\n       */\n      toStartWith: (prefix: string) => void;\n      /**\n       * Passes when a string received ends with the suffix.\n       *\n       * @param suffix the suffix\n       */\n      toEndWith: (suffix: string) => void;\n      /**\n       * Passes when received is an instance of the class.\n       *\n       * @param expected the class\n       */\n      toBeInstanceOf: (expected: Constructor) => void;\n      /**\n       * Passes when calling received throws (or, under `rejects`, the rejection\n       * is) an error as described: by substring, pattern, class or message.\n       *\n       * @param expected the description; any throw passes without one\n       */\n      toThrow: (expected?: ThrowExpectation) => void;\n  };"},{"name":"Matching","kind":"type","line":16878,"doc":{"desc":["The matchers that stand inside an expected value, each matching received","there by a rule instead of by equality."],"params":[],"example":[],"returns":[]},"text":"  export type Matching = {\n      /**\n       * Matches any instance of the class, a primitive by its wrapper\n       * (`expect.any(Number)`).\n       *\n       * @param expected the class\n       * @returns the matcher\n       */\n      any: (expected: Constructor) => AsymmetricMatcher;\n      /**\n       * Matches anything but null and undefined.\n       *\n       * @returns the matcher\n       */\n      anything: () => AsymmetricMatcher;\n      /**\n       * Matches a string that includes the text.\n       *\n       * @param text the substring\n       * @returns the matcher\n       */\n      stringContaining: (text: string) => AsymmetricMatcher;\n      /**\n       * Matches a string the pattern matches.\n       *\n       * @param pattern the pattern, or the source of one\n       * @returns the matcher\n       */\n      stringMatching: (pattern: string | RegExp) => AsymmetricMatcher;\n      /**\n       * Matches an object holding at least the shape's properties, equal.\n       *\n       * @param shape the properties\n       * @returns the matcher\n       */\n      objectContaining: (shape: object) => AsymmetricMatcher;\n      /**\n       * Matches an array holding an element equal to each of the items.\n       *\n       * @param items the elements\n       * @returns the matcher\n       */\n      arrayContaining: (items: readonly unknown[]) => AsymmetricMatcher;\n  };"},{"name":"Mock","kind":"type","line":16927,"doc":{"desc":["The world beneath the plugins, mocked noun by noun: each member registers","hooks of the test's on `on`, visible where the test calls it."],"params":[],"example":[],"returns":[]},"text":"  export type Mock = {\n      /**\n       * Answers `$.clock` from a clock in memory that moves only when the test\n       * moves it: `clock.now` reads it, and each wait is held.\n       *\n       * A held wait resolves when an advance crosses the time it is due, and is\n       * dropped when its dispatch aborts; one held past a hook's budget (ten\n       * seconds of real time) is let go, as a hook that overran.\n       *\n       * @param on the test's `on`\n       * @param options where the clock starts (`now`, 0 when not given)\n       * @returns the clock: its time, and the calls that move it\n       */\n      clock: (on: On, options?: MockClockOptions) => MockClock;\n      /**\n       * Answers `$.store` from a store in memory: `get`, `set`, `delete` and\n       * `keys` over it, as the engine keeps a plugin's own.\n       *\n       * @param on the test's `on`\n       * @param entries what the store holds at the start (nothing when not given)\n       */\n      store: (on: On, entries?: Readonly<Record<string, unknown>>) => void;\n      /**\n       * Answers `$.env.get` from a set of variables; one not listed is unset.\n       *\n       * @param on the test's `on`\n       * @param variables the environment the plugins read\n       */\n      env: (on: On, variables: Readonly<Record<string, string>>) => void;\n      /**\n       * Records what is appended to the session's conversations: each row the\n       * kit stored for a plugin's `$.session.append`, or for the test's own.\n       *\n       * The kit answers with or without this, as a session stores the row: a\n       * plugin's minted or refused, a raised one's pinned blocks put back. This is\n       * the test's `session.append` hook: one more needs a matcher (`{ door }`).\n       *\n       * @param on the test's `on`\n       * @returns the session: the rows appended so far\n       */\n      session: (on: On) => MockSession;\n  };"},{"name":"mock","kind":"const","line":16977,"doc":{"desc":["The world beneath the plugins, mocked noun by noun: `mock.clock`,","`mock.store`, `mock.env` and `mock.session`.","","Each registers hooks of the test's on the `on` it is handed, visible where","the test calls it, and answers its noun from memory or records it."],"params":[],"example":[],"returns":[]},"text":"  export const mock: Mock;"},{"name":"MockClock","kind":"type","line":16983,"doc":{"desc":["The clock `mock.clock` hands back: the time its hooks answer, and the only","ways it moves."],"params":[],"example":[],"returns":[]},"text":"  export type MockClock = {\n      /**\n       * The time now, in milliseconds: what `$.clock.now()` resolves beneath the\n       * plugins.\n       *\n       * @returns the time\n       */\n      now: () => number;\n      /**\n       * Moves the clock on, resolving each wait due on the way (`$.clock.sleep`,\n       * `after`, `every`, this clock's `sleep`) in the order it comes due.\n       *\n       * The clock reads each wait's time as it resolves, and what one started\n       * runs before the next resolves.\n       *\n       * @param ms how far to move, in milliseconds\n       * @returns resolves once the clock is there and the event loop settled\n       */\n      advance: (ms: number) => Promise<void>;\n      /**\n       * Moves the clock to a time at or past now, as `advance` would.\n       *\n       * @param ms the time, in milliseconds\n       * @returns resolves once the clock is there and the event loop settled\n       */\n      set: (ms: number) => Promise<void>;\n      /**\n       * Lets what is already under way run as far as it can without the clock\n       * moving: every wait due now resolves and the event loop settles.\n       *\n       * The same as `advance(0)`; the name for the step between starting a\n       * dispatch unawaited and looking at what it did.\n       *\n       * @returns resolves once the event loop settled, the time where it was\n       */\n      settle: () => Promise<void>;\n      /**\n       * Resolves once the clock has moved this far past now: how a hook of the\n       * test's answers late.\n       *\n       * @param ms how far, in milliseconds\n       * @returns resolves when an advance crosses that time\n       */\n      sleep: (ms: number) => Promise<void>;\n  };"},{"name":"MockClockOptions","kind":"type","line":17032,"doc":{"desc":["Where a mocked clock starts: `now`, in milliseconds (0 when not given)."],"params":[],"example":[],"returns":[]},"text":"  export type MockClockOptions = {\n      now?: number;\n  };"},{"name":"MockSession","kind":"type","line":17040,"doc":{"desc":["The session `mock.session` hands back: what was appended to its","conversations while the test ran."],"params":[],"example":[],"returns":[]},"text":"  export type MockSession = {\n      /**\n       * The rows stored so far, oldest first, each as the event carried it:\n       * `message` as stored, `door`, `origin`, `uuid` and `agentId`.\n       *\n       * A plugin's own row has the door `note`, the plugin as `origin` and a\n       * fresh `uuid`; a row a hook above refused, or the kit, is left out.\n       *\n       * @returns the rows\n       */\n      appended: () => readonly SessionAppendInput[];\n  };"},{"name":"Mounted","kind":"type","line":17061,"doc":{"desc":["A drawing of component `C` the test mounted on surface `P`: reads over its","description, acts on its elements by key, `Client` acts where `P` has one.","","Narrowed by the `surface` the test passed, as `e.surface` narrows","`$.ui.resolve(e)`: no `key` on `mobile` or `vscode`, whose tables","(Elements) lack `Client`; over a union, their meet."],"params":[],"example":[],"returns":[]},"text":"  export type Mounted<P extends RenderSurface = RenderSurface, C extends RenderComponent = RenderComponent> = {\n      [K in keyof MountedMembers<P, C> as K extends keyof ElementOfAct ? ElementOfAct[K] extends keyof Elements[P] ? K : never : K]: MountedMembers<P, C>[K];\n  };"},{"name":"MountedMembers","kind":"type","line":17073,"doc":{"desc":["Every member a mounted drawing of component `C` can have; `Mounted<P, C>`","keeps the ones surface `P` has the element for (ElementOfAct).","","Each act resolves once the work it started settled (chain, handler, what","the handler left running) and what a plugin invalidated was drawn again.","The kit exercises the mod's hooks and modules, never a surface's paint."],"params":[],"example":[],"returns":[]},"text":"  export type MountedMembers<P extends RenderSurface, C extends RenderComponent = RenderComponent> = {\n      /**\n       * Where this drawing is, as the test named it.\n       */\n      readonly surface: P;\n      /**\n       * The tree as last drawn: what the plugins' `ui.render` chain returned\n       * for this instance, validated by the surface's table, as plain data.\n       *\n       * With `in`, what that `Client`'s surface module last drew instead.\n       *\n       * @param scope `{ in }`: a `Client`'s key, to read its module's tree\n       * @returns the tree; rejects with the refusal when the surface could not\n       *   draw what the chain returned, or with a `Client`'s fault line\n       * @example\n       * expect(await ui.drawn()).toMatchObject({ type: 'Box' })\n       */\n      drawn: (scope?: ClientScope) => Promise<RenderElement>;\n      /**\n       * The first element matching the query, outermost first in document\n       * order, or undefined.\n       *\n       * @param query tag, key and shown text to match; `in` to search a Client\n       * @returns the element's description, or undefined when none matches\n       * @example\n       * expect((await ui.find({ key: 'count' }))?.text).toBe('3 notes')\n       */\n      find: (query: ElementQuery) => Promise<FoundElement | undefined>;\n      /**\n       * Every element matching the query, in document order.\n       *\n       * @param query tag, key and shown text to match; `in` to search a Client\n       * @returns the matching elements' descriptions\n       * @example\n       * expect(await ui.findAll({ type: 'Button' })).toHaveLength(2)\n       */\n      findAll: (query: ElementQuery) => Promise<FoundElement[]>;\n      /**\n       * Presses the Button keyed `key`, as the person activating it on this\n       * surface does: the `ui.press` chain, the Button's own `onPress` last.\n       *\n       * `e.surface` is this drawing's. With `link`, presses that link of the\n       * Markdown keyed `key` instead. A Button a `Client`'s module drew is\n       * pressed the same way, by its key.\n       *\n       * @param target the key; another plugin's name to press its Button; a link\n       * @returns what the chain settled on\n       * @example\n       * await ui.press({ key: 'save' })\n       */\n      press: (target: MountPressTarget) => Promise<UiPressResult | undefined>;\n      /**\n       * Types into the Input keyed `key`: the `ui.input` chain with the text as\n       * `e.value`, the Input's own handler last.\n       *\n       * `kind` `submit` (the default) is Enter with that text, `change` an edit\n       * that leaves it in the field.\n       *\n       * @param target the key and the text; `kind`; another plugin's name\n       * @returns what the chain settled on\n       * @example\n       * await ui.input({ key: 'title', text: 'groceries' })\n       */\n      input: (target: MountInputTarget) => Promise<UiInputResult | undefined>;\n      /**\n       * Picks `value` in the Select keyed `key`: the `ui.select` chain, the\n       * Select's own `onSelect` last.\n       *\n       * @param target the key and the option's value; another plugin's name\n       * @returns what the chain settled on\n       * @example\n       * await ui.select({ key: 'sort', value: 'date' })\n       */\n      select: (target: MountSelectTarget) => Promise<UiSelectResult | undefined>;\n      /**\n       * Hands a `Client`'s `onKey` listener one key, as a key pressed while\n       * its region has the focus does.\n       *\n       * `in` names the `Client` by key; optional when the drawing holds one.\n       *\n       * @param event the key (`{ key: 'right' }`, `{ key: 'a', ctrl: true }`)\n       * @example\n       * await ui.key({ key: 'return', in: 'board' })\n       */\n      key: (event: MountKeyEvent) => Promise<void>;\n      /**\n       * Hands a `Client`'s `onPointer` listener one event, in the cells of its\n       * region as every surface that draws a `Client` reports them.\n       *\n       * @param event the event (`{ type: 'down', x: 3, y: 0, button: 'left' }`)\n       * @example\n       * await ui.pointer({ type: 'down', x: 2, y: 0, button: 'left' })\n       */\n      pointer: (event: MountPointerEvent) => Promise<void>;\n      /**\n       * Posts as a `Client`'s own `surface.post(data)` does: the plugin's\n       * `ui.message` hooks run with `e.data`, `e.surface` this drawing's.\n       *\n       * A `{ props }` they answer reaches the instance, which redraws with\n       * its state kept.\n       *\n       * @param data plain data (JsonValue)\n       * @param scope `{ in }`: which `Client`, when the drawing holds several\n       * @example\n       * await ui.post({ pick: 2 })\n       */\n      post: (data: JsonValue, scope?: ClientScope) => Promise<void>;\n      /**\n       * Moves the drawing's frame clock on: each `surface.every(ms, fn)` timer\n       * of its `Client`s fires at every interval of its own the move crosses.\n       *\n       * @param ms how far, in milliseconds\n       * @example\n       * await ui.advance(250)\n       */\n      advance: (ms: number) => Promise<void>;\n      /**\n       * Lays a `Client`'s region out at a size, as the surface measuring it\n       * does: what its module reads as `surface.columns` and `surface.rows`.\n       *\n       * @param size cells across and down; `in`: which `Client`\n       * @example\n       * await ui.resize({ columns: 40, rows: 3 })\n       */\n      resize: (size: MountResizeTarget) => Promise<void>;\n      /**\n       * Draws the instance again, as the engine does when its props change (a\n       * tool row's output arrived): the `ui.render` chain with the next props.\n       *\n       * A plugin's own `$.ui.invalidate` needs no call: the drawing follows it\n       * before the next read.\n       *\n       * @param props the component's next props; the current ones when absent\n       * @example\n       * await ui.redraw({ ...TOOL_ROW, isRunning: false, output: 'done' })\n       */\n      redraw: (props?: RenderPropsOf[C]) => Promise<void>;\n      /**\n       * Lets the drawing go, as the surface dropping the instance does: its\n       * `Client`s and their timers end. Later acts on the handle reject.\n       *\n       * @example\n       * await ui.unmount()\n       */\n      unmount: () => Promise<void>;\n  };"},{"name":"MountInputTarget","kind":"type","line":17224,"doc":{"desc":["What a mounted drawing's `input` takes: the Input's key, the text, which","of the two inputs it is (`submit` when unsaid), another plugin's name."],"params":[],"example":[],"returns":[]},"text":"  export type MountInputTarget = {\n      key: string;\n      text: string;\n      kind?: UiInputArgument['kind'];\n      plugin?: string;\n  };"},{"name":"MountKeyEvent","kind":"type","line":17235,"doc":{"desc":["What a mounted drawing's `key` takes: the key as a `Client`'s `onKey`","listener receives it (ClientKeyEvent), and which `Client` when several."],"params":[],"example":[],"returns":[]},"text":"  export type MountKeyEvent = ClientKeyEvent & ClientScope;"},{"name":"MountPointerEvent","kind":"type","line":17241,"doc":{"desc":["What a mounted drawing's `pointer` takes: the event as a `Client`'s","`onPointer` listener receives it, in its region's cells, and which one."],"params":[],"example":[],"returns":[]},"text":"  export type MountPointerEvent = ClientPointerEvent & ClientScope;"},{"name":"MountPressTarget","kind":"type","line":17247,"doc":{"desc":["What a mounted drawing's `press` takes: the Button's key, another","plugin's name when the Button is not the mounted plugin's, a link."],"params":[],"example":[],"returns":[]},"text":"  export type MountPressTarget = {\n      key: string;\n      plugin?: string;\n      /**\n       * Presses this link of the Markdown keyed `key` instead of a Button.\n       */\n      link?: PressedLink;\n  };"},{"name":"MountResizeTarget","kind":"type","line":17260,"doc":{"desc":["What a mounted drawing's `resize` takes: a `Client` region's size in","cells, as the surface measuring it hands it, and which `Client`."],"params":[],"example":[],"returns":[]},"text":"  export type MountResizeTarget = {\n      columns: number;\n      rows: number;\n      in?: string;\n  };"},{"name":"MountSelectTarget","kind":"type","line":17270,"doc":{"desc":["What a mounted drawing's `select` takes: the Select's key, the picked","option's value, another plugin's name when the Select is not its own."],"params":[],"example":[],"returns":[]},"text":"  export type MountSelectTarget = {\n      key: string;\n      value: string;\n      plugin?: string;\n  };"},{"name":"MountTarget","kind":"type","line":17287,"doc":{"desc":["What `$.ui.mount` takes: whose elements the test will act on, the surface","that draws, and the component instance the engine asks the plugins for.","","The envelope a `ui.render` hook sees as `e` (`surface`, `component`,","`requestId`, `viewport`, `props`) plus `plugin`. `surface` is never","defaulted: one body run over several surfaces is what shows independence."],"params":[],"example":["$.ui.mount({ plugin: 'notes', surface, component: 'Pane', props: PANE })"],"returns":[]},"text":"  export type MountTarget<P extends RenderSurface = RenderSurface, C extends RenderComponent = RenderComponent> = {\n      /**\n       * Whose elements the handle's acts address by bare `key`: the plugin\n       * under test, usually. An act names another plugin to reach its element.\n       */\n      plugin: string;\n      /**\n       * What draws: its element table validates every tree the plugins\n       * return, and every dispatch the handle raises carries it as `e.surface`.\n       *\n       * One of `terminal`, `desktop`, `vscode`, `mobile`.\n       */\n      surface: P;\n      /**\n       * Which component the engine asks the plugins to draw (`Pane`,\n       * `AbovePrompt`, `ToolUse`, ...): what a `ui.render` matcher narrows on.\n       */\n      component: C;\n      /**\n       * The component's props, what the hook reads as `e.props`.\n       */\n      props: RenderPropsOf[C];\n      /**\n       * The instance drawn (a pane's id, a tool row's tool_use_id); one is\n       * minted when absent. Two mounts of one component are two instances.\n       */\n      requestId?: string;\n      /**\n       * What the surface measured, as the hook reads it under `e.viewport`;\n       * absent when the surface has not measured, as on `e`.\n       *\n       * Cells across and down in the surface's monospace metric and whether it\n       * docks a pane. A `Client` in the drawing starts laid out at this size\n       * (0 by 0 when absent) until the handle's `resize` lays its region out.\n       */\n      viewport?: RenderViewport;\n  };"},{"name":"Negatable","kind":"type","line":17328,"doc":{"desc":["A set of checks and, under `not`, the same set passing where they fail."],"params":[],"example":[],"returns":[]},"text":"  export type Negatable<M> = M & {\n      /**\n       * The checks negated.\n       */\n      not: M;\n  };"},{"name":"Plugin","kind":"type","line":17342,"doc":{"desc":["Written inline in a test and loaded as a plugin folder is: its name, the","tier it loads in (`user` when not given), and its hooks module's `register`.","","`register` is written `register(on) { ... }` and is self-contained, as a","module's is: it closes over nothing of the test file."],"params":[],"example":[],"returns":[]},"text":"  export type Plugin = {\n      name: string;\n      tier?: PluginTier;\n      register: Register;\n  };"},{"name":"PluginTier","kind":"type","line":17351,"doc":{"desc":["A tier a plugin loads in: every tier but the engine's own."],"params":[],"example":[],"returns":[]},"text":"  export type PluginTier = Exclude<Tier, 'core'>;"},{"name":"PressTarget","kind":"type","line":17357,"doc":{"desc":["What `$.ui.press` takes: the plugin whose `ui.render` hook drew the element,","the `key` it gave it, the instance and surface when several, a `link`."],"params":[],"example":[],"returns":[]},"text":"  export type PressTarget = {\n      plugin: string;\n      key: string;\n      /**\n       * Which instance holds it, when the plugin drew the key in several.\n       */\n      requestId?: string;\n      /**\n       * Which surface's drawing, when the key is drawn on more than one; the\n       * press carries the surface of the drawing it lands in either way.\n       */\n      surface?: RenderSurface;\n      /**\n       * For a Markdown answering its links: which of them the press lands on.\n       */\n      link?: PressedLink;\n  };"},{"name":"SelectTarget","kind":"type","line":17379,"doc":{"desc":["What `$.ui.select` takes: the plugin whose hook drew the Select, its","`key`, the picked option's value, instance and surface when several."],"params":[],"example":[],"returns":[]},"text":"  export type SelectTarget = {\n      plugin: string;\n      key: string;\n      /**\n       * Which option is picked, by the `value` the Select listed it under.\n       */\n      value: string;\n      /**\n       * Which instance holds it, when the plugin drew the key in several.\n       */\n      requestId?: string;\n      /**\n       * Which surface's drawing, when the key is drawn on more than one; the\n       * pick carries the surface of the drawing it lands in either way.\n       */\n      surface?: RenderSurface;\n  };"},{"name":"test","kind":"const","line":17408,"doc":{"desc":["One test: it passes when its body returns or resolves, and fails when it","throws, rejects or outlasts its time (5000 ms, or `timeoutMs`).","","The body gets the engine's `$` and an `on` whose hooks sit beneath every","plugin; `plugins` load inline plugins beside the one under test. A failure","carries what the engine reported meanwhile: each hook it skipped, and why."],"params":[["name","the test's name, led in its title by the describes around it"],["rest","the body, `($, on) => ...`, or the options then the body"]],"example":[],"returns":[]},"text":"  export const test: (name: string, ...rest: TestRest) => void;"},{"name":"TestBody","kind":"type","line":17418,"doc":{"desc":["A test: the engine's `$`, and `on`, a plugin's registrar, whose hooks sit","beneath every plugin; beneath them the bottom hook throws, naming its event.","","A test registers its hooks before its first call on `$`, which loads the","plugins. Beneath `$.state`, a render's `$.ui.invalidate` and `session.append`","the kit answers. A check that fails in a hook, or a refused answer, fails it."],"params":[],"example":[],"returns":[]},"text":"  export type TestBody = ($: Engine, on: On) => unknown;"},{"name":"TestOptions","kind":"type","line":17426,"doc":{"desc":["What `test` takes beside its name: the inline plugins it loads beside the","one under test, and how long it may run (5000 ms when not given).","","Also the plugin under test's `userConfig` values."],"params":[],"example":[],"returns":[]},"text":"  export type TestOptions = {\n      plugins?: readonly Plugin[];\n      timeoutMs?: number;\n      /**\n       * The plugin under test's `userConfig` values, standing as the ones\n       * stored in settings.\n       *\n       * `register(on, options)` receives them as a load does: unlisted values\n       * unset, defaults filled in, then validated, a bad required field failing\n       * the load. Left out: the manifest's defaults. Inline plugins get none.\n       *\n       * @example\n       * test('greets', { options: { greeting: 'yo' } }, body)\n       */\n      options?: PluginOptions;\n  };"},{"name":"TestRest","kind":"type","line":17446,"doc":{"desc":["What follows a test's name: its body, or its options then its body."],"params":[],"example":[],"returns":[]},"text":"  export type TestRest = readonly [body: TestBody] | readonly [options: TestOptions, body: TestBody];"},{"name":"ThrowExpectation","kind":"type","line":17452,"doc":{"desc":["What `toThrow` compares the thrown error with: a substring or pattern of","its message, its class, a value carrying the whole message, or nothing."],"params":[],"example":[],"returns":[]},"text":"  export type ThrowExpectation = string | RegExp | Constructor | WithMessage;"},{"name":"tier","kind":"const","line":17460,"doc":{"desc":["Says which tier the plugin under test loads in, once, at the top of the","file: `prepend`, `user` (when unsaid), `append` or `builtin`."],"params":[["tier","the tier"]],"example":[],"returns":[]},"text":"  export const tier: (tier: PluginTier) => void;"},{"name":"WithMessage","kind":"type","line":17465,"doc":{"desc":["An error-like value `toThrow` compares by its whole message."],"params":[],"example":[],"returns":[]},"text":"  export type WithMessage = {\n      message: string;\n  };"}],"symbols_url":"https://changelogs.core-directive.com/reference/mods/api/symbols.json"}