import type { ProviderMessage, ContentPart } from '../providers/interface.js'; import type { ToolCall, ToolResult } from '../types/tools.js'; import type { ProviderRegistry } from '../providers/registry.js'; import type { CompactionContext } from './context-compaction.js'; import type { CompactionReceipt } from './compaction-types.js'; import type { SessionMemoryStore } from './session-memory.js'; import type { SessionLineageTracker } from './session-lineage.js'; export type TokenUsage = { inputTokens: number; outputTokens: number; cacheReadTokens?: number | undefined; cacheWriteTokens?: number | undefined; }; type AssistantMessage = { role: 'assistant'; content: string; toolCalls?: ToolCall[] | undefined; reasoningContent?: string | undefined; reasoningSummary?: string | undefined; usage?: TokenUsage | undefined; model?: string | undefined; provider?: string | undefined; }; export type ConversationMessageSnapshot = { role: 'user'; content: string | ContentPart[]; cancelled?: boolean; } | AssistantMessage | { role: 'system'; content: string; } | { role: 'tool'; callId: string; content: string; toolName?: string; }; type Message = ConversationMessageSnapshot; export type ConversationTitleSource = 'system' | 'user'; export interface BlockMeta { type: 'tool' | 'code' | 'diff' | 'thinking'; rawContent: string; filePath?: string | undefined; diffOriginal?: string | undefined; diffUpdated?: string | undefined; } export declare class ConversationManager { private messages; private _title; private _titleSource; private sessionMemoryStore; private sessionLineageTracker; private branches; private currentBranch; private streamingMessageIndex; private undoStack; private _messagesRevision; private _cachedLLMMessages; private _cachedLLMRevision; constructor(); private findToolName; setSessionMemoryStore(store: Pick): void; getSessionMemoryStore(): Pick | null; setSessionLineageTracker(tracker: Pick): void; getSessionLineageTracker(): Pick; /** * Returns the conversation messages formatted for the LLM provider. * * @returns readonly reference, do not mutate; the array is shared across * cache-hit callers until the next conversation mutation. */ getMessagesForLLM(): ProviderMessage[]; addUserMessage(content: string | ContentPart[]): void; addAssistantMessage(content: string, opts?: { toolCalls?: ToolCall[] | undefined; reasoningContent?: string | undefined; reasoningSummary?: string | undefined; usage?: TokenUsage | undefined; model?: string | undefined; provider?: string | undefined; }): void; /** * undo - Remove the last complete turn (the last user message and all subsequent * non-user messages). Pushes the removed messages onto the undo stack. * Returns true if a turn was removed, false if there was nothing to undo. */ undo(): boolean; /** * redo - Restore the most recently undone turn. * Returns true if a turn was restored, false if the undo stack is empty. */ redo(): boolean; addToolResults(results: ToolResult[]): void; addSystemMessage(content: string): void; getLastUserMessage(): string | null; getMessageCount(): number; removeMessagesAfter(count: number): void; markLastUserMessageCancelled(): void; startStreamingBlock(): void; updateStreamingBlock(content: string): void; finalizeStreamingBlock(): void; getMessageSnapshot(): ConversationMessageSnapshot[]; getTranscriptEventIndex(): { events: import("./transcript-events/types.js").TranscriptEvent[]; groups: import("./transcript-events/grouping.js").TranscriptEventGroup[]; }; replaceMessagesForLLM(newMessages: ProviderMessage[]): void; compact(registry: ProviderRegistry, modelId: string, trigger?: 'auto' | 'manual', provider?: string, context?: CompactionContext): Promise; get title(): string; set title(value: string); getTitleSource(): ConversationTitleSource; setSystemTitle(value: string): void; resetAll(): void; forkBranch(name?: string, force?: boolean): string; listBranches(): Array<{ name: string; messageCount: number; isCurrent: boolean; }>; switchBranch(name: string): boolean; mergeBranch(name: string): boolean; getCurrentBranch(): string; toJSON(): object; fromJSON(data: { messages: Message[]; branches?: Record | undefined; currentBranch?: string | undefined; title?: string | undefined; titleSource?: ConversationTitleSource | undefined; }): void; } export { parseDiffForApply, applyDiffContent } from './conversation-diff.js'; //# sourceMappingURL=conversation.d.ts.map