/** * Frame storage queries * * CRUD operations and search functions for Frames. */ import Database from "better-sqlite3-multiple-ciphers"; import type { Frame } from "../frames/types.js"; /** * Save a Frame to the database (insert or update) */ export declare function saveFrame(db: Database.Database, frame: Frame): void; /** * Get a Frame by ID */ export declare function getFrameById(db: Database.Database, id: string): Frame | null; export interface SearchResult { frames: Frame[]; hint?: string; } export interface SearchOptions { exact?: boolean; mode?: "all" | "any"; } /** * Search Frames using FTS5 full-text search * @param query Natural language query string (searches reference_point, summary_caption, keywords) * @param options Search options (exact: disable fuzzy matching, mode: 'all' for AND / 'any' for OR) * @returns SearchResult with frames array and optional hint for FTS5 syntax errors */ export declare function searchFrames(db: Database.Database, query: string, options?: SearchOptions): SearchResult; /** * Get all Frames for a specific branch */ export declare function getFramesByBranch(db: Database.Database, branch: string): Frame[]; /** * Get all Frames for a specific Jira/ticket ID */ export declare function getFramesByJira(db: Database.Database, jiraId: string): Frame[]; /** * Get all Frames that touch a specific module * @param moduleId Module ID to search for in module_scope arrays */ export declare function getFramesByModuleScope(db: Database.Database, moduleId: string): Frame[]; /** * Get all Frames (with optional limit) */ export declare function getAllFrames(db: Database.Database, limit?: number): Frame[]; /** * Query options for exporting frames */ export interface ExportFramesOptions { since?: string; jira?: string; branch?: string; } /** * Get frames iterator for export with optional filters * Uses iterator for memory-efficient streaming of large result sets */ export declare function getFramesForExport(db: Database.Database, options?: ExportFramesOptions): IterableIterator; /** * Delete a Frame by ID */ export declare function deleteFrame(db: Database.Database, id: string): boolean; /** * Get count of all Frames */ export declare function getFrameCount(db: Database.Database): number; /** * Get Turn Cost metrics for a time period * Returns frame count and aggregated spend metrics */ export declare function getTurnCostMetrics(db: Database.Database, since?: string): { frameCount: number; estimatedTokens: number; prompts: number; }; /** * Database statistics for MCP db_stats tool */ export interface DbStatsResult { totalFrames: number; thisWeek: number; thisMonth: number; oldestDate: string | null; newestDate: string | null; moduleDistribution?: Record; } /** * Get database statistics for frame counts and date ranges * Used by MCP db_stats tool */ export declare function getDbStats(db: Database.Database, detailed?: boolean): DbStatsResult;