# songstress

> Every type of the API that both entries share, as the SDK records it.

Page: https://songstress.app/docs/develop/reference/songstress/

The `songstress` module is what code that runs in either entry imports, and it declares the types every other module shares: the API itself, the library's things, the interface's components, the actions, the providers' answers.

What it exports is the SDK's own record of its public surface, which the SDK's tests hold to the code. Each type's
fields, and every description, are read from the SDK's source when the site is built.

### API_PERMISSIONS

Every member of the API by its full name, with the permission its call
needs (null for none), for each entry. A host checks grants from this
table, and its tests prove each member refuses without its grant.
`net.fetch` is listed under `network`: a request to a target on the user's
own network needs `network.local` instead.

```ts
export declare const API_PERMISSIONS: Readonly<{
    shared: Readonly<Record<string, Needs>>;
    server: Readonly<Record<string, Needs>>;
    client: Readonly<Record<string, Needs>>;
}>;
```

Refers to [Needs](/docs/develop/reference/songstress/#type-Needs).

### API_VERSION

The version of the extension API this package describes: the version a
manifest's `engines.songstress` is held against. It is the package's own
version (a test holds the two together), and it moves whenever the public
surface does (api/surface.txt).

```ts
export declare const API_VERSION = "0.1.8";
```

### Action

What a tap, a button or a command's answer does: one of the actions, by its `type`.

```ts
export type Action = InvokeAction | NavigateAction | PlayAction | QueueAction | OpenUrlAction | CopyAction | ShareAction | ToastAction | ConfirmAction | RefreshAction | PickAction | InputAction | NotifyAction;
```

Refers to [InvokeAction](/docs/develop/reference/songstress/#type-InvokeAction), [NavigateAction](/docs/develop/reference/songstress/#type-NavigateAction), [PlayAction](/docs/develop/reference/songstress/#type-PlayAction), [QueueAction](/docs/develop/reference/songstress/#type-QueueAction), [OpenUrlAction](/docs/develop/reference/songstress/#type-OpenUrlAction), [CopyAction](/docs/develop/reference/songstress/#type-CopyAction), [ShareAction](/docs/develop/reference/songstress/#type-ShareAction), [ToastAction](/docs/develop/reference/songstress/#type-ToastAction), [ConfirmAction](/docs/develop/reference/songstress/#type-ConfirmAction), [RefreshAction](/docs/develop/reference/songstress/#type-RefreshAction), [PickAction](/docs/develop/reference/songstress/#type-PickAction), [InputAction](/docs/develop/reference/songstress/#type-InputAction), [NotifyAction](/docs/develop/reference/songstress/#type-NotifyAction).

### Album

An album of the library.

| Field | Type | Description |
|---|---|---|
| `id` | `string` | Its library id. |
| `name` | `string` | Its name. |
| `artist` | `string` | Its artist's name. |
| `artistId?` | `string \| undefined` | Its artist's library id. |
| `year?` | `number \| undefined` | The year it came out. |
| `genre?` | `string \| undefined` | Its genre. |
| `songCount?` | `number \| undefined` | How many songs it holds. |
| `durationS?` | `number \| undefined` | Its length, in seconds. |
| `musicBrainzId?` | `string \| undefined` | The release group's MusicBrainz id, when the tags carry one. |

### AlbumCard

An album of the library, drawn as Songstress draws it, with its own menu.

| Field | Type | Description |
|---|---|---|
| `type` | `"album"` | Always `"album"`: which kind this is. |
| `albumId` | `string` | The album's library id. |

### Artist

An artist of the library.

| Field | Type | Description |
|---|---|---|
| `id` | `string` | Its library id. |
| `name` | `string` | Its name. |
| `albumCount?` | `number \| undefined` | How many albums the library holds of theirs. |
| `musicBrainzId?` | `string \| undefined` | Its MusicBrainz id. |

### ArtistBiography

Who an artist is, in a source's words.

| Field | Type | Description |
|---|---|---|
| `text` | `string` | Plain text, its paragraphs apart by a line break. The first 4000 characters are kept. |
| `url?` | `string \| undefined` | The page the words are from, for "Read more". At most 2000 characters. |
| `language?` | `string \| undefined` | The language the words are in, as a BCP 47 tag: "en", "pt-BR". |

### ArtistCard

An artist of the library, drawn as Songstress draws them, with their own menu.

| Field | Type | Description |
|---|---|---|
| `type` | `"artist"` | Always `"artist"`: which kind this is. |
| `artistId` | `string` | The artist's library id. |

### ArtistInfoProvider

Words about an artist. Implement the method for each thing the manifest
lists under `supports`. Both are asked by the server for itself, never
for one member.

| Field | Type | Description |
|---|---|---|
| `biography?` | `((artist: ArtistQuery, context: ProviderContext) => Awaitable<ArtistBiography \| null>) \| undefined` | Supports "biography": who the artist is; null unless the source can stand behind who it is. A namesake's story is worse than none. |
| `similarArtists?` | `((artist: ArtistQuery, limit: number, context: ProviderContext) => Awaitable<CatalogArtist[]>) \| undefined` | Supports "similar": the artists like this one, most alike first, at most `limit` (never over 50). Each is named by the source's own id; Songstress finds them in the library by name and by `ids`. Empty when the source knows none. |

Refers to [ArtistQuery](/docs/develop/reference/songstress/#type-ArtistQuery), [ProviderContext](/docs/develop/reference/songstress/#type-ProviderContext), [Awaitable](/docs/develop/reference/songstress/#type-Awaitable), [ArtistBiography](/docs/develop/reference/songstress/#type-ArtistBiography), [CatalogArtist](/docs/develop/reference/songstress/#type-CatalogArtist).

### ArtistPhoto

One photo in up to three sizes, as addresses.

| Field | Type | Description |
|---|---|---|
| `large` | `string` | The picture's address at a large size. |
| `medium?` | `string \| undefined` | The picture's address at a medium size. |
| `small?` | `string \| undefined` | The picture's address at a small size. |

### ArtistQuery

An artist Songstress wants a photo of, or words about, with what the
library holds under the name: the evidence that tells them from a
namesake.

| Field | Type | Description |
|---|---|---|
| `name` | `string` | The artist's name, as the library has it. |
| `songs` | `string[]` | Titles of their songs in the library. |
| `releases` | `string[]` | Titles of their releases in the library. |
| `isrcs` | `string[]` | ISRCs of the artist's songs the library holds, to tell them from a namesake. |
| `ids?` | `Partial<Record<ProviderGroup, string>> \| undefined` | Their ids in the catalogues the library knows. |

Refers to [CatalogIds](/docs/develop/reference/songstress/#type-CatalogIds).

### ArtworkProvider

Pictures. Implement the method for each kind the manifest lists under
`supports`.

| Field | Type | Description |
|---|---|---|
| `artistPhoto?` | `((artist: ArtistQuery, context: ProviderContext) => Awaitable<ArtistPhoto \| null>) \| undefined` | The artist's photo; null unless the source can stand behind who it is. A namesake's photo is worse than none. |
| `albumCover?` | `((album: { artist: string; title: string; }, context: ProviderContext) => Awaitable<string \| null>) \| undefined` | The address of the album's cover; null when the source lists none. |

Refers to [ArtistQuery](/docs/develop/reference/songstress/#type-ArtistQuery), [ProviderContext](/docs/develop/reference/songstress/#type-ProviderContext), [Awaitable](/docs/develop/reference/songstress/#type-Awaitable), [ArtistPhoto](/docs/develop/reference/songstress/#type-ArtistPhoto).

### AudioContainer

The file formats Songstress can serve.

```ts
export type AudioContainer = 'flac' | 'm4a' | 'mp3' | 'ogg' | 'opus' | 'webm' | 'wav';
```

### AudioFacts

What a source says about the audio it would hand out for a track.

| Field | Type | Description |
|---|---|---|
| `codec?` | `string \| undefined` | "flac", "aac", "mp3", "opus"… |
| `bitDepth?` | `number \| undefined` | Bits a sample, for lossless audio. |
| `sampleRateHz?` | `number \| undefined` | Samples a second, in hertz. |
| `bitrateKbps?` | `number \| undefined` | Its bitrate, in kilobits a second. |

### Awaitable

A value, or a promise of it: a handler may answer either way.

```ts
export type Awaitable<Value> = Value | Promise<Value>;
```

### BadgeBlock

A short word in a pill.

| Field | Type | Description |
|---|---|---|
| `type` | `"badge"` | Always `"badge"`: which kind this is. |
| `text` | `string` | A word or two. |
| `tone?` | `Tone \| undefined` | Its colour, by meaning. |

Refers to [Tone](/docs/develop/reference/songstress/#type-Tone).

### BannerBlock

A notice across the page.

| Field | Type | Description |
|---|---|---|
| `type` | `"banner"` | Always `"banner"`: which kind this is. |
| `tone` | `"danger" \| "info" \| "success" \| "warning"` | Its colour, by meaning. |
| `title` | `string` | What the banner says. |
| `text?` | `string \| undefined` | A sentence more. |
| `button?` | `{ title: string; action: Action; } \| undefined` | One thing to do about it. |

Refers to [Action](/docs/develop/reference/songstress/#type-Action).

### Block

What a detail screen, a section and a panel are built from.

```ts
export type Block = StackBlock | SectionBlock | TextBlock | IconBlock | ImageBlock | BadgeBlock | ProgressBlock | BannerBlock | DividerBlock | SpacerBlock | CollapsibleBlock | ButtonBlock | MenuBlock | ShelfBlock | SongRow | AlbumCard | ArtistCard | PlaylistCard;
```

Refers to [StackBlock](/docs/develop/reference/songstress/#type-StackBlock), [SectionBlock](/docs/develop/reference/songstress/#type-SectionBlock), [TextBlock](/docs/develop/reference/songstress/#type-TextBlock), [IconBlock](/docs/develop/reference/songstress/#type-IconBlock), [ImageBlock](/docs/develop/reference/songstress/#type-ImageBlock), [BadgeBlock](/docs/develop/reference/songstress/#type-BadgeBlock), [ProgressBlock](/docs/develop/reference/songstress/#type-ProgressBlock), [BannerBlock](/docs/develop/reference/songstress/#type-BannerBlock), [DividerBlock](/docs/develop/reference/songstress/#type-DividerBlock), [SpacerBlock](/docs/develop/reference/songstress/#type-SpacerBlock), [CollapsibleBlock](/docs/develop/reference/songstress/#type-CollapsibleBlock), [ButtonBlock](/docs/develop/reference/songstress/#type-ButtonBlock), [MenuBlock](/docs/develop/reference/songstress/#type-MenuBlock), [ShelfBlock](/docs/develop/reference/songstress/#type-ShelfBlock), [SongRow](/docs/develop/reference/songstress/#type-SongRow), [AlbumCard](/docs/develop/reference/songstress/#type-AlbumCard), [ArtistCard](/docs/develop/reference/songstress/#type-ArtistCard), [PlaylistCard](/docs/develop/reference/songstress/#type-PlaylistCard).

### ButtonBlock

A button that does an action.

| Field | Type | Description |
|---|---|---|
| `type` | `"button"` | Always `"button"`: which kind this is. |
| `title` | `string` | The button's label. |
| `action` | `Action` | What choosing it does. |
| `icon?` | `string \| undefined` | An icon from Songstress's icon set. |
| `style?` | `"destructive" \| "primary" \| "secondary" \| undefined` | Left out, "secondary". A page has at most one primary button. |
| `disabled?` | `boolean \| undefined` | Shown, but it cannot be chosen. |

Refers to [Action](/docs/develop/reference/songstress/#type-Action), [IconName](/docs/develop/reference/songstress/#type-IconName).

### Card

A card of a grid or a shelf.

| Field | Type | Description |
|---|---|---|
| `type` | `"card"` | Always `"card"`: which kind this is. |
| `id` | `string` | Unique among the cards beside it. |
| `title` | `string` | Its title. |
| `subtitle?` | `string \| undefined` | A line under the title. |
| `image?` | `ImageSource \| undefined` | Its picture. |
| `action?` | `Action \| undefined` | What choosing it does. |
| `menu?` | `MenuEntry[] \| undefined` | Its menu. |

Refers to [ImageSource](/docs/develop/reference/songstress/#type-ImageSource), [Action](/docs/develop/reference/songstress/#type-Action), [MenuEntry](/docs/develop/reference/songstress/#type-MenuEntry).

### CatalogAlbum

An album of a source's catalogue, as a search or a link finds it.

| Field | Type | Description |
|---|---|---|
| `id` | `string` | The source's own id for it. |
| `title` | `string` | Its title. |
| `artists` | `string[]` | Its artists' names, the main one first. |
| `artistId?` | `string \| undefined` | The source's id for its main artist. |
| `kind?` | `"album" \| "compilation" \| "ep" \| "single" \| undefined` | What kind of release it is. |
| `releaseDate?` | `string \| undefined` | When it came out, as an ISO 8601 date or a year. |
| `trackCount?` | `number \| undefined` | How many tracks it holds. |
| `explicit?` | `boolean \| undefined` | Marked explicit. |
| `upc?` | `string \| undefined` | Its UPC barcode. |
| `coverUrl?` | `string \| undefined` | Its cover's address, http or https. |
| `url?` | `string \| undefined` | Its page at the source. |
| `ids?` | `Partial<Record<ProviderGroup, string>> \| undefined` | Its ids in the catalogues Songstress knows. |

Refers to [CatalogIds](/docs/develop/reference/songstress/#type-CatalogIds).

### CatalogAlbumDetail

An album of a source's catalogue, opened: with its tracks.

| Field | Type | Description |
|---|---|---|
| `tracks` | `CatalogTrack[]` | Its tracks, in order. |
| `id` | `string` | The source's own id for it. |
| `title` | `string` | Its title. |
| `artists` | `string[]` | Its artists' names, the main one first. |
| `artistId?` | `string \| undefined` | The source's id for its main artist. |
| `kind?` | `"album" \| "compilation" \| "ep" \| "single" \| undefined` | What kind of release it is. |
| `releaseDate?` | `string \| undefined` | When it came out, as an ISO 8601 date or a year. |
| `trackCount?` | `number \| undefined` | How many tracks it holds. |
| `explicit?` | `boolean \| undefined` | Marked explicit. |
| `upc?` | `string \| undefined` | Its UPC barcode. |
| `coverUrl?` | `string \| undefined` | Its cover's address, http or https. |
| `url?` | `string \| undefined` | Its page at the source. |
| `ids?` | `Partial<Record<ProviderGroup, string>> \| undefined` | Its ids in the catalogues Songstress knows. |

Refers to [CatalogAlbum](/docs/develop/reference/songstress/#type-CatalogAlbum), [CatalogTrack](/docs/develop/reference/songstress/#type-CatalogTrack).

### CatalogArtist

An artist of a source's catalogue, as a search or a link finds them.

| Field | Type | Description |
|---|---|---|
| `id` | `string` | The source's own id for it. |
| `name` | `string` | Their name. |
| `imageUrl?` | `string \| undefined` | Their picture's address, http or https. |
| `url?` | `string \| undefined` | Its page at the source. |
| `ids?` | `Partial<Record<ProviderGroup, string>> \| undefined` | Its ids in the catalogues Songstress knows. |

Refers to [CatalogIds](/docs/develop/reference/songstress/#type-CatalogIds).

### CatalogArtistDetail

An artist of a source's catalogue, opened: with their albums and top tracks.

| Field | Type | Description |
|---|---|---|
| `biography?` | `string \| undefined` | Who they are, in words. |
| `albums` | `CatalogAlbum[]` | Their albums. |
| `topTracks?` | `CatalogTrack[] \| undefined` | The artist's most played tracks, most played first. |
| `id` | `string` | The source's own id for it. |
| `name` | `string` | Their name. |
| `imageUrl?` | `string \| undefined` | Their picture's address, http or https. |
| `url?` | `string \| undefined` | Its page at the source. |
| `ids?` | `Partial<Record<ProviderGroup, string>> \| undefined` | Its ids in the catalogues Songstress knows. |

Refers to [CatalogArtist](/docs/develop/reference/songstress/#type-CatalogArtist), [CatalogAlbum](/docs/develop/reference/songstress/#type-CatalogAlbum), [CatalogTrack](/docs/develop/reference/songstress/#type-CatalogTrack).

### CatalogIds

The ids a thing has in Songstress's own catalogues, when the source knows
them: they let Songstress see that two sources mean the same thing.

```ts
export type CatalogIds = Partial<Record<ProviderGroup, string>>;
```

Refers to [ProviderGroup](/docs/develop/reference/songstress/#type-ProviderGroup).

### CatalogPlaylist

A playlist of a source's catalogue, as a search or a link finds it.

| Field | Type | Description |
|---|---|---|
| `id` | `string` | The source's own id for it. |
| `title` | `string` | Its title. |
| `owner?` | `string \| undefined` | Who made it, as the source names them. |
| `description?` | `string \| undefined` | What the playlist says about itself. |
| `trackCount?` | `number \| undefined` | How many tracks it holds. |
| `coverUrl?` | `string \| undefined` | Its cover's address, http or https. |
| `url?` | `string \| undefined` | Its page at the source. |

### CatalogPlaylistDetail

A playlist of a source's catalogue, opened: with its tracks.

| Field | Type | Description |
|---|---|---|
| `tracks` | `CatalogTrack[]` | Its tracks, in order. |
| `id` | `string` | The source's own id for it. |
| `title` | `string` | Its title. |
| `owner?` | `string \| undefined` | Who made it, as the source names them. |
| `description?` | `string \| undefined` | What the playlist says about itself. |
| `trackCount?` | `number \| undefined` | How many tracks it holds. |
| `coverUrl?` | `string \| undefined` | Its cover's address, http or https. |
| `url?` | `string \| undefined` | Its page at the source. |

Refers to [CatalogPlaylist](/docs/develop/reference/songstress/#type-CatalogPlaylist), [CatalogTrack](/docs/develop/reference/songstress/#type-CatalogTrack).

### CatalogTrack

A track as a source lists it. `id` is the source's own.

| Field | Type | Description |
|---|---|---|
| `id` | `string` | The source's own id for it. |
| `title` | `string` | The title without the words of its edition, when the source keeps them apart (see `version`). |
| `version?` | `string \| undefined` | The edition, when the source names it apart from the title: "Live", "Remastered 2011", "Radio Edit". Songstress tells two editions of one song apart by it. |
| `artists` | `string[]` | Its artists' names, the main one first. |
| `artistId?` | `string \| undefined` | The source's id of the first artist. |
| `album?` | `string \| undefined` | Its album's title. |
| `albumId?` | `string \| undefined` | The source's id for its album. |
| `albumArtist?` | `string \| undefined` | The album's artist, where it is not the track's. |
| `durationS?` | `number \| undefined` | Its length, in seconds. |
| `trackNumber?` | `number \| undefined` | Its place on the album. |
| `discNumber?` | `number \| undefined` | Its disc. |
| `releaseDate?` | `string \| undefined` | YYYY, YYYY-MM or YYYY-MM-DD. |
| `isrc?` | `string \| undefined` | Its ISRC. |
| `explicit?` | `boolean \| undefined` | Marked explicit. |
| `coverUrl?` | `string \| undefined` | Its cover's address, http or https. |
| `url?` | `string \| undefined` | The track's page on the source's own site. |
| `ids?` | `Partial<Record<ProviderGroup, string>> \| undefined` | Its ids in the catalogues Songstress knows. |
| `audio?` | `AudioFacts \| undefined` | What the source's audio is: its format and quality. |

Refers to [CatalogIds](/docs/develop/reference/songstress/#type-CatalogIds), [AudioFacts](/docs/develop/reference/songstress/#type-AudioFacts).

### CatalogType

A kind of thing a source lists.

```ts
export type CatalogType = "track" | "album" | "artist" | "playlist";
```

### CheckboxField

A form's checkbox: true or false.

| Field | Type | Description |
|---|---|---|
| `type` | `"checkbox"` | Always `"checkbox"`: which kind this is. |
| `value?` | `boolean \| undefined` | Whether it is ticked at first. |
| `name` | `string` | Unique in the form. |
| `label` | `string` | The field's label. |
| `help?` | `string \| undefined` | A line of help under the field. |

### ClientApi

The API of the client entry: code that runs inside one app, in a sandbox,
for the member signed in there, while the app is open.

| Field | Type | Description |
|---|---|---|
| `hooks` | `ClientHooks` | This device's player, live, while the app is open. |
| `commands` | `ClientCommands` | The handlers of the extension's commands, and running one of its server commands. |
| `ui` | `ClientUi` | The renderers of the extension's pages, panels and status items, and notices in this app. |
| `player` | `Player` | This device's player. Permissions `listening.read` and `player.control`. |
| `queue` | `Queue` | This device's queue. Permissions `listening.read` and `player.control`. |
| `settings` | `Settings` | The extension's settings, as Songstress keeps them. |
| `storage` | `Store` | The extension's own small store. Permission `storage`. |
| `net` | `Net` | The only way to the network. Permission `network`. |
| `host` | `Host` | What the code runs in: the API version, the side, and on the client the app. |

Refers to [SharedApi](/docs/develop/reference/songstress/#type-SharedApi), [ClientHooks](/docs/develop/reference/songstress/#type-ClientHooks), [ClientCommands](/docs/develop/reference/songstress/#type-ClientCommands), [ClientUi](/docs/develop/reference/songstress/#type-ClientUi), [Player](/docs/develop/reference/songstress/#type-Player), [Queue](/docs/develop/reference/songstress/#type-Queue).

### ClientCapabilities

What an app can show or run of an extension.

| Field | Type | Description |
|---|---|---|
| `clientCode` | `boolean` | It runs extensions' client entries. |
| `views` | `boolean` | It opens free-form views: in the browser, apart from the app. |

### ClientCommands

Commands as client code has them: it may also run one.

| Field | Type | Description |
|---|---|---|
| `execute` | `<Value = unknown>(id: string, input?: unknown) => Promise<Value \| undefined>` | Runs one of the extension's own commands, in the entry it names in `run`, for the member signed in here, and resolves to the `value` it left. This is how client code asks its server half for something. Server code has no `execute`: it calls its own functions, and a command it ran would have no member to run for. |
| `register` | `<Input = unknown>(id: string, handler: CommandHandler<Input>) => Disposable` | Sets the handler of one of the manifest's commands, in the entry the command names in `run`. |

Refers to [Commands](/docs/develop/reference/songstress/#type-Commands).

### ClientHooks

The hooks of the client entry. They follow the player of the one device
the code runs on, live, while its app is open and in front: client code is
stopped in the background and told the current state when it comes back.
All but onVolumeChange need the permission `listening.read`.

| Field | Type | Description |
|---|---|---|
| `onPlay` | `(listener: (song: Song, state: PlayerState) => Awaitable<void>) => Disposable` | Playback started or went on after a pause. |
| `onPause` | `(listener: (song: Song, state: PlayerState) => Awaitable<void>) => Disposable` | Playback paused. |
| `onTrackChange` | `(listener: (song: Song \| null, state: PlayerState) => Awaitable<void>) => Disposable` | Another song became the current one; null when the player emptied. |
| `onSeek` | `(listener: (positionS: number, state: PlayerState) => Awaitable<void>) => Disposable` | The listener moved to another place in the song. |
| `onVolumeChange` | `(listener: (volume: number) => Awaitable<void>) => Disposable` | The volume changed; from 0 to 1. No permission. |
| `onQueueChange` | `(listener: (queue: QueueState) => Awaitable<void>) => Disposable` | Songs were added to the queue, removed from it or moved. |
| `onProgress` | `(listener: (positionS: number, state: PlayerState) => Awaitable<void>) => Disposable` | Playback moved on: at most once a second, and only while a song plays. |

Refers to [SharedHooks](/docs/develop/reference/songstress/#type-SharedHooks), [Song](/docs/develop/reference/songstress/#type-Song), [PlayerState](/docs/develop/reference/songstress/#type-PlayerState), [Awaitable](/docs/develop/reference/songstress/#type-Awaitable), [Disposable](/docs/develop/reference/songstress/#type-Disposable), [QueueState](/docs/develop/reference/songstress/#type-QueueState).

### ClientInfo

An app that draws an extension's interface or runs its client code.

| Field | Type | Description |
|---|---|---|
| `platform` | `Platform` | The app: web, desktop, ios or android. |
| `ui` | `number` | The version of the component vocabulary the app draws. A node it does not know is shown as "needs a newer app". |
| `capabilities` | `ClientCapabilities` | What the app can do: run extensions' client code, open views. |

Refers to [Platform](/docs/develop/reference/songstress/#type-Platform), [ClientCapabilities](/docs/develop/reference/songstress/#type-ClientCapabilities).

### ClientUi

Declared interface as client code has it: the same, in its own app.

| Field | Type | Description |
|---|---|---|
| `notify` | `(notice: Notice) => Promise<void>` | Shows a notice in this app. At most ten an hour. |
| `refresh` | `(target: RefreshTarget) => Promise<void>` | Renders a page, a panel or a status item again, where it is showing. |
| `pages` | `Pages` | The renderers of the extension's pages. |
| `panels` | `Panels` | The renderers of the extension's panels. |
| `status` | `StatusItems` | The renderers of the extension's status items. |

Refers to [Ui](/docs/develop/reference/songstress/#type-Ui), [Notice](/docs/develop/reference/songstress/#type-Notice), [RefreshTarget](/docs/develop/reference/songstress/#type-RefreshTarget).

### CollapsibleBlock

Blocks a tap opens and closes.

| Field | Type | Description |
|---|---|---|
| `type` | `"collapsible"` | Always `"collapsible"`: which kind this is. |
| `title` | `string` | What shows while it is closed. |
| `open?` | `boolean \| undefined` | Open at first. |
| `children` | `Block[]` | What it holds, shown open. |

Refers to [Block](/docs/develop/reference/songstress/#type-Block).

### CommandContext

What a command's handler is told beside its input.

| Field | Type | Description |
|---|---|---|
| `userId` | `string` | The member who ran it. |
| `source` | `"action" \| "code" \| "form" \| "input" \| "menu" \| "pick" \| "settings"` | How it was run: from a menu, by an action of a page, by a form, by a button of the settings page, by a pick or an input action with the person's answer, or by client code (`commands.execute`). |
| `location?` | `keyof Menus \| undefined` | The menu it was picked from, when it was. |
| `client?` | `ClientInfo \| undefined` | The app it was run from, when a person ran it. |
| `values?` | `FormValues \| undefined` | The form's fields, when a form ran it. |
| `answer?` | `string \| string[] \| undefined` | The person's answer, when a pick or an input action ran it: the id chosen (the ids, for a pick of several), or the text written. |

Refers to [MenuLocation](/docs/develop/reference/songstress/#type-MenuLocation), [ClientInfo](/docs/develop/reference/songstress/#type-ClientInfo), [FormValues](/docs/develop/reference/songstress/#type-FormValues).

### CommandHandler

A command's handler. `input` is what the command was run on: the song,
album, artist or playlist whose menu it was picked from, or the `input` of
the action, the form or the call that ran it.

```ts
export type CommandHandler<Input = unknown> = (input: Input, context: CommandContext) => Awaitable<CommandOutcome | void>;
```

Refers to [CommandContext](/docs/develop/reference/songstress/#type-CommandContext), [Awaitable](/docs/develop/reference/songstress/#type-Awaitable), [CommandOutcome](/docs/develop/reference/songstress/#type-CommandOutcome).

### CommandOutcome

What a command leaves behind. Both parts are optional.

| Field | Type | Description |
|---|---|---|
| `action?` | `Action \| undefined` | What the app does next, when a person ran the command. |
| `value?` | `unknown` | What `commands.execute` resolves to, when code ran it. JSON. |

Refers to [Action](/docs/develop/reference/songstress/#type-Action).

### Commands

Commands: the named actions of the manifest's `contributes.commands`.
Both sides; no permission.

| Field | Type | Description |
|---|---|---|
| `register` | `<Input = unknown>(id: string, handler: CommandHandler<Input>) => Disposable` | Sets the handler of one of the manifest's commands, in the entry the command names in `run`. |

Refers to [CommandHandler](/docs/develop/reference/songstress/#type-CommandHandler), [Disposable](/docs/develop/reference/songstress/#type-Disposable).

### ConfirmAction

Asks first, then does `action` when the person agrees.

| Field | Type | Description |
|---|---|---|
| `type` | `"confirm"` | Always `"confirm"`: which kind this is. |
| `title` | `string` | What is asked. |
| `message?` | `string \| undefined` | A sentence more. |
| `confirm?` | `string \| undefined` | The word on the button that agrees. |
| `destructive?` | `boolean \| undefined` | Yes is drawn as a destructive choice. |
| `action` | `Action` | What happens on yes. |

Refers to [Action](/docs/develop/reference/songstress/#type-Action).

### CopyAction

Copies text to the clipboard.

| Field | Type | Description |
|---|---|---|
| `type` | `"copy"` | Always `"copy"`: which kind this is. |
| `text` | `string` | The text to copy. |

### DateField

A form's date picker.

| Field | Type | Description |
|---|---|---|
| `type` | `"date-picker"` | Always `"date-picker"`: which kind this is. |
| `value?` | `string \| undefined` | A day, as YYYY-MM-DD. |
| `minimum?` | `string \| undefined` | The earliest date it takes. |
| `maximum?` | `string \| undefined` | The latest date it takes. |
| `name` | `string` | Unique in the form. |
| `label` | `string` | The field's label. |
| `help?` | `string \| undefined` | A line of help under the field. |

### Destination

Where a tap can lead: a page or a view of the extension's own, or
Songstress's page for something in the library.

```ts
export type Destination = {
    page: string;
    params?: Record<string, string>;
} | {
    view: string;
    params?: Record<string, string>;
} | {
    library: LibraryType;
    id: string;
};
```

Refers to [LibraryType](/docs/develop/reference/songstress/#type-LibraryType).

### DetailScreen

A page of blocks, read from top to bottom.

| Field | Type | Description |
|---|---|---|
| `type` | `"detail"` | Always `"detail"`: which kind this is. |
| `children` | `Block[]` | Its blocks, read from top to bottom. |

Refers to [Block](/docs/develop/reference/songstress/#type-Block).

### Disposable

Something that can be taken back: a listener, a handler, a provider.
`dispose()` removes it; calling it again does nothing. Everything an
extension registers is removed for it when the extension is stopped.

| Field | Type | Description |
|---|---|---|
| `dispose` | `() => void` | Takes the listener or handler away. |

### DividerBlock

A line between blocks.

| Field | Type | Description |
|---|---|---|
| `type` | `"divider"` | Always `"divider"`: which kind this is. |

### DownloadAvailability

Whether the source has a song, and under which id of its own.

| Field | Type | Description |
|---|---|---|
| `available` | `boolean` | Whether the source has the track. |
| `id?` | `string \| undefined` | The source's id for the track, handed back to `locate`. |

### DownloadLocation

Where a download's audio is: one file, or segments in order (with the
part that opens them, when the format has one). Songstress fetches them,
joins segments into one file of `container`, and verifies the result
before anything keeps it.

```ts
export type DownloadLocation = (StreamLocation & {
    kind: 'file';
}) | {
    kind: 'segments';
    urls: string[];
    initUrl?: string;
    headers?: Record<string, string>;
    container: AudioContainer;
};
```

Refers to [StreamLocation](/docs/develop/reference/songstress/#type-StreamLocation), [AudioContainer](/docs/develop/reference/songstress/#type-AudioContainer).

### DownloadProvider

A source songs can be acquired from. Off until the admin adds it and
turns it on.

| Field | Type | Description |
|---|---|---|
| `check` | `(track: TrackQuery, context: ProviderContext) => Awaitable<DownloadAvailability>` | Says whether the source has a track, and its id there. |
| `locate` | `(request: { id: string; quality: string; }, context: ProviderContext) => Awaitable<{ location: DownloadLocation; tags?: TrackFacts; } \| null>` | Where the audio is, at one of the manifest's `qualities`; null when it turned out not to be there. `tags` may carry what the source knows that the request did not (an ISRC above all). |

Refers to [TrackQuery](/docs/develop/reference/songstress/#type-TrackQuery), [ProviderContext](/docs/develop/reference/songstress/#type-ProviderContext), [Awaitable](/docs/develop/reference/songstress/#type-Awaitable), [DownloadAvailability](/docs/develop/reference/songstress/#type-DownloadAvailability), [DownloadLocation](/docs/develop/reference/songstress/#type-DownloadLocation), [TrackFacts](/docs/develop/reference/songstress/#type-TrackFacts).

### EmptyState

What a list or a grid shows when it has nothing to show.

| Field | Type | Description |
|---|---|---|
| `title` | `string` | What it says when there is nothing. |
| `text?` | `string \| undefined` | A sentence more. |
| `icon?` | `string \| undefined` | An icon from Songstress's icon set. |
| `button?` | `{ title: string; action: Action; } \| undefined` | A button that does something about it. |

Refers to [IconName](/docs/develop/reference/songstress/#type-IconName), [Action](/docs/develop/reference/songstress/#type-Action).

### Favorite

What a member marked as a favourite, or no longer does.

```ts
export type Favorite = {
    type: 'song';
    song: Song;
} | {
    type: 'album';
    album: Album;
} | {
    type: 'artist';
    artist: Artist;
};
```

Refers to [Song](/docs/develop/reference/songstress/#type-Song), [Album](/docs/develop/reference/songstress/#type-Album), [Artist](/docs/develop/reference/songstress/#type-Artist).

### FavoriteEvent

What `onFavorite` is told: a member marked a song, an album or an artist as a favourite, or took the mark away.

| Field | Type | Description |
|---|---|---|
| `userId` | `string` | The member who marked it. |
| `favorite` | `boolean` | True when it became a favourite, false when it stopped being one. |
| `at` | `string` | When, as an ISO 8601 time. |

### Field

One field of a form: what a `form` screen's sections hold.

```ts
export type Field = TextField | SwitchField | CheckboxField | SliderField | PickerField | DateField;
```

Refers to [TextField](/docs/develop/reference/songstress/#type-TextField), [SwitchField](/docs/develop/reference/songstress/#type-SwitchField), [CheckboxField](/docs/develop/reference/songstress/#type-CheckboxField), [SliderField](/docs/develop/reference/songstress/#type-SliderField), [PickerField](/docs/develop/reference/songstress/#type-PickerField), [DateField](/docs/develop/reference/songstress/#type-DateField).

### ForUser

One member, for a call that concerns them.

| Field | Type | Description |
|---|---|---|
| `userId` | `string` | The member the call concerns. |

### FormScreen

A page of fields and one button that submits them.

| Field | Type | Description |
|---|---|---|
| `type` | `"form"` | Always `"form"`: which kind this is. |
| `sections` | `{ title?: string; footer?: string; fields: Field[]; }[]` | Its sections of fields. |
| `submit` | `{ title: string; command: string; input?: unknown; }` | The button that hands the values to a command. |

Refers to [Field](/docs/develop/reference/songstress/#type-Field).

### FormValues

What a form's fields hold when it is submitted, by field name.

```ts
export type FormValues = Record<string, string | number | boolean>;
```

### GridScreen

A page of cards.

| Field | Type | Description |
|---|---|---|
| `type` | `"grid"` | Always `"grid"`: which kind this is. |
| `sections` | `{ title?: string; items: (Card \| AlbumCard \| ArtistCard \| PlaylistCard)[]; }[]` | Its sections of cards. |
| `search?` | `{ placeholder?: string; } \| undefined` | A search field over it, with its hint. |
| `empty?` | `EmptyState \| undefined` | What it shows when it holds nothing. |
| `nextCursor?` | `string \| undefined` | There are more cards: when the end is reached the page is rendered again with this in `RenderContext.cursor`, and its cards are added below. |

Refers to [Card](/docs/develop/reference/songstress/#type-Card), [AlbumCard](/docs/develop/reference/songstress/#type-AlbumCard), [ArtistCard](/docs/develop/reference/songstress/#type-ArtistCard), [PlaylistCard](/docs/develop/reference/songstress/#type-PlaylistCard), [EmptyState](/docs/develop/reference/songstress/#type-EmptyState).

### Host

Asking the host about itself. Both sides; no permission.

| Field | Type | Description |
|---|---|---|
| `info` | `() => Promise<HostInfo>` | What the code runs in: the API version, the side, the extension, and on the client the app. |

Refers to [HostInfo](/docs/develop/reference/songstress/#type-HostInfo).

### HostInfo

Where the code is running.

| Field | Type | Description |
|---|---|---|
| `apiVersion` | `string` | The extension API version of this host: the version `engines.songstress` is held against. |
| `side` | `Side` | The entry the code is running as. |
| `extension` | `{ id: string; version: string; }` | The extension itself, as installed. |
| `client?` | `ClientInfo \| undefined` | The app the code runs in. On the client side only. |

Refers to [Side](/docs/develop/reference/songstress/#type-Side), [ClientInfo](/docs/develop/reference/songstress/#type-ClientInfo).

### IconBlock

An icon from Songstress's icon set.

| Field | Type | Description |
|---|---|---|
| `type` | `"icon"` | Always `"icon"`: which kind this is. |
| `name` | `string` | The icon's name, from Songstress's icon set. |
| `tone?` | `Tone \| undefined` | Its colour, by meaning. |

Refers to [IconName](/docs/develop/reference/songstress/#type-IconName), [Tone](/docs/develop/reference/songstress/#type-Tone).

### IconName

A name from Songstress's icon set. A name an app does not know is drawn as the extension mark.

```ts
export type IconName = string;
```

### ImageBlock

A picture: a cover from the library, or an address the app fetches through the server.

| Field | Type | Description |
|---|---|---|
| `type` | `"image"` | Always `"image"`: which kind this is. |
| `source` | `ImageSource` | Where the picture comes from. |
| `description` | `string` | What the image shows, for people who do not see it. |
| `shape?` | `"circle" \| "square" \| "wide" \| undefined` | Its shape: square, wide or a circle. |

Refers to [ImageSource](/docs/develop/reference/songstress/#type-ImageSource).

### ImageSource

A picture: the cover of something in the library, or an image on the web,
which the app fetches through the server and never from the device.

```ts
export type ImageSource = {
    cover: LibraryType;
    id: string;
} | {
    url: string;
};
```

Refers to [LibraryType](/docs/develop/reference/songstress/#type-LibraryType).

### InputAction

Asks the person for a line of text, then runs a command with it. Never a
password: a secret is a setting. Nothing runs when they close it.

| Field | Type | Description |
|---|---|---|
| `type` | `"input"` | Always `"input"`: which kind this is. |
| `title` | `string` | What is asked, as a heading. |
| `prompt?` | `string \| undefined` | A line under the title: what to write. |
| `placeholder?` | `string \| undefined` | The hint while the field is empty. |
| `value?` | `string \| undefined` | What the field holds at first. |
| `multiline?` | `boolean \| undefined` | Several lines. |
| `maxLength?` | `number \| undefined` | The most characters it takes. |
| `required?` | `boolean \| undefined` | It cannot be sent empty. |
| `submit?` | `string \| undefined` | The word on the button that sends it. Left out, "Done". |
| `command` | `string` | The command that is handed the text, as `CommandContext.answer`. |
| `input?` | `unknown` | JSON, handed to the command as its input. |

### InvokeAction

Runs one of the extension's commands, handing it `input` (JSON).

| Field | Type | Description |
|---|---|---|
| `type` | `"invoke"` | Always `"invoke"`: which kind this is. |
| `command` | `string` | The command to run. |
| `input?` | `unknown` | JSON handed to the command as its input. |

### JobHandler

Does one run. A run has a deadline of the host's: do a slice, keep where
you are in storage, and let the next run go on. Throwing marks the run as
failed, with the error's message.

```ts
export type JobHandler = (run: JobRun) => Awaitable<void>;
```

Refers to [JobRun](/docs/develop/reference/songstress/#type-JobRun), [Awaitable](/docs/develop/reference/songstress/#type-Awaitable).

### JobRun

One run of a job.

| Field | Type | Description |
|---|---|---|
| `runId` | `string` | The run's id, as Activity knows it. |
| `input?` | `JsonValue \| undefined` | What `jobs.start` was given; undefined for a run on the job's own schedule. |
| `userId?` | `string \| undefined` | The member who started it, when one did. |
| `progress` | `(done: number, total?: number, note?: string) => void` | Tells Activity how far the run is: `done` of `total`, and a few words. |

Refers to [JsonValue](/docs/develop/reference/songstress/#type-JsonValue).

### Jobs

Jobs (the manifest's `contributes.jobs`), each shown in Activity while it
runs. Server entry; permission `jobs`.

| Field | Type | Description |
|---|---|---|
| `register` | `(id: string, handler: JobHandler) => Disposable` | Registers the handler of a declared job. |
| `start` | `(id: string, input?: unknown) => Promise<string>` | Queues a run of one of the extension's jobs, with `input` (JSON) for its handler; resolves to the run's id. A job already waiting or running is not queued twice. |

Refers to [JobHandler](/docs/develop/reference/songstress/#type-JobHandler), [Disposable](/docs/develop/reference/songstress/#type-Disposable).

### JsonValue

What crosses between an extension and Songstress: JSON, and nothing else.
No function, no date object, no binary value survives the crossing.

What Songstress hands to an extension is typed as this. What an extension
hands to Songstress (a value to store, a route's answer, a command's input)
is typed `unknown`, because TypeScript cannot tell that an interface of
yours is JSON: it must be all the same, and a value that is not is refused
with the code "invalid".

```ts
export type JsonValue = string | number | boolean | null | JsonValue[] | {
    [key: string]: JsonValue;
};
```

### Library

Reading the library. Server entry; permission `library.read`.

| Field | Type | Description |
|---|---|---|
| `getSong` | `(id: string) => Promise<Song \| null>` | The song with this id, or null when the library has none. |
| `getAlbum` | `(id: string) => Promise<Album \| null>` | The album with this id, or null when the library has none. |
| `getArtist` | `(id: string) => Promise<Artist \| null>` | The artist with this id, or null when the library has none. |
| `getPlaylist` | `(id: string) => Promise<Playlist \| null>` | A public playlist by its id; null for one that does not exist or that its owner keeps private. |
| `getAlbumSongs` | `(albumId: string) => Promise<Song[]>` | An album's songs, in order. |
| `getPlaylistSongs` | `(playlistId: string) => Promise<Song[]>` | A public playlist's songs, in order. |
| `search` | `(text: string, options?: { types?: Exclude<LibraryType, 'playlist'>[]; limit?: number; }) => Promise<LibrarySearchResults>` | Searches songs, albums and artists by text. `limit` is for each kind (20 when left out, 100 at most). |

Refers to [Song](/docs/develop/reference/songstress/#type-Song), [Album](/docs/develop/reference/songstress/#type-Album), [Artist](/docs/develop/reference/songstress/#type-Artist), [Playlist](/docs/develop/reference/songstress/#type-Playlist), [LibraryType](/docs/develop/reference/songstress/#type-LibraryType), [LibrarySearchResults](/docs/develop/reference/songstress/#type-LibrarySearchResults).

### LibraryChange

Songs that came into the library, changed or left it, by id. A large
change arrives as several calls.

| Field | Type | Description |
|---|---|---|
| `added` | `string[]` | Ids of the songs that came in. |
| `changed` | `string[]` | Ids of the songs that changed. |
| `removed` | `string[]` | Ids of the songs that left. |

### LibrarySearchResults

What a library search found.

| Field | Type | Description |
|---|---|---|
| `songs` | `Song[]` | The songs found. |
| `albums` | `Album[]` | The albums found. |
| `artists` | `Artist[]` | The artists found. |

Refers to [Song](/docs/develop/reference/songstress/#type-Song), [Album](/docs/develop/reference/songstress/#type-Album), [Artist](/docs/develop/reference/songstress/#type-Artist).

### LibraryType

A kind of thing the library holds.

```ts
export type LibraryType = 'song' | 'album' | 'artist' | 'playlist';
```

### LinkProvider

Reads a link one of the manifest's `patterns` claimed: a pasted address,
or a playlist a member follows. Null when it leads nowhere.

| Field | Type | Description |
|---|---|---|
| `resolve` | `(url: string, context: ProviderContext) => Awaitable<LinkResult \| null>` | What the link is: a track, an album, an artist or a playlist of the source's. |

Refers to [ProviderContext](/docs/develop/reference/songstress/#type-ProviderContext), [Awaitable](/docs/develop/reference/songstress/#type-Awaitable), [LinkResult](/docs/develop/reference/songstress/#type-LinkResult).

### LinkResult

What a link turned out to be.

```ts
export type LinkResult = {
    type: 'track';
    track: CatalogTrack;
} | {
    type: 'album';
    album: CatalogAlbumDetail;
} | {
    type: 'artist';
    artist: CatalogArtistDetail;
} | {
    type: 'playlist';
    playlist: CatalogPlaylistDetail;
};
```

Refers to [CatalogTrack](/docs/develop/reference/songstress/#type-CatalogTrack), [CatalogAlbumDetail](/docs/develop/reference/songstress/#type-CatalogAlbumDetail), [CatalogArtistDetail](/docs/develop/reference/songstress/#type-CatalogArtistDetail), [CatalogPlaylistDetail](/docs/develop/reference/songstress/#type-CatalogPlaylistDetail).

### ListScreen

A page of rows.

| Field | Type | Description |
|---|---|---|
| `type` | `"list"` | Always `"list"`: which kind this is. |
| `sections` | `{ title?: string; items: (Row \| SongRow)[]; }[]` | Its sections of rows. |
| `search?` | `{ placeholder?: string; } \| undefined` | A search field over the list. The page is rendered again as the person types, with what they typed in `RenderContext.search`. |
| `empty?` | `EmptyState \| undefined` | What it shows when it holds nothing. |
| `nextCursor?` | `string \| undefined` | There are more rows: when the end is reached the page is rendered again with this in `RenderContext.cursor`, and its rows are added below. |

Refers to [Row](/docs/develop/reference/songstress/#type-Row), [SongRow](/docs/develop/reference/songstress/#type-SongRow), [EmptyState](/docs/develop/reference/songstress/#type-EmptyState).

### LookupProvider

Opens one thing by the source's own id. Implement a method for each kind
the manifest lists under `types`. Null when the source has no such thing.

| Field | Type | Description |
|---|---|---|
| `track?` | `((id: string, context: ProviderContext) => Awaitable<CatalogTrack \| null>) \| undefined` | The track with this id. |
| `album?` | `((id: string, context: ProviderContext) => Awaitable<CatalogAlbumDetail \| null>) \| undefined` | The album with this id, with its tracks. |
| `artist?` | `((id: string, context: ProviderContext) => Awaitable<CatalogArtistDetail \| null>) \| undefined` | The artist with this id, with their albums and top tracks. |
| `playlist?` | `((id: string, context: ProviderContext) => Awaitable<CatalogPlaylistDetail \| null>) \| undefined` | The playlist with this id, with its tracks. |

Refers to [ProviderContext](/docs/develop/reference/songstress/#type-ProviderContext), [Awaitable](/docs/develop/reference/songstress/#type-Awaitable), [CatalogTrack](/docs/develop/reference/songstress/#type-CatalogTrack), [CatalogAlbumDetail](/docs/develop/reference/songstress/#type-CatalogAlbumDetail), [CatalogArtistDetail](/docs/develop/reference/songstress/#type-CatalogArtistDetail), [CatalogPlaylistDetail](/docs/develop/reference/songstress/#type-CatalogPlaylistDetail).

### LyricsLine

One line of lyrics.

| Field | Type | Description |
|---|---|---|
| `text` | `string` | One line, at most 500 characters: line breaks and tabs become spaces and control characters go. An empty line is kept, as a pause. |
| `startS?` | `number \| undefined` | When the line is sung, in seconds from the start, from 0 to seven days. On every line of synced lyrics, never before the line above it; on none of plain ones. A line without it, or out of order, makes every line plain: the server does not sort them. |

### LyricsProvider

Finds a song's lyrics. Asked by the server's nightly library pass, never
while a song plays, within 10 seconds, once an admin adds the source to the
lyrics order. The pass asks the whole order about every track without
synced lyrics, those with plain ones too, since Songstress's own sources
may match exactly enough to replace them; this answer is used for a track
with no lyrics at all, and never replaces lyrics a track has. The track is
asked again only after a rest (SPEC.md, section 11).

| Field | Type | Description |
|---|---|---|
| `find` | `(song: TrackQuery, context: ProviderContext) => Awaitable<LyricsResult>` | The song's lyrics as the source has them: synced or plain lines, instrumental, or none. |

Refers to [TrackQuery](/docs/develop/reference/songstress/#type-TrackQuery), [ProviderContext](/docs/develop/reference/songstress/#type-ProviderContext), [Awaitable](/docs/develop/reference/songstress/#type-Awaitable), [LyricsResult](/docs/develop/reference/songstress/#type-LyricsResult).

### LyricsResult

- `found`: the lines, synced when each carries its time; at most 2000 are
 kept, `synced` is worked out again from them, and no lines is `none`
- `instrumental`: the source says the song has no words
- `none`: the source does not have them

```ts
export type LyricsResult = {
    status: 'found';
    synced: boolean;
    lines: LyricsLine[];
} | {
    status: 'instrumental';
} | {
    status: 'none';
};
```

Refers to [LyricsLine](/docs/develop/reference/songstress/#type-LyricsLine).

### MenuBlock

A button that opens a menu.

| Field | Type | Description |
|---|---|---|
| `type` | `"menu"` | Always `"menu"`: which kind this is. |
| `title` | `string` | The menu button's label. |
| `icon?` | `string \| undefined` | The menu button's icon. |
| `items` | `MenuEntry[]` | What the menu offers. |

Refers to [IconName](/docs/develop/reference/songstress/#type-IconName), [MenuEntry](/docs/develop/reference/songstress/#type-MenuEntry).

### MenuEntry

One entry of a menu.

| Field | Type | Description |
|---|---|---|
| `title` | `string` | Its label. |
| `icon?` | `string \| undefined` | An icon from Songstress's icon set. |
| `action` | `Action` | What it does. |
| `destructive?` | `boolean \| undefined` | It deletes or cannot be undone: drawn as such. |

Refers to [IconName](/docs/develop/reference/songstress/#type-IconName), [Action](/docs/develop/reference/songstress/#type-Action).

### MenuLocation

A place a menu item can appear, as `contributes.menus` keys it.

```ts
export type MenuLocation = keyof Menus;
```

Refers to [Menus](/docs/develop/reference/manifest/#type-Menus).

### MetadataProvider

Facts about artists, releases and tracks. Implement the three discography
methods when the manifest's `supports` lists "discography" (artists are
named by the source's own id, or by the id of the group the provider
joined), and `enrich` when it lists "enrich".

| Field | Type | Description |
|---|---|---|
| `releases?` | `((artistId: string, context: ProviderContext) => Awaitable<CatalogAlbum[]>) \| undefined` | What the artist released, without tracks. |
| `topTracks?` | `((artistId: string, context: ProviderContext) => Awaitable<CatalogTrack[]>) \| undefined` | The artist's tracks the source ranks, most played first; empty when it ranks none. |
| `releaseTracks?` | `((releaseId: string, context: ProviderContext) => Awaitable<CatalogTrack[]>) \| undefined` | One release's tracks, in order. |
| `enrich?` | `((track: TrackQuery, context: ProviderContext) => Awaitable<TrackFacts \| null>) \| undefined` | The facts the track lacks; null when the source does not know the track. |

Refers to [ProviderContext](/docs/develop/reference/songstress/#type-ProviderContext), [Awaitable](/docs/develop/reference/songstress/#type-Awaitable), [CatalogAlbum](/docs/develop/reference/songstress/#type-CatalogAlbum), [CatalogTrack](/docs/develop/reference/songstress/#type-CatalogTrack), [TrackQuery](/docs/develop/reference/songstress/#type-TrackQuery), [TrackFacts](/docs/develop/reference/songstress/#type-TrackFacts).

### NavigateAction

Opens one of the extension's pages or views, or Songstress's own page for something in the library: as a page, or as a sheet.

| Field | Type | Description |
|---|---|---|
| `type` | `"navigate"` | Always `"navigate"`: which kind this is. |
| `to` | `Destination` | Where it goes. |
| `present?` | `"page" \| "sheet" \| undefined` | Left out, "page": pushed like any page. A sheet slides over the screen. On the phones a sheet has no navigation bar, so a list or a grid that asks for `search` shows no search field there: present it as a page. |

Refers to [Destination](/docs/develop/reference/songstress/#type-Destination).

### Needs

The permission a member's call needs; null when it needs none.

```ts
export type Needs = PermissionName | null;
```

Refers to [PermissionName](/docs/develop/reference/songstress/#type-PermissionName).

### Net

The network. There is no global `fetch`: this is the only way out, and it
goes where the manifest's `network` permission names hosts and nowhere
else. Server code may also reach the user's own network, the targets of
`network.local`; client code never does: from an app, a request goes to
the public hosts `network` names alone, which the server's host holds it
to. The address a name resolves to is checked when connecting and on every
redirect, and an answer larger than the host allows is refused.

| Field | Type | Description |
|---|---|---|
| `fetch` | `(url: string, request?: NetRequest) => Promise<NetResponse>` | Makes a request to a host the manifest names. |

Refers to [NetRequest](/docs/develop/reference/songstress/#type-NetRequest), [NetResponse](/docs/develop/reference/songstress/#type-NetResponse).

### NetRequest

A request, as plain data.

| Field | Type | Description |
|---|---|---|
| `method?` | `"DELETE" \| "GET" \| "HEAD" \| "PATCH" \| "POST" \| "PUT" \| undefined` | Left out, "GET". |
| `headers?` | `Record<string, string> \| undefined` | Sent as given. Without a `User-Agent` of its own the request says `songstress-extension/<API version>`; one named here replaces it, for a service that asks a client to say who it is. |
| `body?` | `string \| undefined` | The request's body, written as `bodyEncoding` says. |
| `bodyEncoding?` | `"base64" \| "text" \| undefined` | How `body` is written: as text (the default) or as base64 for bytes. |
| `responseEncoding?` | `"base64" \| "text" \| undefined` | How the answer's body is wanted: text (the default) or base64. |
| `timeoutMs?` | `number \| undefined` | Give up after this long. The host has its own limit, which wins. |
| `redirect?` | `"follow" \| "manual" \| undefined` | Left out, "follow": each hop is held to the hosts granted. "manual" hands back the redirect itself. |

### NetResponse

An answer, as plain data.

| Field | Type | Description |
|---|---|---|
| `status` | `number` | The HTTP status of the answer: 200, 404. |
| `url` | `string` | The address that answered, after redirects. |
| `headers` | `Record<string, string>` | Header names in lowercase. |
| `body` | `string` | The answer's body, as text or as base64, as the request's `responseEncoding` asked. |

### Notice

A notice: what an extension has to tell, with up to two things to do
about it. It stays until the person closes it or picks one.

| Field | Type | Description |
|---|---|---|
| `title` | `string` | What the notice is about, in a few words. |
| `message?` | `string \| undefined` | A sentence or two more. |
| `tone?` | `"danger" \| "info" \| "success" \| "warning" \| undefined` | Left out, "info". |
| `buttons?` | `{ title: string; action: Action; }[] \| undefined` | Each a title and what it does; at most two. |

Refers to [Action](/docs/develop/reference/songstress/#type-Action).

### NotifyAction

Shows a notice (`toast` is the message that goes away by itself).

| Field | Type | Description |
|---|---|---|
| `type` | `"notify"` | Always `"notify"`: which kind this is. |
| `title` | `string` | What the notice is about, in a few words. |
| `message?` | `string \| undefined` | A sentence or two more. |
| `tone?` | `"danger" \| "info" \| "success" \| "warning" \| undefined` | Left out, "info". |
| `buttons?` | `{ title: string; action: Action; }[] \| undefined` | Each a title and what it does; at most two. |

Refers to [Notice](/docs/develop/reference/songstress/#type-Notice).

### OpenUrlAction

Opens an http or https address in the browser.

| Field | Type | Description |
|---|---|---|
| `type` | `"openUrl"` | Always `"openUrl"`: which kind this is. |
| `url` | `string` | The address to open, http or https. |

### PageRenderer

Builds a page's screen. Registered with `songstress.ui.pages.register`.

```ts
export type PageRenderer = (context: RenderContext) => Awaitable<Screen>;
```

Refers to [RenderContext](/docs/develop/reference/songstress/#type-RenderContext), [Awaitable](/docs/develop/reference/songstress/#type-Awaitable), [Screen](/docs/develop/reference/songstress/#type-Screen).

### Pages

Renderers for the manifest's `contributes.pages`, each registered in the
entry its page names in `render`.

| Field | Type | Description |
|---|---|---|
| `register` | `(id: string, render: PageRenderer) => Disposable` | Registers the renderer of a declared page. |

Refers to [PageRenderer](/docs/develop/reference/songstress/#type-PageRenderer), [Disposable](/docs/develop/reference/songstress/#type-Disposable).

### PanelContent

What a panel shows inside one of Songstress's own screens.

| Field | Type | Description |
|---|---|---|
| `children` | `Block[]` | Its blocks. |

Refers to [Block](/docs/develop/reference/songstress/#type-Block).

### PanelContext

What a panel's renderer is told: who looks, and what the screen shows.
The song, artist or album is handed over whole to an extension granted
`library.read`, and left out for any other.

| Field | Type | Description |
|---|---|---|
| `userId` | `string` | The member looking at the panel. |
| `client` | `ClientInfo` | The app it is drawn in. |
| `song?` | `Song \| undefined` | The song playing, on a "now-playing" panel. |
| `artist?` | `Artist \| undefined` | The artist of the page, on an "artist" panel. |
| `album?` | `Album \| undefined` | The album of the page, on an "album" panel. |
| `playlist?` | `Pick<Playlist, "id"> \| undefined` | The playlist of the page, on a "playlist" panel: its id, to an extension granted `library.read`. Playlists themselves are not read for extensions yet. |

Refers to [ClientInfo](/docs/develop/reference/songstress/#type-ClientInfo), [Song](/docs/develop/reference/songstress/#type-Song), [Artist](/docs/develop/reference/songstress/#type-Artist), [Album](/docs/develop/reference/songstress/#type-Album), [Playlist](/docs/develop/reference/songstress/#type-Playlist).

### PanelRenderer

Null when the panel has nothing to show here: it is then left out.

```ts
export type PanelRenderer = (context: PanelContext) => Awaitable<PanelContent | null>;
```

Refers to [PanelContext](/docs/develop/reference/songstress/#type-PanelContext), [Awaitable](/docs/develop/reference/songstress/#type-Awaitable), [PanelContent](/docs/develop/reference/songstress/#type-PanelContent).

### Panels

Renderers for the manifest's `contributes.panels`.

| Field | Type | Description |
|---|---|---|
| `register` | `(id: string, render: PanelRenderer) => Disposable` | Registers the renderer of a declared panel. |

Refers to [PanelRenderer](/docs/develop/reference/songstress/#type-PanelRenderer), [Disposable](/docs/develop/reference/songstress/#type-Disposable).

### PermissionName

A permission's name, as the manifest's `permissions` keys it.

```ts
export type PermissionName = keyof Permissions;
```

Refers to [Permissions](/docs/develop/reference/manifest/#type-Permissions).

### PickAction

Asks the person to choose, with Songstress's own picker (a search field
over a long list), then runs a command with what they chose. Nothing runs
when they choose nothing and close it.

| Field | Type | Description |
|---|---|---|
| `type` | `"pick"` | Always `"pick"`: which kind this is. |
| `title` | `string` | What the picker asks, as its heading. |
| `placeholder?` | `string \| undefined` | The hint in the search field. |
| `items` | `PickItem[]` | What to choose from, up to 100. |
| `many?` | `boolean \| undefined` | Several may be chosen. Left out, one. |
| `command` | `string` | The command that is handed the choice: `CommandContext.answer` is the id chosen, or the ids for a pick of several. |
| `input?` | `unknown` | JSON, handed to the command as its input. |

Refers to [PickItem](/docs/develop/reference/songstress/#type-PickItem).

### PickItem

One choice of a pick.

| Field | Type | Description |
|---|---|---|
| `id` | `string` | What the command is handed when this is chosen. Unique in the pick. |
| `title` | `string` | Its title. |
| `subtitle?` | `string \| undefined` | A line under the title. |
| `icon?` | `string \| undefined` | An icon from Songstress's icon set. |
| `image?` | `ImageSource \| undefined` | A picture beside it. |
| `picked?` | `boolean \| undefined` | Chosen at first, in a pick of several. |

Refers to [IconName](/docs/develop/reference/songstress/#type-IconName), [ImageSource](/docs/develop/reference/songstress/#type-ImageSource).

### PickerField

A form's choice of one option from a list.

| Field | Type | Description |
|---|---|---|
| `type` | `"picker"` | Always `"picker"`: which kind this is. |
| `value?` | `string \| undefined` | The `value` of the option chosen. |
| `options` | `{ value: string; title: string; }[]` | The choices. |
| `name` | `string` | Unique in the form. |
| `label` | `string` | The field's label. |
| `help?` | `string \| undefined` | A line of help under the field. |

### Platform

A Songstress app: the web app, the desktop app, the iPhone and iPad app, the Android app.

```ts
export type Platform = "web" | "desktop" | "ios" | "android";
```

### PlayAction

Plays now, as a tap on a song does.

| Field | Type | Description |
|---|---|---|
| `type` | `"play"` | Always `"play"`: which kind this is. |
| `what` | `Playable` | The library songs to play. |

Refers to [Playable](/docs/develop/reference/songstress/#type-Playable).

### PlayEvent

A play as the server heard of it.

| Field | Type | Description |
|---|---|---|
| `userId` | `string` | The member who is listening. |
| `startedAt` | `string` | When the song started, as an ISO 8601 time. |
| `client?` | `string \| undefined` | The app that reported it, when it said its name. |

### PlayProvider

Plays what the search provider of the same id found. Off until the admin
turns it on. One progressive file only: never a playlist of segments.

| Field | Type | Description |
|---|---|---|
| `resolve` | `(track: CatalogTrack, context: ProviderContext) => Awaitable<StreamLocation \| null>` | Null when the source has no stream for the track right now. |

Refers to [CatalogTrack](/docs/develop/reference/songstress/#type-CatalogTrack), [ProviderContext](/docs/develop/reference/songstress/#type-ProviderContext), [Awaitable](/docs/develop/reference/songstress/#type-Awaitable), [StreamLocation](/docs/develop/reference/songstress/#type-StreamLocation).

### Playable

Something to play: songs by id, or everything of an album, an artist or a
playlist.

```ts
export type Playable = {
    songIds: string[];
} | {
    albumId: string;
} | {
    artistId: string;
} | {
    playlistId: string;
};
```

### Player

The player of the device the code runs on. Client entry. Reading needs
the permission `listening.read`; the rest needs `player.control`.

| Field | Type | Description |
|---|---|---|
| `getState` | `() => Promise<PlayerState>` | What the player is doing now: the song, where it is in it, whether it plays. |
| `play` | `() => Promise<void>` | Goes on playing after a pause. |
| `pause` | `() => Promise<void>` | Pauses what is playing. |
| `next` | `() => Promise<void>` | Skips to the next song in the queue. |
| `previous` | `() => Promise<void>` | Goes back to the song before, as the app's own Previous does. |
| `seek` | `(positionS: number) => Promise<void>` | Moves to a place in the current song, in seconds from its start. |

Refers to [PlayerState](/docs/develop/reference/songstress/#type-PlayerState).

### PlayerState

This device's player at one moment.

| Field | Type | Description |
|---|---|---|
| `song` | `Song \| null` | The song in the player; null when it holds none. |
| `playing` | `boolean` | Whether it is playing now. |
| `positionS` | `number` | Where it is in the song, in seconds from its start. |
| `durationS` | `number` | The song's length, in seconds. |
| `volume` | `number` | From 0 to 1. |

Refers to [Song](/docs/develop/reference/songstress/#type-Song).

### Playlist

A playlist.

| Field | Type | Description |
|---|---|---|
| `id` | `string` | Its library id. |
| `name` | `string` | Its name. |
| `description?` | `string \| undefined` | What the playlist's owner wrote about it. |
| `ownerId?` | `string \| undefined` | The member it belongs to. |
| `public?` | `boolean \| undefined` | Every member can see it. |
| `songCount?` | `number \| undefined` | How many songs it holds. |
| `durationS?` | `number \| undefined` | Its length, in seconds. |

### PlaylistCard

A playlist of the library, drawn as Songstress draws it.

| Field | Type | Description |
|---|---|---|
| `type` | `"playlist"` | Always `"playlist"`: which kind this is. |
| `playlistId` | `string` | The playlist's library id. |

### PlaylistChangeEvent

What `onPlaylistChange` is told: a public playlist was created, changed or deleted.

| Field | Type | Description |
|---|---|---|
| `change` | `"created" \| "deleted" \| "updated"` | What happened to the playlist. |
| `at` | `string` | When, as an ISO 8601 time. |

### ProgressBlock

A bar that shows how far something has got.

| Field | Type | Description |
|---|---|---|
| `type` | `"progress"` | Always `"progress"`: which kind this is. |
| `value?` | `number \| undefined` | From 0 to 1. Left out, the bar shows that something is going on without saying how far it is. |
| `label?` | `string \| undefined` | What it measures. |

### ProviderContext

What every provider call is told.

| Field | Type | Description |
|---|---|---|
| `userId?` | `string \| undefined` | The member the answer is for. Absent when the server asks for itself, as a background job does. |

### ProviderFailure

A failure Songstress knows what to do about. The message is for the
server's log and the admin: never put a token or a signed address in it.

```ts
export declare class ProviderFailure extends Error {
    readonly name = "ProviderFailure";
    readonly code: ProviderFailureCode;
    readonly retryAfterS?: number;
    constructor(code: ProviderFailureCode, options?: {
        message?: string;
        retryAfterS?: number;
    });
}
```

Refers to [ProviderFailureCode](/docs/develop/reference/songstress/#type-ProviderFailureCode).

### ProviderFailureCode

- `rate-limited`: the source asks to slow down; Songstress waits `retryAfterS`
- `sign-in-required`: the source wants a sign-in the settings do not hold, or no longer accept
- `not-configured`: a setting the provider needs is empty
- `unavailable`: the source is down, or refuses this request for now

```ts
export type ProviderFailureCode = 'rate-limited' | 'sign-in-required' | 'not-configured' | 'unavailable';
```

### ProviderGroup

One of Songstress's own catalogues. A source that reads the same catalogue joins its group and speaks its ids.

```ts
export type ProviderGroup = "musicbrainz" | "spotify" | "deezer" | "tidal" | "itunes" | "ytmusic";
```

### ProviderRegistry

Where providers of one kind are registered.

| Field | Type | Description |
|---|---|---|
| `register` | `(id: string, provider: Provider) => Disposable` | Registers the provider the manifest declares under this kind and `id`. |

Refers to [Disposable](/docs/develop/reference/songstress/#type-Disposable).

### Providers

The provider kinds. Server entry; permission `providers` (and for a
scrobble provider `listening.read` too).

| Field | Type | Description |
|---|---|---|
| `search` | `ProviderRegistry<SearchProvider>` | The search sources. |
| `lookup` | `ProviderRegistry<LookupProvider>` | The lookup sources. |
| `links` | `ProviderRegistry<LinkProvider>` | The link sources. |
| `lyrics` | `ProviderRegistry<LyricsProvider>` | The lyrics sources. |
| `metadata` | `ProviderRegistry<MetadataProvider>` | The metadata sources. |
| `artwork` | `ProviderRegistry<ArtworkProvider>` | The artwork sources. |
| `artistInfo` | `ProviderRegistry<ArtistInfoProvider>` | The artist info sources. |
| `scrobble` | `ProviderRegistry<ScrobbleProvider>` | The scrobble services. |
| `recommend` | `ProviderRegistry<RecommendProvider>` | The recommendation sources. |
| `play` | `ProviderRegistry<PlayProvider>` | The play sources. |
| `download` | `ProviderRegistry<DownloadProvider>` | The download sources. |

Refers to [ProviderRegistry](/docs/develop/reference/songstress/#type-ProviderRegistry), [SearchProvider](/docs/develop/reference/songstress/#type-SearchProvider), [LookupProvider](/docs/develop/reference/songstress/#type-LookupProvider), [LinkProvider](/docs/develop/reference/songstress/#type-LinkProvider), [LyricsProvider](/docs/develop/reference/songstress/#type-LyricsProvider), [MetadataProvider](/docs/develop/reference/songstress/#type-MetadataProvider), [ArtworkProvider](/docs/develop/reference/songstress/#type-ArtworkProvider), [ArtistInfoProvider](/docs/develop/reference/songstress/#type-ArtistInfoProvider), [ScrobbleProvider](/docs/develop/reference/songstress/#type-ScrobbleProvider), [RecommendProvider](/docs/develop/reference/songstress/#type-RecommendProvider), [PlayProvider](/docs/develop/reference/songstress/#type-PlayProvider), [DownloadProvider](/docs/develop/reference/songstress/#type-DownloadProvider).

### Queue

The queue of the device the code runs on. Client entry.

| Field | Type | Description |
|---|---|---|
| `get` | `() => Promise<QueueState>` | Permission `listening.read`. |
| `add` | `(songIds: string[], options?: { next?: boolean; }) => Promise<void>` | Adds library songs to the queue: at its end, or right after the current song with `next`. What is playing is never touched. Permission `player.control`. |

Refers to [QueueState](/docs/develop/reference/songstress/#type-QueueState).

### QueueAction

Adds to the queue: at its end, or right after the current song. What is
playing is never touched.

| Field | Type | Description |
|---|---|---|
| `type` | `"queue"` | Always `"queue"`: which kind this is. |
| `what` | `Playable` | The library songs to add. |
| `next?` | `boolean \| undefined` | Right after the current song, not at the end. |

Refers to [Playable](/docs/develop/reference/songstress/#type-Playable).

### QueueState

This device's queue.

| Field | Type | Description |
|---|---|---|
| `songs` | `Song[]` | The songs waiting, in order. |
| `index` | `number` | Where the current song is in `songs`; -1 when the player holds none. |

Refers to [Song](/docs/develop/reference/songstress/#type-Song).

### RecommendProvider

Recommendations, best first. Implement the method for each mode the
manifest lists under `modes`. Empty when the source has nothing for the
seed.

| Field | Type | Description |
|---|---|---|
| `similarTracks?` | `((seed: RecommendSeed, limit: number, context: ProviderContext) => Awaitable<RecommendedTrack[]>) \| undefined` | Mode "track": songs like this one. |
| `artistRadio?` | `((artist: RecommendSeed, limit: number, context: ProviderContext) => Awaitable<RecommendedTrack[]>) \| undefined` | Mode "artist": a radio of this artist. |
| `contextMix?` | `((seeds: RecommendSeed[], limit: number, context: ProviderContext) => Awaitable<RecommendedTrack[]>) \| undefined` | Mode "context": one mix from several songs. |

Refers to [RecommendSeed](/docs/develop/reference/songstress/#type-RecommendSeed), [ProviderContext](/docs/develop/reference/songstress/#type-ProviderContext), [Awaitable](/docs/develop/reference/songstress/#type-Awaitable), [RecommendedTrack](/docs/develop/reference/songstress/#type-RecommendedTrack).

### RecommendSeed

A song or an artist to recommend from. Any field may be missing: use
what the source understands.

| Field | Type | Description |
|---|---|---|
| `title?` | `string \| undefined` | The seed track's title. |
| `artist?` | `string \| undefined` | The seed's artist. |
| `album?` | `string \| undefined` | The seed track's album. |
| `isrc?` | `string \| undefined` | The seed track's ISRC. |
| `musicBrainzId?` | `string \| undefined` | The seed's MusicBrainz id. |
| `genres?` | `string[] \| undefined` | The genres its tags name. |

### RecommendedTrack

A recommended track, by what it is called: Songstress matches it to the
library, filters it and caches it.

| Field | Type | Description |
|---|---|---|
| `title` | `string` | Its title. |
| `artist` | `string` | Its artist's name. |
| `album?` | `string \| undefined` | Its album's title. |
| `isrc?` | `string \| undefined` | Its ISRC. |
| `musicBrainzId?` | `string \| undefined` | Its MusicBrainz id. |
| `durationS?` | `number \| undefined` | Its length, in seconds. |
| `coverUrl?` | `string \| undefined` | Its cover's address, http or https. |
| `ids?` | `Partial<Record<ProviderGroup, string>> \| undefined` | Its ids in the catalogues Songstress knows. |
| `score?` | `number \| undefined` | The source's own measure of how alike, from 0 to 1. |

Refers to [CatalogIds](/docs/develop/reference/songstress/#type-CatalogIds).

### RefreshAction

Renders the page, panel or status item it came from again.

| Field | Type | Description |
|---|---|---|
| `type` | `"refresh"` | Always `"refresh"`: which kind this is. |

### RefreshTarget

What to render again: one of the extension's pages, panels or status
items, by its id.

```ts
export type RefreshTarget = {
    page: string;
} | {
    panel: string;
} | {
    status: string;
};
```

### RenderContext

What a page's renderer is told.

| Field | Type | Description |
|---|---|---|
| `userId` | `string` | The member looking at the page. |
| `client` | `ClientInfo` | The app that will draw the tree. |
| `params` | `Record<string, string>` | What the page was opened with (`Destination.params`). |
| `search?` | `string \| undefined` | What the person typed in the page's search field. |
| `cursor?` | `string \| undefined` | The `nextCursor` of the rows already shown, when more are asked for. |
| `node?` | `string \| undefined` | On a tree, the id of the node the person opened: answer the nodes under it. |

Refers to [ClientInfo](/docs/develop/reference/songstress/#type-ClientInfo).

### RouteHandler

Answers one of the extension's declared routes. Registered with `songstress.routes.register`.

```ts
export type RouteHandler = (request: RouteRequest) => Awaitable<RouteResponse>;
```

Refers to [RouteRequest](/docs/develop/reference/songstress/#type-RouteRequest), [Awaitable](/docs/develop/reference/songstress/#type-Awaitable), [RouteResponse](/docs/develop/reference/songstress/#type-RouteResponse).

### RouteRequest

A request to one of the extension's routes.

| Field | Type | Description |
|---|---|---|
| `method` | `"DELETE" \| "GET" \| "PATCH" \| "POST" \| "PUT"` | The method the route was called with, one the manifest declares for it. |
| `params` | `Record<string, string>` | The `:name` parts of the route's path. |
| `query` | `Record<string, string>` | The query string's values, by name. |
| `body?` | `JsonValue \| undefined` | The request's JSON body, when it has one. |
| `userId` | `string` | The signed-in member who asked. A route is never open to the world. |

Refers to [JsonValue](/docs/develop/reference/songstress/#type-JsonValue).

### RouteResponse

What a route answers: JSON, and nothing else.

| Field | Type | Description |
|---|---|---|
| `status?` | `number \| undefined` | Left out, 200. |
| `body?` | `unknown` | JSON. |

### Routes

Routes (the manifest's `contributes.routes`), served under a prefix that
belongs to the extension. Server entry; permission `routes`.

| Field | Type | Description |
|---|---|---|
| `register` | `(id: string, handler: RouteHandler) => Disposable` | Registers the handler of a declared route. |

Refers to [RouteHandler](/docs/develop/reference/songstress/#type-RouteHandler), [Disposable](/docs/develop/reference/songstress/#type-Disposable).

### Row

A row of a list.

| Field | Type | Description |
|---|---|---|
| `type` | `"row"` | Always `"row"`: which kind this is. |
| `id` | `string` | Unique among the rows of its list. |
| `title` | `string` | Its title. |
| `subtitle?` | `string \| undefined` | A line under the title. |
| `icon?` | `string \| undefined` | An icon from Songstress's icon set. |
| `image?` | `ImageSource \| undefined` | A picture beside it. |
| `badge?` | `BadgeBlock \| undefined` | A short word at the row's end. |
| `action?` | `Action \| undefined` | What choosing it does. |
| `menu?` | `MenuEntry[] \| undefined` | More to do with the row. |

Refers to [IconName](/docs/develop/reference/songstress/#type-IconName), [ImageSource](/docs/develop/reference/songstress/#type-ImageSource), [BadgeBlock](/docs/develop/reference/songstress/#type-BadgeBlock), [Action](/docs/develop/reference/songstress/#type-Action), [MenuEntry](/docs/develop/reference/songstress/#type-MenuEntry).

### ScanSummary

A finished scan of the library.

| Field | Type | Description |
|---|---|---|
| `startedAt` | `string` | ISO 8601 times. |
| `finishedAt` | `string` | When the scan finished, as an ISO 8601 time. |
| `added` | `number` | How many songs the scan added, changed and removed. |
| `changed` | `number` | How many songs changed. |
| `removed` | `number` | How many songs left the library. |

### Screen

What a page is: a list, a grid, a tree, a detail or a form, by its `type`.

```ts
export type Screen = ListScreen | GridScreen | DetailScreen | FormScreen | TreeScreen;
```

Refers to [ListScreen](/docs/develop/reference/songstress/#type-ListScreen), [GridScreen](/docs/develop/reference/songstress/#type-GridScreen), [DetailScreen](/docs/develop/reference/songstress/#type-DetailScreen), [FormScreen](/docs/develop/reference/songstress/#type-FormScreen), [TreeScreen](/docs/develop/reference/songstress/#type-TreeScreen).

### ScrobbleEvent

A play that counted.

| Field | Type | Description |
|---|---|---|
| `userId` | `string` | The member who listened. |
| `playedAt` | `string` | When the play started, as an ISO 8601 time: the play's own time, not the time it was reported. A phone that was offline reports late. |
| `client?` | `string \| undefined` | The app that reported it, when it said its name. |

### ScrobblePlay

One play to report.

| Field | Type | Description |
|---|---|---|
| `song` | `Song` | The song that was played, from the library. |
| `userId` | `string` | The member who listened: `context.userId` is theirs too. |
| `playedAt` | `string` | When the play started, as an ISO 8601 time. |

Refers to [Song](/docs/develop/reference/songstress/#type-Song).

### ScrobbleProvider

A service plays are reported to, for each member who connected it. A
play that fails with `rate-limited` or `unavailable` is tried again later;
`sign-in-required` asks the member to connect again. It is handed members'
plays, so it needs the permission `listening.read` beside `providers`, and
hears only the members who granted it.

| Field | Type | Description |
|---|---|---|
| `scrobble` | `(play: ScrobblePlay, context: ProviderContext) => Awaitable<void>` | A play counted. |
| `nowPlaying?` | `((play: ScrobblePlay, context: ProviderContext) => Awaitable<void>) \| undefined` | A song started. Sent live only, and not for every play. |

Refers to [ScrobblePlay](/docs/develop/reference/songstress/#type-ScrobblePlay), [ProviderContext](/docs/develop/reference/songstress/#type-ProviderContext), [Awaitable](/docs/develop/reference/songstress/#type-Awaitable).

### SearchProvider

Answers a search.

| Field | Type | Description |
|---|---|---|
| `search` | `(query: SearchQuery, context: ProviderContext) => Awaitable<SearchResults>` | Searches the source for the query's text, in the kinds it asks for. |

Refers to [SearchQuery](/docs/develop/reference/songstress/#type-SearchQuery), [ProviderContext](/docs/develop/reference/songstress/#type-ProviderContext), [Awaitable](/docs/develop/reference/songstress/#type-Awaitable), [SearchResults](/docs/develop/reference/songstress/#type-SearchResults).

### SearchQuery

What a search asks a source.

| Field | Type | Description |
|---|---|---|
| `text` | `string` | What the person typed. |
| `types` | `CatalogType[]` | The kinds asked for, from those the manifest lists under `types`. |
| `limit` | `number` | How many of each kind, at most. |
| `offset` | `number` | How many of each kind to skip: the next page. |

Refers to [CatalogType](/docs/develop/reference/songstress/#type-CatalogType).

### SearchResults

What a source found, for each kind asked. Leave out a kind it found nothing of.

| Field | Type | Description |
|---|---|---|
| `tracks?` | `CatalogTrack[] \| undefined` | The tracks found, best first. |
| `albums?` | `CatalogAlbum[] \| undefined` | The albums found, best first. |
| `artists?` | `CatalogArtist[] \| undefined` | The artists found, best first. |
| `playlists?` | `CatalogPlaylist[] \| undefined` | The playlists found, best first. |

Refers to [CatalogTrack](/docs/develop/reference/songstress/#type-CatalogTrack), [CatalogAlbum](/docs/develop/reference/songstress/#type-CatalogAlbum), [CatalogArtist](/docs/develop/reference/songstress/#type-CatalogArtist), [CatalogPlaylist](/docs/develop/reference/songstress/#type-CatalogPlaylist).

### Secrets

The extension's own credentials: tokens it was handed, kept sealed, never
sent to an app and never shown again. Server entry; permission `secrets`.
For a key a person types, declare a setting of type "secret" instead.

| Field | Type | Description |
|---|---|---|
| `get` | `(key: string, user?: ForUser) => Promise<string \| undefined>` | A secret kept under this key, the extension's or, with `{ userId }`, one member's; undefined when there is none. |
| `set` | `(key: string, value: string, user?: ForUser) => Promise<void>` | Keeps a secret, sealed, under this key. |
| `delete` | `(key: string, user?: ForUser) => Promise<void>` | Forgets the secret under this key. |

Refers to [ForUser](/docs/develop/reference/songstress/#type-ForUser).

### SectionBlock

Blocks under a heading.

| Field | Type | Description |
|---|---|---|
| `type` | `"section"` | Always `"section"`: which kind this is. |
| `title?` | `string \| undefined` | The section's heading. |
| `footer?` | `string \| undefined` | A line of help under the section. |
| `children` | `Block[]` | What it holds. |

Refers to [Block](/docs/develop/reference/songstress/#type-Block).

### ServerApi

The API of the server entry: code that runs on the user's own server, in
a sandbox, for every member and every app.

| Field | Type | Description |
|---|---|---|
| `hooks` | `ServerHooks` | What happens on the server, for every member who granted it: plays, favourites, library changes. |
| `ui` | `ServerUi` | The renderers of the extension's pages, panels and status items, and notices and refreshes for one member. |
| `settings` | `ServerSettings` | The extension's settings, the server's and, with `{ userId }`, each member's. |
| `storage` | `ServerStore` | The extension's own small store, as a whole and for each member. Permission `storage`. |
| `secrets` | `Secrets` | Sealed credentials. Permission `secrets`. |
| `providers` | `Providers` | One registry for each kind of source the extension adds. Permission `providers`. |
| `jobs` | `Jobs` | The handlers of declared jobs, and starting a run. Permission `jobs`. |
| `routes` | `Routes` | The handlers of declared routes. Permission `routes`. |
| `signIn` | `SignInRegistry` | The handler of the declared sign-in. Permission `secrets`. |
| `library` | `Library` | Reading the library. Permission `library.read`. |
| `users` | `Users` | Reading members' ids and names. Permission `users.read`. |
| `commands` | `Commands` | The handlers of the extension's declared commands. |
| `net` | `Net` | The only way to the network. Permission `network`. |
| `host` | `Host` | What the code runs in: the API version, the side, and on the client the app. |

Refers to [SharedApi](/docs/develop/reference/songstress/#type-SharedApi), [ServerHooks](/docs/develop/reference/songstress/#type-ServerHooks), [ServerUi](/docs/develop/reference/songstress/#type-ServerUi), [ServerSettings](/docs/develop/reference/songstress/#type-ServerSettings), [ServerStore](/docs/develop/reference/songstress/#type-ServerStore), [Secrets](/docs/develop/reference/songstress/#type-Secrets), [Providers](/docs/develop/reference/songstress/#type-Providers), [Jobs](/docs/develop/reference/songstress/#type-Jobs), [Routes](/docs/develop/reference/songstress/#type-Routes), [SignInRegistry](/docs/develop/reference/songstress/#type-SignInRegistry), [Library](/docs/develop/reference/songstress/#type-Library), [Users](/docs/develop/reference/songstress/#type-Users).

### ServerHooks

The hooks of the server entry. They see every app of every member who
granted the extension their listening, phones included.

| Field | Type | Description |
|---|---|---|
| `onPlay` | `(listener: (song: Song, play: PlayEvent) => Awaitable<void>) => Disposable` | A member started a song: their app reported it, about a second in, once for each song. Live only: a play that starts offline, or on a locked Android phone, may arrive late or never. For "what was played", use onScrobble. Permission `listening.read`. |
| `onScrobble` | `(listener: (song: Song, play: ScrobbleEvent) => Awaitable<void>) => Disposable` | A play counted: half the song or four minutes of it was heard. Reliable: a play made offline waits on the device and arrives later, with the time it really happened. Permission `listening.read`. |
| `onFavorite` | `(listener: (item: Favorite, event: FavoriteEvent) => Awaitable<void>) => Disposable` | A member marked a song, an album or an artist as a favourite, or took the mark away. Permission `listening.read`. |
| `onPlaylistChange` | `(listener: (playlist: Playlist, event: PlaylistChangeEvent) => Awaitable<void>) => Disposable` | A public playlist was created, changed or deleted. Permission `library.read`. |
| `onLibraryChange` | `(listener: (change: LibraryChange) => Awaitable<void>) => Disposable` | Songs came into the library, changed or left it. Permission `library.read`. |
| `onScanComplete` | `(listener: (scan: ScanSummary) => Awaitable<void>) => Disposable` | A scan of the library finished. Permission `library.read`. |

Refers to [SharedHooks](/docs/develop/reference/songstress/#type-SharedHooks), [Song](/docs/develop/reference/songstress/#type-Song), [PlayEvent](/docs/develop/reference/songstress/#type-PlayEvent), [Awaitable](/docs/develop/reference/songstress/#type-Awaitable), [Disposable](/docs/develop/reference/songstress/#type-Disposable), [ScrobbleEvent](/docs/develop/reference/songstress/#type-ScrobbleEvent), [Favorite](/docs/develop/reference/songstress/#type-Favorite), [FavoriteEvent](/docs/develop/reference/songstress/#type-FavoriteEvent), [Playlist](/docs/develop/reference/songstress/#type-Playlist), [PlaylistChangeEvent](/docs/develop/reference/songstress/#type-PlaylistChangeEvent), [LibraryChange](/docs/develop/reference/songstress/#type-LibraryChange), [ScanSummary](/docs/develop/reference/songstress/#type-ScanSummary).

### ServerSettings

The settings as the server entry reads them: settings of scope "server",
secrets included, and with `{ userId }` one member's settings of scope
"user". A device's settings stay on the device.

| Field | Type | Description |
|---|---|---|
| `get` | `<Value extends SettingValue = SettingValue>(key: string, user?: ForUser) => Promise<Value \| undefined>` | What the setting holds: what was set, else its default, else undefined. Secrets included. |
| `onChange` | `(listener: (change: SettingChange) => Awaitable<void>) => Disposable` | Hears each change to a setting this side can read, for as long as the entry is running. A change does not start an entry: code that is started later reads the setting when it needs it. |

Refers to [Settings](/docs/develop/reference/songstress/#type-Settings), [SettingValue](/docs/develop/reference/songstress/#type-SettingValue), [ForUser](/docs/develop/reference/songstress/#type-ForUser).

### ServerStore

The store as the server entry uses it: one part for the extension as a
whole, and with `{ userId }` one part for each member, which is the part
code in that member's apps sees. A sandbox is started and stopped as
needed: what must last goes here, not in a variable.

| Field | Type | Description |
|---|---|---|
| `get` | `<Value = unknown>(key: string, user?: ForUser) => Promise<Value \| undefined>` | What was last set under the key; undefined when nothing is. |
| `set` | `(key: string, value: unknown, user?: ForUser) => Promise<void>` | Keeps a JSON value under the key, in place of what was there. |
| `delete` | `(key: string, user?: ForUser) => Promise<void>` | Forgets a key, the extension's or, with `{ userId }`, one member's. |
| `keys` | `(prefix?: string, user?: ForUser) => Promise<string[]>` | The keys held, in order; those that start with `prefix` when given. |

Refers to [Store](/docs/develop/reference/songstress/#type-Store), [ForUser](/docs/develop/reference/songstress/#type-ForUser).

### ServerUi

Declared interface as the server entry has it: it may also tell a member
something, or have their apps render something again, while they are
open. Nothing is kept for an app that is closed.

| Field | Type | Description |
|---|---|---|
| `notify` | `(notice: Notice, user: ForUser) => Promise<void>` | Shows a notice in the member's open apps. At most ten an hour for one member: more reject with "limit-exceeded". |
| `refresh` | `(target: RefreshTarget, user: ForUser) => Promise<void>` | Has the member's open apps render a page, a panel or a status item again, where it is showing. At most once every five seconds for one target: more are let go. |
| `pages` | `Pages` | The renderers of the extension's pages. |
| `panels` | `Panels` | The renderers of the extension's panels. |
| `status` | `StatusItems` | The renderers of the extension's status items. |

Refers to [Ui](/docs/develop/reference/songstress/#type-Ui), [Notice](/docs/develop/reference/songstress/#type-Notice), [ForUser](/docs/develop/reference/songstress/#type-ForUser), [RefreshTarget](/docs/develop/reference/songstress/#type-RefreshTarget).

### SettingChange

What `settings.onChange` is told: a setting changed.

| Field | Type | Description |
|---|---|---|
| `key` | `string` | The setting's key. |
| `value` | `SettingValue \| undefined` | The new value; undefined when the setting was cleared. A secret's value is never handed to code in an app. |
| `userId?` | `string \| undefined` | The member whose setting it is, for a setting of scope "user". |

Refers to [SettingValue](/docs/develop/reference/songstress/#type-SettingValue).

### SettingValue

What a setting holds. A select holds the `value` of its option, a secret
holds text.

```ts
export type SettingValue = string | number | boolean;
```

### Settings

The extension's settings (the manifest's `contributes.settings`), as code
in an app reads them: the server's, this member's and this device's.
No permission.

| Field | Type | Description |
|---|---|---|
| `get` | `<Value extends SettingValue = SettingValue>(key: string) => Promise<Value \| undefined>` | What the setting holds: what was set, else its default, else undefined. A secret is undefined here: it never leaves the server. |
| `onChange` | `(listener: (change: SettingChange) => Awaitable<void>) => Disposable` | Hears each change to a setting this side can read, for as long as the entry is running. A change does not start an entry: code that is started later reads the setting when it needs it. |

Refers to [SettingValue](/docs/develop/reference/songstress/#type-SettingValue), [SettingChange](/docs/develop/reference/songstress/#type-SettingChange), [Awaitable](/docs/develop/reference/songstress/#type-Awaitable), [Disposable](/docs/develop/reference/songstress/#type-Disposable).

### ShareAction

Opens the device's share sheet.

| Field | Type | Description |
|---|---|---|
| `type` | `"share"` | Always `"share"`: which kind this is. |
| `title?` | `string \| undefined` | The title shared. |
| `text?` | `string \| undefined` | The text shared. |
| `url?` | `string \| undefined` | The address shared. |

### SharedApi

What both entries have.

| Field | Type | Description |
|---|---|---|
| `hooks` | `SharedHooks` | Listening to what happens: the hooks both entries have. |
| `commands` | `Commands` | The handlers of the extension's declared commands. |
| `ui` | `Ui` | The renderers of the extension's pages, panels and status items. |
| `settings` | `Settings` | The extension's settings, as Songstress keeps them. |
| `storage` | `Store` | The extension's own small store. Permission `storage`. |
| `net` | `Net` | The only way to the network. Permission `network`. |
| `host` | `Host` | What the code runs in: the API version, the side, and on the client the app. |

Refers to [SharedHooks](/docs/develop/reference/songstress/#type-SharedHooks), [Commands](/docs/develop/reference/songstress/#type-Commands), [Ui](/docs/develop/reference/songstress/#type-Ui), [Settings](/docs/develop/reference/songstress/#type-Settings), [Store](/docs/develop/reference/songstress/#type-Store), [Net](/docs/develop/reference/songstress/#type-Net), [Host](/docs/develop/reference/songstress/#type-Host).

### SharedHooks

The one hook both entries have, as code that runs on either side may use
it. Each entry's own hooks say more about the moment.

| Field | Type | Description |
|---|---|---|
| `onPlay` | `(listener: (song: Song) => Awaitable<void>) => Disposable` | A song started playing. |

Refers to [Song](/docs/develop/reference/songstress/#type-Song), [Awaitable](/docs/develop/reference/songstress/#type-Awaitable), [Disposable](/docs/develop/reference/songstress/#type-Disposable).

### ShelfBlock

A row of cards that scrolls sideways, under a heading.

| Field | Type | Description |
|---|---|---|
| `type` | `"shelf"` | Always `"shelf"`: which kind this is. |
| `title` | `string` | The shelf's heading. |
| `items` | `(AlbumCard \| ArtistCard \| Card \| PlaylistCard \| SongRow)[]` | What it holds, side by side. |

Refers to [Card](/docs/develop/reference/songstress/#type-Card), [SongRow](/docs/develop/reference/songstress/#type-SongRow), [AlbumCard](/docs/develop/reference/songstress/#type-AlbumCard), [ArtistCard](/docs/develop/reference/songstress/#type-ArtistCard), [PlaylistCard](/docs/develop/reference/songstress/#type-PlaylistCard).

### Side

Where code runs: in the server entry or in the client entry.

```ts
export type Side = "server" | "client";
```

### SignInHandler

The two halves of a sign-in, and its end. A half that cannot be done
throws a `ProviderFailure`; anything else thrown counts as broken.

| Field | Type | Description |
|---|---|---|
| `start` | `(request: SignInStart) => Awaitable<SignInPage>` | The service's page for this sign-in. Keep what `finish` will need (a code verifier) in `songstress.secrets`: another instance may run it. |
| `finish` | `(returned: SignInReturn) => Awaitable<SignedIn>` | Trades what came back for the account's tokens, keeps them in `songstress.secrets`, and answers whose account it is. |
| `signOut?` | `((request: SignOutRequest) => Awaitable<void>) \| undefined` | Forgets the tokens, and tells the service when it has a way to. Left out, signing out only forgets the account's name. |

Refers to [SignInStart](/docs/develop/reference/songstress/#type-SignInStart), [Awaitable](/docs/develop/reference/songstress/#type-Awaitable), [SignInPage](/docs/develop/reference/songstress/#type-SignInPage), [SignInReturn](/docs/develop/reference/songstress/#type-SignInReturn), [SignedIn](/docs/develop/reference/songstress/#type-SignedIn), [SignOutRequest](/docs/develop/reference/songstress/#type-SignOutRequest).

### SignInPage

Where the person signs in.

| Field | Type | Description |
|---|---|---|
| `url` | `string` | The service's own page, an http or https address, with `redirectUrl` and `state` in it as the service asks for them. |

### SignInRegistry

The sign-in the manifest declares. Server entry; permission `secrets`.

| Field | Type | Description |
|---|---|---|
| `register` | `(handler: SignInHandler) => Disposable` | Registers the declared sign-in's handler: one for the extension. |

Refers to [SignInHandler](/docs/develop/reference/songstress/#type-SignInHandler), [Disposable](/docs/develop/reference/songstress/#type-Disposable).

### SignInReturn

What `finish` is handed.

| Field | Type | Description |
|---|---|---|
| `url` | `string` | The address the person came back on, whole: what the service added to `redirectUrl` (a code, an error) is in it. |
| `redirectUrl` | `string` | The `redirectUrl` that `start` was handed, for a service that asks for it again. |
| `userId?` | `string \| undefined` | The member who signed in, for a sign-in of scope "user": the one `start` was handed. Keep their tokens as theirs. |

### SignInStart

What `start` is handed.

| Field | Type | Description |
|---|---|---|
| `redirectUrl` | `string` | Where the service must send the person back: this server's own address for it. Register it with the service as the redirect address. |
| `state` | `string` | A one-time value the service must hand back unchanged (OAuth's `state`): Songstress finishes only the sign-in that carries it. |
| `userId?` | `string \| undefined` | The member signing in, for a sign-in of scope "user"; left out for the server's own. |

### SignOutRequest

What `signOut` is handed: whose account ends.

| Field | Type | Description |
|---|---|---|
| `userId?` | `string \| undefined` | The member signing out, for a sign-in of scope "user"; left out for the server's own. |

### SignedIn

The account now signed in.

| Field | Type | Description |
|---|---|---|
| `account` | `string` | The account as its owner knows it (a name, an address): what the person who signed in reads beside "Signed in as". |

### Size

A step of space.

```ts
export type Size = 'small' | 'medium' | 'large';
```

### SliderField

A form's slider over a range of numbers.

| Field | Type | Description |
|---|---|---|
| `type` | `"slider"` | Always `"slider"`: which kind this is. |
| `value?` | `number \| undefined` | Where it stands at first. |
| `minimum` | `number` | Its lowest value. |
| `maximum` | `number` | Its highest value. |
| `step?` | `number \| undefined` | How far one move goes. |
| `name` | `string` | Unique in the form. |
| `label` | `string` | The field's label. |
| `help?` | `string \| undefined` | A line of help under the field. |

### Song

A song of the library.

| Field | Type | Description |
|---|---|---|
| `id` | `string` | Its library id. |
| `title` | `string` | Its title. |
| `artist` | `string` | The artist as the song's tags credit them. |
| `artistId?` | `string \| undefined` | Its artist's library id. |
| `album?` | `string \| undefined` | Its album's name. |
| `albumId?` | `string \| undefined` | Its album's library id. |
| `durationS?` | `number \| undefined` | Its length, in seconds. |
| `track?` | `number \| undefined` | Its place on its album. |
| `disc?` | `number \| undefined` | Its disc. |
| `year?` | `number \| undefined` | The year it came out. |
| `genre?` | `string \| undefined` | Its genre. |
| `isrc?` | `string \| undefined` | The recording's ISRC, when its tags carry one. |
| `musicBrainzId?` | `string \| undefined` | The recording's MusicBrainz id, when its tags carry one. |

### SongRow

A song of the library, drawn as Songstress draws it, with its own menu.

| Field | Type | Description |
|---|---|---|
| `type` | `"song"` | Always `"song"`: which kind this is. |
| `songId` | `string` | The song's library id. |

### SongstressError

The error every call to the API rejects or throws with.

```ts
export declare class SongstressError extends Error {
    readonly name = "SongstressError";
    readonly code: SongstressErrorCode;
    constructor(code: SongstressErrorCode, message: string);
}
```

Refers to [SongstressErrorCode](/docs/develop/reference/songstress/#type-SongstressErrorCode).

### SongstressErrorCode

Why a call to the API failed.
- `no-host`: the code is not running inside Songstress (a test with no mock host)
- `permission-denied`: the manifest did not ask for it, or nobody granted it
- `not-available`: this side, this app or this build cannot do it
- `limit-exceeded`: a quota, a size, a rate or a deadline was passed
- `invalid`: an argument is wrong, or names something that does not exist
- `failed`: anything else; the message says what

```ts
export type SongstressErrorCode = 'no-host' | 'permission-denied' | 'not-available' | 'limit-exceeded' | 'invalid' | 'failed';
```

### SpacerBlock

Room between blocks.

| Field | Type | Description |
|---|---|---|
| `type` | `"spacer"` | Always `"spacer"`: which kind this is. |
| `size?` | `Size \| undefined` | How much room. |

Refers to [Size](/docs/develop/reference/songstress/#type-Size).

### StackBlock

Blocks beside or under one another.

| Field | Type | Description |
|---|---|---|
| `type` | `"stack"` | Always `"stack"`: which kind this is. |
| `direction?` | `"horizontal" \| "vertical" \| undefined` | Left out, "vertical". |
| `gap?` | `Size \| undefined` | Room between its children. |
| `align?` | `"center" \| "end" \| "start" \| undefined` | How its children line up across it. |
| `children` | `Block[]` | What it holds, in order. |

Refers to [Size](/docs/develop/reference/songstress/#type-Size), [Block](/docs/develop/reference/songstress/#type-Block).

### StatusContent

What a status item shows in the player: an icon and a few words, the
extension's own state at a glance.

| Field | Type | Description |
|---|---|---|
| `text?` | `string \| undefined` | A few words; left out, the icon alone, named by the status item's declared title for people who do not see it. |
| `icon?` | `string \| undefined` | An icon from Songstress's icon set. |
| `tone?` | `Tone \| undefined` | Its colour, by meaning; the theme decides the colour itself. |
| `tooltip?` | `string \| undefined` | A line more, shown on hover or a long press. |
| `progress?` | `number \| undefined` | From 0 to 1: how far some work of the extension's is. |
| `busy?` | `boolean \| undefined` | Work is going on, with no telling how far it is. |
| `action?` | `Action \| undefined` | What choosing it does. |

Refers to [IconName](/docs/develop/reference/songstress/#type-IconName), [Tone](/docs/develop/reference/songstress/#type-Tone), [Action](/docs/develop/reference/songstress/#type-Action).

### StatusContext

What a status item's renderer is told: who looks, and the song playing,
whole to an extension granted `library.read`.

| Field | Type | Description |
|---|---|---|
| `userId` | `string` | The member whose player shows the item. |
| `client` | `ClientInfo` | The app it is drawn in. |
| `song?` | `Song \| undefined` | The song playing, whole to an extension granted `library.read`. |

Refers to [ClientInfo](/docs/develop/reference/songstress/#type-ClientInfo), [Song](/docs/develop/reference/songstress/#type-Song).

### StatusItems

Renderers for the manifest's `contributes.status`. A status item is
rendered when the player shows it, when the song changes, and when it is
refreshed.

| Field | Type | Description |
|---|---|---|
| `register` | `(id: string, render: StatusRenderer) => Disposable` | Registers the renderer of a declared status item. |

Refers to [StatusRenderer](/docs/develop/reference/songstress/#type-StatusRenderer), [Disposable](/docs/develop/reference/songstress/#type-Disposable).

### StatusRenderer

Null when the status item has nothing to say now: it is then left out.

```ts
export type StatusRenderer = (context: StatusContext) => Awaitable<StatusContent | null>;
```

Refers to [StatusContext](/docs/develop/reference/songstress/#type-StatusContext), [Awaitable](/docs/develop/reference/songstress/#type-Awaitable), [StatusContent](/docs/develop/reference/songstress/#type-StatusContent).

### Store

The extension's own store, as code in an app uses it: the signed-in
member's part of it. Small JSON values under text keys, under a quota.
Permission `storage`.

| Field | Type | Description |
|---|---|---|
| `get` | `<Value = unknown>(key: string) => Promise<Value \| undefined>` | What was last set under the key; undefined when nothing is. The type is the caller's word for it: nothing checks it. |
| `set` | `(key: string, value: unknown) => Promise<void>` | Keeps a JSON value under the key, in place of what was there. |
| `delete` | `(key: string) => Promise<void>` | Forgets a key. |
| `keys` | `(prefix?: string) => Promise<string[]>` | The keys held, in order; those that start with `prefix` when given. |

### StreamLocation

Where one whole audio file is.

| Field | Type | Description |
|---|---|---|
| `url` | `string` | The audio's address. |
| `headers?` | `Record<string, string> \| undefined` | Headers to send with the request. |
| `container` | `AudioContainer` | The audio's container. |

Refers to [AudioContainer](/docs/develop/reference/songstress/#type-AudioContainer).

### SwitchField

A form's switch: on or off.

| Field | Type | Description |
|---|---|---|
| `type` | `"switch"` | Always `"switch"`: which kind this is. |
| `value?` | `boolean \| undefined` | Whether it is on at first. |
| `name` | `string` | Unique in the form. |
| `label` | `string` | The field's label. |
| `help?` | `string \| undefined` | A line of help under the field. |

### TextBlock

Words, in one of four styles.

| Field | Type | Description |
|---|---|---|
| `type` | `"text"` | Always `"text"`: which kind this is. |
| `text` | `string` | The words. |
| `style?` | `"body" \| "caption" \| "heading" \| "title" \| undefined` | Left out, "body". |
| `tone?` | `Tone \| undefined` | Their colour, by meaning. |

Refers to [Tone](/docs/develop/reference/songstress/#type-Tone).

### TextField

A form's text field.

| Field | Type | Description |
|---|---|---|
| `type` | `"text-field"` | Always `"text-field"`: which kind this is. |
| `value?` | `string \| undefined` | What it holds at first. |
| `placeholder?` | `string \| undefined` | The hint while it is empty. |
| `multiline?` | `boolean \| undefined` | Several lines. |
| `maxLength?` | `number \| undefined` | The most characters it takes. |
| `required?` | `boolean \| undefined` | It may not be sent empty. |
| `name` | `string` | Unique in the form. |
| `label` | `string` | The field's label. |
| `help?` | `string \| undefined` | A line of help under the field. |

### ToastAction

Shows a short message that goes away by itself.

| Field | Type | Description |
|---|---|---|
| `type` | `"toast"` | Always `"toast"`: which kind this is. |
| `message` | `string` | The message. |
| `tone?` | `"danger" \| "default" \| "success" \| "warning" \| undefined` | Its colour, by meaning. |

### Tone

Colour by what it means; the theme decides what it looks like.

```ts
export type Tone = 'default' | 'muted' | 'accent' | 'success' | 'warning' | 'danger' | 'info';
```

### TrackFacts

Facts a source can add to a track that lacks them.

| Field | Type | Description |
|---|---|---|
| `isrc?` | `string \| undefined` | Its ISRC. |
| `ids?` | `Partial<Record<ProviderGroup, string>> \| undefined` | Its ids in the catalogues the source knows. |
| `releaseDate?` | `string \| undefined` | When it came out, as an ISO 8601 date or a year. |
| `genre?` | `string \| undefined` | Its genre. |
| `label?` | `string \| undefined` | Its record label. |
| `explicit?` | `boolean \| undefined` | Marked explicit. |

Refers to [CatalogIds](/docs/develop/reference/songstress/#type-CatalogIds).

### TrackQuery

A song Songstress wants something for: what its tags say.

| Field | Type | Description |
|---|---|---|
| `title` | `string` | The track's title. |
| `artist` | `string` | Its artist's name. |
| `album?` | `string \| undefined` | Its album's title. |
| `durationS?` | `number \| undefined` | Its length, in seconds. |
| `isrc?` | `string \| undefined` | Its ISRC, when known. |
| `ids?` | `Partial<Record<ProviderGroup, string>> \| undefined` | Its ids in the catalogues it is known in. |

Refers to [CatalogIds](/docs/develop/reference/songstress/#type-CatalogIds).

### TreeNode

A node of a tree: a row that may hold rows of its own.

| Field | Type | Description |
|---|---|---|
| `type` | `"node"` | Always `"node"`: which kind this is. |
| `id` | `string` | Unique in the tree. |
| `title` | `string` | Its title. |
| `subtitle?` | `string \| undefined` | A line under the title. |
| `icon?` | `string \| undefined` | An icon from Songstress's icon set. |
| `image?` | `ImageSource \| undefined` | A picture beside it. |
| `badge?` | `BadgeBlock \| undefined` | A badge beside it. |
| `action?` | `Action \| undefined` | What choosing it does. |
| `menu?` | `MenuEntry[] \| undefined` | Its menu. |
| `children?` | `(SongRow \| TreeNode)[] \| undefined` | The nodes under it, given now. |
| `expandable?` | `boolean \| undefined` | It has nodes under it that are not given now: when the person opens it, the page is rendered again with its id in `RenderContext.node`, and the answer's `nodes` are drawn under it. Left out when `children` is given. |
| `open?` | `boolean \| undefined` | Open at first, on the web and the desktop. A phone opens a node with nodes under it as a page of its own. |

Refers to [IconName](/docs/develop/reference/songstress/#type-IconName), [ImageSource](/docs/develop/reference/songstress/#type-ImageSource), [BadgeBlock](/docs/develop/reference/songstress/#type-BadgeBlock), [Action](/docs/develop/reference/songstress/#type-Action), [MenuEntry](/docs/develop/reference/songstress/#type-MenuEntry), [SongRow](/docs/develop/reference/songstress/#type-SongRow).

### TreeScreen

A page of nodes in a tree: folders, groups, anything that holds more of
itself. The web and desktop apps open a node in place; the phones open it
as a page of its own, titled with the node's title.

| Field | Type | Description |
|---|---|---|
| `type` | `"tree"` | Always `"tree"`: which kind this is. |
| `nodes` | `(SongRow \| TreeNode)[]` | The tree's top nodes, or the nodes under `RenderContext.node`. |
| `search?` | `{ placeholder?: string; } \| undefined` | A search field over it, with its hint. |
| `empty?` | `EmptyState \| undefined` | What it shows when it holds nothing. |

Refers to [TreeNode](/docs/develop/reference/songstress/#type-TreeNode), [SongRow](/docs/develop/reference/songstress/#type-SongRow), [EmptyState](/docs/develop/reference/songstress/#type-EmptyState).

### UI_VERSION

The version of the component vocabulary (ui.ts) this package describes.
An app says which version it draws in `ClientInfo.ui`. Version 2 added the
tree screen, status items, and the pick, input and notify actions.

```ts
export declare const UI_VERSION = 2;
```

### Ui

Declared interface. Both sides; no permission.

| Field | Type | Description |
|---|---|---|
| `pages` | `Pages` | The renderers of the extension's pages. |
| `panels` | `Panels` | The renderers of the extension's panels. |
| `status` | `StatusItems` | The renderers of the extension's status items. |

Refers to [Pages](/docs/develop/reference/songstress/#type-Pages), [Panels](/docs/develop/reference/songstress/#type-Panels), [StatusItems](/docs/develop/reference/songstress/#type-StatusItems).

### User

A member of the server: an id and the name they show.

| Field | Type | Description |
|---|---|---|
| `id` | `string` | The member's id. |
| `name` | `string` | The member's display name. |

### Users

Reading who the members are. Server entry; permission `users.read`.

| Field | Type | Description |
|---|---|---|
| `get` | `(id: string) => Promise<User \| null>` | The member with this id, or null when there is none. |
| `list` | `() => Promise<User[]>` | Every member of the server. |

Refers to [User](/docs/develop/reference/songstress/#type-User).

### songstress

The API code that runs in either entry imports: `import { songstress } from 'songstress'`.

```ts
export declare const sharedApi: SharedApi;
```

Refers to [SharedApi](/docs/develop/reference/songstress/#type-SharedApi).
