@hivegpt/hiveai-angular 0.0.427 → 0.0.429
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 +58 -33
- 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 +22 -7
- package/esm2015/lib/components/voice-agent/services/voice-agent.service.js +8 -3
- package/esm2015/lib/components/voice-agent/services/websocket-voice-client.service.js +6 -4
- package/esm2015/lib/components/voice-agent/voice-agent.module.js +5 -1
- package/fesm2015/hivegpt-hiveai-angular.js +37 -11
- 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 +7 -0
- package/lib/components/chat-drawer/chat-drawer.component.d.ts.map +1 -1
- package/lib/components/voice-agent/services/voice-agent.service.d.ts +5 -0
- package/lib/components/voice-agent/services/voice-agent.service.d.ts.map +1 -1
- package/lib/components/voice-agent/services/websocket-voice-client.service.d.ts +5 -3
- package/lib/components/voice-agent/services/websocket-voice-client.service.d.ts.map +1 -1
- package/lib/components/voice-agent/voice-agent.module.d.ts +4 -0
- package/lib/components/voice-agent/voice-agent.module.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -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
|
|
@@ -1505,20 +1512,19 @@
|
|
|
1505
1512
|
this.durationSubject.next('0:00');
|
|
1506
1513
|
};
|
|
1507
1514
|
VoiceAgentService.prototype.connect = function (apiUrl, token, botId, conversationId, apiKey, eventToken, eventUrl, domainAuthority) {
|
|
1508
|
-
var _a;
|
|
1509
1515
|
return __awaiter(this, void 0, void 0, function () {
|
|
1510
1516
|
var baseUrl, postUrl, headers, res, json, wsUrl, error_1;
|
|
1511
1517
|
var _this = this;
|
|
1512
|
-
return __generator(this, function (
|
|
1513
|
-
switch (
|
|
1518
|
+
return __generator(this, function (_a) {
|
|
1519
|
+
switch (_a.label) {
|
|
1514
1520
|
case 0:
|
|
1515
1521
|
if (this.callStateSubject.value !== 'idle') {
|
|
1516
1522
|
console.warn('Call already in progress');
|
|
1517
1523
|
return [2 /*return*/];
|
|
1518
1524
|
}
|
|
1519
|
-
|
|
1525
|
+
_a.label = 1;
|
|
1520
1526
|
case 1:
|
|
1521
|
-
|
|
1527
|
+
_a.trys.push([1, 4, , 6]);
|
|
1522
1528
|
this.callStateSubject.next('connecting');
|
|
1523
1529
|
this.statusTextSubject.next('Connecting...');
|
|
1524
1530
|
baseUrl = apiUrl.replace(/\/$/, '');
|
|
@@ -1542,14 +1548,14 @@
|
|
|
1542
1548
|
}),
|
|
1543
1549
|
})];
|
|
1544
1550
|
case 2:
|
|
1545
|
-
res =
|
|
1551
|
+
res = _a.sent();
|
|
1546
1552
|
if (!res.ok) {
|
|
1547
1553
|
throw new Error("HTTP " + res.status);
|
|
1548
1554
|
}
|
|
1549
1555
|
return [4 /*yield*/, res.json()];
|
|
1550
1556
|
case 3:
|
|
1551
|
-
json =
|
|
1552
|
-
wsUrl =
|
|
1557
|
+
json = _a.sent();
|
|
1558
|
+
wsUrl = json === null || json === void 0 ? void 0 : json.rn_ws_url;
|
|
1553
1559
|
if (!wsUrl || typeof wsUrl !== 'string') {
|
|
1554
1560
|
throw new Error('No ws_url in response');
|
|
1555
1561
|
}
|
|
@@ -1558,22 +1564,22 @@
|
|
|
1558
1564
|
.pipe(operators.take(1), operators.takeUntil(this.destroy$))
|
|
1559
1565
|
.subscribe(function (roomUrl) { return __awaiter(_this, void 0, void 0, function () {
|
|
1560
1566
|
var err_1;
|
|
1561
|
-
return __generator(this, function (
|
|
1562
|
-
switch (
|
|
1567
|
+
return __generator(this, function (_a) {
|
|
1568
|
+
switch (_a.label) {
|
|
1563
1569
|
case 0:
|
|
1564
|
-
|
|
1570
|
+
_a.trys.push([0, 2, , 4]);
|
|
1565
1571
|
return [4 /*yield*/, this.onRoomCreated(roomUrl)];
|
|
1566
1572
|
case 1:
|
|
1567
|
-
|
|
1573
|
+
_a.sent();
|
|
1568
1574
|
return [3 /*break*/, 4];
|
|
1569
1575
|
case 2:
|
|
1570
|
-
err_1 =
|
|
1576
|
+
err_1 = _a.sent();
|
|
1571
1577
|
console.error('Daily join failed:', err_1);
|
|
1572
1578
|
this.callStateSubject.next('ended');
|
|
1573
1579
|
this.statusTextSubject.next('Connection failed');
|
|
1574
1580
|
return [4 /*yield*/, this.disconnect()];
|
|
1575
1581
|
case 3:
|
|
1576
|
-
|
|
1582
|
+
_a.sent();
|
|
1577
1583
|
throw err_1;
|
|
1578
1584
|
case 4: return [2 /*return*/];
|
|
1579
1585
|
}
|
|
@@ -1590,12 +1596,12 @@
|
|
|
1590
1596
|
this.wsClient.connect(wsUrl);
|
|
1591
1597
|
return [3 /*break*/, 6];
|
|
1592
1598
|
case 4:
|
|
1593
|
-
error_1 =
|
|
1599
|
+
error_1 = _a.sent();
|
|
1594
1600
|
console.error('Error connecting voice agent:', error_1);
|
|
1595
1601
|
this.callStateSubject.next('ended');
|
|
1596
1602
|
return [4 /*yield*/, this.disconnect()];
|
|
1597
1603
|
case 5:
|
|
1598
|
-
|
|
1604
|
+
_a.sent();
|
|
1599
1605
|
this.statusTextSubject.next('Connection failed');
|
|
1600
1606
|
throw error_1;
|
|
1601
1607
|
case 6: return [2 /*return*/];
|
|
@@ -1606,14 +1612,14 @@
|
|
|
1606
1612
|
VoiceAgentService.prototype.onRoomCreated = function (roomUrl) {
|
|
1607
1613
|
return __awaiter(this, void 0, void 0, function () {
|
|
1608
1614
|
var _this = this;
|
|
1609
|
-
return __generator(this, function (
|
|
1610
|
-
switch (
|
|
1615
|
+
return __generator(this, function (_a) {
|
|
1616
|
+
switch (_a.label) {
|
|
1611
1617
|
case 0:
|
|
1612
1618
|
// Connect Daily.js for WebRTC audio
|
|
1613
1619
|
return [4 /*yield*/, this.dailyClient.connect(roomUrl)];
|
|
1614
1620
|
case 1:
|
|
1615
1621
|
// Connect Daily.js for WebRTC audio
|
|
1616
|
-
|
|
1622
|
+
_a.sent();
|
|
1617
1623
|
// Waveform: use local mic stream from Daily client
|
|
1618
1624
|
this.dailyClient.localStream$
|
|
1619
1625
|
.pipe(operators.filter(function (s) { return s != null; }), operators.take(1))
|
|
@@ -1626,8 +1632,8 @@
|
|
|
1626
1632
|
this.subscriptions.add(rxjs.combineLatest([
|
|
1627
1633
|
this.dailyClient.speaking$,
|
|
1628
1634
|
this.dailyClient.userSpeaking$,
|
|
1629
|
-
]).subscribe(function (
|
|
1630
|
-
var
|
|
1635
|
+
]).subscribe(function (_a) {
|
|
1636
|
+
var _b = __read(_a, 2), bot = _b[0], user = _b[1];
|
|
1631
1637
|
if (user) {
|
|
1632
1638
|
_this.callStateSubject.next('listening');
|
|
1633
1639
|
}
|
|
@@ -1651,8 +1657,8 @@
|
|
|
1651
1657
|
};
|
|
1652
1658
|
VoiceAgentService.prototype.disconnect = function () {
|
|
1653
1659
|
return __awaiter(this, void 0, void 0, function () {
|
|
1654
|
-
return __generator(this, function (
|
|
1655
|
-
switch (
|
|
1660
|
+
return __generator(this, function (_a) {
|
|
1661
|
+
switch (_a.label) {
|
|
1656
1662
|
case 0:
|
|
1657
1663
|
this.stopDurationTimer();
|
|
1658
1664
|
this.audioAnalyzer.stop();
|
|
@@ -1660,7 +1666,7 @@
|
|
|
1660
1666
|
return [4 /*yield*/, this.dailyClient.disconnect()];
|
|
1661
1667
|
case 1:
|
|
1662
1668
|
// Daily first, then WebSocket
|
|
1663
|
-
|
|
1669
|
+
_a.sent();
|
|
1664
1670
|
this.wsClient.disconnect();
|
|
1665
1671
|
this.callStateSubject.next('ended');
|
|
1666
1672
|
this.statusTextSubject.next('Call Ended');
|
|
@@ -1964,6 +1970,8 @@
|
|
|
1964
1970
|
this.voiceModalOverlayRef = null;
|
|
1965
1971
|
this.voiceTranscriptSubscriptions = [];
|
|
1966
1972
|
this.domainAuthorityValue = 'prod-lite';
|
|
1973
|
+
/** True after Socket has been initialized for chat (avoids connecting on voice-only usage). */
|
|
1974
|
+
this.chatSocketInitialized = false;
|
|
1967
1975
|
this.isChatingWithAi = false;
|
|
1968
1976
|
this.readAllChunks = function (stream) {
|
|
1969
1977
|
var reader = stream.getReader();
|
|
@@ -2054,11 +2062,11 @@
|
|
|
2054
2062
|
}
|
|
2055
2063
|
}
|
|
2056
2064
|
}
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2065
|
+
// Do NOT call initializeSocket() here. Socket.IO is for chat only; we defer
|
|
2066
|
+
// until the user actually uses chat (send message or start new conversation)
|
|
2067
|
+
// so that voice-only usage never triggers Socket.IO (avoids v2/v3 mismatch error).
|
|
2068
|
+
if (changes.orgId && changes.orgId.currentValue != changes.orgId.previousValue) {
|
|
2069
|
+
this.chatSocketInitialized = false;
|
|
2062
2070
|
}
|
|
2063
2071
|
};
|
|
2064
2072
|
ChatDrawerComponent.prototype.ngOnInit = function () {
|
|
@@ -2105,6 +2113,16 @@
|
|
|
2105
2113
|
_this.initializeSpeechRecognizer(token);
|
|
2106
2114
|
});
|
|
2107
2115
|
};
|
|
2116
|
+
/**
|
|
2117
|
+
* Call before chat actions so Socket.IO is used only for chat, not for voice.
|
|
2118
|
+
* Voice agent uses native WebSocket + Daily.js only; Socket.IO must not run during voice flow.
|
|
2119
|
+
*/
|
|
2120
|
+
ChatDrawerComponent.prototype.ensureChatSocket = function () {
|
|
2121
|
+
if (this.chatSocketInitialized || !this.orgId)
|
|
2122
|
+
return;
|
|
2123
|
+
this.chatSocketInitialized = true;
|
|
2124
|
+
this.initializeSocket();
|
|
2125
|
+
};
|
|
2108
2126
|
ChatDrawerComponent.prototype.initializeSocket = function () {
|
|
2109
2127
|
var _this = this;
|
|
2110
2128
|
try {
|
|
@@ -2483,6 +2501,7 @@
|
|
|
2483
2501
|
if (!this.input || this.loading) {
|
|
2484
2502
|
return;
|
|
2485
2503
|
}
|
|
2504
|
+
this.ensureChatSocket();
|
|
2486
2505
|
this.chatLog.push({
|
|
2487
2506
|
type: 'user',
|
|
2488
2507
|
message: this.processMessageForDisplay(this.input),
|
|
@@ -2506,6 +2525,7 @@
|
|
|
2506
2525
|
if (!inputMsg || this.loading) {
|
|
2507
2526
|
return;
|
|
2508
2527
|
}
|
|
2528
|
+
this.ensureChatSocket();
|
|
2509
2529
|
try {
|
|
2510
2530
|
chat.relatedListItems = [];
|
|
2511
2531
|
this.cdr.detectChanges();
|
|
@@ -3565,8 +3585,9 @@
|
|
|
3565
3585
|
this.conversationKey = this.conversationService.getKey(this.botId, true);
|
|
3566
3586
|
this.chatLog = [this.chatLog[0]];
|
|
3567
3587
|
this.isChatingWithAi = false;
|
|
3588
|
+
this.chatSocketInitialized = false;
|
|
3568
3589
|
setTimeout(function () {
|
|
3569
|
-
_this.
|
|
3590
|
+
_this.ensureChatSocket();
|
|
3570
3591
|
}, 200);
|
|
3571
3592
|
this.scrollToBottom();
|
|
3572
3593
|
this.cdr.detectChanges();
|
|
@@ -3869,6 +3890,10 @@
|
|
|
3869
3890
|
isDev: [{ type: i0.Input }]
|
|
3870
3891
|
};
|
|
3871
3892
|
|
|
3893
|
+
/**
|
|
3894
|
+
* Voice agent module. Uses native WebSocket + Daily.js only.
|
|
3895
|
+
* Does NOT use Socket.IO or ngx-socket-io.
|
|
3896
|
+
*/
|
|
3872
3897
|
var VoiceAgentModule = /** @class */ (function () {
|
|
3873
3898
|
function VoiceAgentModule() {
|
|
3874
3899
|
}
|