import { EventEmitter } from "events";
import { CodeBuddyMessage } from "../codebuddy/client.js";
/** Metadata for conversation branches */
export interface BranchMetadata {
    description?: string;
    tags?: string[];
    model?: string;
    temperature?: number;
    tokenCount?: number;
    costEstimate?: number;
    [key: string]: string | string[] | number | boolean | undefined;
}
export interface ConversationBranch {
    id: string;
    name: string;
    parentId?: string;
    parentMessageIndex?: number;
    messages: CodeBuddyMessage[];
    createdAt: Date;
    updatedAt: Date;
    metadata?: BranchMetadata;
}
export interface BranchTree {
    branch: ConversationBranch;
    children: BranchTree[];
}
/**
 * Conversation Branch Manager - Fork and merge conversation histories
 */
export declare class ConversationBranchManager extends EventEmitter {
    private branches;
    private currentBranchId;
    private storagePath;
    constructor(sessionId?: string);
    private generateId;
    private loadBranches;
    private saveBranch;
    private deleteBranchFile;
    /**
     * Create a new branch
     */
    createBranch(id: string, name: string, parentId?: string, parentMessageIndex?: number): ConversationBranch;
    /**
     * Fork from current branch at current position
     */
    fork(name: string): ConversationBranch;
    /**
     * Fork from a specific message
     */
    forkFromMessage(name: string, messageIndex: number): ConversationBranch;
    /**
     * Switch to a branch
     */
    checkout(branchId: string): ConversationBranch | null;
    /**
     * Get current branch
     */
    getCurrentBranch(): ConversationBranch;
    /**
     * Get current branch ID
     */
    getCurrentBranchId(): string;
    /**
     * Get messages from current branch
     */
    getMessages(): CodeBuddyMessage[];
    /**
     * Add message to current branch
     */
    addMessage(message: CodeBuddyMessage): void;
    /**
     * Set messages for current branch
     */
    setMessages(messages: CodeBuddyMessage[]): void;
    /**
     * Merge a branch into current branch
     */
    merge(sourceBranchId: string, strategy?: "append" | "replace"): boolean;
    private findCommonAncestor;
    /**
     * Delete a branch
     */
    deleteBranch(branchId: string): boolean;
    /**
     * Rename a branch
     */
    renameBranch(branchId: string, newName: string): boolean;
    /**
     * Get all branches
     */
    getAllBranches(): ConversationBranch[];
    /**
     * Get branch tree
     */
    getBranchTree(): BranchTree[];
    /**
     * Get branch history (ancestors)
     */
    getBranchHistory(branchId: string): ConversationBranch[];
    /**
     * Format branches for display
     */
    formatBranches(): string;
    /**
     * Format branch tree for display
     */
    formatBranchTree(): string;
}
export declare function getBranchManager(sessionId?: string): ConversationBranchManager;
export declare function resetBranchManager(): void;
