# zidane/acp

> An Agent Client Protocol server that lets editors such as Zed drive a zidane agent.

Import: `import { … } from 'zidane/acp'`. Source: [src/acp/index.ts](https://github.com/Tahul/zidane/blob/main/src/acp/index.ts).

Use this entry point to embed zidane as an ACP (Agent Client Protocol) agent in your own process. `runAcpStdioServer` serves the protocol over stdio, `createAcpServer` returns a handler for a custom transport, and the JSON-RPC and content-mapping helpers support custom clients. Sessions use a 1-hour prompt cache (`behavior.cacheTtl: '1h'`), and each session's system prompt is frozen on its first prompt. Set `freezeSystemPrompt: false` to send the fresh prompt every time. Editors normally run the `zidane-acp` command instead, described in [ACP](https://zidane.si/docs/acp.md).

```ts
import { runAcpStdioServer } from 'zidane/acp'
import { anthropic } from 'zidane/providers/anthropic'

const handle = runAcpStdioServer({
  provider: anthropic(),
  permission: { enabled: true },
})

process.once('SIGTERM', () => {
  void handle.close().finally(() => process.exit(143))
})
```

## Functions

### `acpMcpServersToZidane`

Function.

Converts MCP server entries from an ACP session request to Zidane `McpServerConfig` values.
`http` becomes `streamable-http`, `sse` stays `sse`, and anything else is treated as a `stdio` command.

```ts
function acpMcpServersToZidane(
  servers: readonly AcpMcpServer[] | undefined,
): McpServerConfig[]
```

**Parameters**

- `servers` (`readonly AcpMcpServer[] | undefined`): MCP servers sent by the ACP client. May be undefined.

**Returns** `McpServerConfig[]`: One config per server, or an empty array when `servers` is undefined.

Source: [src/acp/mapping.ts:27](https://github.com/Tahul/zidane/blob/main/src/acp/mapping.ts#L27)

### `acpPromptToPromptParts`

Function.

Converts the ACP prompt content blocks of a `session/prompt` request to Zidane prompt parts.
Images and audio without embedded data, and unknown block types, become text parts and add a warning.

```ts
function acpPromptToPromptParts(prompt: readonly ContentBlock[]): AcpPromptMapping
```

**Parameters**

- `prompt` (`readonly ContentBlock[]`): Content blocks from the client.

**Returns** `AcpPromptMapping`: The prompt parts and the warnings raised while converting.

Source: [src/acp/mapping.ts:102](https://github.com/Tahul/zidane/blob/main/src/acp/mapping.ts#L102)

### `createAcpServer`

Function.

Creates an ACP agent server.
The server speaks ACP v1: `initialize`, `authenticate`, `logout`, `session/new`, `session/load`, `session/resume`, `session/list`, `session/delete`, `session/close`, `session/prompt`, `session/set_mode`, `session/set_config_option`, and the `session/cancel` notification. It does no I/O itself, so connect it to a transport with [`createJsonRpcConnection`](https://zidane.si/docs/reference/acp.md#createJsonRpcConnection) or use [`runAcpStdioServer`](https://zidane.si/docs/reference/acp.md#runAcpStdioServer).
Throws when neither `provider` nor `models` is set, or when `defaultModelId` is not in `models`.

```ts
function createAcpServer(options: AcpServerOptions): AcpServer
```

**Parameters**

- `options` (`AcpServerOptions`): Provider or model registry, tools, session store and ACP behavior.

**Returns** `AcpServer`: The server.

**Example**

```ts
import { createAcpServer } from 'zidane/acp'
import { anthropic } from 'zidane/providers'

const server = createAcpServer({ provider: anthropic() })
const response = await server.handleMessage({
  jsonrpc: '2.0',
  id: 1,
  method: 'initialize',
  params: { protocolVersion: 1 },
})
```

Source: [src/acp/server.ts:143](https://github.com/Tahul/zidane/blob/main/src/acp/server.ts#L143)

### `createClientDeclaredTools`

Function.

Builds agent tools for client-declared specs.
Each tool sends a [`CLIENT_TOOL_CALL_METHOD`](https://zidane.si/docs/reference/acp.md#CLIENT_TOOL_CALL_METHOD) request to the client and returns the reply text. If the call is aborted, it sends [`CLIENT_TOOL_CANCEL_METHOD`](https://zidane.si/docs/reference/acp.md#CLIENT_TOOL_CANCEL_METHOD) and rejects. A reply with `isError: true` throws.

```ts
function createClientDeclaredTools(
  specs: readonly AcpClientToolSpec[],
  options: { client: AcpPeer; sessionId: string },
): Record<string, ToolDef>
```

**Parameters**

- `specs` (`readonly AcpClientToolSpec[]`): Validated specs, usually from [`parseClientToolSpecs`](https://zidane.si/docs/reference/acp.md#parseClientToolSpecs).
- `options` (`{ client: AcpPeer; sessionId: string }`): The peer to send requests to and the ACP session id to tag them with.

**Returns** `Record<string, ToolDef>`: Tools keyed by spec name.

Source: [src/acp/client-declared-tools.ts:104](https://github.com/Tahul/zidane/blob/main/src/acp/client-declared-tools.ts#L104)

### `createJsonRpcConnection`

Function.

Creates a JSON-RPC 2.0 connection over a pair of byte streams.
Frames are newline-delimited JSON by default. Replies to incoming requests come from `onRequest`; the returned peer sends requests and notifications. Reading starts when `start` is called.

```ts
function createJsonRpcConnection(options: JsonRpcConnectionOptions): JsonRpcConnection
```

**Parameters**

- `options` (`JsonRpcConnectionOptions`): Streams, framing and handlers for the connection.

**Returns** `JsonRpcConnection`: The connection, which is also an `AcpPeer`.

Source: [src/acp/json-rpc.ts:95](https://github.com/Tahul/zidane/blob/main/src/acp/json-rpc.ts#L95)

### `parseClientToolSpecs`

Function.

Validate `_meta.zidane.clientTools`. Returns `undefined` when the key is
absent (so resume can keep the existing set) and throws on malformed specs.

```ts
function parseClientToolSpecs(
  meta: Record<string, unknown> | null | undefined,
): AcpClientToolSpec[] | undefined
```

**Parameters**

- `meta` (`Record<string, unknown> | null | undefined`): The `_meta` object of the `session/new`, `session/load` or `session/resume` request.

**Returns** `AcpClientToolSpec[] | undefined`

Source: [src/acp/client-declared-tools.ts:48](https://github.com/Tahul/zidane/blob/main/src/acp/client-declared-tools.ts#L48)

### `runAcpStdioServer`

Function.

Runs an ACP agent over stdio, usually as the entry point of an editor-facing agent process.
Creates the server with [`createAcpServer`](https://zidane.si/docs/reference/acp.md#createAcpServer), connects it to a JSON-RPC connection on `input` and `output`, and starts reading. Throws if neither `provider` nor `models` is set.

```ts
function runAcpStdioServer(
  options: RunAcpStdioServerOptions,
): { connection: JsonRpcConnection; server: AcpServer; close(): Promise<void> }
```

**Parameters**

- `options` (`RunAcpStdioServerOptions`): Server options plus the stdio streams and framing.

**Returns** `{ connection: JsonRpcConnection; server: AcpServer; close(): Promise<void> }`: The server, the connection, and a `close` function that closes the connection and destroys every open session.

**Example**

```ts
import { runAcpStdioServer } from 'zidane/acp'
import { anthropic } from 'zidane/providers'

const { close } = runAcpStdioServer({
  provider: anthropic(),
  model: 'claude-sonnet-4-5',
})

process.on('SIGINT', () => {
  void close().then(() => process.exit(0))
})
```

Source: [src/acp/index.ts:58](https://github.com/Tahul/zidane/blob/main/src/acp/index.ts#L58)

### `sessionBlocksToAcp`

Function.

Converts stored session content blocks to ACP content blocks, for replaying history.
Thinking blocks become text. Images and documents without data become `resource_link` blocks. Audio without data and system notes are dropped.

```ts
function sessionBlocksToAcp(blocks: readonly SessionContentBlock[]): ContentBlock[]
```

**Parameters**

- `blocks` (`readonly SessionContentBlock[]`): Session content blocks.

**Returns** `ContentBlock[]`: The matching ACP content blocks.

Source: [src/acp/mapping.ts:153](https://github.com/Tahul/zidane/blob/main/src/acp/mapping.ts#L153)

### `stopReasonFromRun`

Function.

Maps the outcome of an agent run to an ACP stop reason.
An abort gives `cancelled`, reaching the turn limit gives `max_turn_requests`. Otherwise the last turn finish reason decides: `length` gives `max_tokens`, `content-filter` and `error` give `refusal`, and anything else gives `end_turn`.

```ts
function stopReasonFromRun(
  input: { aborted: boolean; maxTurnsReached?: boolean; turnUsage?: TurnUsage[] },
): StopReason
```

**Parameters**

- `input` (`{ aborted: boolean; maxTurnsReached?: boolean; turnUsage?: TurnUsage[] }`): Run outcome.

**Returns** `StopReason`: The stop reason to send in the prompt response.

Source: [src/acp/mapping.ts:267](https://github.com/Tahul/zidane/blob/main/src/acp/mapping.ts#L267)

### `toolResultToAcpContent`

Function.

Converts a tool result to ACP tool call content.
A string becomes one text content item. Block arrays map block by block, and unsupported blocks fall back to their text form.

```ts
function toolResultToAcpContent(
  content: string | ToolResultContent[],
): ToolCallContent[]
```

**Parameters**

- `content` (`string | ToolResultContent[]`): Tool result as a string or an array of result blocks.

**Returns** `ToolCallContent[]`: ACP tool call content items.

Source: [src/acp/mapping.ts:183](https://github.com/Tahul/zidane/blob/main/src/acp/mapping.ts#L183)

### `withAcpDefaultTools`

Function.

Return `preset` with the default ACP search/fetch tools filled in. The
preset's own tools win on name collision, so this only adds what's missing.
Applied to the default base and by the `zidane-acp` CLI — never to a
host-provided `AcpServerOptions.preset`, which is honored verbatim.

```ts
function withAcpDefaultTools(preset: Preset): Preset
```

**Parameters**

- `preset` (`Preset`): Base preset to extend. Not modified.

**Returns** `Preset`: A new preset with `web_search` and `fetch_url` added when absent.

Source: [src/acp/server.ts:98](https://github.com/Tahul/zidane/blob/main/src/acp/server.ts#L98)

### `wrapToolsForAcpClient`

Function.

Replaces the `read_file`, `write_file` and `shell` tools with versions that run on the ACP client.
Uses the client file system and terminal so the user sees editor state and terminal output. Tools the client cannot back, or that are missing from `tools`, are left as they are.

```ts
function wrapToolsForAcpClient(
  tools: Record<string, ToolDef> | undefined,
  options: AcpClientToolOptions,
): Record<string, ToolDef> | undefined
```

**Parameters**

- `tools` (`Record<string, ToolDef> | undefined`): Tool set to wrap. Not modified.
- `options` (`AcpClientToolOptions`): Client peer, session id and routing switches.

**Returns** `Record<string, ToolDef> | undefined`: A new tool set, or `undefined` when `tools` is undefined.

Source: [src/acp/client-tools.ts:37](https://github.com/Tahul/zidane/blob/main/src/acp/client-tools.ts#L37)

## Classes

### `AcpProtocolError`

Class.

Error with a JSON-RPC error code. Throwing it from a handler produces an error response with that code and data.

```ts
class AcpProtocolError extends Error
```

**Constructor**

```ts
new AcpProtocolError(code: number, message: string, data?: unknown)
```

**Parameters**

- `code` (`number`): JSON-RPC error code, usually an `AcpErrorCode` value.
- `message` (`string`): Human-readable error message.
- `data?` (`unknown`): Optional extra data sent in the error response.

**Returns** `AcpProtocolError`

**Properties**

- `code` (`number`, readonly): JSON-RPC error code, usually an `AcpErrorCode` value.
- `data?` (`unknown`, readonly): Optional extra data sent in the error response.

Source: [src/acp/server.ts:1034](https://github.com/Tahul/zidane/blob/main/src/acp/server.ts#L1034)

### `JsonRpcRemoteError`

Class.

Error thrown when the other side answers a request with a JSON-RPC error response.
Carries the remote `code` and `data` next to the remote message.

```ts
class JsonRpcRemoteError extends Error
```

**Constructor**

```ts
new JsonRpcRemoteError(message: string, code: number, data?: unknown)
```

**Parameters**

- `message` (`string`): Error message from the remote response.
- `code` (`number`): JSON-RPC error code from the remote response.
- `data?` (`unknown`): Optional `data` member from the remote response.

**Returns** `JsonRpcRemoteError`

**Properties**

- `code` (`number`, readonly): JSON-RPC error code from the remote response.
- `data?` (`unknown`, readonly): Optional `data` member from the remote response.

Source: [src/acp/json-rpc.ts:359](https://github.com/Tahul/zidane/blob/main/src/acp/json-rpc.ts#L359)

## Constants

### `ACP_PROTOCOL_VERSION`

Constant.

ACP major protocol version this server speaks. `initialize` answers with this value.

```ts
const ACP_PROTOCOL_VERSION = 1
```

Source: [src/acp/types.ts:10](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L10)

### `CLIENT_TOOL_CALL_METHOD`

Constant.

JSON-RPC method the agent sends to the client to run a client-declared tool.

```ts
const CLIENT_TOOL_CALL_METHOD = '_zidane/tool_call'
```

Source: [src/acp/client-declared-tools.ts:6](https://github.com/Tahul/zidane/blob/main/src/acp/client-declared-tools.ts#L6)

### `CLIENT_TOOL_CANCEL_METHOD`

Constant.

Notification the agent sends when it abandons a pending [`CLIENT_TOOL_CALL_METHOD`](https://zidane.si/docs/reference/acp.md#CLIENT_TOOL_CALL_METHOD).

```ts
const CLIENT_TOOL_CANCEL_METHOD = '_zidane/tool_call_cancel'
```

Source: [src/acp/client-declared-tools.ts:9](https://github.com/Tahul/zidane/blob/main/src/acp/client-declared-tools.ts#L9)

## Interfaces

### `AcpClientCapabilities`

Interface.

Capabilities an ACP client declares in `initialize`. They decide which requests the agent may send back.

```ts
interface AcpClientCapabilities
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `fs?` (`{ readTextFile?: boolean; writeTextFile?: boolean }`): File system methods the client implements.
- `terminal?` (`boolean`): Whether the client implements the `terminal/*` methods.

Source: [src/acp/types.ts:115](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L115)

### `AcpClientToolOptions`

Interface.

Options for [`wrapToolsForAcpClient`](https://zidane.si/docs/reference/acp.md#wrapToolsForAcpClient).

```ts
interface AcpClientToolOptions
```

**Properties**

- `capabilities` (`AcpClientCapabilities`): Capabilities the client declared at `initialize`. A tool is only routed to the client when the matching capability is present.
- `client` (`AcpPeer`): Peer used to send `fs/*` and `terminal/*` requests to the ACP client.
- `sessionId` (`string`): ACP session id attached to every request sent to the client.
- `useClientFileSystem?` (`boolean`, default `true`): Route `read_file` and `write_file` through the client when it supports `fs.readTextFile` / `fs.writeTextFile`. Set `false` to keep the local tools.
- `useClientTerminal?` (`boolean`, default `true`): Route `shell` through a client terminal when the client declares the `terminal` capability. Set `false` to keep the local tool.

Source: [src/acp/client-tools.ts:11](https://github.com/Tahul/zidane/blob/main/src/acp/client-tools.ts#L11)

### `AcpClientToolSpec`

Interface.

A tool the ACP client declares in `session/new` / `session/load` /
`session/resume` under `_meta.zidane.clientTools`. The agent sees it like
any other tool; execution round-trips to the client over
[`CLIENT_TOOL_CALL_METHOD`](https://zidane.si/docs/reference/acp.md#CLIENT_TOOL_CALL_METHOD).

```ts
interface AcpClientToolSpec
```

**Properties**

- `description` (`string`): What the tool does, shown to the model. Must be non-empty.
- `inputSchema` (`Record<string, unknown>`): JSON Schema for the tool input. The root `type` must be `"object"`. Defaults to an empty object schema when omitted.
- `mutating` (`boolean`): Mutating tools go through permission requests and are hidden in Plan mode.
- `name` (`string`): Tool name the agent exposes. Must match `/^[a-z][\w-]{0,63}$/i` and not collide with a host tool.

Source: [src/acp/client-declared-tools.ts:19](https://github.com/Tahul/zidane/blob/main/src/acp/client-declared-tools.ts#L19)

### `AcpImplementationInfo`

Interface.

ACP `Implementation` metadata. The spec requires `name` + `version`;
`title` is an optional UI label. Incoming `clientInfo` is treated loosely
(see [`InitializeRequest`](https://zidane.si/docs/reference/acp.md#InitializeRequest)) since we never reflect it back on the wire.

```ts
interface AcpImplementationInfo
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `name` (`string`): Programmatic name of the implementation.
- `title?` (`string | null`): Display name for UIs. Falls back to `name` when absent.
- `version` (`string`): Version string of the implementation.

Source: [src/acp/types.ts:103](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L103)

### `AcpModelChoice`

Interface.

A user-selectable model exposed to ACP clients as a `category: 'model'`
session config option. Each choice carries its OWN provider so switching a
model can switch provider + credentials. `provider` may be a factory so the
credentials for a model are only resolved when that model is first selected.

```ts
interface AcpModelChoice
```

**Properties**

- `id` (`string`): Stable id used as the config option value (also the dropdown key).
- `model` (`string`): Model id passed to `agent.run({ model })` for this choice.
- `name?` (`string`): Human label shown in the client dropdown. Defaults to `model`.
- `options?` (`AcpModelOption[]`): Model-specific boolean options exposed as ACP select controls.
- `provider` (`Provider | (() => Provider)`): Provider serving this model; a factory is built lazily on first use.
- `reasoning?` (`boolean`): Whether this model supports a thinking/effort selector.

Source: [src/acp/types.ts:913](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L913)

### `AcpModelOption`

Interface.

A model-specific boolean option, exposed to the client as a select control.

```ts
interface AcpModelOption
```

**Properties**

- `description?` (`string`): Explanation shown to the user.
- `id` (`string`): Identifier of the option.
- `label` (`string`): Display name.

Source: [src/acp/types.ts:929](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L929)

### `AcpPeer`

Interface.

The remote side of an ACP connection, used to send requests and notifications to it.

```ts
interface AcpPeer
```

**Properties**

- `sendNotification` (`(method: string, params?: unknown) => void | Promise<void>`): Sends a notification. No reply is expected.
- `sendRequest` (`(method: string, params?: unknown) => Promise<unknown>`): Sends a request and resolves with its `result`. Rejects when the peer answers with an error or the connection closes.

Source: [src/acp/types.ts:91](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L91)

### `AcpPermissionPolicy`

Interface.

Controls when the agent asks the client for permission before running a tool.

```ts
interface AcpPermissionPolicy
```

**Properties**

- `enabled?` (`boolean`, default `false`): Ask for permission before tool calls. When not `true`, no request is sent.
- `options?` (`PermissionOption[]`, default `allow once, always allow, reject once and always reject`): Choices offered to the user.
- `toolMatcher?` (`(toolName: string, input: Record<string, unknown>) => boolean`): Decides per call whether permission is needed. Without it, `shell`, `write_file`, `edit` and `multi_edit` need it.

Source: [src/acp/types.ts:892](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L892)

### `AcpPromptMapping`

Interface.

Result of converting an ACP prompt to Zidane prompt parts, see [`acpPromptToPromptParts`](https://zidane.si/docs/reference/acp.md#acpPromptToPromptParts).

```ts
interface AcpPromptMapping
```

**Properties**

- `prompt` (`PromptPart[]`): Converted prompt parts.
- `warnings` (`string[]`): Warnings about content that was converted lossily or dropped.

Source: [src/acp/types.ts:1031](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L1031)

### `AcpServer`

Interface.

The ACP agent side. Handles requests and notifications from an ACP client and sends updates back through a peer.

```ts
interface AcpServer
```

**Properties**

- `close` (`() => Promise<void>`): Aborts any running prompts and destroys every open session.
- `handleMessage` (`(message: JsonRpcMessage) => Promise<JsonRpcResponse | null>`): Handles one incoming JSON-RPC message. Returns the response for a request, or `null` for a notification.
- `handleRequest` (`(method: string, params?: unknown) => Promise<unknown>`): Handles one ACP request by method name and returns its result. Throws [`AcpProtocolError`](https://zidane.si/docs/reference/acp.md#AcpProtocolError) for an unknown method or invalid params.
- `notify` (`(method: string, params?: unknown) => Promise<void>`): Sends a notification to the client through the peer. Does nothing when no peer is set.
- `setPeer` (`(peer: AcpPeer) => void`): Sets the peer used to send requests and notifications to the client. Must be called before a session is created.

Source: [src/acp/server.ts:110](https://github.com/Tahul/zidane/blob/main/src/acp/server.ts#L110)

### `AcpServerOptions`

Interface.

Options for [`createAcpServer`](https://zidane.si/docs/reference/acp.md#createAcpServer). Set `provider` or `models`.

```ts
interface AcpServerOptions
```

**Properties**

- `agentInfo?` (`AcpImplementationInfo`, default `{ name: 'zidane', title: 'Zidane ACP', version: '1' }`): Name and version reported in the `initialize` response.
- `agentOptions?` (`Partial<Omit<AgentOptions, 'provider' | 'execution' | 'session'>>`): Extra options forwarded to the agent, applied over the preset. `provider`, `execution` and `session` are managed by the server.
- `authenticate?` (`(request: AuthenticateRequest) => unknown`): Handles the `authenticate` request and returns the result. Without it the request returns `{}`.
- `authMethods?` (`AuthMethod[]`, default `[]`): Authentication methods listed in the `initialize` response.
- `behavior?` (`AgentBehavior`): Agent behavior settings. They win over the preset and `agentOptions` behavior.
- `commands?` (`AvailableCommand[]`): Slash commands advertised via `available_commands_update` on session start.
- `configOptions?` (`SessionConfigOption[]`): Extra config options advertised to the client. Ids that collide with the generated `mode`, `model` or thinking options are dropped.
- `contextWindow?` (`number`): Total context-window size (tokens) reported in `usage_update.size`. ACP
  requires `size` on every usage update, so when neither this nor the
  provider's `meta.contextWindow` is known, usage updates are suppressed
  rather than sent with a fabricated window.
- `defaultModeId?` (`string`, default `the id of the first mode`): Id of the mode new sessions start in.
- `defaultModelId?` (`string`): Initially-selected `AcpModelChoice.id`. Defaults to the first entry.
- `execution?` (`ExecutionContext | ((request: NewSessionRequest | LoadSessionRequest | ResumeSessionRequest) => ExecutionContext)`, default `` a process context rooted at the request `cwd` ``): Execution context for session tools, or a function called with each `session/new`, `session/load` or `session/resume` request.
- `freezeSystemPrompt?` (`boolean`, default `true`): Freeze each session's system prompt: its first prompt records the system prompt in the session, and later prompts send the same text so the provider's prompt cache keeps hitting. Changes to the skills, searchable tools or MCP instructions sections reach the model as notes in the prompt. When the base system prompt itself changed (for example a restarted server with a new `system`), the next prompt records the new one instead. Set `false` to send the freshly built system prompt on every prompt.
- `logout?` (`() => unknown`): Handles the `logout` request. When set, the agent advertises the `logout` auth capability. Without it the request returns `{}`.
- `model?` (`string`): Model id passed to `agent.run({ model })`. With `models`, it also selects the default choice by id or model string when `defaultModelId` is absent.
- `models?` (`AcpModelChoice[]`): Selectable models advertised to the client as a `category: 'model'` config
  option. When present, the client (e.g. Zed) can switch models via
  `session/set_config_option`, and each model resolves its own provider +
  credentials. Supersedes `provider` for run routing.
- `modes?` (`SessionMode[]`, default ``a `build` mode and a `plan` mode``): Session modes offered to the client.
- `permission?` (`AcpPermissionPolicy`): Permission policy for tool calls. Permission requests are off unless `enabled` is `true`.
- `preset?` (`Preset`, default ``the `basic` preset plus `web_search` and `fetch_url`, see [`withAcpDefaultTools`](/docs/reference/acp#withAcpDefaultTools)``): Base preset for the agent: tools, MCP servers, behavior and more.
- `provider?` (`Provider | (() => Provider)`): Single provider used for every run. Required UNLESS `models` is
  supplied (the registry then owns provider resolution per selected model).
- `store?` (`SessionStore`): Session store used to persist and load sessions. Without it sessions live only in memory, and `session/list` returns the open ones.
- `system?` (`string`): System prompt passed to every run.
- `tools?` (`Record<string, ToolDef>`): Extra tools merged over the preset tools. They win on a name clash.
- `useClientFileSystem?` (`boolean`, default `true`): Route `read_file` and `write_file` through the client file system when the client supports it. Set `false` to keep the local tools.
- `useClientTerminal?` (`boolean`, default `true`): Route `shell` through a client terminal when the client supports it. Set `false` to keep the local tool.

Source: [src/acp/types.ts:939](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L939)

### `AcpSessionRuntime`

Interface.

In-memory state of one open ACP session.

```ts
interface AcpSessionRuntime
```

**Properties**

- `abortController?` (`AbortController`): Aborts the running prompt. Set only while a prompt runs.
- `additionalDirectories` (`string[]`): Extra absolute directories the session may access.
- `agent` (`Agent`): Agent that runs the prompts of this session.
- `clientTools` (`AcpClientToolSpec[]`): Tools declared by the client under `_meta.zidane.clientTools`.
- `config` (`Map<string, unknown>`): Selected value of each config option, keyed by option id.
- `configOptions` (`SessionConfigOption[]`): Config options advertised to the client, with current values.
- `cwd` (`string`): Absolute working directory of the session.
- `execution` (`ExecutionContext`): Execution context that tools run in.
- `inFlight?` (`Promise<PromptResponse>`): Promise of the prompt that is running. Set only while a prompt runs.
- `mcpServers` (`McpServerConfig[]`): MCP servers connected for this session.
- `modeId` (`string`): Id of the active mode.
- `provider` (`Provider`): Provider bound to `agent`. In model-registry mode this is a router
  whose `meta` reflects the currently selected model's underlying provider,
  so `resolveContextWindow` stays correct across `session/set_config_option`.
- `runModel?` (`string`): Model id passed to `agent.run({ model })`; the selected choice's `model`.
- `session` (`Session`): Stored session holding the conversation history.
- `sessionId` (`string`): Id of the session.
- `setProviderDelegate?` (`(provider: Provider) => void`): Swap the router's underlying provider on a model switch (registry mode).
- `tools?` (`Record<string, ToolDef>`): Tools available to the session before mode filtering.

Source: [src/acp/types.ts:850](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L850)

### `AgentAuthCapabilities`

Interface.

Authentication features the agent supports.

```ts
interface AgentAuthCapabilities
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `logout?` (`Record<string, unknown> | null`): Present when the agent implements the `logout` method.

Source: [src/acp/types.ts:180](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L180)

### `AgentCapabilities`

Interface.

Capabilities the agent advertises in the `initialize` response.

```ts
interface AgentCapabilities
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `auth?` (`AgentAuthCapabilities`): Authentication features the agent supports beyond `authenticate`.
- `loadSession?` (`boolean`): Whether the agent supports `session/load`.
- `mcpCapabilities?` (`McpCapabilities`): MCP server transports the agent can connect to.
- `promptCapabilities?` (`PromptCapabilities`): Content types the agent accepts in `session/prompt`.
- `sessionCapabilities?` (`SessionCapabilities`): Optional session methods the agent supports.

Source: [src/acp/types.ts:142](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L142)

### `AudioContent`

Interface.

An audio content block.

```ts
interface AudioContent
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `annotations?` (`ContentAnnotations | null`): Hints about how to use or show the audio.
- `data` (`string`): Base64-encoded audio bytes.
- `mimeType` (`string`): MIME type of the audio, such as `audio/mpeg`.
- `type` (`'audio'`): Discriminator. Always `"audio"`.

Source: [src/acp/types.ts:508](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L508)

### `AuthenticateRequest`

Interface.

Params of the `authenticate` request.

```ts
interface AuthenticateRequest
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `methodId` (`string`): Id of the [`AuthMethod`](https://zidane.si/docs/reference/acp.md#AuthMethod) to authenticate with.

Source: [src/acp/types.ts:230](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L230)

### `AuthMethod`

Interface.

An authentication method the agent offers.

```ts
interface AuthMethod
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `description?` (`string | null`): Longer explanation shown to the user.
- `id` (`string`): Identifier passed back as `methodId` in `authenticate`.
- `name` (`string`): Display name.

Source: [src/acp/types.ts:218](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L218)

### `AvailableCommand`

Interface.

A slash command the agent offers in a session.

```ts
interface AvailableCommand
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `description` (`string`): What the command does.
- `input?` (`AvailableCommandInput | null`): Describes the input the command accepts, when it takes any.
- `name` (`string`): Command name, without the leading slash.

Source: [src/acp/types.ts:672](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L672)

### `AvailableCommandInput`

Interface.

Input description for an [`AvailableCommand`](https://zidane.si/docs/reference/acp.md#AvailableCommand).

```ts
interface AvailableCommandInput
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `hint` (`string`): Placeholder text shown while the user types the input.

Source: [src/acp/types.ts:684](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L684)

### `BlobResourceContents`

Interface.

Embedded resource content in binary form.

```ts
interface BlobResourceContents
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `blob` (`string`): Base64-encoded bytes of the resource.
- `mimeType?` (`string | null`): MIME type of the resource.
- `uri` (`string`): URI of the resource.

Source: [src/acp/types.ts:556](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L556)

### `CancelNotification`

Interface.

Params of the `session/cancel` notification. Aborts the running prompt of a session.

```ts
interface CancelNotification
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `sessionId` (`string`): Id of the session to cancel.

Source: [src/acp/types.ts:372](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L372)

### `ClientToolCallResponse`

Interface.

Reply the client returns for a [`CLIENT_TOOL_CALL_METHOD`](https://zidane.si/docs/reference/acp.md#CLIENT_TOOL_CALL_METHOD) request.

```ts
interface ClientToolCallResponse
```

**Properties**

- `content?` (`unknown`): Text result handed to the model. Ignored unless it is a string; a missing value becomes an empty string.
- `isError?` (`unknown`): When `true`, the call fails and `content` becomes the error message.

Source: [src/acp/client-declared-tools.ts:31](https://github.com/Tahul/zidane/blob/main/src/acp/client-declared-tools.ts#L31)

### `CloseSessionRequest`

Interface.

Params of the `session/close` request.

```ts
interface CloseSessionRequest
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `sessionId` (`string`): Id of the session to close.

Source: [src/acp/types.ts:270](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L270)

### `ContentAnnotations`

Interface.

Hints about how a content block should be used or shown.

```ts
interface ContentAnnotations
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `audience?` (`Role[] | null`): Who the content is meant for.
- `lastModified?` (`string | null`): ISO 8601 timestamp of the last change to the content.
- `priority?` (`number | null`): Importance of the content, from 0 (least) to 1 (most).

Source: [src/acp/types.ts:468](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L468)

### `ContentChunk`

Interface.

A piece of streamed message content, carried by `session/update` notifications.

```ts
interface ContentChunk
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `content` (`ContentBlock`): The content of this chunk.
- `messageId?` (`string | null`): Id grouping chunks that belong to the same message.

Source: [src/acp/types.ts:583](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L583)

### `Cost`

Interface.

Monetary cost of a session so far.

```ts
interface Cost
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `amount` (`number`): Total cost as a number.
- `currency` (`string`): ISO 4217 currency code, such as `USD`.

Source: [src/acp/types.ts:745](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L745)

### `CreateTerminalRequest`

Interface.

Params of the `terminal/create` request. The agent sends it to start a command in a client terminal.

```ts
interface CreateTerminalRequest
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `args?` (`string[]`): Arguments for the command.
- `command` (`string`): Command to run.
- `cwd?` (`string | null`): Absolute working directory for the command.
- `env?` (`EnvVariable[]`): Environment variables to set for the command.
- `outputByteLimit?` (`number | null`): Maximum output bytes the client keeps. Older output is truncated past it.
- `sessionId` (`string`): Id of the session making the request.

Source: [src/acp/types.ts:810](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L810)

### `DeleteSessionRequest`

Interface.

Params of the `session/delete` request.

```ts
interface DeleteSessionRequest
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `sessionId` (`string`): Id of the session to delete.

Source: [src/acp/types.ts:278](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L278)

### `EmbeddedResource`

Interface.

A content block that carries a resource inline.

```ts
interface EmbeddedResource
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `annotations?` (`ContentAnnotations | null`): Hints about how to use or show the resource.
- `resource` (`EmbeddedResourceResource`): The embedded text or binary contents.
- `type` (`'resource'`): Discriminator. Always `"resource"`.

Source: [src/acp/types.ts:571](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L571)

### `EnvVariable`

Interface.

An environment variable passed to a stdio MCP server.

```ts
interface EnvVariable
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `name` (`string`): Variable name.
- `value` (`string`): Variable value.

Source: [src/acp/types.ts:437](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L437)

### `HttpHeader`

Interface.

An HTTP header sent to an HTTP or SSE MCP server.

```ts
interface HttpHeader
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `name` (`string`): Header name.
- `value` (`string`): Header value.

Source: [src/acp/types.ts:447](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L447)

### `ImageContent`

Interface.

An image content block.

```ts
interface ImageContent
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `annotations?` (`ContentAnnotations | null`): Hints about how to use or show the image.
- `data` (`string`): Base64-encoded image bytes.
- `mimeType` (`string`): MIME type of the image, such as `image/png`.
- `type` (`'image'`): Discriminator. Always `"image"`.
- `uri?` (`string | null`): Where the image came from, when known.

Source: [src/acp/types.ts:492](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L492)

### `InitializeRequest`

Interface.

Params of the `initialize` request, the first call of a connection.

```ts
interface InitializeRequest
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `clientCapabilities?` (`AcpClientCapabilities`): Capabilities the client supports. Treated as empty when absent.
- `clientInfo?` (`Partial<AcpImplementationInfo>`): Name and version of the client. Optional and read loosely.
- `protocolVersion` (`number`): Latest protocol version the client supports.

Source: [src/acp/types.ts:130](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L130)

### `InitializeResponse`

Interface.

Result of the `initialize` request.

```ts
interface InitializeResponse
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `agentCapabilities` (`AgentCapabilities`): Capabilities the agent supports.
- `agentInfo?` (`AcpImplementationInfo`): Name and version of the agent.
- `authMethods` (`AuthMethod[]`): Authentication methods the client can offer the user.
- `protocolVersion` (`number`): Protocol version the agent chose. The client version when supported, otherwise the latest the agent supports.

Source: [src/acp/types.ts:204](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L204)

### `JsonRpcConnection`

Interface.

A JSON-RPC peer bound to a pair of byte streams. Call `start` to begin reading.

```ts
interface JsonRpcConnection extends AcpPeer
```

**Properties**

- `close` (`() => void`): Stops reading and sending. Frames already received in full are still delivered, then pending requests reject with `JsonRpcConnectionClosedError`.
- `sendNotification` (`(method: string, params?: unknown) => void | Promise<void>`, from `AcpPeer`): Sends a notification. No reply is expected.
- `sendRequest` (`(method: string, params?: unknown) => Promise<unknown>`, from `AcpPeer`): Sends a request and resolves with its `result`. Rejects when the peer answers with an error or the connection closes.
- `sendSerialized` (`(json: string, message: JsonRpcMessage) => void`): Write a message already serialized (`json` must be the JSON of `message`), framed like any other.
- `start` (`() => void`): Starts reading frames from the input stream.

Source: [src/acp/json-rpc.ts:32](https://github.com/Tahul/zidane/blob/main/src/acp/json-rpc.ts#L32)

### `JsonRpcConnectionOptions`

Interface.

Options for [`createJsonRpcConnection`](https://zidane.si/docs/reference/acp.md#createJsonRpcConnection).

```ts
interface JsonRpcConnectionOptions
```

**Properties**

- `framing?` (`'content-length' | 'newline'`, default `'newline'`): Wire framing. `'newline'` is newline-delimited JSON, `'content-length'` is LSP-style headers.
- `input` (`Readable`): Stream the connection reads incoming frames from.
- `onError?` (`(error: Error) => void`): Called with transport read errors and failures that cannot be answered, such as a throwing notification handler.
- `onNotification?` (`(message: JsonRpcMessage & { id?: undefined; method: string }) => void | Promise<void>`): Called for each incoming notification. A throw or rejection is reported through `onError`.
- `onRequest` (`(message: JsonRpcRequest) => JsonRpcResponse | Promise<JsonRpcResponse | null | undefined> | null | undefined`): Handles an incoming request. The returned response is written back; `null` or `undefined` sends nothing. A throw is answered with an internal error response.
- `output` (`Writable`): Stream the connection writes outgoing frames to. Unused when `send` is set.
- `send?` (`(json: string, message: JsonRpcMessage) => void`): Write each serialized message yourself instead of to `output` (framing
  included): a transport that budgets replies and the rest apart
  (`src/ipc/transports/send-budget.ts`). `message` is what was serialized.

Source: [src/acp/json-rpc.ts:7](https://github.com/Tahul/zidane/blob/main/src/acp/json-rpc.ts#L7)

### `JsonRpcError`

Interface.

Error object of a [`JsonRpcFailure`](https://zidane.si/docs/reference/acp.md#JsonRpcFailure).

```ts
interface JsonRpcError
```

**Properties**

- `code` (`number`): Numeric error code. See [`AcpErrorCode`](https://zidane.si/docs/reference/acp.md#AcpErrorCode) for the codes this package uses.
- `data?` (`unknown`): Extra information about the error.
- `message` (`string`): Short human-readable description.

Source: [src/acp/types.ts:63](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L63)

### `JsonRpcFailure`

Interface.

A JSON-RPC 2.0 response to a request that failed.

```ts
interface JsonRpcFailure
```

**Properties**

- `error` (`JsonRpcError`): Description of the failure.
- `id` (`JsonRpcId`): Identifier of the request this answers, or `null` when the request id could not be read.
- `jsonrpc` (`'2.0'`): JSON-RPC version marker. Always `"2.0"`.

Source: [src/acp/types.ts:48](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L48)

### `JsonRpcNotification`

Interface.

A JSON-RPC 2.0 notification. It has no `id` and gets no response.

```ts
interface JsonRpcNotification
```

**Properties**

- `jsonrpc` (`'2.0'`): JSON-RPC version marker. Always `"2.0"`.
- `method` (`string`): Name of the notification, such as `session/update`.
- `params?` (`unknown`): Notification parameters. Their shape depends on `method`.

Source: [src/acp/types.ts:28](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L28)

### `JsonRpcRequest`

Interface.

A JSON-RPC 2.0 request. The receiver answers it with a response carrying the same `id`.

```ts
interface JsonRpcRequest
```

**Properties**

- `id` (`JsonRpcId`): Identifier the response echoes back.
- `jsonrpc` (`'2.0'`): JSON-RPC version marker. Always `"2.0"`.
- `method` (`string`): Name of the method to call, such as `session/prompt`.
- `params?` (`unknown`): Method parameters. Their shape depends on `method`.

Source: [src/acp/types.ts:16](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L16)

### `JsonRpcSuccess`

Interface.

A JSON-RPC 2.0 response to a request that succeeded.

```ts
interface JsonRpcSuccess
```

**Properties**

- `id` (`JsonRpcId`): Identifier of the request this answers.
- `jsonrpc` (`'2.0'`): JSON-RPC version marker. Always `"2.0"`.
- `result` (`unknown`): Value returned by the method.

Source: [src/acp/types.ts:38](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L38)

### `ListSessionsRequest`

Interface.

Params of the `session/list` request.

```ts
interface ListSessionsRequest
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `cursor?` (`string | null`): Cursor from a previous [`ListSessionsResponse`](https://zidane.si/docs/reference/acp.md#ListSessionsResponse) to fetch the next page.
- `cwd?` (`string | null`): Only list sessions with this working directory.

Source: [src/acp/types.ts:286](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L286)

### `ListSessionsResponse`

Interface.

Result of the `session/list` request.

```ts
interface ListSessionsResponse
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `nextCursor?` (`string | null`): Cursor for the next page. Absent on the last page.
- `sessions` (`SessionInfo[]`): Sessions on this page.

Source: [src/acp/types.ts:312](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L312)

### `LoadSessionRequest`

Interface.

Params of the `session/load` request. Replays the stored history as `session/update` notifications.

```ts
interface LoadSessionRequest extends NewSessionRequest
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`, from `NewSessionRequest`): Extension metadata. Reserved by the protocol for custom data.
- `additionalDirectories?` (`string[]`, from `NewSessionRequest`): Extra absolute directories the session may access.
- `cwd` (`string`, from `NewSessionRequest`): Absolute working directory for the session.
- `mcpServers` (`AcpMcpServer[]`, from `NewSessionRequest`): MCP servers the agent connects to for this session.
- `sessionId` (`string`): Id of the stored session to load.

Source: [src/acp/types.ts:250](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L250)

### `LoadSessionResponse`

Interface.

`session/load` and `session/resume` responses do NOT echo `sessionId` and
carry no inline message history. Conversation history is replayed via
`session/update` notifications before the response is returned.

```ts
interface LoadSessionResponse
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `configOptions?` (`SessionConfigOption[] | null`): Configurable options for the session, such as model and thinking effort.
- `modes?` (`SessionModeState | null`): Available modes and the current one.

Source: [src/acp/types.ts:338](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L338)

### `McpCapabilities`

Interface.

MCP server transports the agent supports. `stdio` is always supported.

```ts
interface McpCapabilities
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `http?` (`boolean`): Whether the agent can connect to MCP servers over HTTP.
- `sse?` (`boolean`): Whether the agent can connect to MCP servers over SSE.

Source: [src/acp/types.ts:170](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L170)

### `NewSessionRequest`

Interface.

Params of the `session/new` request.

```ts
interface NewSessionRequest
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `additionalDirectories?` (`string[]`): Extra absolute directories the session may access.
- `cwd` (`string`): Absolute working directory for the session.
- `mcpServers` (`AcpMcpServer[]`): MCP servers the agent connects to for this session.

Source: [src/acp/types.ts:238](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L238)

### `NewSessionResponse`

Interface.

Result of the `session/new` request.

```ts
interface NewSessionResponse
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `configOptions?` (`SessionConfigOption[] | null`): Configurable options for the session, such as model and thinking effort.
- `modes?` (`SessionModeState | null`): Available modes and the current one.
- `sessionId` (`string`): Id of the created session.

Source: [src/acp/types.ts:322](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L322)

### `PermissionOption`

Interface.

A choice offered to the user in a permission request.

```ts
interface PermissionOption
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `kind` (`'allow_once' | 'allow_always' | 'reject_once' | 'reject_always'`): Meaning of the choice. The `always` kinds ask the client to remember the decision.
- `name` (`string`): Label shown to the user.
- `optionId` (`string`): Identifier returned in the outcome when the user picks this option.

Source: [src/acp/types.ts:755](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L755)

### `PlanEntry`

Interface.

One entry of an execution plan.

```ts
interface PlanEntry
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `content` (`string`): What the step does.
- `priority` (`'low' | 'medium' | 'high'`): Relative importance of the step.
- `status` (`'completed' | 'pending' | 'in_progress'`): Progress of the step.

Source: [src/acp/types.ts:660](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L660)

### `PromptCapabilities`

Interface.

Content types the agent accepts in a prompt. Text and resource links are always accepted.

```ts
interface PromptCapabilities
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `audio?` (`boolean`): Whether the agent accepts audio content blocks.
- `embeddedContext?` (`boolean`): Whether the agent accepts embedded `resource` content blocks.
- `image?` (`boolean`): Whether the agent accepts image content blocks.

Source: [src/acp/types.ts:158](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L158)

### `PromptRequest`

Interface.

Params of the `session/prompt` request. Starts one turn of the agent.

```ts
interface PromptRequest
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `prompt` (`ContentBlock[]`): User message as content blocks.
- `sessionId` (`string`): Id of the session to prompt.

Source: [src/acp/types.ts:351](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L351)

### `PromptResponse`

Interface.

Result of `session/prompt`, sent when the turn ends.

```ts
interface PromptResponse
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `stopReason` (`StopReason`): Why the turn ended.

Source: [src/acp/types.ts:361](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L361)

### `ReadTextFileRequest`

Interface.

Params of the `fs/read_text_file` request. The agent sends it to read a file through the client.

```ts
interface ReadTextFileRequest
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `limit?` (`number | null`): Maximum number of lines to read.
- `line?` (`number | null`): 1-based line to start reading from.
- `path` (`string`): Absolute path of the file.
- `sessionId` (`string`): Id of the session making the request.

Source: [src/acp/types.ts:784](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L784)

### `RequestPermissionRequest`

Interface.

Params of the `session/request_permission` request. The agent sends it to ask the user before a tool call runs.

```ts
interface RequestPermissionRequest
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `options` (`PermissionOption[]`): Choices offered to the user.
- `sessionId` (`string`): Id of the session the call belongs to.
- `toolCall` (`ToolCallUpdate`): The tool call that needs approval.

Source: [src/acp/types.ts:772](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L772)

### `ResourceLink`

Interface.

A reference to a resource the agent can fetch. The content is not embedded.

```ts
interface ResourceLink
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `annotations?` (`ContentAnnotations | null`): Hints about how to use or show the resource.
- `description?` (`string | null`): What the resource contains.
- `mimeType?` (`string | null`): MIME type of the resource.
- `name` (`string`): Name of the resource.
- `size?` (`number | null`): Size in bytes, when known.
- `title?` (`string | null`): Display title of the resource.
- `type` (`'resource_link'`): Discriminator. Always `"resource_link"`.
- `uri` (`string`): URI of the resource.

Source: [src/acp/types.ts:522](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L522)

### `ResumeSessionRequest`

Interface.

Params of the `session/resume` request. Restores a stored session without replaying its history.

```ts
interface ResumeSessionRequest
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `additionalDirectories?` (`string[]`): Extra absolute directories the session may access.
- `cwd` (`string`): Absolute working directory for the session.
- `mcpServers?` (`AcpMcpServer[]`): MCP servers the agent connects to for this session.
- `sessionId` (`string`): Id of the stored session to resume.

Source: [src/acp/types.ts:256](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L256)

### `RunAcpStdioServerOptions`

Interface.

Options for [`runAcpStdioServer`](https://zidane.si/docs/reference/acp.md#runAcpStdioServer): the [`AcpServerOptions`](https://zidane.si/docs/reference/acp.md#AcpServerOptions) plus the stdio transport settings.

```ts
interface RunAcpStdioServerOptions extends AcpServerOptions
```

**Properties**

- `agentInfo?` (`AcpImplementationInfo`, from `AcpServerOptions`, default `{ name: 'zidane', title: 'Zidane ACP', version: '1' }`): Name and version reported in the `initialize` response.
- `agentOptions?` (`Partial<Omit<AgentOptions, 'provider' | 'execution' | 'session'>>`, from `AcpServerOptions`): Extra options forwarded to the agent, applied over the preset. `provider`, `execution` and `session` are managed by the server.
- `authenticate?` (`(request: AuthenticateRequest) => unknown`, from `AcpServerOptions`): Handles the `authenticate` request and returns the result. Without it the request returns `{}`.
- `authMethods?` (`AuthMethod[]`, from `AcpServerOptions`, default `[]`): Authentication methods listed in the `initialize` response.
- `behavior?` (`AgentBehavior`, from `AcpServerOptions`): Agent behavior settings. They win over the preset and `agentOptions` behavior.
- `commands?` (`AvailableCommand[]`, from `AcpServerOptions`): Slash commands advertised via `available_commands_update` on session start.
- `configOptions?` (`SessionConfigOption[]`, from `AcpServerOptions`): Extra config options advertised to the client. Ids that collide with the generated `mode`, `model` or thinking options are dropped.
- `contextWindow?` (`number`, from `AcpServerOptions`): Total context-window size (tokens) reported in `usage_update.size`. ACP
  requires `size` on every usage update, so when neither this nor the
  provider's `meta.contextWindow` is known, usage updates are suppressed
  rather than sent with a fabricated window.
- `defaultModeId?` (`string`, from `AcpServerOptions`, default `the id of the first mode`): Id of the mode new sessions start in.
- `defaultModelId?` (`string`, from `AcpServerOptions`): Initially-selected `AcpModelChoice.id`. Defaults to the first entry.
- `execution?` (`ExecutionContext | ((request: NewSessionRequest | LoadSessionRequest | ResumeSessionRequest) => ExecutionContext)`, from `AcpServerOptions`, default `` a process context rooted at the request `cwd` ``): Execution context for session tools, or a function called with each `session/new`, `session/load` or `session/resume` request.
- `framing?` (`'content-length' | 'newline'`, default `'newline'`): Wire framing. `'newline'` is newline-delimited JSON, as ACP stdio requires.
- `freezeSystemPrompt?` (`boolean`, from `AcpServerOptions`, default `true`): Freeze each session's system prompt: its first prompt records the system prompt in the session, and later prompts send the same text so the provider's prompt cache keeps hitting. Changes to the skills, searchable tools or MCP instructions sections reach the model as notes in the prompt. When the base system prompt itself changed (for example a restarted server with a new `system`), the next prompt records the new one instead. Set `false` to send the freshly built system prompt on every prompt.
- `input?` (`Readable`, default `process.stdin`): Stream to read client messages from.
- `logout?` (`() => unknown`, from `AcpServerOptions`): Handles the `logout` request. When set, the agent advertises the `logout` auth capability. Without it the request returns `{}`.
- `model?` (`string`, from `AcpServerOptions`): Model id passed to `agent.run({ model })`. With `models`, it also selects the default choice by id or model string when `defaultModelId` is absent.
- `models?` (`AcpModelChoice[]`, from `AcpServerOptions`): Selectable models advertised to the client as a `category: 'model'` config
  option. When present, the client (e.g. Zed) can switch models via
  `session/set_config_option`, and each model resolves its own provider +
  credentials. Supersedes `provider` for run routing.
- `modes?` (`SessionMode[]`, from `AcpServerOptions`, default ``a `build` mode and a `plan` mode``): Session modes offered to the client.
- `onError?` (`(error: Error) => void`): Called with transport errors and failures that cannot be answered over the wire.
- `output?` (`Writable`, default `process.stdout`): Stream to write agent messages to.
- `permission?` (`AcpPermissionPolicy`, from `AcpServerOptions`): Permission policy for tool calls. Permission requests are off unless `enabled` is `true`.
- `preset?` (`Preset`, from `AcpServerOptions`, default ``the `basic` preset plus `web_search` and `fetch_url`, see [`withAcpDefaultTools`](/docs/reference/acp#withAcpDefaultTools)``): Base preset for the agent: tools, MCP servers, behavior and more.
- `provider?` (`Provider | (() => Provider)`, from `AcpServerOptions`): Single provider used for every run. Required UNLESS `models` is
  supplied (the registry then owns provider resolution per selected model).
- `store?` (`SessionStore`, from `AcpServerOptions`): Session store used to persist and load sessions. Without it sessions live only in memory, and `session/list` returns the open ones.
- `system?` (`string`, from `AcpServerOptions`): System prompt passed to every run.
- `tools?` (`Record<string, ToolDef>`, from `AcpServerOptions`): Extra tools merged over the preset tools. They win on a name clash.
- `useClientFileSystem?` (`boolean`, from `AcpServerOptions`, default `true`): Route `read_file` and `write_file` through the client file system when the client supports it. Set `false` to keep the local tools.
- `useClientTerminal?` (`boolean`, from `AcpServerOptions`, default `true`): Route `shell` through a client terminal when the client supports it. Set `false` to keep the local tool.

Source: [src/acp/index.ts:18](https://github.com/Tahul/zidane/blob/main/src/acp/index.ts#L18)

### `SessionCapabilities`

Interface.

Optional session methods the agent supports. A key being present means the method is available.

```ts
interface SessionCapabilities
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `additionalDirectories?` (`Record<string, unknown> | null`): Present when sessions accept `additionalDirectories`.
- `close?` (`Record<string, unknown> | null`): Present when `session/close` is supported.
- `delete?` (`Record<string, unknown> | null`): Present when `session/delete` is supported.
- `list?` (`Record<string, unknown> | null`): Present when `session/list` is supported.
- `resume?` (`Record<string, unknown> | null`): Present when `session/resume` is supported.

Source: [src/acp/types.ts:188](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L188)

### `SessionConfigOption`

Interface.

A session configuration option. ACP v1 currently defines a single
`select` (dropdown) variant; `id` + `name` + `type` are required.

```ts
interface SessionConfigOption
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `category?` (`SessionConfigOptionCategory | null`): Semantic category such as `mode`, `model` or `thought_level`, used by clients to place the control.
- `currentValue` (`string`): Value that is selected now.
- `description?` (`string | null`): Explanation shown to the user.
- `id` (`string`): Identifier used in `session/set_config_option`.
- `name` (`string`): Display name.
- `options` (`SessionConfigSelectOptions`): Choices, flat or in groups.
- `type` (`'select'`): Control type. Only `"select"` exists in ACP v1.

Source: [src/acp/types.ts:725](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L725)

### `SessionConfigSelectGroup`

Interface.

A named group of select options.

```ts
interface SessionConfigSelectGroup
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `group` (`string`): Identifier of the group.
- `name` (`string`): Display name of the group.
- `options` (`SessionConfigSelectOption[]`): Options in the group.

Source: [src/acp/types.ts:704](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L704)

### `SessionConfigSelectOption`

Interface.

One choice of a select config option.

```ts
interface SessionConfigSelectOption
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `description?` (`string | null`): Explanation shown to the user.
- `name` (`string`): Display name.
- `value` (`string`): Value sent in `session/set_config_option`.

Source: [src/acp/types.ts:692](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L692)

### `SessionInfo`

Interface.

Summary of a stored or open session, returned by `session/list`.

```ts
interface SessionInfo
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `additionalDirectories?` (`string[]`): Extra absolute directories of the session.
- `cwd` (`string`): Absolute working directory of the session.
- `sessionId` (`string`): Id of the session.
- `title?` (`string | null`): Human-readable session title.
- `updatedAt?` (`string | null`): ISO 8601 timestamp of the last update.

Source: [src/acp/types.ts:296](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L296)

### `SessionMode`

Interface.

A mode the session can run in, such as `build` or `plan`.

```ts
interface SessionMode
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `description?` (`string | null`): Explanation shown to the user.
- `id` (`string`): Identifier used in `session/set_mode`.
- `name` (`string`): Display name.

Source: [src/acp/types.ts:410](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L410)

### `SessionModeState`

Interface.

The modes a session offers and the active one.

```ts
interface SessionModeState
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `availableModes` (`SessionMode[]`): Modes the client can switch to.
- `currentModeId` (`string`): Id of the active mode.

Source: [src/acp/types.ts:422](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L422)

### `SessionNotification`

Interface.

Params of the `session/update` notification, the agent stream to the client.

```ts
interface SessionNotification
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `sessionId` (`string`): Id of the session the update belongs to.
- `update` (`SessionUpdate`): The update, discriminated by `sessionUpdate`.

Source: [src/acp/types.ts:650](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L650)

### `SetSessionConfigOptionRequest`

Interface.

Params of the `session/set_config_option` request.

```ts
interface SetSessionConfigOptionRequest
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `configId` (`string`): Id of the [`SessionConfigOption`](https://zidane.si/docs/reference/acp.md#SessionConfigOption) to set.
- `sessionId` (`string`): Id of the session to change.
- `value` (`string`): Value to select. Must be one of the option values.

Source: [src/acp/types.ts:390](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L390)

### `SetSessionConfigOptionResponse`

Interface.

Result of `session/set_config_option`.

```ts
interface SetSessionConfigOptionResponse
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `configOptions` (`SessionConfigOption[]`): Full set of config options with their current values after the change.

Source: [src/acp/types.ts:402](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L402)

### `SetSessionModeRequest`

Interface.

Params of the `session/set_mode` request.

```ts
interface SetSessionModeRequest
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `modeId` (`string`): Id of the [`SessionMode`](https://zidane.si/docs/reference/acp.md#SessionMode) to switch to.
- `sessionId` (`string`): Id of the session to change.

Source: [src/acp/types.ts:380](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L380)

### `TerminalExitStatus`

Interface.

How a terminal command ended.

```ts
interface TerminalExitStatus
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `exitCode?` (`number | null`): Process exit code. Absent when the process was killed by a signal.
- `signal?` (`string | null`): Name of the signal that ended the process, when one did.

Source: [src/acp/types.ts:828](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L828)

### `TerminalOutputResponse`

Interface.

Result of the `terminal/output` request.

```ts
interface TerminalOutputResponse
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `exitStatus?` (`TerminalExitStatus | null`): Exit status once the command has finished. Absent while it runs.
- `output` (`string`): Output captured so far.
- `truncated` (`boolean`): Whether the output was cut to fit the byte limit.

Source: [src/acp/types.ts:838](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L838)

### `TextContent`

Interface.

A text content block.

```ts
interface TextContent
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `annotations?` (`ContentAnnotations | null`): Hints about how to use or show the text.
- `text` (`string`): The text.
- `type` (`'text'`): Discriminator. Always `"text"`.

Source: [src/acp/types.ts:480](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L480)

### `TextResourceContents`

Interface.

Embedded resource content in text form.

```ts
interface TextResourceContents
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `mimeType?` (`string | null`): MIME type of the resource.
- `text` (`string`): Text of the resource.
- `uri` (`string`): URI of the resource.

Source: [src/acp/types.ts:544](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L544)

### `ToolCallLocation`

Interface.

A file location a tool call touches.

```ts
interface ToolCallLocation
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `line?` (`number | null`): Line number within the file.
- `path` (`string`): Absolute file path.

Source: [src/acp/types.ts:604](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L604)

### `ToolCallUpdate`

Interface.

A tool call report or an update to one, carried by `tool_call` and `tool_call_update` session updates.

```ts
interface ToolCallUpdate
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `content?` (`ToolCallContent[] | null`): Content produced by the call, such as output, diffs or a terminal.
- `kind?` (`ToolKind | null`): Category of the tool, used by the client for icons and grouping.
- `locations?` (`ToolCallLocation[] | null`): File locations the call affects.
- `rawInput?` (`unknown`): Raw input the tool was called with.
- `rawOutput?` (`unknown`): Raw output the tool returned.
- `status?` (`ToolCallStatus | null`): Execution status of the call.
- `title?` (`string | null`): Human-readable title for the call.
- `toolCallId` (`string`): Id of the tool call within the session.

Source: [src/acp/types.ts:614](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L614)

### `WriteTextFileRequest`

Interface.

Params of the `fs/write_text_file` request. The agent sends it to write a file through the client.

```ts
interface WriteTextFileRequest
```

**Properties**

- `_meta?` (`Record<string, unknown> | null`): Extension metadata. Reserved by the protocol for custom data.
- `content` (`string`): Full text to write.
- `path` (`string`): Absolute path of the file.
- `sessionId` (`string`): Id of the session making the request.

Source: [src/acp/types.ts:798](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L798)

## Types

### `AcpContentMapper`

Type.

Converts tool result content to ACP tool call content.

```ts
type AcpContentMapper = (content: string | ToolResultContent[]) => ToolCallContent[]
```

Source: [src/acp/types.ts:1039](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L1039)

### `AcpMcpServer`

Type.

An MCP server the client asks the agent to connect to. `stdio` servers are launched as a command. `http` and `sse` servers are reached by URL.

```ts
type AcpMcpServer =
  | { _meta?: Record<string, unknown> | null; args: string[]; command: string; env: EnvVariable[]; name: string; type?: 'stdio' }
  | { _meta?: Record<string, unknown> | null; headers: HttpHeader[]; name: string; type: 'http' | 'sse'; url: string }
```

Source: [src/acp/types.ts:432](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L432)

### `AcpSessionContentMapper`

Type.

Converts stored session content blocks to ACP content blocks.

```ts
type AcpSessionContentMapper = (blocks: SessionContentBlock[]) => ContentBlock[]
```

Source: [src/acp/types.ts:1042](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L1042)

### `ContentBlock`

Type.

A block of content in a prompt or a message.

```ts
type ContentBlock =
  | TextContent
  | ImageContent
  | AudioContent
  | ResourceLink
  | EmbeddedResource
```

Source: [src/acp/types.ts:457](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L457)

### `EmbeddedResourceResource`

Type.

Contents of an embedded resource, as text or binary.

```ts
type EmbeddedResourceResource = TextResourceContents | BlobResourceContents
```

Source: [src/acp/types.ts:568](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L568)

### `JsonRpcId`

Type.

Identifier of a JSON-RPC request.

```ts
type JsonRpcId = string | number | null
```

Source: [src/acp/types.ts:13](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L13)

### `JsonRpcMessage`

Type.

Any JSON-RPC message: a request, a notification or a response.

```ts
type JsonRpcMessage = JsonRpcRequest | JsonRpcNotification | JsonRpcResponse
```

Source: [src/acp/types.ts:60](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L60)

### `JsonRpcResponse`

Type.

A JSON-RPC response, either a success or a failure.

```ts
type JsonRpcResponse = JsonRpcSuccess | JsonRpcFailure
```

Source: [src/acp/types.ts:58](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L58)

### `RequestPermissionOutcome`

Type.

How the user answered a permission request: `cancelled`, or `selected` with the chosen `optionId`.

```ts
type RequestPermissionOutcome =
  | { outcome: 'cancelled' }
  | { _meta?: Record<string, unknown> | null; optionId: string; outcome: 'selected' }
```

Source: [src/acp/types.ts:767](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L767)

### `ResumeSessionResponse`

Type.

Result of `session/resume`. Same shape as [`LoadSessionResponse`](https://zidane.si/docs/reference/acp.md#LoadSessionResponse).

```ts
type ResumeSessionResponse = LoadSessionResponse
```

Source: [src/acp/types.ts:348](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L348)

### `Role`

Type.

Author of a message.

```ts
type Role = 'user' | 'assistant'
```

Source: [src/acp/types.ts:465](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L465)

### `SessionConfigOptionCategory`

Type.

Semantic category of a config option. Clients use it to place the control. Custom strings are allowed.

```ts
type SessionConfigOptionCategory = 'mode' | 'model' | 'thought_level' | (string & {})
```

Source: [src/acp/types.ts:719](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L719)

### `SessionConfigSelectOptions`

Type.

Choices of a select option: a flat list or a list of groups.

```ts
type SessionConfigSelectOptions =
  | SessionConfigSelectOption[]
  | SessionConfigSelectGroup[]
```

Source: [src/acp/types.ts:716](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L716)

### `SessionUpdate`

Type.

Payload of a `session/update` notification, discriminated by `sessionUpdate`. Covers message and thought chunks, tool calls, plans, command lists, mode and config changes, session info and usage.

```ts
type SessionUpdate =
  | ({ sessionUpdate: 'user_message_chunk' } & ContentChunk)
  | ({ sessionUpdate: 'agent_message_chunk' } & ContentChunk)
  | ({ sessionUpdate: 'agent_thought_chunk' } & ContentChunk)
  | ({ sessionUpdate: 'tool_call' } & ToolCallUpdate)
  | ({ sessionUpdate: 'tool_call_update' } & ToolCallUpdate)
  | { _meta?: Record<string, unknown> | null; entries: PlanEntry[]; sessionUpdate: 'plan' }
  | { _meta?: Record<string, unknown> | null; availableCommands: AvailableCommand[]; sessionUpdate: 'available_commands_update' }
  | { _meta?: Record<string, unknown> | null; currentModeId: string; sessionUpdate: 'current_mode_update' }
  | { _meta?: Record<string, unknown> | null; configOptions: SessionConfigOption[]; sessionUpdate: 'config_option_update' }
  | { _meta?: Record<string, unknown> | null; sessionUpdate: 'session_info_update'; title?: string | null; updatedAt?: string | null }
  | { _meta?: Record<string, unknown> | null; cost?: Cost | null; sessionUpdate: 'usage_update'; size: number; used: number }
```

Source: [src/acp/types.ts:636](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L636)

### `StopReason`

Type.

Why a prompt turn ended: `end_turn`, `max_tokens`, `max_turn_requests`, `refusal` or `cancelled`.

```ts
type StopReason =
  | 'end_turn'
  | 'max_tokens'
  | 'max_turn_requests'
  | 'refusal'
  | 'cancelled'
```

Source: [src/acp/types.ts:369](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L369)

### `ToolCallContent`

Type.

Content produced by a tool call: plain content, a file diff, or a terminal reference.

```ts
type ToolCallContent =
  | { _meta?: Record<string, unknown> | null; content: ContentBlock; type: 'content' }
  | { _meta?: Record<string, unknown> | null; newText: string; oldText?: string | null; path: string; type: 'diff' }
  | { _meta?: Record<string, unknown> | null; terminalId: string; type: 'terminal' }
```

Source: [src/acp/types.ts:598](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L598)

### `ToolCallStatus`

Type.

Execution status of a tool call.

```ts
type ToolCallStatus = 'pending' | 'in_progress' | 'completed' | 'failed'
```

Source: [src/acp/types.ts:595](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L595)

### `ToolKind`

Type.

Category of a tool, used by clients for icons and grouping.

```ts
type ToolKind =
  | 'read'
  | 'edit'
  | 'delete'
  | 'move'
  | 'search'
  | 'execute'
  | 'think'
  | 'fetch'
  | 'switch_mode'
  | 'other'
```

Source: [src/acp/types.ts:593](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L593)

## Enums

### `AcpErrorCode`

Enum.

JSON-RPC and ACP error codes used in error responses.

```ts
enum AcpErrorCode {
  AuthenticationRequired = -32000,
  InternalError = -32603,
  InvalidParams = -32602,
  InvalidRequest = -32600,
  MethodNotFound = -32601,
  ParseError = -32700,
  ResourceNotFound = -32002,
}
```

**Members**

- `AuthenticationRequired` (`-32000`): The client must authenticate first.
- `InternalError` (`-32603`): The handler failed with an unexpected error.
- `InvalidParams` (`-32602`): The method params are invalid.
- `InvalidRequest` (`-32600`): The message is not a valid JSON-RPC request.
- `MethodNotFound` (`-32601`): The method does not exist.
- `ParseError` (`-32700`): The received text is not valid JSON.
- `ResourceNotFound` (`-32002`): The requested resource, such as a session, does not exist.

Source: [src/acp/types.ts:73](https://github.com/Tahul/zidane/blob/main/src/acp/types.ts#L73)
