import { type DoctorContext } from "../types.js"; export type SessionRead = { kind: "found"; sessionCode: string; agentToken: string; } /** No session file in any location we read. This machine never registered. */ | { kind: "none"; } /** * A session is there, but its token is in OS-protected storage that this * process cannot open — the desktop's safeStorage, from a headless run or from * a host that passed no vault. Not the same statement as "never registered". */ | { kind: "protected"; } | { kind: "unreadable"; error: string; }; /** * Whether `session.json` says its token lives in the OS-protected sidecar. * * The one field of that file the store-completeness check needs, and the only * one that leaves this function: a protected session whose `session.token` is * gone is a store that has LOST a file, while an unprotected one has no sidecar * to lose — and a stat cannot tell those apart, because the flag is inside the * JSON. Nothing else is returned, and in particular `agentToken` is read past * and dropped: the parsed object is local and never reaches a fact, a detail or * a remedy. * * `unreadable` is its own answer for the reason everything in this directory now * has one: a session.json we could not parse must not be reported as an * unprotected session, which would then be reported as a healthy store. */ export type SessionShape = { kind: "absent"; } | { kind: "unreadable"; error: string; } | { kind: "present"; tokenProtected: boolean; }; export declare function readSessionShape(dir: string): Promise; /** * Every directory session-store.ts would READ from, most specific first, with * the env override resolved read-only (see paths.ts). */ export declare function sessionReadDirs(configDir?: string): string[]; /** The first location that answers, in the agent's own order of preference. */ export declare function readStoredSession(ctx: DoctorContext): Promise;