/** * Project Mind MCP - Conversation Scraper Types * * Universal types for scraping conversations from any AI platform. * Designed to support Claude, GPT, and future sources. */ export type ScraperSource = 'claude' | 'chatgpt' | 'custom'; export interface ScraperAuth { /** Session cookies exported from browser */ cookies?: Cookie[]; /** Path to cookies JSON file */ cookiesFile?: string; /** Direct session token if available */ sessionToken?: string; } export interface Cookie { name: string; value: string; domain: string; path?: string; expires?: number; httpOnly?: boolean; secure?: boolean; sameSite?: 'Strict' | 'Lax' | 'None'; } export interface ScraperOptions { /** Authentication credentials */ auth: ScraperAuth; /** Output directory for exported files */ outputPath: string; /** Date filters */ dateFilter?: { after?: string; before?: string; }; /** Project filter (source-specific) */ projectFilter?: { include?: string[]; exclude?: string[]; includeGeneral?: boolean; }; /** Output format */ format?: 'json' | 'json-compressed' | 'split-by-project'; /** Checkpoint frequency (save every N conversations) */ checkpointFrequency?: number; /** Delay between requests in ms (be nice to servers) */ requestDelay?: number; /** Resume from previous checkpoint */ resume?: boolean; /** Maximum conversations to fetch (for testing) */ limit?: number; /** Show browser window (for debugging) */ headless?: boolean; } export interface ConversationArchive { /** Export metadata */ exportedAt: string; exportVersion: string; source: ScraperSource; sourceVersion?: string; /** Account info (anonymized if needed) */ account?: { id?: string; email?: string; }; /** Statistics */ stats: { totalConversations: number; totalMessages: number; dateRange: { earliest: string; latest: string; }; byProject?: Record; }; /** The conversations */ conversations: Conversation[]; } export interface Conversation { /** Unique identifier from source */ id: string; /** Source platform */ source: ScraperSource; /** Conversation title */ title: string; /** Timestamps */ createdAt: string; updatedAt: string; /** Project association (if any) */ project?: { id: string; name: string; }; /** Conversation metadata */ metadata?: { model?: string; tags?: string[]; starred?: boolean; archived?: boolean; [key: string]: unknown; }; /** Message count */ messageCount: number; /** The actual messages */ messages: Message[]; } export interface Message { /** Unique identifier */ id: string; /** Role */ role: 'user' | 'assistant' | 'system' | 'tool'; /** Message content (may contain markdown, code blocks, etc.) */ content: string; /** Timestamp if available */ timestamp?: string; /** Model used (for assistant messages) */ model?: string; /** Attachments (files, images) */ attachments?: Attachment[]; /** Artifacts (Claude-specific) */ artifacts?: Artifact[]; /** Tool calls (if any) */ toolCalls?: ToolCall[]; } export interface Attachment { id: string; type: 'file' | 'image' | 'document'; name: string; mimeType?: string; size?: number; /** URL or base64 content */ url?: string; content?: string; } export interface Artifact { id: string; type: string; title?: string; language?: string; content: string; } export interface ToolCall { id: string; name: string; input: Record; output?: unknown; } export interface ConversationScraper { /** Source identifier */ readonly source: ScraperSource; /** Human-readable name */ readonly name: string; /** Initialize the scraper (launch browser, authenticate) */ initialize(options: ScraperOptions): Promise; /** Test authentication */ testAuth(): Promise<{ success: boolean; error?: string; account?: string; }>; /** Get list of conversations (metadata only, for preview) */ listConversations(options?: { dateFilter?: ScraperOptions['dateFilter']; projectFilter?: ScraperOptions['projectFilter']; limit?: number; }): Promise; /** Extract full conversation content */ extractConversation(conversationId: string): Promise; /** Extract all conversations with progress callback */ extractAll(onProgress: (progress: ExtractionProgress) => void, onCheckpoint: (checkpoint: ExtractionCheckpoint) => void): Promise; /** Resume from checkpoint */ resumeExtraction(checkpoint: ExtractionCheckpoint, onProgress: (progress: ExtractionProgress) => void, onCheckpoint: (checkpoint: ExtractionCheckpoint) => void): Promise; /** Cleanup (close browser, etc.) */ close(): Promise; } export interface ConversationPreview { id: string; title: string; createdAt: string; updatedAt: string; messageCount?: number; project?: { id: string; name: string; }; } export interface ExtractionProgress { phase: 'listing' | 'extracting' | 'saving'; current: number; total: number; currentConversation?: string; messagesExtracted?: number; estimatedTimeRemaining?: number; } export interface ExtractionCheckpoint { source: ScraperSource; startedAt: string; lastUpdated: string; options: ScraperOptions; /** Conversations fully extracted */ completedIds: string[]; /** Conversation list (if already fetched) */ conversationList?: ConversationPreview[]; /** Partial results */ extractedConversations: Conversation[]; } //# sourceMappingURL=types.d.ts.map