interface TalkitCallSessionTokenResult { sessionToken: string; websocketUrl?: string; expiresAt?: string; } interface TalkitCallConfig { baseUrl: string; getSessionToken: () => Promise; workletUrl?: string; startupTimeoutMs?: number; } interface TalkitCallStateEvent { callId?: string; state: 'idle' | 'connecting' | 'connected' | 'ready' | 'speaking' | 'listening' | 'ended'; command?: TalkitCallCommand; } type TalkitCallCommand = 'INTERRUPT' | 'PAUSE' | 'RESUME' | 'DUCK_OUTPUT' | 'RESET_OUTPUT_VOLUME' | (string & {}); interface TalkitCallErrorEvent { code?: string; message: string; } interface TalkitCallEndedEvent { callId?: string; reason?: string; } interface TalkitCallLifecycleEvent { callId?: string; conversationGroupKey?: string; } interface TalkitCallDebugEvent { type: string; sequence?: number; callId?: string; occurredAt?: number; [key: string]: unknown; } interface TalkitCallEventMap { connecting: TalkitCallLifecycleEvent; connected: TalkitCallLifecycleEvent; ready: TalkitCallLifecycleEvent; speaking: TalkitCallLifecycleEvent; listening: TalkitCallLifecycleEvent; ended: TalkitCallEndedEvent; error: TalkitCallErrorEvent; state: TalkitCallStateEvent; debug: TalkitCallDebugEvent; } type TalkitCallEventName = keyof TalkitCallEventMap; type TalkitCallEventHandler = (event: TalkitCallEventMap[TEventName]) => void; interface TalkitCall { start(): Promise; stop(): void; interrupt(): void; mute(nextMuted?: boolean): boolean; destroy(): void; on(eventName: TEventName, handler: TalkitCallEventHandler): void; off(eventName: TEventName, handler: TalkitCallEventHandler): void; } declare function createTalkitCall(config: TalkitCallConfig): TalkitCall; interface TalkitChatSessionTokenResult { sessionToken: string; websocketUrl?: string; expiresAt?: string; } interface TalkitChatConfig { baseUrl: string; getSessionToken: () => Promise; startupTimeoutMs?: number; } interface TalkitChatStateEvent { threadId?: string; state: 'idle' | 'connecting' | 'connected' | 'ready' | 'ended'; } interface TalkitChatErrorEvent { code?: string; message: string; clientMessageId?: string; } interface TalkitChatHistoryMessage { id: string; role: 'participant' | 'assistant' | 'operator'; content: Record; timestamp: number; } interface TalkitChatHistoryEvent { messages: TalkitChatHistoryMessage[]; pagination: { hasMore: boolean; nextBefore?: string; }; } interface TalkitChatReadyEvent { threadId: string; scopedThreadId?: string; conversationGroupKey?: string; } interface TalkitChatAckEvent { threadId: string; messageId: string; clientMessageId: string; status: 'received'; timestamp: number; } interface TalkitChatBatchEvent { threadId: string; events: unknown[]; renderedMessages?: TalkitChatRenderedMessage[]; } interface TalkitChatRenderedMessage { renderedMessageId: string; turnId?: string; text: string; status: 'streaming' | 'final'; deliveryDelayMs?: number; } interface TalkitChatEndedEvent { threadId?: string; reason?: string; } interface TalkitChatLifecycleEvent { threadId?: string; } interface TalkitChatEventMap { connecting: TalkitChatLifecycleEvent; connected: TalkitChatLifecycleEvent; ready: TalkitChatReadyEvent; ack: TalkitChatAckEvent; batch: TalkitChatBatchEvent; ended: TalkitChatEndedEvent; error: TalkitChatErrorEvent; history: TalkitChatHistoryEvent; state: TalkitChatStateEvent; } type TalkitChatEventName = keyof TalkitChatEventMap; type TalkitChatEventHandler = (event: TalkitChatEventMap[TEventName]) => void; interface TalkitChat { connect(): Promise; send(message: string | Record, options?: { clientMessageId?: string; }): string; loadEarlier(before?: string, limit?: number): void; cancel(): void; disconnect(): void; destroy(): void; on(eventName: TEventName, handler: TalkitChatEventHandler): void; off(eventName: TEventName, handler: TalkitChatEventHandler): void; } declare function createTalkitChat(config: TalkitChatConfig): TalkitChat; export { type TalkitCall, type TalkitCallCommand, type TalkitCallConfig, type TalkitCallDebugEvent, type TalkitCallEndedEvent, type TalkitCallErrorEvent, type TalkitCallEventHandler, type TalkitCallEventMap, type TalkitCallEventName, type TalkitCallLifecycleEvent, type TalkitCallSessionTokenResult, type TalkitCallStateEvent, type TalkitChat, type TalkitChatAckEvent, type TalkitChatBatchEvent, type TalkitChatConfig, type TalkitChatEndedEvent, type TalkitChatErrorEvent, type TalkitChatEventHandler, type TalkitChatEventMap, type TalkitChatEventName, type TalkitChatHistoryEvent, type TalkitChatHistoryMessage, type TalkitChatLifecycleEvent, type TalkitChatReadyEvent, type TalkitChatRenderedMessage, type TalkitChatSessionTokenResult, type TalkitChatStateEvent, createTalkitCall, createTalkitChat };