/** The subset of the hook's on-disk record this reader relies on. Extra fields are ignored. */
export interface HookSessionRecord {
    session_id: string;
    agent?: string;
    cwd?: string;
    pid: number;
    launch_id?: string;
    terminal_id?: string;
    ts?: number;
}
/** Pre-built lookup maps over one scan of the hook state dir. */
export interface HookSessionIndex {
    byLaunchId: Map<string, HookSessionRecord>;
    byTerminalId: Map<string, HookSessionRecord>;
    byPid: Map<number, HookSessionRecord>;
}
/**
 * Read the deployed hook's record for one specific pid, or undefined if absent /
 * corrupt / not fresh. `startedAtMs` (the live process's known start, when the
 * caller has it) rejects a stale record left by a PRIOR process at a reused pid:
 * the hook writes its record AFTER the agent boots, so a record whose `ts`
 * predates the current process's start belongs to a dead predecessor. `ts` is
 * Unix SECONDS (the hook stamps `date +%s`); `startedAtMs` is millis.
 */
export declare function readStateSessionRecord(pid: number, startedAtMs?: number): HookSessionRecord | undefined;
/**
 * Scan the hook state dir once and index every record by launch_id, terminal_id,
 * and pid. Returns empty maps if the dir is absent. Newest-by-`ts` wins a key
 * collision (pid reuse, or a launch id lingering from a since-dead process).
 */
export declare function loadHookSessionIndex(): HookSessionIndex;
export interface ResolveOpts {
    pid: number;
    kind: string;
    launchId?: string;
    terminalId?: string;
    /** Immediate child pids of `pid` — the hook records under the agent pid, which
     *  for a wrapper/shell pid we recorded is a child. */
    childPids?: number[];
}
/**
 * Resolve an agent's OWN authoritative session id from the hook index. Priority
 * mirrors the session-tracker's getLiveSession: launchId join (survives pid
 * divergence — the hook runs under the agent pid, our registry entry may sit on a
 * tmux pane leaf or cmd.exe wrapper) → terminalId join → direct pid → children.
 * Every hit is kind-guarded so a stale file at a reused pid can't cross agents.
 * Undefined until the hook lands (it can lag the spawn) or for hookless harnesses.
 */
export declare function resolveHookSessionRecord(index: HookSessionIndex, opts: ResolveOpts): HookSessionRecord | undefined;
/** The session id alone — see {@link resolveHookSessionRecord} for the full record
 *  (which also carries the SessionStart `ts` used to stamp `startedAtMs`). */
export declare function resolveHookSessionId(index: HookSessionIndex, opts: ResolveOpts): string | undefined;
