- Name
endReason- Kind
- property
- Type
VoiceSessionEndReason- Requirement
- optional
DocsAPI referenceUI machinesvoice-session
voice-session machine
The public state machine contract for @grassroot/ui-machines/voice-session. The machine owns behaviour; the matching headless layer owns composition.
@grassroot/ui-machines/voice-session
Package
Service example
voice-session.tsts
import { createService } from "@grassroot/statechart";import { voiceSessionMachine } from "@grassroot/ui-machines/voice-session"; const service = createService(voiceSessionMachine, { input: {} });service.start();service.send({ type: "…" });service.stop();11 of 11
Exports
VoiceSessionContext
typeVoiceSessionContextts
type VoiceSessionContext = { readonly isMuted: boolean; readonly mode: VoiceSessionMode; readonly endReason?: VoiceSessionEndReason; readonly error?: unknown;};Name
Kind
Type
Requirement
endReasonproperty
VoiceSessionEndReasonoptional
errorproperty
unknownoptional
isMutedproperty
booleanrequired
modeproperty
VoiceSessionModerequired
- Name
error- Kind
- property
- Type
unknown- Requirement
- optional
- Name
isMuted- Kind
- property
- Type
boolean- Requirement
- required
- Name
mode- Kind
- property
- Type
VoiceSessionMode- Requirement
- required
VoiceSessionDiagnosticCodests
export declare const VoiceSessionDiagnosticCodes: readonly DiagnosticCatalogueEntry[];VoiceSessionEndReasonts
type VoiceSessionEndReason = "finished" | "cancelled" | "error";VoiceSessionEvent
typeVoiceSessionEventts
type VoiceSessionEvent = { readonly type: "CONNECTED";} | { readonly type: "SET_MUTED"; readonly muted: boolean;} | { readonly type: "TOGGLE_MUTED";} | { readonly type: "SET_MODE"; readonly mode: VoiceSessionMode;} | { readonly type: "ENDED"; readonly reason: VoiceSessionEndReason; readonly error?: unknown;} | { readonly type: "CANCEL";} | { readonly type: "RESET";};VoiceSessionInput
typeVoiceSessionInputts
type VoiceSessionInput = { readonly isMuted?: boolean; readonly mode?: VoiceSessionMode;};Name
Kind
Type
Requirement
isMutedproperty
booleanoptional
modeproperty
VoiceSessionModeoptional
- Name
isMuted- Kind
- property
- Type
boolean- Requirement
- optional
- Name
mode- Kind
- property
- Type
VoiceSessionMode- Requirement
- optional
voiceSessionMachine
valuevoiceSessionMachinets
export declare const voiceSessionMachine: Machine<VoiceSessionInput, VoiceSessionValue, VoiceSessionContext, VoiceSessionEvent, never>;VoiceSessionMode
typeVoiceSessionModets
type VoiceSessionMode = "listening" | "speaking";voiceSessionReplaySequencets
export declare const voiceSessionReplaySequence: readonly VoiceSessionEvent[];voiceSessionSelectors
valuevoiceSessionSelectorsts
export declare const voiceSessionSelectors: { isActive(snapshot: VoiceSessionSnapshot): boolean; isMuted(snapshot: VoiceSessionSnapshot): boolean; mode(snapshot: VoiceSessionSnapshot): VoiceSessionMode; endReason(snapshot: VoiceSessionSnapshot): VoiceSessionEndReason | undefined;};Name
Kind
Type
Requirement
endReasonmethod
(snapshot: VoiceSessionSnapshot) => VoiceSessionEndReason | undefinedrequired
isActivemethod
(snapshot: VoiceSessionSnapshot) => booleanrequired
isMutedmethod
(snapshot: VoiceSessionSnapshot) => booleanrequired
modemethod
(snapshot: VoiceSessionSnapshot) => VoiceSessionModerequired
- Name
endReason- Kind
- method
- Type
(snapshot: VoiceSessionSnapshot) => VoiceSessionEndReason | undefined- Requirement
- required
- Name
isActive- Kind
- method
- Type
(snapshot: VoiceSessionSnapshot) => boolean- Requirement
- required
- Name
isMuted- Kind
- method
- Type
(snapshot: VoiceSessionSnapshot) => boolean- Requirement
- required
- Name
mode- Kind
- method
- Type
(snapshot: VoiceSessionSnapshot) => VoiceSessionMode- Requirement
- required
VoiceSessionSnapshot
typeVoiceSessionSnapshotts
type VoiceSessionSnapshot = Snapshot<VoiceSessionValue, VoiceSessionContext>;VoiceSessionValue
typeVoiceSessionValuets
type VoiceSessionValue = "starting" | "running" | "ended";