/** * Claude desktop app session-index access. * * The Claude desktop app keeps each signed-in account's Claude Code session * sidebar as plain JSON files: * * /claude-code-sessions///local_.json * * One file per sidebar entry: { sessionId, cliSessionId, cwd, title, ... }. * Nothing inside the file binds it to an account — the scoping is purely * which directory it sits in, and the transcripts themselves * live in the (account-agnostic) `~/.claude/projects/` tree of the runtime * environment. So when a user signs out of account A and into account B, * their sessions "disappear" from the sidebar even though every byte is * still on disk. Copying an entry file into another account's directory * makes the session visible (and resumable) there. * * These helpers locate the desktop app's data directory (including the * Windows one from inside WSL, where the app runs on the Windows side but * the CLI runs in the distro), enumerate the per-account entries, and * plan/apply cross-account mirrors. The file format is the desktop app's * private state, not a public API — everything here treats it read-mostly * and copies files verbatim rather than rewriting them. */ export interface DesktopSessionEntry { /** Absolute path of the local_*.json entry file. */ file: string; /** Account UUID directory the entry sits under (= sidebar scoping). */ accountUuid: string; /** Environment directory between account and entry (VM/env identity). */ envId: string; /** The entry's own id (usually "local_", mirrors the filename). */ sessionId: string | null; /** The Claude Code session id — matches the JSONL transcript filename. */ cliSessionId: string | null; cwd: string | null; title: string | null; model: string | null; isArchived: boolean; createdAt: number | null; lastActivityAt: number | null; } export interface DesktopAccount { accountUuid: string; path: string; entries: DesktopSessionEntry[]; } export interface MirrorAction { from: string; to: string; entry: DesktopSessionEntry; targetAccountUuid: string; } export interface MirrorPlan { actions: MirrorAction[]; /** Entries skipped because the target already lists that cliSessionId. */ skippedExisting: number; /** Entries skipped because they are archived (opt in via includeArchived). */ skippedArchived: number; } /** * Candidate desktop-app data directories for this machine, most specific * first. Only directories that exist AND contain a claude-code-sessions/ * subdirectory are returned. Precedence: explicit arg, then * HARNERY_CLAUDE_DESKTOP_DIR, then platform defaults (on WSL that means * scanning every /mnt/c/Users//AppData/Roaming/Claude). */ export declare function findDesktopDataDirs(explicit?: string): string[]; /** Enumerate every account directory + its session entries under one data dir. */ export declare function listAccounts(dataDir: string): DesktopAccount[]; /** * The account the runtime environment's Claude Code CLI is signed into, * read from ~/.claude.json (best-effort; null when unavailable). Lets the * command label an otherwise-opaque account UUID with an email address. */ export declare function readCliAccount(): { accountUuid: string; email: string | null; } | null; export interface MirrorOptions { /** Restrict targets to accounts whose uuid starts with one of these. */ to?: string[]; /** Restrict sources to accounts whose uuid starts with one of these. */ from?: string[]; /** * Selectors: each matches a cliSessionId / sessionId exactly, or a title * case-insensitively as a substring. Empty/undefined = every entry. */ sessions?: string[]; includeArchived?: boolean; } export declare function entryMatchesSelector(entry: DesktopSessionEntry, selector: string): boolean; /** * Plan the copies that would make each target account list the selected * sessions. Union semantics: every entry a source account has and a target * account lacks (keyed by cliSessionId, falling back to filename) becomes a * copy action. Idempotent by construction — planning again after applying * yields zero actions. */ export declare function planMirror(accounts: DesktopAccount[], opts?: MirrorOptions): MirrorPlan; /** Apply a plan: verbatim file copies (never rewrites entry contents). */ export declare function applyMirror(plan: MirrorPlan): { copied: number; }; //# sourceMappingURL=claude-desktop.d.ts.map