Turn and Prompt Types
These are the types behind $.turn, $.prompt, and their events.
They describe prompts, attachments, system prompt sections, and the prompt box.
Pages
| Page | What is in it |
|---|---|
| Prompt Attachment, Autocomplete, and Context Types | Attribution to Prompt: attribution, attachments, plan mode details, autocomplete, the prompt box, change, compose, and context. |
| Prompt Edit, Fill, Media, and Submit Types | Prompt to Prompt: edit, fill, paint, media, mention, origin, section, and submit types. |
| Prompt Suggest, Skill, and Turn Types | Prompt to Undeclared: suggest, skill, and turn types, including the model step chunks. |
Example
The first line reads the prompt box. The second submits text as if the user typed it. The third logs server tool uses of a model step.
const { text, cursor } = await $.prompt.read();
await $.prompt.submit({ text: "what the person typed", asUser: true });
for (const use of response.serverToolUses ?? []) $.ui.log(use.name);
Shared Sections Skip
prompt.sectionA prompt.section hook does not fire once per named section. From 2.1.302 to 2.1.307, the engine builds shared sections such as lean_body without a prompt.section call, so a hook does not see them.
A prompt.compose hook does see them. See System Prompt.
Types without Fields
These types are aliases, unions, or plain shapes. Each row gives its use and its shape.
| Type | Status | What it is for | Shape and limits |
|---|---|---|---|
Attribution | Documented: An official docs page names this item. | Which git text attribution. carries: the commit trailer, the PR footer, or the sentence that names the exemption (from the mandate or from the commit gate). | Alias of 'commit' | 'pr' | 'exemption' | 'remedy'. |
Prompt | Documented: An official docs page names this item. | What a plugin passes $.: the facts that it wants composed for. The engine reads each one that it leaves out off the session (its model, its tools). | Alias of Partial<Prompt. Used by $.. |
Prompt | Documented: An official docs page names this item. | Which side of the boundary of the prompt cache a section of the system prompt sits on: shared before it, session after it. | Alias of 'shared' | 'session'. shared text is the same for everyone on this build and model, so the API may cache it. session text varies. |
Prompt | Documented: An official docs page names this item. | One branch that the own composition of the system prompt by the engine takes on the request or the session before it computes any section. It is a closed set. | Alias of 'bare' | 'lean' | 'sdk-. Each trait tells a hook how the engine composes the prompt. bare is the one-line prompt of --. |
Prompt | Documented: An official docs page names this item. | Where a prompt. puts its text: over the whole draft, after it, or into it at the cursor. | Alias of 'replace' | 'append' | 'insert'. replace empties the box first. append adds after the draft. insert splices the text in at the cursor. |
Prompt | Documented: An official docs page names this item. | How the engine attached a mentioned file, in the names that prompt. gives its type. | Alias of 'file' | 'already_. already_ means the model holds it unchanged. pdf_ is a PDF too long to inline. |
Prompt | Documented: An official docs page names this item. | The input of prompt. as the $. of a plugin takes it. The engine sets origin (the name of the calling plugin). | Alias of Omit<Prompt. Used by $.. |
Skill | Documented: An official docs page names this item. | A YAML sequence in the frontmatter of a skill, as JSON holds it. | Interface. |
Skill | Documented: An official docs page names this item. | One value in the frontmatter of a skill: what JSON holds, and assignable to and from Json. | Alias of null | boolean | number | string | Skill. A date is the text that its author wrote. What JSON cannot hold (NaN, an infinity) is null. |
Skill | Documented: An official docs page names this item. | The input of skill. as a call takes it. frontmatter and source may be left out, as a caller written before the event carried them does. | Alias of Skill with optional frontmatter and source. If left out, they read {} and built-. Used by $.. |
Skill | Documented: An official docs page names this item. | Whose words a skill is, in the own words of the engine: the settings tier whose skills folder holds it, or what else provides it. | Alias of 'user or any string. The list is open, so a newer source is a word of its own. |
Turn | Documented: An official docs page names this item. | The input of turn.: the final message of the assistant for a turn. It is raised at the moment the turn ends (where the duration of the turn is reported). | Alias of Turn. reason says why it ended. refusal exists on a refusal alone. Used by turn., $.. |
Turn | Documented: An official docs page names this item. | 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. | Alias of 'answer' | 'aborted' | 'refusal' | 'error'. |
Turn | Documented: An official docs page names this item. | One piece of a turn. response as it streams through the chain. It is what the next(e) of a hook yields and what the hook yields up in turn. | Alias of six chunk types: text, thinking, tool start, tool input, stop, and engine. The first five are plain data that a hook reads and rewrites. A hook passes engine on unread. Used by $.. |
Turn | Documented: An official docs page names this item. | Why the model stopped, as a turn. result and its stop chunk carry it. It is one of the stop reasons of the API, or null when no response arrived. | Alias of 'end_. |
Usage | Documented: An official docs page names this item. | One unit of what $. answers, by its key there: the fill of the context window, the rate-limit windows, the cost of the session. | Alias of 'context' | 'rate. |