@bytexbyte/nxtlinq-ai-agent-ui-react-development 0.1.3 → 0.1.4

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.
Files changed (91) hide show
  1. package/dist/ChatBot.d.ts +5 -0
  2. package/dist/ChatBot.d.ts.map +1 -0
  3. package/dist/ChatBot.js +35 -0
  4. package/dist/assets/images/adiSideItalicDataUri.d.ts +2 -0
  5. package/dist/assets/images/adiSideItalicDataUri.d.ts.map +1 -0
  6. package/dist/assets/images/adiSideItalicDataUri.js +1 -0
  7. package/dist/context/ChatBotContext.d.ts +5 -0
  8. package/dist/context/ChatBotContext.d.ts.map +1 -0
  9. package/dist/context/ChatBotContext.js +2908 -0
  10. package/dist/index.d.ts +5 -13
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +4 -11
  13. package/dist/legacy/chatbot/context/ChatBotContext.d.ts.map +1 -1
  14. package/dist/legacy/chatbot/context/ChatBotContext.js +14 -0
  15. package/dist/types/ChatBotTypes.d.ts +166 -0
  16. package/dist/types/ChatBotTypes.d.ts.map +1 -0
  17. package/dist/types/ChatBotTypes.js +1 -0
  18. package/dist/ui/BerifyMeModal.d.ts +17 -0
  19. package/dist/ui/BerifyMeModal.d.ts.map +1 -0
  20. package/dist/ui/BerifyMeModal.js +110 -0
  21. package/dist/ui/ChatBotHeader.d.ts +15 -0
  22. package/dist/ui/ChatBotHeader.d.ts.map +1 -0
  23. package/dist/ui/ChatBotHeader.js +62 -0
  24. package/dist/ui/ChatBotUI.d.ts +3 -0
  25. package/dist/ui/ChatBotUI.d.ts.map +1 -0
  26. package/dist/ui/ChatBotUI.js +557 -0
  27. package/dist/ui/MessageInput.d.ts +3 -0
  28. package/dist/ui/MessageInput.d.ts.map +1 -0
  29. package/dist/ui/MessageInput.js +321 -0
  30. package/dist/ui/MessageList.d.ts +4 -0
  31. package/dist/ui/MessageList.d.ts.map +1 -0
  32. package/dist/ui/MessageList.js +455 -0
  33. package/dist/ui/ModelSelector.d.ts +4 -0
  34. package/dist/ui/ModelSelector.d.ts.map +1 -0
  35. package/dist/ui/ModelSelector.js +122 -0
  36. package/dist/ui/NotificationModal.d.ts +15 -0
  37. package/dist/ui/NotificationModal.d.ts.map +1 -0
  38. package/dist/ui/NotificationModal.js +53 -0
  39. package/dist/ui/PermissionForm.d.ts +8 -0
  40. package/dist/ui/PermissionForm.d.ts.map +1 -0
  41. package/dist/ui/PermissionForm.js +465 -0
  42. package/dist/ui/PresetMessages.d.ts +4 -0
  43. package/dist/ui/PresetMessages.d.ts.map +1 -0
  44. package/dist/ui/PresetMessages.js +33 -0
  45. package/dist/ui/VoiceModePanel.d.ts +3 -0
  46. package/dist/ui/VoiceModePanel.d.ts.map +1 -0
  47. package/dist/ui/VoiceModePanel.js +95 -0
  48. package/dist/ui/chatBotHeaderParts.d.ts +15 -0
  49. package/dist/ui/chatBotHeaderParts.d.ts.map +1 -0
  50. package/dist/ui/chatBotHeaderParts.js +50 -0
  51. package/dist/ui/index.d.ts +9 -0
  52. package/dist/ui/index.d.ts.map +1 -0
  53. package/dist/ui/index.js +8 -0
  54. package/dist/ui/styles/isolatedStyles.d.ts +73 -0
  55. package/dist/ui/styles/isolatedStyles.d.ts.map +1 -0
  56. package/dist/ui/styles/isolatedStyles.js +985 -0
  57. package/package.json +2 -2
  58. package/src/{legacy/chatbot/context → context}/ChatBotContext.tsx +0 -1
  59. package/src/index.ts +17 -40
  60. package/src/{legacy/chatbot/ui → ui}/ModelSelector.tsx +1 -1
  61. package/src/{legacy/chatbot/ui → ui}/VoiceModePanel.tsx +1 -1
  62. package/src/ui/index.ts +8 -0
  63. package/src/NxtlinqAgentChat.tsx +0 -79
  64. package/src/components/AgentAssistantShell.tsx +0 -104
  65. package/src/components/AgentComposer.tsx +0 -134
  66. package/src/components/AgentMessageList.tsx +0 -78
  67. package/src/components/AgentRemoteAudio.tsx +0 -34
  68. package/src/components/AgentVoiceBar.tsx +0 -173
  69. package/src/components/PresetMessageChips.tsx +0 -41
  70. package/src/context/AgentAssistantContext.tsx +0 -294
  71. package/src/legacy/index.ts +0 -26
  72. package/src/theme/defaultTheme.ts +0 -22
  73. package/src/types.ts +0 -65
  74. package/src/voice/useVoiceConnectOrchestration.ts +0 -117
  75. package/src/voice/useVoiceMicState.ts +0 -117
  76. package/src/voice/useVoiceTranscriptMessages.ts +0 -188
  77. package/src/voice/voiceMicConstants.ts +0 -13
  78. package/src/voice/voiceUserBubble.ts +0 -71
  79. /package/src/{legacy/chatbot/ChatBot.tsx → ChatBot.tsx} +0 -0
  80. /package/src/{legacy/assets → assets}/images/adiSideItalicDataUri.ts +0 -0
  81. /package/src/{legacy/chatbot/types → types}/ChatBotTypes.ts +0 -0
  82. /package/src/{legacy/chatbot/ui → ui}/BerifyMeModal.tsx +0 -0
  83. /package/src/{legacy/chatbot/ui → ui}/ChatBotHeader.tsx +0 -0
  84. /package/src/{legacy/chatbot/ui → ui}/ChatBotUI.tsx +0 -0
  85. /package/src/{legacy/chatbot/ui → ui}/MessageInput.tsx +0 -0
  86. /package/src/{legacy/chatbot/ui → ui}/MessageList.tsx +0 -0
  87. /package/src/{legacy/chatbot/ui → ui}/NotificationModal.tsx +0 -0
  88. /package/src/{legacy/chatbot/ui → ui}/PermissionForm.tsx +0 -0
  89. /package/src/{legacy/chatbot/ui → ui}/PresetMessages.tsx +0 -0
  90. /package/src/{legacy/chatbot/ui → ui}/chatBotHeaderParts.tsx +0 -0
  91. /package/src/{legacy/chatbot/ui → ui}/styles/isolatedStyles.ts +0 -0
@@ -1,173 +0,0 @@
1
- import React, { useCallback } from 'react';
2
- import {
3
- useAgentAssistant,
4
- voiceStatusLabel,
5
- } from '../context/AgentAssistantContext';
6
-
7
- function statusDotColor(
8
- status: ReturnType<typeof useAgentAssistant>['voiceStatus'],
9
- theme: ReturnType<typeof useAgentAssistant>['theme'],
10
- ): string {
11
- switch (status) {
12
- case 'listening':
13
- return theme.colors.voiceActive;
14
- case 'speaking':
15
- return theme.colors.voiceSpeaking;
16
- case 'idle':
17
- return theme.colors.mutedText;
18
- default:
19
- return theme.colors.primary;
20
- }
21
- }
22
-
23
- function MicIcon({ color }: { color: string }): React.ReactElement {
24
- return (
25
- <svg width="24" height="24" viewBox="0 0 24 24" fill={color} aria-hidden>
26
- <path d="M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3zm5-3c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z" />
27
- </svg>
28
- );
29
- }
30
-
31
- function MicOffIcon(): React.ReactElement {
32
- return (
33
- <svg width="24" height="24" viewBox="0 0 24 24" fill="#ef4444" aria-hidden>
34
- <path d="M19 11h-1.7c0 .74-.16 1.43-.43 2.05l1.23 1.23c.56-.98.9-2.09.9-3.28zm-4.02.17c0-.06.02-.11.02-.17V5c0-1.66-1.34-3-3-3s-3 1.34-3 3v.18l5.98 5.99zM4.27 3L3 4.27l6.01 6.01V11c0 1.66 1.33 3 2.99 3 .22 0 .44-.03.65-.08l1.66 1.66c-.71.33-1.5.52-2.31.52-2.76 0-5.3-2.1-5.3-5.1H5c0 3.41 2.72 6.23 6 6.72V21h2v-3.28c.91-.13 1.77-.45 2.54-.9L19.73 21 21 19.73 4.27 3z" />
35
- </svg>
36
- );
37
- }
38
-
39
- export function AgentVoiceBar(): React.ReactElement | null {
40
- const {
41
- theme,
42
- interactionMode,
43
- voiceStatus,
44
- voiceSessionId,
45
- isVoiceConnecting,
46
- isVoiceChannelReady,
47
- stopVoice,
48
- isVoiceAvailable,
49
- isMicMuted,
50
- isMicHeldForAssistant,
51
- toggleVoiceMicMute,
52
- } = useAgentAssistant();
53
-
54
- const returnToTextMode = useCallback(() => {
55
- void stopVoice();
56
- }, [stopVoice]);
57
-
58
- if (!isVoiceAvailable) return null;
59
- if (interactionMode !== 'voice' && !isVoiceConnecting) return null;
60
-
61
- const showConnecting = isVoiceConnecting;
62
- const awaitingChannel =
63
- Boolean(voiceSessionId) &&
64
- !isVoiceConnecting &&
65
- !isVoiceChannelReady &&
66
- voiceStatus === 'idle';
67
-
68
- const statusHint = showConnecting
69
- ? 'Tap Back to text mode below to cancel'
70
- : awaitingChannel
71
- ? 'Waiting for voice channel…'
72
- : isMicHeldForAssistant
73
- ? 'Assistant is responding — tap mic to interrupt and speak'
74
- : isMicMuted
75
- ? 'Mic is off — tap the mic when ready to speak'
76
- : voiceStatus === 'listening'
77
- ? 'Start speaking'
78
- : voiceStatus === 'speaking'
79
- ? 'Assistant is speaking…'
80
- : voiceStatus === 'thinking'
81
- ? 'Thinking…'
82
- : '';
83
-
84
- return (
85
- <div
86
- style={{
87
- borderTop: `1px solid ${theme.colors.border}`,
88
- backgroundColor: theme.colors.surface,
89
- padding: theme.spacing.md,
90
- }}
91
- >
92
- <div style={{ display: 'flex', alignItems: 'center', gap: 10 }}>
93
- <div
94
- style={{
95
- flex: 1,
96
- minWidth: 0,
97
- border: `1px solid ${theme.colors.border}`,
98
- borderRadius: 12,
99
- backgroundColor: theme.colors.background,
100
- padding: '8px 10px',
101
- }}
102
- >
103
- <div style={{ display: 'flex', alignItems: 'center', gap: 6 }}>
104
- <span
105
- style={{
106
- width: 8,
107
- height: 8,
108
- borderRadius: 4,
109
- backgroundColor: statusDotColor(voiceStatus, theme),
110
- flexShrink: 0,
111
- }}
112
- />
113
- <span
114
- style={{
115
- color: theme.colors.assistantText,
116
- fontSize: theme.typography.captionSize,
117
- fontWeight: 600,
118
- }}
119
- >
120
- {showConnecting || awaitingChannel ? 'Connecting' : voiceStatusLabel(voiceStatus)}
121
- </span>
122
- {showConnecting ? (
123
- <span style={{ color: theme.colors.mutedText, fontSize: theme.typography.captionSize }}>
124
-
125
- </span>
126
- ) : null}
127
- </div>
128
- {statusHint ? (
129
- <p
130
- style={{
131
- margin: '4px 0 0',
132
- color: theme.colors.mutedText,
133
- fontSize: theme.typography.captionSize - 1,
134
- }}
135
- >
136
- {statusHint}
137
- </p>
138
- ) : null}
139
- </div>
140
- <button
141
- type="button"
142
- onClick={toggleVoiceMicMute}
143
- disabled={showConnecting || awaitingChannel}
144
- style={{
145
- border: 'none',
146
- background: 'none',
147
- padding: 8,
148
- cursor: showConnecting || awaitingChannel ? 'not-allowed' : 'pointer',
149
- opacity: showConnecting || awaitingChannel ? 0.45 : 1,
150
- }}
151
- aria-label={isMicMuted ? 'Unmute microphone' : 'Mute microphone'}
152
- >
153
- {isMicMuted ? <MicOffIcon /> : <MicIcon color={theme.colors.assistantText} />}
154
- </button>
155
- </div>
156
- <button
157
- type="button"
158
- onClick={returnToTextMode}
159
- style={{
160
- display: 'block',
161
- margin: `${theme.spacing.sm}px auto 0`,
162
- border: 'none',
163
- background: 'none',
164
- color: theme.colors.primary,
165
- fontSize: theme.typography.captionSize,
166
- cursor: 'pointer',
167
- }}
168
- >
169
- Back to text mode
170
- </button>
171
- </div>
172
- );
173
- }
@@ -1,41 +0,0 @@
1
- import React from 'react';
2
- import { useAgentAssistant } from '../context/AgentAssistantContext';
3
- import type { PresetMessage } from '../types';
4
-
5
- export function PresetMessageChips(): React.ReactElement | null {
6
- const { presetMessages, selectPreset, theme, interactionMode } = useAgentAssistant();
7
- if (!presetMessages.length || interactionMode === 'voice') {
8
- return null;
9
- }
10
-
11
- return (
12
- <div
13
- style={{
14
- display: 'flex',
15
- flexWrap: 'wrap',
16
- gap: theme.spacing.sm,
17
- padding: `${theme.spacing.sm}px ${theme.spacing.md}px`,
18
- borderBottom: `1px solid ${theme.colors.border}`,
19
- }}
20
- >
21
- {presetMessages.map((preset: PresetMessage, index: number) => (
22
- <button
23
- key={`${preset.text}-${index}`}
24
- type="button"
25
- onClick={() => void selectPreset(preset)}
26
- style={{
27
- border: `1px solid ${theme.colors.border}`,
28
- borderRadius: theme.radius.button,
29
- padding: `${theme.spacing.xs}px ${theme.spacing.sm}px`,
30
- backgroundColor: theme.colors.surface,
31
- color: theme.colors.assistantText,
32
- fontSize: theme.typography.captionSize,
33
- cursor: 'pointer',
34
- }}
35
- >
36
- {preset.text}
37
- </button>
38
- ))}
39
- </div>
40
- );
41
- }
@@ -1,294 +0,0 @@
1
- import type { Message, VoiceStatus } from '@bytexbyte/nxtlinq-ai-agent-core-development';
2
- import {
3
- useNxtlinqAgent,
4
- useNxtlinqVoice,
5
- type UseNxtlinqAgentResult,
6
- type UseNxtlinqVoiceResult,
7
- } from '@bytexbyte/nxtlinq-ai-agent-web-development';
8
- import React, {
9
- createContext,
10
- useCallback,
11
- useContext,
12
- useEffect,
13
- useMemo,
14
- useState,
15
- type ReactNode,
16
- } from 'react';
17
- import { defaultAgentAssistantTheme } from '../theme/defaultTheme';
18
- import type { AgentAssistantTheme, NxtlinqAgentChatProps, PresetMessage } from '../types';
19
- import { useVoiceConnectOrchestration } from '../voice/useVoiceConnectOrchestration';
20
- import { useVoiceMicState } from '../voice/useVoiceMicState';
21
- import { useVoiceTranscriptMessages } from '../voice/useVoiceTranscriptMessages';
22
-
23
- export type InteractionMode = 'text' | 'voice';
24
-
25
- export type AgentAssistantContextValue = UseNxtlinqAgentResult &
26
- UseNxtlinqVoiceResult & {
27
- theme: AgentAssistantTheme;
28
- title: string;
29
- placeholder: string;
30
- presetMessages: PresetMessage[];
31
- interactionMode: InteractionMode;
32
- setInteractionMode: (mode: InteractionMode) => void;
33
- inputText: string;
34
- setInputText: (text: string) => void;
35
- isVoiceAvailable: boolean;
36
- isVoiceConnecting: boolean;
37
- isMicMuted: boolean;
38
- isMicHeldForAssistant: boolean;
39
- toggleVoiceMicMute: () => void;
40
- isVoiceChannelReady: boolean;
41
- enableFileUpload: boolean;
42
- sendText: () => Promise<void>;
43
- selectPreset: (preset: PresetMessage) => Promise<void>;
44
- };
45
-
46
- const AgentAssistantContext = createContext<AgentAssistantContextValue | null>(null);
47
-
48
- export type AgentAssistantProviderProps = {
49
- children: ReactNode;
50
- ui: Pick<
51
- NxtlinqAgentChatProps,
52
- | 'title'
53
- | 'placeholder'
54
- | 'presetMessages'
55
- | 'enableVoice'
56
- | 'enableFileUpload'
57
- | 'theme'
58
- | 'startWithMicMuted'
59
- | 'holdMicDuringAssistant'
60
- >;
61
- };
62
-
63
- export function AgentAssistantProvider({
64
- children,
65
- ui,
66
- }: AgentAssistantProviderProps): React.ReactElement {
67
- const agent = useNxtlinqAgent();
68
- const voice = useNxtlinqVoice();
69
- const [interactionMode, setInteractionModeState] = useState<InteractionMode>('text');
70
- const [inputText, setInputText] = useState('');
71
- const [isVoiceConnecting, setIsVoiceConnecting] = useState(false);
72
-
73
- const isVoiceAvailable = ui.enableVoice !== false;
74
- const micStartsMuted = ui.startWithMicMuted ?? true;
75
-
76
- const handleVoiceBargeIn = useCallback(() => {
77
- voice.interrupt();
78
- }, [voice]);
79
-
80
- const {
81
- isMicMuted,
82
- isMicHeldForAssistant,
83
- toggleVoiceMicMute,
84
- prepareForVoiceConnect,
85
- resetMicState,
86
- clearAssistantMicHold,
87
- } = useVoiceMicState(voice, isVoiceConnecting, {
88
- startWithMicMuted: micStartsMuted,
89
- holdMicDuringAssistant: ui.holdMicDuringAssistant ?? true,
90
- onBargeIn: handleVoiceBargeIn,
91
- });
92
-
93
- const voiceTranscriptApi = useMemo(
94
- () => ({
95
- getMessages: () => agent.agent.getSnapshot().messages,
96
- updateMessages: (updater: (prev: Message[]) => Message[]) => {
97
- agent.setMessages(updater(agent.agent.getSnapshot().messages));
98
- },
99
- syncVoiceTurnHistory: agent.syncVoiceTurnHistory,
100
- }),
101
- [agent.agent, agent.setMessages, agent.syncVoiceTurnHistory],
102
- );
103
-
104
- const { handleTranscript, handleDone, clearVoiceStream } = useVoiceTranscriptMessages(
105
- voiceTranscriptApi,
106
- interactionMode,
107
- voice.voiceSessionId,
108
- );
109
-
110
- const setInteractionMode = useCallback(
111
- (mode: InteractionMode) => {
112
- if (mode === 'text' && interactionMode === 'voice') {
113
- void voice.stopVoice('switch_to_text').then(() => {
114
- clearVoiceStream();
115
- resetMicState();
116
- });
117
- }
118
- setInteractionModeState(mode);
119
- },
120
- [interactionMode, voice, resetMicState, clearVoiceStream],
121
- );
122
-
123
- useEffect(() => {
124
- if (interactionMode === 'text' && voice.voiceSessionId != null) {
125
- void voice.stopVoice('mode_text_cleanup').then(() => {
126
- clearVoiceStream();
127
- resetMicState();
128
- });
129
- }
130
- }, [interactionMode, voice.voiceSessionId, voice, resetMicState, clearVoiceStream]);
131
-
132
- const orchestrationCallbacks = useMemo(
133
- () => ({
134
- handleTranscript,
135
- handleDone,
136
- clearVoiceStream,
137
- prepareForVoiceConnect,
138
- resetMicState,
139
- clearAssistantMicHold,
140
- setInteractionMode,
141
- setIsVoiceConnecting,
142
- }),
143
- [
144
- handleTranscript,
145
- handleDone,
146
- clearVoiceStream,
147
- prepareForVoiceConnect,
148
- resetMicState,
149
- clearAssistantMicHold,
150
- setInteractionMode,
151
- ],
152
- );
153
-
154
- const {
155
- wrappedStartVoice,
156
- wrappedStopVoice,
157
- wrappedInterrupt,
158
- isVoiceChannelReady,
159
- } = useVoiceConnectOrchestration(
160
- agent,
161
- voice,
162
- interactionMode,
163
- micStartsMuted,
164
- orchestrationCallbacks,
165
- );
166
-
167
- // iOS 切換 App 或相機後返回時,若 WebRTC App Channel 已斷開則自動停止語音 session,
168
- // 避免麥克風圖示顯示活躍但狀態卡在 Idle 的問題。
169
- useEffect(() => {
170
- if (typeof document === 'undefined') return;
171
- const handleVisibilityChange = () => {
172
- if (document.visibilityState !== 'visible') return;
173
- if (voice.voiceSessionId == null) return;
174
- const session = agent.agent.getVoiceSession();
175
- if (!session?.isAppChannelOpen()) {
176
- void wrappedStopVoice();
177
- }
178
- };
179
- document.addEventListener('visibilitychange', handleVisibilityChange);
180
- return () => document.removeEventListener('visibilitychange', handleVisibilityChange);
181
- }, [voice.voiceSessionId, agent.agent, wrappedStopVoice]);
182
-
183
- const theme = useMemo(
184
- () => ({
185
- ...defaultAgentAssistantTheme,
186
- ...ui.theme,
187
- colors: { ...defaultAgentAssistantTheme.colors, ...ui.theme?.colors },
188
- spacing: { ...defaultAgentAssistantTheme.spacing, ...ui.theme?.spacing },
189
- radius: { ...defaultAgentAssistantTheme.radius, ...ui.theme?.radius },
190
- typography: {
191
- ...defaultAgentAssistantTheme.typography,
192
- ...ui.theme?.typography,
193
- },
194
- }),
195
- [ui.theme],
196
- );
197
-
198
- const sendText = useCallback(async () => {
199
- const text = inputText.trim();
200
- if (!text || agent.isLoading) return;
201
- setInputText('');
202
- await agent.sendMessage(text);
203
- }, [agent, inputText]);
204
-
205
- const selectPreset = useCallback(
206
- async (preset: PresetMessage) => {
207
- if (preset.autoSend) {
208
- await agent.sendMessage(preset.text);
209
- } else {
210
- setInputText(preset.text);
211
- }
212
- },
213
- [agent],
214
- );
215
-
216
- const value = useMemo<AgentAssistantContextValue>(
217
- () => ({
218
- ...agent,
219
- ...voice,
220
- startVoice: wrappedStartVoice,
221
- stopVoice: wrappedStopVoice,
222
- interrupt: wrappedInterrupt,
223
- theme,
224
- title: ui.title ?? 'AI Assistant',
225
- placeholder: ui.placeholder ?? 'Type a message…',
226
- presetMessages: ui.presetMessages ?? [],
227
- interactionMode,
228
- setInteractionMode,
229
- inputText,
230
- setInputText,
231
- isVoiceAvailable,
232
- isVoiceConnecting,
233
- isMicMuted,
234
- isMicHeldForAssistant,
235
- toggleVoiceMicMute,
236
- isVoiceChannelReady,
237
- enableFileUpload: ui.enableFileUpload !== false,
238
- sendText,
239
- selectPreset,
240
- }),
241
- [
242
- agent,
243
- voice,
244
- wrappedStartVoice,
245
- wrappedStopVoice,
246
- wrappedInterrupt,
247
- theme,
248
- ui.title,
249
- ui.placeholder,
250
- ui.presetMessages,
251
- ui.enableFileUpload,
252
- interactionMode,
253
- setInteractionMode,
254
- inputText,
255
- isVoiceAvailable,
256
- isVoiceConnecting,
257
- isMicMuted,
258
- isMicHeldForAssistant,
259
- toggleVoiceMicMute,
260
- isVoiceChannelReady,
261
- sendText,
262
- selectPreset,
263
- voice.voiceStatus,
264
- ],
265
- );
266
-
267
- return (
268
- <AgentAssistantContext.Provider value={value}>
269
- {children}
270
- </AgentAssistantContext.Provider>
271
- );
272
- }
273
-
274
- export function useAgentAssistant(): AgentAssistantContextValue {
275
- const ctx = useContext(AgentAssistantContext);
276
- if (!ctx) {
277
- throw new Error(
278
- 'useAgentAssistant must be used within <NxtlinqAgentChat> or <AgentAssistantProvider>',
279
- );
280
- }
281
- return ctx;
282
- }
283
-
284
- export function voiceStatusLabel(status: VoiceStatus): string {
285
- const labels: Record<VoiceStatus, string> = {
286
- idle: 'Ready',
287
- listening: 'Listening',
288
- transcribing: 'Transcribing',
289
- thinking: 'Thinking',
290
- generating: 'Generating',
291
- speaking: 'Speaking',
292
- };
293
- return labels[status] ?? status;
294
- }
@@ -1,26 +0,0 @@
1
- export { ChatBot } from './chatbot/ChatBot';
2
- export { ChatBotProvider, useChatBot } from './chatbot/context/ChatBotContext';
3
-
4
- export { ChatBotUI } from './chatbot/ui/ChatBotUI';
5
- export { MessageInput } from './chatbot/ui/MessageInput';
6
- export { MessageList } from './chatbot/ui/MessageList';
7
- export { ModelSelector } from './chatbot/ui/ModelSelector';
8
- export { NotificationModal } from './chatbot/ui/NotificationModal';
9
- export { PermissionForm } from './chatbot/ui/PermissionForm';
10
- export { PresetMessages } from './chatbot/ui/PresetMessages';
11
- export { BerifyMeModal } from './chatbot/ui/BerifyMeModal';
12
-
13
- export type {
14
- AIModel,
15
- AITMetadata,
16
- ChatBotContextType,
17
- ChatBotProps,
18
- NovaError,
19
- NovaResponse,
20
- PresetMessage,
21
- ToolCall,
22
- ToolUse,
23
- } from './chatbot/types/ChatBotTypes';
24
-
25
- /** Alias for consumers migrating to the new package naming. */
26
- export { ChatBot as NxtlinqChatBot } from './chatbot/ChatBot';
@@ -1,22 +0,0 @@
1
- import type { AgentAssistantTheme } from '../types';
2
-
3
- export const defaultAgentAssistantTheme: AgentAssistantTheme = {
4
- colors: {
5
- background: '#f8fafc',
6
- surface: '#ffffff',
7
- border: '#e2e8f0',
8
- primary: '#2563eb',
9
- primaryText: '#ffffff',
10
- userBubble: '#2563eb',
11
- userText: '#ffffff',
12
- assistantBubble: '#f1f5f9',
13
- assistantText: '#0f172a',
14
- mutedText: '#64748b',
15
- error: '#dc2626',
16
- voiceActive: '#22c55e',
17
- voiceSpeaking: '#ec4899',
18
- },
19
- spacing: { xs: 4, sm: 8, md: 16, lg: 24 },
20
- radius: { bubble: 12, panel: 8, button: 8 },
21
- typography: { titleSize: 17, bodySize: 15, captionSize: 13 },
22
- };
package/src/types.ts DELETED
@@ -1,65 +0,0 @@
1
- import type { Message, ToolUse as CoreToolUse } from '@bytexbyte/nxtlinq-ai-agent-core-development';
2
- import type { NxtlinqAgentProviderProps } from '@bytexbyte/nxtlinq-ai-agent-web-development';
3
- import type { CSSProperties } from 'react';
4
-
5
- export type PresetMessage = {
6
- text: string;
7
- autoSend?: boolean;
8
- };
9
-
10
- export type AgentAssistantTheme = {
11
- colors: {
12
- background: string;
13
- surface: string;
14
- border: string;
15
- primary: string;
16
- primaryText: string;
17
- userBubble: string;
18
- userText: string;
19
- assistantBubble: string;
20
- assistantText: string;
21
- mutedText: string;
22
- error: string;
23
- voiceActive: string;
24
- voiceSpeaking: string;
25
- };
26
- spacing: {
27
- xs: number;
28
- sm: number;
29
- md: number;
30
- lg: number;
31
- };
32
- radius: {
33
- bubble: number;
34
- panel: number;
35
- button: number;
36
- };
37
- typography: {
38
- titleSize: number;
39
- bodySize: number;
40
- captionSize: number;
41
- };
42
- };
43
-
44
- export type NxtlinqAgentChatProps = Omit<NxtlinqAgentProviderProps, 'children'> & {
45
- children?: NxtlinqAgentProviderProps['children'];
46
- title?: string;
47
- placeholder?: string;
48
- presetMessages?: PresetMessage[];
49
- loadHistoryOnMount?: boolean;
50
- historyLast?: number;
51
- enableVoice?: boolean;
52
- enableFileUpload?: boolean;
53
- startInVoiceMode?: boolean;
54
- startWithMicMuted?: boolean;
55
- holdMicDuringAssistant?: boolean;
56
- theme?: Partial<AgentAssistantTheme>;
57
- style?: CSSProperties;
58
- headerStyle?: CSSProperties;
59
- onMessage?: NxtlinqAgentProviderProps['onMessage'];
60
- onError?: NxtlinqAgentProviderProps['onError'];
61
- onToolUse?: NxtlinqAgentProviderProps['onToolUse'];
62
- };
63
-
64
- export type ToolUse = CoreToolUse;
65
- export type { Message };