arela
Version:
AI-powered CTO with multi-agent orchestration, code summarization, visual testing (web + mobile) for blazing fast development.
121 lines • 2.97 kB
TypeScript
import type { Message, SessionStats } from "./types.js";
/**
* Session Memory Layer (Layer 4 - Hexi-Memory)
*
* Stores short-term context for the current conversation/task:
* - Current task being worked on
* - Open files being tracked
* - Conversation history
* - Active ticket
* - Arbitrary context key-value pairs
*
* Features:
* - In-memory cache for fast access (<50ms)
* - SQLite persistence for crash recovery
* - Auto-snapshot every 30 seconds
* - Restore from last snapshot on init
*/
export declare class SessionMemory {
private readonly cwd;
private db?;
private dbPath;
private cache;
private snapshotInterval?;
private initialized;
private exitHandler?;
private sigintHandler?;
private sigtermHandler?;
constructor(cwd?: string);
/**
* Initialize session memory
* - Sets up SQLite database
* - Attempts to restore from last snapshot
* - Starts auto-snapshot interval
*/
init(): Promise<void>;
/**
* Create database tables
*/
private createTables;
/**
* Get current session ID
*/
getSessionId(): string;
/**
* Get current task
*/
getCurrentTask(): Promise<string | undefined>;
/**
* Set current task
*/
setCurrentTask(task: string): Promise<void>;
/**
* Add message to conversation history
*/
addMessage(message: Message): Promise<void>;
/**
* Get recent messages from conversation history
*/
getRecentMessages(count: number): Promise<Message[]>;
/**
* Get all messages from conversation history
*/
getAllMessages(): Promise<Message[]>;
/**
* Track an open file
*/
trackOpenFile(filePath: string): Promise<void>;
/**
* Untrack a file
*/
untrackFile(filePath: string): Promise<void>;
/**
* Get list of open files
*/
getOpenFiles(): Promise<string[]>;
/**
* Set active ticket
*/
setActiveTicket(ticketId: string): Promise<void>;
/**
* Get active ticket
*/
getActiveTicket(): Promise<string | undefined>;
/**
* Set context value
*/
setContext(key: string, value: any): Promise<void>;
/**
* Get context value
*/
getContext<T = any>(key: string): Promise<T | undefined>;
/**
* Get all context
*/
getAllContext(): Promise<Record<string, any>>;
/**
* Delete context key
*/
deleteContext(key: string): Promise<void>;
/**
* Save current state to SQLite (snapshot)
*/
snapshot(): Promise<void>;
/**
* Restore state from SQLite snapshot
*/
restore(): Promise<void>;
/**
* Clear current session (start fresh)
*/
clear(): Promise<void>;
/**
* Get session statistics
*/
getStats(): Promise<SessionStats>;
/**
* Close database and stop auto-snapshot
*/
close(): void;
}
//# sourceMappingURL=session.d.ts.map