export declare const SESSION_SOURCES: readonly ["claude", "codex", "codewith", "gemini"]; export type SessionSource = (typeof SESSION_SOURCES)[number]; export declare function isSessionSource(value: string): value is SessionSource; export declare const MESSAGE_ROLES: readonly ["user", "assistant", "system", "tool", "info", "thinking"]; export type MessageRole = (typeof MESSAGE_ROLES)[number]; export declare const TOOL_CALL_STATUSES: readonly ["success", "error", "timeout"]; export type ToolCallStatus = (typeof TOOL_CALL_STATUSES)[number]; export declare const SESSION_OBJECT_KINDS: readonly ["normalized_content"]; export type SessionObjectKind = (typeof SESSION_OBJECT_KINDS)[number]; export declare const SESSION_OBJECT_STATUSES: readonly ["pending", "uploaded", "failed"]; export type SessionObjectStatus = (typeof SESSION_OBJECT_STATUSES)[number]; export interface Session { id: string; source: SessionSource; source_id: string; source_path: string | null; title: string | null; project_path: string | null; project_name: string | null; model: string | null; model_provider: string | null; git_branch: string | null; git_sha: string | null; git_origin_url: string | null; cli_version: string | null; is_subagent: boolean; parent_session_id: string | null; total_input_tokens: number; total_output_tokens: number; total_cache_read_tokens: number; total_cache_write_tokens: number; total_thinking_tokens: number; message_count: number; tool_call_count: number; started_at: string | null; ended_at: string | null; duration_seconds: number | null; ingested_at: string; updated_at: string; source_modified_at: string | null; machine: string | null; metadata: Record; } export interface SessionLookupOptions { /** * Resolve the identifier as a provider-native source id or source-id prefix * within this source. Source-qualified identifiers such as `codewith:` * are normalized to this shape by lookup implementations. */ source?: SessionSource | string; } export interface SessionInsert { id?: string; source: SessionSource; source_id: string; source_path?: string | null; title?: string | null; project_path?: string | null; project_name?: string | null; model?: string | null; model_provider?: string | null; git_branch?: string | null; git_sha?: string | null; git_origin_url?: string | null; cli_version?: string | null; is_subagent?: boolean; parent_session_id?: string | null; total_input_tokens?: number; total_output_tokens?: number; total_cache_read_tokens?: number; total_cache_write_tokens?: number; total_thinking_tokens?: number; message_count?: number; tool_call_count?: number; started_at?: string | null; ended_at?: string | null; duration_seconds?: number | null; source_modified_at?: string | null; machine?: string | null; metadata?: Record; } export interface Machine { name: string; hostname: string | null; platform: string | null; first_seen_at: string; last_seen_at: string; session_count: number; } export interface Message { id: string; session_id: string; source_id: string | null; parent_message_id: string | null; role: MessageRole; content: string | null; content_preview: string | null; model: string | null; is_sidechain: boolean; sequence_num: number | null; input_tokens: number; output_tokens: number; cache_read_tokens: number; cache_write_tokens: number; thinking_tokens: number; timestamp: string | null; metadata: Record; } export interface MessageInsert { id?: string; session_id: string; source_id?: string | null; parent_message_id?: string | null; role: MessageRole; content?: string | null; content_preview?: string | null; model?: string | null; is_sidechain?: boolean; sequence_num?: number | null; input_tokens?: number; output_tokens?: number; cache_read_tokens?: number; cache_write_tokens?: number; thinking_tokens?: number; timestamp?: string | null; metadata?: Record; } export interface ToolCall { id: string; message_id: string | null; session_id: string; tool_name: string; tool_input: string | null; tool_output: string | null; duration_ms: number | null; status: ToolCallStatus | null; timestamp: string | null; metadata: Record; } export interface ToolCallInsert { id?: string; message_id?: string | null; session_id: string; tool_name: string; tool_input?: string | null; tool_output?: string | null; duration_ms?: number | null; status?: ToolCallStatus | null; timestamp?: string | null; metadata?: Record; } export interface ParsedSession { session: SessionInsert; messages: MessageInsert[]; toolCalls: ToolCallInsert[]; } export interface StagedParsedSession { session: SessionInsert; messageCount: number; toolCallCount: number; totalInputTokens: number; totalOutputTokens: number; totalCacheReadTokens: number; totalCacheWriteTokens: number; totalThinkingTokens: number; /** Largest normalized record batch held by the parser while staging. */ maxNormalizedBatchRecords: number; forEachMessageBatch(batchSize: number, callback: (batch: MessageInsert[]) => void): void; forEachToolCallBatch(batchSize: number, callback: (batch: ToolCallInsert[]) => void): void; cleanup(): void; } export interface SessionContentBackup { /** Caller-created backup artifact path or URI, if available. */ artifact?: string | null; /** ISO timestamp when the caller created or verified the backup. */ created_at?: string | null; /** Human-readable backup note; do not include secrets. */ note?: string | null; } export interface SessionContentDestructiveIntent { /** * Allows an import payload to replace an existing session with fewer messages * or tool calls. Requires a non-empty reason. */ allowContentShrink: boolean; /** Human-readable reason for intentionally shrinking synced content. */ reason: string; } export interface SessionContentImport extends ParsedSession { /** * Caller-provided backup/export metadata. The server records only this * metadata in the response; callers own the actual SQLite-safe backup * artifact lifecycle. */ backup?: SessionContentBackup; /** * Explicit destructive intent for intentional content pruning. By default, * import refuses to replace existing cloud content with fewer child rows. */ destructive?: SessionContentDestructiveIntent; } export interface SessionObject { session_id: string; object_kind: SessionObjectKind; object_key: string; source_digest: string; size: number; status: SessionObjectStatus; last_error: string | null; created_at: string; updated_at: string; } export interface SessionObjectInsert { session_id: string; object_kind: SessionObjectKind; object_key: string; source_digest: string; size: number; } export declare class SessionNotFoundError extends Error { constructor(id: string); } export interface SessionLookupCandidate { id: string; source: string; source_id: string; } export declare class SessionAmbiguousError extends Error { readonly identifier: string; readonly candidates: SessionLookupCandidate[]; constructor(identifier: string, candidates: SessionLookupCandidate[]); } export declare class SessionInvalidIdentifierError extends Error { readonly identifier: string; readonly code = "session_invalid_identifier"; constructor(identifier: string, reason: string); } //# sourceMappingURL=index.d.ts.map