import { ImporterAdapter, ImportedMemory } from '@remnic/core'; /** * Message inside a Claude conversation. `sender` is either "human" or * "assistant"; older exports used `role` instead. */ interface ClaudeConversationMessage { uuid?: string; sender?: "human" | "assistant" | string; role?: "human" | "assistant" | string; /** Plain-text transcript of this message. */ text?: string; /** Newer exports expose structured content blocks. */ content?: Array<{ type?: string; text?: string; }>; created_at?: string; updated_at?: string; } interface ClaudeConversation { uuid?: string; name?: string; summary?: string; created_at?: string; updated_at?: string; chat_messages?: ClaudeConversationMessage[]; /** Some exports also expose `messages` alongside chat_messages. */ messages?: ClaudeConversationMessage[]; /** Associated project id, when the conversation lives inside a Project. */ project_uuid?: string; } interface ClaudeProjectDoc { uuid?: string; filename?: string; content?: string; created_at?: string; updated_at?: string; } interface ClaudeProject { uuid?: string; name?: string; description?: string; /** User-authored free-form instructions for the project. */ prompt_template?: string; docs?: ClaudeProjectDoc[]; created_at?: string; updated_at?: string; } /** * Unified parsed shape passed into `transform()`. */ interface ParsedClaudeExport { conversations: ClaudeConversation[]; projects: ClaudeProject[]; /** Source path the export came from (for provenance). */ filePath?: string; } interface ClaudeParseOptions { strict?: boolean; filePath?: string; } /** * Parse a raw Claude export payload. Accepts: * - a JSON string (`conversations.json`, `projects.json`, or a combined * bundle like `{conversations, projects}`) * - an already-parsed object or array. * * Returns the unified `ParsedClaudeExport`. Non-export payloads throw in * strict mode; otherwise the returned struct holds empty arrays so the * transform layer can no-op. */ declare function parseClaudeExport(input: unknown, options?: ClaudeParseOptions): ParsedClaudeExport; /** * Walk a conversation and return only human-authored user turns in * chronological order. Exported so the transform layer can build conversation * summaries from the same source of truth. */ declare function collectHumanTurnsFromConversation(conversation: ClaudeConversation): Array<{ content: string; createdAt?: string; }>; declare const adapter: ImporterAdapter; /** Alias kept for symmetry with other @remnic/import-* packages. */ declare const claudeAdapter: ImporterAdapter; declare const CLAUDE_SOURCE_LABEL = "claude"; interface ClaudeTransformOptions { /** When true, emit conversation-summary memories. */ includeConversations?: boolean; /** Optional cap on total memories emitted — primarily for tests. */ maxMemories?: number; /** Max characters for a conversation summary. */ maxConversationSummaryChars?: number; } /** * Transform a parsed Claude export into `ImportedMemory[]`. Project docs are * emitted first (in parse order), then project prompt templates, then * conversation summaries when opted in. */ declare function transformClaudeExport(parsed: ParsedClaudeExport, options?: ClaudeTransformOptions): ImportedMemory[]; export { CLAUDE_SOURCE_LABEL, type ClaudeConversation, type ClaudeConversationMessage, type ClaudeParseOptions, type ClaudeProject, type ClaudeProjectDoc, type ClaudeTransformOptions, type ParsedClaudeExport, adapter, claudeAdapter, collectHumanTurnsFromConversation, parseClaudeExport, transformClaudeExport };