voicemate.events

Events flowing from the voice pipeline to the UI, and a small asyncio pub/sub bus.

The UI renders one lane per pipeline stage. Several lanes can be active at the same time (the LLM keeps generating while earlier sentences are synthesized and spoken), so the status model is per lane rather than a single exclusive state.

Attributes

Classes

Lane

Pipeline stage shown as one status lane in the UI.

LaneState

State of a lane.

StatusEvent

A lane changed state.

TranscriptEvent

Recognized user speech (or typed text).

TokenEvent

A streamed piece of the assistant reply.

ReplyEvent

The complete assistant reply of a turn.

ToolEvent

A tool call started or finished.

AudioEvent

A chunk of synthesized speech for the browser to play.

InterruptEvent

The user barged in: stop playback immediately.

ErrorEvent

Something failed in a way the user should know about.

ReminderEvent

A reminder became due.

ConfirmEvent

The agent needs the user's permission (human-in-the-loop) or no longer does.

HoldEvent

The user started or ended "hold until I'm finished".

FocusEvent

A skill's focused mode was switched on or off (by the toggle or by a spoken command).

MicCommandEvent

The global hotkey was pressed or released: the page starts or stops its microphone.

NotesChangedEvent

The notes store changed; the UI should refresh its notes panel.

MetricsEvent

Latency metrics of a finished turn.

EventBus

Fan-out pub/sub over asyncio queues.

Module Contents

class voicemate.events.Lane[source]

Bases: enum.StrEnum

Pipeline stage shown as one status lane in the UI.

Initialize self. See help(type(self)) for accurate signature.

LISTENING = 'listening'
TRANSCRIBING = 'transcribing'
RECALLING = 'recalling'
THINKING = 'thinking'
TOOL = 'tool'
GENERATING = 'generating'
SYNTHESIZING = 'synthesizing'
SPEAKING = 'speaking'
class voicemate.events.LaneState[source]

Bases: enum.StrEnum

State of a lane.

Initialize self. See help(type(self)) for accurate signature.

IDLE = 'idle'
ACTIVE = 'active'
DONE = 'done'
voicemate.events.ToolSource
class voicemate.events.StatusEvent[source]

A lane changed state.

Variables:
  • lane – The pipeline stage.

  • state – Its new state.

  • detail – Optional detail, e.g. the tool name.

  • ts – Unix timestamp.

lane: Lane
state: LaneState
detail: str = ''
ts: float
class voicemate.events.TranscriptEvent[source]

Recognized user speech (or typed text).

Variables:
  • text – The transcript.

  • final – False for live partial transcripts while the user is still speaking.

  • lang – Detected language code ("hu" or "en").

  • merged – True when this text continues the previous, cut-off question and replaces it.

text: str
final: bool
lang: str = ''
merged: bool = False
class voicemate.events.TokenEvent[source]

A streamed piece of the assistant reply.

Variables:

text – The new text.

text: str
class voicemate.events.ReplyEvent[source]

The complete assistant reply of a turn.

Variables:
  • text – Full reply text.

  • interrupted – True when the user barged in before the reply finished.

text: str
interrupted: bool = False
class voicemate.events.ToolEvent[source]

A tool call started or finished.

Variables:
  • name – Tool name.

  • phase – "start" or "end".

  • args – Tool arguments.

  • source – Where the result came from (only meaningful at "end").

  • summary – Short human-readable description (e.g. the query sent to the web).

name: str
phase: Literal['start', 'end']
args: dict[str, Any]
source: ToolSource = 'local'
summary: str = ''
class voicemate.events.AudioEvent[source]

A chunk of synthesized speech for the browser to play.

Variables:
  • pcm – Mono signed 16-bit little-endian PCM.

  • sample_rate – Sample rate of pcm in Hz.

pcm: bytes
sample_rate: int
class voicemate.events.InterruptEvent[source]

The user barged in: stop playback immediately.

class voicemate.events.ErrorEvent[source]

Something failed in a way the user should know about.

Variables:

message – Human-readable error.

message: str
class voicemate.events.ReminderEvent[source]

A reminder became due.

Variables:

text – Reminder text.

text: str
class voicemate.events.ConfirmEvent[source]

The agent needs the user’s permission (human-in-the-loop) or no longer does.

Variables:
  • question – The question; empty when the confirmation was answered.

  • open – True while waiting for the answer.

question: str
open: bool = True
class voicemate.events.HoldEvent[source]

The user started or ended “hold until I’m finished”.

Variables:

holding – True while pauses do not end the user’s turn.

holding: bool
class voicemate.events.FocusEvent[source]

A skill’s focused mode was switched on or off (by the toggle or by a spoken command).

Variables:

on – True while the skill is focused.

on: bool
class voicemate.events.MicCommandEvent[source]

The global hotkey was pressed or released: the page starts or stops its microphone.

Variables:

on – True while the hotkey is held, False once it is released.

on: bool
class voicemate.events.NotesChangedEvent[source]

The notes store changed; the UI should refresh its notes panel.

class voicemate.events.MetricsEvent[source]

Latency metrics of a finished turn.

Variables:

metrics – Mapping of metric name to value (seconds or counts).

metrics: dict[str, Any]
voicemate.events.Event
class voicemate.events.EventBus(maxsize: int = 1000)[source]

Fan-out pub/sub over asyncio queues.

Publishing never blocks: when a subscriber falls behind, its oldest event is dropped.

Parameters:

maxsize – Per-subscriber queue capacity.

subscribe() → asyncio.Queue[Event][source]

Register a new subscriber queue.

unsubscribe(queue: asyncio.Queue[Event]) → None[source]

Remove a subscriber queue (no-op if unknown).

publish(event: Event) → None[source]

Deliver event to every subscriber without blocking.