import { type Database } from "../../data/database.js"; export declare function taskRetirementDir(root: string): string; /** * Preserve a legacy task source file (e.g. rooms//tasks.json) verbatim in the * retirement archive. Returns the archived file name. Used by the conversation * importer for legacy task files that are no longer imported into SQL. */ export declare function archiveRawRetiredSource(root: string, legacyPath: string, bytes: Uint8Array): string; export interface TaskArchiveResult { directory: string; exportedFiles: string[]; rowCounts: Record; } /** * Export all four task tables from the staging database, then verify the written * bytes. Returns the archive directory. Safe to call when the tables never existed * (fresh install): writes nothing and returns zero counts. */ export declare function archiveRetiredTasks(stagingDb: Database, root: string): TaskArchiveResult | null; /** * Delete retired topic session directories from member session trees (topic * retirement §3.4, fish #19358). Runs after the storage upgrade settles. * * - Idempotent: a storage_meta flag records completion; while absent (e.g. a * previous attempt failed) later startups retry. * - Non-blocking: file-only leftovers never affect main chat data, so failures * are logged and retried, never allowed to fail the upgrade. * - Narrow: only `/sessions//topics/…` and legacy `topic-…` * prefixed directories inside session day trees are matched; room/DM session * files and the `sessions/current.json` reference file are never touched. */ export declare function cleanupRetiredTopicSessionFiles(root: string, db: Database): void; /** * Delete retired background-task directories from member trees (background * retirement, fish #19454). Runs after the storage upgrade settles. * * - Idempotent: a storage_meta flag records completion; while absent (e.g. a * previous attempt failed) later startups retry. * - Non-blocking: file-only leftovers never affect main chat data, so failures * are logged and retried, never allowed to fail the upgrade. * - Narrow: only `/background-tasks/…` is matched; member session * files, room/DM session trees and `sessions/current.json` are never * touched. (Topic-scoped background children wrote into the same tree before * their own retirement, so this also clears those residuals.) */ export declare function cleanupRetiredBackgroundSessionFiles(root: string, db: Database): void; /** * Park retired per-scope session artifacts in `members//archive/sessions/` * (① A3, fish #20025). A member now has one session under * `sessions//main/`; the old `rooms/` and `dm` trees — and the legacy * `sessions/current.json` reference file — are moved aside rather than deleted, * so nothing is lost and nothing resumes them. Runs after the storage upgrade * settles, alongside the other retirement cleanups. * * - Idempotent: a `storage_meta` flag records completion; while absent (e.g. a * previous attempt failed) later startups retry, but files arriving after the * flag are deliberately left in place. * - Non-blocking: file-only leftovers never affect chat data, so failures are * logged and retried, never allowed to fail the upgrade. * - Narrow: only `sessions//{rooms,dm}` directories and `sessions/current.json` * are matched; `sessions//main/` and everything else under the member * directory stays untouched. Symlinks are never followed or moved. * - Never overwrites: if the archive already holds the target path it is left * alone and the conflict is counted (no merge, no clobber). */ export declare function archiveRetiredScopeSessions(root: string, db: Database): void; /** * ④ A (fish #20035): the legacy shared memory (`memory/user`, `memory/projects`) * is retired with the member-private memory model. On upgrade the content moves * to the workspace-level global archive (`/archive/memory/`) — * read-only history, nothing deleted, nothing merged: if the archive target * already exists the source is left in place and the conflict is counted. * Idempotent via a `storage_meta` flag; failures are logged and retried next * start (matches the other post-upgrade file cleanups). */ export declare function archiveLegacySharedMemory(root: string, db: Database): void; /** * ④ B (fish #20035): `memory/scopes/` was the retired per-chat memory layout. * Fold any remaining files into the member's overview+parts root as * `scopes-.md` (nothing lost, deterministic names), then drop * the empty tree. A member with an empty `scopes/` just gets the tree removed. * The fold only MOVES bytes, so the registry/history rows follow the move: * `reconcileFoldedMemoryRows` runs on every startup (idempotent, conservative: * only when the source is gone and the folded file exists; conflicts stay) and * also heals databases whose fold flag was already set by an earlier build. * The move phase stays flag-gated; non-blocking on failure (retry next start). */ export declare function cleanupMemberMemoryScopes(root: string, db: Database): void; export declare function copyRoomPrinciplesToDescriptions(root: string, db: Database): void; //# sourceMappingURL=retirements.d.ts.map