Datasets:

Modalities:
Text
Formats:
text
Size:
< 1K
ArXiv:
Libraries:
Datasets
File size: 33,528 Bytes
2517be1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
/**
 *
 * ATTACHMENTS
 *
 * Components for displaying and managing different attachment types in chat messages.
 * Supports two operational modes:
 * - **Readonly mode**: For displaying stored attachments in sent messages (DatabaseMessageExtra[])
 * - **Editable mode**: For managing pending uploads in the input form (ChatUploadedFile[])
 *
 * The attachment system uses `getAttachmentDisplayItems()` utility to normalize both
 * data sources into a unified display format, enabling consistent rendering regardless
 * of the attachment origin.
 *
 */

/**
 * **ChatAttachmentsList** - Unified display for file attachments in chat
 *
 * Central component for rendering file attachments in both ChatMessage (readonly)
 * and ChatForm (editable) contexts.
 *
 * **Architecture:**
 * - Delegates rendering to specialized thumbnail components based on attachment type
 * - Manages scroll state and navigation arrows for horizontal overflow
 * - Integrates with DialogChatAttachmentPreview for full-size viewing
 * - Validates vision modality support via `activeModelId` prop
 *
 * **Features:**
 * - Horizontal scroll with smooth navigation arrows
 * - Image thumbnails with lazy loading and error fallback
 * - File type icons for non-image files (PDF, text, audio, etc.)
 * - MCP prompt attachments with expandable content preview
 * - Click-to-preview with full-size dialog and download option
 * - "View All" button when `limitToSingleRow` is enabled and content overflows
 * - Vision modality validation to warn about unsupported image uploads
 * - Customizable thumbnail dimensions via `imageHeight`/`imageWidth` props
 *
 * @example
 * ```svelte
 * <!-- Readonly mode (in ChatMessage) -->
 * <ChatAttachmentsList attachments={message.extra} readonly />
 *
 * <!-- Editable mode (in ChatForm) -->
 * <ChatAttachmentsList
 *   bind:uploadedFiles
 *   onFileRemove={(id) => removeFile(id)}
 *   limitToSingleRow
 *   activeModelId={selectedModel}
 * />
 * ```
 */
export { default as ChatAttachmentsList } from './ChatAttachments/ChatAttachmentsList.svelte';

/**
 * Displays MCP Prompt attachment with expandable content preview.
 * Shows server name, prompt name, and allows expanding to view full prompt arguments
 * and content. Used when user selects a prompt from ChatFormPromptPicker.
 */
export { default as ChatAttachmentMcpPrompt } from './ChatAttachments/ChatAttachmentMcpPrompt.svelte';

/**
 * Displays a single MCP Resource attachment with icon, name, and server info.
 * Shows loading/error states and supports remove action.
 * Used within ChatAttachmentMcpResources for individual resource display.
 */
export { default as ChatAttachmentMcpResource } from './ChatAttachments/ChatAttachmentMcpResource.svelte';

/**
 * Full-size attachment preview component for dialog display. Handles different file types:
 * images (full-size display), text files (syntax highlighted), PDFs (text extraction or image preview),
 * audio (placeholder with download), and generic files (download option).
 */
export { default as ChatAttachmentPreview } from './ChatAttachments/ChatAttachmentPreview.svelte';

/**
 * Displays MCP Resource attachments as a horizontal carousel.
 * Shows resource name, URI, and allows clicking to view resource content.
 */
export { default as ChatAttachmentMcpResources } from './ChatAttachments/ChatAttachmentMcpResources.svelte';

/**
 * Thumbnail for non-image file attachments. Displays file type icon based on extension,
 * file name (truncated), and file size.
 * Handles text files, PDFs, audio, and other document types.
 */
export { default as ChatAttachmentThumbnailFile } from './ChatAttachments/ChatAttachmentThumbnailFile.svelte';

/**
 * Thumbnail for image attachments with lazy loading and error fallback.
 * Displays image preview with configurable dimensions. Falls back to placeholder
 * on load error.
 */
export { default as ChatAttachmentThumbnailImage } from './ChatAttachments/ChatAttachmentThumbnailImage.svelte';

/**
 * Grid view of all attachments for "View All" dialog. Displays all attachments
 * in a responsive grid layout when there are too many to show inline.
 * Triggered by "+X more" button in ChatAttachmentsList.
 */
export { default as ChatAttachmentsViewAll } from './ChatAttachments/ChatAttachmentsViewAll.svelte';

/**
 *
 * FORM
 *
 * Components for the chat input area. The form handles user input, file attachments,
 * audio recording, and MCP prompts & resources selection. It integrates with multiple stores:
 * - `chatStore` for message submission and generation control
 * - `modelsStore` for model selection and validation
 * - `mcpStore` for MCP prompt browsing and loading
 *
 * The form exposes a public API for programmatic control from parent components
 * (focus, height reset, model selector, validation).
 *
 */

/**
 * **ChatForm** - Main chat input component with rich features
 *
 * The primary input interface for composing and sending chat messages.
 * Orchestrates text input, file attachments, audio recording, and MCP prompts.
 * Used by ChatScreenForm and ChatMessageEditForm for both new conversations and message editing.
 *
 * **Architecture:**
 * - Composes ChatFormTextarea, ChatFormActions, and ChatFormPromptPicker
 * - Manages file upload state via `uploadedFiles` bindable prop
 * - Integrates with ModelsSelector for model selection in router mode
 * - Communicates with parent via callbacks (onSubmit, onFilesAdd, onStop, etc.)
 *
 * **Input Handling:**
 * - IME-safe Enter key handling (waits for composition end)
 * - Shift+Enter for newline, Enter for submit
 * - Paste handler for files and long text (> {pasteLongTextToFileLen} chars → file conversion)
 * - Keyboard shortcut `/` triggers MCP prompt picker
 *
 * **Features:**
 * - Auto-resizing textarea with placeholder
 * - File upload via button dropdown (images/text/PDF), drag-drop, or paste
 * - Audio recording with WAV conversion (when model supports audio)
 * - MCP prompt picker with search and argument forms
 * - MCP reource picker with component to list attached resources at the bottom of Chat Form
 * - Model selector integration (router mode)
 * - Loading state with stop button, disabled state for errors
 *
 * **Exported API:**
 * - `focus()` - Focus the textarea programmatically
 * - `resetTextareaHeight()` - Reset textarea to default height after submit
 * - `openModelSelector()` - Open model selection dropdown
 * - `checkModelSelected(): boolean` - Validate model selection, show error if none
 *
 * @example
 * ```svelte
 * <ChatForm
 *   bind:this={chatFormRef}
 *   bind:value={message}
 *   bind:uploadedFiles
 *   {isLoading}
 *   onSubmit={handleSubmit}
 *   onFilesAdd={processFiles}
 *   onStop={handleStop}
 * />
 * ```
 */
export { default as ChatForm } from './ChatForm/ChatForm.svelte';

/**
 * Dropdown button for file attachment selection. Opens a menu with options for
 * Images, Text Files, and PDF Files. Each option filters the file picker to
 * appropriate types. Images option is disabled when model lacks vision modality.
 */
export { default as ChatFormActionAttachmentsDropdown } from './ChatForm/ChatFormActions/ChatFormActionAttachmentsDropdown.svelte';

/**
 * Mobile sheet variant of the file attachment selector. Renders a bottom sheet
 * with the same options as ChatFormActionAttachmentsDropdown, optimized for
 * touch interaction on mobile devices.
 */
export { default as ChatFormActionAttachmentsSheet } from './ChatForm/ChatFormActions/ChatFormActionAttachmentsSheet.svelte';

/**
 * Audio recording button with real-time recording indicator. Records audio
 * and converts to WAV format for upload. Only visible when the active model
 * supports audio modality and setting for automatic audio input is enabled. Shows recording duration while active.
 */
export { default as ChatFormActionRecord } from './ChatForm/ChatFormActions/ChatFormActionRecord.svelte';

/**
 * Container for chat form action buttons. Arranges file attachment, audio record,
 * and submit/stop buttons in a horizontal layout. Handles conditional visibility
 * based on model capabilities and loading state.
 */
export { default as ChatFormActions } from './ChatForm/ChatFormActions/ChatFormActions.svelte';

/**
 * Submit/stop button with loading state. Shows send icon normally, transforms
 * to stop icon during generation. Disabled when input is empty or form is disabled.
 * Triggers onSubmit or onStop callbacks based on current state.
 */
export { default as ChatFormActionSubmit } from './ChatForm/ChatFormActions/ChatFormActionSubmit.svelte';

/**
 * Hidden file input element for programmatic file selection.
 */
export { default as ChatFormFileInputInvisible } from './ChatForm/ChatFormFileInputInvisible.svelte';

/**
 * Helper text display below chat.
 */
export { default as ChatFormHelperText } from './ChatForm/ChatFormHelperText.svelte';

/**
 * Auto-resizing textarea with IME composition support. Automatically adjusts
 * height based on content. Handles IME input correctly (waits for composition
 * end before processing Enter key). Exposes focus() and resetHeight() methods.
 */
export { default as ChatFormTextarea } from './ChatForm/ChatFormTextarea.svelte';

/**
 * **ChatFormPromptPicker** - MCP prompt selection interface
 *
 * Floating picker for browsing and selecting MCP Server Prompts.
 * Triggered by typing `/` in the chat input or choosing `MCP Prompt` option in ChatFormActionAttachmentsDropdown.
 * Loads prompts from connected MCP servers and allows users to select and configure them.
 *
 * **Architecture:**
 * - Fetches available prompts from mcpStore
 * - Manages selection state and keyboard navigation internally
 * - Delegates argument input to ChatFormPromptPickerArgumentForm
 * - Communicates prompt loading lifecycle via callbacks
 *
 * **Prompt Loading Flow:**
 * 1. User selects prompt → `onPromptLoadStart` called with placeholder ID
 * 2. Prompt content fetched from MCP server asynchronously
 * 3. On success → `onPromptLoadComplete` with full prompt data
 * 4. On failure → `onPromptLoadError` with error details
 *
 * **Features:**
 * - Search/filter prompts by name across all connected servers
 * - Keyboard navigation (↑/↓ to navigate, Enter to select, Esc to close)
 * - Argument input forms for prompts with required parameters
 * - Autocomplete suggestions for argument values
 * - Loading states with skeleton placeholders
 * - Server information header per prompt for visual identification
 *
 * **Exported API:**
 * - `handleKeydown(event): boolean` - Process keyboard events, returns true if handled
 *
 * @example
 * ```svelte
 * <ChatFormPromptPicker
 *   bind:this={pickerRef}
 *   isOpen={showPicker}
 *   searchQuery={promptQuery}
 *   onClose={() => showPicker = false}
 *   onPromptLoadStart={(id, info) => addPlaceholder(id, info)}
 *   onPromptLoadComplete={(id, result) => replacePlaceholder(id, result)}
 *   onPromptLoadError={(id, error) => handleError(id, error)}
 * />
 * ```
 */
export { default as ChatFormPromptPicker } from './ChatForm/ChatFormPromptPicker/ChatFormPromptPicker.svelte';

/**
 * Form for entering MCP prompt arguments. Displays input fields for each
 * required argument defined by the prompt. Validates input and submits
 * when all required fields are filled. Shows argument descriptions as hints.
 */
export { default as ChatFormPromptPickerArgumentForm } from './ChatForm/ChatFormPromptPicker/ChatFormPromptPickerArgumentForm.svelte';

/**
 * Single argument input field with autocomplete suggestions. Fetches suggestions
 * from MCP server based on argument type. Supports keyboard navigation through
 * suggestions list. Used within ChatFormPromptPickerArgumentForm.
 */
export { default as ChatFormPromptPickerArgumentInput } from './ChatForm/ChatFormPromptPicker/ChatFormPromptPickerArgumentInput.svelte';

/**
 * Shared popover wrapper for inline picker popovers (prompts, resources).
 * Provides consistent positioning, styling, and open/close behavior.
 */
export { default as ChatFormPickerPopover } from './ChatForm/ChatFormPickerPopover.svelte';

/**
 * Generic scrollable list for picker popovers. Provides search input,
 * scroll-into-view for keyboard navigation, loading skeletons, empty state,
 * and optional footer. Uses Svelte 5 snippets for item/skeleton/footer rendering.
 * Shared by ChatFormPromptPicker and ChatFormResourcePicker.
 */
export { default as ChatFormPickerList } from './ChatForm/ChatFormPicker/ChatFormPickerList.svelte';

/**
 * Generic button wrapper for picker list items. Provides consistent styling,
 * hover/selected states, and data-picker-index attribute for scroll-into-view.
 * Shared by ChatFormPromptPicker and ChatFormResourcePicker.
 */
export { default as ChatFormPickerListItem } from './ChatForm/ChatFormPicker/ChatFormPickerListItem.svelte';

/**
 * Generic header for picker items displaying server favicon, label, item title,
 * and optional description. Accepts `titleExtra` and `subtitle` snippets for
 * custom content like badges or URIs. Shared by both pickers.
 */
export { default as ChatFormPickerItemHeader } from './ChatForm/ChatFormPicker/ChatFormPickerItemHeader.svelte';

/**
 * Generic skeleton loading placeholder for picker list items. Configurable
 * title width and optional badge skeleton. Shared by both pickers.
 */
export { default as ChatFormPickerListItemSkeleton } from './ChatForm/ChatFormPicker/ChatFormPickerListItemSkeleton.svelte';

/**
 * **ChatFormResourcePicker** - MCP resource selection interface
 *
 * Floating picker for browsing and attaching MCP Server Resources.
 * Triggered by typing `@` in the chat input.
 * Loads resources from connected MCP servers and allows users to attach them to the chat context.
 *
 * **Features:**
 * - Search/filter resources by name, title, description, or URI across all connected servers
 * - Keyboard navigation (↑/↓ to navigate, Enter to select, Esc to close)
 * - Shows attached state for already-attached resources
 * - Loading states with skeleton placeholders
 * - Server information header per resource for visual identification
 *
 * **Exported API:**
 * - `handleKeydown(event): boolean` - Process keyboard events, returns true if handled
 */
export { default as ChatFormResourcePicker } from './ChatForm/ChatFormResourcePicker/ChatFormResourcePicker.svelte';

/**
 *
 * MESSAGES
 *
 * Components for displaying chat messages. The message system supports:
 * - **Conversation branching**: Messages can have siblings (alternative versions)
 *   created by editing or regenerating. Users can navigate between branches.
 * - **Role-based rendering**: Different layouts for user, assistant, and system messages
 * - **Streaming support**: Real-time display of assistant responses as they generate
 * - **Agentic workflows**: Special rendering for tool calls and reasoning blocks
 *
 * The branching system uses `getMessageSiblings()` utility to compute sibling info
 * for each message based on the full conversation tree stored in the database.
 *
 */

/**
 * **ChatMessages** - Message list container with branching support
 *
 * Container component that renders the list of messages in a conversation.
 * Computes sibling information for each message to enable branch navigation.
 * Integrates with conversationsStore for message operations.
 *
 * **Architecture:**
 * - Fetches all conversation messages to compute sibling relationships
 * - Filters system messages based on user config (`showSystemMessage`)
 * - Delegates rendering to ChatMessage for each message
 * - Propagates all message operations to chatStore via callbacks
 *
 * **Branching Logic:**
 * - Uses `getMessageSiblings()` to find all messages with same parent
 * - Computes `siblingInfo: { currentIndex, totalSiblings, siblingIds }`
 * - Enables navigation between alternative message versions
 *
 * **Message Operations (delegated to chatStore):**
 * - Edit with branching: Creates new message branch, preserves original
 * - Edit with replacement: Modifies message in place
 * - Regenerate: Creates new assistant response as sibling
 * - Delete: Removes message and all descendants (cascade)
 * - Continue: Appends to incomplete assistant message
 *
 * @example
 * ```svelte
 * <ChatMessages
 *   messages={activeMessages()}
 *   onUserAction={resetAutoScroll}
 * />
 * ```
 */
export { default as ChatMessages } from './ChatMessages/ChatMessages.svelte';

/**
 * **ChatMessage** - Single message display with actions
 *
 * Renders a single chat message with role-specific styling and full action
 * support. Delegates to specialized components based on message role:
 * ChatMessageUser, ChatMessageAssistant, or ChatMessageSystem.
 *
 * **Architecture:**
 * - Routes to role-specific component based on `message.type`
 * - Manages edit mode state and inline editing UI
 * - Handles action callbacks (copy, edit, delete, regenerate)
 * - Displays branching controls when message has siblings
 *
 * **User Messages:**
 * - Shows attachments via ChatAttachmentsList
 * - Displays MCP prompts if present
 * - Edit creates new branch or preserves responses
 *
 * **Assistant Messages:**
 * - Renders content via MarkdownContent or ChatMessageAgenticContent
 * - Shows model info badge (when enabled)
 * - Regenerate creates sibling with optional model override
 * - Continue action for incomplete responses
 *
 * **Features:**
 * - Inline editing with file attachments support
 * - Copy formatted content to clipboard
 * - Delete with confirmation (shows cascade delete count)
 * - Branching controls for sibling navigation
 * - Statistics display (tokens, timing)
 *
 * @example
 * ```svelte
 * <ChatMessage
 *   {message}
 *   {siblingInfo}
 *   onEditWithBranching={handleEdit}
 *   onRegenerateWithBranching={handleRegenerate}
 *   onNavigateToSibling={handleNavigate}
 * />
 * ```
 */
export { default as ChatMessage } from './ChatMessages/ChatMessage.svelte';

/**
 * **ChatMessageAgenticContent** - Agentic workflow output display
 *
 * Specialized renderer for assistant messages containing agentic workflow markers.
 * Parses structured content and displays tool calls and reasoning blocks as
 * interactive collapsible sections with real-time streaming support.
 *
 * **Architecture:**
 * - Uses `parseAgenticContent()` from `$lib/utils` to parse markers
 * - Renders sections as CollapsibleContentBlock components
 * - Handles streaming state for progressive content display
 * - Falls back to MarkdownContent for plain text sections
 *
 * **Marker Format:**
 * - Tool calls: in constants/agentic.ts (AGENTIC_TAGS)
 * - Reasoning: in constants/agentic.ts (REASONING_TAGS)
 * - Partial markers handled gracefully during streaming
 *
 * **Execution States:**
 * - **Streaming**: Animated spinner, block expanded, auto-scroll enabled
 * - **Pending**: Waiting indicator for queued tool calls
 * - **Completed**: Static display, block collapsed by default
 *
 * **Features:**
 * - JSON arguments syntax highlighting via SyntaxHighlightedCode
 * - Tool results display with formatting
 * - Plain text sections between markers rendered as markdown
 * - Smart collapse defaults (expanded while streaming, collapsed when done)
 *
 * @example
 * ```svelte
 * <ChatMessageAgenticContent
 *   content={message.content}
 *   {message}
 *   isStreaming={isGenerating}
 * />
 * ```
 */
export { default as ChatMessageAgenticContent } from './ChatMessages/ChatMessageAgenticContent.svelte';

/**
 * Action buttons toolbar for messages. Displays copy, edit, delete, and regenerate
 * buttons based on message role. Includes branching controls when message has siblings.
 * Shows delete confirmation dialog with cascade delete count. Handles raw output toggle
 * for assistant messages.
 */
export { default as ChatMessageActions } from './ChatMessages/ChatMessageActions.svelte';

/**
 * Navigation controls for message siblings (conversation branches). Displays
 * prev/next arrows with current position counter (e.g., "2/5"). Enables users
 * to navigate between alternative versions of a message created by editing
 * or regenerating. Uses `conversationsStore.navigateToSibling()` for navigation.
 */
export { default as ChatMessageBranchingControls } from './ChatMessages/ChatMessageBranchingControls.svelte';

/**
 * Statistics display for assistant messages. Shows token counts (prompt/completion),
 * generation timing, tokens per second, and model name (when enabled in settings).
 * Data sourced from message.timings stored during generation.
 */
export { default as ChatMessageStatistics } from './ChatMessages/ChatMessageStatistics.svelte';

/**
 * MCP prompt display in user messages. Shows when user selected an MCP prompt
 * via ChatFormPromptPicker. Displays server name, prompt name, and expandable
 * content preview. Stored in message.extra as DatabaseMessageExtraMcpPrompt.
 */
export { default as ChatMessageMcpPrompt } from './ChatMessages/ChatMessageMcpPrompt.svelte';

/**
 * Formatted content display for MCP prompt messages. Renders the full prompt
 * content with arguments in a readable format. Used within ChatMessageMcpPrompt
 * for the expanded view.
 */
export { default as ChatMessageMcpPromptContent } from './ChatMessages/ChatMessageMcpPromptContent.svelte';

/**
 * System message display component. Renders system messages with distinct styling.
 * Visibility controlled by `showSystemMessage` config setting.
 */
export { default as ChatMessageSystem } from './ChatMessages/ChatMessageSystem.svelte';

/**
 * User message display component. Renders user messages with right-aligned bubble styling.
 * Shows message content, attachments via ChatAttachmentsList, and MCP prompts if present.
 * Supports inline editing mode with ChatMessageEditForm integration.
 */
export { default as ChatMessageUser } from './ChatMessages/ChatMessageUser.svelte';

/**
 * Assistant message display component. Renders assistant responses with left-aligned styling.
 * Supports both plain markdown content (via MarkdownContent) and agentic content with tool calls
 * (via ChatMessageAgenticContent). Shows model info badge, statistics, and action buttons.
 * Handles streaming state with real-time content updates.
 */
export { default as ChatMessageAssistant } from './ChatMessages/ChatMessageAssistant.svelte';

/**
 * Inline message editing form. Provides textarea for editing message content with
 * attachment management. Shows save/cancel buttons and optional "Save only" button
 * for editing without regenerating responses. Used within ChatMessage components
 * when user enters edit mode.
 */
export { default as ChatMessageEditForm } from './ChatMessages/ChatMessageEditForm.svelte';

/**
 *
 * SCREEN
 *
 * Top-level chat interface components. ChatScreen is the main container that
 * orchestrates all chat functionality. It integrates with multiple stores:
 * - `chatStore` for message operations and generation control
 * - `conversationsStore` for conversation management
 * - `serverStore` for server connection state
 * - `modelsStore` for model capabilities (vision, audio modalities)
 *
 * The screen handles the complete chat lifecycle from empty state to active
 * conversation with streaming responses.
 *
 */

/**
 * **ChatScreen** - Main chat interface container
 *
 * Top-level component that orchestrates the entire chat interface. Manages
 * messages display, input form, file handling, auto-scroll, error dialogs,
 * and server state. Used as the main content area in chat routes.
 *
 * **Architecture:**
 * - Composes ChatMessages, ChatScreenForm, ChatScreenHeader, and dialogs
 * - Manages auto-scroll via `createAutoScrollController()` hook
 * - Handles file upload pipeline (validation → processing → state update)
 * - Integrates with serverStore for loading/error/warning states
 * - Tracks active model for modality validation (vision, audio)
 *
 * **File Upload Pipeline:**
 * 1. Files received via drag-drop, paste, or file picker
 * 2. Validated against supported types (`isFileTypeSupported()`)
 * 3. Filtered by model modalities (`filterFilesByModalities()`)
 * 4. Empty files detected and reported via DialogEmptyFileAlert
 * 5. Valid files processed to ChatUploadedFile[] format
 * 6. Unsupported files shown in error dialog with reasons
 *
 * **State Management:**
 * - `isEmpty`: Shows centered welcome UI when no conversation active
 * - `isCurrentConversationLoading`: Tracks generation state for current chat
 * - `activeModelId`: Determines available modalities for file validation
 * - `uploadedFiles`: Pending file attachments for next message
 *
 * **Features:**
 * - Messages display with smart auto-scroll (pauses on user scroll up)
 * - File drag-drop with visual overlay indicator
 * - File validation with detailed error messages
 * - Error dialog management (chat errors, model unavailable)
 * - Server loading/error/warning states with appropriate UI
 * - Conversation deletion with confirmation dialog
 * - Processing info display (tokens/sec, timing) during generation
 * - Keyboard shortcuts (Ctrl+Shift+Backspace to delete conversation)
 *
 * @example
 * ```svelte
 * <!-- In chat route -->
 * <ChatScreen showCenteredEmpty />
 *
 * <!-- In conversation route -->
 * <ChatScreen showCenteredEmpty={false} />
 * ```
 */
export { default as ChatScreen } from './ChatScreen/ChatScreen.svelte';

/**
 * Visual overlay displayed when user drags files over the chat screen.
 * Shows drop zone indicator to guide users where to release files.
 * Integrated with ChatScreen's drag-drop file upload handling.
 */
export { default as ChatScreenDragOverlay } from './ChatScreen/ChatScreenDragOverlay.svelte';

/**
 * Chat form wrapper within ChatScreen. Positions the ChatForm component at the
 * bottom of the screen with proper padding and max-width constraints. Handles
 * the visual container styling for the input area.
 */
export { default as ChatScreenForm } from './ChatScreen/ChatScreenForm.svelte';

/**
 * Header bar for chat screen. Displays conversation title (or "New Chat"),
 * model selector (in router mode), and action buttons (delete conversation).
 * Sticky positioned at the top of the chat area.
 */
export { default as ChatScreenHeader } from './ChatScreen/ChatScreenHeader.svelte';

/**
 * Processing info display during generation. Shows real-time statistics:
 * tokens per second, prompt/completion token counts, and elapsed time.
 * Data sourced from slotsService polling during active generation.
 * Only visible when `isCurrentConversationLoading` is true.
 */
export { default as ChatScreenProcessingInfo } from './ChatScreen/ChatScreenProcessingInfo.svelte';

/**
 *
 * SETTINGS
 *
 * Application settings components. Settings are persisted to localStorage via
 * the config store and synchronized with server `/props` endpoint for sampling
 * parameters. The settings panel uses a tabbed interface with mobile-responsive
 * horizontal scrolling tabs.
 *
 * **Parameter Sync System:**
 * Sampling parameters (temperature, top_p, etc.) can come from three sources:
 * 1. **Server Props**: Default values from `/props` endpoint
 * 2. **User Custom**: Values explicitly set by user (overrides server)
 * 3. **App Default**: Fallback when server props unavailable
 *
 * The `ChatSettingsParameterSourceIndicator` badge shows which source is active.
 *
 */

/**
 * **ChatSettings** - Application settings panel
 *
 * Comprehensive settings interface with categorized sections. Manages all
 * user preferences and sampling parameters. Integrates with config store
 * for persistence and ParameterSyncService for server synchronization.
 *
 * **Architecture:**
 * - Uses tabbed navigation with category sections
 * - Maintains local form state, commits on save
 * - Tracks user overrides vs server defaults for sampling params
 * - Exposes reset() method for dialog close without save
 *
 * **Categories:**
 * - **General**: API key, system message, show system messages toggle
 * - **Display**: Theme selection, message actions visibility, model info badge
 * - **Sampling**: Temperature, top_p, top_k, min_p, repeat_penalty, etc.
 * - **Penalties**: Frequency penalty, presence penalty, repeat last N
 * - **Import/Export**: Conversation backup and restore
 * - **MCP**: MCP server management (opens DialogChatSettings with MCP tab)
 * - **Developer**: Debug options, disable auto-scroll
 *
 * **Parameter Sync:**
 * - Fetches defaults from server `/props` endpoint
 * - Shows source indicator badge (Custom/Server Props/Default)
 * - Real-time badge updates as user types
 * - Tracks which parameters user has explicitly overridden
 *
 * **Features:**
 * - Mobile-responsive layout with horizontal scrolling tabs
 * - Form validation with error messages
 * - Secure API key storage (masked input)
 * - Import/export conversations as JSON
 * - Reset to defaults option per parameter
 *
 * **Exported API:**
 * - `reset()` - Reset form fields to currently saved values (for cancel action)
 *
 * @example
 * ```svelte
 * <ChatSettings
 *   bind:this={settingsRef}
 *   onSave={() => dialogOpen = false}
 *   onCancel={() => { settingsRef.reset(); dialogOpen = false; }}
 * />
 * ```
 */
export { default as ChatSettings } from './ChatSettings/ChatSettings.svelte';

/**
 * Footer with save/cancel buttons for settings panel. Positioned at bottom
 * of settings dialog. Save button commits form state to config store,
 * cancel button triggers reset and close.
 */
export { default as ChatSettingsFooter } from './ChatSettings/ChatSettingsFooter.svelte';

/**
 * Form fields renderer for individual settings. Generates appropriate input
 * components based on field type (text, number, select, checkbox, textarea).
 * Handles validation, help text display, and parameter source indicators.
 */
export { default as ChatSettingsFields } from './ChatSettings/ChatSettingsFields.svelte';

/**
 * Import/export tab content for conversation data management. Provides buttons
 * to export all conversations as JSON file and import from JSON file.
 * Handles file download/upload and data validation.
 */
export { default as ChatSettingsImportExportTab } from './ChatSettings/ChatSettingsImportExportTab.svelte';

/**
 * Badge indicating parameter source for sampling settings. Shows one of:
 * - **Custom**: User has explicitly set this value (orange badge)
 * - **Server Props**: Using default from `/props` endpoint (blue badge)
 * - **Default**: Using app default, server props unavailable (gray badge)
 * Updates in real-time as user types to show immediate feedback.
 */
export { default as ChatSettingsParameterSourceIndicator } from './ChatSettings/ChatSettingsParameterSourceIndicator.svelte';

/**
 *
 * SIDEBAR
 *
 * The sidebar integrates with ShadCN's sidebar component system
 * for consistent styling and mobile responsiveness.
 * Conversations are loaded from conversationsStore and displayed in reverse
 * chronological order (most recent first).
 *
 */

/**
 * **ChatSidebar** - Chat Sidebar with actions menu and conversation list
 *
 * Collapsible sidebar displaying conversation history with search and
 * management actions. Integrates with ShadCN sidebar component for
 * consistent styling and mobile responsiveness.
 *
 * **Architecture:**
 * - Uses ShadCN Sidebar.* components for structure
 * - Fetches conversations from conversationsStore
 * - Manages search state and filtered results locally
 * - Handles conversation CRUD operations via conversationsStore
 *
 * **Navigation:**
 * - Click conversation to navigate to `/chat/[id]`
 * - New chat button navigates to `/` (root)
 * - Active conversation highlighted based on route params
 *
 * **Conversation Management:**
 * - Right-click or menu button for context menu
 * - Rename: Opens inline edit dialog
 * - Delete: Shows confirmation with conversation preview
 * - Delete All: Removes all conversations with confirmation
 *
 * **Features:**
 * - Search/filter conversations by title
 * - Conversation list with message previews (first message truncated)
 * - Active conversation highlighting
 * - Mobile-responsive collapse/expand via ShadCN sidebar
 * - New chat button in header
 * - Settings button opens DialogChatSettings
 *
 * **Exported API:**
 * - `handleMobileSidebarItemClick()` - Close sidebar on mobile after item selection
 * - `activateSearchMode()` - Focus search input programmatically
 * - `editActiveConversation()` - Open rename dialog for current conversation
 *
 * @example
 * ```svelte
 * <ChatSidebar bind:this={sidebarRef} />
 * ```
 */
export { default as ChatSidebar } from './ChatSidebar/ChatSidebar.svelte';

/**
 * Action buttons for sidebar header. Contains new chat button, settings button,
 * and delete all conversations button. Manages dialog states for settings and
 * delete confirmation.
 */
export { default as ChatSidebarActions } from './ChatSidebar/ChatSidebarActions.svelte';

/**
 * Single conversation item in sidebar. Displays conversation title (truncated),
 * last message preview, and timestamp. Shows context menu on right-click with
 * rename and delete options. Highlights when active (matches current route).
 * Handles click to navigate and keyboard accessibility.
 */
export { default as ChatSidebarConversationItem } from './ChatSidebar/ChatSidebarConversationItem.svelte';

/**
 * Search input for filtering conversations in sidebar. Filters conversation
 * list by title as user types. Shows clear button when query is not empty.
 * Integrated into sidebar header with proper styling.
 */
export { default as ChatSidebarSearch } from './ChatSidebar/ChatSidebarSearch.svelte';