@bytexbyte/nxtlinq-ai-agent-ui-react-development 0.1.1
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/dist/NxtlinqAgentChat.d.ts +26 -0
- package/dist/NxtlinqAgentChat.d.ts.map +1 -0
- package/dist/NxtlinqAgentChat.js +28 -0
- package/dist/components/AgentAssistantShell.d.ts +5 -0
- package/dist/components/AgentAssistantShell.d.ts.map +1 -0
- package/dist/components/AgentAssistantShell.js +52 -0
- package/dist/components/AgentComposer.d.ts +3 -0
- package/dist/components/AgentComposer.d.ts.map +1 -0
- package/dist/components/AgentComposer.js +60 -0
- package/dist/components/AgentMessageList.d.ts +3 -0
- package/dist/components/AgentMessageList.d.ts.map +1 -0
- package/dist/components/AgentMessageList.js +37 -0
- package/dist/components/AgentRemoteAudio.d.ts +4 -0
- package/dist/components/AgentRemoteAudio.d.ts.map +1 -0
- package/dist/components/AgentRemoteAudio.js +34 -0
- package/dist/components/AgentVoiceBar.d.ts +3 -0
- package/dist/components/AgentVoiceBar.d.ts.map +1 -0
- package/dist/components/AgentVoiceBar.js +91 -0
- package/dist/components/PresetMessageChips.d.ts +3 -0
- package/dist/components/PresetMessageChips.d.ts.map +1 -0
- package/dist/components/PresetMessageChips.js +23 -0
- package/dist/context/AgentAssistantContext.d.ts +32 -0
- package/dist/context/AgentAssistantContext.d.ts.map +1 -0
- package/dist/context/AgentAssistantContext.js +159 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/legacy/assets/images/adiSideItalicDataUri.d.ts +2 -0
- package/dist/legacy/assets/images/adiSideItalicDataUri.d.ts.map +1 -0
- package/dist/legacy/assets/images/adiSideItalicDataUri.js +1 -0
- package/dist/legacy/chatbot/ChatBot.d.ts +5 -0
- package/dist/legacy/chatbot/ChatBot.d.ts.map +1 -0
- package/dist/legacy/chatbot/ChatBot.js +35 -0
- package/dist/legacy/chatbot/context/ChatBotContext.d.ts +5 -0
- package/dist/legacy/chatbot/context/ChatBotContext.d.ts.map +1 -0
- package/dist/legacy/chatbot/context/ChatBotContext.js +2908 -0
- package/dist/legacy/chatbot/types/ChatBotTypes.d.ts +166 -0
- package/dist/legacy/chatbot/types/ChatBotTypes.d.ts.map +1 -0
- package/dist/legacy/chatbot/types/ChatBotTypes.js +1 -0
- package/dist/legacy/chatbot/ui/BerifyMeModal.d.ts +17 -0
- package/dist/legacy/chatbot/ui/BerifyMeModal.d.ts.map +1 -0
- package/dist/legacy/chatbot/ui/BerifyMeModal.js +110 -0
- package/dist/legacy/chatbot/ui/ChatBotUI.d.ts +3 -0
- package/dist/legacy/chatbot/ui/ChatBotUI.d.ts.map +1 -0
- package/dist/legacy/chatbot/ui/ChatBotUI.js +625 -0
- package/dist/legacy/chatbot/ui/MessageInput.d.ts +3 -0
- package/dist/legacy/chatbot/ui/MessageInput.d.ts.map +1 -0
- package/dist/legacy/chatbot/ui/MessageInput.js +321 -0
- package/dist/legacy/chatbot/ui/MessageList.d.ts +4 -0
- package/dist/legacy/chatbot/ui/MessageList.d.ts.map +1 -0
- package/dist/legacy/chatbot/ui/MessageList.js +455 -0
- package/dist/legacy/chatbot/ui/ModelSelector.d.ts +4 -0
- package/dist/legacy/chatbot/ui/ModelSelector.d.ts.map +1 -0
- package/dist/legacy/chatbot/ui/ModelSelector.js +122 -0
- package/dist/legacy/chatbot/ui/NotificationModal.d.ts +15 -0
- package/dist/legacy/chatbot/ui/NotificationModal.d.ts.map +1 -0
- package/dist/legacy/chatbot/ui/NotificationModal.js +53 -0
- package/dist/legacy/chatbot/ui/PermissionForm.d.ts +8 -0
- package/dist/legacy/chatbot/ui/PermissionForm.d.ts.map +1 -0
- package/dist/legacy/chatbot/ui/PermissionForm.js +465 -0
- package/dist/legacy/chatbot/ui/PresetMessages.d.ts +4 -0
- package/dist/legacy/chatbot/ui/PresetMessages.d.ts.map +1 -0
- package/dist/legacy/chatbot/ui/PresetMessages.js +33 -0
- package/dist/legacy/chatbot/ui/VoiceModePanel.d.ts +3 -0
- package/dist/legacy/chatbot/ui/VoiceModePanel.d.ts.map +1 -0
- package/dist/legacy/chatbot/ui/VoiceModePanel.js +95 -0
- package/dist/legacy/chatbot/ui/styles/isolatedStyles.d.ts +73 -0
- package/dist/legacy/chatbot/ui/styles/isolatedStyles.d.ts.map +1 -0
- package/dist/legacy/chatbot/ui/styles/isolatedStyles.js +985 -0
- package/dist/legacy/index.d.ts +14 -0
- package/dist/legacy/index.d.ts.map +1 -0
- package/dist/legacy/index.js +12 -0
- package/dist/theme/defaultTheme.d.ts +3 -0
- package/dist/theme/defaultTheme.d.ts.map +1 -0
- package/dist/theme/defaultTheme.js +20 -0
- package/dist/types.d.ts +62 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/dist/voice/useVoiceConnectOrchestration.d.ts +21 -0
- package/dist/voice/useVoiceConnectOrchestration.d.ts.map +1 -0
- package/dist/voice/useVoiceConnectOrchestration.js +86 -0
- package/dist/voice/useVoiceMicState.d.ts +15 -0
- package/dist/voice/useVoiceMicState.d.ts.map +1 -0
- package/dist/voice/useVoiceMicState.js +94 -0
- package/dist/voice/useVoiceSilenceCommit.d.ts +10 -0
- package/dist/voice/useVoiceSilenceCommit.d.ts.map +1 -0
- package/dist/voice/useVoiceSilenceCommit.js +67 -0
- package/dist/voice/useVoiceTranscriptMessages.d.ts +16 -0
- package/dist/voice/useVoiceTranscriptMessages.d.ts.map +1 -0
- package/dist/voice/useVoiceTranscriptMessages.js +129 -0
- package/dist/voice/useWsRealtimeAudio.d.ts +18 -0
- package/dist/voice/useWsRealtimeAudio.d.ts.map +1 -0
- package/dist/voice/useWsRealtimeAudio.js +102 -0
- package/dist/voice/voiceMicConstants.d.ts +4 -0
- package/dist/voice/voiceMicConstants.d.ts.map +1 -0
- package/dist/voice/voiceMicConstants.js +10 -0
- package/dist/voice/ws/BrowserWsPcmPlayer.d.ts +23 -0
- package/dist/voice/ws/BrowserWsPcmPlayer.d.ts.map +1 -0
- package/dist/voice/ws/BrowserWsPcmPlayer.js +137 -0
- package/dist/voice/ws/BrowserWsPcmRecorder.d.ts +17 -0
- package/dist/voice/ws/BrowserWsPcmRecorder.d.ts.map +1 -0
- package/dist/voice/ws/BrowserWsPcmRecorder.js +71 -0
- package/dist/voice/ws/float32ToPcm16.d.ts +2 -0
- package/dist/voice/ws/float32ToPcm16.d.ts.map +1 -0
- package/dist/voice/ws/float32ToPcm16.js +8 -0
- package/dist/voice/ws/voiceSilenceConstants.d.ts +5 -0
- package/dist/voice/ws/voiceSilenceConstants.d.ts.map +1 -0
- package/dist/voice/ws/voiceSilenceConstants.js +4 -0
- package/dist/voice/ws/wsRealtimeConstants.d.ts +2 -0
- package/dist/voice/ws/wsRealtimeConstants.d.ts.map +1 -0
- package/dist/voice/ws/wsRealtimeConstants.js +1 -0
- package/package.json +60 -0
- package/src/NxtlinqAgentChat.tsx +79 -0
- package/src/components/AgentAssistantShell.tsx +104 -0
- package/src/components/AgentComposer.tsx +134 -0
- package/src/components/AgentMessageList.tsx +78 -0
- package/src/components/AgentRemoteAudio.tsx +34 -0
- package/src/components/AgentVoiceBar.tsx +173 -0
- package/src/components/PresetMessageChips.tsx +41 -0
- package/src/context/AgentAssistantContext.tsx +276 -0
- package/src/index.ts +78 -0
- package/src/legacy/assets/images/adiSideItalicDataUri.ts +1 -0
- package/src/legacy/chatbot/ChatBot.tsx +61 -0
- package/src/legacy/chatbot/context/ChatBotContext.tsx +3227 -0
- package/src/legacy/chatbot/types/ChatBotTypes.ts +195 -0
- package/src/legacy/chatbot/ui/BerifyMeModal.tsx +145 -0
- package/src/legacy/chatbot/ui/ChatBotUI.tsx +949 -0
- package/src/legacy/chatbot/ui/MessageInput.tsx +517 -0
- package/src/legacy/chatbot/ui/MessageList.tsx +764 -0
- package/src/legacy/chatbot/ui/ModelSelector.tsx +190 -0
- package/src/legacy/chatbot/ui/NotificationModal.tsx +110 -0
- package/src/legacy/chatbot/ui/PermissionForm.tsx +632 -0
- package/src/legacy/chatbot/ui/PresetMessages.tsx +50 -0
- package/src/legacy/chatbot/ui/VoiceModePanel.tsx +168 -0
- package/src/legacy/chatbot/ui/styles/isolatedStyles.ts +1058 -0
- package/src/legacy/index.ts +26 -0
- package/src/theme/defaultTheme.ts +22 -0
- package/src/types.ts +65 -0
- package/src/voice/useVoiceConnectOrchestration.ts +117 -0
- package/src/voice/useVoiceMicState.ts +117 -0
- package/src/voice/useVoiceTranscriptMessages.ts +173 -0
- package/src/voice/voiceMicConstants.ts +13 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/** @jsxImportSource @emotion/react */
|
|
2
|
+
import { css } from '@emotion/react';
|
|
3
|
+
import MicIcon from '@mui/icons-material/Mic';
|
|
4
|
+
import MicOffIcon from '@mui/icons-material/MicOff';
|
|
5
|
+
import StopIcon from '@mui/icons-material/Stop';
|
|
6
|
+
import { IconButton, Tooltip } from '@mui/material';
|
|
7
|
+
import * as React from 'react';
|
|
8
|
+
import type { VoiceStatus } from '@bytexbyte/nxtlinq-ai-agent-core-development';
|
|
9
|
+
import { useChatBot } from '../context/ChatBotContext';
|
|
10
|
+
|
|
11
|
+
const STATUS_LABELS: Record<VoiceStatus, string> = {
|
|
12
|
+
idle: 'Idle',
|
|
13
|
+
listening: 'Listening',
|
|
14
|
+
transcribing: 'Transcribing',
|
|
15
|
+
thinking: 'Thinking',
|
|
16
|
+
generating: 'Generating',
|
|
17
|
+
speaking: 'Speaking',
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const ASSISTANT_MIC_HOLD_STATUSES: ReadonlySet<VoiceStatus> = new Set([
|
|
21
|
+
'transcribing',
|
|
22
|
+
'thinking',
|
|
23
|
+
'generating',
|
|
24
|
+
'speaking',
|
|
25
|
+
]);
|
|
26
|
+
|
|
27
|
+
const statusDotColor: Record<VoiceStatus, string> = {
|
|
28
|
+
idle: '#6b7280',
|
|
29
|
+
listening: '#22c55e',
|
|
30
|
+
transcribing: '#eab308',
|
|
31
|
+
thinking: '#3b82f6',
|
|
32
|
+
generating: '#8b5cf6',
|
|
33
|
+
speaking: '#ec4899',
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const STATUS_HINTS: Partial<Record<VoiceStatus, string>> = {
|
|
37
|
+
listening: 'Start speaking',
|
|
38
|
+
transcribing: 'Processing your speech…',
|
|
39
|
+
thinking: 'Thinking…',
|
|
40
|
+
generating: 'Assistant is responding…',
|
|
41
|
+
speaking: 'Assistant is speaking…',
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const VoiceModePanel: React.FC = () => {
|
|
45
|
+
const {
|
|
46
|
+
voiceStatus,
|
|
47
|
+
isVoiceConnecting,
|
|
48
|
+
isMicMuted,
|
|
49
|
+
remoteAudioRef,
|
|
50
|
+
toggleVoiceMicMute,
|
|
51
|
+
interruptVoice,
|
|
52
|
+
} = useChatBot();
|
|
53
|
+
|
|
54
|
+
const isMicHeldForAssistant = ASSISTANT_MIC_HOLD_STATUSES.has(voiceStatus);
|
|
55
|
+
|
|
56
|
+
const statusHint = isVoiceConnecting
|
|
57
|
+
? 'Connecting… use Text Mode above to cancel'
|
|
58
|
+
: isMicMuted && !isMicHeldForAssistant
|
|
59
|
+
? 'Mic is off — tap the mic button when ready to speak'
|
|
60
|
+
: STATUS_HINTS[voiceStatus] ?? '';
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<>
|
|
64
|
+
<audio ref={remoteAudioRef} autoPlay playsInline css={css`display: none !important;`} />
|
|
65
|
+
|
|
66
|
+
<div
|
|
67
|
+
css={css`
|
|
68
|
+
padding: 10px 15px !important;
|
|
69
|
+
border-top: 1px solid #eee !important;
|
|
70
|
+
background: linear-gradient(180deg, #f8fafc 0%, #fff 100%) !important;
|
|
71
|
+
display: flex !important;
|
|
72
|
+
align-items: center !important;
|
|
73
|
+
justify-content: space-between !important;
|
|
74
|
+
gap: 10px !important;
|
|
75
|
+
`}
|
|
76
|
+
>
|
|
77
|
+
<div
|
|
78
|
+
css={css`
|
|
79
|
+
min-width: 0 !important;
|
|
80
|
+
flex: 1 !important;
|
|
81
|
+
height: 32px !important;
|
|
82
|
+
padding: 0 10px !important;
|
|
83
|
+
border-radius: 999px !important;
|
|
84
|
+
border: 1px solid #e5e7eb !important;
|
|
85
|
+
background: #f9fafb !important;
|
|
86
|
+
display: flex !important;
|
|
87
|
+
align-items: center !important;
|
|
88
|
+
gap: 8px !important;
|
|
89
|
+
color: #374151 !important;
|
|
90
|
+
font-size: 12px !important;
|
|
91
|
+
line-height: 1 !important;
|
|
92
|
+
`}
|
|
93
|
+
>
|
|
94
|
+
<span
|
|
95
|
+
css={css`
|
|
96
|
+
flex: 0 0 auto !important;
|
|
97
|
+
width: 8px !important;
|
|
98
|
+
height: 8px !important;
|
|
99
|
+
border-radius: 50% !important;
|
|
100
|
+
background: ${statusDotColor[voiceStatus]} !important;
|
|
101
|
+
${voiceStatus === 'listening' || voiceStatus === 'thinking' || voiceStatus === 'speaking'
|
|
102
|
+
? 'animation: voicePulse 1.2s infinite !important;'
|
|
103
|
+
: ''}
|
|
104
|
+
`}
|
|
105
|
+
/>
|
|
106
|
+
<span css={css`flex: 0 0 auto !important; font-weight: 600 !important;`}>
|
|
107
|
+
{isVoiceConnecting ? 'Connecting' : STATUS_LABELS[voiceStatus]}
|
|
108
|
+
</span>
|
|
109
|
+
{statusHint ? (
|
|
110
|
+
<span
|
|
111
|
+
css={css`
|
|
112
|
+
min-width: 0 !important;
|
|
113
|
+
overflow: hidden !important;
|
|
114
|
+
text-overflow: ellipsis !important;
|
|
115
|
+
white-space: nowrap !important;
|
|
116
|
+
color: #6b7280 !important;
|
|
117
|
+
`}
|
|
118
|
+
>
|
|
119
|
+
{statusHint}
|
|
120
|
+
</span>
|
|
121
|
+
) : null}
|
|
122
|
+
</div>
|
|
123
|
+
|
|
124
|
+
<div css={css`display: flex !important; gap: 4px !important;`}>
|
|
125
|
+
<Tooltip title={
|
|
126
|
+
isVoiceConnecting
|
|
127
|
+
? 'Available after connection'
|
|
128
|
+
: isMicHeldForAssistant
|
|
129
|
+
? 'Mic paused while assistant responds (use Interrupt to speak)'
|
|
130
|
+
: isMicMuted
|
|
131
|
+
? 'Turn on mic'
|
|
132
|
+
: 'Turn off mic'
|
|
133
|
+
}>
|
|
134
|
+
<span>
|
|
135
|
+
<IconButton
|
|
136
|
+
onClick={toggleVoiceMicMute}
|
|
137
|
+
disabled={isVoiceConnecting || isMicHeldForAssistant}
|
|
138
|
+
size="small"
|
|
139
|
+
css={css`color: ${isMicMuted ? '#ef4444' : '#4b5563'} !important;`}
|
|
140
|
+
>
|
|
141
|
+
{isMicMuted ? <MicOffIcon /> : <MicIcon />}
|
|
142
|
+
</IconButton>
|
|
143
|
+
</span>
|
|
144
|
+
</Tooltip>
|
|
145
|
+
<Tooltip title="Interrupt (barge in)">
|
|
146
|
+
<span>
|
|
147
|
+
<IconButton
|
|
148
|
+
onClick={interruptVoice}
|
|
149
|
+
disabled={isVoiceConnecting}
|
|
150
|
+
size="small"
|
|
151
|
+
css={css`color: #4b5563 !important;`}
|
|
152
|
+
>
|
|
153
|
+
<StopIcon />
|
|
154
|
+
</IconButton>
|
|
155
|
+
</span>
|
|
156
|
+
</Tooltip>
|
|
157
|
+
</div>
|
|
158
|
+
</div>
|
|
159
|
+
|
|
160
|
+
<style>{`
|
|
161
|
+
@keyframes voicePulse {
|
|
162
|
+
0%, 100% { opacity: 1; }
|
|
163
|
+
50% { opacity: 0.35; }
|
|
164
|
+
}
|
|
165
|
+
`}</style>
|
|
166
|
+
</>
|
|
167
|
+
);
|
|
168
|
+
};
|