import { type MemorySettings, type MemoryStatus } from "./memory-config.js";
import type { RunManifest } from "../contracts/run.js";
export interface MemorySearchResult {
    path: string;
    content: string;
    sessionId: string;
    updatedAt: string;
    source: string;
}
export interface MemoryOntology {
    version: string;
    classes: string[];
    relationTypes: string[];
    description: string;
}
export interface MemoryMindmapNode {
    id: string;
    type: string;
    label: string;
    path?: string;
    summary?: string;
    children: MemoryMindmapNode[];
}
export interface MemoryMindmap {
    root: MemoryMindmapNode;
    nodes: Array<Omit<MemoryMindmapNode, "children">>;
    edges: Array<{
        from: string;
        to: string;
        type: string;
        label?: string;
    }>;
    ontology: MemoryOntology;
}
export interface GraphQueryResult {
    data: unknown;
    extensions: {
        dialect: "omk-graphql-lite-v1" | "cypher";
        backend: "local_graph" | "kuzu";
        statePath?: string;
        database?: string;
    };
}
export interface LocalGraphMemoryStoreOptions {
    projectRoot?: string;
    sessionId?: string;
    source?: string;
    env?: NodeJS.ProcessEnv;
}
type Primitive = string | number | boolean | null;
type Properties = Record<string, Primitive>;
interface LocalGraphNode {
    id: string;
    type: string;
    labels: string[];
    label: string;
    path?: string;
    content?: string;
    summary?: string;
    tags: string[];
    properties: Properties;
    createdAt: string;
    updatedAt: string;
}
interface LocalGraphEdge {
    id: string;
    type: string;
    from: string;
    to: string;
    label?: string;
    weight?: number;
    properties: Properties;
    createdAt: string;
    updatedAt: string;
}
export interface LocalGraphState {
    version: 1;
    ontology: MemoryOntology;
    project: {
        key: string;
        name: string;
        root: string;
    };
    updatedAt: string;
    nodes: LocalGraphNode[];
    edges: LocalGraphEdge[];
}
export type GraphState = LocalGraphState;
export interface ExtractedConcept {
    type: string;
    label: string;
    summary: string;
    parentIndex?: number;
    relation: string;
    tags: string[];
    line: number;
    level?: number;
    filePaths: string[];
}
export declare const ONTOLOGY: MemoryOntology;
export declare class LocalGraphMemoryStore {
    private readonly settings;
    private readonly source;
    constructor(settings: MemorySettings, source?: string);
    static create(options?: LocalGraphMemoryStoreOptions): Promise<LocalGraphMemoryStore | null>;
    get status(): MemoryStatus;
    get strict(): boolean;
    get mirrorFiles(): boolean;
    get migrateFiles(): boolean;
    read(path: string): Promise<string>;
    write(path: string, content: string): Promise<void>;
    private applyMemoryWrite;
    writeMirrorFiles(state: LocalGraphState): Promise<void>;
    append(path: string, content: string): Promise<void>;
    search(query: string, limit?: number): Promise<MemorySearchResult[]>;
    ontology(): Promise<MemoryOntology>;
    mindmap(query?: string, limit?: number): Promise<MemoryMindmap>;
    /**
     * Idempotent finalizer that links a finalized run manifest into the local
     * graph. Emits run -> providerRoute -> provider, run -> evidence,
     * run -> decision, and run -> artifact nodes/edges.
     *
     * Privacy: only ids, status, paths, sha256, and aggregate counts are stored.
     * Raw evidence/decision message bodies and secrets are never persisted.
     *
     * Idempotency: node/edge ids are deterministic and prior run-generated
     * nodes/edges (tagged `generatedFromRun`) are pruned before re-inserting, so
     * re-running with the same (or a changed) manifest never duplicates state.
     */
    linkRun(runId: string, manifest: RunManifest): Promise<void>;
    private applyRunManifest;
    graphQuery(query: string): Promise<GraphQueryResult>;
    private loadState;
    private emptyState;
    private saveState;
    private handleInvalidState;
    private writeInvalidStateRepair;
    private mutateState;
    private readFromState;
    private findLatestMemoryVersionNode;
    private findMemoryNode;
    private replaceGeneratedMindmap;
    private expandNeighborhood;
    private buildMindmapTree;
    private isMindmapForward;
    private toMindmapFlatNode;
    private defaultRootNode;
    private upsertNode;
    private upsertEdge;
    private memoryNodeId;
    private memoryKey;
    private nodeId;
    private edgeId;
}
export declare function extractConcepts(content: string): ExtractedConcept[];
export {};
