/**
 * MemoryAttachmentStore — persistent attachment storage for long-term memory.
 *
 * Files live beside the memory DB, with no expiry:
 *   ~/.qlogicagent/profiles/<owner>/memory/attachments/<id><ext>
 * The DB (`memory_attachments` table, via LocalMemoryStore) is the index;
 * this class owns the on-disk bytes + ties index rows to files.
 *
 * Lifecycle: an attachment is `adopt`ed at upload time (orphan, memory_id=''),
 * then `link`ed to a memory at commit; on memory delete the files+rows are
 * removed; long-orphaned uploads are purged.
 */
import type { LocalMemoryStore, MemoryAttachmentRef, MemoryAttachmentRow } from "./local-store.js";
export declare const MAX_ATTACHMENT_BYTES: number;
export type AttachmentKind = "image" | "audio" | "video" | "doc" | "file";
export declare function attachmentKindFromMime(mimeType: string, filename?: string): AttachmentKind;
export interface AdoptedAttachment {
    id: string;
    kind: AttachmentKind;
    filename: string;
    mimeType: string;
    size: number;
    url: string;
}
export interface AdoptInput {
    /** Raw bytes (preferred). */
    data?: Buffer;
    /** Or a URL the store fetches (e.g. the gateway's temp MediaStore url). */
    sourceUrl?: string;
    filename: string;
    mimeType: string;
    userId: string;
}
export declare class MemoryAttachmentStore {
    private readonly store;
    private readonly dir;
    constructor(store: LocalMemoryStore, dir: string);
    urlFor(id: string): string;
    toRef(row: MemoryAttachmentRow): MemoryAttachmentRef;
    /** Persist an uploaded file + create an orphan index row (memory_id=''). */
    adopt(input: AdoptInput): Promise<AdoptedAttachment>;
    /** Read an attachment's bytes + mime (for multimodal understanding). */
    readBytes(id: string): Promise<{
        bytes: Buffer;
        mimeType: string;
    } | null>;
    /** Resolve an attachment to an absolute on-disk path (for serving). Guards traversal. */
    locate(id: string): Promise<{
        absPath: string;
        mimeType: string;
        filename: string;
    } | null>;
    link(memoryId: string, attachmentIds: string[], userId: string): number;
    setExtractedText(id: string, text: string): void;
    refsForMemory(memoryId: string): MemoryAttachmentRef[];
    /** Map of memoryId → refs, for atlas windows. */
    refsForMemories(memoryIds: string[]): Map<string, MemoryAttachmentRef[]>;
    /** Remove all files + index rows for a deleted memory. */
    removeByMemoryId(memoryId: string): Promise<void>;
    /** Purge uploads that were never linked to a saved memory. */
    purgeOrphans(olderThanMs?: number): Promise<void>;
}
