/** * Message role types for conversation messages */ export type MessageRole = 'user' | 'assistant' | 'system' | 'error'; /** * Message content types */ export type MessageContentType = 'text' | 'image' | 'audio' | 'video' | 'file' | 'link'; /** * Message status types */ export type MessageStatus = 'pending' | 'sent' | 'delivered' | 'read' | 'failed'; /** * Message priority levels */ /** * Data sharing status types */ export type DataSharingStatus = 'pending' | 'shared' | 'failed'; /** * Data sharing record for tracking shared data with sites */ export interface DataSharingRecord { /** Unique identifier for the sharing record (UUID v7) */ id: string; /** Domain where data was shared */ domain: string; /** What data was shared (description) */ dataShared: string; /** Method used for sharing (detailed string, e.g., "email:user@example.com", "api:POST:/data", "localStorage:preferences") */ sharingMethod: string; /** Status of the sharing operation */ status: DataSharingStatus; /** Timestamp when data was shared */ sharedAt: string; /** User consent timestamp */ userConsentAt: string; /** Additional metadata about the sharing */ metadata?: Record; } /** * Message metadata for tracking and analytics */ export interface MessageMetadata { /** Unique identifier for the message */ id: string; /** Timestamp when the message was created */ createdAt: string; /** Timestamp when the message was last modified */ lastModified: string; /** Version of the message schema */ schemaVersion: string; /** Whether the message has been edited */ isEdited: boolean; } /** * Message content with type-specific data */ export interface MessageContent { /** Type of content */ type: MessageContentType; /** Text content (for text messages) */ text?: string; /** URL for media content */ url?: string; /** File name for file attachments */ fileName?: string; /** File size in bytes */ fileSize?: number; /** MIME type for file attachments */ mimeType?: string; /** Duration in seconds for audio/video content */ duration?: number; /** Thumbnail URL for media content */ thumbnailUrl?: string; /** Alt text for accessibility */ altText?: string; } /** * Message context and references */ export interface MessageContext { /** URL of the page where the message was sent */ pageUrl: string; /** Title of the page where the message was sent */ pageTitle: string; /** Domain where the message was sent */ domain: string; } /** * Message analytics (simplified for MVP) */ export interface MessageAnalytics { /** Time taken to generate the response in milliseconds */ responseTime?: number; } /** * Individual conversation message */ export interface ConversationMessage { /** Message metadata */ metadata: MessageMetadata; /** Role of the message sender */ role: MessageRole; /** Message content */ content: MessageContent; /** Message context */ context: MessageContext; /** Message status */ status: MessageStatus; /** Message analytics */ analytics: MessageAnalytics; /** Parent message ID (for replies) */ parentMessageId?: string; /** Child message IDs (for replies) */ childMessageIds: string[]; /** Tags for categorization */ tags: string[]; /** Custom data for extensibility */ customData?: Record; } /** * Domain-specific conversation storage (simplified for MVP) */ export interface DomainConversations { /** Domain name */ domain: string; /** Array of message IDs for this domain */ messageIds: string[]; /** Tags associated with this domain */ tags: string[]; /** Data sharing records for this domain */ dataSharingRecords: DataSharingRecord[]; }