/**
 * Knowledge graph query interface — high-level API over the typed memory schema.
 *
 * Exposes five operations as both TypeScript functions and agent tool definitions:
 *   remember       — create/upsert a typed memory object
 *   recall_entity  — find an entity by name (exact or fuzzy label match)
 *   find_related   — one-hop relationship traversal
 *   forget         — delete a memory object
 *   search_facts   — FTS5 full-text search over labels
 *
 * Gracefully degrades when the DB is not initialised (returns null / empty arrays).
 *
 * @module
 */
import type { AnyAgentTool } from "../agents/tools/common.js";
import type { MemoryObject, MemoryRelationship, ObjectType, RelType } from "./typed-schema.js";
export type { MemoryObject, MemoryRelationship, ObjectType, RelType };
/**
 * Create (or replace) a typed memory object.
 * Returns the generated ID.
 */
export declare function remember(params: {
    label: string;
    type: ObjectType;
    data?: Record<string, unknown>;
    ttl?: number | null;
}): string;
/**
 * Find an entity by label — exact match first, then fuzzy FTS5.
 * Returns null if not found or DB not ready.
 */
export declare function recallEntity(name: string): MemoryObject | null;
/**
 * Find all objects related to the given entity ID.
 * Optionally filter by relationship type.
 * Returns empty array if DB not ready or entity not found.
 */
export declare function findRelated(entityId: string, relType?: RelType): MemoryObject[];
/**
 * Delete a memory object by ID.
 * Cascades to its relationships.
 */
export declare function forget(id: string): void;
/**
 * Full-text search over fact labels.
 * Returns matching Fact objects sorted by relevance.
 */
export declare function searchFacts(query: string): MemoryObject[];
/**
 * Update a memory object's label and/or data by ID.
 * Data is shallow-merged with existing data (update individual fields without losing others).
 * Returns the updated object, or null if not found.
 */
export declare function updateEntity(id: string, updates: {
    label?: string;
    data?: Record<string, unknown>;
}): MemoryObject | null;
/**
 * Link two objects with a typed relationship.
 * No-op if DB is not ready.
 */
export declare function linkObjects(fromId: string, toId: string, relType: RelType, weight?: number): void;
/**
 * Get all objects of a given type.
 */
export declare function listByType(type: ObjectType): MemoryObject[];
/**
 * Get a single object by ID.
 */
export declare function getMemoryObject(id: string): MemoryObject | null;
/**
 * Per-agent knowledge graph session.
 * Each agent gets its own isolated SQLite DB at {stateDir}/agents/{agentId}/KG/kg.sqlite.
 */
export declare class KnowledgeGraphSession {
    private readonly db;
    constructor(db: any);
    /** Open a session for the given DB file path (creates if absent). */
    static open(dbPath: string): KnowledgeGraphSession;
    /** Open a session for a named agent, using the configured state directory. */
    static forAgent(agentId: string): KnowledgeGraphSession;
    remember(params: {
        label: string;
        type: ObjectType;
        data?: Record<string, unknown>;
        ttl?: number | null;
    }): string;
    recallEntity(name: string): MemoryObject | null;
    findRelated(entityId: string, relType?: RelType): MemoryObject[];
    forget(id: string): void;
    updateEntity(id: string, updates: {
        label?: string;
        data?: Record<string, unknown>;
    }): MemoryObject | null;
    searchFacts(query: string): MemoryObject[];
    linkObjects(fromId: string, toId: string, relType: RelType, weight?: number): void;
    listByType(type: ObjectType): MemoryObject[];
    listAll(): MemoryObject[];
    listAllRelationships(): MemoryRelationship[];
    getMemoryObject(id: string): MemoryObject | null;
}
/**
 * Create the set of knowledge graph agent tools.
 * When a `session` is provided, all operations use the session's isolated DB.
 * When omitted, falls back to the module-level singleton (CLI / legacy path).
 */
export declare function createKnowledgeGraphTools(session?: KnowledgeGraphSession): AnyAgentTool[];
