/** * @license * Copyright 2023 Nuraly, Laabidi Aymen * SPDX-License-Identifier: MIT */ /** * Message sender types */ export declare enum ChatbotSender { User = "user", Bot = "bot", System = "system" } /** * Chatbot loading indicator types */ export declare enum ChatbotLoadingType { Dots = "dots", Spinner = "spinner", Wave = "wave", Typing = "typing" } /** * Chatbot size variants */ export declare enum ChatbotSize { Small = "small", Medium = "medium", Large = "large", Full = "full" } /** * Chatbot visual themes */ export declare enum ChatbotVariant { Default = "default", Minimal = "minimal", Rounded = "rounded", ChatGPT = "chatgpt" } /** * Chatbot message state */ export declare enum ChatbotMessageState { Default = "default", Error = "error", Success = "success", Loading = "loading", Pending = "pending" } /** * File upload types */ export declare enum ChatbotFileType { Image = "image", Document = "document", Audio = "audio", Video = "video", Archive = "archive", Code = "code", Unknown = "unknown" } /** * Action button types */ export declare enum ChatbotActionType { Upload = "upload", Clear = "clear", Export = "export", Settings = "settings", Microphone = "microphone", Camera = "camera", Attach = "attach" } /** * Interface for file attachments */ export interface ChatbotFile { id: string; name: string; size: number; type: ChatbotFileType; mimeType: string; url?: string; previewUrl?: string; uploadProgress?: number; isUploading?: boolean; error?: string; metadata?: Record; } /** * Interface for chatbot messages */ export interface ChatbotMessage { id: string; sender: ChatbotSender; text: string; timestamp: string; error?: boolean; introduction?: boolean; state?: ChatbotMessageState; files?: ChatbotFile[]; suggestions?: ChatbotSuggestion[]; metadata?: Record; parentId?: string; reactions?: string[]; /** * Host-supplied structured artifacts persisted alongside the message text. * During fence extraction these rows are authoritative for `metadata` and * `title`, so a diff view survives conversation reload without any * consumer-side rehydration. See {@link ChatbotMessageArtifact}. */ artifacts?: ChatbotMessageArtifact[]; } /** * A structured artifact row on a message envelope. A backend can persist this * next to the legacy fenced code block: the fence stays a positional hint for * the inline card, while `metadata`/`title` here are authoritative. * * Precedence during extraction: `message.artifacts[].metadata` > metadata from * a host `addArtifact()` call > `{}`. Fence extraction never clears metadata it * did not set itself. */ export interface ChatbotMessageArtifact { /** Stable id; lets host rows and fence/addArtifact entries converge by id. */ id?: string; language: ArtifactLanguage | string; content: string; title?: string; metadata?: ChatbotArtifactMetadata; } /** * Interface for chatbot suggestions */ export interface ChatbotSuggestion { id: string; text: string; enabled?: boolean; icon?: string; description?: string; metadata?: Record; } /** * Interface for action buttons */ export interface ChatbotAction { id: string; type: ChatbotActionType; label: string; icon: string; enabled?: boolean; tooltip?: string; handler: () => void; metadata?: Record; } /** * Interface for chatbot configuration */ export interface ChatbotConfig { apiEndpoint?: string; maxMessages?: number; maxFileSize?: number; allowedFileTypes?: string[]; maxFiles?: number; enableSuggestions?: boolean; enableRetry?: boolean; enableClear?: boolean; enableFileUpload?: boolean; enableVoiceInput?: boolean; enableCamera?: boolean; autoScroll?: boolean; typingIndicatorDelay?: number; showTimestamps?: boolean; showMessageStatus?: boolean; enableMarkdown?: boolean; enableCodeHighlighting?: boolean; enableEmojis?: boolean; placeholder?: string; theme?: 'carbon-light' | 'carbon-dark' | 'default-light' | 'default-dark'; } /** * Interface for chatbot validation rules */ export interface ChatbotValidationRule { id: string; validator: (message: string, files?: ChatbotFile[]) => boolean | Promise; errorMessage: string; warningMessage?: string; } /** * Interface for chatbot events */ export interface ChatbotEventDetail { message?: ChatbotMessage; suggestion?: ChatbotSuggestion; file?: ChatbotFile; files?: ChatbotFile[]; action?: ChatbotAction; error?: Error; metadata?: Record; } /** * Interface for file upload progress */ export interface ChatbotUploadProgress { fileId: string; progress: number; status: 'uploading' | 'completed' | 'error'; error?: string; } /** * Interface for conversation thread */ export interface ChatbotThread { id: string; title: string; messages: ChatbotMessage[]; messagesLoaded?: boolean; createdAt: string; updatedAt: string; bookmarked?: boolean; metadata?: Record; } /** * Interface for module selection item */ export interface ChatbotModule { id: string; name: string; description?: string; icon?: string; enabled?: boolean; metadata?: Record; } /** * Common artifact language types */ export type ArtifactLanguage = 'javascript' | 'typescript' | 'python' | 'java' | 'go' | 'rust' | 'c' | 'cpp' | 'csharp' | 'ruby' | 'php' | 'swift' | 'kotlin' | 'html' | 'css' | 'scss' | 'sql' | 'graphql' | 'json' | 'yaml' | 'xml' | 'toml' | 'markdown' | 'md' | 'bash' | 'shell' | 'sh' | 'zsh' | 'dockerfile' | 'makefile' | 'text' | (string & Record); /** * Optional, opaque-to-the-renderer metadata a consumer can attach to an * artifact. When `previousContent` is present the artifact panel offers a * JSON / Diff tab toggle; the consumer ships data, lumenui owns the render. */ export interface ChatbotArtifactMetadata { /** Pre-edit content (same language as `content`). Enables the Diff tab. */ previousContent?: string; /** Opaque patch object (RFC 6902 ops array, unified-diff text, etc.). Shown in a Patch tab. */ patch?: unknown; /** Hint that this artifact replaces an earlier version. Defaults to `!!previousContent`. */ isEdit?: boolean; /** Routes to a custom renderer. Defaults to `language`. */ kind?: string; /** Per-artifact diff canonicalization: 'json' key-sorts both sides before diffing. */ canonicalize?: 'json' | 'none'; [key: string]: unknown; } /** * Interface for extracted code artifacts */ export interface ChatbotArtifact { /** Unique artifact identifier */ id: string; /** Programming language (from fenced code block) */ language: ArtifactLanguage; /** Raw code content */ content: string; /** Display title (extracted from first comment line or generated) */ title: string; /** ID of the message this artifact belongs to */ messageId: string; /** Index of this artifact within its message (0-based) */ index: number; /** Optional consumer-supplied metadata (previous content, patch, edit hint). */ metadata?: ChatbotArtifactMetadata; } /** * Audio recording state (used by ChatbotAudioController) */ export interface ChatbotAudioRecordingState { active: boolean; duration: string; bars: number[]; } /** * Customizable UI strings. Pass a partial object via the * chatbot's `i18n` property to override any of the defaults. * Defaults come from `@lit/localize`, so translation files keep working. */ export interface ChatbotI18nInput { placeholder: string; chatInputAriaLabel: string; attachButton: string; attachFilesAriaLabel: string; removeFileLabel: string; uploadingLabel: string; uploadingProgress: string; dropFilesHere: string; fileTypeNotAllowed: string; fileTooLarge: string; dismissFileError: string; } export interface ChatbotI18nSend { sendButton: string; stopButton: string; sendMessageLabel: string; stopQueryLabel: string; } export interface ChatbotI18nAudio { recordSpeechLabel: string; sendVoiceMessageLabel: string; cancelRecordingLabel: string; speechToTextLabel: string; voiceMessageLabel: string; convertToTextLabel: string; sendAsVoiceMessageLabel: string; } export interface ChatbotI18nModules { moduleSelectionLabel: string; moduleSearchPlaceholder: string; moduleSelectAriaLabel: string; modulesSelectedSuffix: string; } export interface ChatbotI18nThreads { conversationsTitle: string; bookmarksLabel: string; allConversationsLabel: string; noConversationsLabel: string; newChatTitle: string; newConversationLabel: string; removeBookmarkLabel: string; bookmarkLabel: string; renameLabel: string; deleteLabel: string; moreOptionsLabel: string; showThreadsLabel: string; hideThreadsLabel: string; } export interface ChatbotI18nMessages { attachedFilesLabel: string; copyMessageLabel: string; retryMessageLabel: string; retryButton: string; startConversationLabel: string; suggestionPrefix: string; loadingConversationLabel: string; showMoreLabel: string; showLessLabel: string; } export interface ChatbotI18nUrlModal { addUrlTitle: string; urlLabel: string; urlPlaceholder: string; loadFromUrlLabel: string; selectedFileLabel: string; loadingFromUrlLabel: string; cancelButton: string; addButton: string; } export interface ChatbotI18nArtifactPanel { copyCodeLabel: string; closePanelLabel: string; } export interface ChatbotI18nLoading { agentWorkingLabel: string; } export interface ChatbotI18n { input: ChatbotI18nInput; send: ChatbotI18nSend; audio: ChatbotI18nAudio; modules: ChatbotI18nModules; threads: ChatbotI18nThreads; messages: ChatbotI18nMessages; urlModal: ChatbotI18nUrlModal; artifactPanel: ChatbotI18nArtifactPanel; loading: ChatbotI18nLoading; } /** * Partial override shape for the chatbot's `i18n` property. * Each section is optional, and within each section each key is optional. */ export type ChatbotI18nOverrides = { [K in keyof ChatbotI18n]?: Partial; }; /** * Constants */ export declare const EMPTY_STRING = ""; export declare const DEFAULT_TYPING_DELAY = 1000; export declare const DEFAULT_MAX_MESSAGES = 100; export declare const DEFAULT_MAX_FILE_SIZE: number; export declare const DEFAULT_MAX_FILES = 5; /** * Default allowed file types */ export declare const DEFAULT_ALLOWED_FILE_TYPES: string[]; /** * File type mappings */ export declare const FILE_TYPE_MAPPINGS: Record; //# sourceMappingURL=chatbot.types.d.ts.map