refactor: reset message IDs on new turn and add activity log handlers

- Reset assistant message and thought IDs when starting new agent turn
- Add comprehensive activity log handlers in session context
- Handle tool calls, results, and errors with proper state updates
- Add transcription and assistant chunk streaming handlers
- Improve audio playback with proper error handling and confirmation
- Use generateMessageId() for consistent ID generation
- Filter out transcription activity logs from chat
- Stop audio playback when real speech is detected
```
This commit is contained in:
Mohamed Boudra
2025-10-23 12:22:42 +02:00
parent 41be2d4096
commit 91d691f31d
3 changed files with 202 additions and 38 deletions
@@ -268,6 +268,10 @@ export class AgentManager {
throw new Error(`Agent ${agentId} is ${agent.status}`);
}
// Reset message IDs for new turn - ensures each prompt gets fresh responses
agent.currentAssistantMessageId = null;
agent.currentThoughtId = null;
// Set session mode if specified
if (options?.sessionMode) {
await this.setSessionMode(agentId, options.sessionMode);