export type MemoryType = 'task_list' | 'recently_memory' | 'memory';
export interface MemoryRecord {
    id: string;
    uri: string;
    domain: string;
    path: string;
    content: string;
    memory_type: MemoryType;
    createdAt: string;
    updatedAt: string;
    version: number;
}
export interface CreateMemoryInput {
    memory_type: MemoryType;
    uri: string;
    content: string;
}
export interface UpdateMemoryInput {
    memory_type?: MemoryType;
    uri: string;
    old_string?: string;
    new_string?: string;
    append?: string;
}
export interface ReadMemoryInput {
    memory_type?: MemoryType;
    uri: string;
}
export interface DeleteMemoryInput {
    memory_type?: MemoryType;
    uri: string;
}
export interface SearchMemoryInput {
    query: string;
    limit?: number;
    memory_type?: MemoryType;
}
export interface MemoryCapacityErrorDetails {
    code: 'MEMORY_TYPE_LIMIT_REACHED' | 'MEMORY_LISTABLE_TOTAL_LIMIT_REACHED';
    memory_type: MemoryType;
    domain?: string;
    limit: number;
    current: number;
    recommended_actions: string[];
}
export declare class MemoryCapacityError extends Error {
    readonly details: MemoryCapacityErrorDetails;
    constructor(message: string, details: MemoryCapacityErrorDetails);
}
export interface MemoryTypeStats {
    count: number;
    limit: number | null;
    hardLimit: number | null;
    exceeded: boolean;
    hardExceeded: boolean;
    listable: boolean;
    domainCount: number;
    by_domain: Record<string, MemoryDomainStats>;
}
export interface MemoryDomainStats {
    count: number;
    limit: number | null;
    hardLimit: number | null;
    exceeded: boolean;
    hardExceeded: boolean;
}
export interface MemoryStats {
    total: number;
    listable: {
        count: number;
        limit: number;
        hardLimit: number;
        exceeded: boolean;
        hardExceeded: boolean;
    };
    by_type: Record<MemoryType, MemoryTypeStats>;
}
export interface MemoryStorePort {
    getStats(): Promise<MemoryStats>;
    createMemory(input: CreateMemoryInput): Promise<MemoryRecord>;
    readMemory(input: ReadMemoryInput): Promise<MemoryRecord | null>;
    updateMemory(input: UpdateMemoryInput): Promise<MemoryRecord>;
    deleteMemory(input: DeleteMemoryInput): Promise<boolean>;
    searchMemory(input: SearchMemoryInput): Promise<{
        query: string;
        results: MemoryRecord[];
    }>;
    listByType(memory_type: string): Promise<MemoryRecord[]>;
    removeTaskListMemory(uri: string): Promise<boolean>;
    archiveRecentlyMemory(uri: string): Promise<MemoryRecord>;
}
export declare class MemoryStore implements MemoryStorePort {
    private readonly storePath;
    constructor(storePath: string);
    private nowIso;
    private normalizeUri;
    private normalizeMemoryType;
    private ensureTypeMatch;
    /**
     * 确保存储目标目录存在。
     * 主流程：永久记忆始终按 domain 分文件，创建存储根目录。
     */
    private ensureStoreDir;
    /**
     * 读取单个记忆 JSON 文件。
     * 主流程：读取 by_uri -> 规范化 uri/type/domain/path -> 返回可合并数据。
     */
    private loadMemoryFile;
    /**
     * 读取记忆数据。
     * 主流程：读取根目录下所有 domain JSON 并合并。
     */
    private loadData;
    private writeJsonAtomically;
    /**
     * 保存记忆数据。
     * 主流程：按 domain 分组写入 <domain>.json 并移除空域旧文件。
     */
    private saveData;
    private createEmptyStats;
    /**
     * 统计本地记忆容量。
     * 主流程：遍历所有记录 -> 按类型计数 -> 单独汇总可 list 类型容量。
     */
    private calculateStats;
    private generateId;
    /**
     * 校验可列出记忆容量。
     * 主流程：仅限制 task_list/recently_memory 新建 -> 先校验该类型数量 -> 再校验可 list 总量。
     */
    private ensureListableMemoryCapacity;
    getStats(): Promise<MemoryStats>;
    createMemory(input: CreateMemoryInput): Promise<MemoryRecord>;
    readMemory(input: ReadMemoryInput): Promise<MemoryRecord | null>;
    updateMemory(input: UpdateMemoryInput): Promise<MemoryRecord>;
    deleteMemory(input: DeleteMemoryInput): Promise<boolean>;
    searchMemory(input: SearchMemoryInput): Promise<{
        query: string;
        results: MemoryRecord[];
    }>;
    listByType(memory_type: string): Promise<MemoryRecord[]>;
    removeTaskListMemory(uri: string): Promise<boolean>;
    archiveRecentlyMemory(uri: string): Promise<MemoryRecord>;
}
//# sourceMappingURL=memory-store.d.ts.map