@iota-uz/sdk 0.1.2 → 0.3.1

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.
@@ -1,11 +1,13 @@
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, FC, HTMLAttributes, ReactElement, ImgHTMLAttributes, ButtonHTMLAttributes, RefObject } from 'react';
4
+ import { I as InitialContext, A as AppConfig$1, L as LocaleContext$1, c as TenantContext$1, U as UserContext$1 } from '../index-B73-BCi-.cjs';
5
+ import { File as File$1 } from '@phosphor-icons/react';
4
6
 
5
7
  /**
6
8
  * Type definitions for BI-Chat UI components
7
9
  */
8
- interface Session {
10
+ interface Session$1 {
9
11
  id: string;
10
12
  title: string;
11
13
  status: 'active' | 'archived';
@@ -13,65 +15,140 @@ interface Session {
13
15
  createdAt: string;
14
16
  updatedAt: string;
15
17
  }
16
- declare enum MessageRole {
17
- User = "user",
18
- Assistant = "assistant",
19
- System = "system",
20
- Tool = "tool"
21
- }
22
- interface Message {
18
+ /**
19
+ * A conversation turn groups a user message with its assistant response.
20
+ * This provides a cleaner mental model than flat message lists.
21
+ */
22
+ interface ConversationTurn$1 {
23
23
  id: string;
24
24
  sessionId: string;
25
- role: MessageRole;
25
+ userTurn: UserTurn$1;
26
+ assistantTurn?: AssistantTurn$1;
27
+ createdAt: string;
28
+ }
29
+ /**
30
+ * Content of a user's message in a conversation turn
31
+ */
32
+ interface UserTurn$1 {
33
+ id: string;
26
34
  content: string;
35
+ attachments: Attachment$1[];
27
36
  createdAt: string;
28
- toolCalls?: ToolCall[];
29
- citations?: Citation[];
30
- chartData?: ChartData;
31
- artifacts?: Artifact[];
37
+ }
38
+ /**
39
+ * Content of an assistant's response in a conversation turn
40
+ */
41
+ interface AssistantTurn$1 {
42
+ id: string;
43
+ role?: MessageRole;
44
+ content: string;
32
45
  explanation?: string;
46
+ citations: Citation$1[];
47
+ toolCalls?: ToolCall$1[];
48
+ chartData?: ChartData;
49
+ artifacts: Artifact$1[];
50
+ codeOutputs: CodeOutput$1[];
51
+ debug?: DebugTrace$1;
52
+ createdAt: string;
33
53
  }
34
- interface ToolCall {
54
+ /**
55
+ * Role of a message in a conversation
56
+ */
57
+ declare enum MessageRole {
58
+ User = "user",
59
+ Assistant = "assistant",
60
+ System = "system",
61
+ Tool = "tool"
62
+ }
63
+ /**
64
+ * A tool/function call made by the assistant
65
+ */
66
+ interface ToolCall$1 {
35
67
  id: string;
36
68
  name: string;
37
69
  arguments: string;
70
+ result?: string;
71
+ error?: string;
72
+ durationMs?: number;
38
73
  }
39
- interface Citation {
74
+ /**
75
+ * Citation with position information for inline replacement
76
+ */
77
+ interface Citation$1 {
40
78
  id: string;
41
- source: string;
42
- url?: string;
79
+ /** Type of citation (e.g., "url_citation") */
80
+ type: string;
81
+ /** Title of the cited source */
82
+ title: string;
83
+ /** URL of the cited source */
84
+ url: string;
85
+ /** Starting character index in the message content where this citation is referenced */
86
+ startIndex: number;
87
+ /** Ending character index in the message content where this citation is referenced */
88
+ endIndex: number;
89
+ /** Optional excerpt from the source */
43
90
  excerpt?: string;
91
+ /** Legacy: source name (for backward compatibility) */
92
+ source?: string;
44
93
  }
45
- interface Attachment {
46
- id: string;
94
+ interface Attachment$1 {
95
+ id?: string;
47
96
  filename: string;
48
97
  mimeType: string;
49
98
  sizeBytes: number;
50
99
  base64Data?: string;
100
+ url?: string;
101
+ preview?: string;
51
102
  }
52
- interface ImageAttachment {
53
- filename: string;
54
- mimeType: string;
55
- sizeBytes: number;
103
+ type ImageAttachment = Attachment$1 & {
56
104
  base64Data: string;
57
105
  preview: string;
58
- }
59
- interface CodeOutput {
106
+ };
107
+ /**
108
+ * Output from code interpreter tool
109
+ */
110
+ interface CodeOutput$1 {
60
111
  type: 'image' | 'text' | 'error';
61
- content: string | ImageAttachment;
112
+ content: string;
113
+ /** File metadata for downloadable outputs */
114
+ filename?: string;
115
+ mimeType?: string;
116
+ sizeBytes?: number;
62
117
  }
118
+ /**
119
+ * Queued message for offline/loading state
120
+ */
63
121
  interface QueuedMessage {
64
122
  content: string;
65
- attachments: ImageAttachment[];
123
+ attachments: Attachment$1[];
66
124
  }
125
+ /**
126
+ * Chart visualization data for ApexCharts
127
+ */
67
128
  interface ChartData {
68
- type: 'bar' | 'line' | 'pie' | 'area';
69
- title?: string;
70
- data: any[];
71
- xAxisKey?: string;
72
- yAxisKey?: string;
129
+ /** Type of chart: line, bar, pie, area, or donut */
130
+ chartType: 'line' | 'bar' | 'area' | 'pie' | 'donut';
131
+ /** Chart title displayed above the chart */
132
+ title: string;
133
+ /** Data series (multiple allowed for line/bar/area, single for pie/donut) */
134
+ series: ChartSeries[];
135
+ /** X-axis category labels or segment labels for pie/donut */
136
+ labels?: string[];
137
+ /** Hex color codes for series (e.g., '#4CAF50') */
138
+ colors?: string[];
139
+ /** Chart height in pixels */
140
+ height?: number;
73
141
  }
74
- interface Artifact {
142
+ /**
143
+ * A single data series in a chart
144
+ */
145
+ interface ChartSeries {
146
+ /** Display name for this series */
147
+ name: string;
148
+ /** Numeric data values */
149
+ data: number[];
150
+ }
151
+ interface Artifact$1 {
75
152
  type: 'excel' | 'pdf';
76
153
  filename: string;
77
154
  url: string;
@@ -79,75 +156,286 @@ interface Artifact {
79
156
  rowCount?: number;
80
157
  description?: string;
81
158
  }
82
- interface PendingQuestion {
159
+ interface SessionArtifact {
160
+ id: string;
161
+ sessionId: string;
162
+ messageId?: string;
163
+ type: string;
164
+ name: string;
165
+ description?: string;
166
+ mimeType?: string;
167
+ url?: string;
168
+ sizeBytes: number;
169
+ metadata?: Record<string, unknown>;
170
+ createdAt: string;
171
+ }
172
+ interface PendingQuestion$1 {
83
173
  id: string;
84
174
  turnId: string;
85
- question: string;
86
- type: 'MULTIPLE_CHOICE' | 'FREE_TEXT';
87
- options?: string[];
175
+ questions: Question[];
88
176
  status: 'PENDING' | 'ANSWERED' | 'CANCELLED';
89
177
  }
90
- type QuestionAnswers = Record<string, string>;
178
+ interface Question {
179
+ id: string;
180
+ text: string;
181
+ type: 'SINGLE_CHOICE' | 'MULTIPLE_CHOICE';
182
+ options?: QuestionOption[];
183
+ required?: boolean;
184
+ }
185
+ interface QuestionOption {
186
+ id: string;
187
+ label: string;
188
+ value: string;
189
+ }
190
+ /**
191
+ * Answer data for a single question, including predefined options and custom "Other" text.
192
+ */
193
+ interface QuestionAnswerData {
194
+ /** Selected predefined options (labels) */
195
+ options: string[];
196
+ /** Custom text entered when user selects "Other" option */
197
+ customText?: string;
198
+ }
199
+ /**
200
+ * Map of question IDs to answer data.
201
+ * Supports both multi-select options and custom "Other" text input.
202
+ */
203
+ interface QuestionAnswers {
204
+ [questionId: string]: QuestionAnswerData;
205
+ }
91
206
  interface StreamChunk {
92
- type: 'chunk' | 'error' | 'done' | 'user_message';
207
+ type: 'chunk' | 'content' | 'tool_start' | 'tool_end' | 'usage' | 'done' | 'error' | 'user_message' | 'interrupt';
93
208
  content?: string;
94
209
  error?: string;
95
210
  sessionId?: string;
211
+ usage?: DebugUsage$1;
212
+ tool?: StreamToolPayload;
213
+ interrupt?: StreamInterruptPayload;
214
+ generationMs?: number;
215
+ timestamp?: number;
216
+ }
217
+ interface StreamInterruptPayload {
218
+ checkpointId: string;
219
+ agentName?: string;
220
+ questions: StreamInterruptQuestion[];
221
+ }
222
+ interface StreamInterruptQuestion {
223
+ id: string;
224
+ text: string;
225
+ type: string;
226
+ options: Array<{
227
+ id: string;
228
+ label: string;
229
+ }>;
230
+ }
231
+ interface DebugUsage$1 {
232
+ promptTokens: number;
233
+ completionTokens: number;
234
+ totalTokens: number;
235
+ cachedTokens?: number;
236
+ cost?: number;
237
+ }
238
+ interface StreamToolPayload {
239
+ callId?: string;
240
+ name: string;
241
+ arguments?: string;
242
+ result?: string;
243
+ error?: string;
244
+ durationMs?: number;
245
+ }
246
+ interface DebugTrace$1 {
247
+ generationMs?: number;
248
+ usage?: DebugUsage$1;
249
+ tools: StreamToolPayload[];
250
+ }
251
+ interface DebugLimits {
252
+ policyMaxTokens: number;
253
+ modelMaxTokens: number;
254
+ effectiveMaxTokens: number;
255
+ completionReserveTokens: number;
256
+ }
257
+ interface SessionDebugUsage {
258
+ promptTokens: number;
259
+ completionTokens: number;
260
+ totalTokens: number;
261
+ turnsWithUsage: number;
262
+ latestPromptTokens: number;
263
+ latestCompletionTokens: number;
264
+ latestTotalTokens: number;
265
+ }
266
+ interface SendMessageOptions {
267
+ debugMode?: boolean;
268
+ replaceFromMessageID?: string;
269
+ }
270
+ interface SessionListResult$1 {
271
+ sessions: Session$1[];
272
+ total: number;
273
+ hasMore: boolean;
274
+ }
275
+ interface SessionUser {
276
+ id: string;
277
+ firstName: string;
278
+ lastName: string;
279
+ initials: string;
280
+ }
281
+ interface SessionGroup {
282
+ name: string;
283
+ sessions: Session$1[];
96
284
  }
97
285
  interface ChatDataSource {
98
- createSession(): Promise<Session>;
286
+ createSession(): Promise<Session$1>;
99
287
  fetchSession(id: string): Promise<{
100
- session: Session;
101
- messages: Message[];
102
- pendingQuestion?: PendingQuestion | null;
288
+ session: Session$1;
289
+ turns: ConversationTurn$1[];
290
+ pendingQuestion?: PendingQuestion$1 | null;
103
291
  } | null>;
104
- sendMessage(sessionId: string, content: string, attachments?: Attachment[], signal?: AbortSignal): AsyncGenerator<StreamChunk>;
292
+ fetchSessionArtifacts?(sessionId: string, options?: {
293
+ limit?: number;
294
+ offset?: number;
295
+ }): Promise<{
296
+ artifacts: SessionArtifact[];
297
+ hasMore?: boolean;
298
+ nextOffset?: number;
299
+ }>;
300
+ uploadSessionArtifacts?(sessionId: string, files: File[]): Promise<{
301
+ artifacts: SessionArtifact[];
302
+ }>;
303
+ renameSessionArtifact?(artifactId: string, name: string, description?: string): Promise<SessionArtifact>;
304
+ deleteSessionArtifact?(artifactId: string): Promise<void>;
305
+ sendMessage(sessionId: string, content: string, attachments?: Attachment$1[], signal?: AbortSignal, options?: SendMessageOptions): AsyncGenerator<StreamChunk>;
306
+ clearSessionHistory(sessionId: string): Promise<{
307
+ success: boolean;
308
+ deletedMessages: number;
309
+ deletedArtifacts: number;
310
+ }>;
311
+ compactSessionHistory(sessionId: string): Promise<{
312
+ success: boolean;
313
+ summary: string;
314
+ deletedMessages: number;
315
+ deletedArtifacts: number;
316
+ }>;
105
317
  submitQuestionAnswers(sessionId: string, questionId: string, answers: QuestionAnswers): Promise<{
106
318
  success: boolean;
107
319
  error?: string;
108
320
  }>;
109
- cancelPendingQuestion(questionId: string): Promise<{
321
+ rejectPendingQuestion(sessionId: string): Promise<{
110
322
  success: boolean;
111
323
  error?: string;
112
324
  }>;
113
325
  navigateToSession?(sessionId: string): void;
326
+ listSessions(options?: {
327
+ limit?: number;
328
+ offset?: number;
329
+ includeArchived?: boolean;
330
+ }): Promise<SessionListResult$1>;
331
+ archiveSession(sessionId: string): Promise<Session$1>;
332
+ unarchiveSession(sessionId: string): Promise<Session$1>;
333
+ pinSession(sessionId: string): Promise<Session$1>;
334
+ unpinSession(sessionId: string): Promise<Session$1>;
335
+ deleteSession(sessionId: string): Promise<void>;
336
+ renameSession(sessionId: string, title: string): Promise<Session$1>;
337
+ regenerateSessionTitle(sessionId: string): Promise<Session$1>;
338
+ listUsers?(): Promise<SessionUser[]>;
339
+ listAllSessions?(options?: {
340
+ limit?: number;
341
+ offset?: number;
342
+ includeArchived?: boolean;
343
+ userId?: string | null;
344
+ }): Promise<{
345
+ sessions: Array<Session$1 & {
346
+ owner: SessionUser;
347
+ }>;
348
+ total: number;
349
+ hasMore: boolean;
350
+ }>;
114
351
  }
115
- interface ChatSessionContextValue {
116
- message: string;
117
- messages: Message[];
118
- loading: boolean;
119
- error: string | null;
352
+ interface ChatSessionStateValue {
353
+ session: Session$1 | null;
120
354
  currentSessionId?: string;
121
- pendingQuestion: PendingQuestion | null;
122
- session: Session | null;
123
355
  fetching: boolean;
356
+ error: string | null;
357
+ debugMode: boolean;
358
+ sessionDebugUsage: SessionDebugUsage;
359
+ debugLimits: DebugLimits | null;
360
+ setError: (error: string | null) => void;
361
+ }
362
+ interface ChatMessagingStateValue {
363
+ turns: ConversationTurn$1[];
124
364
  streamingContent: string;
125
365
  isStreaming: boolean;
126
- messageQueue: QueuedMessage[];
127
- codeOutputs: CodeOutput[];
128
- setMessage: (message: string) => void;
129
- setError: (error: string | null) => void;
130
- setCodeOutputs: (outputs: CodeOutput[]) => void;
131
- handleSubmit: (e: React.FormEvent, attachments?: ImageAttachment[]) => void;
132
- handleRegenerate?: (messageId: string) => Promise<void>;
133
- handleEdit?: (messageId: string, newContent: string) => Promise<void>;
366
+ loading: boolean;
367
+ pendingQuestion: PendingQuestion$1 | null;
368
+ codeOutputs: CodeOutput$1[];
369
+ isCompacting: boolean;
370
+ compactionSummary: string | null;
371
+ /** Bumped when artifacts should be refetched (e.g. tool_end for artifact-producing tools). */
372
+ artifactsInvalidationTrigger: number;
373
+ sendMessage: (content: string, attachments?: Attachment$1[]) => Promise<void>;
374
+ handleRegenerate?: (turnId: string) => Promise<void>;
375
+ handleEdit?: (turnId: string, newContent: string) => Promise<void>;
134
376
  handleCopy: (text: string) => Promise<void>;
135
377
  handleSubmitQuestionAnswers: (answers: QuestionAnswers) => void;
136
- handleCancelPendingQuestion: () => Promise<void>;
378
+ handleRejectPendingQuestion: () => Promise<void>;
379
+ cancel: () => void;
380
+ setCodeOutputs: (outputs: CodeOutput$1[]) => void;
381
+ }
382
+ interface ChatInputStateValue {
383
+ message: string;
384
+ inputError: string | null;
385
+ messageQueue: QueuedMessage[];
386
+ setMessage: (message: string) => void;
387
+ setInputError: (error: string | null) => void;
388
+ handleSubmit: (e: React.FormEvent, attachments?: Attachment$1[]) => void;
137
389
  handleUnqueue: () => {
138
390
  content: string;
139
- attachments: ImageAttachment[];
391
+ attachments: Attachment$1[];
140
392
  } | null;
141
- sendMessage: (content: string, attachments?: Attachment[]) => Promise<void>;
142
- cancel: () => void;
393
+ }
394
+ interface ChatSessionContextValue extends ChatSessionStateValue, ChatMessagingStateValue, ChatInputStateValue {
395
+ handleRetry?: () => Promise<void>;
396
+ }
397
+
398
+ /**
399
+ * Per-session rate limiter
400
+ * Prevents excessive requests within a time window
401
+ */
402
+ interface RateLimiterConfig {
403
+ maxRequests: number;
404
+ windowMs: number;
405
+ }
406
+ declare class RateLimiter {
407
+ private timestamps;
408
+ private maxRequests;
409
+ private windowMs;
410
+ constructor(config: RateLimiterConfig);
411
+ /**
412
+ * Check if a request can be made
413
+ * Updates internal state if request is allowed
414
+ */
415
+ canMakeRequest(): boolean;
416
+ /**
417
+ * Get milliseconds until next request is allowed
418
+ * Returns 0 if request can be made immediately
419
+ */
420
+ getTimeUntilNextRequest(): number;
421
+ /**
422
+ * Reset the rate limiter state
423
+ */
424
+ reset(): void;
143
425
  }
144
426
 
145
427
  interface ChatSessionProps {
146
428
  dataSource: ChatDataSource;
147
429
  sessionId?: string;
430
+ /** Optional rate limiter to throttle sendMessage */
431
+ rateLimiter?: RateLimiter;
432
+ /** Alias for isReadOnly (preferred) */
433
+ readOnly?: boolean;
148
434
  isReadOnly?: boolean;
149
- renderUserMessage?: (message: Message) => ReactNode;
150
- renderAssistantMessage?: (message: Message) => ReactNode;
435
+ /** Custom render function for user turns */
436
+ renderUserTurn?: (turn: ConversationTurn$1) => ReactNode;
437
+ /** Custom render function for assistant turns */
438
+ renderAssistantTurn?: (turn: ConversationTurn$1) => ReactNode;
151
439
  className?: string;
152
440
  /** Custom content to display as header */
153
441
  headerSlot?: ReactNode;
@@ -159,72 +447,386 @@ interface ChatSessionProps {
159
447
  actionsSlot?: ReactNode;
160
448
  /** Callback when user navigates back */
161
449
  onBack?: () => void;
450
+ /** Custom verbs for the typing indicator (e.g. ['Thinking', 'Analyzing', ...]) */
451
+ thinkingVerbs?: string[];
452
+ /** Enables the built-in right-side artifacts panel for persisted session artifacts */
453
+ showArtifactsPanel?: boolean;
454
+ /** Initial expanded state for artifacts panel when no persisted preference exists */
455
+ artifactsPanelDefaultExpanded?: boolean;
456
+ /** localStorage key for artifacts panel expanded/collapsed state */
457
+ artifactsPanelStorageKey?: string;
162
458
  }
163
459
  declare function ChatSession(props: ChatSessionProps): react_jsx_runtime.JSX.Element;
164
460
 
461
+ interface SessionArtifactsPanelProps {
462
+ dataSource: ChatDataSource;
463
+ sessionId: string;
464
+ isStreaming: boolean;
465
+ allowDrop?: boolean;
466
+ className?: string;
467
+ }
468
+ declare function SessionArtifactsPanel({ dataSource, sessionId, isStreaming, allowDrop, className, }: SessionArtifactsPanelProps): react_jsx_runtime.JSX.Element;
469
+
470
+ interface SessionArtifactListProps {
471
+ artifacts: SessionArtifact[];
472
+ selectedArtifactId?: string;
473
+ onSelect: (artifact: SessionArtifact) => void;
474
+ }
475
+ declare function SessionArtifactList({ artifacts, selectedArtifactId, onSelect, }: SessionArtifactListProps): react_jsx_runtime.JSX.Element;
476
+
477
+ interface SessionArtifactPreviewProps {
478
+ artifact: SessionArtifact;
479
+ }
480
+ declare function SessionArtifactPreview({ artifact }: SessionArtifactPreviewProps): react_jsx_runtime.JSX.Element;
481
+
165
482
  interface ChatHeaderProps {
166
- session: Session | null;
483
+ session: Session$1 | null;
167
484
  onBack?: () => void;
485
+ readOnly?: boolean;
168
486
  /** Custom logo component to display */
169
487
  logoSlot?: ReactNode;
170
488
  /** Custom action buttons */
171
489
  actionsSlot?: ReactNode;
172
490
  }
173
- declare function ChatHeader({ session, onBack, logoSlot, actionsSlot }: ChatHeaderProps): react_jsx_runtime.JSX.Element;
491
+ declare function ChatHeader({ session, onBack, readOnly, logoSlot, actionsSlot }: ChatHeaderProps): react_jsx_runtime.JSX.Element;
174
492
 
175
493
  interface MessageListProps {
176
- renderUserMessage?: (message: Message) => ReactNode;
177
- renderAssistantMessage?: (message: Message) => ReactNode;
494
+ /** Custom render function for user turns */
495
+ renderUserTurn?: (turn: ConversationTurn$1) => ReactNode;
496
+ /** Custom render function for assistant turns */
497
+ renderAssistantTurn?: (turn: ConversationTurn$1) => ReactNode;
498
+ /** Custom verbs for the typing indicator (e.g. ['Thinking', 'Analyzing', ...]) */
499
+ thinkingVerbs?: string[];
500
+ /** When true, hides edit/regenerate actions */
501
+ readOnly?: boolean;
178
502
  }
179
- declare function MessageList({ renderUserMessage, renderAssistantMessage }: MessageListProps): react_jsx_runtime.JSX.Element;
503
+ declare function MessageList({ renderUserTurn, renderAssistantTurn, thinkingVerbs, readOnly }: MessageListProps): react_jsx_runtime.JSX.Element;
180
504
 
181
- interface TurnBubbleProps {
182
- message: Message;
183
- renderUserMessage?: (message: Message) => ReactNode;
184
- renderAssistantMessage?: (message: Message) => ReactNode;
505
+ interface UserMessageAvatarSlotProps {
506
+ /** Default initials */
507
+ initials: string;
508
+ }
509
+ interface UserMessageContentSlotProps {
510
+ /** Message content text */
511
+ content: string;
512
+ }
513
+ interface UserMessageAttachmentsSlotProps {
514
+ /** Message attachments */
515
+ attachments: Attachment$1[];
516
+ /** Handler to open image viewer */
517
+ onView: (index: number) => void;
185
518
  }
186
- declare function TurnBubble({ message, renderUserMessage, renderAssistantMessage, }: TurnBubbleProps): react_jsx_runtime.JSX.Element | null;
519
+ interface UserMessageActionsSlotProps {
520
+ /** Copy content to clipboard */
521
+ onCopy: () => void;
522
+ /** Edit message (if available) */
523
+ onEdit?: () => void;
524
+ /** Formatted timestamp */
525
+ timestamp: string;
526
+ /** Whether copy action is available */
527
+ canCopy: boolean;
528
+ /** Whether edit action is available */
529
+ canEdit: boolean;
530
+ }
531
+ interface UserMessageSlots {
532
+ /** Custom avatar renderer */
533
+ avatar?: ReactNode | ((props: UserMessageAvatarSlotProps) => ReactNode);
534
+ /** Custom content renderer */
535
+ content?: ReactNode | ((props: UserMessageContentSlotProps) => ReactNode);
536
+ /** Custom attachments renderer */
537
+ attachments?: ReactNode | ((props: UserMessageAttachmentsSlotProps) => ReactNode);
538
+ /** Custom actions renderer */
539
+ actions?: ReactNode | ((props: UserMessageActionsSlotProps) => ReactNode);
540
+ }
541
+ interface UserMessageClassNames {
542
+ /** Root container */
543
+ root?: string;
544
+ /** Inner content wrapper */
545
+ wrapper?: string;
546
+ /** Avatar container */
547
+ avatar?: string;
548
+ /** Message bubble */
549
+ bubble?: string;
550
+ /** Content text */
551
+ content?: string;
552
+ /** Attachments container */
553
+ attachments?: string;
554
+ /** Actions container */
555
+ actions?: string;
556
+ /** Action button */
557
+ actionButton?: string;
558
+ /** Timestamp */
559
+ timestamp?: string;
560
+ }
561
+ interface UserMessageProps {
562
+ /** User turn data */
563
+ turn: UserTurn$1;
564
+ /** Turn ID for edit operations */
565
+ turnId?: string;
566
+ /** User initials for avatar */
567
+ initials?: string;
568
+ /** Slot overrides */
569
+ slots?: UserMessageSlots;
570
+ /** Class name overrides */
571
+ classNames?: UserMessageClassNames;
572
+ /** Copy handler */
573
+ onCopy?: (content: string) => Promise<void> | void;
574
+ /** Edit handler */
575
+ onEdit?: (turnId: string, newContent: string) => void;
576
+ /** Hide avatar */
577
+ hideAvatar?: boolean;
578
+ /** Hide actions */
579
+ hideActions?: boolean;
580
+ /** Hide timestamp */
581
+ hideTimestamp?: boolean;
582
+ /** Whether edit action should be available */
583
+ allowEdit?: boolean;
584
+ }
585
+ declare function UserMessage({ turn, turnId, initials, slots, classNames: classNameOverrides, onCopy, onEdit, hideAvatar, hideActions, hideTimestamp, allowEdit, }: UserMessageProps): react_jsx_runtime.JSX.Element;
187
586
 
188
587
  interface UserTurnViewProps {
189
- message: Message & {
190
- attachments?: ImageAttachment[];
191
- };
588
+ /** The conversation turn containing the user message */
589
+ turn: ConversationTurn$1;
590
+ /** Slot overrides for customization */
591
+ slots?: UserMessageSlots;
592
+ /** Class name overrides */
593
+ classNames?: UserMessageClassNames;
594
+ /** User initials for avatar */
595
+ initials?: string;
596
+ /** Hide avatar */
597
+ hideAvatar?: boolean;
598
+ /** Hide actions */
599
+ hideActions?: boolean;
600
+ /** Hide timestamp */
601
+ hideTimestamp?: boolean;
602
+ /** Whether edit action should be available */
603
+ allowEdit?: boolean;
604
+ }
605
+ declare function UserTurnView({ turn, slots, classNames, initials, hideAvatar, hideActions, hideTimestamp, allowEdit, }: UserTurnViewProps): react_jsx_runtime.JSX.Element;
606
+
607
+ interface AssistantMessageAvatarSlotProps {
608
+ /** Default text */
609
+ text: string;
610
+ }
611
+ interface AssistantMessageContentSlotProps {
612
+ /** Message content (markdown) */
613
+ content: string;
614
+ /** Citations */
615
+ citations?: Citation$1[];
616
+ /** Whether streaming is active */
617
+ isStreaming: boolean;
618
+ }
619
+ interface AssistantMessageSourcesSlotProps {
620
+ /** Citations to display */
621
+ citations: Citation$1[];
622
+ }
623
+ interface AssistantMessageChartsSlotProps {
624
+ /** Chart data */
625
+ chartData: ChartData;
626
+ }
627
+ interface AssistantMessageCodeOutputsSlotProps {
628
+ /** Code execution outputs */
629
+ outputs: CodeOutput$1[];
192
630
  }
193
- declare function UserTurnView({ message }: UserTurnViewProps): react_jsx_runtime.JSX.Element;
631
+ interface AssistantMessageArtifactsSlotProps {
632
+ /** Downloadable artifacts */
633
+ artifacts: Artifact$1[];
634
+ }
635
+ interface AssistantMessageActionsSlotProps {
636
+ /** Copy content to clipboard */
637
+ onCopy: () => void;
638
+ /** Regenerate response */
639
+ onRegenerate?: () => void;
640
+ /** Formatted timestamp */
641
+ timestamp: string;
642
+ /** Whether copy action is available */
643
+ canCopy: boolean;
644
+ /** Whether regenerate action is available */
645
+ canRegenerate: boolean;
646
+ }
647
+ interface AssistantMessageExplanationSlotProps {
648
+ /** Explanation content (markdown) */
649
+ explanation: string;
650
+ /** Whether expanded */
651
+ isExpanded: boolean;
652
+ /** Toggle expansion */
653
+ onToggle: () => void;
654
+ }
655
+ interface AssistantMessageSlots {
656
+ /** Custom avatar renderer */
657
+ avatar?: ReactNode | ((props: AssistantMessageAvatarSlotProps) => ReactNode);
658
+ /** Custom content renderer */
659
+ content?: ReactNode | ((props: AssistantMessageContentSlotProps) => ReactNode);
660
+ /** Custom sources renderer */
661
+ sources?: ReactNode | ((props: AssistantMessageSourcesSlotProps) => ReactNode);
662
+ /** Custom charts renderer */
663
+ charts?: ReactNode | ((props: AssistantMessageChartsSlotProps) => ReactNode);
664
+ /** Custom code outputs renderer */
665
+ codeOutputs?: ReactNode | ((props: AssistantMessageCodeOutputsSlotProps) => ReactNode);
666
+ /** Custom artifacts renderer */
667
+ artifacts?: ReactNode | ((props: AssistantMessageArtifactsSlotProps) => ReactNode);
668
+ /** Custom actions renderer */
669
+ actions?: ReactNode | ((props: AssistantMessageActionsSlotProps) => ReactNode);
670
+ /** Custom explanation renderer */
671
+ explanation?: ReactNode | ((props: AssistantMessageExplanationSlotProps) => ReactNode);
672
+ }
673
+ interface AssistantMessageClassNames {
674
+ /** Root container */
675
+ root?: string;
676
+ /** Inner content wrapper */
677
+ wrapper?: string;
678
+ /** Avatar container */
679
+ avatar?: string;
680
+ /** Message bubble */
681
+ bubble?: string;
682
+ /** Code outputs container */
683
+ codeOutputs?: string;
684
+ /** Charts container */
685
+ charts?: string;
686
+ /** Artifacts container */
687
+ artifacts?: string;
688
+ /** Sources container */
689
+ sources?: string;
690
+ /** Explanation container */
691
+ explanation?: string;
692
+ /** Actions container */
693
+ actions?: string;
694
+ /** Action button */
695
+ actionButton?: string;
696
+ /** Timestamp */
697
+ timestamp?: string;
698
+ }
699
+ interface AssistantMessageProps {
700
+ /** Assistant turn data */
701
+ turn: AssistantTurn$1;
702
+ /** Turn ID for regenerate operations */
703
+ turnId?: string;
704
+ /** When true, this is the last turn (Regenerate button shown only on last assistant message) */
705
+ isLastTurn?: boolean;
706
+ /** Whether response is being streamed */
707
+ isStreaming?: boolean;
708
+ /** Pending question for HITL */
709
+ pendingQuestion?: PendingQuestion$1 | null;
710
+ /** Slot overrides */
711
+ slots?: AssistantMessageSlots;
712
+ /** Class name overrides */
713
+ classNames?: AssistantMessageClassNames;
714
+ /** Copy handler */
715
+ onCopy?: (content: string) => Promise<void> | void;
716
+ /** Regenerate handler */
717
+ onRegenerate?: (turnId: string) => Promise<void> | void;
718
+ /** Send message handler (for markdown links) */
719
+ onSendMessage?: (content: string) => void;
720
+ /** Whether sending is disabled */
721
+ sendDisabled?: boolean;
722
+ /** Hide avatar */
723
+ hideAvatar?: boolean;
724
+ /** Hide actions */
725
+ hideActions?: boolean;
726
+ /** Hide timestamp */
727
+ hideTimestamp?: boolean;
728
+ /** Show debug panel */
729
+ showDebug?: boolean;
730
+ }
731
+ declare function AssistantMessage({ turn, turnId, isLastTurn, isStreaming, pendingQuestion, slots, classNames: classNameOverrides, onCopy, onRegenerate, onSendMessage, sendDisabled, hideAvatar, hideActions, hideTimestamp, showDebug, }: AssistantMessageProps): react_jsx_runtime.JSX.Element;
194
732
 
195
733
  interface AssistantTurnViewProps {
196
- message: Message & {
197
- codeOutputs?: CodeOutput[];
198
- isStreaming?: boolean;
199
- };
734
+ /** The conversation turn containing the assistant response */
735
+ turn: ConversationTurn$1;
736
+ /** When true, this is the last turn in the list (Regenerate button shown only on last assistant message) */
737
+ isLastTurn?: boolean;
738
+ /** Whether the response is currently being streamed */
739
+ isStreaming?: boolean;
740
+ /** Slot overrides for customization */
741
+ slots?: AssistantMessageSlots;
742
+ /** Class name overrides */
743
+ classNames?: AssistantMessageClassNames;
744
+ /** Hide avatar */
745
+ hideAvatar?: boolean;
746
+ /** Hide actions */
747
+ hideActions?: boolean;
748
+ /** Hide timestamp */
749
+ hideTimestamp?: boolean;
200
750
  }
201
- declare function AssistantTurnView({ message }: AssistantTurnViewProps): react_jsx_runtime.JSX.Element;
751
+ declare function AssistantTurnView({ turn, isLastTurn, isStreaming, slots, classNames, hideAvatar, hideActions, hideTimestamp, }: AssistantTurnViewProps): react_jsx_runtime.JSX.Element | null;
752
+
753
+ interface TurnBubbleClassNames {
754
+ /** Root container */
755
+ root?: string;
756
+ /** User turn wrapper */
757
+ userTurn?: string;
758
+ /** Assistant turn wrapper */
759
+ assistantTurn?: string;
760
+ }
761
+ interface TurnBubbleProps {
762
+ /** The conversation turn containing user and optional assistant content */
763
+ turn: ConversationTurn$1;
764
+ /** When true, this turn is the last in the list (e.g. Regenerate shows only on last assistant message) */
765
+ isLastTurn?: boolean;
766
+ /** Custom render function for user turn (full control) */
767
+ renderUserTurn?: (turn: ConversationTurn$1) => ReactNode;
768
+ /** Custom render function for assistant turn (full control) */
769
+ renderAssistantTurn?: (turn: ConversationTurn$1) => ReactNode;
770
+ /** Props passed to UserTurnView (when not using custom renderer) */
771
+ userTurnProps?: Omit<UserTurnViewProps, 'turn'>;
772
+ /** Props passed to AssistantTurnView (when not using custom renderer) */
773
+ assistantTurnProps?: Omit<AssistantTurnViewProps, 'turn'>;
774
+ /** Slots for user message customization */
775
+ userMessageSlots?: UserMessageSlots;
776
+ /** Slots for assistant message customization */
777
+ assistantMessageSlots?: AssistantMessageSlots;
778
+ /** Class names for user message */
779
+ userMessageClassNames?: UserMessageClassNames;
780
+ /** Class names for assistant message */
781
+ assistantMessageClassNames?: AssistantMessageClassNames;
782
+ /** Class names for turn bubble container */
783
+ classNames?: TurnBubbleClassNames;
784
+ /** Whether assistant response is streaming */
785
+ isStreaming?: boolean;
786
+ }
787
+ declare function TurnBubble({ turn, isLastTurn, renderUserTurn, renderAssistantTurn, userTurnProps, assistantTurnProps, userMessageSlots, assistantMessageSlots, userMessageClassNames, assistantMessageClassNames, classNames, isStreaming, }: TurnBubbleProps): react_jsx_runtime.JSX.Element;
202
788
 
203
789
  interface MarkdownRendererProps {
790
+ /** Markdown content to render */
204
791
  content: string;
205
- citations?: Citation[] | null;
792
+ /** Optional citations to process and display */
793
+ citations?: Citation$1[] | null;
794
+ /** Optional function to send messages (enables table export) */
795
+ sendMessage?: (content: string) => void;
796
+ /** Whether message sending is disabled */
797
+ sendDisabled?: boolean;
798
+ /** Copy button label for code blocks */
799
+ copyLabel?: string;
800
+ /** Copied confirmation label for code blocks */
801
+ copiedLabel?: string;
802
+ /** Export button label for tables */
803
+ exportLabel?: string;
206
804
  }
207
- declare function MarkdownRenderer({ content }: MarkdownRendererProps): react_jsx_runtime.JSX.Element;
805
+ declare function MarkdownRenderer({ content, citations, sendMessage, sendDisabled, copyLabel, copiedLabel, exportLabel, }: MarkdownRendererProps): react_jsx_runtime.JSX.Element;
806
+ declare const MemoizedMarkdownRenderer: react.MemoExoticComponent<typeof MarkdownRenderer>;
208
807
 
209
808
  interface ChartCardProps {
210
809
  chartData: ChartData;
211
810
  }
811
+ /**
812
+ * ChartCard renders a single chart visualization with optional PNG export.
813
+ */
212
814
  declare function ChartCard({ chartData }: ChartCardProps): react_jsx_runtime.JSX.Element;
213
815
 
214
816
  interface SourcesPanelProps {
215
- citations: Citation[];
817
+ citations: Citation$1[];
216
818
  }
217
819
  declare function SourcesPanel({ citations }: SourcesPanelProps): react_jsx_runtime.JSX.Element | null;
218
820
 
219
821
  interface DownloadCardProps {
220
- artifact: Artifact;
822
+ artifact: Artifact$1;
221
823
  }
222
824
  declare function DownloadCard({ artifact }: DownloadCardProps): react_jsx_runtime.JSX.Element;
223
825
 
224
826
  interface InlineQuestionFormProps {
225
- pendingQuestion: PendingQuestion;
827
+ pendingQuestion: PendingQuestion$1;
226
828
  }
227
- declare function InlineQuestionForm({ pendingQuestion }: InlineQuestionFormProps): react_jsx_runtime.JSX.Element;
829
+ declare function InlineQuestionForm({ pendingQuestion }: InlineQuestionFormProps): react_jsx_runtime.JSX.Element | null;
228
830
 
229
831
  interface MessageInputRef {
230
832
  focus: () => void;
@@ -235,34 +837,51 @@ interface MessageInputProps {
235
837
  loading: boolean;
236
838
  fetching?: boolean;
237
839
  disabled?: boolean;
840
+ commandError?: string | null;
841
+ debugMode?: boolean;
842
+ debugSessionUsage?: SessionDebugUsage;
843
+ debugLimits?: DebugLimits | null;
238
844
  messageQueue?: QueuedMessage[];
845
+ onClearCommandError?: () => void;
239
846
  onMessageChange: (value: string) => void;
240
- onSubmit: (e: React.FormEvent, attachments: ImageAttachment[]) => void;
847
+ onSubmit: (e: React.FormEvent, attachments: Attachment$1[]) => void;
241
848
  onUnqueue?: () => {
242
849
  content: string;
243
- attachments: ImageAttachment[];
850
+ attachments: Attachment$1[];
244
851
  } | null;
245
852
  placeholder?: string;
246
853
  maxFiles?: number;
247
854
  maxFileSize?: number;
248
855
  containerClassName?: string;
856
+ formClassName?: string;
249
857
  }
250
858
  declare const MessageInput: react.ForwardRefExoticComponent<MessageInputProps & react.RefAttributes<MessageInputRef>>;
251
859
 
252
860
  interface AttachmentGridProps {
253
- attachments: ImageAttachment[];
861
+ attachments: Attachment$1[];
254
862
  onRemove?: (index: number) => void;
255
863
  onView?: (index: number) => void;
256
864
  className?: string;
865
+ readonly?: boolean;
866
+ maxDisplay?: number;
867
+ maxCapacity?: number;
868
+ emptyMessage?: string;
869
+ showCount?: boolean;
870
+ /** Number of files currently being processed (shows shimmer placeholders) */
871
+ pendingCount?: number;
257
872
  }
258
- declare function AttachmentGrid({ attachments, onRemove, onView, className }: AttachmentGridProps): react_jsx_runtime.JSX.Element | null;
873
+ declare function AttachmentGrid({ attachments, onRemove, onView, className, readonly, maxDisplay, maxCapacity, emptyMessage, showCount, pendingCount, }: AttachmentGridProps): react_jsx_runtime.JSX.Element | null;
874
+ declare const MemoizedAttachmentGrid: react__default.MemoExoticComponent<typeof AttachmentGrid>;
259
875
 
260
876
  interface ImageModalProps {
261
- images: ImageAttachment[];
262
- initialIndex: number;
877
+ isOpen: boolean;
263
878
  onClose: () => void;
879
+ attachment: ImageAttachment;
880
+ allAttachments?: ImageAttachment[];
881
+ currentIndex?: number;
882
+ onNavigate?: (direction: 'prev' | 'next') => void;
264
883
  }
265
- declare function ImageModal({ images, initialIndex, onClose }: ImageModalProps): react_jsx_runtime.JSX.Element;
884
+ declare function ImageModal({ isOpen, onClose, attachment, allAttachments, currentIndex, onNavigate, }: ImageModalProps): react_jsx_runtime.JSX.Element;
266
885
 
267
886
  /**
268
887
  * WelcomeContent Component
@@ -278,7 +897,7 @@ interface WelcomeContentProps {
278
897
  declare function WelcomeContent({ onPromptSelect, title, description, disabled }: WelcomeContentProps): react_jsx_runtime.JSX.Element;
279
898
 
280
899
  interface CodeOutputsPanelProps {
281
- outputs: CodeOutput[];
900
+ outputs: CodeOutput$1[];
282
901
  }
283
902
  declare function CodeOutputsPanel({ outputs }: CodeOutputsPanelProps): react_jsx_runtime.JSX.Element | null;
284
903
 
@@ -296,8 +915,17 @@ interface ScrollToBottomButtonProps {
296
915
  show: boolean;
297
916
  onClick: () => void;
298
917
  unreadCount?: number;
918
+ disabled?: boolean;
919
+ /** When set, renders a pill-style button with this label (e.g. "New messages") */
920
+ label?: string;
921
+ }
922
+ declare function ScrollToBottomButton({ show, onClick, unreadCount, disabled, label, }: ScrollToBottomButtonProps): react_jsx_runtime.JSX.Element;
923
+
924
+ interface CompactionDoodleProps {
925
+ title: string;
926
+ subtitle: string;
299
927
  }
300
- declare function ScrollToBottomButton({ show, onClick, unreadCount }: ScrollToBottomButtonProps): react_jsx_runtime.JSX.Element;
928
+ declare function CompactionDoodle({ title, subtitle }: CompactionDoodleProps): react_jsx_runtime.JSX.Element;
301
929
 
302
930
  interface EmptyStateProps {
303
931
  /** Optional icon to display */
@@ -314,7 +942,7 @@ interface EmptyStateProps {
314
942
  size?: 'sm' | 'md' | 'lg';
315
943
  }
316
944
  declare function EmptyState({ icon, title, description, action, className, size, }: EmptyStateProps): react_jsx_runtime.JSX.Element;
317
- declare const _default$3: react.MemoExoticComponent<typeof EmptyState>;
945
+ declare const MemoizedEmptyState: react.MemoExoticComponent<typeof EmptyState>;
318
946
 
319
947
  /**
320
948
  * EditableText Component
@@ -346,7 +974,7 @@ interface EditableTextRef {
346
974
  /** Programmatically cancel editing */
347
975
  cancelEditing: () => void;
348
976
  }
349
- declare const _default$2: react.MemoExoticComponent<react.ForwardRefExoticComponent<EditableTextProps & react.RefAttributes<EditableTextRef>>>;
977
+ declare const MemoizedEditableText: react.MemoExoticComponent<react.ForwardRefExoticComponent<EditableTextProps & react.RefAttributes<EditableTextRef>>>;
350
978
 
351
979
  /**
352
980
  * SearchInput Component
@@ -375,7 +1003,7 @@ interface SearchInputProps {
375
1003
  ariaLabel?: string;
376
1004
  }
377
1005
  declare function SearchInput({ value, onChange, placeholder, autoFocus, onSubmit, onEscape, className, size, disabled, ariaLabel, }: SearchInputProps): react_jsx_runtime.JSX.Element;
378
- declare const _default$1: react.MemoExoticComponent<typeof SearchInput>;
1006
+ declare const MemoizedSearchInput: react.MemoExoticComponent<typeof SearchInput>;
379
1007
 
380
1008
  /**
381
1009
  * Skeleton Component
@@ -436,50 +1064,1146 @@ declare function SkeletonCard({ width, height, className, }: {
436
1064
  declare function ListItemSkeleton({ className }: {
437
1065
  className?: string;
438
1066
  }): react_jsx_runtime.JSX.Element;
439
- declare const _default: react.MemoExoticComponent<typeof Skeleton>;
1067
+ declare const MemoizedSkeleton: react.MemoExoticComponent<typeof Skeleton>;
440
1068
 
441
1069
  /**
442
- * Framer Motion animation variants for BiChat UI
443
- * Subtle, professional animations for enterprise applications
444
- * Respects prefers-reduced-motion for accessibility
1070
+ * CodeBlock Component
1071
+ * Syntax highlighted code blocks with copy functionality and dark mode support
445
1072
  */
1073
+ interface CodeBlockProps {
1074
+ /** Programming language for syntax highlighting */
1075
+ language: string;
1076
+ /** Code content to display */
1077
+ value: string;
1078
+ /** Whether to render as inline code */
1079
+ inline?: boolean;
1080
+ /** Copy button label (defaults to "Copy") */
1081
+ copyLabel?: string;
1082
+ /** Copied confirmation label (defaults to "Copied!") */
1083
+ copiedLabel?: string;
1084
+ }
1085
+ declare function CodeBlock({ language, value, inline, copyLabel, copiedLabel, }: CodeBlockProps): react_jsx_runtime.JSX.Element;
1086
+ declare const MemoizedCodeBlock: react.MemoExoticComponent<typeof CodeBlock>;
1087
+
446
1088
  /**
447
- * Fade in animation
1089
+ * LoadingSpinner Component
1090
+ * Displays animated loading indicators
448
1091
  */
449
- declare const fadeInVariants: {
450
- initial: {
451
- opacity: number;
452
- };
453
- animate: {
454
- opacity: number;
455
- transition: {
456
- duration: number;
457
- };
458
- };
459
- exit: {
460
- opacity: number;
461
- transition: {
462
- duration: number;
463
- };
464
- };
465
- };
1092
+ type SpinnerVariant = 'spinner' | 'dots' | 'pulse';
1093
+ interface LoadingSpinnerProps {
1094
+ variant?: SpinnerVariant;
1095
+ size?: 'sm' | 'md' | 'lg';
1096
+ message?: string;
1097
+ }
1098
+ declare function LoadingSpinner({ variant, size, message }: LoadingSpinnerProps): react_jsx_runtime.JSX.Element;
1099
+ declare const MemoizedLoadingSpinner: react.MemoExoticComponent<typeof LoadingSpinner>;
1100
+
466
1101
  /**
467
- * Fade in with subtle slide up
1102
+ * TableExportButton Component
1103
+ * Small inline button for exporting markdown tables to Excel
468
1104
  */
469
- declare const fadeInUpVariants: {
470
- initial: {
471
- opacity: number;
472
- y: number;
473
- };
474
- animate: {
475
- opacity: number;
476
- y: number;
477
- transition: {
478
- duration: number;
479
- ease: number[];
480
- };
481
- };
482
- exit: {
1105
+ interface TableExportButtonProps {
1106
+ /** Click handler for export action */
1107
+ onClick: () => void;
1108
+ /** Whether the button should be disabled */
1109
+ disabled?: boolean;
1110
+ /** Export button label (defaults to "Export") */
1111
+ label?: string;
1112
+ /** Disabled tooltip text */
1113
+ disabledTooltip?: string;
1114
+ }
1115
+ declare const TableExportButton: react.NamedExoticComponent<TableExportButtonProps>;
1116
+
1117
+ interface TableWithExportProps {
1118
+ /** The table content to render */
1119
+ children: ReactNode;
1120
+ /** Function to send a message (from chat context) */
1121
+ sendMessage?: (content: string) => void;
1122
+ /** Whether sending is disabled (loading or streaming) */
1123
+ disabled?: boolean;
1124
+ /** Custom export message to send */
1125
+ exportMessage?: string;
1126
+ /** Export button label */
1127
+ exportLabel?: string;
1128
+ }
1129
+ declare const TableWithExport: react.NamedExoticComponent<TableWithExportProps>;
1130
+
1131
+ /**
1132
+ * useToast Hook
1133
+ * Manages toast notification state
1134
+ */
1135
+ type ToastType = 'success' | 'error' | 'info' | 'warning';
1136
+ interface ToastItem {
1137
+ id: string;
1138
+ type: ToastType;
1139
+ message: string;
1140
+ duration?: number;
1141
+ }
1142
+ interface UseToastReturn {
1143
+ toasts: ToastItem[];
1144
+ success: (msg: string, duration?: number) => void;
1145
+ error: (msg: string, duration?: number) => void;
1146
+ info: (msg: string, duration?: number) => void;
1147
+ warning: (msg: string, duration?: number) => void;
1148
+ dismiss: (id: string) => void;
1149
+ dismissAll: () => void;
1150
+ }
1151
+ /**
1152
+ * Hook for managing toast notifications
1153
+ *
1154
+ * @example
1155
+ * ```tsx
1156
+ * const { toasts, success, error, dismiss } = useToast()
1157
+ *
1158
+ * // Show a success toast
1159
+ * success('Operation completed!')
1160
+ *
1161
+ * // Show an error toast with custom duration
1162
+ * error('Something went wrong', 10000)
1163
+ *
1164
+ * // Render toasts
1165
+ * <ToastContainer toasts={toasts} onDismiss={dismiss} />
1166
+ * ```
1167
+ */
1168
+ declare function useToast(): UseToastReturn;
1169
+
1170
+ interface ToastProps {
1171
+ id: string;
1172
+ type: ToastType;
1173
+ message: string;
1174
+ duration?: number;
1175
+ onDismiss: (id: string) => void;
1176
+ /** Label for dismiss button (defaults to "Dismiss") */
1177
+ dismissLabel?: string;
1178
+ }
1179
+ declare function Toast({ id, type, message, duration, onDismiss, dismissLabel, }: ToastProps): react_jsx_runtime.JSX.Element;
1180
+
1181
+ interface ToastContainerProps {
1182
+ toasts: ToastItem[];
1183
+ onDismiss: (id: string) => void;
1184
+ /** Label for dismiss buttons */
1185
+ dismissLabel?: string;
1186
+ }
1187
+ declare function ToastContainer({ toasts, onDismiss, dismissLabel }: ToastContainerProps): react_jsx_runtime.JSX.Element;
1188
+
1189
+ /**
1190
+ * ConfirmModal Component
1191
+ * Polished confirmation dialog with contextual icon, refined typography,
1192
+ * and smooth micro-interactions.
1193
+ * Uses @headlessui/react Dialog for accessible modal behavior.
1194
+ */
1195
+ interface ConfirmModalProps {
1196
+ /** Whether the modal is open */
1197
+ isOpen: boolean;
1198
+ /** Modal title */
1199
+ title: string;
1200
+ /** Modal message/description */
1201
+ message: string;
1202
+ /** Callback when user confirms */
1203
+ onConfirm: () => void;
1204
+ /** Callback when user cancels */
1205
+ onCancel: () => void;
1206
+ /** Confirm button text (defaults to "Confirm") */
1207
+ confirmText?: string;
1208
+ /** Cancel button text (defaults to "Cancel") */
1209
+ cancelText?: string;
1210
+ /** Whether this is a danger/destructive action (red confirm button) */
1211
+ isDanger?: boolean;
1212
+ }
1213
+ declare function ConfirmModalBase({ isOpen, title, message, onConfirm, onCancel, confirmText, cancelText, isDanger, }: ConfirmModalProps): react_jsx_runtime.JSX.Element;
1214
+ declare const ConfirmModal: react.MemoExoticComponent<typeof ConfirmModalBase>;
1215
+
1216
+ /**
1217
+ * UserAvatar Component
1218
+ * Displays user initials with deterministic color from a color palette
1219
+ */
1220
+ interface UserAvatarProps {
1221
+ /** User's first name */
1222
+ firstName: string;
1223
+ /** User's last name */
1224
+ lastName: string;
1225
+ /** Override initials (defaults to first letters of first and last name) */
1226
+ initials?: string;
1227
+ /** Avatar size */
1228
+ size?: 'sm' | 'md' | 'lg';
1229
+ /** Additional CSS classes */
1230
+ className?: string;
1231
+ }
1232
+ declare function UserAvatar({ firstName, lastName, initials: providedInitials, size, className, }: UserAvatarProps): react_jsx_runtime.JSX.Element;
1233
+ declare const MemoizedUserAvatar: react.MemoExoticComponent<typeof UserAvatar>;
1234
+
1235
+ interface PermissionGuardProps {
1236
+ /** Permission names to check */
1237
+ permissions: string[];
1238
+ /** Check mode: 'all' requires all permissions (AND), 'any' requires at least one (OR) */
1239
+ mode?: 'all' | 'any';
1240
+ /** Function to check if user has a specific permission */
1241
+ hasPermission: (permission: string) => boolean;
1242
+ /** Fallback to render when permissions are not satisfied */
1243
+ fallback?: ReactNode;
1244
+ /** Children to render when permissions are satisfied */
1245
+ children: ReactNode;
1246
+ }
1247
+ /**
1248
+ * Permission guard component.
1249
+ * Conditionally renders children based on permission checks.
1250
+ */
1251
+ declare function PermissionGuard({ permissions, mode, hasPermission, fallback, children, }: PermissionGuardProps): react_jsx_runtime.JSX.Element;
1252
+
1253
+ interface ErrorBoundaryProps {
1254
+ children: ReactNode;
1255
+ /** Optional custom error UI */
1256
+ fallback?: ReactNode | ((error: Error | null, reset: () => void) => ReactNode);
1257
+ /** Callback when an error is caught */
1258
+ onError?: (error: Error, errorInfo: ErrorInfo) => void;
1259
+ }
1260
+ interface ErrorBoundaryState {
1261
+ hasError: boolean;
1262
+ error: Error | null;
1263
+ }
1264
+ /**
1265
+ * Default error UI component
1266
+ */
1267
+ declare function DefaultErrorContent({ error, onReset, resetLabel, errorTitle, }: {
1268
+ error: Error | null;
1269
+ onReset?: () => void;
1270
+ resetLabel?: string;
1271
+ errorTitle?: string;
1272
+ }): react_jsx_runtime.JSX.Element;
1273
+ declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
1274
+ constructor(props: ErrorBoundaryProps);
1275
+ static getDerivedStateFromError(error: Error): ErrorBoundaryState;
1276
+ componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
1277
+ handleReset: () => void;
1278
+ render(): string | number | boolean | Iterable<ReactNode> | react_jsx_runtime.JSX.Element | null | undefined;
1279
+ }
1280
+
1281
+ /**
1282
+ * TypingIndicator Component
1283
+ * Displays rotating verbs with shimmer animation to show AI is thinking/processing.
1284
+ * Verbs are configurable via props.
1285
+ */
1286
+ interface TypingIndicatorProps {
1287
+ /** Custom thinking verbs to rotate through */
1288
+ verbs?: string[];
1289
+ /** Verb rotation interval in ms (defaults to 3000) */
1290
+ rotationInterval?: number;
1291
+ /** Additional CSS classes */
1292
+ className?: string;
1293
+ }
1294
+ declare function TypingIndicator({ verbs, rotationInterval, className, }: TypingIndicatorProps): react_jsx_runtime.JSX.Element;
1295
+ declare const MemoizedTypingIndicator: react.MemoExoticComponent<typeof TypingIndicator>;
1296
+
1297
+ interface SidebarProps {
1298
+ dataSource: ChatDataSource;
1299
+ onSessionSelect: (sessionId: string) => void;
1300
+ onNewChat: () => void;
1301
+ onArchivedView?: () => void;
1302
+ activeSessionId?: string;
1303
+ creating?: boolean;
1304
+ showAllChatsTab?: boolean;
1305
+ isOpen?: boolean;
1306
+ onClose?: () => void;
1307
+ headerSlot?: react__default.ReactNode;
1308
+ footerSlot?: react__default.ReactNode;
1309
+ className?: string;
1310
+ }
1311
+ declare function Sidebar({ dataSource, onSessionSelect, onNewChat, onArchivedView, activeSessionId, creating, showAllChatsTab, isOpen: _isOpen, onClose, headerSlot, footerSlot, className, }: SidebarProps): react_jsx_runtime.JSX.Element;
1312
+
1313
+ /**
1314
+ * SessionItem Component
1315
+ * Individual chat session item in the sidebar with actions menu
1316
+ * Router-agnostic: uses onSelect callback instead of Link
1317
+ */
1318
+
1319
+ interface SessionItemProps {
1320
+ session: Session$1;
1321
+ isActive: boolean;
1322
+ mode?: 'active' | 'archived';
1323
+ onSelect: (sessionId: string) => void;
1324
+ onArchive?: () => void;
1325
+ onRestore?: () => void;
1326
+ onPin?: () => void;
1327
+ onRename?: (newTitle: string) => void;
1328
+ onRegenerateTitle?: () => void;
1329
+ onDelete?: () => void;
1330
+ testIdPrefix?: string;
1331
+ className?: string;
1332
+ }
1333
+ declare const SessionItem: react__default.NamedExoticComponent<SessionItemProps>;
1334
+
1335
+ interface ArchivedChatListProps {
1336
+ dataSource: ChatDataSource;
1337
+ onBack: () => void;
1338
+ onSessionSelect: (sessionId: string) => void;
1339
+ activeSessionId?: string;
1340
+ className?: string;
1341
+ toast?: UseToastReturn;
1342
+ }
1343
+ declare function ArchivedChatList({ dataSource, onBack, onSessionSelect, activeSessionId, className, toast: toastFromProps, }: ArchivedChatListProps): react_jsx_runtime.JSX.Element;
1344
+
1345
+ interface AllChatsListProps {
1346
+ dataSource: ChatDataSource;
1347
+ onSessionSelect: (sessionId: string) => void;
1348
+ activeSessionId?: string;
1349
+ }
1350
+ declare function AllChatsList({ dataSource, onSessionSelect, activeSessionId }: AllChatsListProps): react_jsx_runtime.JSX.Element;
1351
+
1352
+ /**
1353
+ * TabBar Component
1354
+ * Horizontal tabs with animated indicator for switching between views
1355
+ * Generic: accepts any set of tabs via props
1356
+ */
1357
+ interface TabBarProps {
1358
+ tabs: Array<{
1359
+ id: string;
1360
+ label: string;
1361
+ }>;
1362
+ activeTab: string;
1363
+ onTabChange: (tabId: string) => void;
1364
+ }
1365
+ declare function TabBar({ tabs, activeTab, onTabChange }: TabBarProps): react_jsx_runtime.JSX.Element | null;
1366
+ declare const MemoizedTabBar: react.MemoExoticComponent<typeof TabBar>;
1367
+
1368
+ interface UserFilterProps {
1369
+ users: SessionUser[];
1370
+ selectedUser: SessionUser | null;
1371
+ onUserChange: (user: SessionUser | null) => void;
1372
+ loading?: boolean;
1373
+ }
1374
+ declare function UserFilter({ users, selectedUser, onUserChange, loading }: UserFilterProps): react_jsx_runtime.JSX.Element;
1375
+ declare const MemoizedUserFilter: react.MemoExoticComponent<typeof UserFilter>;
1376
+
1377
+ interface DateGroupHeaderProps {
1378
+ groupName: string;
1379
+ count: number;
1380
+ }
1381
+ /**
1382
+ * Sticky header for date-based session groups
1383
+ * Displays group name and session count
1384
+ */
1385
+ declare function DateGroupHeader({ groupName, count }: DateGroupHeaderProps): react_jsx_runtime.JSX.Element;
1386
+
1387
+ interface SessionSkeletonProps {
1388
+ count?: number;
1389
+ }
1390
+ declare function SessionSkeleton({ count }: SessionSkeletonProps): react_jsx_runtime.JSX.Element;
1391
+
1392
+ interface SystemMessageProps {
1393
+ content: string;
1394
+ createdAt: string;
1395
+ onCopy?: (content: string) => Promise<void> | void;
1396
+ hideActions?: boolean;
1397
+ hideTimestamp?: boolean;
1398
+ }
1399
+ declare function SystemMessage({ content, createdAt, onCopy, hideActions, hideTimestamp, }: SystemMessageProps): react_jsx_runtime.JSX.Element;
1400
+
1401
+ interface DebugPanelProps {
1402
+ trace?: DebugTrace$1;
1403
+ }
1404
+ declare function DebugPanel({ trace }: DebugPanelProps): react_jsx_runtime.JSX.Element;
1405
+
1406
+ /**
1407
+ * Alert Component
1408
+ * Standardized error/success/warning/info messages with retry capability
1409
+ */
1410
+ type AlertVariant = 'error' | 'success' | 'warning' | 'info';
1411
+ interface AlertProps {
1412
+ variant?: AlertVariant;
1413
+ message: string;
1414
+ title?: string;
1415
+ onDismiss?: () => void;
1416
+ onRetry?: () => void;
1417
+ show?: boolean;
1418
+ dismissible?: boolean;
1419
+ }
1420
+ declare function Alert({ variant, message, title, onDismiss, onRetry, show, dismissible, }: AlertProps): react_jsx_runtime.JSX.Element;
1421
+ declare const _default$1: react.MemoExoticComponent<typeof Alert>;
1422
+
1423
+ /**
1424
+ * Archive Banner Component
1425
+ * Displays when a chat session is archived and provides a restore button
1426
+ */
1427
+ interface ArchiveBannerProps {
1428
+ show?: boolean;
1429
+ onRestore?: () => Promise<void>;
1430
+ restoring?: boolean;
1431
+ onRestoreComplete?: () => void;
1432
+ }
1433
+ declare function ArchiveBanner({ show, onRestore, restoring, onRestoreComplete, }: ArchiveBannerProps): react_jsx_runtime.JSX.Element;
1434
+ declare const _default: react.MemoExoticComponent<typeof ArchiveBanner>;
1435
+
1436
+ /**
1437
+ * RetryActionArea Component
1438
+ * Displays a retry action area inline where the assistant message would appear
1439
+ * (typically after an interrupted request or connection loss)
1440
+ *
1441
+ * Styled to match assistant message positioning (left-aligned) so users see
1442
+ * the retry button contextually in the conversation flow.
1443
+ */
1444
+ interface RetryActionAreaProps {
1445
+ /** Callback when retry button is clicked */
1446
+ onRetry: () => void;
1447
+ }
1448
+ declare const RetryActionArea: react.NamedExoticComponent<RetryActionAreaProps>;
1449
+
1450
+ /**
1451
+ * StreamError Component
1452
+ * Error recovery UI for streaming failures
1453
+ */
1454
+ interface StreamErrorProps {
1455
+ /** Error message to display */
1456
+ error: string;
1457
+ /** Callback to retry the failed operation */
1458
+ onRetry?: () => void;
1459
+ /** Callback to regenerate the message */
1460
+ onRegenerate?: () => void;
1461
+ /** Whether to show compact mode (less padding) */
1462
+ compact?: boolean;
1463
+ }
1464
+ declare function StreamError({ error, onRetry, onRegenerate, compact, }: StreamErrorProps): react_jsx_runtime.JSX.Element;
1465
+
1466
+ interface ActionableMessage {
1467
+ id: string;
1468
+ role: MessageRole;
1469
+ content: string;
1470
+ }
1471
+ interface MessageActionsProps {
1472
+ message: ActionableMessage;
1473
+ onCopy: (text: string) => Promise<void>;
1474
+ onRegenerate?: (messageId: string) => Promise<void>;
1475
+ onEdit?: (message: ActionableMessage) => void;
1476
+ }
1477
+ declare function MessageActions({ message, onCopy, onRegenerate, onEdit, }: MessageActionsProps): react_jsx_runtime.JSX.Element;
1478
+
1479
+ interface AttachmentPreviewProps {
1480
+ /** The attachment to display */
1481
+ attachment: ImageAttachment;
1482
+ /** Optional callback when remove button is clicked */
1483
+ onRemove?: () => void;
1484
+ /** Optional callback when thumbnail is clicked (for enlargement) */
1485
+ onClick?: () => void;
1486
+ /** If true, hide remove button and disable click interactions */
1487
+ readonly?: boolean;
1488
+ }
1489
+ declare const AttachmentPreview: react.NamedExoticComponent<AttachmentPreviewProps>;
1490
+
1491
+ interface AttachmentUploadProps {
1492
+ /** Callback fired when files are successfully converted and validated */
1493
+ onAttachmentsSelected: (attachments: Attachment$1[]) => void;
1494
+ /** Maximum number of attachments allowed (default: 10) */
1495
+ maxAttachments?: number;
1496
+ /** Maximum file size in bytes (default: 20 MB) */
1497
+ maxSizeBytes?: number;
1498
+ /** Whether the component is disabled */
1499
+ disabled?: boolean;
1500
+ }
1501
+ declare const AttachmentUpload: react.NamedExoticComponent<AttachmentUploadProps>;
1502
+
1503
+ interface ScreenReaderAnnouncerProps {
1504
+ message: string;
1505
+ politeness?: 'polite' | 'assertive';
1506
+ clearAfter?: number;
1507
+ }
1508
+ /**
1509
+ * Screen reader announcer component for live region updates
1510
+ * Uses ARIA live regions to announce dynamic content changes
1511
+ *
1512
+ * @param message - The message to announce
1513
+ * @param politeness - 'polite' (wait for pause) or 'assertive' (immediate)
1514
+ * @param clearAfter - Optional milliseconds to clear message after announcement
1515
+ *
1516
+ * @example
1517
+ * <ScreenReaderAnnouncer
1518
+ * message="New message received"
1519
+ * politeness="polite"
1520
+ * />
1521
+ */
1522
+ declare function ScreenReaderAnnouncer({ message, politeness, clearAfter, }: ScreenReaderAnnouncerProps): react_jsx_runtime.JSX.Element;
1523
+
1524
+ /**
1525
+ * Skip to main content link for keyboard navigation
1526
+ * Hidden by default, visible on keyboard focus
1527
+ * Allows users to skip navigation and go directly to main content
1528
+ */
1529
+ declare function SkipLink(): react_jsx_runtime.JSX.Element;
1530
+
1531
+ interface ContextMenuItem {
1532
+ id: string;
1533
+ label: string;
1534
+ icon?: ReactNode;
1535
+ onClick: () => void;
1536
+ variant?: 'default' | 'danger';
1537
+ disabled?: boolean;
1538
+ }
1539
+ interface TouchContextMenuProps {
1540
+ items: ContextMenuItem[];
1541
+ isOpen: boolean;
1542
+ onClose: () => void;
1543
+ anchorRect: DOMRect | null;
1544
+ }
1545
+ declare const TouchContextMenu: FC<TouchContextMenuProps>;
1546
+
1547
+ interface QuestionFormProps {
1548
+ pendingQuestion: PendingQuestion$1;
1549
+ sessionId: string;
1550
+ onSubmit: (answers: QuestionAnswers) => Promise<void>;
1551
+ onCancel: () => void;
1552
+ }
1553
+ declare function QuestionForm({ pendingQuestion, onSubmit, onCancel, }: QuestionFormProps): react_jsx_runtime.JSX.Element;
1554
+
1555
+ interface QuestionStepProps {
1556
+ question: Question;
1557
+ selectedAnswers: QuestionAnswers;
1558
+ onAnswer: (answerData: QuestionAnswerData) => void;
1559
+ }
1560
+ declare function QuestionStep({ question, selectedAnswers, onAnswer, }: QuestionStepProps): react_jsx_runtime.JSX.Element;
1561
+
1562
+ interface ConfirmationStepProps {
1563
+ questions: Question[];
1564
+ answers: QuestionAnswers;
1565
+ }
1566
+ declare function ConfirmationStep({ questions, answers, }: ConfirmationStepProps): react_jsx_runtime.JSX.Element;
1567
+
1568
+ interface SlotProps extends HTMLAttributes<HTMLElement> {
1569
+ children?: ReactNode;
1570
+ }
1571
+ /**
1572
+ * Slot component that merges its props with its child element's props
1573
+ * Used for the asChild pattern to allow consumers to customize the rendered element
1574
+ */
1575
+ declare const Slot: react.ForwardRefExoticComponent<SlotProps & react.RefAttributes<HTMLElement>>;
1576
+ /**
1577
+ * Helper type for components that support asChild
1578
+ * Extends the HTML attributes while adding asChild option
1579
+ */
1580
+ type AsChildProps<T extends HTMLAttributes<HTMLElement> = HTMLAttributes<HTMLElement>> = T & {
1581
+ /** Merge props with child element instead of rendering wrapper */
1582
+ asChild?: boolean;
1583
+ };
1584
+ /**
1585
+ * Get children count (flattens fragments)
1586
+ */
1587
+ declare function getValidChildren(children: ReactNode): ReactElement[];
1588
+
1589
+ interface TurnContextValue {
1590
+ /** Turn identifier */
1591
+ turnId?: string;
1592
+ }
1593
+ declare function useTurnContext(): TurnContextValue;
1594
+ type TurnRootProps = AsChildProps<HTMLAttributes<HTMLDivElement>> & {
1595
+ /** Turn identifier for tracking */
1596
+ turnId?: string;
1597
+ };
1598
+ type TurnUserProps = AsChildProps<HTMLAttributes<HTMLDivElement>>;
1599
+ type TurnAssistantProps = AsChildProps<HTMLAttributes<HTMLDivElement>>;
1600
+ type TurnTimestampProps = AsChildProps<HTMLAttributes<HTMLTimeElement>> & {
1601
+ /** ISO date string or Date object */
1602
+ date?: string | Date;
1603
+ /** Custom formatter */
1604
+ formatter?: (date: Date) => string;
1605
+ };
1606
+ type TurnActionsProps = AsChildProps<HTMLAttributes<HTMLDivElement>>;
1607
+ declare const Turn: {
1608
+ Root: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
1609
+ asChild?: boolean;
1610
+ } & {
1611
+ /** Turn identifier for tracking */
1612
+ turnId?: string;
1613
+ } & react.RefAttributes<HTMLDivElement>>;
1614
+ User: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
1615
+ asChild?: boolean;
1616
+ } & react.RefAttributes<HTMLDivElement>>;
1617
+ Assistant: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
1618
+ asChild?: boolean;
1619
+ } & react.RefAttributes<HTMLDivElement>>;
1620
+ Timestamp: react.ForwardRefExoticComponent<HTMLAttributes<HTMLTimeElement> & {
1621
+ asChild?: boolean;
1622
+ } & {
1623
+ /** ISO date string or Date object */
1624
+ date?: string | Date;
1625
+ /** Custom formatter */
1626
+ formatter?: (date: Date) => string;
1627
+ } & react.RefAttributes<HTMLTimeElement>>;
1628
+ Actions: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
1629
+ asChild?: boolean;
1630
+ } & react.RefAttributes<HTMLDivElement>>;
1631
+ };
1632
+
1633
+ type ImageLoadingStatus = 'idle' | 'loading' | 'loaded' | 'error';
1634
+ interface AvatarContextValue {
1635
+ imageLoadingStatus: ImageLoadingStatus;
1636
+ setImageLoadingStatus: (status: ImageLoadingStatus) => void;
1637
+ }
1638
+ declare function useAvatarContext(): AvatarContextValue;
1639
+ type AvatarRootProps = AsChildProps<HTMLAttributes<HTMLSpanElement>>;
1640
+ type AvatarImageProps = AsChildProps<ImgHTMLAttributes<HTMLImageElement>> & {
1641
+ /** Called when loading status changes */
1642
+ onLoadingStatusChange?: (status: ImageLoadingStatus) => void;
1643
+ };
1644
+ type AvatarFallbackProps = AsChildProps<HTMLAttributes<HTMLSpanElement>> & {
1645
+ /** Delay before showing fallback (in ms) */
1646
+ delayMs?: number;
1647
+ };
1648
+ declare const Avatar: {
1649
+ Root: react.ForwardRefExoticComponent<HTMLAttributes<HTMLSpanElement> & {
1650
+ asChild?: boolean;
1651
+ } & react.RefAttributes<HTMLSpanElement>>;
1652
+ Image: react.ForwardRefExoticComponent<ImgHTMLAttributes<HTMLImageElement> & {
1653
+ asChild?: boolean;
1654
+ } & {
1655
+ /** Called when loading status changes */
1656
+ onLoadingStatusChange?: (status: ImageLoadingStatus) => void;
1657
+ } & react.RefAttributes<HTMLImageElement>>;
1658
+ Fallback: react.ForwardRefExoticComponent<HTMLAttributes<HTMLSpanElement> & {
1659
+ asChild?: boolean;
1660
+ } & {
1661
+ /** Delay before showing fallback (in ms) */
1662
+ delayMs?: number;
1663
+ } & react.RefAttributes<HTMLSpanElement>>;
1664
+ };
1665
+
1666
+ type BubbleVariant = 'user' | 'assistant' | 'system';
1667
+ interface BubbleContextValue {
1668
+ variant?: BubbleVariant;
1669
+ }
1670
+ declare function useBubbleContext(): BubbleContextValue;
1671
+ type BubbleRootProps = AsChildProps<HTMLAttributes<HTMLDivElement>> & {
1672
+ /** Bubble variant (affects data attribute for styling) */
1673
+ variant?: BubbleVariant;
1674
+ };
1675
+ type BubbleContentProps = AsChildProps<HTMLAttributes<HTMLDivElement>>;
1676
+ type BubbleHeaderProps = AsChildProps<HTMLAttributes<HTMLDivElement>>;
1677
+ type BubbleFooterProps = AsChildProps<HTMLAttributes<HTMLDivElement>>;
1678
+ type BubbleMetadataProps = AsChildProps<HTMLAttributes<HTMLDivElement>>;
1679
+ declare const Bubble: {
1680
+ Root: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
1681
+ asChild?: boolean;
1682
+ } & {
1683
+ /** Bubble variant (affects data attribute for styling) */
1684
+ variant?: BubbleVariant;
1685
+ } & react.RefAttributes<HTMLDivElement>>;
1686
+ Content: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
1687
+ asChild?: boolean;
1688
+ } & react.RefAttributes<HTMLDivElement>>;
1689
+ Header: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
1690
+ asChild?: boolean;
1691
+ } & react.RefAttributes<HTMLDivElement>>;
1692
+ Footer: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
1693
+ asChild?: boolean;
1694
+ } & react.RefAttributes<HTMLDivElement>>;
1695
+ Metadata: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
1696
+ asChild?: boolean;
1697
+ } & react.RefAttributes<HTMLDivElement>>;
1698
+ };
1699
+
1700
+ interface ActionButtonContextValue {
1701
+ isHovered: boolean;
1702
+ isFocused: boolean;
1703
+ isPressed: boolean;
1704
+ isDisabled: boolean;
1705
+ }
1706
+ declare function useActionButtonContext(): ActionButtonContextValue;
1707
+ type ActionButtonRootProps = AsChildProps<ButtonHTMLAttributes<HTMLButtonElement>>;
1708
+ type ActionButtonIconProps = AsChildProps<HTMLAttributes<HTMLSpanElement>>;
1709
+ type ActionButtonLabelProps = AsChildProps<HTMLAttributes<HTMLSpanElement>> & {
1710
+ /** Visually hidden but accessible to screen readers */
1711
+ srOnly?: boolean;
1712
+ };
1713
+ type ActionButtonTooltipProps = AsChildProps<HTMLAttributes<HTMLSpanElement>> & {
1714
+ /** Position relative to button */
1715
+ position?: 'top' | 'bottom' | 'left' | 'right';
1716
+ /** Only show when hovered */
1717
+ showOnHover?: boolean;
1718
+ };
1719
+ declare const ActionButton: {
1720
+ Root: react.ForwardRefExoticComponent<ButtonHTMLAttributes<HTMLButtonElement> & {
1721
+ asChild?: boolean;
1722
+ } & react.RefAttributes<HTMLButtonElement>>;
1723
+ Icon: react.ForwardRefExoticComponent<HTMLAttributes<HTMLSpanElement> & {
1724
+ asChild?: boolean;
1725
+ } & react.RefAttributes<HTMLSpanElement>>;
1726
+ Label: react.ForwardRefExoticComponent<HTMLAttributes<HTMLSpanElement> & {
1727
+ asChild?: boolean;
1728
+ } & {
1729
+ /** Visually hidden but accessible to screen readers */
1730
+ srOnly?: boolean;
1731
+ } & react.RefAttributes<HTMLSpanElement>>;
1732
+ Tooltip: react.ForwardRefExoticComponent<HTMLAttributes<HTMLSpanElement> & {
1733
+ asChild?: boolean;
1734
+ } & {
1735
+ /** Position relative to button */
1736
+ position?: "top" | "bottom" | "left" | "right";
1737
+ /** Only show when hovered */
1738
+ showOnHover?: boolean;
1739
+ } & react.RefAttributes<HTMLSpanElement>>;
1740
+ };
1741
+
1742
+ /**
1743
+ * useStreaming hook
1744
+ * Handles AsyncGenerator streaming responses with cancellation support
1745
+ */
1746
+
1747
+ interface UseStreamingOptions {
1748
+ onChunk?: (content: string) => void;
1749
+ onError?: (error: string) => void;
1750
+ onDone?: () => void;
1751
+ }
1752
+ declare function useStreaming(options?: UseStreamingOptions): {
1753
+ content: string;
1754
+ isStreaming: boolean;
1755
+ error: Error | null;
1756
+ processStream: (stream: AsyncGenerator<StreamChunk>, signal?: AbortSignal) => Promise<void>;
1757
+ cancel: () => void;
1758
+ reset: () => void;
1759
+ };
1760
+
1761
+ /**
1762
+ * Translation hook using locale from IotaContext
1763
+ */
1764
+ declare function useTranslation(): {
1765
+ t: (key: string, params?: Record<string, any>) => string;
1766
+ locale: string;
1767
+ };
1768
+
1769
+ /**
1770
+ * Hook to prevent body scroll when modal is open
1771
+ * Restores scroll on cleanup or when modal closes
1772
+ *
1773
+ * @param isOpen - Whether the modal is currently open
1774
+ *
1775
+ * @example
1776
+ * const [isModalOpen, setIsModalOpen] = useState(false)
1777
+ * useModalLock(isModalOpen)
1778
+ */
1779
+ declare function useModalLock(isOpen: boolean): void;
1780
+
1781
+ /**
1782
+ * Hook to trap focus within a container (for modals, sidebars)
1783
+ * Ensures Tab and Shift+Tab cycle through focusable elements only
1784
+ *
1785
+ * @param containerRef - React ref to the container element
1786
+ * @param isActive - Whether the focus trap is currently active
1787
+ * @param restoreFocusOnDeactivate - Element to restore focus to when deactivated
1788
+ *
1789
+ * @example
1790
+ * const modalRef = useRef<HTMLDivElement>(null)
1791
+ * useFocusTrap(modalRef, isOpen)
1792
+ */
1793
+ declare function useFocusTrap(containerRef: RefObject<HTMLElement | null>, isActive: boolean, restoreFocusOnDeactivate?: HTMLElement | null): void;
1794
+
1795
+ /**
1796
+ * useImageGallery Hook
1797
+ * Manages image modal/gallery state and navigation
1798
+ */
1799
+
1800
+ interface UseImageGalleryOptions {
1801
+ /** Initial images to display */
1802
+ images?: ImageAttachment[];
1803
+ /** Wrap navigation at boundaries (default: false) */
1804
+ wrap?: boolean;
1805
+ /** Callback when modal opens */
1806
+ onOpen?: (index: number) => void;
1807
+ /** Callback when modal closes */
1808
+ onClose?: () => void;
1809
+ /** Callback when navigation occurs */
1810
+ onNavigate?: (index: number, direction: 'prev' | 'next') => void;
1811
+ }
1812
+ interface UseImageGalleryReturn {
1813
+ /** Whether the gallery modal is open */
1814
+ isOpen: boolean;
1815
+ /** Current image index */
1816
+ currentIndex: number;
1817
+ /** Current image (or undefined if none) */
1818
+ currentImage: ImageAttachment | undefined;
1819
+ /** All images in the gallery */
1820
+ images: ImageAttachment[];
1821
+ /** Whether there's a previous image */
1822
+ hasPrev: boolean;
1823
+ /** Whether there's a next image */
1824
+ hasNext: boolean;
1825
+ /** Open gallery at specific index */
1826
+ open: (index: number, newImages?: ImageAttachment[]) => void;
1827
+ /** Close the gallery */
1828
+ close: () => void;
1829
+ /** Navigate to previous image */
1830
+ prev: () => void;
1831
+ /** Navigate to next image */
1832
+ next: () => void;
1833
+ /** Navigate to specific index */
1834
+ goTo: (index: number) => void;
1835
+ /** Set images without opening */
1836
+ setImages: (images: ImageAttachment[]) => void;
1837
+ }
1838
+ /**
1839
+ * Hook for managing image gallery/modal state
1840
+ *
1841
+ * @example
1842
+ * ```tsx
1843
+ * const gallery = useImageGallery({ images: attachments })
1844
+ *
1845
+ * // Open gallery
1846
+ * <button onClick={() => gallery.open(0)}>View Images</button>
1847
+ *
1848
+ * // Render gallery
1849
+ * {gallery.isOpen && (
1850
+ * <ImageModal
1851
+ * image={gallery.currentImage}
1852
+ * onClose={gallery.close}
1853
+ * onPrev={gallery.prev}
1854
+ * onNext={gallery.next}
1855
+ * hasPrev={gallery.hasPrev}
1856
+ * hasNext={gallery.hasNext}
1857
+ * />
1858
+ * )}
1859
+ * ```
1860
+ */
1861
+ declare function useImageGallery(options?: UseImageGalleryOptions): UseImageGalleryReturn;
1862
+
1863
+ /**
1864
+ * useAutoScroll Hook
1865
+ * Manages auto-scroll behavior for chat containers
1866
+ */
1867
+ interface UseAutoScrollOptions {
1868
+ /** Threshold in pixels from bottom to consider "at bottom" (default: 100) */
1869
+ threshold?: number;
1870
+ /** Smooth scroll behavior (default: true) */
1871
+ smooth?: boolean;
1872
+ /** Callback when scroll position changes */
1873
+ onScroll?: (isAtBottom: boolean) => void;
1874
+ }
1875
+ interface UseAutoScrollReturn {
1876
+ /** Ref to attach to the scrollable container */
1877
+ containerRef: React.RefObject<HTMLDivElement>;
1878
+ /** Whether the container is scrolled to the bottom */
1879
+ isAtBottom: boolean;
1880
+ /** Whether auto-scroll should be active */
1881
+ shouldAutoScroll: boolean;
1882
+ /** Manually scroll to bottom */
1883
+ scrollToBottom: (smooth?: boolean) => void;
1884
+ /** Enable/disable auto-scroll */
1885
+ setAutoScroll: (enabled: boolean) => void;
1886
+ /** Handle scroll event (attach to container if not using ref) */
1887
+ handleScroll: (e: React.UIEvent<HTMLDivElement>) => void;
1888
+ }
1889
+ /**
1890
+ * Hook for managing auto-scroll behavior in chat containers
1891
+ *
1892
+ * @example
1893
+ * ```tsx
1894
+ * const scroll = useAutoScroll({ threshold: 50 })
1895
+ *
1896
+ * // Attach to container
1897
+ * <div ref={scroll.containerRef} onScroll={scroll.handleScroll}>
1898
+ * {messages.map(msg => <Message key={msg.id} />)}
1899
+ * </div>
1900
+ *
1901
+ * // Scroll button
1902
+ * {!scroll.isAtBottom && (
1903
+ * <button onClick={() => scroll.scrollToBottom()}>
1904
+ * Scroll to bottom
1905
+ * </button>
1906
+ * )}
1907
+ * ```
1908
+ */
1909
+ declare function useAutoScroll(options?: UseAutoScrollOptions): UseAutoScrollReturn;
1910
+
1911
+ /**
1912
+ * useMessageActions Hook
1913
+ * Provides copy, regenerate, and edit functionality for messages
1914
+ */
1915
+ interface UseMessageActionsOptions {
1916
+ /** Callback when copy succeeds */
1917
+ onCopy?: (content: string) => void;
1918
+ /** Callback when copy fails */
1919
+ onCopyError?: (error: Error) => void;
1920
+ /** Callback when regenerate is triggered */
1921
+ onRegenerate?: () => void | Promise<void>;
1922
+ /** Callback when edit is triggered */
1923
+ onEdit?: (content: string) => void | Promise<void>;
1924
+ /** Duration to show "copied" state in ms (default: 2000) */
1925
+ copiedDuration?: number;
1926
+ }
1927
+ interface UseMessageActionsReturn {
1928
+ /** Whether content was recently copied */
1929
+ isCopied: boolean;
1930
+ /** Whether regenerate is in progress */
1931
+ isRegenerating: boolean;
1932
+ /** Whether edit is in progress */
1933
+ isEditing: boolean;
1934
+ /** Copy content to clipboard */
1935
+ copy: (content: string) => Promise<void>;
1936
+ /** Trigger regenerate action */
1937
+ regenerate: () => Promise<void>;
1938
+ /** Trigger edit action */
1939
+ edit: (content: string) => Promise<void>;
1940
+ /** Reset all states */
1941
+ reset: () => void;
1942
+ }
1943
+ /**
1944
+ * Hook for managing message actions (copy, regenerate, edit)
1945
+ *
1946
+ * @example
1947
+ * ```tsx
1948
+ * const actions = useMessageActions({
1949
+ * onRegenerate: () => chatContext.regenerateMessage(messageId),
1950
+ * onEdit: (content) => chatContext.editMessage(messageId, content),
1951
+ * onCopy: () => toast.success('Copied!'),
1952
+ * })
1953
+ *
1954
+ * <button onClick={() => actions.copy(message.content)}>
1955
+ * {actions.isCopied ? 'Copied!' : 'Copy'}
1956
+ * </button>
1957
+ *
1958
+ * <button onClick={actions.regenerate} disabled={actions.isRegenerating}>
1959
+ * {actions.isRegenerating ? 'Regenerating...' : 'Regenerate'}
1960
+ * </button>
1961
+ * ```
1962
+ */
1963
+ declare function useMessageActions(options?: UseMessageActionsOptions): UseMessageActionsReturn;
1964
+
1965
+ /**
1966
+ * useAttachments Hook
1967
+ * Manages file upload state, validation, and preview
1968
+ */
1969
+
1970
+ interface FileValidationError {
1971
+ file: File;
1972
+ reason: 'size' | 'type' | 'count' | 'custom';
1973
+ message: string;
1974
+ }
1975
+ interface UseAttachmentsOptions {
1976
+ /** Maximum number of files (default: 10) */
1977
+ maxFiles?: number;
1978
+ /** Maximum file size in bytes (default: 20MB) */
1979
+ maxFileSize?: number;
1980
+ /** Allowed MIME types (default: attachment allowlist) */
1981
+ allowedTypes?: string[];
1982
+ /** Custom validation function */
1983
+ validate?: (file: File) => string | null;
1984
+ /** Callback when files are added */
1985
+ onAdd?: (files: Attachment$1[]) => void;
1986
+ /** Callback when a file is removed */
1987
+ onRemove?: (file: Attachment$1) => void;
1988
+ /** Callback when validation fails */
1989
+ onError?: (errors: FileValidationError[]) => void;
1990
+ }
1991
+ interface UseAttachmentsReturn {
1992
+ /** Current attachments */
1993
+ files: Attachment$1[];
1994
+ /** Validation errors from last operation */
1995
+ errors: FileValidationError[];
1996
+ /** Whether files are being processed */
1997
+ isProcessing: boolean;
1998
+ /** Whether max file limit is reached */
1999
+ isMaxReached: boolean;
2000
+ /** Number of remaining slots */
2001
+ remainingSlots: number;
2002
+ /** Add files (validates and processes) */
2003
+ add: (files: FileList | File[]) => Promise<void>;
2004
+ /** Remove a specific file */
2005
+ remove: (fileOrId: Attachment$1 | string) => void;
2006
+ /** Clear all files */
2007
+ clear: () => void;
2008
+ /** Clear errors */
2009
+ clearErrors: () => void;
2010
+ /** Set files directly (for controlled mode) */
2011
+ setFiles: (files: Attachment$1[]) => void;
2012
+ }
2013
+ /**
2014
+ * Hook for managing file attachments
2015
+ *
2016
+ * @example
2017
+ * ```tsx
2018
+ * const attachments = useAttachments({
2019
+ * maxFiles: 5,
2020
+ * maxFileSize: 5 * 1024 * 1024, // 5MB
2021
+ * onError: (errors) => errors.forEach(e => toast.error(e.message)),
2022
+ * })
2023
+ *
2024
+ * <input
2025
+ * type="file"
2026
+ * multiple
2027
+ * accept="image/*"
2028
+ * onChange={(e) => attachments.add(e.target.files)}
2029
+ * />
2030
+ *
2031
+ * {attachments.files.map(file => (
2032
+ * <AttachmentPreview
2033
+ * key={file.id}
2034
+ * attachment={file}
2035
+ * onRemove={() => attachments.remove(file)}
2036
+ * />
2037
+ * ))}
2038
+ *
2039
+ * {attachments.errors.length > 0 && (
2040
+ * <ErrorList errors={attachments.errors} />
2041
+ * )}
2042
+ * ```
2043
+ */
2044
+ declare function useAttachments(options?: UseAttachmentsOptions): UseAttachmentsReturn;
2045
+
2046
+ /**
2047
+ * useMarkdownCopy Hook
2048
+ * Manages copy-to-clipboard state for code blocks in markdown
2049
+ */
2050
+ interface UseMarkdownCopyOptions {
2051
+ /** Duration to show "copied" state in ms (default: 2000) */
2052
+ copiedDuration?: number;
2053
+ /** Callback when copy succeeds */
2054
+ onCopy?: (content: string, language?: string) => void;
2055
+ /** Callback when copy fails */
2056
+ onError?: (error: Error) => void;
2057
+ }
2058
+ interface UseMarkdownCopyReturn {
2059
+ /** Map of copied states by block ID */
2060
+ copiedStates: Map<string, boolean>;
2061
+ /** Check if a specific block is in copied state */
2062
+ isCopied: (blockId: string) => boolean;
2063
+ /** Copy content with block ID tracking */
2064
+ copy: (blockId: string, content: string, language?: string) => Promise<void>;
2065
+ /** Reset copied state for a specific block */
2066
+ reset: (blockId: string) => void;
2067
+ /** Reset all copied states */
2068
+ resetAll: () => void;
2069
+ }
2070
+ /**
2071
+ * Hook for managing copy states for multiple code blocks
2072
+ *
2073
+ * @example
2074
+ * ```tsx
2075
+ * const markdownCopy = useMarkdownCopy({
2076
+ * onCopy: (content, lang) => console.log(`Copied ${lang} code`),
2077
+ * })
2078
+ *
2079
+ * function CodeBlock({ id, code, language }) {
2080
+ * return (
2081
+ * <div>
2082
+ * <pre>{code}</pre>
2083
+ * <button onClick={() => markdownCopy.copy(id, code, language)}>
2084
+ * {markdownCopy.isCopied(id) ? 'Copied!' : 'Copy'}
2085
+ * </button>
2086
+ * </div>
2087
+ * )
2088
+ * }
2089
+ * ```
2090
+ */
2091
+ declare function useMarkdownCopy(options?: UseMarkdownCopyOptions): UseMarkdownCopyReturn;
2092
+
2093
+ /**
2094
+ * useScrollToBottom Hook
2095
+ * Manages scroll-to-bottom functionality with smart auto-scroll
2096
+ * Only scrolls if user is near the bottom (within threshold)
2097
+ */
2098
+ interface UseScrollToBottomReturn {
2099
+ /**
2100
+ * Ref to attach to the messages container
2101
+ */
2102
+ containerRef: React.RefObject<HTMLDivElement>;
2103
+ /**
2104
+ * Whether to show the scroll-to-bottom button
2105
+ */
2106
+ showScrollButton: boolean;
2107
+ /**
2108
+ * Function to scroll to bottom
2109
+ */
2110
+ scrollToBottom: () => void;
2111
+ }
2112
+ /**
2113
+ * Hook for managing scroll-to-bottom behavior
2114
+ * Automatically scrolls if user is near the bottom
2115
+ * Shows button only when scrolled up significantly
2116
+ */
2117
+ declare function useScrollToBottom(items: unknown[]): UseScrollToBottomReturn;
2118
+
2119
+ interface ShortcutConfig {
2120
+ key: string;
2121
+ ctrl?: boolean;
2122
+ shift?: boolean;
2123
+ alt?: boolean;
2124
+ meta?: boolean;
2125
+ callback: () => void;
2126
+ preventDefault?: boolean;
2127
+ description?: string;
2128
+ }
2129
+ /**
2130
+ * Hook for managing global keyboard shortcuts
2131
+ * Automatically handles modifier keys and input field exclusion
2132
+ *
2133
+ * @param shortcuts - Array of keyboard shortcut configurations
2134
+ *
2135
+ * @example
2136
+ * useKeyboardShortcuts([
2137
+ * { key: 'k', ctrl: true, callback: () => focusSearch(), description: 'Focus search' },
2138
+ * { key: '?', callback: () => setShowHelp(true), description: 'Show keyboard shortcuts' },
2139
+ * ])
2140
+ */
2141
+ declare function useKeyboardShortcuts(shortcuts: ShortcutConfig[]): void;
2142
+
2143
+ interface LongPressOptions {
2144
+ delay?: number;
2145
+ onLongPress: (e: React.TouchEvent | React.MouseEvent) => void;
2146
+ onPressStart?: () => void;
2147
+ onPressCancel?: () => void;
2148
+ moveThreshold?: number;
2149
+ hapticFeedback?: boolean;
2150
+ }
2151
+ interface LongPressEventHandlers {
2152
+ onTouchStart: (e: React.TouchEvent) => void;
2153
+ onTouchEnd: (e: React.TouchEvent) => void;
2154
+ onTouchMove: (e: React.TouchEvent) => void;
2155
+ onMouseDown?: (e: React.MouseEvent) => void;
2156
+ onMouseUp?: (e: React.MouseEvent) => void;
2157
+ onMouseLeave?: (e: React.MouseEvent) => void;
2158
+ }
2159
+ interface LongPressResult {
2160
+ handlers: LongPressEventHandlers;
2161
+ isPressed: boolean;
2162
+ }
2163
+ declare function useLongPress(options: LongPressOptions): LongPressResult;
2164
+
2165
+ /**
2166
+ * Framer Motion animation variants for BiChat UI
2167
+ * Subtle, professional animations for enterprise applications
2168
+ * Respects prefers-reduced-motion for accessibility
2169
+ */
2170
+ /**
2171
+ * Fade in animation
2172
+ */
2173
+ declare const fadeInVariants: {
2174
+ initial: {
2175
+ opacity: number;
2176
+ };
2177
+ animate: {
2178
+ opacity: number;
2179
+ transition: {
2180
+ duration: number;
2181
+ };
2182
+ };
2183
+ exit: {
2184
+ opacity: number;
2185
+ transition: {
2186
+ duration: number;
2187
+ };
2188
+ };
2189
+ };
2190
+ /**
2191
+ * Fade in with subtle slide up
2192
+ */
2193
+ declare const fadeInUpVariants: {
2194
+ initial: {
2195
+ opacity: number;
2196
+ y: number;
2197
+ };
2198
+ animate: {
2199
+ opacity: number;
2200
+ y: number;
2201
+ transition: {
2202
+ duration: number;
2203
+ ease: number[];
2204
+ };
2205
+ };
2206
+ exit: {
483
2207
  opacity: number;
484
2208
  y: number;
485
2209
  transition: {
@@ -630,6 +2354,31 @@ declare const typingDotVariants: {
630
2354
  };
631
2355
  };
632
2356
  };
2357
+ /**
2358
+ * Verb transition for typing indicator
2359
+ * Smooth slide-up animation for rotating text
2360
+ */
2361
+ declare const verbTransitionVariants: {
2362
+ initial: {
2363
+ y: number;
2364
+ opacity: number;
2365
+ };
2366
+ animate: {
2367
+ y: number;
2368
+ opacity: number;
2369
+ transition: {
2370
+ duration: number;
2371
+ ease: string;
2372
+ };
2373
+ };
2374
+ exit: {
2375
+ y: number;
2376
+ opacity: number;
2377
+ transition: {
2378
+ duration: number;
2379
+ };
2380
+ };
2381
+ };
633
2382
  /**
634
2383
  * Floating button (scroll to bottom, etc.)
635
2384
  */
@@ -699,35 +2448,62 @@ declare const toastVariants: {
699
2448
  };
700
2449
  };
701
2450
  };
702
-
703
2451
  /**
704
- * Per-session rate limiter
705
- * Prevents excessive requests within a time window
2452
+ * Session item with subtle slide-right on hover
706
2453
  */
707
- interface RateLimiterConfig {
708
- maxRequests: number;
709
- windowMs: number;
710
- }
711
- declare class RateLimiter {
712
- private timestamps;
713
- private maxRequests;
714
- private windowMs;
715
- constructor(config: RateLimiterConfig);
716
- /**
717
- * Check if a request can be made
718
- * Updates internal state if request is allowed
719
- */
720
- canMakeRequest(): boolean;
721
- /**
722
- * Get milliseconds until next request is allowed
723
- * Returns 0 if request can be made immediately
724
- */
725
- getTimeUntilNextRequest(): number;
726
- /**
727
- * Reset the rate limiter state
728
- */
729
- reset(): void;
730
- }
2454
+ declare const sessionItemVariants: {
2455
+ initial: {
2456
+ opacity: number;
2457
+ x: number;
2458
+ };
2459
+ animate: {
2460
+ opacity: number;
2461
+ x: number;
2462
+ transition: {
2463
+ duration: number;
2464
+ };
2465
+ };
2466
+ hover: {
2467
+ x: number;
2468
+ transition: {
2469
+ duration: number;
2470
+ };
2471
+ };
2472
+ exit: {
2473
+ opacity: number;
2474
+ x: number;
2475
+ transition: {
2476
+ duration: number;
2477
+ };
2478
+ };
2479
+ };
2480
+ /**
2481
+ * Error/alert message slide-in
2482
+ */
2483
+ declare const errorMessageVariants: {
2484
+ initial: {
2485
+ opacity: number;
2486
+ y: number;
2487
+ height: number;
2488
+ };
2489
+ animate: {
2490
+ opacity: number;
2491
+ y: number;
2492
+ height: string;
2493
+ transition: {
2494
+ duration: number;
2495
+ ease: number[];
2496
+ };
2497
+ };
2498
+ exit: {
2499
+ opacity: number;
2500
+ y: number;
2501
+ height: number;
2502
+ transition: {
2503
+ duration: number;
2504
+ };
2505
+ };
2506
+ };
731
2507
 
732
2508
  interface ChatSessionProviderProps {
733
2509
  dataSource: ChatDataSource;
@@ -736,30 +2512,24 @@ interface ChatSessionProviderProps {
736
2512
  children: ReactNode;
737
2513
  }
738
2514
  declare function ChatSessionProvider({ dataSource, sessionId, rateLimiter: externalRateLimiter, children }: ChatSessionProviderProps): react_jsx_runtime.JSX.Element;
2515
+ declare function useChatSession(): ChatSessionStateValue;
2516
+ declare function useChatMessaging(): ChatMessagingStateValue;
2517
+ declare function useChatInput(): ChatInputStateValue;
739
2518
  declare function useChat(): ChatSessionContextValue;
740
2519
 
741
2520
  /**
742
- * Type definitions matching Go structs for server-side context
2521
+ * BiChat context types layered on top of canonical applet-core context contracts.
743
2522
  */
744
- interface UserContext {
745
- id: number;
746
- email: string;
747
- firstName: string;
748
- lastName: string;
749
- permissions: string[];
750
- }
751
- interface TenantContext {
752
- id: string;
753
- name: string;
754
- }
755
- interface LocaleContext {
756
- language: string;
757
- translations: Record<string, string>;
758
- }
759
- interface AppConfig {
760
- graphQLEndpoint: string;
2523
+
2524
+ type UserContext = UserContext$1;
2525
+ type TenantContext = TenantContext$1;
2526
+ type LocaleContext = LocaleContext$1;
2527
+ type AppConfig = AppConfig$1 & {
761
2528
  streamEndpoint: string;
762
- }
2529
+ basePath: string;
2530
+ assetsBasePath: string;
2531
+ rpcUIEndpoint: string;
2532
+ };
763
2533
  interface Extensions {
764
2534
  branding?: {
765
2535
  appName?: string;
@@ -794,14 +2564,23 @@ interface Extensions {
794
2564
  codeInterpreter?: boolean;
795
2565
  multiAgent?: boolean;
796
2566
  };
2567
+ llm?: {
2568
+ provider?: string;
2569
+ apiKeyConfigured?: boolean;
2570
+ };
2571
+ debug?: {
2572
+ limits?: {
2573
+ policyMaxTokens: number;
2574
+ modelMaxTokens: number;
2575
+ effectiveMaxTokens: number;
2576
+ completionReserveTokens: number;
2577
+ };
2578
+ };
797
2579
  }
798
- interface IotaContext {
799
- user: UserContext;
800
- tenant: TenantContext;
801
- locale: LocaleContext;
2580
+ type IotaContext = Omit<InitialContext, 'config' | 'extensions'> & {
802
2581
  config: AppConfig;
803
2582
  extensions?: Extensions;
804
- }
2583
+ };
805
2584
  declare global {
806
2585
  interface Window {
807
2586
  __BICHAT_CONTEXT__: IotaContext;
@@ -836,7 +2615,7 @@ interface BiChatConfig {
836
2615
  translations: Record<string, string>;
837
2616
  };
838
2617
  endpoints: {
839
- graphQL: string;
2618
+ rpc: string;
840
2619
  stream: string;
841
2620
  };
842
2621
  csrfToken?: string;
@@ -870,33 +2649,6 @@ declare function useRequiredConfig(): BiChatConfig;
870
2649
  */
871
2650
  declare function hasPermission(config: BiChatConfig | null, permission: string): boolean;
872
2651
 
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
2652
  /**
901
2653
  * Theme system type definitions
902
2654
  */
@@ -980,21 +2732,23 @@ declare function createHeadersWithCSRF(init?: HeadersInit): Headers;
980
2732
 
981
2733
  /**
982
2734
  * Built-in HTTP data source with SSE streaming and AbortController
983
- * Implements ChatDataSource interface with real HTTP/GraphQL calls
2735
+ * Implements ChatDataSource interface with real HTTP/RPC calls
2736
+ *
2737
+ * Uses turn-based architecture - fetches ConversationTurns instead of flat messages.
984
2738
  */
985
2739
 
986
2740
  interface HttpDataSourceConfig {
987
2741
  baseUrl: string;
988
- graphQLEndpoint?: string;
2742
+ rpcEndpoint: string;
989
2743
  streamEndpoint?: string;
990
2744
  csrfToken?: string | (() => string);
991
2745
  headers?: Record<string, string>;
992
2746
  timeout?: number;
993
2747
  }
994
2748
  interface SessionState {
995
- session: Session;
996
- messages: Message[];
997
- pendingQuestion?: PendingQuestion | null;
2749
+ session: Session$1;
2750
+ turns: ConversationTurn$1[];
2751
+ pendingQuestion?: PendingQuestion$1 | null;
998
2752
  }
999
2753
  interface Result<T> {
1000
2754
  success: boolean;
@@ -1004,6 +2758,7 @@ interface Result<T> {
1004
2758
  declare class HttpDataSource implements ChatDataSource {
1005
2759
  private config;
1006
2760
  private abortController;
2761
+ private rpc;
1007
2762
  constructor(config: HttpDataSourceConfig);
1008
2763
  /**
1009
2764
  * Get CSRF token from config
@@ -1013,57 +2768,380 @@ declare class HttpDataSource implements ChatDataSource {
1013
2768
  * Create headers for HTTP requests
1014
2769
  */
1015
2770
  private createHeaders;
1016
- /**
1017
- * Execute GraphQL query
1018
- */
1019
- private graphql;
2771
+ private callRPC;
1020
2772
  /**
1021
2773
  * Create a new chat session
1022
2774
  */
1023
- createSession(): Promise<Session>;
2775
+ createSession(): Promise<Session$1>;
1024
2776
  /**
1025
- * Fetch an existing session with messages
2777
+ * Fetch an existing session with turns (turn-based architecture)
1026
2778
  */
1027
2779
  fetchSession(id: string): Promise<SessionState | null>;
2780
+ fetchSessionArtifacts(sessionId: string, options?: {
2781
+ limit?: number;
2782
+ offset?: number;
2783
+ }): Promise<{
2784
+ artifacts: SessionArtifact[];
2785
+ hasMore?: boolean;
2786
+ nextOffset?: number;
2787
+ }>;
2788
+ uploadSessionArtifacts(sessionId: string, files: File[]): Promise<{
2789
+ artifacts: SessionArtifact[];
2790
+ }>;
2791
+ renameSessionArtifact(artifactId: string, name: string, description?: string): Promise<SessionArtifact>;
2792
+ deleteSessionArtifact(artifactId: string): Promise<void>;
1028
2793
  /**
1029
2794
  * Send a message and stream the response using SSE
1030
2795
  */
1031
- sendMessage(sessionId: string, content: string, attachments?: Attachment[], signal?: AbortSignal): AsyncGenerator<StreamChunk>;
2796
+ sendMessage(sessionId: string, content: string, attachments?: Attachment$1[], signal?: AbortSignal, options?: SendMessageOptions): AsyncGenerator<StreamChunk>;
1032
2797
  /**
1033
2798
  * Cancel ongoing stream
1034
2799
  */
1035
2800
  cancelStream(): void;
2801
+ /**
2802
+ * Clear session history in-place.
2803
+ */
2804
+ clearSessionHistory(sessionId: string): Promise<{
2805
+ success: boolean;
2806
+ deletedMessages: number;
2807
+ deletedArtifacts: number;
2808
+ }>;
2809
+ /**
2810
+ * Compact session history into summarized turn.
2811
+ */
2812
+ compactSessionHistory(sessionId: string): Promise<{
2813
+ success: boolean;
2814
+ summary: string;
2815
+ deletedMessages: number;
2816
+ deletedArtifacts: number;
2817
+ }>;
1036
2818
  /**
1037
2819
  * Submit answers to a pending question
1038
2820
  */
1039
2821
  submitQuestionAnswers(sessionId: string, questionId: string, answers: QuestionAnswers): Promise<Result<void>>;
1040
2822
  /**
1041
- * Cancel a pending question
2823
+ * Reject a pending question
1042
2824
  */
1043
- cancelPendingQuestion(questionId: string): Promise<Result<void>>;
2825
+ rejectPendingQuestion(sessionId: string): Promise<Result<void>>;
1044
2826
  /**
1045
2827
  * Navigate to a session (optional, for SPA routing)
1046
2828
  */
1047
2829
  navigateToSession?(sessionId: string): void;
2830
+ listSessions(options?: {
2831
+ limit?: number;
2832
+ offset?: number;
2833
+ includeArchived?: boolean;
2834
+ }): Promise<SessionListResult$1>;
2835
+ archiveSession(sessionId: string): Promise<Session$1>;
2836
+ unarchiveSession(sessionId: string): Promise<Session$1>;
2837
+ pinSession(sessionId: string): Promise<Session$1>;
2838
+ unpinSession(sessionId: string): Promise<Session$1>;
2839
+ deleteSession(sessionId: string): Promise<void>;
2840
+ renameSession(sessionId: string, title: string): Promise<Session$1>;
2841
+ regenerateSessionTitle(sessionId: string): Promise<Session$1>;
1048
2842
  }
1049
2843
  /**
1050
2844
  * Factory function to create HttpDataSource
1051
2845
  */
1052
2846
  declare function createHttpDataSource(config: HttpDataSourceConfig): ChatDataSource;
1053
2847
 
2848
+ type BichatRPC = {
2849
+ "bichat.artifact.delete": {
2850
+ params: SessionIDParams;
2851
+ result: OkResult;
2852
+ };
2853
+ "bichat.artifact.update": {
2854
+ params: ArtifactUpdateParams;
2855
+ result: ArtifactResult;
2856
+ };
2857
+ "bichat.ping": {
2858
+ params: PingParams;
2859
+ result: PingResult;
2860
+ };
2861
+ "bichat.question.reject": {
2862
+ params: QuestionCancelParams;
2863
+ result: SessionGetResult;
2864
+ };
2865
+ "bichat.question.submit": {
2866
+ params: QuestionSubmitParams;
2867
+ result: SessionGetResult;
2868
+ };
2869
+ "bichat.session.archive": {
2870
+ params: SessionIDParams;
2871
+ result: SessionCreateResult;
2872
+ };
2873
+ "bichat.session.artifacts": {
2874
+ params: SessionArtifactsParams;
2875
+ result: SessionArtifactsResult;
2876
+ };
2877
+ "bichat.session.clear": {
2878
+ params: SessionIDParams;
2879
+ result: SessionClearResult;
2880
+ };
2881
+ "bichat.session.compact": {
2882
+ params: SessionIDParams;
2883
+ result: SessionCompactResult;
2884
+ };
2885
+ "bichat.session.create": {
2886
+ params: SessionCreateParams;
2887
+ result: SessionCreateResult;
2888
+ };
2889
+ "bichat.session.delete": {
2890
+ params: SessionIDParams;
2891
+ result: OkResult;
2892
+ };
2893
+ "bichat.session.get": {
2894
+ params: SessionGetParams;
2895
+ result: SessionGetResult;
2896
+ };
2897
+ "bichat.session.list": {
2898
+ params: SessionListParams;
2899
+ result: SessionListResult;
2900
+ };
2901
+ "bichat.session.pin": {
2902
+ params: SessionIDParams;
2903
+ result: SessionCreateResult;
2904
+ };
2905
+ "bichat.session.regenerateTitle": {
2906
+ params: SessionIDParams;
2907
+ result: SessionCreateResult;
2908
+ };
2909
+ "bichat.session.unarchive": {
2910
+ params: SessionIDParams;
2911
+ result: SessionCreateResult;
2912
+ };
2913
+ "bichat.session.unpin": {
2914
+ params: SessionIDParams;
2915
+ result: SessionCreateResult;
2916
+ };
2917
+ "bichat.session.updateTitle": {
2918
+ params: SessionUpdateTitleParams;
2919
+ result: SessionCreateResult;
2920
+ };
2921
+ "bichat.session.uploadArtifacts": {
2922
+ params: SessionUploadArtifactsParams;
2923
+ result: SessionUploadArtifactsResult;
2924
+ };
2925
+ };
2926
+ interface Artifact {
2927
+ id: string;
2928
+ sessionId: string;
2929
+ messageId?: string;
2930
+ type: string;
2931
+ name: string;
2932
+ description?: string;
2933
+ mimeType?: string;
2934
+ url?: string;
2935
+ sizeBytes: number;
2936
+ metadata?: Record<string, unknown>;
2937
+ createdAt: string;
2938
+ }
2939
+ interface ArtifactResult {
2940
+ artifact: Artifact;
2941
+ }
2942
+ interface ArtifactUpdateParams {
2943
+ id: string;
2944
+ name: string;
2945
+ description?: string;
2946
+ }
2947
+ interface AssistantTurn {
2948
+ id: string;
2949
+ role?: string;
2950
+ content: string;
2951
+ explanation?: string;
2952
+ citations: Citation[];
2953
+ toolCalls?: ToolCall[];
2954
+ debug?: DebugTrace | null;
2955
+ artifacts: unknown[];
2956
+ codeOutputs: CodeOutput[];
2957
+ createdAt: string;
2958
+ }
2959
+ interface Attachment {
2960
+ id: string;
2961
+ filename: string;
2962
+ mimeType: string;
2963
+ sizeBytes: number;
2964
+ base64Data?: string;
2965
+ url?: string;
2966
+ }
2967
+ interface Citation {
2968
+ id: string;
2969
+ type: string;
2970
+ title: string;
2971
+ url: string;
2972
+ startIndex: number;
2973
+ endIndex: number;
2974
+ excerpt?: string;
2975
+ source?: string;
2976
+ }
2977
+ interface CodeOutput {
2978
+ type: string;
2979
+ content: string;
2980
+ filename?: string;
2981
+ mimeType?: string;
2982
+ sizeBytes?: number;
2983
+ }
2984
+ interface ConversationTurn {
2985
+ id: string;
2986
+ sessionId: string;
2987
+ userTurn: UserTurn;
2988
+ assistantTurn?: AssistantTurn | null;
2989
+ createdAt: string;
2990
+ }
2991
+ interface DebugToolCall {
2992
+ callId?: string;
2993
+ name?: string;
2994
+ arguments?: string;
2995
+ result?: string;
2996
+ error?: string;
2997
+ durationMs?: number;
2998
+ }
2999
+ interface DebugTrace {
3000
+ usage?: DebugUsage | null;
3001
+ generationMs?: number;
3002
+ tools?: DebugToolCall[];
3003
+ }
3004
+ interface DebugUsage {
3005
+ promptTokens: number;
3006
+ completionTokens: number;
3007
+ totalTokens: number;
3008
+ cachedTokens: number;
3009
+ cost: number;
3010
+ }
3011
+ interface OkResult {
3012
+ ok: boolean;
3013
+ }
3014
+ interface PendingQuestion {
3015
+ checkpointId: string;
3016
+ agentName?: string;
3017
+ turnId: string;
3018
+ questions: PendingQuestionItem[];
3019
+ }
3020
+ interface PendingQuestionItem {
3021
+ id: string;
3022
+ text: string;
3023
+ type: string;
3024
+ options: PendingQuestionOption[];
3025
+ }
3026
+ interface PendingQuestionOption {
3027
+ id: string;
3028
+ label: string;
3029
+ }
3030
+ type PingParams = Record<string, never>;
3031
+ interface PingResult {
3032
+ ok: boolean;
3033
+ tenantId: string;
3034
+ }
3035
+ interface QuestionCancelParams {
3036
+ sessionId: string;
3037
+ }
3038
+ interface QuestionSubmitParams {
3039
+ sessionId: string;
3040
+ checkpointId: string;
3041
+ answers: Record<string, string>;
3042
+ }
3043
+ interface Session {
3044
+ id: string;
3045
+ title: string;
3046
+ status: string;
3047
+ pinned: boolean;
3048
+ createdAt: string;
3049
+ updatedAt: string;
3050
+ }
3051
+ interface SessionArtifactsParams {
3052
+ sessionId: string;
3053
+ limit: number;
3054
+ offset: number;
3055
+ }
3056
+ interface SessionArtifactsResult {
3057
+ artifacts: Artifact[];
3058
+ hasMore: boolean;
3059
+ nextOffset: number;
3060
+ }
3061
+ interface SessionClearResult {
3062
+ success: boolean;
3063
+ deletedMessages: number;
3064
+ deletedArtifacts: number;
3065
+ }
3066
+ interface SessionCompactResult {
3067
+ success: boolean;
3068
+ summary: string;
3069
+ deletedMessages: number;
3070
+ deletedArtifacts: number;
3071
+ }
3072
+ interface SessionCreateParams {
3073
+ title: string;
3074
+ }
3075
+ interface SessionCreateResult {
3076
+ session: Session;
3077
+ }
3078
+ interface SessionGetParams {
3079
+ id: string;
3080
+ }
3081
+ interface SessionGetResult {
3082
+ session: Session;
3083
+ turns: ConversationTurn[];
3084
+ pendingQuestion?: PendingQuestion | null;
3085
+ }
3086
+ interface SessionIDParams {
3087
+ id: string;
3088
+ }
3089
+ interface SessionListParams {
3090
+ limit: number;
3091
+ offset: number;
3092
+ includeArchived: boolean;
3093
+ }
3094
+ interface SessionListResult {
3095
+ sessions: Session[];
3096
+ total?: number;
3097
+ hasMore: boolean;
3098
+ }
3099
+ interface SessionUpdateTitleParams {
3100
+ id: string;
3101
+ title: string;
3102
+ }
3103
+ interface SessionUploadArtifactsParams {
3104
+ sessionId: string;
3105
+ attachments: Attachment[];
3106
+ }
3107
+ interface SessionUploadArtifactsResult {
3108
+ artifacts: Artifact[];
3109
+ }
3110
+ interface ToolCall {
3111
+ id: string;
3112
+ name: string;
3113
+ arguments: string;
3114
+ result?: string;
3115
+ error?: string;
3116
+ durationMs?: number;
3117
+ }
3118
+ interface UserTurn {
3119
+ id: string;
3120
+ content: string;
3121
+ attachments: Attachment[];
3122
+ createdAt: string;
3123
+ }
3124
+
1054
3125
  /**
1055
3126
  * File Utilities
1056
3127
  * Validation, conversion, and formatting for file attachments
1057
3128
  */
3129
+ declare const ATTACHMENT_ACCEPT_ATTRIBUTE: string;
3130
+ declare function isImageMimeType(mimeType: string): boolean;
1058
3131
  /**
1059
- * Validates an image file against size and type constraints
3132
+ * Validates a file against size and type constraints
1060
3133
  * @throws Error if validation fails
1061
3134
  */
1062
- declare function validateImageFile(file: File, maxSizeBytes?: number): void;
3135
+ declare function validateAttachmentFile(file: File$1, maxSizeBytes?: number): void;
3136
+ /**
3137
+ * Backward-compatible image validator used by older components/stories.
3138
+ */
3139
+ declare function validateImageFile(file: File$1, maxSizeBytes?: number): void;
1063
3140
  /**
1064
- * Converts a file to base64 string (without data URL prefix)
3141
+ * Converts a file to base64 string (without data URL prefix).
3142
+ * Prefers FileReader data URLs, then falls back to buffer-based encoding.
1065
3143
  */
1066
- declare function convertToBase64(file: File): Promise<string>;
3144
+ declare function convertToBase64(file: File$1): Promise<string>;
1067
3145
  /**
1068
3146
  * Creates a data URL from base64 string and MIME type
1069
3147
  */
@@ -1078,4 +3156,133 @@ declare function formatFileSize(bytes: number): string;
1078
3156
  */
1079
3157
  declare function validateFileCount(currentCount: number, newCount: number, maxCount?: number): void;
1080
3158
 
1081
- export { type AppConfig, type Artifact, AssistantTurnView, type Attachment, AttachmentGrid, type BiChatConfig, ChartCard, type ChartData, type ChatDataSource, ChatHeader, ChatSession, type ChatSessionContextValue, ChatSessionProvider, type Citation, type CodeOutput, CodeOutputsPanel, ConfigProvider, DownloadCard, _default$2 as EditableText, type EditableTextProps, type EditableTextRef, _default$3 as EmptyState, type EmptyStateProps, HttpDataSource, type HttpDataSourceConfig, type ImageAttachment, ImageModal, InlineQuestionForm, type IotaContext, IotaContextProvider, ListItemSkeleton, type LocaleContext, MarkdownRenderer, type Message, MessageInput, type MessageInputProps, type MessageInputRef, MessageList, MessageRole, type PendingQuestion, type QuestionAnswers, type QueuedMessage, RateLimiter, type RateLimiterConfig, ScrollToBottomButton, _default$1 as SearchInput, type SearchInputProps, type Session, _default as Skeleton, SkeletonAvatar, SkeletonCard, SkeletonGroup, type SkeletonGroupProps, type SkeletonProps, SkeletonText, SourcesPanel, type StreamChunk, StreamingCursor, type TenantContext, type Theme, type ThemeBorderRadius, type ThemeColors, ThemeProvider, type ThemeSpacing, type ToolCall, TurnBubble, type UserContext, UserTurnView, WelcomeContent, addCSRFHeader, backdropVariants, buttonVariants, convertToBase64, createDataUrl, createHeadersWithCSRF, createHttpDataSource, darkTheme, dropdownVariants, fadeInUpVariants, fadeInVariants, floatingButtonVariants, formatFileSize, getCSRFToken, hasPermission as hasConfigPermission, hasPermission$1 as hasPermission, lightTheme, listItemVariants, messageContainerVariants, messageVariants, scaleFadeVariants, staggerContainerVariants, toastVariants, typingDotVariants, useChat, useConfig, useIotaContext, useRequiredConfig, useStreaming, useTheme, useTranslation, validateFileCount, validateImageFile };
3159
+ interface FileVisual {
3160
+ /** Phosphor icon component */
3161
+ icon: typeof File$1;
3162
+ /** Tailwind text-color classes for the icon (light + dark) */
3163
+ iconColor: string;
3164
+ /** Tailwind background classes for the icon container (light + dark) */
3165
+ bgColor: string;
3166
+ /** Short label (PDF, CSV, XLS, etc.) */
3167
+ label: string;
3168
+ }
3169
+ /**
3170
+ * Resolves visual metadata (icon, colors, label) for a file based on
3171
+ * its MIME type and/or filename. Single source of truth used by
3172
+ * AttachmentGrid, SessionArtifactList, DownloadCard, etc.
3173
+ */
3174
+ declare function getFileVisual(mimeType?: string, filename?: string): FileVisual;
3175
+ /** Chart-specific visual (not mime-based, used for artifact type = 'chart') */
3176
+ declare const CHART_VISUAL: FileVisual;
3177
+
3178
+ /**
3179
+ * Citation Processing Utility
3180
+ *
3181
+ * Transforms OpenAI citations from raw markers (e.g., ≡cite≡turn0search2≡)
3182
+ * to formatted inline citation markers (e.g., [1], [2]).
3183
+ *
3184
+ * Process:
3185
+ * 1. Sort citations by startIndex (descending) to process from end to start
3186
+ * 2. Replace character ranges [startIndex, endIndex] with numbered markers
3187
+ * 3. Return processed content with clean inline citation references
3188
+ */
3189
+
3190
+ interface ProcessedContent {
3191
+ /** Content with citation markers replaced by [1], [2], etc. */
3192
+ content: string;
3193
+ /** Citations array with their display indices */
3194
+ citations: Array<Citation$1 & {
3195
+ displayIndex: number;
3196
+ }>;
3197
+ }
3198
+ /**
3199
+ * Process message content to replace raw citation markers with formatted inline citations
3200
+ *
3201
+ * @param content - Raw message content with potential citation markers
3202
+ * @param citations - Array of citations with startIndex/endIndex positions
3203
+ * @returns Processed content with clean citation markers and indexed citations
3204
+ *
3205
+ * @example
3206
+ * ```ts
3207
+ * const result = processCitations(
3208
+ * "Tesla reported $28B ≡cite≡turn0search2≡ revenue",
3209
+ * [{ startIndex: 20, endIndex: 42, title: "...", url: "...", type: "url_citation" }]
3210
+ * )
3211
+ * // result.content = "Tesla reported $28B [1] revenue"
3212
+ * // result.citations = [{ ..., displayIndex: 1 }]
3213
+ * ```
3214
+ */
3215
+ declare function processCitations(content: string, citations: Citation$1[] | null | undefined): ProcessedContent;
3216
+
3217
+ /**
3218
+ * Normalizes partially-streamed markdown so that react-markdown
3219
+ * can render it without layout artifacts (e.g. an unclosed code fence
3220
+ * turning the rest of the message into a code block).
3221
+ *
3222
+ * Called on every streaming content update — kept intentionally cheap (O(lines)).
3223
+ */
3224
+ declare function normalizeStreamingMarkdown(text: string): string;
3225
+
3226
+ /**
3227
+ * SSE stream parser for consuming Server-Sent Events.
3228
+ */
3229
+ interface SSEEvent {
3230
+ type: string;
3231
+ content?: string;
3232
+ error?: string;
3233
+ sessionId?: string;
3234
+ toolName?: string;
3235
+ toolCallId?: string;
3236
+ durationMs?: number;
3237
+ success?: boolean;
3238
+ [key: string]: unknown;
3239
+ }
3240
+ /**
3241
+ * Parses an SSE stream and yields parsed JSON events.
3242
+ */
3243
+ declare function parseSSEStream(reader: ReadableStreamDefaultReader<Uint8Array>): AsyncGenerator<SSEEvent, void, unknown>;
3244
+
3245
+ /**
3246
+ * Groups chat sessions by date relative to today
3247
+ * Categories: Today, Yesterday, Last 7 Days, Last 30 Days, Older
3248
+ * Sessions within each group are sorted by updatedAt (most recent first)
3249
+ */
3250
+ declare function groupSessionsByDate(sessions: Session$1[], t?: (key: string) => string): SessionGroup[];
3251
+
3252
+ /**
3253
+ * Date formatting utilities using date-fns
3254
+ */
3255
+ /**
3256
+ * Format a date as relative time (e.g., "5m ago", "2h ago")
3257
+ * Falls back to HH:mm format for dates older than 24 hours
3258
+ *
3259
+ * Accepts an optional `t` function for i18n. Translation keys used:
3260
+ * - relativeTime.justNow
3261
+ * - relativeTime.minutesAgo (receives `{count}`)
3262
+ * - relativeTime.hoursAgo (receives `{count}`)
3263
+ * - relativeTime.daysAgo (receives `{count}`)
3264
+ *
3265
+ * If no `t` function is provided, falls back to English defaults.
3266
+ */
3267
+ declare function formatRelativeTime(date: string | Date, t?: (key: string, params?: Record<string, string | number>) => string): string;
3268
+
3269
+ /**
3270
+ * Shared validation utilities for QuestionForm components
3271
+ */
3272
+
3273
+ /**
3274
+ * Checks if a question has been answered.
3275
+ * A question is answered if it has at least one selected option OR custom text.
3276
+ */
3277
+ declare function isQuestionAnswered(data: QuestionAnswerData | undefined): boolean;
3278
+ /**
3279
+ * Validates that all questions are answered and custom text is valid.
3280
+ * Returns null if valid, or an error message string if invalid.
3281
+ *
3282
+ * @param questions - Array of questions to validate
3283
+ * @param answers - Map of question IDs to answer data
3284
+ * @param t - Optional translation function for error messages
3285
+ */
3286
+ declare function validateAnswers(questions: Question[], answers: QuestionAnswers, t?: (key: string, params?: Record<string, any>) => string): string | null;
3287
+
3288
+ export { ATTACHMENT_ACCEPT_ATTRIBUTE, ActionButton, type ActionButtonIconProps, type ActionButtonLabelProps, type ActionButtonRootProps, type ActionButtonTooltipProps, _default$1 as Alert, AllChatsList, type AppConfig, _default as ArchiveBanner, ArchivedChatList, type Artifact$1 as 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$1 as AssistantTurn, AssistantTurnView, type AssistantTurnViewProps, type Attachment$1 as Attachment, MemoizedAttachmentGrid as AttachmentGrid, AttachmentPreview, AttachmentUpload, Avatar, type AvatarFallbackProps, type AvatarImageProps, type AvatarRootProps, type BiChatConfig, type BichatRPC, Bubble, type BubbleContentProps, type BubbleFooterProps, type BubbleHeaderProps, type BubbleMetadataProps, type BubbleRootProps, type BubbleVariant, CHART_VISUAL, ChartCard, type ChartData, type ChartSeries, type ChatDataSource, ChatHeader, type ChatInputStateValue, type ChatMessagingStateValue, ChatSession, type ChatSessionContextValue, ChatSessionProvider, type ChatSessionStateValue, type Citation$1 as Citation, MemoizedCodeBlock as CodeBlock, type CodeOutput$1 as CodeOutput, CodeOutputsPanel, CompactionDoodle, ConfigProvider, ConfirmModal, type ConfirmModalProps, ConfirmationStep, type ConversationTurn$1 as ConversationTurn, DateGroupHeader, DebugPanel, type DebugPanelProps, DefaultErrorContent, DownloadCard, MemoizedEditableText as EditableText, type EditableTextProps, type EditableTextRef, MemoizedEmptyState as EmptyState, type EmptyStateProps, ErrorBoundary, type FileValidationError, type FileVisual, HttpDataSource, type HttpDataSourceConfig, type ImageAttachment, type ImageLoadingStatus, ImageModal, InlineQuestionForm, type IotaContext, IotaContextProvider, ListItemSkeleton, MemoizedLoadingSpinner as LoadingSpinner, type LocaleContext, MemoizedMarkdownRenderer as MarkdownRenderer, MessageActions, MessageInput, type MessageInputProps, type MessageInputRef, MessageList, MessageRole, type PendingQuestion$1 as PendingQuestion, PermissionGuard, type PermissionGuardProps, type ProcessedContent, type Question, type QuestionAnswerData, type QuestionAnswers, QuestionForm, type QuestionOption, QuestionStep, type QueuedMessage, RateLimiter, type RateLimiterConfig, RetryActionArea, type SSEEvent, ScreenReaderAnnouncer, ScrollToBottomButton, MemoizedSearchInput as SearchInput, type SearchInputProps, type Session$1 as Session, type SessionArtifact, SessionArtifactList, SessionArtifactPreview, SessionArtifactsPanel, type SessionGroup, SessionItem, type SessionListResult$1 as SessionListResult, SessionSkeleton, type SessionUser, type ShortcutConfig, Sidebar, MemoizedSkeleton as Skeleton, SkeletonAvatar, SkeletonCard, SkeletonGroup, type SkeletonGroupProps, type SkeletonProps, SkeletonText, SkipLink, Slot, type SlotProps, SourcesPanel, type StreamChunk, StreamError, StreamingCursor, SystemMessage, MemoizedTabBar as TabBar, TableExportButton, TableWithExport, type TenantContext, type Theme, type ThemeBorderRadius, type ThemeColors, ThemeProvider, type ThemeSpacing, Toast, ToastContainer, type ToastItem, type ToastProps, type ToastType, type ToolCall$1 as ToolCall, TouchContextMenu, Turn, type TurnActionsProps, type TurnAssistantProps, TurnBubble, type TurnBubbleClassNames, type TurnBubbleProps, type TurnRootProps, type TurnTimestampProps, type TurnUserProps, MemoizedTypingIndicator as TypingIndicator, type TypingIndicatorProps, 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, MemoizedUserFilter as UserFilter, UserMessage, type UserMessageActionsSlotProps, type UserMessageAttachmentsSlotProps, type UserMessageAvatarSlotProps, type UserMessageClassNames, type UserMessageContentSlotProps, type UserMessageProps, type UserMessageSlots, type UserTurn$1 as UserTurn, UserTurnView, type UserTurnViewProps, WelcomeContent, addCSRFHeader, backdropVariants, buttonVariants, convertToBase64, createDataUrl, createHeadersWithCSRF, createHttpDataSource, darkTheme, dropdownVariants, errorMessageVariants, fadeInUpVariants, fadeInVariants, floatingButtonVariants, formatFileSize, formatRelativeTime, getCSRFToken, getFileVisual, getValidChildren, groupSessionsByDate, hasPermission as hasConfigPermission, hasPermission$1 as hasPermission, isImageMimeType, isQuestionAnswered, lightTheme, listItemVariants, messageContainerVariants, messageVariants, normalizeStreamingMarkdown, parseSSEStream, processCitations, scaleFadeVariants, sessionItemVariants, staggerContainerVariants, toastVariants, typingDotVariants, useActionButtonContext, useAttachments, useAutoScroll, useAvatarContext, useBubbleContext, useChat, useChatInput, useChatMessaging, useChatSession, useConfig, useFocusTrap, useImageGallery, useIotaContext, useKeyboardShortcuts, useLongPress, useMarkdownCopy, useMessageActions, useModalLock, useRequiredConfig, useScrollToBottom, useStreaming, useTheme, useToast, useTranslation, useTurnContext, validateAnswers, validateAttachmentFile, validateFileCount, validateImageFile, verbTransitionVariants };