@fungi.computer/whistle
Classes
Section titled “Classes”WhistleActionError
Section titled “WhistleActionError”An owning handler’s explicit failure code and optional structured details.
Extends
Section titled “Extends”Error
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new WhistleActionError(
code,message,details?):WhistleActionError
Parameters
Section titled “Parameters”string
Stable failure identity supplied by the handler owner.
message
Section titled “message”string
details?
Section titled “details?”Optional JSON context safe to return to the caller.
Returns
Section titled “Returns”Overrides
Section titled “Overrides”Error.constructor
Properties
Section titled “Properties”
readonlycode:string
Stable failure identity supplied by the handler owner.
details?
Section titled “details?”
readonlyoptionaldetails?:WhistleJsonValue
Optional JSON context safe to return to the caller.
WhistleClosedError
Section titled “WhistleClosedError”A valid contribution was attempted after the runtime closed.
Extends
Section titled “Extends”Error
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new WhistleClosedError():
WhistleClosedError
Construct the provisional error for a valid post-close contribution.
Returns
Section titled “Returns”Overrides
Section titled “Overrides”Error.constructor
Type Aliases
Section titled “Type Aliases”WhistleExecutionOrigin
Section titled “WhistleExecutionOrigin”WhistleExecutionOrigin =
"agent"|"browser"|"keyboard"|"menu"|"palette"|"programmatic"|"slash"|"terminal"
The trusted host origin entering the single execution door.
WhistleCommandHandler
Section titled “WhistleCommandHandler”WhistleCommandHandler<
Arguments,Result> > =object["bivarianceHack"]
Runs one command with its parsed arguments. Returning undefined settles the
command without a result.
Type Parameters
Section titled “Type Parameters”Arguments
Section titled “Arguments”Arguments
Result
Section titled “Result”Result
WhistlePromptAnswer
Section titled “WhistlePromptAnswer”WhistlePromptAnswer<
Prompt> > =WhistlePromptAnswers[Prompt["type"]]
The answer type for one prompt kind.
Type Parameters
Section titled “Type Parameters”Prompt
Section titled “Prompt”Prompt extends WhistlePrompt
WhistleInteraction
Section titled “WhistleInteraction”WhistleInteraction =
Readonly<{signal:AbortSignal;prompt: <Kind>>(prompt,options?) =>Promise<WhistlePromptAnswers[Kind]>;notify: (notice) =>void; }>
A human conversation attached to one execution. prompt rejects when the human
cancels; signal aborts when the whole interaction is dismissed.
WhistleInteractionEnd
Section titled “WhistleInteractionEnd”WhistleInteractionEnd =
Readonly<{status:"handled"; }> |Readonly<{status:"cancelled"; }> |Readonly<{status:"failed";message:string; }>
How an execution with an attached interaction ended.
WhistleInteractionSession
Section titled “WhistleInteractionSession”WhistleInteractionSession =
Readonly<{interaction:WhistleInteraction;settle: (end) =>void; }>
One interaction a presenter opened for one execution.
WhistlePresenter
Section titled “WhistlePresenter”WhistlePresenter = (
request) =>WhistleInteractionSession
A mounted client that can render interactions. Whistle opens one session per human execution that has no caller-supplied interaction.
Parameters
Section titled “Parameters”request
Section titled “request”Readonly<{ commandId: string; title: string; retry: () => void;
}>
Returns
Section titled “Returns”WhistleExecutionInput
Section titled “WhistleExecutionInput”WhistleExecutionInput<
Arguments> > =Readonly<{origin:WhistleExecutionOrigin;arguments?:Arguments;signal?:AbortSignal;interaction?:WhistleInteraction; }>
The already-typed input supplied to a command handler.
Type Parameters
Section titled “Type Parameters”Arguments
Section titled “Arguments”Arguments = unknown
WhistleExecutionOutcome
Section titled “WhistleExecutionOutcome”WhistleExecutionOutcome<
Result> > =Extract<WhistleAvailability, {status:"unavailable"; }> |Readonly<{status:"handled";result?:Result; }> |Readonly<{status:"closed"; }> |Readonly<{status:"missing"; }> |Readonly<{status:"invalid"; }> |Readonly<{error:WhistleFailure;status:"failed"; }>
The normalized result of one command execution request.
Type Parameters
Section titled “Type Parameters”Result
Section titled “Result”Result = unknown
WhistleCommand
Section titled “WhistleCommand”WhistleCommand<
Arguments,Result> > =Readonly<{id:string;title:string;category:string;description?:string;projections?:WhistleCommandProjections;action?:WhistleAction;availability?: () =>WhistleAvailability;handler:WhistleCommandHandler<Arguments,Result>>; }>
One semantic command definition.
Type Parameters
Section titled “Type Parameters”Arguments
Section titled “Arguments”Arguments = unknown
Result
Section titled “Result”Result = unknown
WhistleContribution
Section titled “WhistleContribution”WhistleContribution =
Readonly<{sourceId:string;namespace:string;scope?:string;commands: readonlyWhistleCommand<never>>[]; }>
One contribution of source-owned commands to a namespace.
WhistleProjectionRow
Section titled “WhistleProjectionRow”WhistleProjectionRow =
Readonly<{commandId:string;sourceId:string;scope?:string;title:string;category:string;description?:string;order:number;action?:WhistleAction;availability:WhistleAvailability; }>
Shared immutable metadata carried by each projection row.
WhistleAgentProjection
Section titled “WhistleAgentProjection”WhistleAgentProjection =
Omit<WhistleProjectionRow,"action"|"scope"> > &Readonly<{action?:Pick<WhistleAction,"inputSchema"|"outputSchema">>;keybind?:string; }>
Immutable agent snapshot row composed from the schema-owned action data.
WhistleBindingProjection
Section titled “WhistleBindingProjection”WhistleBindingProjection =
WhistleProjectionRow&Readonly<{binding:string; }>
One binding value projected from a command.
WhistlePaletteProjection
Section titled “WhistlePaletteProjection”WhistlePaletteProjection =
WhistleProjectionRow
One palette value projected from a command.
WhistleSlashProjection
Section titled “WhistleSlashProjection”WhistleSlashProjection =
WhistleProjectionRow&Readonly<{alias:string;arguments?:WhistleSlashArguments; }>
One slash alias projected from a command.
WhistleHelpProjection
Section titled “WhistleHelpProjection”WhistleHelpProjection =
WhistleProjectionRow
One help value projected from a command.
WhistleMenuProjection
Section titled “WhistleMenuProjection”WhistleMenuProjection =
WhistleProjectionRow
One menu value projected from a command.
WhistleSnapshot
Section titled “WhistleSnapshot”WhistleSnapshot =
Readonly<{bindings: readonlyWhistleBindingProjection[];palette: readonlyWhistlePaletteProjection[];slash: readonlyWhistleSlashProjection[];help: readonlyWhistleHelpProjection[];menu: readonlyWhistleMenuProjection[];agent: readonlyWhistleAgentProjection[]; }>
The six immutable views of one semantic command graph.
WhistleContributionLease
Section titled “WhistleContributionLease”WhistleContributionLease =
Readonly<{update: (commands) =>void;dispose: () =>void; }>
An idempotent lease for one contribution generation.
WhistleRuntime
Section titled “WhistleRuntime”WhistleRuntime =
Readonly<{contribute: (contribution) =>WhistleContributionLease;close: () =>undefined;execute: (commandId,input) =>Promise<WhistleExecutionOutcome>>;snapshot: () =>WhistleSnapshot;subscribe: (listener) => () =>void;present: (presenter) => () =>void; }>
The provisional Whistle semantic runtime seam.
WhistleKeymapAdapter
Section titled “WhistleKeymapAdapter”WhistleKeymapAdapter =
Readonly<{cleanup: () =>void; }>
Lifecycle operations for a projection into a maintained host keymap.
WhistleKeymapBinding
Section titled “WhistleKeymapBinding”WhistleKeymapBinding =
Readonly<{cmd:string;key:string; }>
One physical key string mapped to a Whistle command identifier.
WhistleKeymapCommand
Section titled “WhistleKeymapCommand”WhistleKeymapCommand =
Readonly<{name:string;run: () =>Promise<boolean>>; }>
Host callback that executes one semantic Whistle command.
WhistleKeymapLayer
Section titled “WhistleKeymapLayer”WhistleKeymapLayer =
Readonly<{bindings: readonlyWhistleKeymapBinding[];commands: readonlyWhistleKeymapCommand[]; }>
Binding and command records accepted by a maintained keymap host.
WhistleKeymapHost
Section titled “WhistleKeymapHost”WhistleKeymapHost =
Readonly<{registerLayer: (layer) => () =>void; }>
Minimal registration surface implemented by a maintained host keymap.
Functions
Section titled “Functions”scopeSnapshot()
Section titled “scopeSnapshot()”scopeSnapshot(
snapshot,scope):WhistleSnapshot
The human-facing view for one focused scope: global rows plus the focused scope’s rows. A focused slash alias or binding shadows the same global one. The agent view is not focus-bound and stays whole.
Parameters
Section titled “Parameters”snapshot
Section titled “snapshot”A complete runtime snapshot.
string | null
The focused scope, or null when nothing scoped is focused.
Returns
Section titled “Returns”A frozen snapshot with the same agent rows.
createWhistle()
Section titled “createWhistle()”createWhistle():
WhistleRuntime
Construct the provisional semantic runtime shell.
Returns
Section titled “Returns”createWhistleKeymapAdapter()
Section titled “createWhistleKeymapAdapter()”createWhistleKeymapAdapter(
keymap,whistle,origin):WhistleKeymapAdapter
Project Whistle bindings into a host-created maintained OpenTUI keymap.
Parameters
Section titled “Parameters”keymap
Section titled “keymap”whistle
Section titled “whistle”Pick<WhistleRuntime, "snapshot" | "subscribe" |
"execute">
origin
Section titled “origin”Returns
Section titled “Returns”References
Section titled “References”WhistleAction
Section titled “WhistleAction”Re-exports WhistleAction
WhistleActionPresentation
Section titled “WhistleActionPresentation”Re-exports WhistleActionPresentation
WhistleActionSchema
Section titled “WhistleActionSchema”Re-exports WhistleActionSchema
WhistleAvailability
Section titled “WhistleAvailability”Re-exports WhistleAvailability
WhistleCommandProjections
Section titled “WhistleCommandProjections”Re-exports WhistleCommandProjections
WhistleCommandDefinition
Section titled “WhistleCommandDefinition”Re-exports WhistleCommandDefinition
WhistleFailure
Section titled “WhistleFailure”Re-exports WhistleFailure
WhistleJsonObject
Section titled “WhistleJsonObject”Re-exports WhistleJsonObject
WhistleJsonValue
Section titled “WhistleJsonValue”Re-exports WhistleJsonValue
WhistleNotice
Section titled “WhistleNotice”Re-exports WhistleNotice
WhistleNoticeLink
Section titled “WhistleNoticeLink”Re-exports WhistleNoticeLink
WhistlePrompt
Section titled “WhistlePrompt”Re-exports WhistlePrompt
WhistlePromptOption
Section titled “WhistlePromptOption”Re-exports WhistlePromptOption
WhistleSlashArguments
Section titled “WhistleSlashArguments”Re-exports WhistleSlashArguments
WhistleSlashWord
Section titled “WhistleSlashWord”Re-exports WhistleSlashWord