import type { DoctorCheck } from './doctor.js'; /** * Is the running session using the account ccx thinks it is? * * Every `ccx run` shares ONE session directory, and starting a session copies * that account's login into it. Two sessions at once therefore write the same * file, and the second one silently takes the first one's account: the first * terminal keeps running, on somebody else's login, while ccx still reports the * account it chose. A limit hit there is recorded against the wrong account. * * The save-back guard already refuses to write the borrowed login into the * wrong profile, so nothing is corrupted by it. What was missing is any way to * SEE it, which is what this reports. * * Deliberately local and read-only: fingerprints of files already on disk, no * network, no renewal. `ccx doctor` is what someone runs when a session behaved * oddly, and it must never change anything while answering. */ export interface SessionAccountInput { sessionDir: string; activeAccount: string | null; accounts: Array<{ name: string; dir: string; }>; /** * The sessions running right now. Two of them pointed at ONE directory is the * collision itself, and it is worth saying before anything else: only one * login can be in that directory, so the others are running as somebody else. */ leases?: Array<{ account: string; pid: number; configDir: string; }>; /** * Which filesystem's rules apply when comparing directories. Windows treats * two spellings of one path as the same directory; POSIX does not, and * folding case there would merge /tmp/Session with /tmp/session and report a * collision between two perfectly good sessions. */ platform?: NodeJS.Platform; /** Injected so the check is testable without building credential files. */ fingerprintOf?: (dir: string) => string | null; exists?: (file: string) => boolean; } export declare function auditSessionAccount(input: SessionAccountInput): DoctorCheck;