Skip to main content
Generated from packages/sdk/src by scripts/generate-sdk-reference.mjs. Do not edit this page by hand — change the source or the generator. For the narrative version, start with Reference.

Types and interfaces

AccountInfo

AccountUsage

AdeChatClient

RULE FOR ANYTHING ADDED TO THIS SURFACE — destructive while streaming. An SDK caller has no ambient signal that a turn is live. send() resolves as soon as the turn is dispatched, not when it completes, so nothing in the API tells a settings handler or a render effect that a reply is mid-flight. And when a turn dies from a runtime teardown it emits neither error nor done — subscribers just stop receiving. Silent truncation is therefore the default failure mode of every destructive operation here, not an edge case. So any new operation that can end a running turn must pick one, explicitly:
  • refuse mid-turn and name the way out (setModel, which throws and points at interrupt() or { force: true }); or
  • proceed, and say plainly in its own docs that in-flight turns end without a completion event (dispose, because a shutdown that can refuse is worse than a lost reply).
What is not acceptable is the third option: destroying the turn quietly and letting the consumer discover it as a response that stopped mid-sentence.

AdeClientEvent

The client-level event names. See AdeClientEventMap.

AdeClientEventMap

Payloads of the client-level events, by name. These are about the RUNTIME, not about any one thread. A thread learns that its runtime died from the synthetic status envelope on its own status channel; a host learns it here, once.

AdeErrorCode

Every error this package throws carries a stable machine-readable code. Kept as its own union rather than derived from ADE_ERROR_CODES so each member can carry its own doc comment; a test asserts the two agree.

AdeProvider

Known provider ids for autocomplete; provider strings remain open for newer runtimes.

AdeThread

AgentChatCodexCollaborationMode

Collaboration mode accepted by the Codex app-server for an active turn/start.

AgentChatEvent

One transcript event. The type field is the discriminant; the remaining fields are provider- and type-specific and are preserved verbatim.

AgentChatEventEnvelope

AgentChatFileRef

File attachment reference accepted by send and steer. Only the path crosses the wire; bytes never do. The runtime reads the file itself, on the host machine, when the provider needs its contents. WHERE THE PATH MAY LIVE. The runtime resolves an attachment against the thread’s working directory and refuses an absolute path it cannot place, so a send whose attachment names a file outside what the runtime accepts throws rather than dropping the file quietly. Pass paths the host obtained from its own file dialog or drop handler, not strings a model produced.

AgentChatHostConfigLevel

How completely a provider honoured a host configuration request. The same three-value vocabulary the MCP report uses, for the same reason: four of the six providers cannot do the thing exactly, and a report that said only “applied” would be a lie for most embedders.
  • "applied" — the provider received the value through a first-class channel of its own.
  • "best-effort" — ADE reached the same outcome through a mechanism it already owns (a prompt prefix, a containment root), and detail names what that costs.
  • "ignored" — the provider has no switch for it and the value did not reach the model. detail says so.

AgentChatInstructions

Host instructions for one thread, in the normalized wire form.

AgentChatSessionStatus

AgentChatSessionSummary

AgentChatSettingSources

Which on-disk configuration layers a provider loads for a thread. "none" is the default for SDK threads and is what every 0.1.x thread got. The four values are sent verbatim; the engine decides what each one means per provider, and reports the answer on AgentChatSessionSummary.

ApiCredentialInfo

ApprovalDecision

What a host can say about a pending approval.

ApprovalRequest

One request a host has to answer before its turn can continue.

AttachmentRootCheck

What checkAttachmentRoot answers: the canonical root, or the refusal.

AttachmentRootFilterResult

The result of filterAttachmentRoots: the roots to send, and the ones dropped.

BundledRuntime

Resolution of a runtime shipped as an npm platform package. A downloaded runtime cannot live inside a signed and notarized application: the bundle is one signed artifact, and a Mach-O executable that appears in userData after the fact is outside it. So the runtime is also published the way esbuild and swc publish theirs — one package per target, each carrying os and cpu, listed as optionalDependencies of @ade-dev/runtime so npm installs exactly one. The embedder copies that directory into their bundle and signs it with their own identity. Layout, which this module both expects and documents: @ade-dev/runtime-<target>/ package.json { os: […], cpu: […], version: <ade release> } bin/ade[.exe] the runtime binary, mode 0755 native/ the extracted contents of <binary>.native.tar.gz node_modules/ the modules the binary dlopens vendor/crsqlite/… the cr-sqlite extension LICENSE README.md runtimeRoot is <pkg>/native, which is what ADE_RUNTIME_ROOT must point at; nodeModulesPath is <pkg>/native/node_modules, which is ADE_RUNTIME_NODE_MODULES. The two are reported separately rather than derived at the call site because an embedder is free to relocate either half inside their bundle, and createAdeChat accepts both.

CapabilitiesChangedEvent

Emitted on a thread’s status channel after setModel replaced its capability reports. A switch across providers can move a policy from "enforced" to "best-effort", and a host that read the reports once at open would keep showing the old guarantee. Synthesized by the SDK, never by the runtime.

CreateAdeChatOptions

DefaultModelOptions

Options for pickDefaultModel and client.models.defaultModel.

DoctorReport

DownloadRequest

DownloadResult

EditLastOptions

Options for editLast.

HistoryPageOptions

Options for historyPage.

HostConfigCapability

What the provider did with a host-configuration request. Null means one of two things, exactly as mcpCapability does: this thread asked for nothing, or it asked and an older runtime reported nothing. The SDK does not invent a level for the second case — an unverified guarantee is reported as unverified.

InstructionsCapability

JsonSchema

KnownAgentChatEvent

The narrowed members most consumers actually branch on.

McpCapabilityReport

What the provider could actually do with a caller’s MCP request. Mirrors AgentChatMcpCapability in chat.ts. Only ADE’s Claude adapter can enforce strict mode outright; the rest are best-effort with a named residual, and Pi has no MCP surface at all (a thread that asks for mcpServers on Pi is refused by the runtime rather than silently opened without them). Read strictRequested FIRST, then level. level and residual describe strict mode, so they only make a claim when strict mode was requested; on a delivery-only thread (loadUserMcpServers: true) the user’s own config loads by design and no level value means “only my tools are loaded”. Given strictRequested, level is the field to branch on, and "enforced" is the ONLY value that means “nothing but the servers I supplied”. Treating "best-effort" as a synonym is the mistake this type exists to prevent — four of the six providers report it, so an embedder that branches on truthiness rather than on the level will overpromise for most of its users. Surface residual when it is non-null: “your servers are loaded, and so is X” is a materially different guarantee from “only yours”. The residual text comes from the provider adapter and names the specific leak, so it is safe to show verbatim.

McpHeadersResolver

Supplies MCP header values for one server of one thread. Called at every create, resume and restart that needs them, and before each turn of a thread with remote servers; the result is sent to the runtime and never persisted by the SDK. May return a Promise, so a host can refresh an OAuth token first. Return undefined for a server that needs no headers.

McpServerConfig

Per-thread MCP server definition. Mirrors AgentChatMcpServerConfig on the engine side (unit 1). Passing these sets mcpServers on the create call; loadUserMcpServers: false additionally sets strictMcpConfig: true.

McpToolFilter

Which of one MCP server’s tools reach the model. Bare tool names, as the server lists them ("search", not "mcp__docs__search"). Names are not secrets: the thread store keeps them. Not every provider can enforce both, and a filter a provider cannot enforce is refused (invalid_option) at open, updateMcpServers and setModel — never dropped: Needs a runtime advertising capabilities.personalChats.mcpToolFilters; an older one would drop the fields, so the SDK refuses to send them there.

ModelCatalogEntry

Flattened, SDK-facing model row.

PackagedRuntime

Spread straight into createAdeChat: createAdeChat({ …resolvePackagedRuntime(process.resourcesPath), home, allowDownload: false }) The field names ARE the createAdeChat option names, which is the point: no host-side mapping to get wrong. source: "packaged" makes doctor().runtime.source report "packaged".

PendingInputKind

PendingInputOption

PendingInputQuestion

PendingInputRequest

One unresolved request the provider is blocked on. Mirrors PendingInputRequest in chat.ts. Returned by the pendingInputs action and mapped to the SDK’s ApprovalRequest shape before it reaches a caller.

PendingInputSource

Who raised a pending input. The ACP harnesses (Qwen, Kimi, Grok, Copilot, Devin, Antigravity) all report "acp", not their own name.

PermissionCapability

What the provider could actually enforce of a permission policy. "enforced" means the provider itself gates every tool call against the policy. "best-effort" means ADE approximated it with the containment and approval knobs the provider does expose, and residual names what the policy therefore does not cover. "unsupported" means the provider has no gate at all and only the coarse preset applies.

PermissionPreset

ProbeRuntimeSignatureOptions

ProviderCapabilities

Runtime-derived controls available for a provider.

ProviderStatus

Per-provider installation, authentication and availability roll-up. READ source FIRST. It is the field that says how much the rest of the record is worth:
  • "probed" — the runtime resolved the binary the provider would actually spawn, ran --version, and looked at the credential files the CLI itself uses. installed, binaryPath, version and authenticated are real measurements.
  • "derived" — the runtime is older than the providers.status RPC, so everything here comes from the model catalog. installed is modelCount > 0, the three probe fields are null, and a UI should say “not detected” rather than “not installed”.

ProviderStatusProbeRecord

One provider record as the providers.status RPC sends it. NOT a Partial<ProviderStatus>. ProviderStatus is this SDK’s OUTPUT type and carries four fields only the model catalog can answer — available, requiresConfiguration, modelCount and the "derived" half of source — which the probe never sends and mergeProviderStatus deliberately takes from the catalog instead. Declaring them here would admit members that never occur. Every field is optional and widely typed on purpose: this is untrusted wire data, and mergeProviderStatus re-reads each one through its own guard. The shape is the one documented in docs/features/sdk/README.md.

ProviderStatusRpcResult

Result of the providers.status machine RPC.

ResolveBundledRuntimeOptions

ResolvedBinarySource

Which of the five resolution steps produced the binary. Reported verbatim on doctor().runtime.source, where it is the difference between a five-minute diagnosis of a packaging mistake and a day of one. "packaged" is an explicit binary whose options came from resolvePackagedRuntime() (SDK >= 0.4 lists it here; before, only DoctorReport["runtime"]["source"] had it).

ResolvePackagedRuntimeOptions

Options for resolvePackagedRuntime.

RunOptions

RuntimeCompatibility

The result of comparing a runtime’s version with SUPPORTED_RUNTIME_RANGE.

RuntimeDownloader

Injectable so tests never touch the network. createAdeChat accepts one via the internal options bag; the default is downloadRuntime.

RuntimeSignature

Code-signing state of the runtime binary, for a support bundle. An embedder who signs their app but forgets the nested runtime does not get a clean error — the process dies on launch under the hardened runtime, on a user’s machine, never on the developer’s. doctor().runtime.signature is the cheapest way to see that before a release goes out, so this probe never throws and never blocks: a failure to read the state is reported as “not known” (null), which is honest, rather than as “not signed”, which is not.

RuntimeTarget

Asset naming and URL scheme, mirrored from apps/ade-cli/scripts/install-runtime.sh and apps/web/api/install.ts: https://github.com/&lt;repo&gt;/releases/latest/download/&lt;asset> https://github.com/&lt;repo&gt;/releases/download/&lt;tag&gt;/&lt;asset> with <asset> one of ade-<platform>-<arch>[.exe], the matching <binary>.native.tar.gz, and SHA256SUMS. The runtime binary alone is NOT runnable: it dlopens native modules out of the archive’s node_modules, which is why both assets are fetched and why spawnEnv below exists.

SendOptions

SetModelOptions

SetModelResult

What setModel returns: the resolved model, plus the four capability reports as they stand on the new provider. A switch across providers can quietly lower a guarantee — a policy Claude enforced is best-effort on Codex — so the reports come back with the answer rather than leaving the caller to re-read four fields and notice. The same object is emitted as capabilities_changed on the thread’s status channel, for subscribers that did not make the call.

SettingSourcesCapability

SignInHandle

SignInStatus

SteerOptions

Options for steer.

SyntheticRuntimeLostStatusEvent

The status envelope the SDK synthesizes when the runtime goes away. A runtime that exits mid-turn emits nothing — the process that would have sent done or error is gone — so without this every subscriber stayed “running” forever. Every live thread receives one of these, on the status and event channels, when the client sees the runtime exit or its socket drop. synthetic: true marks it as the SDK’s own; the runtime never sends that key. It is not in the durable transcript, so history() never returns it.

ThreadBudget

A host-side limit for the usage observed on one thread.

ThreadCapabilities

The four capability reports a thread carries, as one object. Returned by setModel and carried by capabilities_changed. Each report keeps its own null rule — see the matching field on AdeThread.

ThreadEventChannel

ThreadHistoryPage

One page of a thread’s durable transcript, newest page first. Returned by AdeThread.historyPage. events are in transcript order (oldest first) within the page.

ThreadInstructions

Host instructions for a thread. A bare string means { mode: "append" }.

ThreadInterruptOptions

ThreadModelSelection

What a thread’s model resolved to, as the runtime reports it. The runtime resolves aliases, CLI-wrapped ids, and ids a CLI update retired, so this can differ from the id the host passed. Render displayName rather than the raw id whenever it is non-null.

ThreadOpenOptions

ThreadPermissionPolicy

A per-tool permission policy: the third form of permissions, alongside the two presets. Tool names are provider-neutral. mcp:<server>:<tool> and mcp:<server>:* name an MCP tool and the engine translates them to each provider’s own spelling (Claude writes mcp__server__tool). Any other string is matched against the provider’s own tool name, case-insensitively, with an optional trailing * for a prefix match — and built-in tool names ARE provider-specific, so Bash means something on Claude and nothing on Pi. Precedence on Claude, highest first:
  1. deniedTools
  2. allowedTools and autoApproveMcpServers
  3. sandboxRoot containment, for commands and file writes only
  4. fallback
On Codex the three tool fields apply to MCP tool calls only: a call Codex raises as an elicitation is judged by deniedTools, then allowedTools / autoApproveMcpServers on mcp:<server>:<tool>, then fallback. Commands and file writes reach only rungs 3 and 4 — sandboxRoot containment then fallback — and the command text is never consulted. Read thread.permissionCapability.residual rather than assuming a rung. fallback is required. A policy with no fallback has no obvious default, and guessing “ask” would silently park the turn for a host that built no approval UI — which is the failure this type exists to remove.

ThreadQueueItem

One message waiting in a thread’s queue.

ThreadRefreshOptions

Credentials and endpoints to push onto a thread as it is opened. The one exception to “a resume re-applies the stored values”: MCP servers carry secrets that rotate (a bearer token after sign-out or an account switch) and endpoints that move (a port that was busy), and a thread pinned to the old ones fails MCP auth for good.

ThreadRerunResult

What retry and editLast return, once the runtime has cut the old turn out and dispatched the new one. The new turn’s events follow on the stream. The rollback is the CONVERSATION only. Files the old turn wrote stay on disk, and this result does not report them (see retry).

ThreadRespondOptions

The response fields accepted by the runtime’s respondToInput action.

ThreadResumeOptions

Options for reopening a key this home already knows. provider and model become optional because a durable thread already recorded them — but they are still used if the runtime lost the session and the thread has to be recreated, so a caller that has them should pass them. A RESUME RE-APPLIES THE STORED VALUES. cwd, instructions, settingSources, permissions, mcpServers and loadUserMcpServers are read off the durable record, not off this object: one key is one conversation, and moving a live agent to a new directory, a new policy or a new tool surface on reopen is not what “reopen” means. Passing a value that differs from the stored one is not an error and does not change the thread; the SDK logs one line naming the option it ignored. To run under different host configuration, open a different key. THE STORED RECORD ALSO WINS ON A RECREATE. When the runtime has lost the session entirely (a wiped or migrated home, a corrupt state root), the key is created afresh from the record: provider, model, cwd, instructions, settingSources, permissions, mcpServers and loadUserMcpServers come off the record, and a value passed here only fills a field the record lacks. permissions means the stored policy or, for a key created on 0.3 or later with a preset, the stored preset; a key written before 0.3 with a preset has none on record, so the value passed here (or "default") is used. Before 0.3 the call’s options won instead, which let any caller that could name a key — a renderer, over the Electron bridge — rebuild a lost thread with a looser policy, another provider, or no MCP servers at all. refresh.mcpServers is the one field that does replace the stored value, on a resume and on a recreate alike — see ThreadRefreshOptions.

ThreadSummary

ThreadUpdate

What update may change on a live thread. title is a rename and is safe at any time. reasoningEffort and fastMode reconfigure the provider, which on some providers restarts it — so they follow the same mid-turn rule setModel does.

ThreadUpdateOptions

Options for update.

ThreadUpdateResult

What update returns: the thread’s title and model after the change.

ThreadUsage

Usage totals observed or recovered from a thread’s durable transcript.

ToolIdentity

A tool name split into the server that owns it and the tool itself.

Unsubscribe

UsageLimitEvent

The client usageLimit event: one thread’s limit state changed.

UsageLimitResume

A thread’s usage-limit state, as the runtime publishes it on session_meta_updated.usageLimitResume (a copy of AgentChatUsageLimitResume). The runtime republishes the whole value on every transition and sends null when the limit clears.