@hivegpt/hiveai-angular 0.0.478 → 0.0.479

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.
@@ -1584,15 +1584,17 @@
1584
1584
  { type: i0.NgZone }
1585
1585
  ]; };
1586
1586
 
1587
+ /** Static Daily.co room URL (used instead of dynamic room_created from backend). */
1588
+ var STATIC_DAILY_ROOM_URL = 'https://cloud-4a46e9dfbc8c499daddd480d9c294b88.daily.co/voice-None-1772776583';
1587
1589
  /**
1588
1590
  * Voice agent orchestrator. Coordinates WebSocket (signaling) and Daily.js (WebRTC audio).
1589
1591
  *
1590
1592
  * CRITICAL: This service must NEVER use Socket.IO or ngx-socket-io. Voice flow uses only:
1591
- * - Native WebSocket (WebSocketVoiceClientService) for signaling (room_created, transcripts)
1592
- * - Daily.js (DailyVoiceClientService) for WebRTC audio. Audio does NOT flow over WebSocket.
1593
+ * - Native WebSocket (WebSocketVoiceClientService) for signaling (transcripts)
1594
+ * - Daily.js (DailyVoiceClientService) for WebRTC audio via STATIC_DAILY_ROOM_URL.
1593
1595
  *
1594
1596
  * - Maintains callState, statusText, duration, isMicMuted, isUserSpeaking, audioLevels
1595
- * - Uses WebSocket for room_created and transcripts only (no audio)
1597
+ * - Uses WebSocket for transcripts only (no audio)
1596
1598
  * - Uses Daily.js for all audio, mic, and real-time speaking detection
1597
1599
  */
1598
1600
  var VoiceAgentService = /** @class */ (function () {
@@ -1644,7 +1646,7 @@
1644
1646
  };
1645
1647
  VoiceAgentService.prototype.connect = function (apiUrl, token, botId, conversationId, apiKey, eventToken, eventUrl, domainAuthority) {
1646
1648
  return __awaiter(this, void 0, void 0, function () {
1647
- var baseUrl, postUrl, headers, res, json, wsUrl, error_1;
1649
+ var baseUrl, postUrl, headers, res, json, wsUrl, err_1, error_1;
1648
1650
  var _this = this;
1649
1651
  return __generator(this, function (_a) {
1650
1652
  switch (_a.label) {
@@ -1655,7 +1657,7 @@
1655
1657
  }
1656
1658
  _a.label = 1;
1657
1659
  case 1:
1658
- _a.trys.push([1, 4, , 6]);
1660
+ _a.trys.push([1, 9, , 11]);
1659
1661
  this.callStateSubject.next('connecting');
1660
1662
  this.statusTextSubject.next('Connecting...');
1661
1663
  baseUrl = apiUrl.replace(/\/$/, '');
@@ -1691,32 +1693,6 @@
1691
1693
  if (!wsUrl || typeof wsUrl !== 'string') {
1692
1694
  throw new Error('No ws_url in response');
1693
1695
  }
1694
- // Subscribe to room_created BEFORE connecting to avoid race
1695
- this.wsClient.roomCreated$
1696
- .pipe(operators.take(1), operators.takeUntil(this.destroy$))
1697
- .subscribe(function (roomUrl) { return __awaiter(_this, void 0, void 0, function () {
1698
- var err_1;
1699
- return __generator(this, function (_a) {
1700
- switch (_a.label) {
1701
- case 0:
1702
- _a.trys.push([0, 2, , 4]);
1703
- return [4 /*yield*/, this.onRoomCreated(roomUrl)];
1704
- case 1:
1705
- _a.sent();
1706
- return [3 /*break*/, 4];
1707
- case 2:
1708
- err_1 = _a.sent();
1709
- console.error('Daily join failed:', err_1);
1710
- this.callStateSubject.next('ended');
1711
- this.statusTextSubject.next('Connection failed');
1712
- return [4 /*yield*/, this.disconnect()];
1713
- case 3:
1714
- _a.sent();
1715
- throw err_1;
1716
- case 4: return [2 /*return*/];
1717
- }
1718
- });
1719
- }); });
1720
1696
  // Forward transcripts from WebSocket
1721
1697
  this.subscriptions.add(this.wsClient.userTranscript$
1722
1698
  .pipe(operators.takeUntil(this.destroy$))
@@ -1726,17 +1702,33 @@
1726
1702
  .subscribe(function (t) { return _this.botTranscriptSubject.next(t); }));
1727
1703
  // Connect signaling WebSocket (no audio over WS)
1728
1704
  this.wsClient.connect(wsUrl);
1729
- return [3 /*break*/, 6];
1705
+ _a.label = 4;
1730
1706
  case 4:
1707
+ _a.trys.push([4, 6, , 8]);
1708
+ return [4 /*yield*/, this.onRoomCreated(STATIC_DAILY_ROOM_URL)];
1709
+ case 5:
1710
+ _a.sent();
1711
+ return [3 /*break*/, 8];
1712
+ case 6:
1713
+ err_1 = _a.sent();
1714
+ console.error('Daily join failed:', err_1);
1715
+ this.callStateSubject.next('ended');
1716
+ this.statusTextSubject.next('Connection failed');
1717
+ return [4 /*yield*/, this.disconnect()];
1718
+ case 7:
1719
+ _a.sent();
1720
+ throw err_1;
1721
+ case 8: return [3 /*break*/, 11];
1722
+ case 9:
1731
1723
  error_1 = _a.sent();
1732
1724
  console.error('Error connecting voice agent:', error_1);
1733
1725
  this.callStateSubject.next('ended');
1734
1726
  return [4 /*yield*/, this.disconnect()];
1735
- case 5:
1727
+ case 10:
1736
1728
  _a.sent();
1737
1729
  this.statusTextSubject.next('Connection failed');
1738
1730
  throw error_1;
1739
- case 6: return [2 /*return*/];
1731
+ case 11: return [2 /*return*/];
1740
1732
  }
1741
1733
  });
1742
1734
  });