agentgui 1.0.185 → 1.0.186

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentgui",
3
- "version": "1.0.185",
3
+ "version": "1.0.186",
4
4
  "description": "Multi-agent ACP client with real-time communication",
5
5
  "type": "module",
6
6
  "main": "server.js",
package/server.js CHANGED
@@ -1172,10 +1172,18 @@ wss.on('connection', (ws, req) => {
1172
1172
  timestamp: Date.now()
1173
1173
  }));
1174
1174
  } else if (data.type === 'unsubscribe') {
1175
- ws.subscriptions.delete(data.sessionId);
1176
- const idx = subscriptionIndex.get(data.sessionId);
1177
- if (idx) { idx.delete(ws); if (idx.size === 0) subscriptionIndex.delete(data.sessionId); }
1178
- debugLog(`[WebSocket] Client ${ws.clientId} unsubscribed from ${data.sessionId}`);
1175
+ if (data.sessionId) {
1176
+ ws.subscriptions.delete(data.sessionId);
1177
+ const idx = subscriptionIndex.get(data.sessionId);
1178
+ if (idx) { idx.delete(ws); if (idx.size === 0) subscriptionIndex.delete(data.sessionId); }
1179
+ }
1180
+ if (data.conversationId) {
1181
+ const key = `conv-${data.conversationId}`;
1182
+ ws.subscriptions.delete(key);
1183
+ const idx = subscriptionIndex.get(key);
1184
+ if (idx) { idx.delete(ws); if (idx.size === 0) subscriptionIndex.delete(key); }
1185
+ }
1186
+ debugLog(`[WebSocket] Client ${ws.clientId} unsubscribed from ${data.sessionId || data.conversationId}`);
1179
1187
  } else if (data.type === 'get_subscriptions') {
1180
1188
  ws.send(JSON.stringify({
1181
1189
  type: 'subscriptions',
@@ -1335,7 +1335,11 @@ class AgentGUIClient {
1335
1335
  try {
1336
1336
  this.cacheCurrentConversation();
1337
1337
  this.stopChunkPolling();
1338
- if (this.state.currentConversation?.id !== conversationId) {
1338
+ var prevId = this.state.currentConversation?.id;
1339
+ if (prevId && prevId !== conversationId) {
1340
+ if (this.wsManager.isConnected && !this.state.streamingConversations.has(prevId)) {
1341
+ this.wsManager.sendMessage({ type: 'unsubscribe', conversationId: prevId });
1342
+ }
1339
1343
  this.state.currentSession = null;
1340
1344
  }
1341
1345
 
@@ -585,9 +585,11 @@
585
585
  }
586
586
  if (!voiceActive) return;
587
587
  if (data.type === 'streaming_progress' && data.block) {
588
+ if (data.conversationId && data.conversationId !== currentConversationId) return;
588
589
  handleVoiceBlock(data.block, true);
589
590
  }
590
591
  if (data.type === 'streaming_start') {
592
+ if (data.conversationId && data.conversationId !== currentConversationId) return;
591
593
  spokenChunks = new Set();
592
594
  }
593
595
  });