/** The store's name inside `~/.gsloth`: a directory, despite the extension (see the note above). */ export declare const HISTORY_DB_FILENAME = "history.db"; /** The index database's name inside the store directory. */ export declare const HISTORY_INDEX_FILENAME = "index.db"; /** The flat directory of per-thread files inside the store directory. */ export declare const HISTORY_THREADS_DIRNAME = "threads"; /** Where a single-file store is moved while it is being split; an interrupted split resumes here. */ export declare const PRE_SPLIT_SUFFIX = ".pre-split"; /** The lock file a split holds, beside the store. */ export declare const MIGRATION_LOCK_SUFFIX = ".migrating"; /** The paths that make up one store. */ export interface HistoryStorePaths { /** The store directory itself. */ root: string; /** `/index.db`. */ index: string; /** `/threads`. */ threads: string; /** `.pre-split`: a single-file store part-way through its split. */ preSplit: string; /** `.migrating`: the split's lock. */ lock: string; } /** Every path of the store at `storePath`. */ export declare function historyStorePaths(storePath: string): HistoryStorePaths; /** * The file name holding `threadId`. A plain id (lowercase hex digits and dashes) is used as it stands; * anything else is named by its SHA-256, and the id is read back from inside the file. */ export declare function threadFileName(threadId: string): string; /** * The thread id a file name spells, when it spells one directly; `undefined` for a hashed name * (whose id is only inside the file) and for anything that is not a thread file. */ export declare function threadIdFromFileName(name: string): string | undefined; /** Whether `name` is a thread file's name, direct or hashed. */ export declare function isThreadFileName(name: string): boolean; /** The path of the file holding `threadId` in the store at `storePath`. */ export declare function threadFilePath(storePath: string, threadId: string): string; /** * The history store's location. Honors an explicit `dbPath` (from `history.dbPath` or a `--db` * flag); otherwise the global `~/.gsloth/history.db`. When `dbPath` is omitted and `ensureDir` is * true, `~/.gsloth` is created so the recorder can write; the store directory itself is created by * the opener, never here, and never with its parents (a configured path under a directory that does * not exist is refused rather than conjured). * * Every history reader and writer resolves through this one function; the precedence a command * applies before calling it is `--db`, then `history.dbPath`, then the default. */ export declare function resolveHistoryDbPath(dbPath?: string, ensureDir?: boolean): string;