/**
* Agent Synch MCP Server - Storage Layer
* Handles all persistent storage operations for the memory bank.
*/
export interface ActiveContext {
summary: string;
lastUpdated: string;
focus?: string;
taskGraph?: object;
}
export interface FilingCabinetEntry {
originalPath?: string;
summary: string;
keyExports?: string[];
dependencies?: string[];
dependents?: string[];
indexedAt?: string;
}
export interface ProjectProfile {
name: string;
standards?: Record<string, string>;
workflow?: Record<string, string>;
emergentProperties?: string[];
}
export interface Room {
path: string;
description: string;
depth: number;
connectedRooms: string[];
keyItems: string[];
}
export interface SpatialMap {
rooms: Record<string, Room>;
}
export interface SearchResult {
path: string;
projectId: string;
summary: string;
matchScore: number;
}
export interface BugEntry {
id: string;
projectId: string;
title: string;
description: string;
stackTrace?: string;
filePath?: string;
lineNumber?: number;
severity: 'low' | 'medium' | 'high' | 'critical';
status: 'open' | 'in_progress' | 'resolved';
createdAt: string;
resolvedAt?: string;
resolution?: string;
}
export interface ServerConfig {
serverPath: string;
discoveredAt: string;
lastVerified: string;
version: string;
}
export interface ContextEvent {
id: string;
projectId: string;
agentId: string;
eventType: 'handoff' | 'checkpoint' | 'error' | 'complete';
summary: string;
focus?: string;
metadata?: Record<string, unknown>;
timestamp: string;
previousEventId?: string;
}
/**
* AgentSynchStorage - Core storage engine using SQLite with MD dual-write.
*/
export declare class AgentSynchStorage {
private baseDir;
private db;
constructor(baseDir?: string);
/**
* Initialize storage structure and SQLite tables.
*/
initialize(): Promise<void>;
private projectDir;
private sanitizeId;
private ensureProjectDir;
getActiveContext(projectId: string): Promise<ActiveContext | null>;
private parseContextFromMd;
setActiveContext(projectId: string, context: ActiveContext): Promise<void>;
private generateContextMd;
indexFile(projectId: string, entry: FilingCabinetEntry): Promise<void>;
getFileFromCabinet(projectId: string, originalPath: string): Promise<FilingCabinetEntry | null>;
listCabinet(projectId: string): Promise<string[]>;
getProjectProfile(projectId: string): Promise<ProjectProfile | null>;
setProjectProfile(projectId: string, profile: ProjectProfile): Promise<void>;
getSpatialMap(projectId: string): Promise<SpatialMap>;
saveSpatialMap(projectId: string, map: SpatialMap): Promise<void>;
addRoom(projectId: string, room: Room): Promise<void>;
linkRooms(projectId: string, roomA: string, roomB: string): Promise<void>;
searchMemory(query: string, projectId?: string): Promise<SearchResult[]>;
listProjects(): Promise<string[]>;
logBug(entry: Omit<BugEntry, 'id' | 'createdAt' | 'status'>): Promise<string>;
getBugs(projectId: string, status?: string): Promise<BugEntry[]>;
resolveBug(bugId: string, projectId: string, resolution: string): Promise<void>;
getServerConfig(): Promise<ServerConfig | null>;
setServerConfig(config: ServerConfig): Promise<void>;
isFirstRun(): Promise<boolean>;
emitContextEvent(event: Omit<ContextEvent, 'id' | 'timestamp'>): Promise<ContextEvent>;
private generateEventMd;
getContextEvents(projectId: string, limit?: number): Promise<ContextEvent[]>;
getLastEvent(projectId: string): Promise<ContextEvent | null>;
}