Repository navigation
Component State Stores
The frontend state stores are four Zustand stores with narrow ownership boundaries: connection/session transport state, conversation stream state, visitor identity/history/rate counters, and voice/UI audio state. They are consumed by Component-Frontend-App, Component-WebSocket-Transport, Component-Audio-Chain, and Component-Speech-Input.
packages/frontend/src/stores/connectionStore.tspackages/frontend/src/stores/conversationStore.tspackages/frontend/src/stores/visitorStore.tspackages/frontend/src/stores/voiceStore.tspackages/frontend/src/types/domain.ts
domain.ts exports:
type SessionState = 'INITIALIZING' | 'GREETING' | 'ACTIVE' | 'ENDED' | 'BUDGET_CAPPED' | 'RATE_LIMITED' | 'SIGNAL_LOST' | 'ERROR'type GreetingArchetype = 'TV_PRESENTER_INTRO' | 'MID_MONOLOGUE' | 'MOCK_ANNOYANCE' | 'SPONSOR_BREAK' | 'TIME_OF_DAY_RIFF' | 'SELF_CONGRATULATION' | 'FAKE_NEWS_FLASH' | 'GLITCH_COLD_OPEN'interface Greeting { id; archetype; text; audioPath; audioDurationMs; videoPath; weight; tags; }interface RateLimitState { hourlyCount; hourlyWindowStart; dailyCount; dailyWindowStart; }interface Visitor { actorId; displayAlias; greetingHistory; rateLimitCounters; }
Owns transport/session status:
-
sessionState: SessionState, initiallyINITIALIZING sessionId: string | nullagentCoreSessionId: string | nullisWebSocketReady: boolean
Actions:
setSessionState(state: SessionState): voidsetConnected(sessionId: string, agentCoreSessionId: string): voidreset(): void
Owns the current streamed/completed assistant response and session counters:
turnCount: numbertokenCount: numbercurrentResponseText: stringisStreaming: booleancurrentTurnIndex: number
Actions:
appendToken(token: string): voidsetFullText(text: string): voidadvanceTurn(): voidupdateCounters(counters: { sessionTokenTotal: number; sessionTurnTotal: number }): voidreset(): void
Owns local visitor identity and rate-limit history:
actorId: stringdisplayAlias: string | nullgreetingHistory: string[]rateLimitCounters: RateLimitState
Actions:
setDisplayAlias(alias: string): voidpushGreeting(greetingId: string): voidupdateRateLimits(limits: RateLimitState): voidclearAll(): voidreset(): void
actorId is stored in localStorage under a max-height- prefixed key and created with crypto.randomUUID() if absent. pushGreeting() keeps only the latest 20 IDs.
Owns voice/speech animation flags, not volume:
isSpeaking: booleanisMouthOpen: booleanisMicActive: booleanisGreeting: boolean
Actions:
setSpeaking(value: boolean): voidsetMouthOpen(value: boolean): voidsetMicActive(value: boolean): voidsetGreeting(value: boolean): voidreset(): void
-
visitorStorereadslocalStorageduring initial state creation, so it assumes a browser environment. -
voiceStoredoes not own volume despite its audio-adjacent name; current volume is local state inApp.tsx. -
connectionStore.sessionStatestarts atINITIALIZING, and over SSEACTIVEarrives only with the firstsessionevent, after a send.Apptherefore blocks sending only in terminal and refusal states (SEND_BLOCKED_STATES), not untilACTIVE. This page's earlier claim thatAppsends only when state isACTIVEorGREETINGdescribed a bug, fixed 2026-11-16; see Component-Frontend-App. - Audio clips are numbered per turn: the server restarts each turn's segment
seqat 0.voiceStorestamps every queued clip withaudioTurn, whichbeginAudioTurn()advances whenuseAgentStreamstarts a non-capture exchange, anduseAudioresets its duplicate-dropseqwhen the turn changes. A player that remembers the highestseqit has ever played drops every later turn's audio, so the voice goes silent after the first reply (fixed 2026-11-16).
- Concept-Cloud-Only-Inference
- Concept-Budget-Ceiling
- Concept-Personality-Gate
- Concept-IP-And-Legal-Posture
- Concept-Supply-Chain-Discipline
- Concept-Graceful-Degradation
- Concept-Observability
- Concept-Testing-And-TDD
- Concept-Credential-Hygiene
Editing in the browser? Wiki edits are live and bypass wiki:lint. Read
Guide-Wiki-Contributing first.