# zidane-ui/palette/headless

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

## Functions

### `actionsSource`

Function.

The app's key actions as palette entries: whatever the app has a handler for right now, titled for reading (the
catalog's labels are footer hints), grouped, and carrying the live chord.

```ts
function actionsSource(
  handlers: Partial<Record<KeyAction, () => void>> | (() => Partial<Record<KeyAction, () => void>>),
  bindings: PaletteBindings,
  labels: { paletteActionTitles: Record<string, string>; paletteAppearanceMode: Record<'dark' | 'light' | 'system', string>; paletteAppearanceModeHint: string; paletteAppearanceSettings: string; paletteCloseSidePanel: string; paletteCodeCompletion: string; paletteCommandGone: string; paletteCommandsGroup: string; paletteCompactTranscript: string; paletteCompactTranscriptHint: string; paletteConversationsGroup: string; paletteDiagnostics: Record<'off' | 'lsp' | 'tools', string>; paletteDiagnosticsHint: string; paletteEditFiles: string; paletteEditorGroup: string; paletteEditorSettings: string; paletteFileCount: (count: number) => string; paletteFilesGroup: string; paletteFilesPlaceholder: string; paletteFilesTitle: string; paletteFilesTreeSide: Record<'right' | 'left', string>; paletteFilesTreeSideHint: string; paletteGoToFile: string; paletteHoverDocs: string; paletteImportRepo: string; paletteImportRepoHint: string; paletteMatchCount: (count: number) => string; paletteModelGroup: string; paletteNavigateGroup: string; paletteNeedsLsp: string; paletteNeedsSession: string; paletteOpenAndFind: string; paletteOpenFile: string; paletteOpenSidePanel: string; palettePanelAttention: (count: number, waiting: boolean) => string; palettePanelsGroup: string; palettePanelTitle: (label: string) => string; paletteReducedMotion: string; paletteSearchPlaceholder: string; paletteSessionActionsGroup: string; paletteSessionCurrent: string; paletteSessionsGroup: string; paletteSessionStatus: Record<'error' | 'attention' | 'running' | 'pending', string>; paletteSettingsGroup: string; paletteShowLegacyModels: string; paletteShowLegacyModelsHint: string; paletteSidebarRunDetails: string; paletteSidebarRunDetailsHint: string; paletteSwitchToSession: string; paletteUnavailable: string; paletteUntitledSession: string; paletteViewGroup: string; paletteWordWrap: string },
): PaletteProvider
```

**Parameters**

- `handlers` (`Partial<Record<KeyAction, () => void>> | (() => Partial<Record<KeyAction, () => void>>)`): The app's key action handlers, or a getter read when the palette lists and runs them (a key
  command registry's `get`).
- `bindings` (`PaletteBindings`): The live chords.
- `labels` (`{ paletteActionTitles: Record<string, string>; paletteAppearanceMode: Record<'dark' | 'light' | 'system', string>; paletteAppearanceModeHint: string; paletteAppearanceSettings: string; paletteCloseSidePanel: string; paletteCodeCompletion: string; paletteCommandGone: string; paletteCommandsGroup: string; paletteCompactTranscript: string; paletteCompactTranscriptHint: string; paletteConversationsGroup: string; paletteDiagnostics: Record<'off' | 'lsp' | 'tools', string>; paletteDiagnosticsHint: string; paletteEditFiles: string; paletteEditorGroup: string; paletteEditorSettings: string; paletteFileCount: (count: number) => string; paletteFilesGroup: string; paletteFilesPlaceholder: string; paletteFilesTitle: string; paletteFilesTreeSide: Record<'right' | 'left', string>; paletteFilesTreeSideHint: string; paletteGoToFile: string; paletteHoverDocs: string; paletteImportRepo: string; paletteImportRepoHint: string; paletteMatchCount: (count: number) => string; paletteModelGroup: string; paletteNavigateGroup: string; paletteNeedsLsp: string; paletteNeedsSession: string; paletteOpenAndFind: string; paletteOpenFile: string; paletteOpenSidePanel: string; palettePanelAttention: (count: number, waiting: boolean) => string; palettePanelsGroup: string; palettePanelTitle: (label: string) => string; paletteReducedMotion: string; paletteSearchPlaceholder: string; paletteSessionActionsGroup: string; paletteSessionCurrent: string; paletteSessionsGroup: string; paletteSessionStatus: Record<'error' | 'attention' | 'running' | 'pending', string>; paletteSettingsGroup: string; paletteShowLegacyModels: string; paletteShowLegacyModelsHint: string; paletteSidebarRunDetails: string; paletteSidebarRunDetailsHint: string; paletteSwitchToSession: string; paletteUnavailable: string; paletteUntitledSession: string; paletteViewGroup: string; paletteWordWrap: string }`): The palette labels.

**Returns** `PaletteProvider`

Source: [ui/src/palette/headless/app-sources.ts:81](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/app-sources.ts#L81)

### `commandsSource`

Function.

`/` commands (built-in and extension) for the session's folder, from the
host that runs them. Running one hands the composer a prompt (`/name`), or
an insert (`/name `) when the command completes arguments.

```ts
function commandsSource(
  host: Pick<PaletteHost, 'listCommands'>,
  labels: { paletteActionTitles: Record<string, string>; paletteAppearanceMode: Record<'dark' | 'light' | 'system', string>; paletteAppearanceModeHint: string; paletteAppearanceSettings: string; paletteCloseSidePanel: string; paletteCodeCompletion: string; paletteCommandGone: string; paletteCommandsGroup: string; paletteCompactTranscript: string; paletteCompactTranscriptHint: string; paletteConversationsGroup: string; paletteDiagnostics: Record<'off' | 'lsp' | 'tools', string>; paletteDiagnosticsHint: string; paletteEditFiles: string; paletteEditorGroup: string; paletteEditorSettings: string; paletteFileCount: (count: number) => string; paletteFilesGroup: string; paletteFilesPlaceholder: string; paletteFilesTitle: string; paletteFilesTreeSide: Record<'right' | 'left', string>; paletteFilesTreeSideHint: string; paletteGoToFile: string; paletteHoverDocs: string; paletteImportRepo: string; paletteImportRepoHint: string; paletteMatchCount: (count: number) => string; paletteModelGroup: string; paletteNavigateGroup: string; paletteNeedsLsp: string; paletteNeedsSession: string; paletteOpenAndFind: string; paletteOpenFile: string; paletteOpenSidePanel: string; palettePanelAttention: (count: number, waiting: boolean) => string; palettePanelsGroup: string; palettePanelTitle: (label: string) => string; paletteReducedMotion: string; paletteSearchPlaceholder: string; paletteSessionActionsGroup: string; paletteSessionCurrent: string; paletteSessionsGroup: string; paletteSessionStatus: Record<'error' | 'attention' | 'running' | 'pending', string>; paletteSettingsGroup: string; paletteShowLegacyModels: string; paletteShowLegacyModelsHint: string; paletteSidebarRunDetails: string; paletteSidebarRunDetailsHint: string; paletteSwitchToSession: string; paletteUnavailable: string; paletteUntitledSession: string; paletteViewGroup: string; paletteWordWrap: string },
  options?: CommandsSourceOptions,
): PaletteProvider
```

**Parameters**

- `host` (`Pick<PaletteHost, 'listCommands'>`): Lists the commands (`listCommands`).
- `labels` (`{ paletteActionTitles: Record<string, string>; paletteAppearanceMode: Record<'dark' | 'light' | 'system', string>; paletteAppearanceModeHint: string; paletteAppearanceSettings: string; paletteCloseSidePanel: string; paletteCodeCompletion: string; paletteCommandGone: string; paletteCommandsGroup: string; paletteCompactTranscript: string; paletteCompactTranscriptHint: string; paletteConversationsGroup: string; paletteDiagnostics: Record<'off' | 'lsp' | 'tools', string>; paletteDiagnosticsHint: string; paletteEditFiles: string; paletteEditorGroup: string; paletteEditorSettings: string; paletteFileCount: (count: number) => string; paletteFilesGroup: string; paletteFilesPlaceholder: string; paletteFilesTitle: string; paletteFilesTreeSide: Record<'right' | 'left', string>; paletteFilesTreeSideHint: string; paletteGoToFile: string; paletteHoverDocs: string; paletteImportRepo: string; paletteImportRepoHint: string; paletteMatchCount: (count: number) => string; paletteModelGroup: string; paletteNavigateGroup: string; paletteNeedsLsp: string; paletteNeedsSession: string; paletteOpenAndFind: string; paletteOpenFile: string; paletteOpenSidePanel: string; palettePanelAttention: (count: number, waiting: boolean) => string; palettePanelsGroup: string; palettePanelTitle: (label: string) => string; paletteReducedMotion: string; paletteSearchPlaceholder: string; paletteSessionActionsGroup: string; paletteSessionCurrent: string; paletteSessionsGroup: string; paletteSessionStatus: Record<'error' | 'attention' | 'running' | 'pending', string>; paletteSettingsGroup: string; paletteShowLegacyModels: string; paletteShowLegacyModelsHint: string; paletteSidebarRunDetails: string; paletteSidebarRunDetailsHint: string; paletteSwitchToSession: string; paletteUnavailable: string; paletteUntitledSession: string; paletteViewGroup: string; paletteWordWrap: string }`): The group and disabled wording.
- `options?` (`CommandsSourceOptions`, default `{}`): Which server the active session runs on.

**Returns** `PaletteProvider`

Source: [ui/src/palette/headless/sources.ts:50](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/sources.ts#L50)

### `conversationItem`

Function.

A content hit as a palette item: the session's title, the excerpt as its description.

```ts
function conversationItem(
  hit: PaletteConversationHit,
  session: PaletteSession,
  query: string,
  labels: { paletteActionTitles: Record<string, string>; paletteAppearanceMode: Record<'dark' | 'light' | 'system', string>; paletteAppearanceModeHint: string; paletteAppearanceSettings: string; paletteCloseSidePanel: string; paletteCodeCompletion: string; paletteCommandGone: string; paletteCommandsGroup: string; paletteCompactTranscript: string; paletteCompactTranscriptHint: string; paletteConversationsGroup: string; paletteDiagnostics: Record<'off' | 'lsp' | 'tools', string>; paletteDiagnosticsHint: string; paletteEditFiles: string; paletteEditorGroup: string; paletteEditorSettings: string; paletteFileCount: (count: number) => string; paletteFilesGroup: string; paletteFilesPlaceholder: string; paletteFilesTitle: string; paletteFilesTreeSide: Record<'right' | 'left', string>; paletteFilesTreeSideHint: string; paletteGoToFile: string; paletteHoverDocs: string; paletteImportRepo: string; paletteImportRepoHint: string; paletteMatchCount: (count: number) => string; paletteModelGroup: string; paletteNavigateGroup: string; paletteNeedsLsp: string; paletteNeedsSession: string; paletteOpenAndFind: string; paletteOpenFile: string; paletteOpenSidePanel: string; palettePanelAttention: (count: number, waiting: boolean) => string; palettePanelsGroup: string; palettePanelTitle: (label: string) => string; paletteReducedMotion: string; paletteSearchPlaceholder: string; paletteSessionActionsGroup: string; paletteSessionCurrent: string; paletteSessionsGroup: string; paletteSessionStatus: Record<'error' | 'attention' | 'running' | 'pending', string>; paletteSettingsGroup: string; paletteShowLegacyModels: string; paletteShowLegacyModelsHint: string; paletteSidebarRunDetails: string; paletteSidebarRunDetailsHint: string; paletteSwitchToSession: string; paletteUnavailable: string; paletteUntitledSession: string; paletteViewGroup: string; paletteWordWrap: string },
): PaletteItem
```

**Parameters**

- `hit` (`PaletteConversationHit`): The host's hit.
- `session` (`PaletteSession`): The loaded session it names.
- `query` (`string`): The query it matched.
- `labels` (`{ paletteActionTitles: Record<string, string>; paletteAppearanceMode: Record<'dark' | 'light' | 'system', string>; paletteAppearanceModeHint: string; paletteAppearanceSettings: string; paletteCloseSidePanel: string; paletteCodeCompletion: string; paletteCommandGone: string; paletteCommandsGroup: string; paletteCompactTranscript: string; paletteCompactTranscriptHint: string; paletteConversationsGroup: string; paletteDiagnostics: Record<'off' | 'lsp' | 'tools', string>; paletteDiagnosticsHint: string; paletteEditFiles: string; paletteEditorGroup: string; paletteEditorSettings: string; paletteFileCount: (count: number) => string; paletteFilesGroup: string; paletteFilesPlaceholder: string; paletteFilesTitle: string; paletteFilesTreeSide: Record<'right' | 'left', string>; paletteFilesTreeSideHint: string; paletteGoToFile: string; paletteHoverDocs: string; paletteImportRepo: string; paletteImportRepoHint: string; paletteMatchCount: (count: number) => string; paletteModelGroup: string; paletteNavigateGroup: string; paletteNeedsLsp: string; paletteNeedsSession: string; paletteOpenAndFind: string; paletteOpenFile: string; paletteOpenSidePanel: string; palettePanelAttention: (count: number, waiting: boolean) => string; palettePanelsGroup: string; palettePanelTitle: (label: string) => string; paletteReducedMotion: string; paletteSearchPlaceholder: string; paletteSessionActionsGroup: string; paletteSessionCurrent: string; paletteSessionsGroup: string; paletteSessionStatus: Record<'error' | 'attention' | 'running' | 'pending', string>; paletteSettingsGroup: string; paletteShowLegacyModels: string; paletteShowLegacyModelsHint: string; paletteSidebarRunDetails: string; paletteSidebarRunDetailsHint: string; paletteSwitchToSession: string; paletteUnavailable: string; paletteUntitledSession: string; paletteViewGroup: string; paletteWordWrap: string }`): The palette labels.

**Returns** `PaletteItem`

Source: [ui/src/palette/headless/session-sources.ts:177](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/session-sources.ts#L177)

### `conversationItemId`

Function.

The palette item id of a content match.

```ts
function conversationItemId(target: ConversationTarget): string
```

**Parameters**

- `target` (`ConversationTarget`): The session and the query.

**Returns** `string`

Source: [ui/src/palette/headless/session-sources.ts:149](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/session-sources.ts#L149)

### `conversationsSource`

Function.

What running a content match does.

```ts
function conversationsSource(
  open: (target: ConversationTarget) => void,
): PaletteProvider
```

**Parameters**

- `open` (`(target: ConversationTarget) => void`): Shows the session with its find open on `query`.

**Returns** `PaletteProvider`

Source: [ui/src/palette/headless/session-sources.ts:198](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/session-sources.ts#L198)

### `conversationTargetOf`

Function.

The target a content-match id names; `null` for any other id.

```ts
function conversationTargetOf(itemId: string): ConversationTarget | null
```

**Parameters**

- `itemId` (`string`): A palette item id.

**Returns** `ConversationTarget | null`

Source: [ui/src/palette/headless/session-sources.ts:158](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/session-sources.ts#L158)

### `createPaletteStore`

Function.

Creates a palette store.

```ts
function createPaletteStore(options?: PaletteStoreOptions): PaletteStore
```

**Parameters**

- `options?` (`PaletteStoreOptions`, default `{}`): Where the recents persist.

**Returns** `PaletteStore`

Source: [ui/src/palette/headless/store.ts:57](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/store.ts#L57)

### `createStorageRecents`

Function.

Recents kept in a `Storage` under `key`, as `{ version: 1, recents }`.
Unreadable or foreign data reads as no recents.

```ts
function createStorageRecents(
  storage: PaletteRecentsStorage,
  key: string,
): PaletteRecents
```

**Parameters**

- `storage` (`PaletteRecentsStorage`): Where to keep them, such as `localStorage`.
- `key` (`string`): The storage key.

**Returns** `PaletteRecents`

Source: [ui/src/palette/headless/recents.ts:13](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/recents.ts#L13)

### `extensionsSource`

Function.

Extension providers' items. Each arrives with `source` set to its
provider's id; this source remembers that per item id and lists
everything under [`EXTENSIONS_SOURCE_ID`](https://zidane.si/docs/reference/ui-palette-headless.md#EXTENSIONS_SOURCE_ID), so `run` comes back here
and goes on to `(provider, itemId)`. Nested results are re-stamped the
same way.

```ts
function extensionsSource(
  host: Pick<PaletteHost, 'extensions'>,
  labels: { paletteActionTitles: Record<string, string>; paletteAppearanceMode: Record<'dark' | 'light' | 'system', string>; paletteAppearanceModeHint: string; paletteAppearanceSettings: string; paletteCloseSidePanel: string; paletteCodeCompletion: string; paletteCommandGone: string; paletteCommandsGroup: string; paletteCompactTranscript: string; paletteCompactTranscriptHint: string; paletteConversationsGroup: string; paletteDiagnostics: Record<'off' | 'lsp' | 'tools', string>; paletteDiagnosticsHint: string; paletteEditFiles: string; paletteEditorGroup: string; paletteEditorSettings: string; paletteFileCount: (count: number) => string; paletteFilesGroup: string; paletteFilesPlaceholder: string; paletteFilesTitle: string; paletteFilesTreeSide: Record<'right' | 'left', string>; paletteFilesTreeSideHint: string; paletteGoToFile: string; paletteHoverDocs: string; paletteImportRepo: string; paletteImportRepoHint: string; paletteMatchCount: (count: number) => string; paletteModelGroup: string; paletteNavigateGroup: string; paletteNeedsLsp: string; paletteNeedsSession: string; paletteOpenAndFind: string; paletteOpenFile: string; paletteOpenSidePanel: string; palettePanelAttention: (count: number, waiting: boolean) => string; palettePanelsGroup: string; palettePanelTitle: (label: string) => string; paletteReducedMotion: string; paletteSearchPlaceholder: string; paletteSessionActionsGroup: string; paletteSessionCurrent: string; paletteSessionsGroup: string; paletteSessionStatus: Record<'error' | 'attention' | 'running' | 'pending', string>; paletteSettingsGroup: string; paletteShowLegacyModels: string; paletteShowLegacyModelsHint: string; paletteSidebarRunDetails: string; paletteSidebarRunDetailsHint: string; paletteSwitchToSession: string; paletteUnavailable: string; paletteUntitledSession: string; paletteViewGroup: string; paletteWordWrap: string },
): PaletteProvider
```

**Parameters**

- `host` (`Pick<PaletteHost, 'extensions'>`): The extension items (`extensions`).
- `labels` (`{ paletteActionTitles: Record<string, string>; paletteAppearanceMode: Record<'dark' | 'light' | 'system', string>; paletteAppearanceModeHint: string; paletteAppearanceSettings: string; paletteCloseSidePanel: string; paletteCodeCompletion: string; paletteCommandGone: string; paletteCommandsGroup: string; paletteCompactTranscript: string; paletteCompactTranscriptHint: string; paletteConversationsGroup: string; paletteDiagnostics: Record<'off' | 'lsp' | 'tools', string>; paletteDiagnosticsHint: string; paletteEditFiles: string; paletteEditorGroup: string; paletteEditorSettings: string; paletteFileCount: (count: number) => string; paletteFilesGroup: string; paletteFilesPlaceholder: string; paletteFilesTitle: string; paletteFilesTreeSide: Record<'right' | 'left', string>; paletteFilesTreeSideHint: string; paletteGoToFile: string; paletteHoverDocs: string; paletteImportRepo: string; paletteImportRepoHint: string; paletteMatchCount: (count: number) => string; paletteModelGroup: string; paletteNavigateGroup: string; paletteNeedsLsp: string; paletteNeedsSession: string; paletteOpenAndFind: string; paletteOpenFile: string; paletteOpenSidePanel: string; palettePanelAttention: (count: number, waiting: boolean) => string; palettePanelsGroup: string; palettePanelTitle: (label: string) => string; paletteReducedMotion: string; paletteSearchPlaceholder: string; paletteSessionActionsGroup: string; paletteSessionCurrent: string; paletteSessionsGroup: string; paletteSessionStatus: Record<'error' | 'attention' | 'running' | 'pending', string>; paletteSettingsGroup: string; paletteShowLegacyModels: string; paletteShowLegacyModelsHint: string; paletteSidebarRunDetails: string; paletteSidebarRunDetailsHint: string; paletteSwitchToSession: string; paletteUnavailable: string; paletteUntitledSession: string; paletteViewGroup: string; paletteWordWrap: string }`): The wording of a gone or failed command.

**Returns** `PaletteProvider`

Source: [ui/src/palette/headless/sources.ts:205](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/sources.ts#L205)

### `filesSource`

Function.

Project files. Two ways in: type a name in the root list (every file is a
`searchOnly` item, so it never floods the empty listing), or "Go to file…"
for a nested picker over the whole tree. One listing per palette open,
shared by both for a few seconds so files the agent just wrote show up on
the next open.

```ts
function filesSource(
  host: Pick<PaletteHost, 'listFiles'>,
  labels: { paletteActionTitles: Record<string, string>; paletteAppearanceMode: Record<'dark' | 'light' | 'system', string>; paletteAppearanceModeHint: string; paletteAppearanceSettings: string; paletteCloseSidePanel: string; paletteCodeCompletion: string; paletteCommandGone: string; paletteCommandsGroup: string; paletteCompactTranscript: string; paletteCompactTranscriptHint: string; paletteConversationsGroup: string; paletteDiagnostics: Record<'off' | 'lsp' | 'tools', string>; paletteDiagnosticsHint: string; paletteEditFiles: string; paletteEditorGroup: string; paletteEditorSettings: string; paletteFileCount: (count: number) => string; paletteFilesGroup: string; paletteFilesPlaceholder: string; paletteFilesTitle: string; paletteFilesTreeSide: Record<'right' | 'left', string>; paletteFilesTreeSideHint: string; paletteGoToFile: string; paletteHoverDocs: string; paletteImportRepo: string; paletteImportRepoHint: string; paletteMatchCount: (count: number) => string; paletteModelGroup: string; paletteNavigateGroup: string; paletteNeedsLsp: string; paletteNeedsSession: string; paletteOpenAndFind: string; paletteOpenFile: string; paletteOpenSidePanel: string; palettePanelAttention: (count: number, waiting: boolean) => string; palettePanelsGroup: string; palettePanelTitle: (label: string) => string; paletteReducedMotion: string; paletteSearchPlaceholder: string; paletteSessionActionsGroup: string; paletteSessionCurrent: string; paletteSessionsGroup: string; paletteSessionStatus: Record<'error' | 'attention' | 'running' | 'pending', string>; paletteSettingsGroup: string; paletteShowLegacyModels: string; paletteShowLegacyModelsHint: string; paletteSidebarRunDetails: string; paletteSidebarRunDetailsHint: string; paletteSwitchToSession: string; paletteUnavailable: string; paletteUntitledSession: string; paletteViewGroup: string; paletteWordWrap: string },
  options: FilesSourceOptions,
): PaletteProvider
```

**Parameters**

- `host` (`Pick<PaletteHost, 'listFiles'>`): Lists the files (`listFiles`).
- `labels` (`{ paletteActionTitles: Record<string, string>; paletteAppearanceMode: Record<'dark' | 'light' | 'system', string>; paletteAppearanceModeHint: string; paletteAppearanceSettings: string; paletteCloseSidePanel: string; paletteCodeCompletion: string; paletteCommandGone: string; paletteCommandsGroup: string; paletteCompactTranscript: string; paletteCompactTranscriptHint: string; paletteConversationsGroup: string; paletteDiagnostics: Record<'off' | 'lsp' | 'tools', string>; paletteDiagnosticsHint: string; paletteEditFiles: string; paletteEditorGroup: string; paletteEditorSettings: string; paletteFileCount: (count: number) => string; paletteFilesGroup: string; paletteFilesPlaceholder: string; paletteFilesTitle: string; paletteFilesTreeSide: Record<'right' | 'left', string>; paletteFilesTreeSideHint: string; paletteGoToFile: string; paletteHoverDocs: string; paletteImportRepo: string; paletteImportRepoHint: string; paletteMatchCount: (count: number) => string; paletteModelGroup: string; paletteNavigateGroup: string; paletteNeedsLsp: string; paletteNeedsSession: string; paletteOpenAndFind: string; paletteOpenFile: string; paletteOpenSidePanel: string; palettePanelAttention: (count: number, waiting: boolean) => string; palettePanelsGroup: string; palettePanelTitle: (label: string) => string; paletteReducedMotion: string; paletteSearchPlaceholder: string; paletteSessionActionsGroup: string; paletteSessionCurrent: string; paletteSessionsGroup: string; paletteSessionStatus: Record<'error' | 'attention' | 'running' | 'pending', string>; paletteSettingsGroup: string; paletteShowLegacyModels: string; paletteShowLegacyModelsHint: string; paletteSidebarRunDetails: string; paletteSidebarRunDetailsHint: string; paletteSwitchToSession: string; paletteUnavailable: string; paletteUntitledSession: string; paletteViewGroup: string; paletteWordWrap: string }`): The group, row and picker wording.
- `options` (`FilesSourceOptions`): How to open a file, and the sandbox root.

**Returns** `PaletteProvider`

Source: [ui/src/palette/headless/sources.ts:120](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/sources.ts#L120)

### `gatherPaletteItems`

Function.

Asks every source for its items for `ctx`. Sources that answer at once are
in `ready` when this returns, so the palette can paint them in its first
frame; the others call `onLanded` as they answer. A failing source
contributes nothing rather than breaking the list.

```ts
function gatherPaletteItems(
  sources: readonly PaletteProvider[],
  ctx: PaletteContext,
  onLanded: (sourceId: string, items: readonly PaletteItem[]) => void,
): PaletteGather
```

**Parameters**

- `sources` (`readonly PaletteProvider[]`): The registered sources.
- `ctx` (`PaletteContext`): The context handed to every source.
- `onLanded` (`(sourceId: string, items: readonly PaletteItem[]) => void`): Called with each asynchronous source's items (empty when it failed).

**Returns** `PaletteGather`

Source: [ui/src/palette/headless/gather.ts:21](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/gather.ts#L21)

### `orderPaletteSessions`

Function.

Most relevant first: rank, then last update. `shown` are the ones listed
on an empty query (the active session never is: you are in it).

```ts
function orderPaletteSessions<S extends PaletteSession>(
  sessions: readonly S[],
  activeSessionId: string | null,
  rankOf: (id: string) => SessionRank,
): { ordered: S[]; shown: ReadonlySet<string> }
```

**Type parameters**

- `S` (`extends PaletteSession`)

**Parameters**

- `sessions` (`readonly S[]`): Every loaded session.
- `activeSessionId` (`string | null`): The session on show.
- `rankOf` (`(id: string) => SessionRank`): Whether a session needs you, runs, or neither.

**Returns** `{ ordered: S[]; shown: ReadonlySet<string> }`

Source: [ui/src/palette/headless/session-sources.ts:76](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/session-sources.ts#L76)

### `paletteRecentIdOf`

Function.

The id Recent remembers for a run item: a content match is a way to its session.

```ts
function paletteRecentIdOf(item: PaletteItem): string
```

**Parameters**

- `item` (`PaletteItem`): The item that ran.

**Returns** `string`

Source: [ui/src/palette/headless/session-sources.ts:215](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/session-sources.ts#L215)

### `panelsSource`

Function.

Side panel tabs: open a tab, toggle the panel.

```ts
function panelsSource(
  read: () => PalettePanels,
  bindings: PaletteBindings,
  labels: { paletteActionTitles: Record<string, string>; paletteAppearanceMode: Record<'dark' | 'light' | 'system', string>; paletteAppearanceModeHint: string; paletteAppearanceSettings: string; paletteCloseSidePanel: string; paletteCodeCompletion: string; paletteCommandGone: string; paletteCommandsGroup: string; paletteCompactTranscript: string; paletteCompactTranscriptHint: string; paletteConversationsGroup: string; paletteDiagnostics: Record<'off' | 'lsp' | 'tools', string>; paletteDiagnosticsHint: string; paletteEditFiles: string; paletteEditorGroup: string; paletteEditorSettings: string; paletteFileCount: (count: number) => string; paletteFilesGroup: string; paletteFilesPlaceholder: string; paletteFilesTitle: string; paletteFilesTreeSide: Record<'right' | 'left', string>; paletteFilesTreeSideHint: string; paletteGoToFile: string; paletteHoverDocs: string; paletteImportRepo: string; paletteImportRepoHint: string; paletteMatchCount: (count: number) => string; paletteModelGroup: string; paletteNavigateGroup: string; paletteNeedsLsp: string; paletteNeedsSession: string; paletteOpenAndFind: string; paletteOpenFile: string; paletteOpenSidePanel: string; palettePanelAttention: (count: number, waiting: boolean) => string; palettePanelsGroup: string; palettePanelTitle: (label: string) => string; paletteReducedMotion: string; paletteSearchPlaceholder: string; paletteSessionActionsGroup: string; paletteSessionCurrent: string; paletteSessionsGroup: string; paletteSessionStatus: Record<'error' | 'attention' | 'running' | 'pending', string>; paletteSettingsGroup: string; paletteShowLegacyModels: string; paletteShowLegacyModelsHint: string; paletteSidebarRunDetails: string; paletteSidebarRunDetailsHint: string; paletteSwitchToSession: string; paletteUnavailable: string; paletteUntitledSession: string; paletteViewGroup: string; paletteWordWrap: string },
): PaletteProvider
```

**Parameters**

- `read` (`() => PalettePanels`): The panel, read when the palette lists or runs a row.
- `bindings` (`PaletteBindings`): The live chords (built-in tabs with a dedicated chord show it).
- `labels` (`{ paletteActionTitles: Record<string, string>; paletteAppearanceMode: Record<'dark' | 'light' | 'system', string>; paletteAppearanceModeHint: string; paletteAppearanceSettings: string; paletteCloseSidePanel: string; paletteCodeCompletion: string; paletteCommandGone: string; paletteCommandsGroup: string; paletteCompactTranscript: string; paletteCompactTranscriptHint: string; paletteConversationsGroup: string; paletteDiagnostics: Record<'off' | 'lsp' | 'tools', string>; paletteDiagnosticsHint: string; paletteEditFiles: string; paletteEditorGroup: string; paletteEditorSettings: string; paletteFileCount: (count: number) => string; paletteFilesGroup: string; paletteFilesPlaceholder: string; paletteFilesTitle: string; paletteFilesTreeSide: Record<'right' | 'left', string>; paletteFilesTreeSideHint: string; paletteGoToFile: string; paletteHoverDocs: string; paletteImportRepo: string; paletteImportRepoHint: string; paletteMatchCount: (count: number) => string; paletteModelGroup: string; paletteNavigateGroup: string; paletteNeedsLsp: string; paletteNeedsSession: string; paletteOpenAndFind: string; paletteOpenFile: string; paletteOpenSidePanel: string; palettePanelAttention: (count: number, waiting: boolean) => string; palettePanelsGroup: string; palettePanelTitle: (label: string) => string; paletteReducedMotion: string; paletteSearchPlaceholder: string; paletteSessionActionsGroup: string; paletteSessionCurrent: string; paletteSessionsGroup: string; paletteSessionStatus: Record<'error' | 'attention' | 'running' | 'pending', string>; paletteSettingsGroup: string; paletteShowLegacyModels: string; paletteShowLegacyModelsHint: string; paletteSidebarRunDetails: string; paletteSidebarRunDetailsHint: string; paletteSwitchToSession: string; paletteUnavailable: string; paletteUntitledSession: string; paletteViewGroup: string; paletteWordWrap: string }`): The palette labels.

**Returns** `PaletteProvider`

Source: [ui/src/palette/headless/app-sources.ts:193](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/app-sources.ts#L193)

### `prefsSource`

Function.

The app's per-device preferences as toggles with live state; anything deeper opens the Settings page that owns
it. The chat settings are [`settingsSource`](https://zidane.si/docs/reference/ui-palette-headless.md#settingsSource)'s.

```ts
function prefsSource(
  prefs: PalettePrefs,
  labels: { paletteActionTitles: Record<string, string>; paletteAppearanceMode: Record<'dark' | 'light' | 'system', string>; paletteAppearanceModeHint: string; paletteAppearanceSettings: string; paletteCloseSidePanel: string; paletteCodeCompletion: string; paletteCommandGone: string; paletteCommandsGroup: string; paletteCompactTranscript: string; paletteCompactTranscriptHint: string; paletteConversationsGroup: string; paletteDiagnostics: Record<'off' | 'lsp' | 'tools', string>; paletteDiagnosticsHint: string; paletteEditFiles: string; paletteEditorGroup: string; paletteEditorSettings: string; paletteFileCount: (count: number) => string; paletteFilesGroup: string; paletteFilesPlaceholder: string; paletteFilesTitle: string; paletteFilesTreeSide: Record<'right' | 'left', string>; paletteFilesTreeSideHint: string; paletteGoToFile: string; paletteHoverDocs: string; paletteImportRepo: string; paletteImportRepoHint: string; paletteMatchCount: (count: number) => string; paletteModelGroup: string; paletteNavigateGroup: string; paletteNeedsLsp: string; paletteNeedsSession: string; paletteOpenAndFind: string; paletteOpenFile: string; paletteOpenSidePanel: string; palettePanelAttention: (count: number, waiting: boolean) => string; palettePanelsGroup: string; palettePanelTitle: (label: string) => string; paletteReducedMotion: string; paletteSearchPlaceholder: string; paletteSessionActionsGroup: string; paletteSessionCurrent: string; paletteSessionsGroup: string; paletteSessionStatus: Record<'error' | 'attention' | 'running' | 'pending', string>; paletteSettingsGroup: string; paletteShowLegacyModels: string; paletteShowLegacyModelsHint: string; paletteSidebarRunDetails: string; paletteSidebarRunDetailsHint: string; paletteSwitchToSession: string; paletteUnavailable: string; paletteUntitledSession: string; paletteViewGroup: string; paletteWordWrap: string },
): PaletteProvider
```

**Parameters**

- `prefs` (`PalettePrefs`): The preferences to list.
- `labels` (`{ paletteActionTitles: Record<string, string>; paletteAppearanceMode: Record<'dark' | 'light' | 'system', string>; paletteAppearanceModeHint: string; paletteAppearanceSettings: string; paletteCloseSidePanel: string; paletteCodeCompletion: string; paletteCommandGone: string; paletteCommandsGroup: string; paletteCompactTranscript: string; paletteCompactTranscriptHint: string; paletteConversationsGroup: string; paletteDiagnostics: Record<'off' | 'lsp' | 'tools', string>; paletteDiagnosticsHint: string; paletteEditFiles: string; paletteEditorGroup: string; paletteEditorSettings: string; paletteFileCount: (count: number) => string; paletteFilesGroup: string; paletteFilesPlaceholder: string; paletteFilesTitle: string; paletteFilesTreeSide: Record<'right' | 'left', string>; paletteFilesTreeSideHint: string; paletteGoToFile: string; paletteHoverDocs: string; paletteImportRepo: string; paletteImportRepoHint: string; paletteMatchCount: (count: number) => string; paletteModelGroup: string; paletteNavigateGroup: string; paletteNeedsLsp: string; paletteNeedsSession: string; paletteOpenAndFind: string; paletteOpenFile: string; paletteOpenSidePanel: string; palettePanelAttention: (count: number, waiting: boolean) => string; palettePanelsGroup: string; palettePanelTitle: (label: string) => string; paletteReducedMotion: string; paletteSearchPlaceholder: string; paletteSessionActionsGroup: string; paletteSessionCurrent: string; paletteSessionsGroup: string; paletteSessionStatus: Record<'error' | 'attention' | 'running' | 'pending', string>; paletteSettingsGroup: string; paletteShowLegacyModels: string; paletteShowLegacyModelsHint: string; paletteSidebarRunDetails: string; paletteSidebarRunDetailsHint: string; paletteSwitchToSession: string; paletteUnavailable: string; paletteUntitledSession: string; paletteViewGroup: string; paletteWordWrap: string }`): The palette labels.

**Returns** `PaletteProvider`

Source: [ui/src/palette/headless/app-sources.ts:337](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/app-sources.ts#L337)

### `repoSource`

Function.

"Import repository": clone a URL and start a draft in it. Runs after the palette closed.

```ts
function repoSource(
  importRepo: () => void,
  labels: { paletteActionTitles: Record<string, string>; paletteAppearanceMode: Record<'dark' | 'light' | 'system', string>; paletteAppearanceModeHint: string; paletteAppearanceSettings: string; paletteCloseSidePanel: string; paletteCodeCompletion: string; paletteCommandGone: string; paletteCommandsGroup: string; paletteCompactTranscript: string; paletteCompactTranscriptHint: string; paletteConversationsGroup: string; paletteDiagnostics: Record<'off' | 'lsp' | 'tools', string>; paletteDiagnosticsHint: string; paletteEditFiles: string; paletteEditorGroup: string; paletteEditorSettings: string; paletteFileCount: (count: number) => string; paletteFilesGroup: string; paletteFilesPlaceholder: string; paletteFilesTitle: string; paletteFilesTreeSide: Record<'right' | 'left', string>; paletteFilesTreeSideHint: string; paletteGoToFile: string; paletteHoverDocs: string; paletteImportRepo: string; paletteImportRepoHint: string; paletteMatchCount: (count: number) => string; paletteModelGroup: string; paletteNavigateGroup: string; paletteNeedsLsp: string; paletteNeedsSession: string; paletteOpenAndFind: string; paletteOpenFile: string; paletteOpenSidePanel: string; palettePanelAttention: (count: number, waiting: boolean) => string; palettePanelsGroup: string; palettePanelTitle: (label: string) => string; paletteReducedMotion: string; paletteSearchPlaceholder: string; paletteSessionActionsGroup: string; paletteSessionCurrent: string; paletteSessionsGroup: string; paletteSessionStatus: Record<'error' | 'attention' | 'running' | 'pending', string>; paletteSettingsGroup: string; paletteShowLegacyModels: string; paletteShowLegacyModelsHint: string; paletteSidebarRunDetails: string; paletteSidebarRunDetailsHint: string; paletteSwitchToSession: string; paletteUnavailable: string; paletteUntitledSession: string; paletteViewGroup: string; paletteWordWrap: string },
): PaletteProvider
```

**Parameters**

- `importRepo` (`() => void`): Opens the app's clone dialog.
- `labels` (`{ paletteActionTitles: Record<string, string>; paletteAppearanceMode: Record<'dark' | 'light' | 'system', string>; paletteAppearanceModeHint: string; paletteAppearanceSettings: string; paletteCloseSidePanel: string; paletteCodeCompletion: string; paletteCommandGone: string; paletteCommandsGroup: string; paletteCompactTranscript: string; paletteCompactTranscriptHint: string; paletteConversationsGroup: string; paletteDiagnostics: Record<'off' | 'lsp' | 'tools', string>; paletteDiagnosticsHint: string; paletteEditFiles: string; paletteEditorGroup: string; paletteEditorSettings: string; paletteFileCount: (count: number) => string; paletteFilesGroup: string; paletteFilesPlaceholder: string; paletteFilesTitle: string; paletteFilesTreeSide: Record<'right' | 'left', string>; paletteFilesTreeSideHint: string; paletteGoToFile: string; paletteHoverDocs: string; paletteImportRepo: string; paletteImportRepoHint: string; paletteMatchCount: (count: number) => string; paletteModelGroup: string; paletteNavigateGroup: string; paletteNeedsLsp: string; paletteNeedsSession: string; paletteOpenAndFind: string; paletteOpenFile: string; paletteOpenSidePanel: string; palettePanelAttention: (count: number, waiting: boolean) => string; palettePanelsGroup: string; palettePanelTitle: (label: string) => string; paletteReducedMotion: string; paletteSearchPlaceholder: string; paletteSessionActionsGroup: string; paletteSessionCurrent: string; paletteSessionsGroup: string; paletteSessionStatus: Record<'error' | 'attention' | 'running' | 'pending', string>; paletteSettingsGroup: string; paletteShowLegacyModels: string; paletteShowLegacyModelsHint: string; paletteSidebarRunDetails: string; paletteSidebarRunDetailsHint: string; paletteSwitchToSession: string; paletteUnavailable: string; paletteUntitledSession: string; paletteViewGroup: string; paletteWordWrap: string }`): The palette labels.

**Returns** `PaletteProvider`

Source: [ui/src/palette/headless/app-sources.ts:124](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/app-sources.ts#L124)

### `sessionItemId`

Function.

The palette item id of a session row.

```ts
function sessionItemId(key: string): string
```

**Parameters**

- `key` (`string`): The session key.

**Returns** `string`

Source: [ui/src/palette/headless/session-sources.ts:52](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/session-sources.ts#L52)

### `sessionKeyOfItem`

Function.

The session a palette item id names: the key [`sessionItemId`](https://zidane.si/docs/reference/ui-palette-headless.md#sessionItemId) put after the prefix.

```ts
function sessionKeyOfItem(itemId: string): string
```

**Parameters**

- `itemId` (`string`): A session row's item id.

**Returns** `string`

Source: [ui/src/palette/headless/session-sources.ts:61](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/session-sources.ts#L61)

### `sessionsSource`

Function.

Switch between sessions by title.

```ts
function sessionsSource(
  sessions: readonly PaletteSession[],
  activeSessionId: string | null,
  select: (id: string) => void,
  rankOf: (id: string) => SessionRank,
  labels: { paletteActionTitles: Record<string, string>; paletteAppearanceMode: Record<'dark' | 'light' | 'system', string>; paletteAppearanceModeHint: string; paletteAppearanceSettings: string; paletteCloseSidePanel: string; paletteCodeCompletion: string; paletteCommandGone: string; paletteCommandsGroup: string; paletteCompactTranscript: string; paletteCompactTranscriptHint: string; paletteConversationsGroup: string; paletteDiagnostics: Record<'off' | 'lsp' | 'tools', string>; paletteDiagnosticsHint: string; paletteEditFiles: string; paletteEditorGroup: string; paletteEditorSettings: string; paletteFileCount: (count: number) => string; paletteFilesGroup: string; paletteFilesPlaceholder: string; paletteFilesTitle: string; paletteFilesTreeSide: Record<'right' | 'left', string>; paletteFilesTreeSideHint: string; paletteGoToFile: string; paletteHoverDocs: string; paletteImportRepo: string; paletteImportRepoHint: string; paletteMatchCount: (count: number) => string; paletteModelGroup: string; paletteNavigateGroup: string; paletteNeedsLsp: string; paletteNeedsSession: string; paletteOpenAndFind: string; paletteOpenFile: string; paletteOpenSidePanel: string; palettePanelAttention: (count: number, waiting: boolean) => string; palettePanelsGroup: string; palettePanelTitle: (label: string) => string; paletteReducedMotion: string; paletteSearchPlaceholder: string; paletteSessionActionsGroup: string; paletteSessionCurrent: string; paletteSessionsGroup: string; paletteSessionStatus: Record<'error' | 'attention' | 'running' | 'pending', string>; paletteSettingsGroup: string; paletteShowLegacyModels: string; paletteShowLegacyModelsHint: string; paletteSidebarRunDetails: string; paletteSidebarRunDetailsHint: string; paletteSwitchToSession: string; paletteUnavailable: string; paletteUntitledSession: string; paletteViewGroup: string; paletteWordWrap: string },
): PaletteProvider
```

**Parameters**

- `sessions` (`readonly PaletteSession[]`): Every loaded session.
- `activeSessionId` (`string | null`): The session on show (never in the short list).
- `select` (`(id: string) => void`): Shows a session.
- `rankOf` (`(id: string) => SessionRank`): Whether a session needs you, runs, or neither.
- `labels` (`{ paletteActionTitles: Record<string, string>; paletteAppearanceMode: Record<'dark' | 'light' | 'system', string>; paletteAppearanceModeHint: string; paletteAppearanceSettings: string; paletteCloseSidePanel: string; paletteCodeCompletion: string; paletteCommandGone: string; paletteCommandsGroup: string; paletteCompactTranscript: string; paletteCompactTranscriptHint: string; paletteConversationsGroup: string; paletteDiagnostics: Record<'off' | 'lsp' | 'tools', string>; paletteDiagnosticsHint: string; paletteEditFiles: string; paletteEditorGroup: string; paletteEditorSettings: string; paletteFileCount: (count: number) => string; paletteFilesGroup: string; paletteFilesPlaceholder: string; paletteFilesTitle: string; paletteFilesTreeSide: Record<'right' | 'left', string>; paletteFilesTreeSideHint: string; paletteGoToFile: string; paletteHoverDocs: string; paletteImportRepo: string; paletteImportRepoHint: string; paletteMatchCount: (count: number) => string; paletteModelGroup: string; paletteNavigateGroup: string; paletteNeedsLsp: string; paletteNeedsSession: string; paletteOpenAndFind: string; paletteOpenFile: string; paletteOpenSidePanel: string; palettePanelAttention: (count: number, waiting: boolean) => string; palettePanelsGroup: string; palettePanelTitle: (label: string) => string; paletteReducedMotion: string; paletteSearchPlaceholder: string; paletteSessionActionsGroup: string; paletteSessionCurrent: string; paletteSessionsGroup: string; paletteSessionStatus: Record<'error' | 'attention' | 'running' | 'pending', string>; paletteSettingsGroup: string; paletteShowLegacyModels: string; paletteShowLegacyModelsHint: string; paletteSidebarRunDetails: string; paletteSidebarRunDetailsHint: string; paletteSwitchToSession: string; paletteUnavailable: string; paletteUntitledSession: string; paletteViewGroup: string; paletteWordWrap: string }`): The palette labels.

**Returns** `PaletteProvider`

Source: [ui/src/palette/headless/session-sources.ts:101](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/session-sources.ts#L101)

### `settingsSource`

Function.

The chat settings as palette rows with live state: the conversation
preset (a picker of the three presets), the compact transcript and the
sidebar's run details as toggles.

```ts
function settingsSource(
  access: PaletteSettingsAccess,
  labels: { paletteActionTitles: Record<string, string>; paletteAppearanceMode: Record<'dark' | 'light' | 'system', string>; paletteAppearanceModeHint: string; paletteAppearanceSettings: string; paletteCloseSidePanel: string; paletteCodeCompletion: string; paletteCommandGone: string; paletteCommandsGroup: string; paletteCompactTranscript: string; paletteCompactTranscriptHint: string; paletteConversationsGroup: string; paletteDiagnostics: Record<'off' | 'lsp' | 'tools', string>; paletteDiagnosticsHint: string; paletteEditFiles: string; paletteEditorGroup: string; paletteEditorSettings: string; paletteFileCount: (count: number) => string; paletteFilesGroup: string; paletteFilesPlaceholder: string; paletteFilesTitle: string; paletteFilesTreeSide: Record<'right' | 'left', string>; paletteFilesTreeSideHint: string; paletteGoToFile: string; paletteHoverDocs: string; paletteImportRepo: string; paletteImportRepoHint: string; paletteMatchCount: (count: number) => string; paletteModelGroup: string; paletteNavigateGroup: string; paletteNeedsLsp: string; paletteNeedsSession: string; paletteOpenAndFind: string; paletteOpenFile: string; paletteOpenSidePanel: string; palettePanelAttention: (count: number, waiting: boolean) => string; palettePanelsGroup: string; palettePanelTitle: (label: string) => string; paletteReducedMotion: string; paletteSearchPlaceholder: string; paletteSessionActionsGroup: string; paletteSessionCurrent: string; paletteSessionsGroup: string; paletteSessionStatus: Record<'error' | 'attention' | 'running' | 'pending', string>; paletteSettingsGroup: string; paletteShowLegacyModels: string; paletteShowLegacyModelsHint: string; paletteSidebarRunDetails: string; paletteSidebarRunDetailsHint: string; paletteSwitchToSession: string; paletteUnavailable: string; paletteUntitledSession: string; paletteViewGroup: string; paletteWordWrap: string },
): PaletteProvider
```

**Parameters**

- `access` (`PaletteSettingsAccess`): Reads and writes the settings.
- `labels` (`{ paletteActionTitles: Record<string, string>; paletteAppearanceMode: Record<'dark' | 'light' | 'system', string>; paletteAppearanceModeHint: string; paletteAppearanceSettings: string; paletteCloseSidePanel: string; paletteCodeCompletion: string; paletteCommandGone: string; paletteCommandsGroup: string; paletteCompactTranscript: string; paletteCompactTranscriptHint: string; paletteConversationsGroup: string; paletteDiagnostics: Record<'off' | 'lsp' | 'tools', string>; paletteDiagnosticsHint: string; paletteEditFiles: string; paletteEditorGroup: string; paletteEditorSettings: string; paletteFileCount: (count: number) => string; paletteFilesGroup: string; paletteFilesPlaceholder: string; paletteFilesTitle: string; paletteFilesTreeSide: Record<'right' | 'left', string>; paletteFilesTreeSideHint: string; paletteGoToFile: string; paletteHoverDocs: string; paletteImportRepo: string; paletteImportRepoHint: string; paletteMatchCount: (count: number) => string; paletteModelGroup: string; paletteNavigateGroup: string; paletteNeedsLsp: string; paletteNeedsSession: string; paletteOpenAndFind: string; paletteOpenFile: string; paletteOpenSidePanel: string; palettePanelAttention: (count: number, waiting: boolean) => string; palettePanelsGroup: string; palettePanelTitle: (label: string) => string; paletteReducedMotion: string; paletteSearchPlaceholder: string; paletteSessionActionsGroup: string; paletteSessionCurrent: string; paletteSessionsGroup: string; paletteSessionStatus: Record<'error' | 'attention' | 'running' | 'pending', string>; paletteSettingsGroup: string; paletteShowLegacyModels: string; paletteShowLegacyModelsHint: string; paletteSidebarRunDetails: string; paletteSidebarRunDetailsHint: string; paletteSwitchToSession: string; paletteUnavailable: string; paletteUntitledSession: string; paletteViewGroup: string; paletteWordWrap: string }`): The rows' wording.

**Returns** `PaletteProvider`

Source: [ui/src/palette/headless/sources.ts:260](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/sources.ts#L260)

### `setupSource`

Function.

"Run setup": the setup wizard again, with the current values. Runs after the palette closed.

```ts
function setupSource(
  runSetup: () => void,
  labels: { paletteActionTitles: Record<string, string>; paletteAppearanceMode: Record<'dark' | 'light' | 'system', string>; paletteAppearanceModeHint: string; paletteAppearanceSettings: string; paletteCloseSidePanel: string; paletteCodeCompletion: string; paletteCommandGone: string; paletteCommandsGroup: string; paletteCompactTranscript: string; paletteCompactTranscriptHint: string; paletteConversationsGroup: string; paletteDiagnostics: Record<'off' | 'lsp' | 'tools', string>; paletteDiagnosticsHint: string; paletteEditFiles: string; paletteEditorGroup: string; paletteEditorSettings: string; paletteFileCount: (count: number) => string; paletteFilesGroup: string; paletteFilesPlaceholder: string; paletteFilesTitle: string; paletteFilesTreeSide: Record<'right' | 'left', string>; paletteFilesTreeSideHint: string; paletteGoToFile: string; paletteHoverDocs: string; paletteImportRepo: string; paletteImportRepoHint: string; paletteMatchCount: (count: number) => string; paletteModelGroup: string; paletteNavigateGroup: string; paletteNeedsLsp: string; paletteNeedsSession: string; paletteOpenAndFind: string; paletteOpenFile: string; paletteOpenSidePanel: string; palettePanelAttention: (count: number, waiting: boolean) => string; palettePanelsGroup: string; palettePanelTitle: (label: string) => string; paletteReducedMotion: string; paletteSearchPlaceholder: string; paletteSessionActionsGroup: string; paletteSessionCurrent: string; paletteSessionsGroup: string; paletteSessionStatus: Record<'error' | 'attention' | 'running' | 'pending', string>; paletteSettingsGroup: string; paletteShowLegacyModels: string; paletteShowLegacyModelsHint: string; paletteSidebarRunDetails: string; paletteSidebarRunDetailsHint: string; paletteSwitchToSession: string; paletteUnavailable: string; paletteUntitledSession: string; paletteViewGroup: string; paletteWordWrap: string },
): PaletteProvider
```

**Parameters**

- `runSetup` (`() => void`): Opens the setup wizard.
- `labels` (`{ paletteActionTitles: Record<string, string>; paletteAppearanceMode: Record<'dark' | 'light' | 'system', string>; paletteAppearanceModeHint: string; paletteAppearanceSettings: string; paletteCloseSidePanel: string; paletteCodeCompletion: string; paletteCommandGone: string; paletteCommandsGroup: string; paletteCompactTranscript: string; paletteCompactTranscriptHint: string; paletteConversationsGroup: string; paletteDiagnostics: Record<'off' | 'lsp' | 'tools', string>; paletteDiagnosticsHint: string; paletteEditFiles: string; paletteEditorGroup: string; paletteEditorSettings: string; paletteFileCount: (count: number) => string; paletteFilesGroup: string; paletteFilesPlaceholder: string; paletteFilesTitle: string; paletteFilesTreeSide: Record<'right' | 'left', string>; paletteFilesTreeSideHint: string; paletteGoToFile: string; paletteHoverDocs: string; paletteImportRepo: string; paletteImportRepoHint: string; paletteMatchCount: (count: number) => string; paletteModelGroup: string; paletteNavigateGroup: string; paletteNeedsLsp: string; paletteNeedsSession: string; paletteOpenAndFind: string; paletteOpenFile: string; paletteOpenSidePanel: string; palettePanelAttention: (count: number, waiting: boolean) => string; palettePanelsGroup: string; palettePanelTitle: (label: string) => string; paletteReducedMotion: string; paletteSearchPlaceholder: string; paletteSessionActionsGroup: string; paletteSessionCurrent: string; paletteSessionsGroup: string; paletteSessionStatus: Record<'error' | 'attention' | 'running' | 'pending', string>; paletteSettingsGroup: string; paletteShowLegacyModels: string; paletteShowLegacyModelsHint: string; paletteSidebarRunDetails: string; paletteSidebarRunDetailsHint: string; paletteSwitchToSession: string; paletteUnavailable: string; paletteUntitledSession: string; paletteViewGroup: string; paletteWordWrap: string }`): The palette labels.

**Returns** `PaletteProvider`

Source: [ui/src/palette/headless/app-sources.ts:281](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/app-sources.ts#L281)

### `spacesSource`

Function.

"Switch to space" entries while Spaces is on: one per space but the shown one, the TUI palette's entries.

```ts
function spacesSource(
  enabled: boolean,
  spaces: readonly Space[],
  activeId: string,
  select: (spaceId: string) => void,
): PaletteProvider
```

**Parameters**

- `enabled` (`boolean`): Whether Spaces is on.
- `spaces` (`readonly Space[]`): Every space.
- `activeId` (`string`): The space on show.
- `select` (`(spaceId: string) => void`): Shows a space.

**Returns** `PaletteProvider`

Source: [ui/src/palette/headless/app-sources.ts:256](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/app-sources.ts#L256)

## Constants

### `ACTIONS_SOURCE_ID`

Constant.

The key actions source's id.

```ts
const ACTIONS_SOURCE_ID = 'builtin:actions'
```

Source: [ui/src/palette/headless/app-sources.ts:20](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/app-sources.ts#L20)

### `COMMANDS_SOURCE_ID`

Constant.

The commands source's id.

```ts
const COMMANDS_SOURCE_ID = 'builtin:commands'
```

Source: [ui/src/palette/headless/sources.ts:25](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/sources.ts#L25)

### `CONVERSATION_ITEM_PREFIX`

Constant.

What a content match's item id starts with.

```ts
const CONVERSATION_ITEM_PREFIX = 'conversation:'
```

Source: [ui/src/palette/headless/session-sources.ts:134](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/session-sources.ts#L134)

### `CONVERSATIONS_SOURCE_ID`

Constant.

The conversations source's id.

```ts
const CONVERSATIONS_SOURCE_ID = 'builtin:conversations'
```

Source: [ui/src/palette/headless/session-sources.ts:132](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/session-sources.ts#L132)

### `DEFAULT_PALETTE_LABELS`

Constant.

The default English strings of the palette area.

```ts
const DEFAULT_PALETTE_LABELS: { paletteActionTitles: Record<string, string>; paletteAppearanceMode: Record<'dark' | 'light' | 'system', string>; paletteAppearanceModeHint: string; paletteAppearanceSettings: string; paletteCloseSidePanel: string; paletteCodeCompletion: string; paletteCommandGone: string; paletteCommandsGroup: string; paletteCompactTranscript: string; paletteCompactTranscriptHint: string; paletteConversationsGroup: string; paletteDiagnostics: Record<'off' | 'lsp' | 'tools', string>; paletteDiagnosticsHint: string; paletteEditFiles: string; paletteEditorGroup: string; paletteEditorSettings: string; paletteFileCount: (count: number) => string; paletteFilesGroup: string; paletteFilesPlaceholder: string; paletteFilesTitle: string; paletteFilesTreeSide: Record<'right' | 'left', string>; paletteFilesTreeSideHint: string; paletteGoToFile: string; paletteHoverDocs: string; paletteImportRepo: string; paletteImportRepoHint: string; paletteMatchCount: (count: number) => string; paletteModelGroup: string; paletteNavigateGroup: string; paletteNeedsLsp: string; paletteNeedsSession: string; paletteOpenAndFind: string; paletteOpenFile: string; paletteOpenSidePanel: string; palettePanelAttention: (count: number, waiting: boolean) => string; palettePanelsGroup: string; palettePanelTitle: (label: string) => string; paletteReducedMotion: string; paletteSearchPlaceholder: string; paletteSessionActionsGroup: string; paletteSessionCurrent: string; paletteSessionsGroup: string; paletteSessionStatus: Record<'error' | 'attention' | 'running' | 'pending', string>; paletteSettingsGroup: string; paletteShowLegacyModels: string; paletteShowLegacyModelsHint: string; paletteSidebarRunDetails: string; paletteSidebarRunDetailsHint: string; paletteSwitchToSession: string; paletteUnavailable: string; paletteUntitledSession: string; paletteViewGroup: string; paletteWordWrap: string }
```

Source: [ui/src/palette/headless/labels.ts:9](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/labels.ts#L9)

### `EXTENSIONS_SOURCE_ID`

Constant.

The extensions source's id: every extension item is re-stamped under it.

```ts
const EXTENSIONS_SOURCE_ID = 'extensions'
```

Source: [ui/src/palette/headless/sources.ts:29](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/sources.ts#L29)

### `FILES_SOURCE_ID`

Constant.

The files source's id.

```ts
const FILES_SOURCE_ID = 'builtin:files'
```

Source: [ui/src/palette/headless/sources.ts:27](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/sources.ts#L27)

### `GO_TO_FILE_ID`

Constant.

The "Go to file…" row's item id.

```ts
const GO_TO_FILE_ID = 'file:go'
```

Source: [ui/src/palette/headless/sources.ts:33](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/sources.ts#L33)

### `PALETTE_SESSIONS_SHOWN`

Constant.

Listed without typing.

```ts
const PALETTE_SESSIONS_SHOWN = 6
```

Source: [ui/src/palette/headless/session-sources.ts:45](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/session-sources.ts#L45)

### `PANELS_SOURCE_ID`

Constant.

The side panel source's id.

```ts
const PANELS_SOURCE_ID = 'builtin:panels'
```

Source: [ui/src/palette/headless/app-sources.ts:175](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/app-sources.ts#L175)

### `PREFS_SOURCE_ID`

Constant.

The per-device preferences source's id.

```ts
const PREFS_SOURCE_ID = 'builtin:app-settings'
```

Source: [ui/src/palette/headless/app-sources.ts:324](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/app-sources.ts#L324)

### `REPO_SOURCE_ID`

Constant.

The import-repository source's id.

```ts
const REPO_SOURCE_ID = 'builtin:repo'
```

Source: [ui/src/palette/headless/app-sources.ts:116](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/app-sources.ts#L116)

### `SESSION_ITEM_PREFIX`

Constant.

What a session row's item id starts with.

```ts
const SESSION_ITEM_PREFIX = 'session:'
```

Source: [ui/src/palette/headless/session-sources.ts:43](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/session-sources.ts#L43)

### `SESSIONS_SOURCE_ID`

Constant.

The sessions source's id.

```ts
const SESSIONS_SOURCE_ID = 'builtin:sessions'
```

Source: [ui/src/palette/headless/session-sources.ts:41](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/session-sources.ts#L41)

### `SETTINGS_SOURCE_ID`

Constant.

The chat settings source's id.

```ts
const SETTINGS_SOURCE_ID = 'builtin:settings'
```

Source: [ui/src/palette/headless/sources.ts:31](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/sources.ts#L31)

### `SETUP_SOURCE_ID`

Constant.

The setup source's id.

```ts
const SETUP_SOURCE_ID = 'builtin:setup'
```

Source: [ui/src/palette/headless/app-sources.ts:273](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/app-sources.ts#L273)

### `SPACES_SOURCE_ID`

Constant.

The spaces source's id.

```ts
const SPACES_SOURCE_ID = 'builtin:spaces'
```

Source: [ui/src/palette/headless/app-sources.ts:246](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/app-sources.ts#L246)

## Interfaces

### `CommandsSourceOptions`

Interface.

Options of [`commandsSource`](https://zidane.si/docs/reference/ui-palette-headless.md#commandsSource).

```ts
interface CommandsSourceOptions
```

**Properties**

- `hostOf?` (`() => string | null`): The server the active session runs on (`null`: this host), read on each listing.

Source: [ui/src/palette/headless/sources.ts:36](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/sources.ts#L36)

### `ConversationTarget`

Interface.

What a content-match row names: the session and the query it matched.

```ts
interface ConversationTarget
```

**Properties**

- `query` (`string`): The query it matched.
- `sessionId` (`string`): The session the match is in.

Source: [ui/src/palette/headless/session-sources.ts:137](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/session-sources.ts#L137)

### `FilesSourceOptions`

Interface.

Options of [`filesSource`](https://zidane.si/docs/reference/ui-palette-headless.md#filesSource).

```ts
interface FilesSourceOptions
```

**Properties**

- `now?` (`() => number`): Clock for the listing cache, in milliseconds. Default: `performance.now`.
- `open` (`(path: string) => unknown`): Opens a file by its full path (`root/relative`).
- `workspaceRoot?` (`() => string | undefined`): The active session's sandbox root when its files live there; else `ctx.cwd` is the root.

Source: [ui/src/palette/headless/sources.ts:92](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/sources.ts#L92)

### `PaletteCommand`

Interface.

A `/` command the host runs, as the palette lists it.

```ts
interface PaletteCommand
```

**Properties**

- `aliases?` (`readonly string[]`): Other names that run the same command (searchable).
- `description` (`string`): One-line description.
- `group?` (`string`): Grouping label, usually the contributing extension's name (searchable).
- `hasArgCompletion?` (`boolean`): `true` when the command completes arguments: running it inserts `/name ` for the user to finish.
- `name` (`string`): Command name, without the leading `/`.

Source: [ui/src/palette/headless/host.ts:19](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/host.ts#L19)

### `PaletteCommandQuery`

Interface.

What `PaletteHost.listCommands` lists commands for.

```ts
interface PaletteCommandQuery
```

**Properties**

- `cwd` (`string`): The folder whose commands to list.
- `hostId?` (`string | null`): The server the active session runs on (`null` or absent: this host).

Source: [ui/src/palette/headless/host.ts:33](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/host.ts#L33)

### `PaletteConversationHit`

Interface.

A conversation whose content matched a query.

```ts
interface PaletteConversationHit
```

**Properties**

- `excerpt` (`string`): The text around the best match.
- `matchCount` (`number`): How many turns matched.
- `sessionId` (`string`): The session key.
- `title?` (`string`): The session's title, when the host knows it.
- `updatedAt?` (`number`): The session's last update (epoch ms), when the host knows it.

Source: [ui/src/palette/headless/host.ts:87](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/host.ts#L87)

### `PaletteConversationQuery`

Interface.

What `PaletteHost.searchConversations` searches.

```ts
interface PaletteConversationQuery
```

**Properties**

- `archive?` (`'all' | 'active' | 'archived'`): Which sessions the list was loaded with (hosts that scan their own list narrow it by this).
- `query` (`string`): The query as typed (trimmed, at least two characters).
- `sessionIds` (`readonly string[]`): The sessions to search: every loaded one.

Source: [ui/src/palette/headless/host.ts:101](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/host.ts#L101)

### `PaletteExtensions`

Interface.

The palette items extensions contribute, and running them.

```ts
interface PaletteExtensions
```

**Properties**

- `list` (`(ctx: PaletteContext & { cwd: string }) => Promise<readonly PaletteItem[]>`): Every extension provider's items for `ctx.cwd`; each item's `source` is its provider's id.
- `run` (`(sourceId: string, itemId: string, ctx: PaletteContext & { cwd: string }) => Promise<PaletteExtensionRun>`): Runs `itemId` on its provider `sourceId`.
- `subscribe?` (`(onChange: () => void) => () => void`): Called when the providers' items may have changed. Returns the unsubscribe.
- `watch?` (`(cwd: string) => () => void`): Keeps the providers' own live updates on for `cwd` while the palette is open. Returns the stop.

Source: [ui/src/palette/headless/host.ts:67](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/host.ts#L67)

### `PaletteFileEntry`

Interface.

One entry of a project listing.

```ts
interface PaletteFileEntry
```

**Properties**

- `kind` (`'dir' | 'file'`): Files are listed; folders are skipped.
- `path` (`string`): Path relative to the listed root, `/`-separated.

Source: [ui/src/palette/headless/host.ts:41](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/host.ts#L41)

### `PaletteFileQuery`

Interface.

What `PaletteHost.listFiles` lists.

```ts
interface PaletteFileQuery
```

**Properties**

- `root` (`string`): The project root (a folder, or a sandbox root such as `zidane-env://…`).
- `sessionId?` (`string`): The active session, for hosts that list a session's workspace.

Source: [ui/src/palette/headless/host.ts:49](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/host.ts#L49)

### `PaletteGather`

Interface.

What [`gatherPaletteItems`](https://zidane.si/docs/reference/ui-palette-headless.md#gatherPaletteItems) has at once, and how to drop what is still coming.

```ts
interface PaletteGather
```

**Properties**

- `cancel` (`() => void`): Drops the answers still on their way.
- `ready` (`Map<string, readonly PaletteItem[]>`): The items of every source that answered synchronously, by source id.

Source: [ui/src/palette/headless/gather.ts:4](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/gather.ts#L4)

### `PaletteHost`

Interface.

The data the palette's built-in sources read. Leave a member out and what needs it lists nothing.

```ts
interface PaletteHost
```

**Properties**

- `extensions?` (`PaletteExtensions`): Extension-contributed items. Absent: no extensions source.
- `recents?` (`PaletteRecents`): Persistent recents. Absent: recents last as long as the page.
- `settings?` (`Readable<Partial<Settings>>`): The settings in effect, read when the palette lists its rows. Absent: no settings rows.
- `listCommands?` (`(query: PaletteCommandQuery) => Promise<readonly PaletteCommand[]>`): The `/` commands for a folder. Absent: no commands source.
- `listFiles?` (`(query: PaletteFileQuery) => Promise<readonly PaletteFileEntry[]>`): The project's files (without gitignored ones). Absent: no files source.
- `searchConversations?` (`(query: PaletteConversationQuery) => Promise<readonly PaletteConversationHit[]>`): 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>`): Applies a settings patch. Absent: settings rows are not offered.

Source: [ui/src/palette/headless/host.ts:111](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/host.ts#L111)

### `PalettePanels`

Interface.

The side panel, read when the palette lists its rows.

```ts
interface PalettePanels
```

**Properties**

- `activeTabId?` (`string`): The tab on show.
- `attention` (`Readonly<Record<string, { count: number; tone: string } | undefined>>`): Badge counts per tab id; `attention` reads as waiting on you.
- `open` (`boolean`): Whether the panel shows.
- `tabs` (`readonly PalettePanelTab[]`): The tabs, in strip order.
- `close` (`() => void`): Closes the panel.
- `pick` (`(tabId: string) => void`): Shows a tab (opening the panel).
- `toggle` (`() => void`): Opens or closes the panel.

Source: [ui/src/palette/headless/app-sources.ts:157](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/app-sources.ts#L157)

### `PalettePanelTab`

Interface.

A side panel tab as the palette lists it.

```ts
interface PalettePanelTab
```

**Properties**

- `icon?` (`string`): Its glyph (an Uno icon class).
- `id` (`string`): The tab's id.
- `label` (`string`): Its name (the row reads "<label> panel").

Source: [ui/src/palette/headless/app-sources.ts:147](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/app-sources.ts#L147)

### `PalettePref`

Interface.

A preference the palette reads and writes.

```ts
interface PalettePref<T>
```

**Type parameters**

- `T`

**Properties**

- `get` (`() => T`): The preferences in effect.
- `set` (`(update: Partial<T>) => void`): Merges `update` into them.

Source: [ui/src/palette/headless/app-sources.ts:304](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/app-sources.ts#L304)

### `PalettePrefs`

Interface.

The per-device preferences [`prefsSource`](https://zidane.si/docs/reference/ui-palette-headless.md#prefsSource) lists. Leave one out and its rows are not listed.

```ts
interface PalettePrefs
```

**Properties**

- `appearance?` (`PalettePref<AppearanceState>`): The appearance prefs (mode, reduced motion, files tree side).
- `editor?` (`PalettePref<EditorState>`): The editor prefs (editing, wrap, diagnostics, language server features).
- `modelPicker?` (`PalettePref<{ showLegacy: boolean }>`): The model picker's "show legacy models".
- `openSettings?` (`(tab: 'appearance' | 'editor') => void`): Opens a Settings page. Absent: no "… settings" rows.

Source: [ui/src/palette/headless/app-sources.ts:312](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/app-sources.ts#L312)

### `PaletteRankResponse`

Interface.

The ranking worker's answer to a `rank` request.

```ts
interface PaletteRankResponse
```

**Properties**

- `catalog` (`number`): The catalog it ranked.
- `id` (`number`): The request's id.
- `query` (`string`): The query it ranked.
- `rows` (`{ at: number; score: number; titleMatches: readonly number[] }[] | null`): Positions in the catalog with their score and highlight; null for a catalog the worker no longer has.

Source: [ui/src/palette/headless/rank-protocol.ts:14](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/rank-protocol.ts#L14)

### `PaletteRecents`

Interface.

Where the palette keeps its recently run item ids (most recent first).

```ts
interface PaletteRecents
```

**Properties**

- `read` (`() => readonly string[]`): The stored ids; empty when nothing is stored or it is unreadable.
- `write` (`(next: readonly string[]) => void`): Stores `next`. Best effort: a failure keeps the in-memory list.

Source: [ui/src/palette/headless/host.ts:79](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/host.ts#L79)

### `PaletteSession`

Interface.

A session as the palette's session sources read it.

```ts
interface PaletteSession
```

**Properties**

- `cwd` (`string`): Its folder (the row shows the folder's name).
- `id` (`string`): The session key.
- `title?` (`string`): Its title; empty or absent reads as the untitled label.
- `updatedAt` (`number`): Last update, epoch ms (orders the rows, the row's age).

Source: [ui/src/palette/headless/session-sources.ts:29](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/session-sources.ts#L29)

### `PaletteSettingsAccess`

Interface.

What [`settingsSource`](https://zidane.si/docs/reference/ui-palette-headless.md#settingsSource) reads and writes: the host's settings members, or an app's own settings state.

```ts
interface PaletteSettingsAccess
```

**Properties**

- `settings` (`{ get(): Partial<Settings> }`): The settings in effect, read when the palette lists its rows.
- `setSettings` (`(patch: Partial<Settings>) => void | Promise<void>`): Applies a patch.

Source: [ui/src/palette/headless/sources.ts:245](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/sources.ts#L245)

### `PaletteState`

Interface.

What the palette shows from: one immutable snapshot per change.

```ts
interface PaletteState
```

**Properties**

- `isOpen` (`boolean`): Whether the palette is open.
- `recents` (`readonly string[]`): Recently run item ids, most recent first.
- `sources` (`readonly PaletteProvider[]`): Every registered source, in registration order.
- `version` (`number`): Bumps whenever an open palette's source signalled a change through `subscribe`.

Source: [ui/src/palette/headless/store.ts:19](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/store.ts#L19)

### `PaletteStore`

Interface.

The palette's state and what changes it. Every method is stable.

```ts
interface PaletteStore
```

**Properties**

- `state` (`Readable<PaletteState>`): The current [`PaletteState`](https://zidane.si/docs/reference/ui-palette-headless.md#PaletteState).
- `close` (`() => void`): Closes the palette.
- `markRecent` (`(id: string) => void`): Puts `id` first in the recents and persists them.
- `open` (`() => void`): Opens the palette.
- `registerSource` (`(source: PaletteProvider) => () => void`): Registers a source (replacing one with the same id). Returns its unregister.
- `toggle` (`() => void`): Opens a closed palette, closes an open one.

Source: [ui/src/palette/headless/store.ts:31](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/store.ts#L31)

### `PaletteStoreOptions`

Interface.

Options of [`createPaletteStore`](https://zidane.si/docs/reference/ui-palette-headless.md#createPaletteStore).

```ts
interface PaletteStoreOptions
```

**Properties**

- `recents?` (`PaletteRecents`): Where the recents persist. Default: in memory only.

Source: [ui/src/palette/headless/store.ts:47](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/store.ts#L47)

## Types

### `PaletteBindings`

Type.

The live chord of each action, in the app's binding grammar (an empty string: unbound).

```ts
type PaletteBindings = () => Partial<Record<KeyAction, string>>
```

Source: [ui/src/palette/headless/app-sources.ts:17](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/app-sources.ts#L17)

### `PaletteExtensionRun`

Type.

What running an extension item answered.

```ts
type PaletteExtensionRun =
  | { ok: true; result: PaletteRunResult }
  | { error: PaletteHostError; ok: false }
```

Source: [ui/src/palette/headless/host.ts:64](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/host.ts#L64)

### `PaletteHostError`

Type.

Why a host call failed, for the palette to word through its labels.

```ts
type PaletteHostError = { code: 'unavailable' } | { code: 'failed'; message: string }
```

Source: [ui/src/palette/headless/host.ts:57](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/host.ts#L57)

### `PaletteLabels`

Type.

The shape of the palette label dictionary: every key of [`DEFAULT_PALETTE_LABELS`](https://zidane.si/docs/reference/ui-palette-headless.md#DEFAULT_PALETTE_LABELS).

```ts
type PaletteLabels = typeof DEFAULT_PALETTE_LABELS
```

Source: [ui/src/palette/headless/labels.ts:126](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/labels.ts#L126)

### `PaletteRankRequest`

Type.

A message to the ranking worker: a new catalog, or a query on the current one.

```ts
type PaletteRankRequest =
  | { catalog: number; items: readonly PaletteItem[]; kind: 'catalog' }
  | { catalog: number; id: number; kind: 'rank'; query: string }
```

Source: [ui/src/palette/headless/rank-protocol.ts:9](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/rank-protocol.ts#L9)

### `PaletteRecentsStorage`

Type.

The `Storage` calls [`createStorageRecents`](https://zidane.si/docs/reference/ui-palette-headless.md#createStorageRecents) makes (`localStorage`, `sessionStorage` or a double).

```ts
type PaletteRecentsStorage = Pick<Storage, 'getItem' | 'setItem'>
```

Source: [ui/src/palette/headless/recents.ts:4](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/recents.ts#L4)

### `SessionRank`

Type.

0 = needs you (approval, question), 1 = running, 2 = everything else.

```ts
type SessionRank = 0 | 1 | 2
```

Source: [ui/src/palette/headless/session-sources.ts:66](https://github.com/Tahul/zidane/blob/main/ui/src/palette/headless/session-sources.ts#L66)
