Skip to main content
Published packages: @ade-dev/sdk, @ade-dev/chat-ui. Full narrative docs start at ADE SDK.

createAdeChat(options)

resolvePackagedRuntime(resourcesPath, { dir?, platform?, arch? }) returns { binaryPath, runtimeRoot, runtimeNodeModules, source: "packaged" } or null. Spread it into the options. See Bundling. SUPPORTED_RUNTIME_RANGE is the runtime range this SDK build supports. See Version compatibility for each SDK version’s range. Runtime resolution runs in five steps: binaryPath, then an installed @ade-dev/runtime-<target> package, then the home cache, then ade on PATH, then a download. See Bundling.

AdeChatClient

threads.open options

All four host-configuration options persist on the thread record, so a resume that has to recreate a lost session rebuilds the same thread. They apply on create only, with one exception: refresh. A resume reads cwd, attachmentRoots, instructions, settingSources, permissions, mcpServers and loadUserMcpServers off the stored record and ignores what this call passed, logging one line per differing option. Open a different key to run under different configuration. A recreate (the key is stored, but the runtime lost its session) uses the stored record first. This call’s options fill only fields the record does not have. The SDK logs one line for each stored value it used.
What a policy is worth depends on the provider and, on Claude, on fallback. A deny fallback removes the unnamed mutating built-ins and scopes MCP to the servers the policy names. An ask fallback relies on the Agent SDK’s permission prompt. Read thread.permissionCapability and see Permissions.

AdeThread

The three capability fields are null when the thread requested nothing, and when an older runtime reported nothing. level is "applied" | "best-effort" | "ignored" for the two host-config reports, and "enforced" | "best-effort" | "unsupported" for the permission one.

Client events

pickDefaultModel

available (default true) keeps only models with isAvailable and connected. providers keeps only those providers and tries them in order. Within a provider, or within all of them when providers is absent, the catalog’s isDefault model wins, then the first model the catalog lists. client.models.defaultModel(opts) is the same rule on a fresh catalog. prefer (SDK 0.5) is your own ordering inside one provider’s qualifying models. Return a number greater than zero to prefer a model: the highest score wins. Return 0 or less for “no opinion”, and that model is ranked the usual way. A model nobody scores falls back to isDefault, then to catalog order, so prefer never removes a model from the pool. Use it to state a cost or family preference instead of keeping your own copy of the rule:
isSupportedProvider(value) narrows a string such as ModelCatalogEntry.provider to AdeProvider without a cast. ModelCatalogEntry.provider is deliberately typed open, because a downloaded catalog can name a provider newer than this SDK.

checkAttachmentRoot and filterAttachmentRoots

Both are SDK 0.5. They answer the question “will the runtime accept this root?” before you send it, because one refused entry fails the whole threads.open.
checkAttachmentRoot never throws. ok: true carries the canonical spelling the runtime will accept — the same one threads.open stores — so pass that, not your original string. sdkHome is the same home you give createAdeChat. filterAttachmentRoots keeps every valid entry in list order, canonicalized and de-duplicated, capped at 32, and reports each refused or over-the-limit entry with its reason. Its roots is safe to pass straight to threads.open, so one bad entry no longer locks every chat:
A non-array argument still throws invalid_option: that is a programming error, not a root you meant to filter.

ThreadSummary

Session summary

AgentChatSessionSummary is the runtime’s record of a tracked session. Two fields report the Codex app-server collaboration mode when a live runtime has one: AgentChatCodexCollaborationMode is that "default" | "plan" union.

ProviderStatus

source is the field to read first. On a "derived" record — an older runtime with no providers.status RPC — installed is modelCount > 0, and binaryPath, version and the three remediation fields are null. stale is true when either the probe or the model catalog behind the verdict was served from the cache rather than produced by this call. It is not a claim that the record is past the runtime’s TTL: a record served from inside the TTL is stale by this definition too.

doctor()

sdkVersion is injected at package build time from package.json. Compare it to socket.runtimeVersion when versions disagree. binary is the 0.1.x view and keeps its four source values. A packaged or attached runtime reports binary.source: "option". runtime is the 0.2 view: which of the five resolution steps produced the binary, and what the OS thinks of its signature. runtime.signature is null for “not known”, never for “not signed” — see Runtime. accepted is Gatekeeper’s verdict on the outermost .app that contains the runtime, and null when it could not be judged. runtime.compatibility compares the runtime version with SUPPORTED_RUNTIME_RANGE; see Runtime.

Errors

AdeError with code: runtime_incompatible · binary_not_found · download_failed · checksum_mismatch · spawn_failed · connect_failed · handshake_failed · rpc_error · rpc_timeout · transport_closed · protocol_error · thread_not_found · invalid_option · runtime_unavailable · approval_not_found · unauthorized · disposed · turn_in_flight · unsupported turn_in_flight (SDK 0.4) is every refusal that exists only because a turn is running: setModel or a reasoning update without { force: true }, and a runtime action that must wait for the turn to end. Nothing changed; wait for the turn to finish, or call interrupt(), then call again. Before 0.4 these used invalid_option. unsupported (SDK 0.4): the provider or the runtime cannot do what you asked. retry() and editLast() throw it for a provider other than Claude or Codex, and on a runtime without the rerunLastTurn action. A relative or refused cwd throws invalid_option. So does a bad attachmentRoots entry, a policy with no fallback, a sandboxRoot that is not absolute, and an approve() naming a question-shaped request — the SDK checks those before any RPC, and the engine’s own invalid_argument: refusals are mapped onto the same code. Prepare an attachmentRoots list with filterAttachmentRoots to keep one bad entry from failing the open. runtime_incompatible comes from createAdeChat({ requireCompatibleRuntime: true }) when the runtime version is outside SUPPORTED_RUNTIME_RANGE. approve() throws approval_not_found when the item is already settled. unauthorized comes from an Electron bridge whose authorize hook refused the call.

MCP capability

See MCP servers. Shape: