# zidane-ui/adapters/server

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

## Functions

### `actionResult`

Function.

An action's answer with its failure as the kit's typed error.

```ts
function actionResult<T extends { ok: true }>(
  answer: ServerActionAnswer<T>,
): ActionResult<T>
```

**Type parameters**

- `T` (`extends { ok: true }`)

**Parameters**

- `answer` (`ServerActionAnswer<T>`): What the server answered.

**Returns** `ActionResult<T>`

Source: [ui/src/adapters/results.ts:42](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/results.ts#L42)

### `createBrowserWindowSettings`

Function.

Creates this browser's window settings over the page's storage.

```ts
function createBrowserWindowSettings(
  options?: BrowserWindowSettingsOptions,
): BrowserWindowSettings
```

**Parameters**

- `options?` (`BrowserWindowSettingsOptions`, default `{}`): The storage, the key and how another page's change is heard.

**Returns** `BrowserWindowSettings`

Source: [ui/src/adapters/browser-window-settings.ts:112](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/browser-window-settings.ts#L112)

### `createServerAppHost`

Function.

Builds every area's host on an open client.

```ts
function createServerAppHost(options: ServerAppHostOptions): ServerAppHosts
```

**Parameters**

- `options` (`ServerAppHostOptions`): The client, the server's origin and the platform's own hosts.

**Returns** `ServerAppHosts`

Source: [ui/src/adapters/server-app-host.ts:183](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-app-host.ts#L183)

### `createServerApprovalsHost`

Function.

Creates an [`ApprovalsHost`](https://zidane.si/docs/reference/ui-approvals-headless.md#ApprovalsHost) on a running zidane-server.

```ts
function createServerApprovalsHost(options: ServerApprovalsHostOptions): ApprovalsHost
```

**Parameters**

- `options` (`ServerApprovalsHostOptions`): The shared client, whether the token may answer approvals, and where background errors go.

**Returns** `ApprovalsHost`

Source: [ui/src/adapters/server-approvals-host.ts:41](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-approvals-host.ts#L41)

### `createServerChannelsHost`

Function.

The channels of a zidane-server, or `undefined` when it runs none (neither `channels.connections.list` nor
`channels.bindings.list` is offered).

```ts
function createServerChannelsHost(
  options: ServerChannelsHostOptions,
): ServerChannelsHost | undefined
```

**Parameters**

- `options` (`ServerChannelsHostOptions`): The client, whether the server has a public URL, and the app's screens.

**Returns** `ServerChannelsHost | undefined`

Source: [ui/src/adapters/server-channels-host.ts:55](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-channels-host.ts#L55)

### `createServerClient`

Function.

Creates a client for a zidane-server and starts connecting. See the module docs for what it
handles; [`ServerClient`](https://zidane.si/docs/reference/ui-adapters-server.md#ServerClient) for what it offers.

```ts
function createServerClient(options: ServerClientOptions): ServerClient
```

**Parameters**

- `options` (`ServerClientOptions`): The server's `url`, the `token`, and optional transport and retry settings.

**Returns** `ServerClient`: The client, connecting.

**Example**

```ts
import { createServerClient } from 'zidane/ipc/browser'

const server = createServerClient({ url: 'wss://zidane.example.com', token })
const hello = await server.ready
if (server.can('sessions.list'))
  console.log(await server.call('sessions.list', {}), hello.hostName)
```

Source: [dist/ipc/browser.d.ts:384](https://github.com/Tahul/zidane/blob/main/dist/ipc/browser.d.ts#L384)

### `createServerComposerHost`

Function.

Creates a [`ComposerHost`](https://zidane.si/docs/reference/ui-chat-headless.md#ComposerHost) over a zidane-server client.

```ts
function createServerComposerHost(
  options: ServerComposerHostOptions,
): ServerComposerHost
```

**Parameters**

- `options` (`ServerComposerHostOptions`): The client to speak through.

**Returns** `ServerComposerHost`

Source: [ui/src/adapters/server-composer-host.ts:202](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-composer-host.ts#L202)

### `createServerExtensionsHost`

Function.

Creates an [`ExtensionsHost`](https://zidane.si/docs/reference/ui-extensions-headless.md#ExtensionsHost) over a zidane-server client.

```ts
function createServerExtensionsHost(
  options: ServerExtensionsHostOptions,
): ServerExtensionsHost
```

**Parameters**

- `options` (`ServerExtensionsHostOptions`): The client, the folder, the sign-in step handler, the error sink and where assets are.

**Returns** `ServerExtensionsHost`

Source: [ui/src/adapters/server-extensions-host.ts:330](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-extensions-host.ts#L330)

### `createServerFilesHost`

Function.

Creates a [`FilesHost`](https://zidane.si/docs/reference/ui-files-headless.md#FilesHost) on a running zidane-server.

```ts
function createServerFilesHost(options: ServerFilesHostOptions): FilesHost
```

**Parameters**

- `options` (`ServerFilesHostOptions`): The shared client, the folder → session lookup and where editor preferences live.

**Returns** `FilesHost`

Source: [ui/src/adapters/server-files-host.ts:152](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-files-host.ts#L152)

### `createServerGitHost`

Function.

Creates a [`GitHost`](https://zidane.si/docs/reference/ui-git-headless.md#GitHost) over a zidane-server client.

```ts
function createServerGitHost(options: ServerGitHostOptions): GitHost
```

**Parameters**

- `options` (`ServerGitHostOptions`): The client.

**Returns** `GitHost`

Source: [ui/src/adapters/server-git-host.ts:187](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-git-host.ts#L187)

### `createServerHost`

Function.

Creates a [`ChatHost`](https://zidane.si/docs/reference/ui-chat-headless.md#ChatHost) on a running zidane-server. Pass a shared `client`, or the `url`
and `token` (and client options) to create one.

```ts
function createServerHost(options: ServerHostOptions): ServerHost
```

**Parameters**

- `options` (`ServerHostOptions`): The client, or what to create one with, plus the working directory for new sessions.

**Returns** `ServerHost`

Source: [ui/src/adapters/server-host.ts:174](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-host.ts#L174)

### `createServerMachinesHost`

Function.

Creates a [`MachinesHost`](https://zidane.si/docs/reference/ui-machines-headless.md#MachinesHost) on a running zidane-server.

```ts
function createServerMachinesHost(
  options: ServerMachinesHostOptions,
): ServerMachinesHost
```

**Parameters**

- `options` (`ServerMachinesHostOptions`): The shared client and the server's fallback name.

**Returns** `ServerMachinesHost`

Source: [ui/src/adapters/server-machines-host.ts:95](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-machines-host.ts#L95)

### `createServerOnboardingHost`

Function.

Creates an [`OnboardingHost`](https://zidane.si/docs/reference/ui-onboarding-headless.md#OnboardingHost) on a running zidane-server.

```ts
function createServerOnboardingHost(
  options: ServerOnboardingHostOptions,
): ServerOnboardingHost
```

**Parameters**

- `options` (`ServerOnboardingHostOptions`): The shared client, the run, whether the token may configure the server, the page's look, and where background errors go.

**Returns** `ServerOnboardingHost`

Source: [ui/src/adapters/server-onboarding-host.ts:140](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-onboarding-host.ts#L140)

### `createServerPaletteHost`

Function.

Creates a [`PaletteHost`](https://zidane.si/docs/reference/ui-palette-headless.md#PaletteHost) over a zidane-server client.

```ts
function createServerPaletteHost(options: ServerPaletteHostOptions): ServerPaletteHost
```

**Parameters**

- `options` (`ServerPaletteHostOptions`): The client, recents storage and error sink.

**Returns** `ServerPaletteHost`

Source: [ui/src/adapters/server-palette-host.ts:74](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-palette-host.ts#L74)

### `createServerSessionDirectory`

Function.

Builds the directory and its live stores on an app's server hosts.

```ts
function createServerSessionDirectory(
  options: ServerSessionDirectoryOptions,
): ServerSessionDirectory
```

**Parameters**

- `options` (`ServerSessionDirectoryOptions`): The hosts and the device storage for the sidebar's views.

**Returns** `ServerSessionDirectory`

Source: [ui/src/adapters/server-session-directory.ts:167](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-session-directory.ts#L167)

### `createServerSessionHost`

Function.

Creates a [`SessionHost`](https://zidane.si/docs/reference/ui-session-headless.md#SessionHost) over a zidane-server client.

```ts
function createServerSessionHost(options: ServerSessionHostOptions): ServerSessionHost
```

**Parameters**

- `options` (`ServerSessionHostOptions`): The client to speak through.

**Returns** `ServerSessionHost`

Source: [ui/src/adapters/server-session-host.ts:196](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-session-host.ts#L196)

### `createServerSessionProjects`

Function.

The projects of a zidane-server, or `undefined` when it keeps none (`projects.list` is not offered).

```ts
function createServerSessionProjects(
  client: ServerProjectsClient,
  oauthCallbackUrl?: string,
): ServerSessionProjects | undefined
```

**Parameters**

- `client` (`ServerProjectsClient`): The server's client, or a bridge to it.
- `oauthCallbackUrl?` (`string`): The server's `SERVER_OAUTH_CALLBACK_PATH` at the origin this page reaches it by. Absent: no
  shared MCP sign-in.

**Returns** `ServerSessionProjects | undefined`

Source: [ui/src/adapters/server-projects.ts:91](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-projects.ts#L91)

### `createServerSettingsHost`

Function.

Creates a [`SettingsHost`](https://zidane.si/docs/reference/ui-settings-headless.md#SettingsHost) on a running zidane-server.

```ts
function createServerSettingsHost(
  options: ServerSettingsHostOptions,
): ServerSettingsHost
```

**Parameters**

- `options` (`ServerSettingsHostOptions`): The shared client.

**Returns** `ServerSettingsHost`

Source: [ui/src/adapters/server-settings-host.ts:68](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-settings-host.ts#L68)

### `createServerSidebarHost`

Function.

Creates a [`SidebarHost`](https://zidane.si/docs/reference/ui-chat-headless.md#SidebarHost) over a zidane-server client.

```ts
function createServerSidebarHost(options: ServerSidebarHostOptions): SidebarHost
```

**Parameters**

- `options` (`ServerSidebarHostOptions`): The client to speak through.

**Returns** `SidebarHost`

Source: [ui/src/adapters/server-sidebar-host.ts:32](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-sidebar-host.ts#L32)

### `createServerTerminalHost`

Function.

Creates a [`TerminalHost`](https://zidane.si/docs/reference/ui-terminal-headless.md#TerminalHost) on a running zidane-server.

```ts
function createServerTerminalHost(options: ServerTerminalHostOptions): TerminalHost
```

**Parameters**

- `options` (`ServerTerminalHostOptions`): The shared client.

**Returns** `TerminalHost`

Source: [ui/src/adapters/server-terminal-host.ts:35](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-terminal-host.ts#L35)

### `createServerViewsHost`

Function.

Creates a [`ViewsHost`](https://zidane.si/docs/reference/ui-views-headless.md#ViewsHost) over a zidane-server client. It listens to the
client only while something reads it.

```ts
function createServerViewsHost(options: ServerViewsHostOptions): ViewsHost
```

**Parameters**

- `options` (`ServerViewsHostOptions`): The client to speak through.

**Returns** `ViewsHost`

Source: [ui/src/adapters/server-views-host.ts:94](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-views-host.ts#L94)

### `createSessionBinding`

Function.

A [`SessionBinding`](https://zidane.si/docs/reference/ui-adapters-server.md#SessionBinding) holding the one session on screen.

```ts
function createSessionBinding(): SessionBinding
```

**Returns** `SessionBinding`

Source: [ui/src/adapters/server-app-host.ts:78](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-app-host.ts#L78)

### `extensionInvokeRequest`

Function.

A callback as the `extensions.ui.invoke` request it travels as. Its folder (`args.cwd`, where a callback has
one) is the caller's to send beside it.

```ts
function extensionInvokeRequest<K extends keyof ExtensionCallbacks>(
  id: K,
  args: ExtensionCallbacks[K]['args'],
): Omit<{ cwd: string } & { ctx?: unknown; op: 'panel.load'; panelId: string }, 'cwd'> | Omit<{ cwd: string } & { actionId: string; ctx?: unknown; op: 'panel.action'; panelId: string; payload?: Json }, 'cwd'> | Omit<{ cwd: string } & { key: string; op: 'reference.resolve'; providerId: string }, 'cwd'> | Omit<{ cwd: string } & { op: 'badge.menu'; target: unknown }, 'cwd'> | Omit<{ cwd: string } & { actionId: string; op: 'badge.run'; sessionId?: string; source: string; target: unknown }, 'cwd'> | Omit<{ cwd: string } & { key: string; op: 'setting.action'; pageId: string }, 'cwd'> | Omit<{ cwd: string } & { key: string; op: 'setting.status'; pageId: string }, 'cwd'> | Omit<{ cwd: string } & { key: string; op: 'setting.validate'; pageId: string; value: unknown }, 'cwd'>
```

**Type parameters**

- `K` (`extends keyof ExtensionCallbacks`)

**Parameters**

- `id` (`K`): The callback.
- `args` (`ExtensionCallbacks[K]['args']`): Its arguments.

**Returns** `Omit<{ cwd: string } & { ctx?: unknown; op: 'panel.load'; panelId: string }, 'cwd'> | Omit<{ cwd: string } & { actionId: string; ctx?: unknown; op: 'panel.action'; panelId: string; payload?: Json }, 'cwd'> | Omit<{ cwd: string } & { key: string; op: 'reference.resolve'; providerId: string }, 'cwd'> | Omit<{ cwd: string } & { op: 'badge.menu'; target: unknown }, 'cwd'> | Omit<{ cwd: string } & { actionId: string; op: 'badge.run'; sessionId?: string; source: string; target: unknown }, 'cwd'> | Omit<{ cwd: string } & { key: string; op: 'setting.action'; pageId: string }, 'cwd'> | Omit<{ cwd: string } & { key: string; op: 'setting.status'; pageId: string }, 'cwd'> | Omit<{ cwd: string } & { key: string; op: 'setting.validate'; pageId: string; value: unknown }, 'cwd'>`

Source: [ui/src/adapters/extension-protocol.ts:29](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/extension-protocol.ts#L29)

### `extensionUiEffectOf`

Function.

A routed UI request as the effect the app applies.

```ts
function extensionUiEffectOf(request: UiClientRequest): ExtensionUiEffect
```

**Parameters**

- `request` (`UiClientRequest`): The `ui:client` signal's request.

**Returns** `ExtensionUiEffect`

Source: [ui/src/adapters/extension-protocol.ts:68](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/extension-protocol.ts#L68)

### `installExtensionHostModules`

Function.

Puts `modules` in the host module map linked bundles read (merged over what is there).

```ts
function installExtensionHostModules(
  modules: ExtensionHostModules,
  target?: object,
): void
```

**Parameters**

- `modules` (`ExtensionHostModules`): Host modules by specifier.
- `target?` (`object`, default `globalThis`): The global object. Default `globalThis`.

Source: [ui/src/adapters/extension-modules.ts:166](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/extension-modules.ts#L166)

### `linkExtensionModule`

Function.

Rewrites a bundle's imports of host modules into reads of the host module map, so the code runs
as a module with no imports. A bare import the map has no module for fails, every one named.
Relative and URL imports are left alone (a self-contained bundle has none).

```ts
function linkExtensionModule(
  code: string,
  provided: (specifier: string) => boolean,
): LinkedExtensionModule
```

**Parameters**

- `code` (`string`): One ESM module (zidane's `compileUiEntry` output).
- `provided` (`(specifier: string) => boolean`): Whether the app provides a specifier.

**Returns** `LinkedExtensionModule`: The linked code and the host modules it reads.

Source: [ui/src/adapters/extension-modules.ts:94](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/extension-modules.ts#L94)

### `pairWithServer`

Function.

Trades a code for a token.

```ts
function pairWithServer(
  baseUrl: string,
  code: string,
  options?: PairWithServerOptions,
): Promise<PairResult>
```

**Parameters**

- `baseUrl` (`string`): The server's `http(s)://` origin; `''` for the page's own server.
- `code` (`string`): The code as typed (formatted before it is sent).
- `options?` (`PairWithServerOptions`, default `{}`): The app's label and kind, and the `fetch` to post with.

**Returns** `Promise<PairResult>`

Source: [ui/src/adapters/server-pairing.ts:43](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-pairing.ts#L43)

### `revokeSelf`

Function.

Revokes the app's own token with `tokens.revokeSelf`.

```ts
function revokeSelf(client: Pick<ServerClient, 'call'>): Promise<void>
```

**Parameters**

- `client` (`Pick<ServerClient, 'call'>`): The open connection.

**Returns** `Promise<void>`

Source: [ui/src/adapters/server-pairing.ts:67](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-pairing.ts#L67)

### `serverCapabilities`

Function.

What the token and the server allow, read from `client.can` (after `client.ready`).

```ts
function serverCapabilities(client: Pick<ServerClient, 'can'>): ServerCapabilities
```

**Parameters**

- `client` (`Pick<ServerClient, 'can'>`): The open connection.

**Returns** `ServerCapabilities`

Source: [ui/src/adapters/server-app-host.ts:119](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-app-host.ts#L119)

### `serverDirectoryPorts`

Function.

The session directory's stream store, transcript reads and prewarm policy over a server chat host.

```ts
function serverDirectoryPorts(host: ServerDirectoryHost): ServerDirectoryPorts
```

**Parameters**

- `host` (`ServerDirectoryHost`): The chat host that holds and reads the transcripts.

**Returns** `ServerDirectoryPorts`

Source: [ui/src/adapters/server-directory.ts:37](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-directory.ts#L37)

### `toSidebarListSession`

Function.

Converts a zidane server's session row into a [`SidebarListSession`](https://zidane.si/docs/reference/ui-chat-headless.md#SidebarListSession): the chat session plus its folder and space.

```ts
function toSidebarListSession(row: SessionRow): SidebarListSession
```

**Parameters**

- `row` (`SessionRow`): The session row from the server.

**Returns** `SidebarListSession`

Source: [ui/src/adapters/server-host.ts:124](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-host.ts#L124)

## Classes

### `ExtensionModuleLinkError`

Class.

A bundle that imports something the app does not provide.

```ts
class ExtensionModuleLinkError extends Error
```

**Constructor**

```ts
new ExtensionModuleLinkError(specifiers: readonly string[])
```

**Parameters**

- `specifiers` (`readonly string[]`): The specifiers the app has no module for.

**Returns** `ExtensionModuleLinkError`

**Properties**

- `specifiers` (`readonly string[]`, readonly): The specifiers the app has no module for.

Source: [ui/src/adapters/extension-modules.ts:50](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/extension-modules.ts#L50)

## Interfaces

### `BrowserWindowSettings`

Interface.

This browser's window settings, shared by the server hosts of one page.

```ts
interface BrowserWindowSettings
```

**Properties**

- `merge` (`(server: Partial<Settings>) => Partial<Settings>`): The server's values with this browser's over them. The first call while nothing is stored copies the
  server's window values into the map (the migration).
- `split` (`(patch: Partial<Settings>) => { host: Partial<Settings>; window: Partial<Settings> }`): Splits a patch: the keys that stay in this browser, and the rest for the server.
- `stored` (`() => Partial<Settings> | null`): The values stored now; `null` while nothing was stored yet (not migrated).
- `subscribe` (`(listener: () => void) => () => void`): Calls back after every write here and every change another page made. Returns the unsubscribe.
- `write` (`(patch: Partial<Settings>) => void`): Stores window values. Throws when the storage refuses (full, blocked).

Source: [ui/src/adapters/browser-window-settings.ts:60](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/browser-window-settings.ts#L60)

### `BrowserWindowSettingsOptions`

Interface.

Options of [`createBrowserWindowSettings`](https://zidane.si/docs/reference/ui-adapters-server.md#createBrowserWindowSettings).

```ts
interface BrowserWindowSettingsOptions
```

**Properties**

- `key?` (`string`): The key. Default: `zg:window-settings`.
- `listen?` (`(onChange: () => void) => () => void`): Calls back when another page changed the stored map; returns how to stop. Default: the window's
  `storage` event for the key, with the default storage.
- `storage?` (`RecordStorage`): Where the map lives. Default: `localStorage` (a page without one keeps the values in memory).

Source: [ui/src/adapters/browser-window-settings.ts:47](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/browser-window-settings.ts#L47)

### `LinkedExtensionModule`

Interface.

A linked bundle: its code, and the host modules it reads.

```ts
interface LinkedExtensionModule
```

**Properties**

- `code` (`string`): The bundle with its host-module imports rewritten to reads of the shared module map.
- `uses` (`readonly string[]`): The host module specifiers the code reads, each once.

Source: [ui/src/adapters/extension-modules.ts:42](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/extension-modules.ts#L42)

### `PairWithServerOptions`

Interface.

Options for [`pairWithServer`](https://zidane.si/docs/reference/ui-adapters-server.md#pairWithServer).

```ts
interface PairWithServerOptions
```

**Properties**

- `fetch?` (`(url: string, init: RequestInit) => Promise<Response>`): `fetch` (a test passes its own). Default: the global one.
- `kind?` (`PairDeviceKind`): What kind of device pairs: the token is named `<kind>: <name>` (default `browser`).
- `name?` (`string`): The app's label; the server names the token after it.

Source: [ui/src/adapters/server-pairing.ts:27](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-pairing.ts#L27)

### `ServerAppHostOptions`

Interface.

Options for [`createServerAppHost`](https://zidane.si/docs/reference/ui-adapters-server.md#createServerAppHost).

```ts
interface ServerAppHostOptions
```

**Properties**

- `client` (`ServerClient`): The open connection (after `client.ready`), shared by every server host.
- `newChat?` (`(hostId: string, machine?: string) => void`): Opens a new chat on the server, or on one of its machines (the app's own navigation). Absent: no `newChat` in the machines host.
- `origin` (`string`): The server's `http(s)://` origin as the app reaches it: OAuth sign-ins come back there, machines join its `ws(s)://` twin, extension assets load from it.
- `platform?` (`{ appearance?: AppearanceHost; draftStorage?: ComposerDraftStorage; keybindings?: KeybindingsHost; windowSettings?: BrowserWindowSettings; workspace?: WorkspaceHost<WorkspaceScope> }`): The hosts the app's platform keeps itself.
- `saveExport?` (`(file: { content: string; filename: string; format: SessionExportFormat }) => Promise<string>`): Hands an exported transcript to the user and resolves what to show as where it went. Absent: no export.
- `serverName?` (`string`): The server's name before its handshake reports one.
- `storage?` (`Storage`): Synchronous storage for the hosts that remember preferences on the device (the Files tab's editor preferences).
- `token?` (`string`): The client token: extension webviews and bundles are fetched with it.

Source: [ui/src/adapters/server-app-host.ts:137](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-app-host.ts#L137)

### `ServerAppHosts`

Interface.

The hosts, their shared connection and what it may do.

```ts
interface ServerAppHosts
```

**Properties**

- `binding` (`SessionBinding`): The session on screen and its folder: set it as the app shows a session (the Files tab reads through it).
- `can` (`ServerCapabilities`): What the connection may do, for the app's own controls.
- `client` (`ServerClient`): The connection every server host shares, for the reads no host carries (`sessions.getMeta`).
- `dispose` (`() => void`): Closes the hosts that listen for their whole life, and the connection (the chat host closes it).
- `host` (`AppHost & { chat: ServerHost; extensions: ServerExtensionsHost }`): Every area's host, for `AppHostProvider`.

Source: [ui/src/adapters/server-app-host.ts:165](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-app-host.ts#L165)

### `ServerApprovalsHostOptions`

Interface.

Options for [`createServerApprovalsHost`](https://zidane.si/docs/reference/ui-adapters-server.md#createServerApprovalsHost).

```ts
interface ServerApprovalsHostOptions
```

**Properties**

- `canApprove?` (`boolean`): `false` leaves out `resolve` and `denyAll`, for a token without the `approve` scope.
  Default: `client.can('approvals.resolve')` once the handshake has landed, `true` before it.
- `client` (`ServerClient`): The client to speak through, shared with the chat host (`createServerHost({ client })`) and other areas' hosts.
- `onError?` (`(error: unknown) => void`): Called with errors no caller receives (a failed listing). Default: a console warning.

Source: [ui/src/adapters/server-approvals-host.ts:24](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-approvals-host.ts#L24)

### `ServerCapabilities`

Interface.

What a connection may do, for an app's own controls (a host leaves out the rest by itself).

```ts
interface ServerCapabilities
```

**Properties**

- `artifacts` (`boolean`): The artifacts panel.
- `configure` (`boolean`): Configuring providers (an admin token).
- `diffs` (`boolean`): The Diffs tab (the same listing).
- `files` (`boolean`): The Files tab: the server's folders can be listed.
- `inbox` (`boolean`): The inbox of questions and plans.
- `queue` (`boolean`): The message queue.
- `reminders` (`boolean`): Reminders and schedules.
- `revokeSelf` (`boolean`): Revoking this app's own token on sign-out.
- `secrets` (`boolean`): The secrets panel.
- `side` (`boolean`): Side chats.
- `terminal` (`boolean`): The terminals.

Source: [ui/src/adapters/server-app-host.ts:89](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-app-host.ts#L89)

### `ServerChannelsHost`

Interface.

The server's channels host, and how to stop listening.

```ts
interface ServerChannelsHost extends ChannelsHostState
```

**Properties**

- `agent?` (`ChannelsAgent`, from `ChannelsHostState`): The org's Agent. Absent: no Agent card and no Agent row.
- `alerts?` (`ChannelsAlerts`, from `ChannelsHostState`): The caller's open channel alerts. Absent: no alerts list.
- `apply` (`(signal: { kind: string }) => void`, from `ChannelsHostState`): A signal of the host: reads again what it touches. Other kinds are ignored.
- `bindings?` (`ChannelsBindings`, from `ChannelsHostState`): A project's bindings (Project settings › Channels). Absent: no Channels section.
- `close` (`() => void`): Stops following the server's signals.
- `connections?` (`ChannelsConnections`, from `ChannelsHostState`): The host's connections (Settings › Channels). Absent: no Channels page.
- `defaultProjects` (`Readable<Readonly<Record<string, string | null>>>`, from `ChannelsHostState`): The defaults set from this window, by connection id (`null`: cleared). The host has no read of them.
- `held?` (`ChannelsHeld`, from `ChannelsHostState`): A project's replies the outbound filter held, and their release. Absent: no Held replies list.
- `openProject?` (`(projectId: string) => void`, from `ChannelsHostState`): Opens a project of the host (its home): the Agent card's Open project. Absent: no Open project.
- `openSession?` (`(sessionId: string) => void`, from `ChannelsHostState`): Opens a session of the host (a test session). Absent: Test as opens it in the background.
- `openTarget?` (`(target: ReadinessOpenTarget, projectId?: string) => void`, from `ChannelsHostState`): Opens a screen of the app a readiness fix names (Settings › Channels, Linked accounts). The project's own screens
  open its settings in the kit. Absent: those fixes show without a button. `projectId`: the project the fix is
  about (absent for an alert about no project).
- `readiness?` (`ChannelsReadiness`, from `ChannelsHostState`): A project's readiness checklist. Absent: no checklist.
- `setDefaultProject?` (`(connectionId: string, projectId: string | null) => Promise<void>`, from `ChannelsHostState`): Sets (`null`: clears) the caller's default project for a connection's DMs and unbound mentions. Absent: no
  default project rows.
- `testAs?` (`(projectId: string, bindingId: string, as: TestAsKind, identity: { iconUrl?: string; name: string }) => Promise<TestSession>`, from `ChannelsHostState`): Opens a private session with a binding's exact rules for a member or a guest. Absent: no Test as.
  `identity`: how its replies post, kept for the session's Test badge.
- `testSessions` (`Readable<Readonly<Record<string, TestSession>>>`, from `ChannelsHostState`): The test sessions opened in this window, by session id.
- `wake` (`() => void`, from `ChannelsHostState`): Reads again everything read so far (a new connection).

Source: [ui/src/adapters/server-channels-host.ts:31](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-channels-host.ts#L31)

### `ServerChannelsHostOptions`

Interface.

Options for [`createServerChannelsHost`](https://zidane.si/docs/reference/ui-adapters-server.md#createServerChannelsHost).

```ts
interface ServerChannelsHostOptions
```

**Properties**

- `client` (`ServerClient`): The server's client.
- `openProject?` (`(projectId: string) => void`): Opens a project of the server (the Agent card's Open project).
- `openSession?` (`(sessionId: string) => void`): Opens a session of the server (a test session).
- `openTarget?` (`(target: ReadinessOpenTarget, projectId?: string) => void`): Opens a screen of the app a readiness fix names (`ChannelsHost.openTarget`).
- `publicUrl?` (`boolean`): The server serves https webhooks at a public URL (Slack's HTTP transport is offered). Default false.

Source: [ui/src/adapters/server-channels-host.ts:17](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-channels-host.ts#L17)

### `ServerClient`

Interface.

A connection to a zidane-server: typed calls, signals and its state.

```ts
interface ServerClient
```

**Properties**

- `call` (`<M extends keyof IpcMethods>(method: M, params: IpcParams<M>) => Promise<IpcResult<M>>`): Calls a method. Waits while (re)connecting; fails when the connection drops mid-call.
- `can` (`(method: keyof IpcMethods) => boolean`): Whether this connection may call `method`: the host offers it and the token reaches it.
  `true` against a host that predates the list. `false` while not open.
- `close` (`() => void`): Closes the connection and stops reconnecting.
- `hello` (`() => HelloResult | null`): The current connection's hello, `null` while not open.
- `notify` (`<M extends keyof IpcMethods>(method: M, params: IpcParams<M>) => void`): Sends a notification (no answer). Dropped while not open.
- `onOpen` (`(listener: (hello: HelloResult, reconnected: boolean) => void) => () => void`): Called after every handshake, `reconnected` after the first: re-read or resume what the
  page shows. Returns its unsubscribe.
- `onSignal` (`(listener: (signal: HostSignal, meta?: SignalMeta) => void) => () => void`): Called with every signal the host fans out, and its position in its session; returns its unsubscribe.
- `onState` (`(listener: (state: ServerClientState) => void) => () => void`): Called on every state change; returns its unsubscribe.
- `ready` (`Promise<HelloResult>`): Resolves with the first hello; rejects when the client is refused or closed before it.
- `state` (`() => ServerClientState`): The connection's state now.

Source: [dist/ipc/browser.d.ts:340](https://github.com/Tahul/zidane/blob/main/dist/ipc/browser.d.ts#L340)

### `ServerClientOptions`

Interface.

Options for [`createServerClient`](https://zidane.si/docs/reference/ui-adapters-server.md#createServerClient).

```ts
interface ServerClientOptions
```

**Properties**

- `appVersion?` (`string`): Reported in the server's logs and audit (default `'web'`).
- `connectTimeoutMs?` (`number`): How long an attempt may take to open and finish its handshake before it is dropped and retried, in ms (default 10 000).
- `fetch?` (`{ (input: RequestInfo | URL, init?: RequestInit): Promise<Response>; (input: string | Request | URL, init?: RequestInit): Promise<Response> }`): `fetch`, for the auth check after a failed connect. Default: the global one.
- `heartbeatMs?` (`number`): Ping interval in ms; a ping unanswered by the next one drops the connection (default 20 000; 0: off).
- `onState?` (`(state: ServerClientState) => void`): Called on every state change.
- `reconnect?` (`false | { initialMs?: number; maxMs?: number }`): First reconnect delay and its ceiling, in ms (default 500 doubling to 15 000). `false`: never reconnect.
- `token?` (`string`): A client token (`zidane server token create`). Absent: a server without auth.
- `url` (`string`): `ws://` or `wss://` URL of the server.
- `WebSocket?` (`(url: string | URL, protocols?: string | string[]) => WebSocket`): WebSocket constructor. Default: the global one.

Source: [dist/ipc/browser.d.ts:293](https://github.com/Tahul/zidane/blob/main/dist/ipc/browser.d.ts#L293)

### `ServerComposerHost`

Interface.

The [`ComposerHost`](https://zidane.si/docs/reference/ui-chat-headless.md#ComposerHost) [`createServerComposerHost`](https://zidane.si/docs/reference/ui-adapters-server.md#createServerComposerHost) returns.

```ts
interface ServerComposerHost extends ComposerHost
```

**Properties**

- `agents?` (`ComposerAgents`, from `ComposerHost`): The agent profiles the agent picker offers.
- `autocomplete?` (`ComposerAutocomplete`, from `ComposerHost`): Inline ghost text.
- `close` (`() => void`): Stops listening to the client (it leaves the client open).
- `completions?` (`ComposerCompletions`, from `ComposerHost`): The completion catalogs.
- `context?` (`ComposerContext`, from `ComposerHost`): A session's context gauge, its breakdown and its settled cost.
- `controls?` (`ComposerControls`, from `ComposerHost`): The pickers' writes on a session (model, effort, options, agent) and their cache estimates.
- `drafts?` (`ComposerDrafts`, from `ComposerHost`): The shared per-session draft.
- `draftStorage?` (`ComposerDraftStorage`, from `ComposerHost`): Where unsent drafts outlive the app (`createWebStorageDraftStorage`). Absent: they live while the app runs.
- `folders?` (`ComposerFolders`, from `ComposerHost`): The folder a new session opens in, remembered. Absent: a new session starts without one.
- `models?` (`ComposerModels`, from `ComposerHost`): The model catalogs the pickers list.
- `pickerPrefs?` (`ModelPickerPrefsStore`, from `ComposerHost`): The model picker's per-device preferences. Absent: an in-memory store for the page's life.
- `prefs?` (`ComposerPrefs`, from `ComposerHost`): Where picks are remembered across apps (effort and options per model, the next chat's model).
- `runs?` (`ComposerRuns`, from `ComposerHost`): The current run's counters per session (the run chip, the cost pill).
- `suggestions?` (`ComposerSuggestions`, from `ComposerHost`): Next-prompt suggestions.

Source: [ui/src/adapters/server-composer-host.ts:71](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-composer-host.ts#L71)

### `ServerComposerHostOptions`

Interface.

Options for [`createServerComposerHost`](https://zidane.si/docs/reference/ui-adapters-server.md#createServerComposerHost).

```ts
interface ServerComposerHostOptions
```

**Properties**

- `client` (`ServerClient`): The client to speak through, shared with the chat host (`createServerHost(…).client`).

Source: [ui/src/adapters/server-composer-host.ts:65](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-composer-host.ts#L65)

### `ServerExtensionsHost`

Interface.

The [`ExtensionsHost`](https://zidane.si/docs/reference/ui-extensions-headless.md#ExtensionsHost) [`createServerExtensionsHost`](https://zidane.si/docs/reference/ui-adapters-server.md#createServerExtensionsHost) returns.

```ts
interface ServerExtensionsHost extends ExtensionsHost
```

**Properties**

- `announce` (`(info: ExtensionsClientAnnounce) => Promise<void>`): Tells the server what this window shows (kept and sent again on every reconnect).
- `bundle` (`ServerExtensionBundleLookup`): An extension's `ui` bundle in the folder's current listing (`url` relative to the server's
  origin), why it did not bundle, or `undefined`: it has none. `fresh`: list again first.
- `close` (`() => void`): Stops listening to the client (the client stays open). Pending dialogs close unanswered.
- `commands` (`ServerExtensionCommands`): The unified commands.
- `dialogs` (`ServerExtensionDialogs`): `ctx.ui` dialogs and toasts routed to this client. Absent: this client shows none.
- `effects` (`ExtensionUiEffects`): `ctx.ui` panels, navigation, composer edits and notifications routed to this client.
- `folder` (`() => string | null`): The folder shown now.
- `integrations` (`ExtensionIntegrations`): Integrations and their connections.
- `invoke` (`<K extends keyof ExtensionCallbacks>(callbackId: K, args: ExtensionCallbacks[K]['args']) => Promise<ExtensionCallbacks[K]['result']>`): Calls an extension callback by id. Absent: nothing invokes (panels don't load, menus stay empty).
- `items` (`ExtensionItemStores`, from `ExtensionsHost`): Every contribution, per token.
- `onReset` (`(listener: () => void) => () => void`): The folder's extensions were rebuilt, or the connection came back (maybe to a restarted server):
  their `ui` modules may have changed. Returns the unsubscribe.
- `openLink` (`(request: ExtensionLinkRequest) => Promise<boolean>`): Offers a link the user opened to the extensions' link handlers (`LinkHandler`, higher `priority`
  first). Resolves `true` when one opened it; `false` (or a rejection): open it the app's way. The kit
  skips it while Alt is held (`routeLink`). Absent: links open the app's way.
- `panelChanged` (`(listener: (change: ExtensionPanelChange) => void) => () => void`): A panel would load something new (its `subscribe` emitted, or its handle was updated): reload it where
  visible. `sessionId`: only that session's content changed. Returns the unsubscribe. Absent: panels the kit
  draws reload only after an action or a folder change.
- `ready` (`Promise<void>`): Settles once the first listing of the folder's items, settings, commands and integrations is in.
- `rpc` (`(contract: string, method: string, input?: unknown, opts?: ExtensionRpcOptions) => Promise<unknown>`): Calls an RPC method. Rejects `rpc` with the method's error. Absent: no RPC from the UI.
- `setFolder` (`(cwd: string | null) => void`): Shows another folder's extensions (`null`: none).
- `settings` (`ExtensionSettings`): The extensions' settings, locked keys and provenance included.
- `storage` (`ExtensionStorage`): The extensions' typed stores.
- `webviews?` (`ExtensionWebviews & ServerWebviewSources`): With `assets`: the webview URLs the server mints.

Source: [ui/src/adapters/server-extensions-host.ts:137](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-extensions-host.ts#L137)

### `ServerExtensionsHostOptions`

Interface.

Options for [`createServerExtensionsHost`](https://zidane.si/docs/reference/ui-adapters-server.md#createServerExtensionsHost).

```ts
interface ServerExtensionsHostOptions
```

**Properties**

- `assets?` (`ServerExtensionAssetsAccess`): Where webview pages are minted. Absent: no `webviews` (a `file` source shows nothing).
- `client` (`ServerClient`): The client to speak through, shared with the chat host.
- `cwd?` (`string | null`): The folder whose extensions show. `null`: none until `ServerExtensionsHost.setFolder`.
- `onError?` (`(error: unknown) => void`): Called with errors no caller can receive (a failed listing). Default: a console warning.
- `onFlowStep?` (`ExtensionFlowStepHandler`): Shows one sign-in step. Default: links open in a new tab; questions show as dialogs of this host.

Source: [ui/src/adapters/server-extensions-host.ts:91](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-extensions-host.ts#L91)

### `ServerFilesHostOptions`

Interface.

Options for [`createServerFilesHost`](https://zidane.si/docs/reference/ui-adapters-server.md#createServerFilesHost).

```ts
interface ServerFilesHostOptions
```

**Properties**

- `client` (`ServerClient`): The client to speak through, shared with the chat host (`createServerHost({ client })`) and other areas' hosts.
- `sessionOf` (`(cwd: string) => string | undefined`): The session whose workspace holds a folder's files (the session open on it); `undefined`: none, nothing to read.
- `storage?` (`RecordStorage`): Where the editor preferences live (`localStorage`). Absent: no `editorPrefs`, the defaults.

Source: [ui/src/adapters/server-files-host.ts:58](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-files-host.ts#L58)

### `ServerGitHostOptions`

Interface.

Options for [`createServerGitHost`](https://zidane.si/docs/reference/ui-adapters-server.md#createServerGitHost).

```ts
interface ServerGitHostOptions
```

**Properties**

- `client` (`ServerClient`): The client to speak through, shared with the chat host.

Source: [ui/src/adapters/server-git-host.ts:47](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-git-host.ts#L47)

### `ServerHost`

Interface.

The [`ChatHost`](https://zidane.si/docs/reference/ui-chat-headless.md#ChatHost) [`createServerHost`](https://zidane.si/docs/reference/ui-adapters-server.md#createServerHost) returns, plus the connection.

```ts
interface ServerHost extends ChatHost
```

**Properties**

- `accounts?` (`ChatAccounts`, from `ChatHost`): The accounts that hold the sessions' credentials: a run stopped by a failed sign-in is fixed from its card
  (`HostTranscript`). Absent: the card offers Retry and Copy details only.
- `afterText` (`(sessionId: string, action: () => void) => void`): Runs `action` once the reply text a session's pacer holds has shown (at once when nothing waits, or without
  `smooth`): a signal another host applies that follows that text keeps its place behind it.
- `badges?` (`ChatBadgeActions`, from `ChatHost`): The badge menu's extension actions. Absent: the built-in actions only.
- `blobMediaUrl?` (`(hash: string, name?: string) => string | undefined`, from `ChatHost`): The address of a medium the host's session store holds by content hash (`TranscriptActions.blobMediaUrl`): a
  prompt's attachment, a tool result's media block. The same bytes for good. `undefined` when it serves none now.
- `blockRuns?` (`ChatBlockRuns`, from `ChatHost`): Run here on a reply's shell blocks, and their saved runs. Absent: blocks have no Run button.
- `cancelTool?` (`(sessionId: string, callId: string) => void`, from `ChatHost`): Stop a running tool call (a shell command).
- `chips?` (`ChatChipDetails`, from `ChatHost`): What chip hover cards show (a commit, a `#chat`, a skill, a command). Absent: chips have no hover card.
- `client` (`ServerClient`): The client it speaks through (for other areas' hosts on the same connection).
- `close` (`() => void`): Closes the connection and stops reconnecting (also closes a client it was given).
- `connection` (`Readable<ServerClientState>`): The connection's state, for a status line or a sign-in prompt.
- `holdsTranscript` (`(sessionId: string) => boolean`): Whether the host holds the session's transcript, read (hydrated): opened, kept from a recent open, or read ahead.
- `interactions?` (`{ all?: () => Readable<readonly ChatInteraction[]>; answer: (requestId: string, response: InteractionResponse) => Promise<void | { answeredFirst: InteractionAnsweredFirst }>; cancel?: (requestId: string, reason?: string) => Promise<void>; pending: (sessionId: string) => Readable<readonly ChatInteraction[]> }`, from `ChatHost`): Pending questions, plans, and approvals, and the way to answer or dismiss them.
- `interrupt?` (`(sessionId: string) => void`, from `ChatHost`): Stops the run in flight in a session. Absent: no stop button.
- `messageMediaUrl?` (`(sessionId: string, src: string) => string | undefined`, from `ChatHost`): Where a message's media loads from (`![alt](src)`, see
  `TranscriptActions.messageMediaUrl`): `src` as written, or the host's
  address for a local file; `undefined` when it serves none.
- `models?` (`Readable<readonly ChatModelProvider[]>`, from `ChatHost`): Providers and models for the model picker. Absent: no picker.
- `paths?` (`ChatPaths`, from `ChatHost`): What prose chips name on disk. Absent: a chip opens the path as written.
- `prefetch` (`(sessionId: string) => Promise<void>`): Reads a session's tail ahead of its open (the pointer rests on its row): the open then shows it at once and
  catches up from where the read left it, or joins the read in flight. Nothing for an open transcript, a running
  session, one held already, or while disconnected. Resolves when the read lands (at once when nothing is read);
  never rejects: an open after a failed read reads the tail itself. A read in flight is joined, not made again.
- `providerReady?` (`(cwd?: string) => Promise<boolean>`, from `ChatHost`): Whether a model provider can answer a prompt sent from `cwd`. Absent: a send is never refused for want of one.
- `ready` (`Promise<void>`): Resolves once the first handshake and session list completed; rejects when the client was refused.
- `references?` (`ChatReferences`, from `ChatHost`): Extension text references (ticket ids, issue links) in prose. Absent: they stay plain text.
- `refresh` (`() => Promise<void>`): Re-reads the session list.
- `searchSync?` (`ChatSearchSync`, from `ChatHost`): The transcript search a session's other windows share. Absent: the search stays in this window.
- `send?` (`(input: SendInput) => Promise<void>`, from `ChatHost`): Sends a prompt to a session. Absent: the composer cannot send.
- `sessionMessage?` (`(sessionId: string, startsWith: string) => Promise<string | null>`, from `ChatHost`): The whole of a message another session's report quoted cut: the newest of `sessionId`'s messages
  that starts with `startsWith` (the report's summary), `null` when none does.
- `sessions?` (`{ create?: (input?: { title?: string }) => Promise<ChatSession>; list: Readable<readonly ChatSession[]>; main?: () => Promise<string | null>; onChanged?: (listener: (change: SessionRowChange<SidebarListSession>) => void) => () => void; onFacets?: (listener: (sessionId: string, facets: Readonly<Record<string, unknown>>) => void) => () => void; query?: (filter: { archive: SessionArchiveFilter; hostId?: string }) => Promise<readonly SidebarListSession[]>; remove?: (sessionId: string) => Promise<void | SessionRemoval>; rename?: (sessionId: string, title: string) => Promise<void>; search?: (query: string, filter?: { archive?: SessionArchiveFilter }, onPartial?: (hits: readonly SessionSearchHit[]) => void) => Promise<readonly SessionSearchHit[]>; setArchived?: (sessionId: string, archived: boolean) => Promise<void>; setFavorite?: (sessionId: string, favorite: boolean) => Promise<void>; setInboxState?: (sessionId: string, patch: SessionInboxPatch) => Promise<void>; setSpace?: (sessionId: string, spaceId: string) => Promise<void>; views?: SidebarViewsHost }`, from `ChatHost`): Session list and management. Each method left out hides its control (rename, archive, favorite, delete).
- `shell?` (`(sessionId: string, command: string) => Promise<void>`, from `ChatHost`): Runs a `!` shell command in the session's folder, outside any agent run; its run streams into the
  transcript. Absent: a `!` prompt goes to the model as text.
- `showSteer?` (`(sessionId: string, steer: WaitingSteer) => void`, from `ChatHost`): Shows a message the session's run took as a steer (the queue answered `steer`) under its transcript until the
  agent reads it, or the run ends. Absent: a steer shows only once the agent reads it.
- `siteIcons?` (`ChatSiteIcons`, from `ChatHost`): Site icons for link badges. Absent: links show the globe.
- `toolCall?` (`(sessionId: string, callId: string, turnId?: string) => Promise<ToolCallDetail | null>`, from `ChatHost`): The whole of a tool call (its input, every hunk of its edit), when the
  event went out lean (`clipped.input`, `edit.clipped`). `turnId`: the
  call's turn, a hint where to look first.
- `toolMediaUrl?` (`(sessionId: string, callId: string, index: number) => string | undefined`, from `ChatHost`): Where the `index`-th image, video or audio block of a tool call's result
  loads from (`TranscriptActions.toolMediaUrl`); `undefined` when the host
  serves none.
- `toolOutput?` (`(sessionId: string, callId: string) => Promise<string | null>`, from `ChatHost`): A tool call's full output, when the event carries a preview only.
- `toolOutputRange?` (`(sessionId: string, callId: string, range: ToolOutputRange, turnId?: string) => Promise<ToolResultSlice | null>`, from `ChatHost`): One range of a tool call's full output (UTF-16 code units), when the event carries a preview only:
  the row then pages through it (`TOOL_OUTPUT_PAGE_SIZE` at a time) instead of reading it whole with
  `toolOutput`. `null` when the host holds no result for the call. `turnId`: the call's turn, a hint
  where to look first.
- `transcript` (`(sessionId: string) => Transcript`, from `ChatHost`): Returns the transcript store for a session.

Source: [ui/src/adapters/server-host.ts:92](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-host.ts#L92)

### `ServerMachinesHost`

Interface.

The [`MachinesHost`](https://zidane.si/docs/reference/ui-machines-headless.md#MachinesHost) [`createServerMachinesHost`](https://zidane.si/docs/reference/ui-adapters-server.md#createServerMachinesHost) returns.

```ts
interface ServerMachinesHost extends MachinesHost
```

**Properties**

- `addHost?` (`(input: { name?: string; token: string; url: string }) => Promise<HostCheckResult>`, from `MachinesHost`): Saves a server after checking it. Absent: no add form.
- `capabilities?` (`(hostId: string, options?: { refresh?: boolean }) => Promise<HostCapabilities>`, from `MachinesHost`): What a host can do (OS, tools on PATH, sandbox, environment kinds, what it allows, disk); `refresh` probes again
  instead of the backend's short cache. Rejects with a [`MachinesError`](https://zidane.si/docs/reference/ui-machines-headless.md#MachinesError) (`read`). Absent: no capabilities.
- `close` (`() => void`): Stops listening to the client (the client stays open).
- `daemon?` (`DaemonControl`, from `MachinesHost`): The local daemon. Absent: no daemon menu.
- `hosts?` (`Readable<HostsState>`, from `MachinesHost`): The hosts the app knows and their connection. Absent: no host list.
- `installTool?` (`(hostId: string, name: string) => Promise<ToolInstallResult>`, from `MachinesHost`): Installs a missing tool on a server, as its user, when the server's recipe needs no root (`toolInstall` says
  `run`); answers what it printed and the new capabilities. Rejects with a [`MachinesError`](https://zidane.si/docs/reference/ui-machines-headless.md#MachinesError) (`install`).
  Absent: no Install buttons.
- `linkedAccounts?` (`ServerLinkedAccounts`, from `MachinesHost`): The person's linked accounts on a server (Google, Slack): Link and Unlink. Absent: no Linked accounts section.
- `links?` (`MachineLinks`, from `MachinesHost`): This computer's machine links. Absent: no share or use rows.
- `machines?` (`MachinesDirectory`, from `MachinesHost`): The machines servers hold. Absent: no machine list.
- `newChat?` (`(hostId: string, machine?: string) => void`, from `MachinesHost`): Opens a new chat on `hostId`: on its machine named `machine` when given, else in the server's own folders. The
  app moves its draft there and shows it. Absent: no New chat buttons.
- `openWeb?` (`(hostId: string, sessionId?: string) => Promise<void>`, from `MachinesHost`): Opens a server's web app (`HostView.web`) in the system browser, on a session's page when named, never as one of
  the app's own links. Absent: the app's link opener takes the address.
- `organization?` (`ServerOrganization`, from `MachinesHost`): A server's organization mode: who you are, whether it shares, its people for an admin. Absent: no People section.
- `pairHost?` (`(input: { code: string; name?: string; url: string }) => Promise<HostCheckResult>`, from `MachinesHost`): Trades a one-time pairing code (`zidane server setup`, `zidane server pair`) for a device token named after this
  device, then saves the server like `MachinesHost.addHost`. A refused code answers `error: 'pairing'` with
  its reason. Absent: the add form takes a device token only.
- `permitted?` (`Readable<ReadonlySet<MachinesAction> | null>`, from `MachinesHost`): What the members may do right now; `null` while that is not known (not connected). Absent: everything they offer.
- `pickFolder?` (`() => Promise<string | null>`, from `MachinesHost`): Picks a folder to share (the native dialog). Absent: no Add a folder.
- `presence?` (`MachinesPresence`, from `MachinesHost`): Live per-session presence (attached windows, runs, waiting on you). Absent: no presence on the rows.
- `refreshHosts?` (`() => Promise<void>`, from `MachinesHost`): Reads the hosts again (after a setting changed).
- `removeHost?` (`(id: string) => Promise<void>`, from `MachinesHost`): Removes a saved server and its token. Rejects with a [`MachinesError`](https://zidane.si/docs/reference/ui-machines-headless.md#MachinesError). Absent: no Remove.
- `renameHost?` (`(id: string, name: string) => Promise<HostCheckResult>`, from `MachinesHost`): Renames a saved server. Absent: no Rename.
- `retry?` (`(hostId: string) => Promise<void>`, from `MachinesHost`): Reconnects to a server now instead of at the next backoff. Absent: no Retry.
- `savedHosts?` (`SavedHosts`, from `MachinesHost`): The saved-server registry with its dates. Absent: the hosts list shows the live statuses alone.
- `serverSignInProviders?` (`(url: string) => Promise<readonly string[]>`, from `MachinesHost`): The providers the server at `url` signs its users in with (none: it signs nobody in), before the add form offers
  a button for each. Absent: "Sign in with Google" shows whenever `signInToServer` is there.
- `setHostUrl?` (`(id: string, url: string) => Promise<HostCheckResult>`, from `MachinesHost`): Moves a saved server to a new URL with its saved token, once the same server answers there. Absent: no Change URL.
- `signIn?` (`(hostId: string, target: HostSignInTarget, onDone?: () => void) => SignInFlow`, from `MachinesHost`): Starts a browser sign-in whose tokens stay on `hostId` (the browser opens here); `onDone` runs once the server
  stored them. Absent: no "Sign in there".
- `signInToServer?` (`(input: { name?: string; provider: string; url: string }, onCode: (code: { userCode: string; verificationUrl: string }) => void, signal?: AbortSignal) => Promise<HostCheckResult>`, from `MachinesHost`): Sign in to an organization's server with a provider (`google`, `slack`) instead of a token (docs/IDENTITY.md),
  then save the server like `MachinesHost.addHost`. The provider's page opens in the browser; with Google's
  device flow, `onCode` shows the code and the link while the person signs in. Absent: no "Sign in with …".
- `sync?` (`HostSync`, from `MachinesHost`): Settings sync to a server and the server's record. Absent: no Sync section, no markers.
- `testHost?` (`(target: { id: string } | { token: string; url: string }) => Promise<HostCheckResult>`, from `MachinesHost`): Tests a saved server, or a URL and token before saving. Absent: no Test.
- `tokens?` (`ServerTokens`, from `MachinesHost`): A server's client tokens. Absent: no token list.
- `updates?` (`ServerUpdates`, from `MachinesHost`): A server's self-update. Absent: no update section.

Source: [ui/src/adapters/server-machines-host.ts:72](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-machines-host.ts#L72)

### `ServerMachinesHostOptions`

Interface.

Options for [`createServerMachinesHost`](https://zidane.si/docs/reference/ui-adapters-server.md#createServerMachinesHost).

```ts
interface ServerMachinesHostOptions
```

**Properties**

- `client` (`ServerClient`): The client to speak through, shared with the chat host (`createServerHost({ client })`) and other areas' hosts.
- `linkAccount?` (`(provider: string, signal: AbortSignal) => Promise<void>`): Links another account of `provider` to the person signed in (the app runs the provider's page and ends with
  `me.linkIdentity`). Absent: no Link in Linked accounts.
- `name?` (`string`): The server's name before (or without) the one its handshake reports. Default `zidane-server`.
- `newChat?` (`(hostId: string, machine?: string) => void`): Opens a new chat on the server, or on one of its machines (the app's own navigation). Absent: no `newChat`.
- `url?` (`string`): The server's `ws://` or `wss://` URL as a machine reaches it (a web page's own origin), for join codes.
  Absent: no `machines.invite`.

Source: [ui/src/adapters/server-machines-host.ts:52](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-machines-host.ts#L52)

### `ServerOnboardingHost`

Interface.

The [`OnboardingHost`](https://zidane.si/docs/reference/ui-onboarding-headless.md#OnboardingHost) [`createServerOnboardingHost`](https://zidane.si/docs/reference/ui-adapters-server.md#createServerOnboardingHost) returns.

```ts
interface ServerOnboardingHost extends OnboardingHost
```

**Properties**

- `appIcons?` (`{ list: Readable<readonly OnboardingAppIcon[]>; note?: string }`, from `OnboardingHost`): App icons for Look, for an app that has several. Absent: Look offers no icon.
- `close` (`() => void`): Stops open sign-ins and listening to the client (the client stays open).
- `commit` (`(result: OnboardingResult) => Promise<void>`, from `OnboardingHost`): Writes what a finished run decided. `result.server`: open the first session on that server.
- `connectors?` (`{ add: (id: string, input?: ConnectorInput) => Promise<void>; githubToken?: () => Promise<string | null>; installed: Readable<readonly string[]>; signIn?: (id: string) => SignInFlow }`, from `OnboardingHost`): Connectors. Absent: the step is left out.
- `context` (`Readable<OnboardingSetup | null>`, from `OnboardingHost`): What the wizard starts from. It is `null` while the app still detects.
- `extensions?` (`{ install: (name: string, onProgress?: (message: string) => void) => Promise<void>; installed: Readable<readonly string[]> }`, from `OnboardingHost`): Native extensions. Absent: the step is left out.
- `imports?` (`{ preview: () => Promise<OnboardingImportPreview>; run: (selection: OnboardingImportSelection) => Promise<void> }`, from `OnboardingHost`): Bring your setup. Absent: the step is left out.
- `providers` (`{ list: Readable<readonly OnboardingProvider[]>; models?: (key: string) => Promise<readonly OnboardingModelInfo[]>; saveKey?: (key: string, input: { fields?: Record<string, string>; value?: string }) => Promise<void>; signIn?: (key: string) => SignInFlow; test?: (key: string, model?: string) => Promise<ProviderTestResult> }`, from `OnboardingHost`): The providers Connect lists, and how to set them up.
- `servers?` (`{ machines: MachinesHost }`, from `OnboardingHost`): The Server step: add a zidane-server (`addHost`, `pairHost`, `signInToServer`), sign in to providers there
  (`signIn`) and sync this computer's setup to it (`sync.state`, `sync.configure`). The step reads the app's
  machines host. Adding a server turns on Remote hosts, so the host must accept an add while they are off. The
  run writes the sync with `sync.configure` once it is saved. Absent, or without `addHost` or
  `sync.configure`: the step is left out.
- `skills?` (`{ browse: (input: string) => Promise<SkillSourceListing>; images?: SkillSourceImages; install: (source: string, rels: readonly string[], onProgress?: (message: string) => void) => Promise<void>; installed: Readable<readonly string[]> }`, from `OnboardingHost`): Skills. Absent: the step is left out.
- `themes?` (`{ list: Readable<readonly Theme[]>; preview: (appearance: OnboardingAppearance | null) => void }`, from `OnboardingHost`): Themes for Look. Absent: the step is left out.

Source: [ui/src/adapters/server-onboarding-host.ts:99](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-onboarding-host.ts#L99)

### `ServerOnboardingHostOptions`

Interface.

Options for [`createServerOnboardingHost`](https://zidane.si/docs/reference/ui-adapters-server.md#createServerOnboardingHost).

```ts
interface ServerOnboardingHostOptions
```

**Properties**

- `appIcons?` (`{ list: Readable<readonly OnboardingAppIcon[]>; note?: string }`): The app icons Look offers, from the page. Absent: Look offers no icon.
- `canConfigure?` (`boolean`): `false` leaves out keys, sign-ins, connectors and extensions.
  Default: `client.can('auth.setApiKey')` once the handshake has landed, `true` before it.
- `client` (`ServerClient`): The client to speak through, shared with the chat host and other areas' hosts.
- `cwd?` (`string`): The folder on the server whose extension providers and catalog count. Absent: the server user's scope.
- `mode?` (`OnboardingMode`, default `'full'`): How much of the wizard runs.
- `oauthCallbackUrl?` (`string`): The server's `SERVER_OAUTH_CALLBACK_PATH` at the origin this page reaches it by: a connector's browser sign-in
  comes back there (a browser can't listen on a loopback port). Absent: no sign-in, a connector signs in on first use.
- `onCommitted?` (`(result: OnboardingResult) => void | Promise<void>`): Called once the settings are written, to apply what the server does not keep: the look, the model pick.
- `onError?` (`(error: unknown) => void`): Called with errors no caller receives (a failed listing). Default: a console warning.
- `surface?` (`OnboardingSurface`, default `'desktop'`): The app the wizard runs in.
- `themes?` (`{ list: Readable<readonly Theme[]>; preview: (appearance: OnboardingAppearance | null) => void }`): The themes Look offers and the live preview, from the page. Absent: no Look step.
- `windowSettings?` (`BrowserWindowSettings`): This browser's settings: the window rows stay here (`createBrowserWindowSettings`). Absent: every row goes to the server.

Source: [ui/src/adapters/server-onboarding-host.ts:61](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-onboarding-host.ts#L61)

### `ServerPaletteHost`

Interface.

The [`PaletteHost`](https://zidane.si/docs/reference/ui-palette-headless.md#PaletteHost) [`createServerPaletteHost`](https://zidane.si/docs/reference/ui-adapters-server.md#createServerPaletteHost) returns.

```ts
interface ServerPaletteHost extends PaletteHost
```

**Properties**

- `close` (`() => void`): Stops listening to the client (the client stays open).
- `extensions?` (`PaletteExtensions`, from `PaletteHost`): Extension-contributed items. Absent: no extensions source.
- `listCommands?` (`(query: PaletteCommandQuery) => Promise<readonly PaletteCommand[]>`, from `PaletteHost`): The `/` commands for a folder. Absent: no commands source.
- `listFiles?` (`(query: PaletteFileQuery) => Promise<readonly PaletteFileEntry[]>`, from `PaletteHost`): The project's files (without gitignored ones). Absent: no files source.
- `recents?` (`PaletteRecents`, from `PaletteHost`): Persistent recents. Absent: recents last as long as the page.
- `rerank?` (`(query: string, candidates: readonly RerankItem[]) => Promise<readonly string[] | null>`, from `PaletteHost`): Reorders the palette's best rows (every group) by meaning: their ids, best first, or `null` when the host does
  not (the setting is off, the query is one word, no model answered). Asked once a query settles; the rows on show
  never wait on it. Absent: the palette's own ranking stands.
- `searchConversations?` (`(query: PaletteConversationQuery) => Promise<readonly PaletteConversationHit[]>`, from `PaletteHost`): Content matches inside conversations, best first; a newer call may cancel an older scan (it then resolves
  with whatever it has, or rejects). Absent: no "In conversations" group.
- `setSettings?` (`(patch: Partial<Settings>) => Promise<void>`, from `PaletteHost`): Applies a settings patch. Absent: settings rows are not offered.
- `settings?` (`Readable<Partial<Settings>>`, from `PaletteHost`): The settings in effect, read when the palette lists its rows. Absent: no settings rows.

Source: [ui/src/adapters/server-palette-host.ts:43](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-palette-host.ts#L43)

### `ServerPaletteHostOptions`

Interface.

Options for [`createServerPaletteHost`](https://zidane.si/docs/reference/ui-adapters-server.md#createServerPaletteHost).

```ts
interface ServerPaletteHostOptions
```

**Properties**

- `client` (`ServerClient`): The client to speak through, shared with the chat host.
- `onError?` (`(error: unknown) => void`): Called with errors no caller can receive (a failed watch of the extensions' items). Default: a console warning.
- `recents?` (`PaletteRecents`): Where recents persist. Default: in memory.
- `windowSettings?` (`BrowserWindowSettings`): This browser's settings: the window rows stay here (`createBrowserWindowSettings`). Absent: every row goes to the server.

Source: [ui/src/adapters/server-palette-host.ts:31](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-palette-host.ts#L31)

### `ServerProjectsClient`

Interface.

What [`createServerSessionProjects`](https://zidane.si/docs/reference/ui-adapters-server.md#createServerSessionProjects) needs of a server's connection: a `ServerClient` is one.

```ts
interface ServerProjectsClient
```

**Properties**

- `call` (`<M extends keyof IpcMethods>(method: M, params: IpcParams<M>) => Promise<IpcResult<M>>`): Calls a method. A refusal rejects as a `ServerCallError` with its code.
- `can` (`(method: keyof IpcMethods) => boolean`): Whether this connection may call `method`.
- `hello` (`() => Pick<HelloResult, 'identity'> | null`): The current connection's hello: whether it names who the connection is (organization mode). `null` while not open.
- `onOpen` (`(listener: (hello: unknown, reconnected: boolean) => void) => () => void`): Called after every handshake, `reconnected` after the first; returns its unsubscribe.
- `onSignal` (`(listener: (signal: ServerProjectsSignal) => void) => () => void`): Called with every signal the projects hear; returns its unsubscribe.

Source: [ui/src/adapters/server-projects.ts:63](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-projects.ts#L63)

### `ServerSessionDirectory`

Interface.

The directory and the stores its rows read live.

```ts
interface ServerSessionDirectory
```

**Properties**

- `activity` (`SessionActivityStore`): What each session's run does now.
- `badges` (`SessionBadgesStore`): Each session's artifact badges.
- `directory` (`SessionDirectory<ServerDirectorySession, Partial<Pick<CreateSessionParams, 'environment' | 'cwd' | 'modelOptions' | 'agentId' | 'providerKey' | 'modelId' | 'account' | 'effort' | 'projectId'>>>`): The directory; `create` takes the new session's folder (`cwd`, none by default) and picks.
- `estimates` (`RunEstimatesStore`): How long each session's runs have left: the rows and the transcript's subagent headers read it.
- `running` (`KeyedStore<boolean, false>`): Which session runs now, per session id (`false` while unknown).
- `start` (`() => () => void`): Starts following the server; returns the stop.

Source: [ui/src/adapters/server-session-directory.ts:147](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-session-directory.ts#L147)

### `ServerSessionDirectoryOptions`

Interface.

Options for [`createServerSessionDirectory`](https://zidane.si/docs/reference/ui-adapters-server.md#createServerSessionDirectory).

```ts
interface ServerSessionDirectoryOptions
```

**Properties**

- `hosts` (`Pick<ServerAppHosts, 'host' | 'client'>`): The app's hosts and their client (`createServerAppHost`).
- `storage?` (`Storage`): Synchronous storage for the sidebar's views on this device. Absent: they last as long as the app runs, and the server's copy.

Source: [ui/src/adapters/server-session-directory.ts:139](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-session-directory.ts#L139)

### `ServerSessionHost`

Interface.

The [`SessionHost`](https://zidane.si/docs/reference/ui-session-headless.md#SessionHost) [`createServerSessionHost`](https://zidane.si/docs/reference/ui-adapters-server.md#createServerSessionHost) returns.

```ts
interface ServerSessionHost extends SessionHost
```

**Properties**

- `artifacts?` (`SessionArtifacts`, from `SessionHost`): The recorded artifacts. Absent: no Artifacts panel.
- `close` (`() => void`): Stops listening to the client (it leaves the client open).
- `details?` (`SessionDetailsActions`, from `SessionHost`): The details dialog's actions. Absent: the dialog shows facts only.
- `links?` (`(sessionId: string, turnId?: string) => Promise<SessionLinks | null>`, from `SessionHost`): A session's links (docs/LINKS.md), or one of its messages' (`turnId`); `null`: it has none now. Absent: no Copy
  link, no Open on phone, no Copy message link.
- `openInApp?` (`(sessionId: string, turnId?: string) => void`, from `SessionHost`): Hands the session (on its message `turnId`) to the installed app on this device: the web app opens its `zidane://` link. Absent: no Open in the app.
- `pinSession?` (`(sessionId: string) => () => void`, from `SessionHost`): Keeps a session's transcript cached while it shows besides the open conversation (a `/side` chat), until the
  returned unpin runs. The app implements it over its session directory (`SessionDirectory.pin`). Absent: nothing
  keeps it, and the transcript cache may drop it while it shows.
- `plans?` (`SessionPlans`, from `SessionHost`): The plans. Absent: no Todos panel.
- `ports?` (`SessionPorts`, from `SessionHost`): The ports listening in a session's environment. Absent: no ports anywhere.
- `projects?` (`SessionProjects`, from `SessionHost`): Projects (`Settings.projectHome`). Absent: the project home keeps its layout in the window, and offers no project settings.
- `projectsOf?` (`(hostId?: string) => Readable<SessionProjects | undefined>`, from `SessionHost`): The projects of a host this window reaches, by its id (a session's host, a machine's id): no id, or the window's
  own host's, is `projects`. The store holds `undefined` while that host offers none here (not connected yet, gone,
  no projects). The same store for the same id. Absent: only `projects`.
- `queue?` (`SessionQueue`, from `SessionHost`): The type-ahead queues. Absent: no queue.
- `runningWork?` (`SessionRunningWork`, from `SessionHost`): The cancellable work. Absent: no running work dialog.
- `schedules?` (`SessionSchedules`, from `SessionHost`): Reminders (zidane's schedules). Absent: no Reminders panel, no badge.
- `secrets?` (`SessionSecrets`, from `SessionHost`): The saved secrets of a session's project. Absent: no Secrets panel.
- `sharing?` (`SessionSharingHost`, from `SessionHost`): Sharing the session with people of the organization (docs/MULTIPLAYER.md). Absent: no "Share…".
- `side?` (`SessionSideChats`, from `SessionHost`): `/side` chats about a session. Absent: no side chat.
- `turns?` (`SessionTurns`, from `SessionHost`): The stored turns. Absent: no turn details dialog.
- `usage?` (`SessionUsage`, from `SessionHost`): Usage. Absent: no usage card, no usage panel.

Source: [ui/src/adapters/server-session-host.ts:160](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-session-host.ts#L160)

### `ServerSessionHostOptions`

Interface.

Options for [`createServerSessionHost`](https://zidane.si/docs/reference/ui-adapters-server.md#createServerSessionHost).

```ts
interface ServerSessionHostOptions
```

**Properties**

- `client` (`ServerClient`): The client to speak through, shared with the chat host (`createServerHost(…).client`).
- `linkAddress?` (`string`): The address this client reaches the server at: a session's links (docs/LINKS.md) name the server by its hello's
  `clientUrl`, else by this. Absent: no links.
- `oauthCallbackUrl?` (`string`): The server's `SERVER_OAUTH_CALLBACK_PATH` at the origin this page reaches it by. Absent: no project MCP sign-in.
- `openInApp?` (`(link: string) => void`): Opens a session's `zidane://` link on this device (the web app navigates to it). Absent: no Open in the app.
- `portsPollMs?` (`number`, default `3000`): How often a session's ports are read while shown (`ports.list`).
- `saveExport?` (`(file: { content: string; filename: string; format: SessionExportFormat }) => Promise<string>`): Hands an exported transcript to the user (a browser download) and resolves what to show as where it went.
  Absent: no export.

Source: [ui/src/adapters/server-session-host.ts:138](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-session-host.ts#L138)

### `ServerSessionProjects`

Interface.

What [`createServerSessionProjects`](https://zidane.si/docs/reference/ui-adapters-server.md#createServerSessionProjects) returns: the host's projects, and how to stop listening.

```ts
interface ServerSessionProjects
```

**Properties**

- `close` (`() => void`): Stops listening to the server's signals.
- `projects` (`SessionProjects`): The server's projects, as the session host offers them.

Source: [ui/src/adapters/server-projects.ts:77](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-projects.ts#L77)

### `ServerSettingsHost`

Interface.

The [`SettingsHost`](https://zidane.si/docs/reference/ui-settings-headless.md#SettingsHost) [`createServerSettingsHost`](https://zidane.si/docs/reference/ui-adapters-server.md#createServerSettingsHost) returns.

```ts
interface ServerSettingsHost extends SettingsHost
```

**Properties**

- `claudeImport?` (`SettingsClaudeImportHost`, from `SettingsHost`): Importing the Claude Code setup of the host's machine. Absent: no import.
- `close` (`() => void`): Stops listening to the client (the client stays open).
- `document` (`Readable<SettingsDocument>`, from `SettingsHost`): The settings document: `loading` until first read.
- `environments?` (`SettingsEnvironmentsHost`, from `SettingsHost`): Where new sessions run (Settings › Environments).
- `extensions?` (`SettingsExtensionsHost`, from `SettingsHost`): Extensions on disk for a folder (Settings › Extensions).
- `hostCatalog?` (`SettingsHostCatalog`, from `SettingsHost`): The host's own catalogs with its enabled state (a server's Skills, MCP servers, Extensions, Plugins).
- `instructions?` (`SettingsInstructionsHost`, from `SettingsHost`): What a session's agent is loaded with (Settings › Instructions).
- `logs?` (`SettingsLogsHost`, from `SettingsHost`): The host's log funnel (Settings › Logs).
- `mcp?` (`SettingsMcpHost`, from `SettingsHost`): A folder's MCP servers, their sign-ins and tests (Settings › MCP servers). Absent: no servers to show.
- `models?` (`SettingsModelsHost`, from `SettingsHost`): The model rows' decision catalog, tests and last used model (Settings › Agent). Absent: rows without them.
- `paths?` (`SettingsPaths`, from `SettingsHost`): Opening the host's paths in other apps (reveal, open in the editor).
- `performance?` (`SettingsPerformanceHost`, from `SettingsHost`): What the app's processes and threads use, live (Settings › Performance). Absent: an empty page.
- `plugins?` (`SettingsPluginsHost`, from `SettingsHost`): Agent Plugins for a folder (Settings › Plugins).
- `providers?` (`SettingsProvidersHost`, from `SettingsHost`): The providers the host's agents sign in to (Settings › Accounts). Absent: no providers to show.
- `refresh` (`() => Promise<void>`, from `SettingsHost`): Reads the settings again and tells subscribers. Never rejects: a failure lands in `document` (when nothing was read yet).
- `skillGroups?` (`SettingsSkillGroupsHost`, from `SettingsHost`): Skill groups for a folder (Settings › Skills, both this computer's and a host's catalog). Absent: no groups.
- `skills?` (`SettingsSkillsHost`, from `SettingsHost`): Skills on disk for a folder (Settings › Skills). Absent: no skills section content.
- `targets?` (`Readable<SettingsTargets>`, from `SettingsHost`): Where each scope's rows live: the page's scope chip, and the badge of a row whose scope differs from its
  page's. Absent: no chip.
- `update?` (`(patch: Partial<Settings>) => Promise<void>`, from `SettingsHost`): Applies a patch: `document` shows it at once, then what the host holds
  after the write. Rejects with a [`SettingsError`](https://zidane.si/docs/reference/ui-settings-headless.md#SettingsError) when the write is
  refused, and `document` goes back to what the host holds. Absent: read-only.
- `writable?` (`Readable<boolean>`, from `SettingsHost`): Whether `update` may run now (a server that does not offer `settings.set` may not). Absent: whenever `update` is there.

Source: [ui/src/adapters/server-settings-host.ts:58](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-settings-host.ts#L58)

### `ServerSettingsHostOptions`

Interface.

Options for [`createServerSettingsHost`](https://zidane.si/docs/reference/ui-adapters-server.md#createServerSettingsHost).

```ts
interface ServerSettingsHostOptions
```

**Properties**

- `client` (`ServerClient`): The shared client (`createServerClient`).
- `name?` (`string`): The server's name before its handshake reports one (`targets`).
- `oauthCallbackUrl?` (`string`): The server's `SERVER_OAUTH_CALLBACK_PATH` at the origin this page reaches it by: an MCP server's sign-in
  comes back there (a browser can't listen on a loopback port). Absent: no MCP sign-in.
- `windowSettings?` (`BrowserWindowSettings`): This browser's settings: the window rows stay here (`createBrowserWindowSettings`). Absent: every row goes to the server.

Source: [ui/src/adapters/server-settings-host.ts:43](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-settings-host.ts#L43)

### `ServerSidebarHostOptions`

Interface.

Options for [`createServerSidebarHost`](https://zidane.si/docs/reference/ui-adapters-server.md#createServerSidebarHost).

```ts
interface ServerSidebarHostOptions
```

**Properties**

- `client` (`ServerClient`): The client to speak through, shared with the chat host (`createServerHost(…).client`).

Source: [ui/src/adapters/server-sidebar-host.ts:22](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-sidebar-host.ts#L22)

### `ServerTerminalHostOptions`

Interface.

Options for [`createServerTerminalHost`](https://zidane.si/docs/reference/ui-adapters-server.md#createServerTerminalHost).

```ts
interface ServerTerminalHostOptions
```

**Properties**

- `client` (`ServerClient`): The client to speak through, shared with the chat host (`createServerHost({ client })`) and other areas' hosts.

Source: [ui/src/adapters/server-terminal-host.ts:20](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-terminal-host.ts#L20)

### `ServerViewsHostOptions`

Interface.

Options for [`createServerViewsHost`](https://zidane.si/docs/reference/ui-adapters-server.md#createServerViewsHost).

```ts
interface ServerViewsHostOptions
```

**Properties**

- `afterText?` (`(sessionId: string, action: () => void) => void`): Holds a session's `views:changed` until the reply text streamed before it has shown (the chat host's
  `afterText`), so a fence's stored view takes over from its draft once the draft has drawn whole. Absent: at once.
- `client` (`ServerClient`): The client to speak through, shared with the chat host (`createServerHost(…).client`).
- `customFrames?` (`ServerCustomFramesOptions`): Where Custom pages are minted: the server's origin and the token
  (`POST /zidane/views/custom`). Absent, or a server without
  `views.reportProblem`: `<Custom>` shows its title and alt text.
- `oauthCallbackUrl?` (`string`): The server's `SERVER_OAUTH_CALLBACK_PATH` at the origin this page reaches
  it by: "Sign in" on an MCP source's line signs in to its server there.
  Absent: no Sign in.

Source: [ui/src/adapters/server-views-host.ts:30](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-views-host.ts#L30)

### `SessionBinding`

Interface.

The folders the app has a session open on, for the hosts that read a folder through a session.

```ts
interface SessionBinding
```

**Properties**

- `sessionOf` (`(cwd: string) => string | undefined`): The session open on `cwd`, if any.
- `set` (`(sessionId: string | null, cwd: string) => void`): The session on screen and its folder (`null`: none).

Source: [ui/src/adapters/server-app-host.ts:70](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-app-host.ts#L70)

## Types

### `ActionResult`

Type.

An action's answer as the kit types it: a failure's reason becomes a `failed` error.

```ts
type ActionResult<T extends { ok: true }> =
  | T
  | { error: { code: 'failed'; message: string }; ok: false }
```

**Type parameters**

- `T` (`extends { ok: true }`)

Source: [ui/src/adapters/results.ts:35](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/results.ts#L35)

### `ExtensionHostModule`

Type.

A module namespace (`import * as React from 'react'`).

```ts
type ExtensionHostModule = Readonly<Record<string, unknown>>
```

Source: [ui/src/adapters/extension-modules.ts:28](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/extension-modules.ts#L28)

### `ExtensionHostModules`

Type.

Host modules by specifier: what the app hands the extensions' components.

```ts
type ExtensionHostModules = Readonly<Record<string, ExtensionHostModule>>
```

Source: [ui/src/adapters/extension-modules.ts:31](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/extension-modules.ts#L31)

### `ExtensionHostModuleSources`

Type.

Host modules by specifier, each a namespace or a loader of one (a function resolving the namespace): a
loader runs the first time a bundle imports its specifier, so the app's first load stays small.

```ts
type ExtensionHostModuleSources = Readonly<Record<string, ExtensionHostModule | (() => Promise<ExtensionHostModule>)>>
```

Source: [ui/src/adapters/extension-modules.ts:37](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/extension-modules.ts#L37)

### `ExtensionInvokeWire`

Type.

A callback's request as `extensions.ui.invoke` carries it, without the folder it runs in.

```ts
type ExtensionInvokeWire = IpcParams<'extensions.ui.invoke'> extends infer R ? R extends unknown ? Omit<R, 'cwd'> : never : never
```

Source: [ui/src/adapters/extension-protocol.ts:12](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/extension-protocol.ts#L12)

### `ExtensionUiClientRequest`

Type.

A UI request an extension routed to this window (`ui:client`): a panel, navigation, a composer edit, a notification, a chord.

```ts
type ExtensionUiClientRequest = Extract<HostSignal, { kind: 'ui:client' }>['request']
```

Source: [ui/src/adapters/extension-protocol.ts:15](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/extension-protocol.ts#L15)

### `PairError`

Type.

Why a pairing failed: the server's own reasons, or the request never got an answer it understands.

```ts
type PairError = ServerPairFailure
```

Source: [ui/src/adapters/server-pairing.ts:18](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-pairing.ts#L18)

### `PairFetch`

Type.

The part of `fetch` pairing uses.

```ts
type PairFetch = NonNullable<PairBrowserOptions['fetch']>
```

Source: [ui/src/adapters/server-pairing.ts:24](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-pairing.ts#L24)

### `PairResult`

Type.

What pairing answered.

```ts
type PairResult = ({ ok: true } & PairedBrowser) | { error: PairError; ok: false }
```

Source: [ui/src/adapters/server-pairing.ts:21](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-pairing.ts#L21)

### `ServerActionAnswer`

Type.

What a server action answers: its result, or the server's reason it failed.

```ts
type ServerActionAnswer<T extends { ok: true }> = T | { error: string; ok: false }
```

**Type parameters**

- `T` (`extends { ok: true }`)

Source: [ui/src/adapters/results.ts:32](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/results.ts#L32)

### `ServerClientState`

Type.

Where a [`ServerClient`](https://zidane.si/docs/reference/ui-adapters-server.md#ServerClient)'s connection is.

```ts
type ServerClientState =
  | { attempt: number; status: 'connecting' }
  | { hello: HelloResult; status: 'open' }
  | { attempt: number; error: string; inMs: number; status: 'retrying' }
  | { message: string; reason: ServerRefusal; status: 'refused' }
  | { status: 'closed' }
```

Source: [dist/ipc/browser.d.ts:270](https://github.com/Tahul/zidane/blob/main/dist/ipc/browser.d.ts#L270)

### `ServerDirectoryCreateInput`

Type.

What a new session starts with: its folder (none by default), where it runs (a machine's kind), and the new-session defaults' picks.

```ts
type ServerDirectoryCreateInput = Partial<Pick<IpcParams<'sessions.create'>, 'cwd' | 'agentId' | 'providerKey' | 'modelId' | 'account' | 'effort' | 'modelOptions' | 'projectId' | 'environment'>>
```

Source: [ui/src/adapters/server-session-directory.ts:61](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-session-directory.ts#L61)

### `ServerDirectoryHost`

Type.

What [`serverDirectoryPorts`](https://zidane.si/docs/reference/ui-adapters-server.md#serverDirectoryPorts) reads of the chat host.

```ts
type ServerDirectoryHost = Pick<ServerHost, 'prefetch' | 'holdsTranscript'>
```

Source: [ui/src/adapters/server-directory.ts:25](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-directory.ts#L25)

### `ServerDirectoryPorts`

Type.

The directory's ports over a server chat host: spread into `createSessionDirectory`'s options.

```ts
type ServerDirectoryPorts = Pick<SessionDirectoryOptions<SidebarListSession, void>, 'streams' | 'loadEvents'> & { prewarm: { idleWindow: false } }
```

Source: [ui/src/adapters/server-directory.ts:28](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-directory.ts#L28)

### `ServerDirectorySession`

Type.

A sidebar row with the session's picks.

```ts
type ServerDirectorySession = SidebarListSession & ComposerSessionView & { environment?: SessionEnvironmentSummary; modelId?: string; providerKey?: string; runEstimates?: SessionRow['runEstimates']; sharing?: SessionRow['sharing']; startedFrom?: SessionRow['startedFrom'] }
```

Source: [ui/src/adapters/server-session-directory.ts:42](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-session-directory.ts#L42)

### `ServerHostOptions`

Type.

Options for [`createServerHost`](https://zidane.si/docs/reference/ui-adapters-server.md#createServerHost): a client to share, or what to create one with.

```ts
type ServerHostOptions = ({ client: ServerClient } | (Omit<ServerClientOptions, 'onState'> & { client?: undefined })) & { accounts?: ChatAccounts; cwd?: string; onError?: (error: unknown) => void; smooth?: () => boolean }
```

Source: [ui/src/adapters/server-host.ts:66](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-host.ts#L66)

### `ServerProjectsSignal`

Type.

A signal the projects hear: the server's, or `settings:changed` without the settings (a bridge keeps them on the server).

```ts
type ServerProjectsSignal = HostSignal | { kind: 'settings:changed' }
```

Source: [ui/src/adapters/server-projects.ts:60](https://github.com/Tahul/zidane/blob/main/ui/src/adapters/server-projects.ts#L60)
