/** * session-store-importer.ts * * Boot-time migration that folds every pre-existing session store into the ONE * home-scoped durable broker store. Idempotent and safe to run repeatedly, the * merge is keyed on session id, so a re-run over the same sources is a no-op. * * Sources folded in (the one-broker session-spine effort, see CHANGELOG 1.0.0, S1 spine): * 1. Companion chat files, ~/.goodvibes/companion-chat/sessions/*.json * (home-scoped, projectless → project 'unknown'); INCLUDING closed sessions. * 2. Per-project broker snapshots, /.goodvibes//control-plane/ * sessions.json (the old project-scoped store path); stamped project = . * 3. The stale agent-fork store, same broker-snapshot shape under its surface. * * No session is dropped (closed included); deletion remains the GC's job. Corrupt * or partial files are logged and skipped per-file, the run never aborts. */ /** A legacy store to fold into the home store. */ export interface LegacySessionSource { /** 'broker-store' = a SharedSessionStoreSnapshot JSON file; 'companion-dir' = a dir of PersistedChatSession files. */ readonly kind: 'broker-store' | 'companion-dir'; /** File path (broker-store) or directory path (companion-dir). */ readonly path: string; /** Project to stamp on records that carry no explicit project. Companion sources default to 'unknown'. */ readonly project?: string | undefined; } export interface ImportLegacySessionsResult { /** Total sessions in the home store after the import. */ readonly total: number; /** Sessions newly added by this run (0 on an idempotent re-run). */ readonly imported: number; /** Sources that did not exist on disk (skipped, not an error). */ readonly missingSources: readonly string[]; /** Files that failed to parse and were skipped. */ readonly skippedFiles: readonly string[]; } /** * Discover the legacy stores reachable from a single project root plus the * home-scoped companion directory. Scans /.goodvibes// * control-plane/sessions.json across every surface subdir (tui, goodvibes, * agent, …). The home store itself is never returned as a source. */ export declare function discoverLegacySessionSources(input: { readonly projectRoot: string; readonly companionSessionsDir?: string | undefined; }): LegacySessionSource[]; /** * Fold every source into the home store at `homeStorePath`, idempotently. * Starts from the existing home store, merges each source keyed by session id * (newer updatedAt wins; messages/inputs union-deduped by id), and re-persists * atomically. A second run over the same sources produces the same store. */ export declare function importLegacySessionStores(input: { readonly homeStorePath: string; readonly sources: readonly LegacySessionSource[]; }): Promise; //# sourceMappingURL=session-store-importer.d.ts.map