command-host
Import
Section titled “Import”import * as api from "@fungi.computer/nacre/command-host";Exports
Section titled “Exports”| Kind | Export | Description |
|---|---|---|
| type alias | AppCommandOptional | An optional field a declaration may carry as explicitly undefined. |
| type alias | AppCommandDeclaration | The digest-covered command rows a mounted App’s Release declares, as the host receives them. Oyster compares and projects them; the Release declaration grammar stays with its owner, which hands rows of this shape. |
| type alias | AppSurfaceCommandMount | The command side of one mounted App’s host handlers. |
| type alias | PaneCommands | Commands owned by one pane, projected to globals plus its focus scope. |
| type alias | PaneCommandMount | Closing a pane withdraws all its leases, presenters and subscriptions. |
| type alias | AppSurfaceCommandHost | The shell-owned Whistle graph and its focused menu projection. |
| constant | appDirectorySourceId | Whistle source of Release-advertised rows for Apps not yet mounted. |
| function | commandPaletteReservedChordForPlatform() | Select the shell command-palette chord for a Mac or non-Mac keyboard. |
| function | commandPaletteReservedChordForUserAgent() | Select the shell command-palette chord from the embedding browser user agent. |
| function | createAppSurfaceCommandHost() | Own one shell’s Whistle runtime for mounted Apps and local panes. The embedding host supplies verified Release declarations and decides which App or pane has focus. |
AppCommandOptionaltype alias
Section titled “AppCommandOptional”type AppCommandOptional<T> = T | undefined;An optional field a declaration may carry as explicitly undefined.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T |
AppCommandDeclarationtype alias
Section titled “AppCommandDeclaration”type AppCommandDeclaration = Readonly<{ id: string; title: string; category: string; description?: AppCommandOptional<string>; projections?: AppCommandOptional< Readonly<{ bindings?: AppCommandOptional< Readonly<{ order?: AppCommandOptional<number>; values: readonly string[]; }> >; agent?: AppCommandOptional< Readonly<{ order?: AppCommandOptional<number>; keybind?: AppCommandOptional<string>; }> >; help?: AppCommandOptional< Readonly<{ order?: AppCommandOptional<number>; }> >; menu?: AppCommandOptional< Readonly<{ order?: AppCommandOptional<number>; }> >; palette?: AppCommandOptional< Readonly<{ order?: AppCommandOptional<number>; }> >; slash?: AppCommandOptional< Readonly<{ order?: AppCommandOptional<number>; aliases: readonly string[]; }> >; }> >;}>;The digest-covered command rows a mounted App’s Release declares, as the host receives them. Oyster compares and projects them; the Release declaration grammar stays with its owner, which hands rows of this shape.
AppSurfaceCommandMounttype alias
Section titled “AppSurfaceCommandMount”type AppSurfaceCommandMount = Readonly<{ agentCommands: Pick<WhistleRuntime, "snapshot" | "execute">; handlers: Pick<AppHostHandlers, "registerCommands" | "invokeReservedChord">; dispose: () => void;}>;The command side of one mounted App’s host handlers.
PaneCommandstype alias
Section titled “PaneCommands”type PaneCommands = Readonly<{ commandId: (id) => string; contribute: (commands) => WhistleContributionLease; execute: WhistleRuntime["execute"]; snapshot: WhistleRuntime["snapshot"]; subscribe: WhistleRuntime["subscribe"]; present: WhistleRuntime["present"];}>;Commands owned by one pane, projected to globals plus its focus scope.
PaneCommandMounttype alias
Section titled “PaneCommandMount”type PaneCommandMount = PaneCommands & Readonly<{ dispose: () => void; }>;Closing a pane withdraws all its leases, presenters and subscriptions.
AppSurfaceCommandHosttype alias
Section titled “AppSurfaceCommandHost”type AppSurfaceCommandHost = Readonly<{ mountPane: (paneId) => PaneCommandMount; mount: (mountId, declarations) => AppSurfaceCommandMount; focus: (mountId) => void; registerShellCommands: (commands) => () => void; registerDirectoryCommands: (commands, run) => () => void; menu: () => readonly WhistleMenuProjection[]; active: () => WhistleSnapshot; execute: (commandId, input) => Promise<WhistleExecutionOutcome>; snapshot: () => WhistleSnapshot; subscribe: (listener) => () => void; dispose: () => void;}>;The shell-owned Whistle graph and its focused menu projection.
appDirectorySourceIdconstant
Section titled “appDirectorySourceId”const appDirectorySourceId: "app-directory" = "app-directory";Whistle source of Release-advertised rows for Apps not yet mounted.
commandPaletteReservedChordForPlatform()function
Section titled “commandPaletteReservedChordForPlatform()”function commandPaletteReservedChordForPlatform(mac): AppHostReservedChord;Select the shell command-palette chord for a Mac or non-Mac keyboard.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
mac |
boolean |
Returns
Section titled “Returns”AppHostReservedChord
commandPaletteReservedChordForUserAgent()function
Section titled “commandPaletteReservedChordForUserAgent()”function commandPaletteReservedChordForUserAgent( userAgent,): AppHostReservedChord;Select the shell command-palette chord from the embedding browser user agent.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
userAgent |
string |
Returns
Section titled “Returns”AppHostReservedChord
createAppSurfaceCommandHost()function
Section titled “createAppSurfaceCommandHost()”function createAppSurfaceCommandHost(whistle?): AppSurfaceCommandHost;Own one shell’s Whistle runtime for mounted Apps and local panes. The embedding host supplies verified Release declarations and decides which App or pane has focus.
Agar invokes registerCommands once for the aggregate command set of a mount.
The adapter keeps that aggregate as one Whistle generation, so an Agar update
replaces the generation atomically and disposal releases only that App. Command
handlers remain the App’s callback; the shell only adds the Whistle identity and
routes focused menu execution to it.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
whistle |
WhistleRuntime |