@copilotz/chat-ui 0.6.5 → 0.6.7

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
@@ -2,20 +2,20 @@ import React, { ReactNode } from 'react';
2
2
  import { Options, Components } from 'react-markdown';
3
3
 
4
4
  type MediaAttachment = {
5
- kind: 'image';
5
+ kind: "image";
6
6
  dataUrl: string;
7
7
  mimeType: string;
8
8
  fileName?: string;
9
9
  size?: number;
10
10
  } | {
11
- kind: 'audio';
11
+ kind: "audio";
12
12
  dataUrl: string;
13
13
  mimeType: string;
14
14
  durationMs?: number;
15
15
  fileName?: string;
16
16
  size?: number;
17
17
  } | {
18
- kind: 'video';
18
+ kind: "video";
19
19
  dataUrl: string;
20
20
  mimeType: string;
21
21
  durationMs?: number;
@@ -24,11 +24,11 @@ type MediaAttachment = {
24
24
  poster?: string;
25
25
  };
26
26
  type AudioAttachment = Extract<MediaAttachment, {
27
- kind: 'audio';
27
+ kind: "audio";
28
28
  }>;
29
- type VoiceComposerState = 'idle' | 'preparing' | 'waiting_for_speech' | 'listening' | 'finishing' | 'review' | 'sending' | 'error';
30
- type VoiceReviewMode = 'manual' | 'armed';
31
- type VoiceTranscriptMode = 'none' | 'final-only' | 'partial-and-final';
29
+ type VoiceComposerState = "idle" | "preparing" | "waiting_for_speech" | "listening" | "finishing" | "review" | "sending" | "error";
30
+ type VoiceReviewMode = "manual" | "armed";
31
+ type VoiceTranscriptMode = "none" | "final-only" | "partial-and-final";
32
32
  interface VoiceTranscript {
33
33
  partial?: string;
34
34
  final?: string;
@@ -61,12 +61,12 @@ interface ToolCall {
61
61
  name: string;
62
62
  arguments: Record<string, any>;
63
63
  result?: any;
64
- status: 'pending' | 'running' | 'completed' | 'failed';
64
+ status: "pending" | "running" | "completed" | "failed";
65
65
  startTime?: number;
66
66
  endTime?: number;
67
67
  }
68
- type ActivityDisplayMode = 'full' | 'summary' | 'hidden';
69
- type AssistantActivitySummaryKind = 'thinking' | 'working' | 'using_tools' | 'preparing_answer';
68
+ type ActivityDisplayMode = "full" | "summary" | "hidden";
69
+ type AssistantActivitySummaryKind = "thinking" | "working" | "using_tools" | "preparing_answer";
70
70
  interface AssistantActivitySummary {
71
71
  kind: AssistantActivitySummaryKind;
72
72
  toolName?: string;
@@ -81,7 +81,7 @@ interface AssistantActivityState {
81
81
  }
82
82
  interface ChatMessage {
83
83
  id: string;
84
- role: 'user' | 'assistant' | 'system';
84
+ role: "user" | "assistant" | "system";
85
85
  content: string;
86
86
  timestamp: number;
87
87
  attachments?: MediaAttachment[];
@@ -108,8 +108,8 @@ interface ChatThread {
108
108
  metadata?: Record<string, any>;
109
109
  }
110
110
  interface ChatMarkdownConfig {
111
- remarkPlugins?: Options['remarkPlugins'];
112
- rehypePlugins?: Options['rehypePlugins'];
111
+ remarkPlugins?: Options["remarkPlugins"];
112
+ rehypePlugins?: Options["rehypePlugins"];
113
113
  components?: Components;
114
114
  }
115
115
  interface ChatConfig {
@@ -124,7 +124,7 @@ interface ChatConfig {
124
124
  label?: string;
125
125
  hideIfSingle?: boolean;
126
126
  /** 'single' = classic single-agent dropdown (default). 'multi' = participants + target selectors. */
127
- mode?: 'single' | 'multi';
127
+ mode?: "single" | "multi";
128
128
  };
129
129
  labels?: {
130
130
  inputPlaceholder?: string;
@@ -217,7 +217,7 @@ interface ChatConfig {
217
217
  maxFileSize?: number;
218
218
  };
219
219
  ui?: {
220
- theme?: 'light' | 'dark' | 'auto';
220
+ theme?: "light" | "dark" | "auto";
221
221
  showTimestamps?: boolean;
222
222
  showAvatars?: boolean;
223
223
  compactMode?: boolean;
@@ -230,7 +230,7 @@ interface ChatConfig {
230
230
  };
231
231
  markdown?: ChatMarkdownConfig;
232
232
  voiceCompose?: {
233
- defaultMode?: 'text' | 'voice';
233
+ defaultMode?: "text" | "voice";
234
234
  reviewMode?: VoiceReviewMode;
235
235
  autoSendDelayMs?: number;
236
236
  persistComposer?: boolean;
@@ -253,6 +253,20 @@ interface ChatConfig {
253
253
  /** Additional actions to render in the header */
254
254
  headerActions?: ReactNode;
255
255
  }
256
+ interface ChatUserMenuItem {
257
+ id: string;
258
+ label: string;
259
+ icon?: ReactNode;
260
+ onSelect?: () => void;
261
+ variant?: "default" | "destructive";
262
+ checked?: boolean;
263
+ disabled?: boolean;
264
+ }
265
+ interface ChatUserMenuSection {
266
+ id: string;
267
+ label?: string;
268
+ items: ChatUserMenuItem[];
269
+ }
256
270
  interface StateCallback<T = unknown> {
257
271
  setState: (state: T | ((prev: T) => T)) => void;
258
272
  getState: () => T;
@@ -272,7 +286,7 @@ interface ChatCallbacks {
272
286
  onAttachmentRemove?: (attachmentIndex: number, callback?: StateCallback<ChatState>) => void;
273
287
  onViewProfile?: () => void;
274
288
  onOpenSettings?: () => void;
275
- onThemeChange?: (theme: 'light' | 'dark' | 'system') => void;
289
+ onThemeChange?: (theme: "light" | "dark" | "system") => void;
276
290
  onLogout?: () => void;
277
291
  }
278
292
  interface ChatV2Props {
@@ -281,6 +295,9 @@ interface ChatV2Props {
281
295
  currentThreadId?: string | null;
282
296
  config?: ChatConfig;
283
297
  sidebar?: ReactNode;
298
+ userMenuSections?: ChatUserMenuSection[];
299
+ /** @deprecated Prefer userMenuSections for native menu composition */
300
+ userMenuAdditionalItems?: ReactNode;
284
301
  isGenerating?: boolean;
285
302
  isMessagesLoading?: boolean;
286
303
  isLoadingOlderMessages?: boolean;
@@ -311,7 +328,7 @@ interface ChatV2Props {
311
328
  messageSuggestions?: Record<string, string[]>;
312
329
  enabledFeatures?: string[];
313
330
  className?: string;
314
- onAddMemory?: (content: string, category?: MemoryItem['category']) => void;
331
+ onAddMemory?: (content: string, category?: MemoryItem["category"]) => void;
315
332
  onUpdateMemory?: (memoryId: string, content: string) => void;
316
333
  onDeleteMemory?: (memoryId: string) => void;
317
334
  /**
@@ -345,7 +362,7 @@ interface AgentOption {
345
362
  /** Custom color for multi-agent display. Auto-assigned if not provided. */
346
363
  color?: string;
347
364
  }
348
- type MessageAction = 'copy' | 'edit' | 'delete' | 'regenerate' | 'retry';
365
+ type MessageAction = "copy" | "edit" | "delete" | "regenerate" | "retry";
349
366
  interface MessageActionEvent {
350
367
  action: MessageAction;
351
368
  messageId: string;
@@ -354,7 +371,7 @@ interface MessageActionEvent {
354
371
  interface FileUploadProgress {
355
372
  fileName: string;
356
373
  progress: number;
357
- status: 'uploading' | 'completed' | 'failed';
374
+ status: "uploading" | "completed" | "failed";
358
375
  }
359
376
  interface StreamingUpdate {
360
377
  messageId: string;
@@ -365,14 +382,14 @@ interface UserCustomField {
365
382
  key: string;
366
383
  label: string;
367
384
  value: string | number | boolean | null | undefined;
368
- type?: 'text' | 'email' | 'phone' | 'url' | 'date' | 'number' | 'boolean';
385
+ type?: "text" | "email" | "phone" | "url" | "date" | "number" | "boolean";
369
386
  icon?: ReactNode;
370
387
  }
371
388
  interface MemoryItem {
372
389
  id: string;
373
390
  content: string;
374
- category?: 'preference' | 'fact' | 'goal' | 'context' | 'other';
375
- source: 'agent' | 'user';
391
+ category?: "preference" | "fact" | "goal" | "context" | "other";
392
+ source: "agent" | "user";
376
393
  createdAt: string;
377
394
  updatedAt?: string;
378
395
  }
@@ -410,4 +427,4 @@ declare function useChatUserContext(): ChatUserContextValue;
410
427
  declare const defaultChatConfig: Required<ChatConfig>;
411
428
  declare function mergeConfig(_baseConfig: ChatConfig, userConfig?: Partial<ChatConfig>): Required<ChatConfig>;
412
429
 
413
- export { type ActivityDisplayMode, type AgentOption, AssistantActivity, type AssistantActivityState, type AssistantActivitySummary, type AssistantActivitySummaryKind, type AudioAttachment, type ChatCallbacks, type ChatConfig, type ChatMarkdownConfig, type ChatMessage, type ChatState, type ChatThread, ChatUI, type ChatUserContext, ChatUserContextProvider, type ChatV2Props, type CreateVoiceProvider, type FileUploadProgress, type MediaAttachment, type MemoryItem, type MessageAction, type MessageActionEvent, type StateCallback, type StreamingUpdate, type ToolCall, type UserCustomField, type VoiceComposerState, type VoiceProvider, type VoiceProviderHandlers, type VoiceProviderOptions, type VoiceReviewMode, type VoiceSegment, type VoiceTranscript, type VoiceTranscriptMode, defaultChatConfig, mergeConfig, useChatUserContext };
430
+ export { type ActivityDisplayMode, type AgentOption, AssistantActivity, type AssistantActivityState, type AssistantActivitySummary, type AssistantActivitySummaryKind, type AudioAttachment, type ChatCallbacks, type ChatConfig, type ChatMarkdownConfig, type ChatMessage, type ChatState, type ChatThread, ChatUI, type ChatUserContext, ChatUserContextProvider, type ChatUserMenuItem, type ChatUserMenuSection, type ChatV2Props, type CreateVoiceProvider, type FileUploadProgress, type MediaAttachment, type MemoryItem, type MessageAction, type MessageActionEvent, type StateCallback, type StreamingUpdate, type ToolCall, type UserCustomField, type VoiceComposerState, type VoiceProvider, type VoiceProviderHandlers, type VoiceProviderOptions, type VoiceReviewMode, type VoiceSegment, type VoiceTranscript, type VoiceTranscriptMode, defaultChatConfig, mergeConfig, useChatUserContext };
package/dist/index.d.ts CHANGED
@@ -2,20 +2,20 @@ import React, { ReactNode } from 'react';
2
2
  import { Options, Components } from 'react-markdown';
3
3
 
4
4
  type MediaAttachment = {
5
- kind: 'image';
5
+ kind: "image";
6
6
  dataUrl: string;
7
7
  mimeType: string;
8
8
  fileName?: string;
9
9
  size?: number;
10
10
  } | {
11
- kind: 'audio';
11
+ kind: "audio";
12
12
  dataUrl: string;
13
13
  mimeType: string;
14
14
  durationMs?: number;
15
15
  fileName?: string;
16
16
  size?: number;
17
17
  } | {
18
- kind: 'video';
18
+ kind: "video";
19
19
  dataUrl: string;
20
20
  mimeType: string;
21
21
  durationMs?: number;
@@ -24,11 +24,11 @@ type MediaAttachment = {
24
24
  poster?: string;
25
25
  };
26
26
  type AudioAttachment = Extract<MediaAttachment, {
27
- kind: 'audio';
27
+ kind: "audio";
28
28
  }>;
29
- type VoiceComposerState = 'idle' | 'preparing' | 'waiting_for_speech' | 'listening' | 'finishing' | 'review' | 'sending' | 'error';
30
- type VoiceReviewMode = 'manual' | 'armed';
31
- type VoiceTranscriptMode = 'none' | 'final-only' | 'partial-and-final';
29
+ type VoiceComposerState = "idle" | "preparing" | "waiting_for_speech" | "listening" | "finishing" | "review" | "sending" | "error";
30
+ type VoiceReviewMode = "manual" | "armed";
31
+ type VoiceTranscriptMode = "none" | "final-only" | "partial-and-final";
32
32
  interface VoiceTranscript {
33
33
  partial?: string;
34
34
  final?: string;
@@ -61,12 +61,12 @@ interface ToolCall {
61
61
  name: string;
62
62
  arguments: Record<string, any>;
63
63
  result?: any;
64
- status: 'pending' | 'running' | 'completed' | 'failed';
64
+ status: "pending" | "running" | "completed" | "failed";
65
65
  startTime?: number;
66
66
  endTime?: number;
67
67
  }
68
- type ActivityDisplayMode = 'full' | 'summary' | 'hidden';
69
- type AssistantActivitySummaryKind = 'thinking' | 'working' | 'using_tools' | 'preparing_answer';
68
+ type ActivityDisplayMode = "full" | "summary" | "hidden";
69
+ type AssistantActivitySummaryKind = "thinking" | "working" | "using_tools" | "preparing_answer";
70
70
  interface AssistantActivitySummary {
71
71
  kind: AssistantActivitySummaryKind;
72
72
  toolName?: string;
@@ -81,7 +81,7 @@ interface AssistantActivityState {
81
81
  }
82
82
  interface ChatMessage {
83
83
  id: string;
84
- role: 'user' | 'assistant' | 'system';
84
+ role: "user" | "assistant" | "system";
85
85
  content: string;
86
86
  timestamp: number;
87
87
  attachments?: MediaAttachment[];
@@ -108,8 +108,8 @@ interface ChatThread {
108
108
  metadata?: Record<string, any>;
109
109
  }
110
110
  interface ChatMarkdownConfig {
111
- remarkPlugins?: Options['remarkPlugins'];
112
- rehypePlugins?: Options['rehypePlugins'];
111
+ remarkPlugins?: Options["remarkPlugins"];
112
+ rehypePlugins?: Options["rehypePlugins"];
113
113
  components?: Components;
114
114
  }
115
115
  interface ChatConfig {
@@ -124,7 +124,7 @@ interface ChatConfig {
124
124
  label?: string;
125
125
  hideIfSingle?: boolean;
126
126
  /** 'single' = classic single-agent dropdown (default). 'multi' = participants + target selectors. */
127
- mode?: 'single' | 'multi';
127
+ mode?: "single" | "multi";
128
128
  };
129
129
  labels?: {
130
130
  inputPlaceholder?: string;
@@ -217,7 +217,7 @@ interface ChatConfig {
217
217
  maxFileSize?: number;
218
218
  };
219
219
  ui?: {
220
- theme?: 'light' | 'dark' | 'auto';
220
+ theme?: "light" | "dark" | "auto";
221
221
  showTimestamps?: boolean;
222
222
  showAvatars?: boolean;
223
223
  compactMode?: boolean;
@@ -230,7 +230,7 @@ interface ChatConfig {
230
230
  };
231
231
  markdown?: ChatMarkdownConfig;
232
232
  voiceCompose?: {
233
- defaultMode?: 'text' | 'voice';
233
+ defaultMode?: "text" | "voice";
234
234
  reviewMode?: VoiceReviewMode;
235
235
  autoSendDelayMs?: number;
236
236
  persistComposer?: boolean;
@@ -253,6 +253,20 @@ interface ChatConfig {
253
253
  /** Additional actions to render in the header */
254
254
  headerActions?: ReactNode;
255
255
  }
256
+ interface ChatUserMenuItem {
257
+ id: string;
258
+ label: string;
259
+ icon?: ReactNode;
260
+ onSelect?: () => void;
261
+ variant?: "default" | "destructive";
262
+ checked?: boolean;
263
+ disabled?: boolean;
264
+ }
265
+ interface ChatUserMenuSection {
266
+ id: string;
267
+ label?: string;
268
+ items: ChatUserMenuItem[];
269
+ }
256
270
  interface StateCallback<T = unknown> {
257
271
  setState: (state: T | ((prev: T) => T)) => void;
258
272
  getState: () => T;
@@ -272,7 +286,7 @@ interface ChatCallbacks {
272
286
  onAttachmentRemove?: (attachmentIndex: number, callback?: StateCallback<ChatState>) => void;
273
287
  onViewProfile?: () => void;
274
288
  onOpenSettings?: () => void;
275
- onThemeChange?: (theme: 'light' | 'dark' | 'system') => void;
289
+ onThemeChange?: (theme: "light" | "dark" | "system") => void;
276
290
  onLogout?: () => void;
277
291
  }
278
292
  interface ChatV2Props {
@@ -281,6 +295,9 @@ interface ChatV2Props {
281
295
  currentThreadId?: string | null;
282
296
  config?: ChatConfig;
283
297
  sidebar?: ReactNode;
298
+ userMenuSections?: ChatUserMenuSection[];
299
+ /** @deprecated Prefer userMenuSections for native menu composition */
300
+ userMenuAdditionalItems?: ReactNode;
284
301
  isGenerating?: boolean;
285
302
  isMessagesLoading?: boolean;
286
303
  isLoadingOlderMessages?: boolean;
@@ -311,7 +328,7 @@ interface ChatV2Props {
311
328
  messageSuggestions?: Record<string, string[]>;
312
329
  enabledFeatures?: string[];
313
330
  className?: string;
314
- onAddMemory?: (content: string, category?: MemoryItem['category']) => void;
331
+ onAddMemory?: (content: string, category?: MemoryItem["category"]) => void;
315
332
  onUpdateMemory?: (memoryId: string, content: string) => void;
316
333
  onDeleteMemory?: (memoryId: string) => void;
317
334
  /**
@@ -345,7 +362,7 @@ interface AgentOption {
345
362
  /** Custom color for multi-agent display. Auto-assigned if not provided. */
346
363
  color?: string;
347
364
  }
348
- type MessageAction = 'copy' | 'edit' | 'delete' | 'regenerate' | 'retry';
365
+ type MessageAction = "copy" | "edit" | "delete" | "regenerate" | "retry";
349
366
  interface MessageActionEvent {
350
367
  action: MessageAction;
351
368
  messageId: string;
@@ -354,7 +371,7 @@ interface MessageActionEvent {
354
371
  interface FileUploadProgress {
355
372
  fileName: string;
356
373
  progress: number;
357
- status: 'uploading' | 'completed' | 'failed';
374
+ status: "uploading" | "completed" | "failed";
358
375
  }
359
376
  interface StreamingUpdate {
360
377
  messageId: string;
@@ -365,14 +382,14 @@ interface UserCustomField {
365
382
  key: string;
366
383
  label: string;
367
384
  value: string | number | boolean | null | undefined;
368
- type?: 'text' | 'email' | 'phone' | 'url' | 'date' | 'number' | 'boolean';
385
+ type?: "text" | "email" | "phone" | "url" | "date" | "number" | "boolean";
369
386
  icon?: ReactNode;
370
387
  }
371
388
  interface MemoryItem {
372
389
  id: string;
373
390
  content: string;
374
- category?: 'preference' | 'fact' | 'goal' | 'context' | 'other';
375
- source: 'agent' | 'user';
391
+ category?: "preference" | "fact" | "goal" | "context" | "other";
392
+ source: "agent" | "user";
376
393
  createdAt: string;
377
394
  updatedAt?: string;
378
395
  }
@@ -410,4 +427,4 @@ declare function useChatUserContext(): ChatUserContextValue;
410
427
  declare const defaultChatConfig: Required<ChatConfig>;
411
428
  declare function mergeConfig(_baseConfig: ChatConfig, userConfig?: Partial<ChatConfig>): Required<ChatConfig>;
412
429
 
413
- export { type ActivityDisplayMode, type AgentOption, AssistantActivity, type AssistantActivityState, type AssistantActivitySummary, type AssistantActivitySummaryKind, type AudioAttachment, type ChatCallbacks, type ChatConfig, type ChatMarkdownConfig, type ChatMessage, type ChatState, type ChatThread, ChatUI, type ChatUserContext, ChatUserContextProvider, type ChatV2Props, type CreateVoiceProvider, type FileUploadProgress, type MediaAttachment, type MemoryItem, type MessageAction, type MessageActionEvent, type StateCallback, type StreamingUpdate, type ToolCall, type UserCustomField, type VoiceComposerState, type VoiceProvider, type VoiceProviderHandlers, type VoiceProviderOptions, type VoiceReviewMode, type VoiceSegment, type VoiceTranscript, type VoiceTranscriptMode, defaultChatConfig, mergeConfig, useChatUserContext };
430
+ export { type ActivityDisplayMode, type AgentOption, AssistantActivity, type AssistantActivityState, type AssistantActivitySummary, type AssistantActivitySummaryKind, type AudioAttachment, type ChatCallbacks, type ChatConfig, type ChatMarkdownConfig, type ChatMessage, type ChatState, type ChatThread, ChatUI, type ChatUserContext, ChatUserContextProvider, type ChatUserMenuItem, type ChatUserMenuSection, type ChatV2Props, type CreateVoiceProvider, type FileUploadProgress, type MediaAttachment, type MemoryItem, type MessageAction, type MessageActionEvent, type StateCallback, type StreamingUpdate, type ToolCall, type UserCustomField, type VoiceComposerState, type VoiceProvider, type VoiceProviderHandlers, type VoiceProviderOptions, type VoiceReviewMode, type VoiceSegment, type VoiceTranscript, type VoiceTranscriptMode, defaultChatConfig, mergeConfig, useChatUserContext };