agentgui 1.0.264 → 1.0.265

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/static/js/voice.js +22 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentgui",
3
- "version": "1.0.264",
3
+ "version": "1.0.265",
4
4
  "description": "Multi-agent ACP client with real-time communication",
5
5
  "type": "module",
6
6
  "main": "server.js",
@@ -672,7 +672,11 @@
672
672
  }
673
673
  });
674
674
  window.addEventListener('conversation-selected', function(e) {
675
- currentConversationId = e.detail.conversationId;
675
+ var newConversationId = e.detail.conversationId;
676
+ if (currentConversationId && currentConversationId !== newConversationId) {
677
+ unsubscribeFromConversation();
678
+ }
679
+ currentConversationId = newConversationId;
676
680
  stopSpeaking();
677
681
  spokenChunks = new Set();
678
682
  renderedSeqs = new Set();
@@ -715,9 +719,11 @@
715
719
  _voiceBreakNext = false;
716
720
  if (!conversationId) {
717
721
  showVoiceEmpty(container);
722
+ unsubscribeFromConversation();
718
723
  return;
719
724
  }
720
725
  isLoadingHistory = true;
726
+ subscribeToConversation(conversationId);
721
727
  fetch(BASE + '/api/conversations/' + conversationId + '/chunks')
722
728
  .then(function(res) { return res.json(); })
723
729
  .then(function(data) {
@@ -751,6 +757,20 @@
751
757
  });
752
758
  }
753
759
 
760
+ function subscribeToConversation(conversationId) {
761
+ if (!conversationId || typeof agentGUIClient === 'undefined' || !agentGUIClient || !agentGUIClient.wsManager) {
762
+ return;
763
+ }
764
+ agentGUIClient.wsManager.sendMessage({ type: 'subscribe', conversationId: conversationId, timestamp: Date.now() });
765
+ }
766
+
767
+ function unsubscribeFromConversation() {
768
+ if (typeof agentGUIClient === 'undefined' || !agentGUIClient || !agentGUIClient.wsManager || !currentConversationId) {
769
+ return;
770
+ }
771
+ agentGUIClient.wsManager.sendMessage({ type: 'unsubscribe', conversationId: currentConversationId, timestamp: Date.now() });
772
+ }
773
+
754
774
  function showVoiceEmpty(container) {
755
775
  container.innerHTML = '<div class="voice-empty"><div class="voice-empty-icon"><svg viewBox="0 0 24 24" width="64" height="64" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"/><path d="M19 10v2a7 7 0 0 1-14 0v-2"/><line x1="12" y1="19" x2="12" y2="23"/><line x1="8" y1="23" x2="16" y2="23"/></svg></div><div>Hold the microphone button to record.<br>Release to transcribe. Tap Send to submit.<br>New responses will be read aloud.</div></div>';
756
776
  }
@@ -770,6 +790,7 @@
770
790
  function deactivate() {
771
791
  voiceActive = false;
772
792
  stopSpeaking();
793
+ unsubscribeFromConversation();
773
794
  }
774
795
 
775
796
  function escapeHtml(text) {