/** * Attachment Manager * * Manages external file storage for image attachments with content-hash * based deduplication. Images are stored in .smartergpt/lex/attachments/ * with SHA256 hash filenames. * * This is part of AX-011 to reduce context bloat by storing images * externally and returning references instead of base64 inline data. */ /** * Attachment reference returned by storage operations */ export interface AttachmentRef { /** Attachment reference ID (att_) */ ref: string; /** MIME type of the attachment */ mime_type: string; /** Size in bytes */ size_bytes: number; /** Relative path from workspace root */ path: string; } /** * Attachment Manager - handles external file storage for attachments */ export declare class AttachmentManager { private attachmentsDir; /** * Create a new AttachmentManager * @param workspaceRoot - Workspace root directory (defaults to cwd) */ constructor(workspaceRoot?: string); /** * Store an attachment and return its reference * @param data - File data as Buffer * @param mimeType - MIME type of the attachment * @returns Attachment reference */ storeAttachment(data: Buffer, mimeType: string): AttachmentRef; /** * Get attachment data by reference * @param ref - Attachment reference (att_) * @param format - Return format (base64 or path) * @returns Attachment data or path */ getAttachment(ref: string, format?: "base64" | "path"): string | null; /** * Get attachment metadata by reference * @param ref - Attachment reference (att_) * @returns Attachment reference metadata or null */ getAttachmentRef(ref: string): AttachmentRef | null; /** * Find files matching a hash prefix * @param prefix - Hash prefix to search for * @returns Array of matching filenames */ private findFilesByPrefix; /** * Get file extension from MIME type * @param mimeType - MIME type * @returns File extension (including dot) */ private getExtensionFromMimeType; /** * Get MIME type from file extension * @param ext - File extension (including dot) * @returns MIME type */ private getMimeTypeFromExtension; }