/** * companion-chat-persistence.ts * * Disk-backed session store for CompanionChatManager. * * Design: * - Sessions and their messages are stored as individual JSON files under * `/.json` using atomic tmp-file + rename writes. * - The store is loaded eagerly at construction time (async init()) and * thereafter kept in sync with every createSession / updateSession / * appendMessage / closeSession mutation. * - Default storage root: ~/.goodvibes/companion-chat/sessions/ */ import type { CompanionChatMessage, CompanionChatSession } from './companion-chat-types.js'; export interface PersistedChatSession { readonly meta: CompanionChatSession; readonly messages: CompanionChatMessage[]; } /** * Resolve the companion-chat sessions directory. * * Pass the runtime's INJECTED home directory so an isolated-home daemon never * reads or writes the real `~/.goodvibes/companion-chat`, the rest of the * runtime resolves paths from the injected home, and this must agree. The * OS `homedir()` is used only as a last resort when nothing is injected. */ export declare function defaultSessionsDir(homeDirectory?: string): string; export declare class CompanionChatPersistence { private readonly sessionsDir; constructor(sessionsDir?: string); /** Ensure the sessions directory exists. */ private ensureDir; private filePath; /** Load all persisted sessions from disk. Returns an empty array on directory failure. */ loadAll(): Promise; /** Atomically persist a single session to disk. Rejects when the write fails. */ save(session: PersistedChatSession): Promise; /** Delete a session file from disk (called when a closed session is GC'd). Rejects on unlink failure. */ delete(sessionId: string): Promise; } //# sourceMappingURL=companion-chat-persistence.d.ts.map