@copilotz/chat-ui 0.7.1 → 0.7.3
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.cjs +714 -743
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +69 -26
- package/dist/index.d.ts +69 -26
- package/dist/index.js +842 -873
- package/dist/index.js.map +1 -1
- package/dist/styles.css +24 -60
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -65,19 +65,41 @@ interface ToolCall {
|
|
|
65
65
|
startTime?: number;
|
|
66
66
|
endTime?: number;
|
|
67
67
|
}
|
|
68
|
-
type
|
|
69
|
-
type
|
|
70
|
-
interface
|
|
71
|
-
|
|
68
|
+
type AssistantActivityKind = "thinking" | "tool" | "answering";
|
|
69
|
+
type AssistantActivityStatus = "active" | "complete" | "failed";
|
|
70
|
+
interface AssistantActivityItem {
|
|
71
|
+
id: string;
|
|
72
|
+
kind: AssistantActivityKind;
|
|
73
|
+
status: AssistantActivityStatus;
|
|
72
74
|
toolName?: string;
|
|
73
|
-
|
|
75
|
+
startedAt?: number;
|
|
76
|
+
completedAt?: number;
|
|
77
|
+
details?: {
|
|
78
|
+
reasoning?: string;
|
|
79
|
+
toolCall?: ToolCall;
|
|
80
|
+
result?: any;
|
|
81
|
+
error?: string;
|
|
82
|
+
};
|
|
74
83
|
}
|
|
75
|
-
interface
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
84
|
+
interface AssistantActivityBlock {
|
|
85
|
+
items: AssistantActivityItem[];
|
|
86
|
+
}
|
|
87
|
+
interface ChatSender {
|
|
88
|
+
/** Copilotz sender type from the message domain. */
|
|
89
|
+
type: "user" | "agent" | "tool" | "system";
|
|
90
|
+
/** Conversational identity: user external id, agent id, or tool owner id. */
|
|
91
|
+
id: string;
|
|
92
|
+
/** Human-readable display label. */
|
|
93
|
+
name: string;
|
|
94
|
+
/** Backend participant/node id when known. Never used as display text. */
|
|
95
|
+
participantId?: string;
|
|
96
|
+
/** Original external id when distinct from id. */
|
|
97
|
+
externalId?: string;
|
|
98
|
+
/** Agent config id for agent/tool senders when known. */
|
|
99
|
+
agentId?: string;
|
|
100
|
+
avatarUrl?: string;
|
|
101
|
+
/** Custom color for participant display. */
|
|
102
|
+
color?: string;
|
|
81
103
|
}
|
|
82
104
|
interface ChatMessage {
|
|
83
105
|
id: string;
|
|
@@ -92,11 +114,9 @@ interface ChatMessage {
|
|
|
92
114
|
editedAt?: number;
|
|
93
115
|
metadata?: Record<string, any>;
|
|
94
116
|
/** Unified assistant activity state for live rendering and history hydration */
|
|
95
|
-
activity?:
|
|
96
|
-
/**
|
|
97
|
-
|
|
98
|
-
/** Agent ID of the sender (for multi-agent conversations) */
|
|
99
|
-
senderAgentId?: string;
|
|
117
|
+
activity?: AssistantActivityBlock;
|
|
118
|
+
/** Canonical frontend sender identity. Prefer this over legacy sender fields. */
|
|
119
|
+
sender?: ChatSender;
|
|
100
120
|
}
|
|
101
121
|
interface ChatThread {
|
|
102
122
|
id: string;
|
|
@@ -191,12 +211,13 @@ interface ChatConfig {
|
|
|
191
211
|
footerLabel?: string;
|
|
192
212
|
daysAgo?: string;
|
|
193
213
|
inputHelpText?: string;
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
214
|
+
activityThinkingActive?: string;
|
|
215
|
+
activityThinkingComplete?: string;
|
|
216
|
+
activityToolActive?: string;
|
|
217
|
+
activityToolComplete?: string;
|
|
218
|
+
activityToolFailed?: string;
|
|
219
|
+
activityAnsweringActive?: string;
|
|
220
|
+
activityAnsweringComplete?: string;
|
|
200
221
|
activityShowDetails?: string;
|
|
201
222
|
activityHideDetails?: string;
|
|
202
223
|
defaultThreadName?: string;
|
|
@@ -212,7 +233,8 @@ interface ChatConfig {
|
|
|
212
233
|
enableMessageEditing?: boolean;
|
|
213
234
|
enableMessageCopy?: boolean;
|
|
214
235
|
enableRegeneration?: boolean;
|
|
215
|
-
|
|
236
|
+
showActivity?: boolean;
|
|
237
|
+
showActivityDetails?: boolean;
|
|
216
238
|
maxAttachments?: number;
|
|
217
239
|
maxFileSize?: number;
|
|
218
240
|
};
|
|
@@ -406,12 +428,33 @@ declare const ChatUI: React.FC<ChatV2Props>;
|
|
|
406
428
|
|
|
407
429
|
type ActivityLabels = ChatConfig['labels'];
|
|
408
430
|
interface AssistantActivityProps {
|
|
409
|
-
activity?:
|
|
410
|
-
|
|
431
|
+
activity?: AssistantActivityBlock;
|
|
432
|
+
showActivity?: boolean;
|
|
433
|
+
showActivityDetails?: boolean;
|
|
411
434
|
labels?: ActivityLabels;
|
|
412
435
|
}
|
|
413
436
|
declare const AssistantActivity: React.NamedExoticComponent<AssistantActivityProps>;
|
|
414
437
|
|
|
438
|
+
interface MessageSenderDisplay {
|
|
439
|
+
name: string;
|
|
440
|
+
avatar: React.ReactNode;
|
|
441
|
+
color?: string;
|
|
442
|
+
}
|
|
443
|
+
declare const resolveMessageSenderDisplay: ({ sender, fallbackName, fallbackAvatar, fallbackAvatarUrl, compactMode, }: {
|
|
444
|
+
sender?: ChatSender;
|
|
445
|
+
fallbackName: string;
|
|
446
|
+
fallbackAvatar?: React.ReactNode;
|
|
447
|
+
fallbackAvatarUrl?: string;
|
|
448
|
+
compactMode?: boolean;
|
|
449
|
+
}) => MessageSenderDisplay;
|
|
450
|
+
declare const MessageSenderAvatar: React.FC<{
|
|
451
|
+
sender?: ChatSender;
|
|
452
|
+
fallbackName: string;
|
|
453
|
+
fallbackAvatar?: React.ReactNode;
|
|
454
|
+
fallbackAvatarUrl?: string;
|
|
455
|
+
compactMode?: boolean;
|
|
456
|
+
}>;
|
|
457
|
+
|
|
415
458
|
type Setter = (next: Partial<ChatUserContext> | ((prev: ChatUserContext) => Partial<ChatUserContext>)) => void;
|
|
416
459
|
interface ChatUserContextValue {
|
|
417
460
|
context: ChatUserContext;
|
|
@@ -427,4 +470,4 @@ declare function useChatUserContext(): ChatUserContextValue;
|
|
|
427
470
|
declare const defaultChatConfig: Required<ChatConfig>;
|
|
428
471
|
declare function mergeConfig(_baseConfig: ChatConfig, userConfig?: Partial<ChatConfig>): Required<ChatConfig>;
|
|
429
472
|
|
|
430
|
-
export { type
|
|
473
|
+
export { type AgentOption, AssistantActivity, type AssistantActivityBlock, type AssistantActivityItem, type AssistantActivityKind, type AssistantActivityStatus, type AudioAttachment, type ChatCallbacks, type ChatConfig, type ChatMarkdownConfig, type ChatMessage, type ChatSender, 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, MessageSenderAvatar, 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, resolveMessageSenderDisplay, useChatUserContext };
|
package/dist/index.d.ts
CHANGED
|
@@ -65,19 +65,41 @@ interface ToolCall {
|
|
|
65
65
|
startTime?: number;
|
|
66
66
|
endTime?: number;
|
|
67
67
|
}
|
|
68
|
-
type
|
|
69
|
-
type
|
|
70
|
-
interface
|
|
71
|
-
|
|
68
|
+
type AssistantActivityKind = "thinking" | "tool" | "answering";
|
|
69
|
+
type AssistantActivityStatus = "active" | "complete" | "failed";
|
|
70
|
+
interface AssistantActivityItem {
|
|
71
|
+
id: string;
|
|
72
|
+
kind: AssistantActivityKind;
|
|
73
|
+
status: AssistantActivityStatus;
|
|
72
74
|
toolName?: string;
|
|
73
|
-
|
|
75
|
+
startedAt?: number;
|
|
76
|
+
completedAt?: number;
|
|
77
|
+
details?: {
|
|
78
|
+
reasoning?: string;
|
|
79
|
+
toolCall?: ToolCall;
|
|
80
|
+
result?: any;
|
|
81
|
+
error?: string;
|
|
82
|
+
};
|
|
74
83
|
}
|
|
75
|
-
interface
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
84
|
+
interface AssistantActivityBlock {
|
|
85
|
+
items: AssistantActivityItem[];
|
|
86
|
+
}
|
|
87
|
+
interface ChatSender {
|
|
88
|
+
/** Copilotz sender type from the message domain. */
|
|
89
|
+
type: "user" | "agent" | "tool" | "system";
|
|
90
|
+
/** Conversational identity: user external id, agent id, or tool owner id. */
|
|
91
|
+
id: string;
|
|
92
|
+
/** Human-readable display label. */
|
|
93
|
+
name: string;
|
|
94
|
+
/** Backend participant/node id when known. Never used as display text. */
|
|
95
|
+
participantId?: string;
|
|
96
|
+
/** Original external id when distinct from id. */
|
|
97
|
+
externalId?: string;
|
|
98
|
+
/** Agent config id for agent/tool senders when known. */
|
|
99
|
+
agentId?: string;
|
|
100
|
+
avatarUrl?: string;
|
|
101
|
+
/** Custom color for participant display. */
|
|
102
|
+
color?: string;
|
|
81
103
|
}
|
|
82
104
|
interface ChatMessage {
|
|
83
105
|
id: string;
|
|
@@ -92,11 +114,9 @@ interface ChatMessage {
|
|
|
92
114
|
editedAt?: number;
|
|
93
115
|
metadata?: Record<string, any>;
|
|
94
116
|
/** Unified assistant activity state for live rendering and history hydration */
|
|
95
|
-
activity?:
|
|
96
|
-
/**
|
|
97
|
-
|
|
98
|
-
/** Agent ID of the sender (for multi-agent conversations) */
|
|
99
|
-
senderAgentId?: string;
|
|
117
|
+
activity?: AssistantActivityBlock;
|
|
118
|
+
/** Canonical frontend sender identity. Prefer this over legacy sender fields. */
|
|
119
|
+
sender?: ChatSender;
|
|
100
120
|
}
|
|
101
121
|
interface ChatThread {
|
|
102
122
|
id: string;
|
|
@@ -191,12 +211,13 @@ interface ChatConfig {
|
|
|
191
211
|
footerLabel?: string;
|
|
192
212
|
daysAgo?: string;
|
|
193
213
|
inputHelpText?: string;
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
214
|
+
activityThinkingActive?: string;
|
|
215
|
+
activityThinkingComplete?: string;
|
|
216
|
+
activityToolActive?: string;
|
|
217
|
+
activityToolComplete?: string;
|
|
218
|
+
activityToolFailed?: string;
|
|
219
|
+
activityAnsweringActive?: string;
|
|
220
|
+
activityAnsweringComplete?: string;
|
|
200
221
|
activityShowDetails?: string;
|
|
201
222
|
activityHideDetails?: string;
|
|
202
223
|
defaultThreadName?: string;
|
|
@@ -212,7 +233,8 @@ interface ChatConfig {
|
|
|
212
233
|
enableMessageEditing?: boolean;
|
|
213
234
|
enableMessageCopy?: boolean;
|
|
214
235
|
enableRegeneration?: boolean;
|
|
215
|
-
|
|
236
|
+
showActivity?: boolean;
|
|
237
|
+
showActivityDetails?: boolean;
|
|
216
238
|
maxAttachments?: number;
|
|
217
239
|
maxFileSize?: number;
|
|
218
240
|
};
|
|
@@ -406,12 +428,33 @@ declare const ChatUI: React.FC<ChatV2Props>;
|
|
|
406
428
|
|
|
407
429
|
type ActivityLabels = ChatConfig['labels'];
|
|
408
430
|
interface AssistantActivityProps {
|
|
409
|
-
activity?:
|
|
410
|
-
|
|
431
|
+
activity?: AssistantActivityBlock;
|
|
432
|
+
showActivity?: boolean;
|
|
433
|
+
showActivityDetails?: boolean;
|
|
411
434
|
labels?: ActivityLabels;
|
|
412
435
|
}
|
|
413
436
|
declare const AssistantActivity: React.NamedExoticComponent<AssistantActivityProps>;
|
|
414
437
|
|
|
438
|
+
interface MessageSenderDisplay {
|
|
439
|
+
name: string;
|
|
440
|
+
avatar: React.ReactNode;
|
|
441
|
+
color?: string;
|
|
442
|
+
}
|
|
443
|
+
declare const resolveMessageSenderDisplay: ({ sender, fallbackName, fallbackAvatar, fallbackAvatarUrl, compactMode, }: {
|
|
444
|
+
sender?: ChatSender;
|
|
445
|
+
fallbackName: string;
|
|
446
|
+
fallbackAvatar?: React.ReactNode;
|
|
447
|
+
fallbackAvatarUrl?: string;
|
|
448
|
+
compactMode?: boolean;
|
|
449
|
+
}) => MessageSenderDisplay;
|
|
450
|
+
declare const MessageSenderAvatar: React.FC<{
|
|
451
|
+
sender?: ChatSender;
|
|
452
|
+
fallbackName: string;
|
|
453
|
+
fallbackAvatar?: React.ReactNode;
|
|
454
|
+
fallbackAvatarUrl?: string;
|
|
455
|
+
compactMode?: boolean;
|
|
456
|
+
}>;
|
|
457
|
+
|
|
415
458
|
type Setter = (next: Partial<ChatUserContext> | ((prev: ChatUserContext) => Partial<ChatUserContext>)) => void;
|
|
416
459
|
interface ChatUserContextValue {
|
|
417
460
|
context: ChatUserContext;
|
|
@@ -427,4 +470,4 @@ declare function useChatUserContext(): ChatUserContextValue;
|
|
|
427
470
|
declare const defaultChatConfig: Required<ChatConfig>;
|
|
428
471
|
declare function mergeConfig(_baseConfig: ChatConfig, userConfig?: Partial<ChatConfig>): Required<ChatConfig>;
|
|
429
472
|
|
|
430
|
-
export { type
|
|
473
|
+
export { type AgentOption, AssistantActivity, type AssistantActivityBlock, type AssistantActivityItem, type AssistantActivityKind, type AssistantActivityStatus, type AudioAttachment, type ChatCallbacks, type ChatConfig, type ChatMarkdownConfig, type ChatMessage, type ChatSender, 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, MessageSenderAvatar, 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, resolveMessageSenderDisplay, useChatUserContext };
|