import type { Database as DatabaseType } from "better-sqlite3"; import { type Repositories } from "./repositories/index.js"; import { CompactionService, ProjectScanService, GitService, EventTriggerService, UpdateService, AgentRulesService, InstanceRegistryService, CrossInstanceService, SensitiveDataService, WorkflowAdvisorService, PMDiagnosticsTracker } from "./services/index.js"; export interface Services { compaction: CompactionService; scan: ProjectScanService; git: GitService; events: EventTriggerService; update: UpdateService; agentRules: AgentRulesService; registry: InstanceRegistryService; crossInstance: CrossInstanceService; sensitiveData: SensitiveDataService; advisor: WorkflowAdvisorService; diagnostics: PMDiagnosticsTracker; } export declare function initDatabase(projectRoot: string, ideKey?: string): DatabaseType; export declare function getDb(): DatabaseType; export declare function getRepos(): Repositories; export declare function getServices(): Services; export declare function getProjectRoot(): string; export declare function getDbPath(): string; /** * Re-initialize the database at a new project root. * * Used when the agent provides the correct project_root at session start * and the server originally resolved to the wrong location (e.g. the * global fallback because the IDE spawned from $HOME). * * If the old DB at the incorrect location contains data, this function * copies it to the new location so previous sessions/decisions/etc. survive. * * @returns {{ migrated: boolean; oldPath: string; newPath: string; message: string }} */ export declare function reinitDatabase(newProjectRoot: string, ideKey?: string): { migrated: boolean; oldPath: string; newPath: string; message: string; }; /** * Create a backup copy of the database file. * Uses SQLite's backup API for a safe, consistent copy. */ export declare function backupDatabase(destPath?: string): string; export declare function queryAll(sql: string, params?: unknown[]): Record[]; export declare function queryOne(sql: string, params?: unknown[]): Record | null; export declare function execute(sql: string, params?: unknown[]): { lastId: number; }; export declare function executeMany(statements: Array<{ sql: string; params: unknown[]; }>): void; export declare function now(): string; export declare function getCurrentSessionId(): number | null; export declare function getLastCompletedSession(): { id: number; ended_at: string; summary: string | null; agent_name: string; } | null; export declare function getDbSizeKb(): number; export declare function forceFlush(): void; /** * F10: Log a tool invocation for session replay diagnostics. * Silent no-op if the tool_call_log table doesn't exist (older schemas). */ export declare function logToolCall(toolName: string, outcome?: "success" | "error", notes?: string): void; //# sourceMappingURL=database.d.ts.map