@hivegpt/hiveai-angular 0.0.460 → 0.0.461

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.
@@ -1756,32 +1756,36 @@
1756
1756
  .subscribe(function (stream) {
1757
1757
  _this.audioAnalyzer.start(stream);
1758
1758
  });
1759
- // Speaking state from Daily only (NOT from AudioAnalyzer).
1760
- // User speaking overrides bot talking: if user speaks while bot talks, state = listening.
1761
1759
  this.subscriptions.add(this.dailyClient.userSpeaking$.subscribe(function (s) { return _this.isUserSpeakingSubject.next(s); }));
1762
1760
  this.subscriptions.add(rxjs.combineLatest([
1763
1761
  this.dailyClient.speaking$,
1764
1762
  this.dailyClient.userSpeaking$,
1765
1763
  ]).subscribe(function (_a) {
1766
1764
  var _b = __read(_a, 2), bot = _b[0], user = _b[1];
1765
+ var current = _this.callStateSubject.value;
1766
+ if (current === 'connecting' && !bot) {
1767
+ return;
1768
+ }
1769
+ if (current === 'connecting' && bot) {
1770
+ console.log("[VoiceDebug] First bot audio arrived \u2014 transitioning to talking \u2014 " + new Date().toISOString());
1771
+ _this.callStartTime = Date.now();
1772
+ _this.startDurationTimer();
1773
+ _this.callStateSubject.next('talking');
1774
+ return;
1775
+ }
1767
1776
  if (user) {
1768
1777
  _this.callStateSubject.next('listening');
1769
1778
  }
1770
1779
  else if (bot) {
1771
- console.log("[VoiceDebug] Agent starts speaking (callState \u2192 talking) \u2014 " + new Date().toISOString());
1772
1780
  _this.callStateSubject.next('talking');
1773
1781
  }
1774
- else if (_this.callStateSubject.value === 'talking' ||
1775
- _this.callStateSubject.value === 'listening') {
1782
+ else if (current === 'talking' || current === 'listening') {
1776
1783
  _this.callStateSubject.next('connected');
1777
1784
  }
1778
1785
  }));
1779
1786
  this.subscriptions.add(this.dailyClient.micMuted$.subscribe(function (muted) { return _this.isMicMutedSubject.next(muted); }));
1780
- console.log("[VoiceDebug] Room fully connected (callState \u2192 connected) \u2014 " + new Date().toISOString());
1781
- this.callStateSubject.next('connected');
1782
- this.statusTextSubject.next('Connected');
1783
- this.callStartTime = Date.now();
1784
- this.startDurationTimer();
1787
+ console.log("[VoiceDebug] Room joined, staying in connecting until bot speaks \u2014 " + new Date().toISOString());
1788
+ this.statusTextSubject.next('Connecting...');
1785
1789
  return [2 /*return*/];
1786
1790
  }
1787
1791
  });