@hivegpt/hiveai-angular 0.0.478 → 0.0.480
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/bundles/hivegpt-hiveai-angular.umd.js +35 -92
- package/bundles/hivegpt-hiveai-angular.umd.js.map +1 -1
- package/bundles/hivegpt-hiveai-angular.umd.min.js +1 -1
- package/bundles/hivegpt-hiveai-angular.umd.min.js.map +1 -1
- package/esm2015/lib/components/chat-drawer/chat-drawer.component.js +3 -1
- package/esm2015/lib/components/voice-agent/components/voice-agent-modal/voice-agent-modal.component.js +9 -5
- package/esm2015/lib/components/voice-agent/services/voice-agent.service.js +21 -72
- package/fesm2015/hivegpt-hiveai-angular.js +30 -75
- package/fesm2015/hivegpt-hiveai-angular.js.map +1 -1
- package/hivegpt-hiveai-angular.metadata.json +1 -1
- package/lib/components/chat-drawer/chat-drawer.component.d.ts.map +1 -1
- package/lib/components/voice-agent/components/voice-agent-modal/voice-agent-modal.component.d.ts.map +1 -1
- package/lib/components/voice-agent/services/voice-agent.service.d.ts +8 -9
- package/lib/components/voice-agent/services/voice-agent.service.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1584,16 +1584,14 @@
|
|
|
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
|
-
* Voice agent orchestrator.
|
|
1590
|
+
* Voice agent orchestrator. Connects directly to a hardcoded Daily.co room — no API or WebSocket.
|
|
1589
1591
|
*
|
|
1590
|
-
*
|
|
1591
|
-
* -
|
|
1592
|
-
* -
|
|
1593
|
-
*
|
|
1594
|
-
* - Maintains callState, statusText, duration, isMicMuted, isUserSpeaking, audioLevels
|
|
1595
|
-
* - Uses WebSocket for room_created and transcripts only (no audio)
|
|
1596
|
-
* - Uses Daily.js for all audio, mic, and real-time speaking detection
|
|
1592
|
+
* - When the modal opens, connect() is called and joins STATIC_DAILY_ROOM_URL immediately.
|
|
1593
|
+
* - Daily.js (DailyVoiceClientService) handles all WebRTC audio, mic, and speaking detection.
|
|
1594
|
+
* - Maintains callState, statusText, duration, isMicMuted, isUserSpeaking, audioLevels.
|
|
1597
1595
|
*/
|
|
1598
1596
|
var VoiceAgentService = /** @class */ (function () {
|
|
1599
1597
|
function VoiceAgentService(audioAnalyzer, wsClient, dailyClient) {
|
|
@@ -1624,6 +1622,10 @@
|
|
|
1624
1622
|
// Waveform visualization only - do NOT use for speaking state
|
|
1625
1623
|
this.subscriptions.add(this.audioAnalyzer.audioLevels$.subscribe(function (levels) { return _this.audioLevelsSubject.next(levels); }));
|
|
1626
1624
|
}
|
|
1625
|
+
/** Current call state (for checking if connection was already started). */
|
|
1626
|
+
VoiceAgentService.prototype.getCallState = function () {
|
|
1627
|
+
return this.callStateSubject.value;
|
|
1628
|
+
};
|
|
1627
1629
|
VoiceAgentService.prototype.ngOnDestroy = function () {
|
|
1628
1630
|
this.destroy$.next();
|
|
1629
1631
|
this.subscriptions.unsubscribe();
|
|
@@ -1642,10 +1644,10 @@
|
|
|
1642
1644
|
this.statusTextSubject.next('');
|
|
1643
1645
|
this.durationSubject.next('0:00');
|
|
1644
1646
|
};
|
|
1645
|
-
|
|
1647
|
+
/** Connect directly to the hardcoded Daily room. No API or WebSocket — as soon as modal opens. */
|
|
1648
|
+
VoiceAgentService.prototype.connect = function () {
|
|
1646
1649
|
return __awaiter(this, void 0, void 0, function () {
|
|
1647
|
-
var
|
|
1648
|
-
var _this = this;
|
|
1650
|
+
var err_1;
|
|
1649
1651
|
return __generator(this, function (_a) {
|
|
1650
1652
|
switch (_a.label) {
|
|
1651
1653
|
case 0:
|
|
@@ -1653,90 +1655,25 @@
|
|
|
1653
1655
|
console.warn('Call already in progress');
|
|
1654
1656
|
return [2 /*return*/];
|
|
1655
1657
|
}
|
|
1656
|
-
_a.label = 1;
|
|
1657
|
-
case 1:
|
|
1658
|
-
_a.trys.push([1, 4, , 6]);
|
|
1659
1658
|
this.callStateSubject.next('connecting');
|
|
1660
1659
|
this.statusTextSubject.next('Connecting...');
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
Authorization: "Bearer " + token,
|
|
1666
|
-
'domain-authority': domainAuthority,
|
|
1667
|
-
'eventtoken': eventToken,
|
|
1668
|
-
'eventurl': eventUrl,
|
|
1669
|
-
'hive-bot-id': botId,
|
|
1670
|
-
'x-api-key': apiKey,
|
|
1671
|
-
"ngrok-skip-browser-warning": "true"
|
|
1672
|
-
};
|
|
1673
|
-
return [4 /*yield*/, fetch(postUrl, {
|
|
1674
|
-
method: 'POST',
|
|
1675
|
-
headers: headers,
|
|
1676
|
-
body: JSON.stringify({
|
|
1677
|
-
bot_id: botId,
|
|
1678
|
-
conversation_id: conversationId,
|
|
1679
|
-
voice: 'alloy',
|
|
1680
|
-
}),
|
|
1681
|
-
})];
|
|
1660
|
+
_a.label = 1;
|
|
1661
|
+
case 1:
|
|
1662
|
+
_a.trys.push([1, 3, , 5]);
|
|
1663
|
+
return [4 /*yield*/, this.onRoomCreated(STATIC_DAILY_ROOM_URL)];
|
|
1682
1664
|
case 2:
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
throw new Error("HTTP " + res.status);
|
|
1686
|
-
}
|
|
1687
|
-
return [4 /*yield*/, res.json()];
|
|
1665
|
+
_a.sent();
|
|
1666
|
+
return [3 /*break*/, 5];
|
|
1688
1667
|
case 3:
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
if (!wsUrl || typeof wsUrl !== 'string') {
|
|
1692
|
-
throw new Error('No ws_url in response');
|
|
1693
|
-
}
|
|
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
|
-
// Forward transcripts from WebSocket
|
|
1721
|
-
this.subscriptions.add(this.wsClient.userTranscript$
|
|
1722
|
-
.pipe(operators.takeUntil(this.destroy$))
|
|
1723
|
-
.subscribe(function (t) { return _this.userTranscriptSubject.next(t); }));
|
|
1724
|
-
this.subscriptions.add(this.wsClient.botTranscript$
|
|
1725
|
-
.pipe(operators.takeUntil(this.destroy$))
|
|
1726
|
-
.subscribe(function (t) { return _this.botTranscriptSubject.next(t); }));
|
|
1727
|
-
// Connect signaling WebSocket (no audio over WS)
|
|
1728
|
-
this.wsClient.connect(wsUrl);
|
|
1729
|
-
return [3 /*break*/, 6];
|
|
1730
|
-
case 4:
|
|
1731
|
-
error_1 = _a.sent();
|
|
1732
|
-
console.error('Error connecting voice agent:', error_1);
|
|
1668
|
+
err_1 = _a.sent();
|
|
1669
|
+
console.error('Daily join failed:', err_1);
|
|
1733
1670
|
this.callStateSubject.next('ended');
|
|
1671
|
+
this.statusTextSubject.next('Connection failed');
|
|
1734
1672
|
return [4 /*yield*/, this.disconnect()];
|
|
1735
|
-
case
|
|
1673
|
+
case 4:
|
|
1736
1674
|
_a.sent();
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
case 6: return [2 /*return*/];
|
|
1675
|
+
throw err_1;
|
|
1676
|
+
case 5: return [2 /*return*/];
|
|
1740
1677
|
}
|
|
1741
1678
|
});
|
|
1742
1679
|
});
|
|
@@ -1926,9 +1863,13 @@
|
|
|
1926
1863
|
this.subscriptions.push(this.voiceAgentService.audioLevels$.subscribe(function (levels) {
|
|
1927
1864
|
_this.audioLevels = levels;
|
|
1928
1865
|
}));
|
|
1929
|
-
//
|
|
1930
|
-
this.voiceAgentService.
|
|
1931
|
-
|
|
1866
|
+
// If connection was already started from the drawer (openVoiceModal), don't reset or start again.
|
|
1867
|
+
var state = this.voiceAgentService.getCallState();
|
|
1868
|
+
var alreadyStarted = state !== 'idle' && state !== 'ended';
|
|
1869
|
+
if (!alreadyStarted) {
|
|
1870
|
+
this.voiceAgentService.resetToIdle();
|
|
1871
|
+
void this.startCall();
|
|
1872
|
+
}
|
|
1932
1873
|
};
|
|
1933
1874
|
VoiceAgentModalComponent.prototype.ngOnDestroy = function () {
|
|
1934
1875
|
this.subscriptions.forEach(function (sub) { return sub.unsubscribe(); });
|
|
@@ -1946,7 +1887,7 @@
|
|
|
1946
1887
|
_g.label = 1;
|
|
1947
1888
|
case 1:
|
|
1948
1889
|
_g.trys.push([1, 3, 4, 5]);
|
|
1949
|
-
return [4 /*yield*/, this.voiceAgentService.connect(
|
|
1890
|
+
return [4 /*yield*/, this.voiceAgentService.connect()];
|
|
1950
1891
|
case 2:
|
|
1951
1892
|
_g.sent();
|
|
1952
1893
|
return [3 /*break*/, 5];
|
|
@@ -4303,6 +4244,8 @@
|
|
|
4303
4244
|
var conversationId = (_b = (_a = this.conversationKey) !== null && _a !== void 0 ? _a : this.conversationService.getKey(this.botId, false)) !== null && _b !== void 0 ? _b : '';
|
|
4304
4245
|
this.voiceModalConversationId = conversationId;
|
|
4305
4246
|
this.setupVoiceTranscripts();
|
|
4247
|
+
// Start connecting to the voice room immediately (no wait for modal to open)
|
|
4248
|
+
void this.voiceAgentService.connect();
|
|
4306
4249
|
// Close existing overlay if any
|
|
4307
4250
|
if (this.voiceModalOverlayRef) {
|
|
4308
4251
|
this.voiceModalOverlayRef.detach();
|