@hivegpt/hiveai-angular 0.0.427 → 0.0.428

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.
@@ -1155,11 +1155,13 @@
1155
1155
 
1156
1156
  /**
1157
1157
  * WebSocket-only client for voice agent signaling.
1158
+ * CRITICAL: Uses native WebSocket only. NO Socket.IO, NO ngx-socket-io.
1159
+ *
1158
1160
  * Responsibilities:
1159
- * - Connect to ws_url
1160
- * - Parse JSON messages
1161
+ * - Connect to ws_url (from POST /ai/ask-voice response)
1162
+ * - Parse JSON messages (room_created, user_transcript, bot_transcript)
1161
1163
  * - Emit roomCreated$, userTranscript$, botTranscript$
1162
- * - NO audio logic, NO mic logic.
1164
+ * - NO audio logic, NO mic logic. Audio is handled by Daily.js (WebRTC).
1163
1165
  */
1164
1166
  var WebSocketVoiceClientService = /** @class */ (function () {
1165
1167
  function WebSocketVoiceClientService() {
@@ -1453,6 +1455,11 @@
1453
1455
 
1454
1456
  /**
1455
1457
  * Voice agent orchestrator. Coordinates WebSocket (signaling) and Daily.js (WebRTC audio).
1458
+ *
1459
+ * CRITICAL: This service must NEVER use Socket.IO or ngx-socket-io. Voice flow uses only:
1460
+ * - Native WebSocket (WebSocketVoiceClientService) for signaling (room_created, transcripts)
1461
+ * - Daily.js (DailyVoiceClientService) for WebRTC audio. Audio does NOT flow over WebSocket.
1462
+ *
1456
1463
  * - Maintains callState, statusText, duration, isMicMuted, isUserSpeaking, audioLevels
1457
1464
  * - Uses WebSocket for room_created and transcripts only (no audio)
1458
1465
  * - Uses Daily.js for all audio, mic, and real-time speaking detection
@@ -1964,6 +1971,8 @@
1964
1971
  this.voiceModalOverlayRef = null;
1965
1972
  this.voiceTranscriptSubscriptions = [];
1966
1973
  this.domainAuthorityValue = 'prod-lite';
1974
+ /** True after Socket has been initialized for chat (avoids connecting on voice-only usage). */
1975
+ this.chatSocketInitialized = false;
1967
1976
  this.isChatingWithAi = false;
1968
1977
  this.readAllChunks = function (stream) {
1969
1978
  var reader = stream.getReader();
@@ -2054,11 +2063,11 @@
2054
2063
  }
2055
2064
  }
2056
2065
  }
2057
- if (changes.orgId) {
2058
- if (changes.orgId.currentValue != changes.orgId.previousValue &&
2059
- changes.orgId.currentValue) {
2060
- this.initializeSocket();
2061
- }
2066
+ // Do NOT call initializeSocket() here. Socket.IO is for chat only; we defer
2067
+ // until the user actually uses chat (send message or start new conversation)
2068
+ // so that voice-only usage never triggers Socket.IO (avoids v2/v3 mismatch error).
2069
+ if (changes.orgId && changes.orgId.currentValue != changes.orgId.previousValue) {
2070
+ this.chatSocketInitialized = false;
2062
2071
  }
2063
2072
  };
2064
2073
  ChatDrawerComponent.prototype.ngOnInit = function () {
@@ -2105,6 +2114,16 @@
2105
2114
  _this.initializeSpeechRecognizer(token);
2106
2115
  });
2107
2116
  };
2117
+ /**
2118
+ * Call before chat actions so Socket.IO is used only for chat, not for voice.
2119
+ * Voice agent uses native WebSocket + Daily.js only; Socket.IO must not run during voice flow.
2120
+ */
2121
+ ChatDrawerComponent.prototype.ensureChatSocket = function () {
2122
+ if (this.chatSocketInitialized || !this.orgId)
2123
+ return;
2124
+ this.chatSocketInitialized = true;
2125
+ this.initializeSocket();
2126
+ };
2108
2127
  ChatDrawerComponent.prototype.initializeSocket = function () {
2109
2128
  var _this = this;
2110
2129
  try {
@@ -2483,6 +2502,7 @@
2483
2502
  if (!this.input || this.loading) {
2484
2503
  return;
2485
2504
  }
2505
+ this.ensureChatSocket();
2486
2506
  this.chatLog.push({
2487
2507
  type: 'user',
2488
2508
  message: this.processMessageForDisplay(this.input),
@@ -2506,6 +2526,7 @@
2506
2526
  if (!inputMsg || this.loading) {
2507
2527
  return;
2508
2528
  }
2529
+ this.ensureChatSocket();
2509
2530
  try {
2510
2531
  chat.relatedListItems = [];
2511
2532
  this.cdr.detectChanges();
@@ -3565,8 +3586,9 @@
3565
3586
  this.conversationKey = this.conversationService.getKey(this.botId, true);
3566
3587
  this.chatLog = [this.chatLog[0]];
3567
3588
  this.isChatingWithAi = false;
3589
+ this.chatSocketInitialized = false;
3568
3590
  setTimeout(function () {
3569
- _this.initializeSocket();
3591
+ _this.ensureChatSocket();
3570
3592
  }, 200);
3571
3593
  this.scrollToBottom();
3572
3594
  this.cdr.detectChanges();
@@ -3869,6 +3891,10 @@
3869
3891
  isDev: [{ type: i0.Input }]
3870
3892
  };
3871
3893
 
3894
+ /**
3895
+ * Voice agent module. Uses native WebSocket + Daily.js only.
3896
+ * Does NOT use Socket.IO or ngx-socket-io.
3897
+ */
3872
3898
  var VoiceAgentModule = /** @class */ (function () {
3873
3899
  function VoiceAgentModule() {
3874
3900
  }