feat: Introduce new core components for conversation and speech management

- Added ConversationManager for managing conversation history with configurable limits.
- Implemented InputQueue for serial processing of input items.
- Created SpeechManager for handling text-to-speech generation and streaming.
- Developed StreamProcessor for processing LLM streams and forwarding events.
- Added TranscriptionManager for audio transcription using AI SDK.
- Introduced WebSocketManager for managing WebSocket connections and messaging.
- Updated VoiceAgent to support new architecture and improved socket handling.
- Refactored index files to export new core components.
This commit is contained in:
Bijit Mondal
2026-02-23 16:15:49 +05:30
parent 4dd30b89c0
commit 5e7eb469ae
71 changed files with 5175 additions and 19 deletions

46
dist/core/ConversationManager.d.ts vendored Normal file
View File

@@ -0,0 +1,46 @@
import { EventEmitter } from "events";
import { type ModelMessage } from "ai";
import { type HistoryConfig } from "../types";
export interface ConversationManagerOptions {
history?: Partial<HistoryConfig>;
}
/**
* Manages conversation history (ModelMessage[]) with configurable
* limits on message count and total character size.
*/
export declare class ConversationManager extends EventEmitter {
private conversationHistory;
private historyConfig;
constructor(options?: ConversationManagerOptions);
/**
* Add a message to history and trim if needed.
*/
addMessage(message: ModelMessage): void;
/**
* Get a copy of the current history.
*/
getHistory(): ModelMessage[];
/**
* Get a direct reference to the history array.
* Use with caution — prefer getHistory() for safety.
*/
getHistoryRef(): ModelMessage[];
/**
* Replace the entire conversation history.
*/
setHistory(history: ModelMessage[]): void;
/**
* Clear all conversation history.
*/
clearHistory(): void;
/**
* Get the number of messages in history.
*/
get length(): number;
/**
* Trim conversation history to stay within configured limits.
* Removes oldest messages (always in pairs to preserve user/assistant turns).
*/
private trimHistory;
}
//# sourceMappingURL=ConversationManager.d.ts.map