Skip to content
API reference

interaction

Import
import * as api from "@fungi.computer/whistle/interaction";
Kind Export Description
type alias WhistleInteractionStatus Where one interaction is in its life.
type alias WhistlePendingPrompt The one pending question, with the sequence its answer must name.
type alias WhistleMessageNotice A notice that carries a message line.
type alias WhistleHandoffNotice A “continue elsewhere” notice.
type alias WhistleInteractionSnapshot Everything a renderer needs to draw one interaction.
type alias WhistleInteractionHost A renderer-neutral store behind one interaction dialog or panel.
function createWhistleInteractionHost() Own one interaction’s state for any renderer. Prompts and notices are parsed here, at the boundary where command-supplied data becomes UI.

WhistleInteractionStatustype alias

Section titled “WhistleInteractionStatus”
Signature
type WhistleInteractionStatus =
"working" | "prompting" | "failed" | "done" | "cancelled";

Where one interaction is in its life.


WhistlePendingPrompttype alias

Section titled “WhistlePendingPrompt”
Signature
type WhistlePendingPrompt = Readonly<{
sequence: number;
request: WhistlePrompt;
}>;

The one pending question, with the sequence its answer must name.


WhistleMessageNoticetype alias

Section titled “WhistleMessageNotice”
Signature
type WhistleMessageNotice = Extract<
WhistleNotice,
Readonly<{
type: "info" | "progress" | "success";
}>
>;

A notice that carries a message line.


WhistleHandoffNoticetype alias

Section titled “WhistleHandoffNotice”
Signature
type WhistleHandoffNotice = Extract<
WhistleNotice,
Readonly<{
type: "handoff";
}>
>;

A “continue elsewhere” notice.


WhistleInteractionSnapshottype alias

Section titled “WhistleInteractionSnapshot”
Signature
type WhistleInteractionSnapshot = Readonly<{
title: string;
status: WhistleInteractionStatus;
message?: WhistleMessageNotice;
handoff?: WhistleHandoffNotice;
links: readonly WhistleNoticeLink[];
prompt?: WhistlePendingPrompt;
failure?: string;
retryable: boolean;
closing?: WhistleMessageNotice;
}>;

Everything a renderer needs to draw one interaction.


WhistleInteractionHosttype alias

Section titled “WhistleInteractionHost”
Signature
type WhistleInteractionHost = Readonly<{
snapshot: () => WhistleInteractionSnapshot;
subscribe: (listener) => () => void;
begin: () => WhistleInteractionSession;
retry: () => void;
answer: (sequence, value) => boolean;
cancel: () => void;
}>;

A renderer-neutral store behind one interaction dialog or panel.

createWhistleInteractionHost()function

Section titled “createWhistleInteractionHost()”
Signature
function createWhistleInteractionHost(options): WhistleInteractionHost;

Own one interaction’s state for any renderer. Prompts and notices are parsed here, at the boundary where command-supplied data becomes UI.

Parameter Type
options Readonly<{ title: string; onEnd?: (end) => void; }>

WhistleInteractionHost

Re-exports interactionTextLimit