@copilotz/chat-ui 0.1.31 → 0.1.33

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/index.d.cts CHANGED
@@ -25,6 +25,38 @@ type MediaAttachment = {
25
25
  size?: number;
26
26
  poster?: string;
27
27
  };
28
+ type AudioAttachment = Extract<MediaAttachment, {
29
+ kind: 'audio';
30
+ }>;
31
+ type VoiceComposerState = 'idle' | 'preparing' | 'waiting_for_speech' | 'listening' | 'finishing' | 'review' | 'sending' | 'error';
32
+ type VoiceTranscriptMode = 'none' | 'final-only' | 'partial-and-final';
33
+ interface VoiceTranscript {
34
+ partial?: string;
35
+ final?: string;
36
+ }
37
+ interface VoiceSegment {
38
+ attachment: AudioAttachment;
39
+ transcript?: VoiceTranscript;
40
+ metadata?: Record<string, unknown>;
41
+ }
42
+ interface VoiceProviderHandlers {
43
+ onStateChange?: (state: VoiceComposerState) => void;
44
+ onAudioLevelChange?: (level: number) => void;
45
+ onDurationChange?: (durationMs: number) => void;
46
+ onTranscriptChange?: (transcript: VoiceTranscript) => void;
47
+ onSegmentReady?: (segment: VoiceSegment) => void;
48
+ onError?: (error: Error) => void;
49
+ }
50
+ interface VoiceProviderOptions {
51
+ maxRecordingMs?: number;
52
+ }
53
+ interface VoiceProvider {
54
+ start: () => Promise<void>;
55
+ stop: () => Promise<void>;
56
+ cancel: () => Promise<void> | void;
57
+ destroy: () => Promise<void> | void;
58
+ }
59
+ type CreateVoiceProvider = (handlers: VoiceProviderHandlers, options?: VoiceProviderOptions) => VoiceProvider | Promise<VoiceProvider>;
28
60
  interface ToolCall {
29
61
  id: string;
30
62
  name: string;
@@ -88,6 +120,26 @@ interface ChatConfig {
88
120
  attachFileTooltip?: string;
89
121
  recordAudio?: string;
90
122
  recordAudioTooltip?: string;
123
+ voiceEnter?: string;
124
+ voiceExit?: string;
125
+ voiceTitle?: string;
126
+ voiceIdle?: string;
127
+ voicePreparing?: string;
128
+ voiceWaiting?: string;
129
+ voiceListening?: string;
130
+ voiceFinishing?: string;
131
+ voiceReview?: string;
132
+ voiceSending?: string;
133
+ voiceStart?: string;
134
+ voiceStop?: string;
135
+ voiceSendNow?: string;
136
+ voiceCancel?: string;
137
+ voiceDiscard?: string;
138
+ voiceRecordAgain?: string;
139
+ voiceAutoSendIn?: string;
140
+ voiceTranscriptPending?: string;
141
+ voicePermissionDenied?: string;
142
+ voiceCaptureError?: string;
91
143
  exportData?: string;
92
144
  importData?: string;
93
145
  clearAll?: string;
@@ -147,6 +199,16 @@ interface ChatConfig {
147
199
  longMessageChunkChars?: number;
148
200
  renderUserMarkdown?: boolean;
149
201
  };
202
+ voiceCompose?: {
203
+ enabled?: boolean;
204
+ defaultMode?: 'text' | 'voice';
205
+ autoSendDelayMs?: number;
206
+ persistComposer?: boolean;
207
+ showTranscriptPreview?: boolean;
208
+ transcriptMode?: VoiceTranscriptMode;
209
+ maxRecordingMs?: number;
210
+ createProvider?: CreateVoiceProvider;
211
+ };
150
212
  customComponent?: {
151
213
  label?: string;
152
214
  icon?: ReactNode;
@@ -607,4 +669,4 @@ declare const chatUtils: {
607
669
  generateThreadTitle: (firstMessage: string) => string;
608
670
  };
609
671
 
610
- export { type AgentOption, type ChatCallbacks, type ChatConfig, ChatHeader, type ChatHeaderConfig, type ChatHeaderProps, ChatInput, type ChatMessage, type ChatState, type ChatThread, ChatUI, type ChatUserContext, ChatUserContextProvider, type ChatV2Props, type CustomField, type FileUploadProgress, type MediaAttachment, type MemoryItem, Message, type MessageAction, type MessageActionEvent, Sidebar, type SidebarConfig, type SidebarProps, type StateCallback, type StreamingUpdate, ThreadManager, type ToolCall, type UserCustomField, UserMenu, type UserMenuCallbacks, type UserMenuConfig, type UserMenuProps, type UserMenuUser, UserProfile, type UserProfileConfig, type UserProfileProps, type UserProfileUser, chatConfigPresets, chatUtils, cn, configUtils, createObjectUrlFromDataUrl, defaultChatConfig, featureFlags, formatDate, mergeConfig, themeUtils, useChatUserContext, validateConfig };
672
+ export { type AgentOption, type AudioAttachment, type ChatCallbacks, type ChatConfig, ChatHeader, type ChatHeaderConfig, type ChatHeaderProps, ChatInput, type ChatMessage, type ChatState, type ChatThread, ChatUI, type ChatUserContext, ChatUserContextProvider, type ChatV2Props, type CreateVoiceProvider, type CustomField, type FileUploadProgress, type MediaAttachment, type MemoryItem, Message, type MessageAction, type MessageActionEvent, Sidebar, type SidebarConfig, type SidebarProps, type StateCallback, type StreamingUpdate, ThreadManager, type ToolCall, type UserCustomField, UserMenu, type UserMenuCallbacks, type UserMenuConfig, type UserMenuProps, type UserMenuUser, UserProfile, type UserProfileConfig, type UserProfileProps, type UserProfileUser, type VoiceComposerState, type VoiceProvider, type VoiceProviderHandlers, type VoiceProviderOptions, type VoiceSegment, type VoiceTranscript, type VoiceTranscriptMode, chatConfigPresets, chatUtils, cn, configUtils, createObjectUrlFromDataUrl, defaultChatConfig, featureFlags, formatDate, mergeConfig, themeUtils, useChatUserContext, validateConfig };
package/dist/index.d.ts CHANGED
@@ -25,6 +25,38 @@ type MediaAttachment = {
25
25
  size?: number;
26
26
  poster?: string;
27
27
  };
28
+ type AudioAttachment = Extract<MediaAttachment, {
29
+ kind: 'audio';
30
+ }>;
31
+ type VoiceComposerState = 'idle' | 'preparing' | 'waiting_for_speech' | 'listening' | 'finishing' | 'review' | 'sending' | 'error';
32
+ type VoiceTranscriptMode = 'none' | 'final-only' | 'partial-and-final';
33
+ interface VoiceTranscript {
34
+ partial?: string;
35
+ final?: string;
36
+ }
37
+ interface VoiceSegment {
38
+ attachment: AudioAttachment;
39
+ transcript?: VoiceTranscript;
40
+ metadata?: Record<string, unknown>;
41
+ }
42
+ interface VoiceProviderHandlers {
43
+ onStateChange?: (state: VoiceComposerState) => void;
44
+ onAudioLevelChange?: (level: number) => void;
45
+ onDurationChange?: (durationMs: number) => void;
46
+ onTranscriptChange?: (transcript: VoiceTranscript) => void;
47
+ onSegmentReady?: (segment: VoiceSegment) => void;
48
+ onError?: (error: Error) => void;
49
+ }
50
+ interface VoiceProviderOptions {
51
+ maxRecordingMs?: number;
52
+ }
53
+ interface VoiceProvider {
54
+ start: () => Promise<void>;
55
+ stop: () => Promise<void>;
56
+ cancel: () => Promise<void> | void;
57
+ destroy: () => Promise<void> | void;
58
+ }
59
+ type CreateVoiceProvider = (handlers: VoiceProviderHandlers, options?: VoiceProviderOptions) => VoiceProvider | Promise<VoiceProvider>;
28
60
  interface ToolCall {
29
61
  id: string;
30
62
  name: string;
@@ -88,6 +120,26 @@ interface ChatConfig {
88
120
  attachFileTooltip?: string;
89
121
  recordAudio?: string;
90
122
  recordAudioTooltip?: string;
123
+ voiceEnter?: string;
124
+ voiceExit?: string;
125
+ voiceTitle?: string;
126
+ voiceIdle?: string;
127
+ voicePreparing?: string;
128
+ voiceWaiting?: string;
129
+ voiceListening?: string;
130
+ voiceFinishing?: string;
131
+ voiceReview?: string;
132
+ voiceSending?: string;
133
+ voiceStart?: string;
134
+ voiceStop?: string;
135
+ voiceSendNow?: string;
136
+ voiceCancel?: string;
137
+ voiceDiscard?: string;
138
+ voiceRecordAgain?: string;
139
+ voiceAutoSendIn?: string;
140
+ voiceTranscriptPending?: string;
141
+ voicePermissionDenied?: string;
142
+ voiceCaptureError?: string;
91
143
  exportData?: string;
92
144
  importData?: string;
93
145
  clearAll?: string;
@@ -147,6 +199,16 @@ interface ChatConfig {
147
199
  longMessageChunkChars?: number;
148
200
  renderUserMarkdown?: boolean;
149
201
  };
202
+ voiceCompose?: {
203
+ enabled?: boolean;
204
+ defaultMode?: 'text' | 'voice';
205
+ autoSendDelayMs?: number;
206
+ persistComposer?: boolean;
207
+ showTranscriptPreview?: boolean;
208
+ transcriptMode?: VoiceTranscriptMode;
209
+ maxRecordingMs?: number;
210
+ createProvider?: CreateVoiceProvider;
211
+ };
150
212
  customComponent?: {
151
213
  label?: string;
152
214
  icon?: ReactNode;
@@ -607,4 +669,4 @@ declare const chatUtils: {
607
669
  generateThreadTitle: (firstMessage: string) => string;
608
670
  };
609
671
 
610
- export { type AgentOption, type ChatCallbacks, type ChatConfig, ChatHeader, type ChatHeaderConfig, type ChatHeaderProps, ChatInput, type ChatMessage, type ChatState, type ChatThread, ChatUI, type ChatUserContext, ChatUserContextProvider, type ChatV2Props, type CustomField, type FileUploadProgress, type MediaAttachment, type MemoryItem, Message, type MessageAction, type MessageActionEvent, Sidebar, type SidebarConfig, type SidebarProps, type StateCallback, type StreamingUpdate, ThreadManager, type ToolCall, type UserCustomField, UserMenu, type UserMenuCallbacks, type UserMenuConfig, type UserMenuProps, type UserMenuUser, UserProfile, type UserProfileConfig, type UserProfileProps, type UserProfileUser, chatConfigPresets, chatUtils, cn, configUtils, createObjectUrlFromDataUrl, defaultChatConfig, featureFlags, formatDate, mergeConfig, themeUtils, useChatUserContext, validateConfig };
672
+ export { type AgentOption, type AudioAttachment, type ChatCallbacks, type ChatConfig, ChatHeader, type ChatHeaderConfig, type ChatHeaderProps, ChatInput, type ChatMessage, type ChatState, type ChatThread, ChatUI, type ChatUserContext, ChatUserContextProvider, type ChatV2Props, type CreateVoiceProvider, type CustomField, type FileUploadProgress, type MediaAttachment, type MemoryItem, Message, type MessageAction, type MessageActionEvent, Sidebar, type SidebarConfig, type SidebarProps, type StateCallback, type StreamingUpdate, ThreadManager, type ToolCall, type UserCustomField, UserMenu, type UserMenuCallbacks, type UserMenuConfig, type UserMenuProps, type UserMenuUser, UserProfile, type UserProfileConfig, type UserProfileProps, type UserProfileUser, type VoiceComposerState, type VoiceProvider, type VoiceProviderHandlers, type VoiceProviderOptions, type VoiceSegment, type VoiceTranscript, type VoiceTranscriptMode, chatConfigPresets, chatUtils, cn, configUtils, createObjectUrlFromDataUrl, defaultChatConfig, featureFlags, formatDate, mergeConfig, themeUtils, useChatUserContext, validateConfig };