@iota-uz/sdk 0.1.1 → 0.3.0
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/bichat/index.cjs +2993 -642
- package/dist/bichat/index.cjs.map +1 -1
- package/dist/bichat/index.css +386 -43
- package/dist/bichat/index.css.map +1 -1
- package/dist/bichat/index.d.cts +1280 -88
- package/dist/bichat/index.d.ts +1280 -88
- package/dist/bichat/index.mjs +2871 -551
- package/dist/bichat/index.mjs.map +1 -1
- package/dist/bichat/styles.css +516 -46
- package/package.json +3 -2
- package/tailwind/compiled.css +1 -1
- package/tailwind/iota.css +0 -1
package/dist/bichat/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
import { ReactNode } from 'react';
|
|
3
|
+
import react__default, { ReactNode, Component, ErrorInfo, HTMLAttributes, ReactElement, ImgHTMLAttributes, ButtonHTMLAttributes, RefObject } from 'react';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Type definitions for BI-Chat UI components
|
|
@@ -13,34 +13,75 @@ interface Session {
|
|
|
13
13
|
createdAt: string;
|
|
14
14
|
updatedAt: string;
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
interface Message {
|
|
16
|
+
/**
|
|
17
|
+
* A conversation turn groups a user message with its assistant response.
|
|
18
|
+
* This provides a cleaner mental model than flat message lists.
|
|
19
|
+
*/
|
|
20
|
+
interface ConversationTurn {
|
|
23
21
|
id: string;
|
|
24
22
|
sessionId: string;
|
|
25
|
-
|
|
23
|
+
userTurn: UserTurn;
|
|
24
|
+
assistantTurn?: AssistantTurn;
|
|
25
|
+
createdAt: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Content of a user's message in a conversation turn
|
|
29
|
+
*/
|
|
30
|
+
interface UserTurn {
|
|
31
|
+
id: string;
|
|
26
32
|
content: string;
|
|
33
|
+
attachments: Attachment[];
|
|
27
34
|
createdAt: string;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Content of an assistant's response in a conversation turn
|
|
38
|
+
*/
|
|
39
|
+
interface AssistantTurn {
|
|
40
|
+
id: string;
|
|
41
|
+
content: string;
|
|
32
42
|
explanation?: string;
|
|
43
|
+
citations: Citation[];
|
|
44
|
+
chartData?: ChartData;
|
|
45
|
+
artifacts: Artifact[];
|
|
46
|
+
codeOutputs: CodeOutput[];
|
|
47
|
+
createdAt: string;
|
|
33
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Role of a message in a conversation
|
|
51
|
+
*/
|
|
52
|
+
declare enum MessageRole {
|
|
53
|
+
User = "user",
|
|
54
|
+
Assistant = "assistant",
|
|
55
|
+
System = "system",
|
|
56
|
+
Tool = "tool"
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* A tool/function call made by the assistant
|
|
60
|
+
*/
|
|
34
61
|
interface ToolCall {
|
|
35
62
|
id: string;
|
|
36
63
|
name: string;
|
|
37
64
|
arguments: string;
|
|
38
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Citation with position information for inline replacement
|
|
68
|
+
*/
|
|
39
69
|
interface Citation {
|
|
40
70
|
id: string;
|
|
41
|
-
|
|
42
|
-
|
|
71
|
+
/** Type of citation (e.g., "url_citation") */
|
|
72
|
+
type: string;
|
|
73
|
+
/** Title of the cited source */
|
|
74
|
+
title: string;
|
|
75
|
+
/** URL of the cited source */
|
|
76
|
+
url: string;
|
|
77
|
+
/** Starting character index in the message content where this citation is referenced */
|
|
78
|
+
startIndex: number;
|
|
79
|
+
/** Ending character index in the message content where this citation is referenced */
|
|
80
|
+
endIndex: number;
|
|
81
|
+
/** Optional excerpt from the source */
|
|
43
82
|
excerpt?: string;
|
|
83
|
+
/** Legacy: source name (for backward compatibility) */
|
|
84
|
+
source?: string;
|
|
44
85
|
}
|
|
45
86
|
interface Attachment {
|
|
46
87
|
id: string;
|
|
@@ -56,20 +97,49 @@ interface ImageAttachment {
|
|
|
56
97
|
base64Data: string;
|
|
57
98
|
preview: string;
|
|
58
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* Output from code interpreter tool
|
|
102
|
+
*/
|
|
59
103
|
interface CodeOutput {
|
|
60
104
|
type: 'image' | 'text' | 'error';
|
|
61
|
-
content: string
|
|
105
|
+
content: string;
|
|
106
|
+
/** File metadata for downloadable outputs */
|
|
107
|
+
filename?: string;
|
|
108
|
+
mimeType?: string;
|
|
109
|
+
sizeBytes?: number;
|
|
62
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* Queued message for offline/loading state
|
|
113
|
+
*/
|
|
63
114
|
interface QueuedMessage {
|
|
64
115
|
content: string;
|
|
65
116
|
attachments: ImageAttachment[];
|
|
66
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* Chart visualization data for ApexCharts
|
|
120
|
+
*/
|
|
67
121
|
interface ChartData {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
122
|
+
/** Type of chart: line, bar, pie, area, or donut */
|
|
123
|
+
chartType: 'line' | 'bar' | 'area' | 'pie' | 'donut';
|
|
124
|
+
/** Chart title displayed above the chart */
|
|
125
|
+
title: string;
|
|
126
|
+
/** Data series (multiple allowed for line/bar/area, single for pie/donut) */
|
|
127
|
+
series: ChartSeries[];
|
|
128
|
+
/** X-axis category labels or segment labels for pie/donut */
|
|
129
|
+
labels?: string[];
|
|
130
|
+
/** Hex color codes for series (e.g., '#4CAF50') */
|
|
131
|
+
colors?: string[];
|
|
132
|
+
/** Chart height in pixels */
|
|
133
|
+
height?: number;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* A single data series in a chart
|
|
137
|
+
*/
|
|
138
|
+
interface ChartSeries {
|
|
139
|
+
/** Display name for this series */
|
|
140
|
+
name: string;
|
|
141
|
+
/** Numeric data values */
|
|
142
|
+
data: number[];
|
|
73
143
|
}
|
|
74
144
|
interface Artifact {
|
|
75
145
|
type: 'excel' | 'pdf';
|
|
@@ -82,12 +152,37 @@ interface Artifact {
|
|
|
82
152
|
interface PendingQuestion {
|
|
83
153
|
id: string;
|
|
84
154
|
turnId: string;
|
|
85
|
-
|
|
86
|
-
type: 'MULTIPLE_CHOICE' | 'FREE_TEXT';
|
|
87
|
-
options?: string[];
|
|
155
|
+
questions: Question[];
|
|
88
156
|
status: 'PENDING' | 'ANSWERED' | 'CANCELLED';
|
|
89
157
|
}
|
|
90
|
-
|
|
158
|
+
interface Question {
|
|
159
|
+
id: string;
|
|
160
|
+
text: string;
|
|
161
|
+
type: 'SINGLE_CHOICE' | 'MULTIPLE_CHOICE';
|
|
162
|
+
options?: QuestionOption[];
|
|
163
|
+
required?: boolean;
|
|
164
|
+
}
|
|
165
|
+
interface QuestionOption {
|
|
166
|
+
id: string;
|
|
167
|
+
label: string;
|
|
168
|
+
value: string;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Answer data for a single question, including predefined options and custom "Other" text.
|
|
172
|
+
*/
|
|
173
|
+
interface QuestionAnswerData {
|
|
174
|
+
/** Selected predefined options (labels) */
|
|
175
|
+
options: string[];
|
|
176
|
+
/** Custom text entered when user selects "Other" option */
|
|
177
|
+
customText?: string;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Map of question IDs to answer data.
|
|
181
|
+
* Supports both multi-select options and custom "Other" text input.
|
|
182
|
+
*/
|
|
183
|
+
interface QuestionAnswers {
|
|
184
|
+
[questionId: string]: QuestionAnswerData;
|
|
185
|
+
}
|
|
91
186
|
interface StreamChunk {
|
|
92
187
|
type: 'chunk' | 'error' | 'done' | 'user_message';
|
|
93
188
|
content?: string;
|
|
@@ -98,7 +193,7 @@ interface ChatDataSource {
|
|
|
98
193
|
createSession(): Promise<Session>;
|
|
99
194
|
fetchSession(id: string): Promise<{
|
|
100
195
|
session: Session;
|
|
101
|
-
|
|
196
|
+
turns: ConversationTurn[];
|
|
102
197
|
pendingQuestion?: PendingQuestion | null;
|
|
103
198
|
} | null>;
|
|
104
199
|
sendMessage(sessionId: string, content: string, attachments?: Attachment[], signal?: AbortSignal): AsyncGenerator<StreamChunk>;
|
|
@@ -114,7 +209,7 @@ interface ChatDataSource {
|
|
|
114
209
|
}
|
|
115
210
|
interface ChatSessionContextValue {
|
|
116
211
|
message: string;
|
|
117
|
-
|
|
212
|
+
turns: ConversationTurn[];
|
|
118
213
|
loading: boolean;
|
|
119
214
|
error: string | null;
|
|
120
215
|
currentSessionId?: string;
|
|
@@ -129,11 +224,12 @@ interface ChatSessionContextValue {
|
|
|
129
224
|
setError: (error: string | null) => void;
|
|
130
225
|
setCodeOutputs: (outputs: CodeOutput[]) => void;
|
|
131
226
|
handleSubmit: (e: React.FormEvent, attachments?: ImageAttachment[]) => void;
|
|
132
|
-
handleRegenerate?: (
|
|
133
|
-
handleEdit?: (
|
|
227
|
+
handleRegenerate?: (turnId: string) => Promise<void>;
|
|
228
|
+
handleEdit?: (turnId: string, newContent: string) => Promise<void>;
|
|
134
229
|
handleCopy: (text: string) => Promise<void>;
|
|
135
230
|
handleSubmitQuestionAnswers: (answers: QuestionAnswers) => void;
|
|
136
231
|
handleCancelPendingQuestion: () => Promise<void>;
|
|
232
|
+
handleRetry?: () => Promise<void>;
|
|
137
233
|
handleUnqueue: () => {
|
|
138
234
|
content: string;
|
|
139
235
|
attachments: ImageAttachment[];
|
|
@@ -146,8 +242,10 @@ interface ChatSessionProps {
|
|
|
146
242
|
dataSource: ChatDataSource;
|
|
147
243
|
sessionId?: string;
|
|
148
244
|
isReadOnly?: boolean;
|
|
149
|
-
|
|
150
|
-
|
|
245
|
+
/** Custom render function for user turns */
|
|
246
|
+
renderUserTurn?: (turn: ConversationTurn) => ReactNode;
|
|
247
|
+
/** Custom render function for assistant turns */
|
|
248
|
+
renderAssistantTurn?: (turn: ConversationTurn) => ReactNode;
|
|
151
249
|
className?: string;
|
|
152
250
|
/** Custom content to display as header */
|
|
153
251
|
headerSlot?: ReactNode;
|
|
@@ -173,42 +271,319 @@ interface ChatHeaderProps {
|
|
|
173
271
|
declare function ChatHeader({ session, onBack, logoSlot, actionsSlot }: ChatHeaderProps): react_jsx_runtime.JSX.Element;
|
|
174
272
|
|
|
175
273
|
interface MessageListProps {
|
|
176
|
-
|
|
177
|
-
|
|
274
|
+
/** Custom render function for user turns */
|
|
275
|
+
renderUserTurn?: (turn: ConversationTurn) => ReactNode;
|
|
276
|
+
/** Custom render function for assistant turns */
|
|
277
|
+
renderAssistantTurn?: (turn: ConversationTurn) => ReactNode;
|
|
178
278
|
}
|
|
179
|
-
declare function MessageList({
|
|
279
|
+
declare function MessageList({ renderUserTurn, renderAssistantTurn }: MessageListProps): react_jsx_runtime.JSX.Element;
|
|
180
280
|
|
|
181
|
-
interface
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
281
|
+
interface UserMessageAvatarSlotProps {
|
|
282
|
+
/** Default initials */
|
|
283
|
+
initials: string;
|
|
284
|
+
}
|
|
285
|
+
interface UserMessageContentSlotProps {
|
|
286
|
+
/** Message content text */
|
|
287
|
+
content: string;
|
|
288
|
+
}
|
|
289
|
+
interface UserMessageAttachmentsSlotProps {
|
|
290
|
+
/** Image attachments */
|
|
291
|
+
attachments: ImageAttachment[];
|
|
292
|
+
/** Handler to open image viewer */
|
|
293
|
+
onView: (index: number) => void;
|
|
294
|
+
}
|
|
295
|
+
interface UserMessageActionsSlotProps {
|
|
296
|
+
/** Copy content to clipboard */
|
|
297
|
+
onCopy: () => void;
|
|
298
|
+
/** Edit message (if available) */
|
|
299
|
+
onEdit?: () => void;
|
|
300
|
+
/** Formatted timestamp */
|
|
301
|
+
timestamp: string;
|
|
302
|
+
/** Whether copy action is available */
|
|
303
|
+
canCopy: boolean;
|
|
304
|
+
/** Whether edit action is available */
|
|
305
|
+
canEdit: boolean;
|
|
306
|
+
}
|
|
307
|
+
interface UserMessageSlots {
|
|
308
|
+
/** Custom avatar renderer */
|
|
309
|
+
avatar?: ReactNode | ((props: UserMessageAvatarSlotProps) => ReactNode);
|
|
310
|
+
/** Custom content renderer */
|
|
311
|
+
content?: ReactNode | ((props: UserMessageContentSlotProps) => ReactNode);
|
|
312
|
+
/** Custom attachments renderer */
|
|
313
|
+
attachments?: ReactNode | ((props: UserMessageAttachmentsSlotProps) => ReactNode);
|
|
314
|
+
/** Custom actions renderer */
|
|
315
|
+
actions?: ReactNode | ((props: UserMessageActionsSlotProps) => ReactNode);
|
|
316
|
+
}
|
|
317
|
+
interface UserMessageClassNames {
|
|
318
|
+
/** Root container */
|
|
319
|
+
root?: string;
|
|
320
|
+
/** Inner content wrapper */
|
|
321
|
+
wrapper?: string;
|
|
322
|
+
/** Avatar container */
|
|
323
|
+
avatar?: string;
|
|
324
|
+
/** Message bubble */
|
|
325
|
+
bubble?: string;
|
|
326
|
+
/** Content text */
|
|
327
|
+
content?: string;
|
|
328
|
+
/** Attachments container */
|
|
329
|
+
attachments?: string;
|
|
330
|
+
/** Actions container */
|
|
331
|
+
actions?: string;
|
|
332
|
+
/** Action button */
|
|
333
|
+
actionButton?: string;
|
|
334
|
+
/** Timestamp */
|
|
335
|
+
timestamp?: string;
|
|
336
|
+
}
|
|
337
|
+
interface UserMessageProps {
|
|
338
|
+
/** User turn data */
|
|
339
|
+
turn: UserTurn;
|
|
340
|
+
/** Turn ID for edit operations */
|
|
341
|
+
turnId?: string;
|
|
342
|
+
/** User initials for avatar */
|
|
343
|
+
initials?: string;
|
|
344
|
+
/** Slot overrides */
|
|
345
|
+
slots?: UserMessageSlots;
|
|
346
|
+
/** Class name overrides */
|
|
347
|
+
classNames?: UserMessageClassNames;
|
|
348
|
+
/** Copy handler */
|
|
349
|
+
onCopy?: (content: string) => Promise<void> | void;
|
|
350
|
+
/** Edit handler */
|
|
351
|
+
onEdit?: (turnId: string, newContent: string) => void;
|
|
352
|
+
/** Hide avatar */
|
|
353
|
+
hideAvatar?: boolean;
|
|
354
|
+
/** Hide actions */
|
|
355
|
+
hideActions?: boolean;
|
|
356
|
+
/** Hide timestamp */
|
|
357
|
+
hideTimestamp?: boolean;
|
|
185
358
|
}
|
|
186
|
-
declare function
|
|
359
|
+
declare function UserMessage({ turn, turnId, initials, slots, classNames: classNameOverrides, onCopy, onEdit, hideAvatar, hideActions, hideTimestamp, }: UserMessageProps): react_jsx_runtime.JSX.Element;
|
|
187
360
|
|
|
188
361
|
interface UserTurnViewProps {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
362
|
+
/** The conversation turn containing the user message */
|
|
363
|
+
turn: ConversationTurn;
|
|
364
|
+
/** Slot overrides for customization */
|
|
365
|
+
slots?: UserMessageSlots;
|
|
366
|
+
/** Class name overrides */
|
|
367
|
+
classNames?: UserMessageClassNames;
|
|
368
|
+
/** User initials for avatar */
|
|
369
|
+
initials?: string;
|
|
370
|
+
/** Hide avatar */
|
|
371
|
+
hideAvatar?: boolean;
|
|
372
|
+
/** Hide actions */
|
|
373
|
+
hideActions?: boolean;
|
|
374
|
+
/** Hide timestamp */
|
|
375
|
+
hideTimestamp?: boolean;
|
|
192
376
|
}
|
|
193
|
-
declare function UserTurnView({
|
|
377
|
+
declare function UserTurnView({ turn, slots, classNames, initials, hideAvatar, hideActions, hideTimestamp, }: UserTurnViewProps): react_jsx_runtime.JSX.Element;
|
|
378
|
+
|
|
379
|
+
interface AssistantMessageAvatarSlotProps {
|
|
380
|
+
/** Default text */
|
|
381
|
+
text: string;
|
|
382
|
+
}
|
|
383
|
+
interface AssistantMessageContentSlotProps {
|
|
384
|
+
/** Message content (markdown) */
|
|
385
|
+
content: string;
|
|
386
|
+
/** Citations */
|
|
387
|
+
citations?: Citation[];
|
|
388
|
+
/** Whether streaming is active */
|
|
389
|
+
isStreaming: boolean;
|
|
390
|
+
}
|
|
391
|
+
interface AssistantMessageSourcesSlotProps {
|
|
392
|
+
/** Citations to display */
|
|
393
|
+
citations: Citation[];
|
|
394
|
+
}
|
|
395
|
+
interface AssistantMessageChartsSlotProps {
|
|
396
|
+
/** Chart data */
|
|
397
|
+
chartData: ChartData;
|
|
398
|
+
}
|
|
399
|
+
interface AssistantMessageCodeOutputsSlotProps {
|
|
400
|
+
/** Code execution outputs */
|
|
401
|
+
outputs: CodeOutput[];
|
|
402
|
+
}
|
|
403
|
+
interface AssistantMessageArtifactsSlotProps {
|
|
404
|
+
/** Downloadable artifacts */
|
|
405
|
+
artifacts: Artifact[];
|
|
406
|
+
}
|
|
407
|
+
interface AssistantMessageActionsSlotProps {
|
|
408
|
+
/** Copy content to clipboard */
|
|
409
|
+
onCopy: () => void;
|
|
410
|
+
/** Regenerate response */
|
|
411
|
+
onRegenerate?: () => void;
|
|
412
|
+
/** Formatted timestamp */
|
|
413
|
+
timestamp: string;
|
|
414
|
+
/** Whether copy action is available */
|
|
415
|
+
canCopy: boolean;
|
|
416
|
+
/** Whether regenerate action is available */
|
|
417
|
+
canRegenerate: boolean;
|
|
418
|
+
}
|
|
419
|
+
interface AssistantMessageExplanationSlotProps {
|
|
420
|
+
/** Explanation content (markdown) */
|
|
421
|
+
explanation: string;
|
|
422
|
+
/** Whether expanded */
|
|
423
|
+
isExpanded: boolean;
|
|
424
|
+
/** Toggle expansion */
|
|
425
|
+
onToggle: () => void;
|
|
426
|
+
}
|
|
427
|
+
interface AssistantMessageSlots {
|
|
428
|
+
/** Custom avatar renderer */
|
|
429
|
+
avatar?: ReactNode | ((props: AssistantMessageAvatarSlotProps) => ReactNode);
|
|
430
|
+
/** Custom content renderer */
|
|
431
|
+
content?: ReactNode | ((props: AssistantMessageContentSlotProps) => ReactNode);
|
|
432
|
+
/** Custom sources renderer */
|
|
433
|
+
sources?: ReactNode | ((props: AssistantMessageSourcesSlotProps) => ReactNode);
|
|
434
|
+
/** Custom charts renderer */
|
|
435
|
+
charts?: ReactNode | ((props: AssistantMessageChartsSlotProps) => ReactNode);
|
|
436
|
+
/** Custom code outputs renderer */
|
|
437
|
+
codeOutputs?: ReactNode | ((props: AssistantMessageCodeOutputsSlotProps) => ReactNode);
|
|
438
|
+
/** Custom artifacts renderer */
|
|
439
|
+
artifacts?: ReactNode | ((props: AssistantMessageArtifactsSlotProps) => ReactNode);
|
|
440
|
+
/** Custom actions renderer */
|
|
441
|
+
actions?: ReactNode | ((props: AssistantMessageActionsSlotProps) => ReactNode);
|
|
442
|
+
/** Custom explanation renderer */
|
|
443
|
+
explanation?: ReactNode | ((props: AssistantMessageExplanationSlotProps) => ReactNode);
|
|
444
|
+
}
|
|
445
|
+
interface AssistantMessageClassNames {
|
|
446
|
+
/** Root container */
|
|
447
|
+
root?: string;
|
|
448
|
+
/** Inner content wrapper */
|
|
449
|
+
wrapper?: string;
|
|
450
|
+
/** Avatar container */
|
|
451
|
+
avatar?: string;
|
|
452
|
+
/** Message bubble */
|
|
453
|
+
bubble?: string;
|
|
454
|
+
/** Code outputs container */
|
|
455
|
+
codeOutputs?: string;
|
|
456
|
+
/** Charts container */
|
|
457
|
+
charts?: string;
|
|
458
|
+
/** Artifacts container */
|
|
459
|
+
artifacts?: string;
|
|
460
|
+
/** Sources container */
|
|
461
|
+
sources?: string;
|
|
462
|
+
/** Explanation container */
|
|
463
|
+
explanation?: string;
|
|
464
|
+
/** Actions container */
|
|
465
|
+
actions?: string;
|
|
466
|
+
/** Action button */
|
|
467
|
+
actionButton?: string;
|
|
468
|
+
/** Timestamp */
|
|
469
|
+
timestamp?: string;
|
|
470
|
+
}
|
|
471
|
+
interface AssistantMessageProps {
|
|
472
|
+
/** Assistant turn data */
|
|
473
|
+
turn: AssistantTurn;
|
|
474
|
+
/** Turn ID for regenerate operations */
|
|
475
|
+
turnId?: string;
|
|
476
|
+
/** Whether response is being streamed */
|
|
477
|
+
isStreaming?: boolean;
|
|
478
|
+
/** Pending question for HITL */
|
|
479
|
+
pendingQuestion?: PendingQuestion | null;
|
|
480
|
+
/** Slot overrides */
|
|
481
|
+
slots?: AssistantMessageSlots;
|
|
482
|
+
/** Class name overrides */
|
|
483
|
+
classNames?: AssistantMessageClassNames;
|
|
484
|
+
/** Copy handler */
|
|
485
|
+
onCopy?: (content: string) => Promise<void> | void;
|
|
486
|
+
/** Regenerate handler */
|
|
487
|
+
onRegenerate?: (turnId: string) => Promise<void> | void;
|
|
488
|
+
/** Send message handler (for markdown links) */
|
|
489
|
+
onSendMessage?: (content: string) => void;
|
|
490
|
+
/** Whether sending is disabled */
|
|
491
|
+
sendDisabled?: boolean;
|
|
492
|
+
/** Hide avatar */
|
|
493
|
+
hideAvatar?: boolean;
|
|
494
|
+
/** Hide actions */
|
|
495
|
+
hideActions?: boolean;
|
|
496
|
+
/** Hide timestamp */
|
|
497
|
+
hideTimestamp?: boolean;
|
|
498
|
+
}
|
|
499
|
+
declare function AssistantMessage({ turn, turnId, isStreaming, pendingQuestion, slots, classNames: classNameOverrides, onCopy, onRegenerate, onSendMessage, sendDisabled, hideAvatar, hideActions, hideTimestamp, }: AssistantMessageProps): react_jsx_runtime.JSX.Element;
|
|
194
500
|
|
|
195
501
|
interface AssistantTurnViewProps {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
502
|
+
/** The conversation turn containing the assistant response */
|
|
503
|
+
turn: ConversationTurn;
|
|
504
|
+
/** Whether the response is currently being streamed */
|
|
505
|
+
isStreaming?: boolean;
|
|
506
|
+
/** Slot overrides for customization */
|
|
507
|
+
slots?: AssistantMessageSlots;
|
|
508
|
+
/** Class name overrides */
|
|
509
|
+
classNames?: AssistantMessageClassNames;
|
|
510
|
+
/** Hide avatar */
|
|
511
|
+
hideAvatar?: boolean;
|
|
512
|
+
/** Hide actions */
|
|
513
|
+
hideActions?: boolean;
|
|
514
|
+
/** Hide timestamp */
|
|
515
|
+
hideTimestamp?: boolean;
|
|
516
|
+
}
|
|
517
|
+
declare function AssistantTurnView({ turn, isStreaming, slots, classNames, hideAvatar, hideActions, hideTimestamp, }: AssistantTurnViewProps): react_jsx_runtime.JSX.Element | null;
|
|
518
|
+
|
|
519
|
+
interface TurnBubbleClassNames {
|
|
520
|
+
/** Root container */
|
|
521
|
+
root?: string;
|
|
522
|
+
/** User turn wrapper */
|
|
523
|
+
userTurn?: string;
|
|
524
|
+
/** Assistant turn wrapper */
|
|
525
|
+
assistantTurn?: string;
|
|
526
|
+
}
|
|
527
|
+
interface TurnBubbleProps {
|
|
528
|
+
/** The conversation turn containing user and optional assistant content */
|
|
529
|
+
turn: ConversationTurn;
|
|
530
|
+
/** Custom render function for user turn (full control) */
|
|
531
|
+
renderUserTurn?: (turn: ConversationTurn) => ReactNode;
|
|
532
|
+
/** Custom render function for assistant turn (full control) */
|
|
533
|
+
renderAssistantTurn?: (turn: ConversationTurn) => ReactNode;
|
|
534
|
+
/** Props passed to UserTurnView (when not using custom renderer) */
|
|
535
|
+
userTurnProps?: Omit<UserTurnViewProps, 'turn'>;
|
|
536
|
+
/** Props passed to AssistantTurnView (when not using custom renderer) */
|
|
537
|
+
assistantTurnProps?: Omit<AssistantTurnViewProps, 'turn'>;
|
|
538
|
+
/** Slots for user message customization */
|
|
539
|
+
userMessageSlots?: UserMessageSlots;
|
|
540
|
+
/** Slots for assistant message customization */
|
|
541
|
+
assistantMessageSlots?: AssistantMessageSlots;
|
|
542
|
+
/** Class names for user message */
|
|
543
|
+
userMessageClassNames?: UserMessageClassNames;
|
|
544
|
+
/** Class names for assistant message */
|
|
545
|
+
assistantMessageClassNames?: AssistantMessageClassNames;
|
|
546
|
+
/** Class names for turn bubble container */
|
|
547
|
+
classNames?: TurnBubbleClassNames;
|
|
548
|
+
/** Whether assistant response is streaming */
|
|
549
|
+
isStreaming?: boolean;
|
|
200
550
|
}
|
|
201
|
-
declare function
|
|
551
|
+
declare function TurnBubble({ turn, renderUserTurn, renderAssistantTurn, userTurnProps, assistantTurnProps, userMessageSlots, assistantMessageSlots, userMessageClassNames, assistantMessageClassNames, classNames, isStreaming, }: TurnBubbleProps): react_jsx_runtime.JSX.Element;
|
|
202
552
|
|
|
203
553
|
interface MarkdownRendererProps {
|
|
554
|
+
/** Markdown content to render */
|
|
204
555
|
content: string;
|
|
556
|
+
/** Optional citations to process and display */
|
|
205
557
|
citations?: Citation[] | null;
|
|
558
|
+
/** Optional function to send messages (enables table export) */
|
|
559
|
+
sendMessage?: (content: string) => void;
|
|
560
|
+
/** Whether message sending is disabled */
|
|
561
|
+
sendDisabled?: boolean;
|
|
562
|
+
/** Copy button label for code blocks */
|
|
563
|
+
copyLabel?: string;
|
|
564
|
+
/** Copied confirmation label for code blocks */
|
|
565
|
+
copiedLabel?: string;
|
|
566
|
+
/** Export button label for tables */
|
|
567
|
+
exportLabel?: string;
|
|
206
568
|
}
|
|
207
|
-
declare function MarkdownRenderer({ content }: MarkdownRendererProps): react_jsx_runtime.JSX.Element;
|
|
569
|
+
declare function MarkdownRenderer({ content, citations, sendMessage, sendDisabled, copyLabel, copiedLabel, exportLabel, }: MarkdownRendererProps): react_jsx_runtime.JSX.Element;
|
|
570
|
+
declare const MemoizedMarkdownRenderer: react.MemoExoticComponent<typeof MarkdownRenderer>;
|
|
208
571
|
|
|
209
572
|
interface ChartCardProps {
|
|
210
573
|
chartData: ChartData;
|
|
211
574
|
}
|
|
575
|
+
/**
|
|
576
|
+
* ChartCard renders a single chart visualization with optional PNG export.
|
|
577
|
+
*
|
|
578
|
+
* Chart types:
|
|
579
|
+
* - line: Line chart with multiple series
|
|
580
|
+
* - bar: Bar chart with multiple series
|
|
581
|
+
* - area: Area chart with multiple series (filled)
|
|
582
|
+
* - pie: Pie chart (single series)
|
|
583
|
+
* - donut: Donut chart (single series)
|
|
584
|
+
*
|
|
585
|
+
* @param chartData - Chart specification from GraphQL API
|
|
586
|
+
*/
|
|
212
587
|
declare function ChartCard({ chartData }: ChartCardProps): react_jsx_runtime.JSX.Element;
|
|
213
588
|
|
|
214
589
|
interface SourcesPanelProps {
|
|
@@ -224,7 +599,7 @@ declare function DownloadCard({ artifact }: DownloadCardProps): react_jsx_runtim
|
|
|
224
599
|
interface InlineQuestionFormProps {
|
|
225
600
|
pendingQuestion: PendingQuestion;
|
|
226
601
|
}
|
|
227
|
-
declare function InlineQuestionForm({ pendingQuestion }: InlineQuestionFormProps): react_jsx_runtime.JSX.Element;
|
|
602
|
+
declare function InlineQuestionForm({ pendingQuestion }: InlineQuestionFormProps): react_jsx_runtime.JSX.Element | null;
|
|
228
603
|
|
|
229
604
|
interface MessageInputRef {
|
|
230
605
|
focus: () => void;
|
|
@@ -250,19 +625,67 @@ interface MessageInputProps {
|
|
|
250
625
|
declare const MessageInput: react.ForwardRefExoticComponent<MessageInputProps & react.RefAttributes<MessageInputRef>>;
|
|
251
626
|
|
|
252
627
|
interface AttachmentGridProps {
|
|
628
|
+
/** Array of image attachments to display */
|
|
253
629
|
attachments: ImageAttachment[];
|
|
630
|
+
/** Optional callback when remove button is clicked */
|
|
254
631
|
onRemove?: (index: number) => void;
|
|
632
|
+
/** Optional callback when thumbnail is clicked for preview */
|
|
255
633
|
onView?: (index: number) => void;
|
|
634
|
+
/** Additional CSS class */
|
|
256
635
|
className?: string;
|
|
636
|
+
/** If true, disable all interactions */
|
|
637
|
+
readonly?: boolean;
|
|
638
|
+
/** Maximum number of attachments to display (default: all) */
|
|
639
|
+
maxDisplay?: number;
|
|
640
|
+
/** Maximum total capacity (for warning display, default: 10) */
|
|
641
|
+
maxCapacity?: number;
|
|
642
|
+
/** Empty state message */
|
|
643
|
+
emptyMessage?: string;
|
|
644
|
+
/** Show count label above grid */
|
|
645
|
+
showCount?: boolean;
|
|
257
646
|
}
|
|
258
|
-
|
|
647
|
+
/**
|
|
648
|
+
* Responsive grid component for displaying image attachments
|
|
649
|
+
*
|
|
650
|
+
* Layout:
|
|
651
|
+
* - Mobile: 2 columns (grid-cols-2)
|
|
652
|
+
* - Tablet: 3 columns (sm:grid-cols-3)
|
|
653
|
+
* - Desktop: 4 columns (md:grid-cols-4)
|
|
654
|
+
*/
|
|
655
|
+
declare function AttachmentGrid({ attachments, onRemove, onView, className, readonly, maxDisplay, maxCapacity, emptyMessage, showCount, }: AttachmentGridProps): react_jsx_runtime.JSX.Element | null;
|
|
656
|
+
declare const MemoizedAttachmentGrid: react__default.MemoExoticComponent<typeof AttachmentGrid>;
|
|
259
657
|
|
|
260
658
|
interface ImageModalProps {
|
|
261
|
-
|
|
262
|
-
|
|
659
|
+
/** Whether the modal is open */
|
|
660
|
+
isOpen: boolean;
|
|
661
|
+
/** Callback to close the modal */
|
|
263
662
|
onClose: () => void;
|
|
663
|
+
/** The current attachment to display */
|
|
664
|
+
attachment: ImageAttachment;
|
|
665
|
+
/** Optional: all attachments for navigation */
|
|
666
|
+
allAttachments?: ImageAttachment[];
|
|
667
|
+
/** Optional: current index for navigation state */
|
|
668
|
+
currentIndex?: number;
|
|
669
|
+
/** Optional: callback for navigation (prev/next) */
|
|
670
|
+
onNavigate?: (direction: 'prev' | 'next') => void;
|
|
264
671
|
}
|
|
265
|
-
|
|
672
|
+
/**
|
|
673
|
+
* Full-screen image modal component for viewing attachments
|
|
674
|
+
*
|
|
675
|
+
* Features:
|
|
676
|
+
* - Full-screen overlay with dark backdrop (90% opacity)
|
|
677
|
+
* - Large image display centered on screen
|
|
678
|
+
* - Close button (X) in top-right corner
|
|
679
|
+
* - Image metadata: filename, file size, MIME type
|
|
680
|
+
* - Navigation arrows (left/right) for image carousel
|
|
681
|
+
* - Keyboard support: Escape to close, Arrow keys to navigate
|
|
682
|
+
* - Click backdrop to close
|
|
683
|
+
* - Focus trap within modal
|
|
684
|
+
* - Body scroll locked when open
|
|
685
|
+
* - Image loading state with spinner
|
|
686
|
+
* - Navigation disabled at boundaries (not circular)
|
|
687
|
+
*/
|
|
688
|
+
declare function ImageModal({ isOpen, onClose, attachment, allAttachments, currentIndex, onNavigate, }: ImageModalProps): react.ReactPortal | null;
|
|
266
689
|
|
|
267
690
|
/**
|
|
268
691
|
* WelcomeContent Component
|
|
@@ -314,7 +737,7 @@ interface EmptyStateProps {
|
|
|
314
737
|
size?: 'sm' | 'md' | 'lg';
|
|
315
738
|
}
|
|
316
739
|
declare function EmptyState({ icon, title, description, action, className, size, }: EmptyStateProps): react_jsx_runtime.JSX.Element;
|
|
317
|
-
declare const
|
|
740
|
+
declare const MemoizedEmptyState: react.MemoExoticComponent<typeof EmptyState>;
|
|
318
741
|
|
|
319
742
|
/**
|
|
320
743
|
* EditableText Component
|
|
@@ -346,7 +769,7 @@ interface EditableTextRef {
|
|
|
346
769
|
/** Programmatically cancel editing */
|
|
347
770
|
cancelEditing: () => void;
|
|
348
771
|
}
|
|
349
|
-
declare const
|
|
772
|
+
declare const MemoizedEditableText: react.MemoExoticComponent<react.ForwardRefExoticComponent<EditableTextProps & react.RefAttributes<EditableTextRef>>>;
|
|
350
773
|
|
|
351
774
|
/**
|
|
352
775
|
* SearchInput Component
|
|
@@ -375,7 +798,7 @@ interface SearchInputProps {
|
|
|
375
798
|
ariaLabel?: string;
|
|
376
799
|
}
|
|
377
800
|
declare function SearchInput({ value, onChange, placeholder, autoFocus, onSubmit, onEscape, className, size, disabled, ariaLabel, }: SearchInputProps): react_jsx_runtime.JSX.Element;
|
|
378
|
-
declare const
|
|
801
|
+
declare const MemoizedSearchInput: react.MemoExoticComponent<typeof SearchInput>;
|
|
379
802
|
|
|
380
803
|
/**
|
|
381
804
|
* Skeleton Component
|
|
@@ -436,7 +859,762 @@ declare function SkeletonCard({ width, height, className, }: {
|
|
|
436
859
|
declare function ListItemSkeleton({ className }: {
|
|
437
860
|
className?: string;
|
|
438
861
|
}): react_jsx_runtime.JSX.Element;
|
|
439
|
-
declare const
|
|
862
|
+
declare const MemoizedSkeleton: react.MemoExoticComponent<typeof Skeleton>;
|
|
863
|
+
|
|
864
|
+
/**
|
|
865
|
+
* CodeBlock Component
|
|
866
|
+
* Syntax highlighted code blocks with copy functionality and dark mode support
|
|
867
|
+
*/
|
|
868
|
+
interface CodeBlockProps {
|
|
869
|
+
/** Programming language for syntax highlighting */
|
|
870
|
+
language: string;
|
|
871
|
+
/** Code content to display */
|
|
872
|
+
value: string;
|
|
873
|
+
/** Whether to render as inline code */
|
|
874
|
+
inline?: boolean;
|
|
875
|
+
/** Copy button label (defaults to "Copy") */
|
|
876
|
+
copyLabel?: string;
|
|
877
|
+
/** Copied confirmation label (defaults to "Copied!") */
|
|
878
|
+
copiedLabel?: string;
|
|
879
|
+
}
|
|
880
|
+
declare function CodeBlock({ language, value, inline, copyLabel, copiedLabel, }: CodeBlockProps): react_jsx_runtime.JSX.Element;
|
|
881
|
+
declare const MemoizedCodeBlock: react.MemoExoticComponent<typeof CodeBlock>;
|
|
882
|
+
|
|
883
|
+
/**
|
|
884
|
+
* LoadingSpinner Component
|
|
885
|
+
* Displays animated loading indicators
|
|
886
|
+
*/
|
|
887
|
+
type SpinnerVariant = 'spinner' | 'dots' | 'pulse';
|
|
888
|
+
interface LoadingSpinnerProps {
|
|
889
|
+
variant?: SpinnerVariant;
|
|
890
|
+
size?: 'sm' | 'md' | 'lg';
|
|
891
|
+
message?: string;
|
|
892
|
+
}
|
|
893
|
+
declare function LoadingSpinner({ variant, size, message }: LoadingSpinnerProps): react_jsx_runtime.JSX.Element;
|
|
894
|
+
declare const MemoizedLoadingSpinner: react.MemoExoticComponent<typeof LoadingSpinner>;
|
|
895
|
+
|
|
896
|
+
/**
|
|
897
|
+
* TableExportButton Component
|
|
898
|
+
* Small inline button for exporting markdown tables to Excel
|
|
899
|
+
*/
|
|
900
|
+
interface TableExportButtonProps {
|
|
901
|
+
/** Click handler for export action */
|
|
902
|
+
onClick: () => void;
|
|
903
|
+
/** Whether the button should be disabled */
|
|
904
|
+
disabled?: boolean;
|
|
905
|
+
/** Export button label (defaults to "Export") */
|
|
906
|
+
label?: string;
|
|
907
|
+
/** Disabled tooltip text */
|
|
908
|
+
disabledTooltip?: string;
|
|
909
|
+
}
|
|
910
|
+
declare const TableExportButton: react.NamedExoticComponent<TableExportButtonProps>;
|
|
911
|
+
|
|
912
|
+
interface TableWithExportProps {
|
|
913
|
+
/** The table content to render */
|
|
914
|
+
children: ReactNode;
|
|
915
|
+
/** Function to send a message (from chat context) */
|
|
916
|
+
sendMessage?: (content: string) => void;
|
|
917
|
+
/** Whether sending is disabled (loading or streaming) */
|
|
918
|
+
disabled?: boolean;
|
|
919
|
+
/** Custom export message to send */
|
|
920
|
+
exportMessage?: string;
|
|
921
|
+
/** Export button label */
|
|
922
|
+
exportLabel?: string;
|
|
923
|
+
}
|
|
924
|
+
declare const TableWithExport: react.NamedExoticComponent<TableWithExportProps>;
|
|
925
|
+
|
|
926
|
+
/**
|
|
927
|
+
* useToast Hook
|
|
928
|
+
* Manages toast notification state
|
|
929
|
+
*/
|
|
930
|
+
type ToastType = 'success' | 'error' | 'info' | 'warning';
|
|
931
|
+
interface ToastItem {
|
|
932
|
+
id: string;
|
|
933
|
+
type: ToastType;
|
|
934
|
+
message: string;
|
|
935
|
+
duration?: number;
|
|
936
|
+
}
|
|
937
|
+
interface UseToastReturn {
|
|
938
|
+
toasts: ToastItem[];
|
|
939
|
+
success: (msg: string, duration?: number) => void;
|
|
940
|
+
error: (msg: string, duration?: number) => void;
|
|
941
|
+
info: (msg: string, duration?: number) => void;
|
|
942
|
+
warning: (msg: string, duration?: number) => void;
|
|
943
|
+
dismiss: (id: string) => void;
|
|
944
|
+
dismissAll: () => void;
|
|
945
|
+
}
|
|
946
|
+
/**
|
|
947
|
+
* Hook for managing toast notifications
|
|
948
|
+
*
|
|
949
|
+
* @example
|
|
950
|
+
* ```tsx
|
|
951
|
+
* const { toasts, success, error, dismiss } = useToast()
|
|
952
|
+
*
|
|
953
|
+
* // Show a success toast
|
|
954
|
+
* success('Operation completed!')
|
|
955
|
+
*
|
|
956
|
+
* // Show an error toast with custom duration
|
|
957
|
+
* error('Something went wrong', 10000)
|
|
958
|
+
*
|
|
959
|
+
* // Render toasts
|
|
960
|
+
* <ToastContainer toasts={toasts} onDismiss={dismiss} />
|
|
961
|
+
* ```
|
|
962
|
+
*/
|
|
963
|
+
declare function useToast(): UseToastReturn;
|
|
964
|
+
|
|
965
|
+
interface ToastProps {
|
|
966
|
+
id: string;
|
|
967
|
+
type: ToastType;
|
|
968
|
+
message: string;
|
|
969
|
+
duration?: number;
|
|
970
|
+
onDismiss: (id: string) => void;
|
|
971
|
+
/** Label for dismiss button (defaults to "Dismiss") */
|
|
972
|
+
dismissLabel?: string;
|
|
973
|
+
}
|
|
974
|
+
declare function Toast({ id, type, message, duration, onDismiss, dismissLabel, }: ToastProps): react_jsx_runtime.JSX.Element;
|
|
975
|
+
|
|
976
|
+
interface ToastContainerProps {
|
|
977
|
+
toasts: ToastItem[];
|
|
978
|
+
onDismiss: (id: string) => void;
|
|
979
|
+
/** Label for dismiss buttons */
|
|
980
|
+
dismissLabel?: string;
|
|
981
|
+
}
|
|
982
|
+
declare function ToastContainer({ toasts, onDismiss, dismissLabel }: ToastContainerProps): react_jsx_runtime.JSX.Element;
|
|
983
|
+
|
|
984
|
+
/**
|
|
985
|
+
* ConfirmModal Component
|
|
986
|
+
* Generic confirmation dialog with customizable title, message, and actions
|
|
987
|
+
*/
|
|
988
|
+
interface ConfirmModalProps {
|
|
989
|
+
/** Whether the modal is open */
|
|
990
|
+
isOpen: boolean;
|
|
991
|
+
/** Modal title */
|
|
992
|
+
title: string;
|
|
993
|
+
/** Modal message/description */
|
|
994
|
+
message: string;
|
|
995
|
+
/** Callback when user confirms */
|
|
996
|
+
onConfirm: () => void;
|
|
997
|
+
/** Callback when user cancels */
|
|
998
|
+
onCancel: () => void;
|
|
999
|
+
/** Confirm button text (defaults to "Confirm") */
|
|
1000
|
+
confirmText?: string;
|
|
1001
|
+
/** Cancel button text (defaults to "Cancel") */
|
|
1002
|
+
cancelText?: string;
|
|
1003
|
+
/** Whether this is a danger/destructive action (red confirm button) */
|
|
1004
|
+
isDanger?: boolean;
|
|
1005
|
+
}
|
|
1006
|
+
declare function ConfirmModalBase({ isOpen, title, message, onConfirm, onCancel, confirmText, cancelText, isDanger, }: ConfirmModalProps): react_jsx_runtime.JSX.Element | null;
|
|
1007
|
+
declare const ConfirmModal: react.MemoExoticComponent<typeof ConfirmModalBase>;
|
|
1008
|
+
|
|
1009
|
+
/**
|
|
1010
|
+
* UserAvatar Component
|
|
1011
|
+
* Displays user initials with deterministic color from a color palette
|
|
1012
|
+
*/
|
|
1013
|
+
interface UserAvatarProps {
|
|
1014
|
+
/** User's first name */
|
|
1015
|
+
firstName: string;
|
|
1016
|
+
/** User's last name */
|
|
1017
|
+
lastName: string;
|
|
1018
|
+
/** Override initials (defaults to first letters of first and last name) */
|
|
1019
|
+
initials?: string;
|
|
1020
|
+
/** Avatar size */
|
|
1021
|
+
size?: 'sm' | 'md' | 'lg';
|
|
1022
|
+
/** Additional CSS classes */
|
|
1023
|
+
className?: string;
|
|
1024
|
+
}
|
|
1025
|
+
declare function UserAvatar({ firstName, lastName, initials: providedInitials, size, className, }: UserAvatarProps): react_jsx_runtime.JSX.Element;
|
|
1026
|
+
declare const MemoizedUserAvatar: react.MemoExoticComponent<typeof UserAvatar>;
|
|
1027
|
+
|
|
1028
|
+
interface PermissionGuardProps {
|
|
1029
|
+
/** Permission names to check */
|
|
1030
|
+
permissions: string[];
|
|
1031
|
+
/** Check mode: 'all' requires all permissions (AND), 'any' requires at least one (OR) */
|
|
1032
|
+
mode?: 'all' | 'any';
|
|
1033
|
+
/** Function to check if user has a specific permission */
|
|
1034
|
+
hasPermission: (permission: string) => boolean;
|
|
1035
|
+
/** Fallback to render when permissions are not satisfied */
|
|
1036
|
+
fallback?: ReactNode;
|
|
1037
|
+
/** Children to render when permissions are satisfied */
|
|
1038
|
+
children: ReactNode;
|
|
1039
|
+
}
|
|
1040
|
+
/**
|
|
1041
|
+
* Permission guard component.
|
|
1042
|
+
* Conditionally renders children based on permission checks.
|
|
1043
|
+
*/
|
|
1044
|
+
declare function PermissionGuard({ permissions, mode, hasPermission, fallback, children, }: PermissionGuardProps): react_jsx_runtime.JSX.Element;
|
|
1045
|
+
|
|
1046
|
+
interface ErrorBoundaryProps {
|
|
1047
|
+
children: ReactNode;
|
|
1048
|
+
/** Optional custom error UI */
|
|
1049
|
+
fallback?: ReactNode | ((error: Error | null, reset: () => void) => ReactNode);
|
|
1050
|
+
/** Callback when an error is caught */
|
|
1051
|
+
onError?: (error: Error, errorInfo: ErrorInfo) => void;
|
|
1052
|
+
}
|
|
1053
|
+
interface ErrorBoundaryState {
|
|
1054
|
+
hasError: boolean;
|
|
1055
|
+
error: Error | null;
|
|
1056
|
+
}
|
|
1057
|
+
/**
|
|
1058
|
+
* Default error UI component
|
|
1059
|
+
*/
|
|
1060
|
+
declare function DefaultErrorContent({ error, onReset, resetLabel, errorTitle, }: {
|
|
1061
|
+
error: Error | null;
|
|
1062
|
+
onReset?: () => void;
|
|
1063
|
+
resetLabel?: string;
|
|
1064
|
+
errorTitle?: string;
|
|
1065
|
+
}): react_jsx_runtime.JSX.Element;
|
|
1066
|
+
declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
1067
|
+
constructor(props: ErrorBoundaryProps);
|
|
1068
|
+
static getDerivedStateFromError(error: Error): ErrorBoundaryState;
|
|
1069
|
+
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
1070
|
+
handleReset: () => void;
|
|
1071
|
+
render(): string | number | boolean | Iterable<ReactNode> | react_jsx_runtime.JSX.Element | null | undefined;
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
/**
|
|
1075
|
+
* TypingIndicator Component
|
|
1076
|
+
* Displays animated dots or rotating text to indicate AI is processing
|
|
1077
|
+
*/
|
|
1078
|
+
type TypingIndicatorVariant = 'dots' | 'text' | 'pulse';
|
|
1079
|
+
interface TypingIndicatorProps {
|
|
1080
|
+
/** Display variant */
|
|
1081
|
+
variant?: TypingIndicatorVariant;
|
|
1082
|
+
/** Custom thinking messages (for text variant) */
|
|
1083
|
+
messages?: string[];
|
|
1084
|
+
/** Message rotation interval in ms (for text variant, defaults to 3000) */
|
|
1085
|
+
rotationInterval?: number;
|
|
1086
|
+
/** Size */
|
|
1087
|
+
size?: 'sm' | 'md' | 'lg';
|
|
1088
|
+
/** Additional CSS classes */
|
|
1089
|
+
className?: string;
|
|
1090
|
+
}
|
|
1091
|
+
declare function TypingIndicator({ variant, messages, rotationInterval, size, className, }: TypingIndicatorProps): react_jsx_runtime.JSX.Element;
|
|
1092
|
+
declare const MemoizedTypingIndicator: react.MemoExoticComponent<typeof TypingIndicator>;
|
|
1093
|
+
|
|
1094
|
+
interface SlotProps extends HTMLAttributes<HTMLElement> {
|
|
1095
|
+
children?: ReactNode;
|
|
1096
|
+
}
|
|
1097
|
+
/**
|
|
1098
|
+
* Slot component that merges its props with its child element's props
|
|
1099
|
+
* Used for the asChild pattern to allow consumers to customize the rendered element
|
|
1100
|
+
*/
|
|
1101
|
+
declare const Slot: react.ForwardRefExoticComponent<SlotProps & react.RefAttributes<HTMLElement>>;
|
|
1102
|
+
/**
|
|
1103
|
+
* Helper type for components that support asChild
|
|
1104
|
+
* Extends the HTML attributes while adding asChild option
|
|
1105
|
+
*/
|
|
1106
|
+
type AsChildProps<T extends HTMLAttributes<HTMLElement> = HTMLAttributes<HTMLElement>> = T & {
|
|
1107
|
+
/** Merge props with child element instead of rendering wrapper */
|
|
1108
|
+
asChild?: boolean;
|
|
1109
|
+
};
|
|
1110
|
+
/**
|
|
1111
|
+
* Get children count (flattens fragments)
|
|
1112
|
+
*/
|
|
1113
|
+
declare function getValidChildren(children: ReactNode): ReactElement[];
|
|
1114
|
+
|
|
1115
|
+
interface TurnContextValue {
|
|
1116
|
+
/** Turn identifier */
|
|
1117
|
+
turnId?: string;
|
|
1118
|
+
}
|
|
1119
|
+
declare function useTurnContext(): TurnContextValue;
|
|
1120
|
+
type TurnRootProps = AsChildProps<HTMLAttributes<HTMLDivElement>> & {
|
|
1121
|
+
/** Turn identifier for tracking */
|
|
1122
|
+
turnId?: string;
|
|
1123
|
+
};
|
|
1124
|
+
type TurnUserProps = AsChildProps<HTMLAttributes<HTMLDivElement>>;
|
|
1125
|
+
type TurnAssistantProps = AsChildProps<HTMLAttributes<HTMLDivElement>>;
|
|
1126
|
+
type TurnTimestampProps = AsChildProps<HTMLAttributes<HTMLTimeElement>> & {
|
|
1127
|
+
/** ISO date string or Date object */
|
|
1128
|
+
date?: string | Date;
|
|
1129
|
+
/** Custom formatter */
|
|
1130
|
+
formatter?: (date: Date) => string;
|
|
1131
|
+
};
|
|
1132
|
+
type TurnActionsProps = AsChildProps<HTMLAttributes<HTMLDivElement>>;
|
|
1133
|
+
declare const Turn: {
|
|
1134
|
+
Root: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
1135
|
+
asChild?: boolean;
|
|
1136
|
+
} & {
|
|
1137
|
+
/** Turn identifier for tracking */
|
|
1138
|
+
turnId?: string;
|
|
1139
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
1140
|
+
User: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
1141
|
+
asChild?: boolean;
|
|
1142
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
1143
|
+
Assistant: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
1144
|
+
asChild?: boolean;
|
|
1145
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
1146
|
+
Timestamp: react.ForwardRefExoticComponent<HTMLAttributes<HTMLTimeElement> & {
|
|
1147
|
+
asChild?: boolean;
|
|
1148
|
+
} & {
|
|
1149
|
+
/** ISO date string or Date object */
|
|
1150
|
+
date?: string | Date;
|
|
1151
|
+
/** Custom formatter */
|
|
1152
|
+
formatter?: (date: Date) => string;
|
|
1153
|
+
} & react.RefAttributes<HTMLTimeElement>>;
|
|
1154
|
+
Actions: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
1155
|
+
asChild?: boolean;
|
|
1156
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
1157
|
+
};
|
|
1158
|
+
|
|
1159
|
+
type ImageLoadingStatus = 'idle' | 'loading' | 'loaded' | 'error';
|
|
1160
|
+
interface AvatarContextValue {
|
|
1161
|
+
imageLoadingStatus: ImageLoadingStatus;
|
|
1162
|
+
setImageLoadingStatus: (status: ImageLoadingStatus) => void;
|
|
1163
|
+
}
|
|
1164
|
+
declare function useAvatarContext(): AvatarContextValue;
|
|
1165
|
+
type AvatarRootProps = AsChildProps<HTMLAttributes<HTMLSpanElement>>;
|
|
1166
|
+
type AvatarImageProps = AsChildProps<ImgHTMLAttributes<HTMLImageElement>> & {
|
|
1167
|
+
/** Called when loading status changes */
|
|
1168
|
+
onLoadingStatusChange?: (status: ImageLoadingStatus) => void;
|
|
1169
|
+
};
|
|
1170
|
+
type AvatarFallbackProps = AsChildProps<HTMLAttributes<HTMLSpanElement>> & {
|
|
1171
|
+
/** Delay before showing fallback (in ms) */
|
|
1172
|
+
delayMs?: number;
|
|
1173
|
+
};
|
|
1174
|
+
declare const Avatar: {
|
|
1175
|
+
Root: react.ForwardRefExoticComponent<HTMLAttributes<HTMLSpanElement> & {
|
|
1176
|
+
asChild?: boolean;
|
|
1177
|
+
} & react.RefAttributes<HTMLSpanElement>>;
|
|
1178
|
+
Image: react.ForwardRefExoticComponent<ImgHTMLAttributes<HTMLImageElement> & {
|
|
1179
|
+
asChild?: boolean;
|
|
1180
|
+
} & {
|
|
1181
|
+
/** Called when loading status changes */
|
|
1182
|
+
onLoadingStatusChange?: (status: ImageLoadingStatus) => void;
|
|
1183
|
+
} & react.RefAttributes<HTMLImageElement>>;
|
|
1184
|
+
Fallback: react.ForwardRefExoticComponent<HTMLAttributes<HTMLSpanElement> & {
|
|
1185
|
+
asChild?: boolean;
|
|
1186
|
+
} & {
|
|
1187
|
+
/** Delay before showing fallback (in ms) */
|
|
1188
|
+
delayMs?: number;
|
|
1189
|
+
} & react.RefAttributes<HTMLSpanElement>>;
|
|
1190
|
+
};
|
|
1191
|
+
|
|
1192
|
+
type BubbleVariant = 'user' | 'assistant' | 'system';
|
|
1193
|
+
interface BubbleContextValue {
|
|
1194
|
+
variant?: BubbleVariant;
|
|
1195
|
+
}
|
|
1196
|
+
declare function useBubbleContext(): BubbleContextValue;
|
|
1197
|
+
type BubbleRootProps = AsChildProps<HTMLAttributes<HTMLDivElement>> & {
|
|
1198
|
+
/** Bubble variant (affects data attribute for styling) */
|
|
1199
|
+
variant?: BubbleVariant;
|
|
1200
|
+
};
|
|
1201
|
+
type BubbleContentProps = AsChildProps<HTMLAttributes<HTMLDivElement>>;
|
|
1202
|
+
type BubbleHeaderProps = AsChildProps<HTMLAttributes<HTMLDivElement>>;
|
|
1203
|
+
type BubbleFooterProps = AsChildProps<HTMLAttributes<HTMLDivElement>>;
|
|
1204
|
+
type BubbleMetadataProps = AsChildProps<HTMLAttributes<HTMLDivElement>>;
|
|
1205
|
+
declare const Bubble: {
|
|
1206
|
+
Root: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
1207
|
+
asChild?: boolean;
|
|
1208
|
+
} & {
|
|
1209
|
+
/** Bubble variant (affects data attribute for styling) */
|
|
1210
|
+
variant?: BubbleVariant;
|
|
1211
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
1212
|
+
Content: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
1213
|
+
asChild?: boolean;
|
|
1214
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
1215
|
+
Header: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
1216
|
+
asChild?: boolean;
|
|
1217
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
1218
|
+
Footer: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
1219
|
+
asChild?: boolean;
|
|
1220
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
1221
|
+
Metadata: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
1222
|
+
asChild?: boolean;
|
|
1223
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
1224
|
+
};
|
|
1225
|
+
|
|
1226
|
+
interface ActionButtonContextValue {
|
|
1227
|
+
isHovered: boolean;
|
|
1228
|
+
isFocused: boolean;
|
|
1229
|
+
isPressed: boolean;
|
|
1230
|
+
isDisabled: boolean;
|
|
1231
|
+
}
|
|
1232
|
+
declare function useActionButtonContext(): ActionButtonContextValue;
|
|
1233
|
+
type ActionButtonRootProps = AsChildProps<ButtonHTMLAttributes<HTMLButtonElement>>;
|
|
1234
|
+
type ActionButtonIconProps = AsChildProps<HTMLAttributes<HTMLSpanElement>>;
|
|
1235
|
+
type ActionButtonLabelProps = AsChildProps<HTMLAttributes<HTMLSpanElement>> & {
|
|
1236
|
+
/** Visually hidden but accessible to screen readers */
|
|
1237
|
+
srOnly?: boolean;
|
|
1238
|
+
};
|
|
1239
|
+
type ActionButtonTooltipProps = AsChildProps<HTMLAttributes<HTMLSpanElement>> & {
|
|
1240
|
+
/** Position relative to button */
|
|
1241
|
+
position?: 'top' | 'bottom' | 'left' | 'right';
|
|
1242
|
+
/** Only show when hovered */
|
|
1243
|
+
showOnHover?: boolean;
|
|
1244
|
+
};
|
|
1245
|
+
declare const ActionButton: {
|
|
1246
|
+
Root: react.ForwardRefExoticComponent<ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
1247
|
+
asChild?: boolean;
|
|
1248
|
+
} & react.RefAttributes<HTMLButtonElement>>;
|
|
1249
|
+
Icon: react.ForwardRefExoticComponent<HTMLAttributes<HTMLSpanElement> & {
|
|
1250
|
+
asChild?: boolean;
|
|
1251
|
+
} & react.RefAttributes<HTMLSpanElement>>;
|
|
1252
|
+
Label: react.ForwardRefExoticComponent<HTMLAttributes<HTMLSpanElement> & {
|
|
1253
|
+
asChild?: boolean;
|
|
1254
|
+
} & {
|
|
1255
|
+
/** Visually hidden but accessible to screen readers */
|
|
1256
|
+
srOnly?: boolean;
|
|
1257
|
+
} & react.RefAttributes<HTMLSpanElement>>;
|
|
1258
|
+
Tooltip: react.ForwardRefExoticComponent<HTMLAttributes<HTMLSpanElement> & {
|
|
1259
|
+
asChild?: boolean;
|
|
1260
|
+
} & {
|
|
1261
|
+
/** Position relative to button */
|
|
1262
|
+
position?: "top" | "bottom" | "left" | "right";
|
|
1263
|
+
/** Only show when hovered */
|
|
1264
|
+
showOnHover?: boolean;
|
|
1265
|
+
} & react.RefAttributes<HTMLSpanElement>>;
|
|
1266
|
+
};
|
|
1267
|
+
|
|
1268
|
+
/**
|
|
1269
|
+
* useStreaming hook
|
|
1270
|
+
* Handles AsyncGenerator streaming responses with cancellation support
|
|
1271
|
+
*/
|
|
1272
|
+
|
|
1273
|
+
interface UseStreamingOptions {
|
|
1274
|
+
onChunk?: (content: string) => void;
|
|
1275
|
+
onError?: (error: string) => void;
|
|
1276
|
+
onDone?: () => void;
|
|
1277
|
+
}
|
|
1278
|
+
declare function useStreaming(options?: UseStreamingOptions): {
|
|
1279
|
+
content: string;
|
|
1280
|
+
isStreaming: boolean;
|
|
1281
|
+
error: Error | null;
|
|
1282
|
+
processStream: (stream: AsyncGenerator<StreamChunk>, signal?: AbortSignal) => Promise<void>;
|
|
1283
|
+
cancel: () => void;
|
|
1284
|
+
reset: () => void;
|
|
1285
|
+
};
|
|
1286
|
+
|
|
1287
|
+
/**
|
|
1288
|
+
* Translation hook using locale from IotaContext
|
|
1289
|
+
*/
|
|
1290
|
+
declare function useTranslation(): {
|
|
1291
|
+
t: (key: string, params?: Record<string, any>) => string;
|
|
1292
|
+
locale: string;
|
|
1293
|
+
};
|
|
1294
|
+
|
|
1295
|
+
/**
|
|
1296
|
+
* Hook to prevent body scroll when modal is open
|
|
1297
|
+
* Restores scroll on cleanup or when modal closes
|
|
1298
|
+
*
|
|
1299
|
+
* @param isOpen - Whether the modal is currently open
|
|
1300
|
+
*
|
|
1301
|
+
* @example
|
|
1302
|
+
* const [isModalOpen, setIsModalOpen] = useState(false)
|
|
1303
|
+
* useModalLock(isModalOpen)
|
|
1304
|
+
*/
|
|
1305
|
+
declare function useModalLock(isOpen: boolean): void;
|
|
1306
|
+
|
|
1307
|
+
/**
|
|
1308
|
+
* Hook to trap focus within a container (for modals, sidebars)
|
|
1309
|
+
* Ensures Tab and Shift+Tab cycle through focusable elements only
|
|
1310
|
+
*
|
|
1311
|
+
* @param containerRef - React ref to the container element
|
|
1312
|
+
* @param isActive - Whether the focus trap is currently active
|
|
1313
|
+
* @param restoreFocusOnDeactivate - Element to restore focus to when deactivated
|
|
1314
|
+
*
|
|
1315
|
+
* @example
|
|
1316
|
+
* const modalRef = useRef<HTMLDivElement>(null)
|
|
1317
|
+
* useFocusTrap(modalRef, isOpen)
|
|
1318
|
+
*/
|
|
1319
|
+
declare function useFocusTrap(containerRef: RefObject<HTMLElement | null>, isActive: boolean, restoreFocusOnDeactivate?: HTMLElement | null): void;
|
|
1320
|
+
|
|
1321
|
+
/**
|
|
1322
|
+
* useImageGallery Hook
|
|
1323
|
+
* Manages image modal/gallery state and navigation
|
|
1324
|
+
*/
|
|
1325
|
+
|
|
1326
|
+
interface UseImageGalleryOptions {
|
|
1327
|
+
/** Initial images to display */
|
|
1328
|
+
images?: ImageAttachment[];
|
|
1329
|
+
/** Wrap navigation at boundaries (default: false) */
|
|
1330
|
+
wrap?: boolean;
|
|
1331
|
+
/** Callback when modal opens */
|
|
1332
|
+
onOpen?: (index: number) => void;
|
|
1333
|
+
/** Callback when modal closes */
|
|
1334
|
+
onClose?: () => void;
|
|
1335
|
+
/** Callback when navigation occurs */
|
|
1336
|
+
onNavigate?: (index: number, direction: 'prev' | 'next') => void;
|
|
1337
|
+
}
|
|
1338
|
+
interface UseImageGalleryReturn {
|
|
1339
|
+
/** Whether the gallery modal is open */
|
|
1340
|
+
isOpen: boolean;
|
|
1341
|
+
/** Current image index */
|
|
1342
|
+
currentIndex: number;
|
|
1343
|
+
/** Current image (or undefined if none) */
|
|
1344
|
+
currentImage: ImageAttachment | undefined;
|
|
1345
|
+
/** All images in the gallery */
|
|
1346
|
+
images: ImageAttachment[];
|
|
1347
|
+
/** Whether there's a previous image */
|
|
1348
|
+
hasPrev: boolean;
|
|
1349
|
+
/** Whether there's a next image */
|
|
1350
|
+
hasNext: boolean;
|
|
1351
|
+
/** Open gallery at specific index */
|
|
1352
|
+
open: (index: number, newImages?: ImageAttachment[]) => void;
|
|
1353
|
+
/** Close the gallery */
|
|
1354
|
+
close: () => void;
|
|
1355
|
+
/** Navigate to previous image */
|
|
1356
|
+
prev: () => void;
|
|
1357
|
+
/** Navigate to next image */
|
|
1358
|
+
next: () => void;
|
|
1359
|
+
/** Navigate to specific index */
|
|
1360
|
+
goTo: (index: number) => void;
|
|
1361
|
+
/** Set images without opening */
|
|
1362
|
+
setImages: (images: ImageAttachment[]) => void;
|
|
1363
|
+
}
|
|
1364
|
+
/**
|
|
1365
|
+
* Hook for managing image gallery/modal state
|
|
1366
|
+
*
|
|
1367
|
+
* @example
|
|
1368
|
+
* ```tsx
|
|
1369
|
+
* const gallery = useImageGallery({ images: attachments })
|
|
1370
|
+
*
|
|
1371
|
+
* // Open gallery
|
|
1372
|
+
* <button onClick={() => gallery.open(0)}>View Images</button>
|
|
1373
|
+
*
|
|
1374
|
+
* // Render gallery
|
|
1375
|
+
* {gallery.isOpen && (
|
|
1376
|
+
* <ImageModal
|
|
1377
|
+
* image={gallery.currentImage}
|
|
1378
|
+
* onClose={gallery.close}
|
|
1379
|
+
* onPrev={gallery.prev}
|
|
1380
|
+
* onNext={gallery.next}
|
|
1381
|
+
* hasPrev={gallery.hasPrev}
|
|
1382
|
+
* hasNext={gallery.hasNext}
|
|
1383
|
+
* />
|
|
1384
|
+
* )}
|
|
1385
|
+
* ```
|
|
1386
|
+
*/
|
|
1387
|
+
declare function useImageGallery(options?: UseImageGalleryOptions): UseImageGalleryReturn;
|
|
1388
|
+
|
|
1389
|
+
/**
|
|
1390
|
+
* useAutoScroll Hook
|
|
1391
|
+
* Manages auto-scroll behavior for chat containers
|
|
1392
|
+
*/
|
|
1393
|
+
interface UseAutoScrollOptions {
|
|
1394
|
+
/** Threshold in pixels from bottom to consider "at bottom" (default: 100) */
|
|
1395
|
+
threshold?: number;
|
|
1396
|
+
/** Smooth scroll behavior (default: true) */
|
|
1397
|
+
smooth?: boolean;
|
|
1398
|
+
/** Callback when scroll position changes */
|
|
1399
|
+
onScroll?: (isAtBottom: boolean) => void;
|
|
1400
|
+
}
|
|
1401
|
+
interface UseAutoScrollReturn {
|
|
1402
|
+
/** Ref to attach to the scrollable container */
|
|
1403
|
+
containerRef: React.RefObject<HTMLDivElement>;
|
|
1404
|
+
/** Whether the container is scrolled to the bottom */
|
|
1405
|
+
isAtBottom: boolean;
|
|
1406
|
+
/** Whether auto-scroll should be active */
|
|
1407
|
+
shouldAutoScroll: boolean;
|
|
1408
|
+
/** Manually scroll to bottom */
|
|
1409
|
+
scrollToBottom: (smooth?: boolean) => void;
|
|
1410
|
+
/** Enable/disable auto-scroll */
|
|
1411
|
+
setAutoScroll: (enabled: boolean) => void;
|
|
1412
|
+
/** Handle scroll event (attach to container if not using ref) */
|
|
1413
|
+
handleScroll: (e: React.UIEvent<HTMLDivElement>) => void;
|
|
1414
|
+
}
|
|
1415
|
+
/**
|
|
1416
|
+
* Hook for managing auto-scroll behavior in chat containers
|
|
1417
|
+
*
|
|
1418
|
+
* @example
|
|
1419
|
+
* ```tsx
|
|
1420
|
+
* const scroll = useAutoScroll({ threshold: 50 })
|
|
1421
|
+
*
|
|
1422
|
+
* // Attach to container
|
|
1423
|
+
* <div ref={scroll.containerRef} onScroll={scroll.handleScroll}>
|
|
1424
|
+
* {messages.map(msg => <Message key={msg.id} />)}
|
|
1425
|
+
* </div>
|
|
1426
|
+
*
|
|
1427
|
+
* // Scroll button
|
|
1428
|
+
* {!scroll.isAtBottom && (
|
|
1429
|
+
* <button onClick={() => scroll.scrollToBottom()}>
|
|
1430
|
+
* Scroll to bottom
|
|
1431
|
+
* </button>
|
|
1432
|
+
* )}
|
|
1433
|
+
* ```
|
|
1434
|
+
*/
|
|
1435
|
+
declare function useAutoScroll(options?: UseAutoScrollOptions): UseAutoScrollReturn;
|
|
1436
|
+
|
|
1437
|
+
/**
|
|
1438
|
+
* useMessageActions Hook
|
|
1439
|
+
* Provides copy, regenerate, and edit functionality for messages
|
|
1440
|
+
*/
|
|
1441
|
+
interface UseMessageActionsOptions {
|
|
1442
|
+
/** Callback when copy succeeds */
|
|
1443
|
+
onCopy?: (content: string) => void;
|
|
1444
|
+
/** Callback when copy fails */
|
|
1445
|
+
onCopyError?: (error: Error) => void;
|
|
1446
|
+
/** Callback when regenerate is triggered */
|
|
1447
|
+
onRegenerate?: () => void | Promise<void>;
|
|
1448
|
+
/** Callback when edit is triggered */
|
|
1449
|
+
onEdit?: (content: string) => void | Promise<void>;
|
|
1450
|
+
/** Duration to show "copied" state in ms (default: 2000) */
|
|
1451
|
+
copiedDuration?: number;
|
|
1452
|
+
}
|
|
1453
|
+
interface UseMessageActionsReturn {
|
|
1454
|
+
/** Whether content was recently copied */
|
|
1455
|
+
isCopied: boolean;
|
|
1456
|
+
/** Whether regenerate is in progress */
|
|
1457
|
+
isRegenerating: boolean;
|
|
1458
|
+
/** Whether edit is in progress */
|
|
1459
|
+
isEditing: boolean;
|
|
1460
|
+
/** Copy content to clipboard */
|
|
1461
|
+
copy: (content: string) => Promise<void>;
|
|
1462
|
+
/** Trigger regenerate action */
|
|
1463
|
+
regenerate: () => Promise<void>;
|
|
1464
|
+
/** Trigger edit action */
|
|
1465
|
+
edit: (content: string) => Promise<void>;
|
|
1466
|
+
/** Reset all states */
|
|
1467
|
+
reset: () => void;
|
|
1468
|
+
}
|
|
1469
|
+
/**
|
|
1470
|
+
* Hook for managing message actions (copy, regenerate, edit)
|
|
1471
|
+
*
|
|
1472
|
+
* @example
|
|
1473
|
+
* ```tsx
|
|
1474
|
+
* const actions = useMessageActions({
|
|
1475
|
+
* onRegenerate: () => chatContext.regenerateMessage(messageId),
|
|
1476
|
+
* onEdit: (content) => chatContext.editMessage(messageId, content),
|
|
1477
|
+
* onCopy: () => toast.success('Copied!'),
|
|
1478
|
+
* })
|
|
1479
|
+
*
|
|
1480
|
+
* <button onClick={() => actions.copy(message.content)}>
|
|
1481
|
+
* {actions.isCopied ? 'Copied!' : 'Copy'}
|
|
1482
|
+
* </button>
|
|
1483
|
+
*
|
|
1484
|
+
* <button onClick={actions.regenerate} disabled={actions.isRegenerating}>
|
|
1485
|
+
* {actions.isRegenerating ? 'Regenerating...' : 'Regenerate'}
|
|
1486
|
+
* </button>
|
|
1487
|
+
* ```
|
|
1488
|
+
*/
|
|
1489
|
+
declare function useMessageActions(options?: UseMessageActionsOptions): UseMessageActionsReturn;
|
|
1490
|
+
|
|
1491
|
+
/**
|
|
1492
|
+
* useAttachments Hook
|
|
1493
|
+
* Manages file upload state, validation, and preview
|
|
1494
|
+
*/
|
|
1495
|
+
|
|
1496
|
+
interface FileValidationError {
|
|
1497
|
+
file: File;
|
|
1498
|
+
reason: 'size' | 'type' | 'count' | 'custom';
|
|
1499
|
+
message: string;
|
|
1500
|
+
}
|
|
1501
|
+
interface UseAttachmentsOptions {
|
|
1502
|
+
/** Maximum number of files (default: 10) */
|
|
1503
|
+
maxFiles?: number;
|
|
1504
|
+
/** Maximum file size in bytes (default: 10MB) */
|
|
1505
|
+
maxFileSize?: number;
|
|
1506
|
+
/** Allowed MIME types (default: images only) */
|
|
1507
|
+
allowedTypes?: string[];
|
|
1508
|
+
/** Custom validation function */
|
|
1509
|
+
validate?: (file: File) => string | null;
|
|
1510
|
+
/** Callback when files are added */
|
|
1511
|
+
onAdd?: (files: Attachment[]) => void;
|
|
1512
|
+
/** Callback when a file is removed */
|
|
1513
|
+
onRemove?: (file: Attachment) => void;
|
|
1514
|
+
/** Callback when validation fails */
|
|
1515
|
+
onError?: (errors: FileValidationError[]) => void;
|
|
1516
|
+
}
|
|
1517
|
+
interface UseAttachmentsReturn {
|
|
1518
|
+
/** Current attachments */
|
|
1519
|
+
files: Attachment[];
|
|
1520
|
+
/** Validation errors from last operation */
|
|
1521
|
+
errors: FileValidationError[];
|
|
1522
|
+
/** Whether files are being processed */
|
|
1523
|
+
isProcessing: boolean;
|
|
1524
|
+
/** Whether max file limit is reached */
|
|
1525
|
+
isMaxReached: boolean;
|
|
1526
|
+
/** Number of remaining slots */
|
|
1527
|
+
remainingSlots: number;
|
|
1528
|
+
/** Add files (validates and processes) */
|
|
1529
|
+
add: (files: FileList | File[]) => Promise<void>;
|
|
1530
|
+
/** Remove a specific file */
|
|
1531
|
+
remove: (fileOrId: Attachment | string) => void;
|
|
1532
|
+
/** Clear all files */
|
|
1533
|
+
clear: () => void;
|
|
1534
|
+
/** Clear errors */
|
|
1535
|
+
clearErrors: () => void;
|
|
1536
|
+
/** Set files directly (for controlled mode) */
|
|
1537
|
+
setFiles: (files: Attachment[]) => void;
|
|
1538
|
+
}
|
|
1539
|
+
/**
|
|
1540
|
+
* Hook for managing file attachments
|
|
1541
|
+
*
|
|
1542
|
+
* @example
|
|
1543
|
+
* ```tsx
|
|
1544
|
+
* const attachments = useAttachments({
|
|
1545
|
+
* maxFiles: 5,
|
|
1546
|
+
* maxFileSize: 5 * 1024 * 1024, // 5MB
|
|
1547
|
+
* onError: (errors) => errors.forEach(e => toast.error(e.message)),
|
|
1548
|
+
* })
|
|
1549
|
+
*
|
|
1550
|
+
* <input
|
|
1551
|
+
* type="file"
|
|
1552
|
+
* multiple
|
|
1553
|
+
* accept="image/*"
|
|
1554
|
+
* onChange={(e) => attachments.add(e.target.files)}
|
|
1555
|
+
* />
|
|
1556
|
+
*
|
|
1557
|
+
* {attachments.files.map(file => (
|
|
1558
|
+
* <AttachmentPreview
|
|
1559
|
+
* key={file.id}
|
|
1560
|
+
* attachment={file}
|
|
1561
|
+
* onRemove={() => attachments.remove(file)}
|
|
1562
|
+
* />
|
|
1563
|
+
* ))}
|
|
1564
|
+
*
|
|
1565
|
+
* {attachments.errors.length > 0 && (
|
|
1566
|
+
* <ErrorList errors={attachments.errors} />
|
|
1567
|
+
* )}
|
|
1568
|
+
* ```
|
|
1569
|
+
*/
|
|
1570
|
+
declare function useAttachments(options?: UseAttachmentsOptions): UseAttachmentsReturn;
|
|
1571
|
+
|
|
1572
|
+
/**
|
|
1573
|
+
* useMarkdownCopy Hook
|
|
1574
|
+
* Manages copy-to-clipboard state for code blocks in markdown
|
|
1575
|
+
*/
|
|
1576
|
+
interface UseMarkdownCopyOptions {
|
|
1577
|
+
/** Duration to show "copied" state in ms (default: 2000) */
|
|
1578
|
+
copiedDuration?: number;
|
|
1579
|
+
/** Callback when copy succeeds */
|
|
1580
|
+
onCopy?: (content: string, language?: string) => void;
|
|
1581
|
+
/** Callback when copy fails */
|
|
1582
|
+
onError?: (error: Error) => void;
|
|
1583
|
+
}
|
|
1584
|
+
interface UseMarkdownCopyReturn {
|
|
1585
|
+
/** Map of copied states by block ID */
|
|
1586
|
+
copiedStates: Map<string, boolean>;
|
|
1587
|
+
/** Check if a specific block is in copied state */
|
|
1588
|
+
isCopied: (blockId: string) => boolean;
|
|
1589
|
+
/** Copy content with block ID tracking */
|
|
1590
|
+
copy: (blockId: string, content: string, language?: string) => Promise<void>;
|
|
1591
|
+
/** Reset copied state for a specific block */
|
|
1592
|
+
reset: (blockId: string) => void;
|
|
1593
|
+
/** Reset all copied states */
|
|
1594
|
+
resetAll: () => void;
|
|
1595
|
+
}
|
|
1596
|
+
/**
|
|
1597
|
+
* Hook for managing copy states for multiple code blocks
|
|
1598
|
+
*
|
|
1599
|
+
* @example
|
|
1600
|
+
* ```tsx
|
|
1601
|
+
* const markdownCopy = useMarkdownCopy({
|
|
1602
|
+
* onCopy: (content, lang) => console.log(`Copied ${lang} code`),
|
|
1603
|
+
* })
|
|
1604
|
+
*
|
|
1605
|
+
* function CodeBlock({ id, code, language }) {
|
|
1606
|
+
* return (
|
|
1607
|
+
* <div>
|
|
1608
|
+
* <pre>{code}</pre>
|
|
1609
|
+
* <button onClick={() => markdownCopy.copy(id, code, language)}>
|
|
1610
|
+
* {markdownCopy.isCopied(id) ? 'Copied!' : 'Copy'}
|
|
1611
|
+
* </button>
|
|
1612
|
+
* </div>
|
|
1613
|
+
* )
|
|
1614
|
+
* }
|
|
1615
|
+
* ```
|
|
1616
|
+
*/
|
|
1617
|
+
declare function useMarkdownCopy(options?: UseMarkdownCopyOptions): UseMarkdownCopyReturn;
|
|
440
1618
|
|
|
441
1619
|
/**
|
|
442
1620
|
* Framer Motion animation variants for BiChat UI
|
|
@@ -870,33 +2048,6 @@ declare function useRequiredConfig(): BiChatConfig;
|
|
|
870
2048
|
*/
|
|
871
2049
|
declare function hasPermission(config: BiChatConfig | null, permission: string): boolean;
|
|
872
2050
|
|
|
873
|
-
/**
|
|
874
|
-
* useStreaming hook
|
|
875
|
-
* Handles AsyncGenerator streaming responses with cancellation support
|
|
876
|
-
*/
|
|
877
|
-
|
|
878
|
-
interface UseStreamingOptions {
|
|
879
|
-
onChunk?: (content: string) => void;
|
|
880
|
-
onError?: (error: string) => void;
|
|
881
|
-
onDone?: () => void;
|
|
882
|
-
}
|
|
883
|
-
declare function useStreaming(options?: UseStreamingOptions): {
|
|
884
|
-
content: string;
|
|
885
|
-
isStreaming: boolean;
|
|
886
|
-
error: Error | null;
|
|
887
|
-
processStream: (stream: AsyncGenerator<StreamChunk>, signal?: AbortSignal) => Promise<void>;
|
|
888
|
-
cancel: () => void;
|
|
889
|
-
reset: () => void;
|
|
890
|
-
};
|
|
891
|
-
|
|
892
|
-
/**
|
|
893
|
-
* Translation hook using locale from IotaContext
|
|
894
|
-
*/
|
|
895
|
-
declare function useTranslation(): {
|
|
896
|
-
t: (key: string, params?: Record<string, any>) => string;
|
|
897
|
-
locale: string;
|
|
898
|
-
};
|
|
899
|
-
|
|
900
2051
|
/**
|
|
901
2052
|
* Theme system type definitions
|
|
902
2053
|
*/
|
|
@@ -981,6 +2132,8 @@ declare function createHeadersWithCSRF(init?: HeadersInit): Headers;
|
|
|
981
2132
|
/**
|
|
982
2133
|
* Built-in HTTP data source with SSE streaming and AbortController
|
|
983
2134
|
* Implements ChatDataSource interface with real HTTP/GraphQL calls
|
|
2135
|
+
*
|
|
2136
|
+
* Uses turn-based architecture - fetches ConversationTurns instead of flat messages.
|
|
984
2137
|
*/
|
|
985
2138
|
|
|
986
2139
|
interface HttpDataSourceConfig {
|
|
@@ -993,7 +2146,7 @@ interface HttpDataSourceConfig {
|
|
|
993
2146
|
}
|
|
994
2147
|
interface SessionState {
|
|
995
2148
|
session: Session;
|
|
996
|
-
|
|
2149
|
+
turns: ConversationTurn[];
|
|
997
2150
|
pendingQuestion?: PendingQuestion | null;
|
|
998
2151
|
}
|
|
999
2152
|
interface Result<T> {
|
|
@@ -1022,7 +2175,7 @@ declare class HttpDataSource implements ChatDataSource {
|
|
|
1022
2175
|
*/
|
|
1023
2176
|
createSession(): Promise<Session>;
|
|
1024
2177
|
/**
|
|
1025
|
-
* Fetch an existing session with
|
|
2178
|
+
* Fetch an existing session with turns (turn-based architecture)
|
|
1026
2179
|
*/
|
|
1027
2180
|
fetchSession(id: string): Promise<SessionState | null>;
|
|
1028
2181
|
/**
|
|
@@ -1078,4 +2231,43 @@ declare function formatFileSize(bytes: number): string;
|
|
|
1078
2231
|
*/
|
|
1079
2232
|
declare function validateFileCount(currentCount: number, newCount: number, maxCount?: number): void;
|
|
1080
2233
|
|
|
1081
|
-
|
|
2234
|
+
/**
|
|
2235
|
+
* Citation Processing Utility
|
|
2236
|
+
*
|
|
2237
|
+
* Transforms OpenAI citations from raw markers (e.g., ≡cite≡turn0search2≡)
|
|
2238
|
+
* to formatted inline citation markers (e.g., [1], [2]).
|
|
2239
|
+
*
|
|
2240
|
+
* Process:
|
|
2241
|
+
* 1. Sort citations by startIndex (descending) to process from end to start
|
|
2242
|
+
* 2. Replace character ranges [startIndex, endIndex] with numbered markers
|
|
2243
|
+
* 3. Return processed content with clean inline citation references
|
|
2244
|
+
*/
|
|
2245
|
+
|
|
2246
|
+
interface ProcessedContent {
|
|
2247
|
+
/** Content with citation markers replaced by [1], [2], etc. */
|
|
2248
|
+
content: string;
|
|
2249
|
+
/** Citations array with their display indices */
|
|
2250
|
+
citations: Array<Citation & {
|
|
2251
|
+
displayIndex: number;
|
|
2252
|
+
}>;
|
|
2253
|
+
}
|
|
2254
|
+
/**
|
|
2255
|
+
* Process message content to replace raw citation markers with formatted inline citations
|
|
2256
|
+
*
|
|
2257
|
+
* @param content - Raw message content with potential citation markers
|
|
2258
|
+
* @param citations - Array of citations with startIndex/endIndex positions
|
|
2259
|
+
* @returns Processed content with clean citation markers and indexed citations
|
|
2260
|
+
*
|
|
2261
|
+
* @example
|
|
2262
|
+
* ```ts
|
|
2263
|
+
* const result = processCitations(
|
|
2264
|
+
* "Tesla reported $28B ≡cite≡turn0search2≡ revenue",
|
|
2265
|
+
* [{ startIndex: 20, endIndex: 42, title: "...", url: "...", type: "url_citation" }]
|
|
2266
|
+
* )
|
|
2267
|
+
* // result.content = "Tesla reported $28B [1] revenue"
|
|
2268
|
+
* // result.citations = [{ ..., displayIndex: 1 }]
|
|
2269
|
+
* ```
|
|
2270
|
+
*/
|
|
2271
|
+
declare function processCitations(content: string, citations: Citation[] | null | undefined): ProcessedContent;
|
|
2272
|
+
|
|
2273
|
+
export { ActionButton, type ActionButtonIconProps, type ActionButtonLabelProps, type ActionButtonRootProps, type ActionButtonTooltipProps, type AppConfig, type Artifact, type AsChildProps, AssistantMessage, type AssistantMessageActionsSlotProps, type AssistantMessageArtifactsSlotProps, type AssistantMessageAvatarSlotProps, type AssistantMessageChartsSlotProps, type AssistantMessageClassNames, type AssistantMessageCodeOutputsSlotProps, type AssistantMessageContentSlotProps, type AssistantMessageExplanationSlotProps, type AssistantMessageProps, type AssistantMessageSlots, type AssistantMessageSourcesSlotProps, type AssistantTurn, AssistantTurnView, type AssistantTurnViewProps, type Attachment, MemoizedAttachmentGrid as AttachmentGrid, Avatar, type AvatarFallbackProps, type AvatarImageProps, type AvatarRootProps, type BiChatConfig, Bubble, type BubbleContentProps, type BubbleFooterProps, type BubbleHeaderProps, type BubbleMetadataProps, type BubbleRootProps, type BubbleVariant, ChartCard, type ChartData, type ChartSeries, type ChatDataSource, ChatHeader, ChatSession, type ChatSessionContextValue, ChatSessionProvider, type Citation, MemoizedCodeBlock as CodeBlock, type CodeOutput, CodeOutputsPanel, ConfigProvider, ConfirmModal, type ConfirmModalProps, type ConversationTurn, DefaultErrorContent, DownloadCard, MemoizedEditableText as EditableText, type EditableTextProps, type EditableTextRef, MemoizedEmptyState as EmptyState, type EmptyStateProps, ErrorBoundary, type FileValidationError, HttpDataSource, type HttpDataSourceConfig, type ImageAttachment, type ImageLoadingStatus, ImageModal, InlineQuestionForm, type IotaContext, IotaContextProvider, ListItemSkeleton, MemoizedLoadingSpinner as LoadingSpinner, type LocaleContext, MemoizedMarkdownRenderer as MarkdownRenderer, MessageInput, type MessageInputProps, type MessageInputRef, MessageList, MessageRole, type PendingQuestion, PermissionGuard, type PermissionGuardProps, type ProcessedContent, type Question, type QuestionAnswerData, type QuestionAnswers, type QuestionOption, type QueuedMessage, RateLimiter, type RateLimiterConfig, ScrollToBottomButton, MemoizedSearchInput as SearchInput, type SearchInputProps, type Session, MemoizedSkeleton as Skeleton, SkeletonAvatar, SkeletonCard, SkeletonGroup, type SkeletonGroupProps, type SkeletonProps, SkeletonText, Slot, type SlotProps, SourcesPanel, type StreamChunk, StreamingCursor, TableExportButton, TableWithExport, type TenantContext, type Theme, type ThemeBorderRadius, type ThemeColors, ThemeProvider, type ThemeSpacing, Toast, ToastContainer, type ToastItem, type ToastProps, type ToastType, type ToolCall, Turn, type TurnActionsProps, type TurnAssistantProps, TurnBubble, type TurnBubbleClassNames, type TurnBubbleProps, type TurnRootProps, type TurnTimestampProps, type TurnUserProps, MemoizedTypingIndicator as TypingIndicator, type TypingIndicatorProps, type TypingIndicatorVariant, type UseAttachmentsOptions, type UseAttachmentsReturn, type UseAutoScrollOptions, type UseAutoScrollReturn, type UseImageGalleryOptions, type UseImageGalleryReturn, type UseMarkdownCopyOptions, type UseMarkdownCopyReturn, type UseMessageActionsOptions, type UseMessageActionsReturn, type UseToastReturn, MemoizedUserAvatar as UserAvatar, type UserAvatarProps, type UserContext, UserMessage, type UserMessageActionsSlotProps, type UserMessageAttachmentsSlotProps, type UserMessageAvatarSlotProps, type UserMessageClassNames, type UserMessageContentSlotProps, type UserMessageProps, type UserMessageSlots, type UserTurn, UserTurnView, type UserTurnViewProps, WelcomeContent, addCSRFHeader, backdropVariants, buttonVariants, convertToBase64, createDataUrl, createHeadersWithCSRF, createHttpDataSource, darkTheme, dropdownVariants, fadeInUpVariants, fadeInVariants, floatingButtonVariants, formatFileSize, getCSRFToken, getValidChildren, hasPermission as hasConfigPermission, hasPermission$1 as hasPermission, lightTheme, listItemVariants, messageContainerVariants, messageVariants, processCitations, scaleFadeVariants, staggerContainerVariants, toastVariants, typingDotVariants, useActionButtonContext, useAttachments, useAutoScroll, useAvatarContext, useBubbleContext, useChat, useConfig, useFocusTrap, useImageGallery, useIotaContext, useMarkdownCopy, useMessageActions, useModalLock, useRequiredConfig, useStreaming, useTheme, useToast, useTranslation, useTurnContext, validateFileCount, validateImageFile };
|