/** * ChatState — AI transcript FSM. * * Accumulates signaling events into a renderable chat history. The key * property is that an AI partial and a user partial can coexist (e.g. when * the user barges mid-response), and both are rendered — ordered by which * party spoke most recently. * * Event semantics: * - `ai.response_utterance` → AI chunk; buffer into `_aiPartial`. * - `ai.completion` → AI finished. Promote partial to complete. * If `barged`, `lastSpoken` flips to user. * - `ai.partial_result` → User partial; replace `_userPartial`. * - `ai.speech_detect` → User finished. Promote partial (or insert * directly) with the server's final text. */ export type Speaker = 'ai' | 'user'; export type EntryState = 'partial' | 'complete'; export interface ChatEntry { speaker: Speaker; text: string; state: EntryState; } export declare class ChatState { private _entries; private _aiPartial; private _userPartial; private _lastSpoken; /** Invoked after any state change. Overridable by consumers. */ onUpdate: () => void; /** Completed entries plus any live partials, in render order. */ getHistory(): ChatEntry[]; get hasAny(): boolean; get lastSpoken(): Speaker | null; reset(): void; onUserPartial(text: string): void; onUserComplete(text: string): void; onAiChunk(text: string): void; onAiComplete(text: string, barged: boolean): void; } //# sourceMappingURL=chat-state.d.ts.map