export interface PidSessionEntry {
    pid: number;
    agent: string;
    /**
     * Custom harness / profile name when this pid was launched via
     * `agents run <profile>` (e.g. `deepseek`). `agent` stays the HOST
     * CLI (`claude`) so process matching and transcript discovery keep
     * working. `sessions --active` displays this when set (PHNX-2935).
     */
    harness?: string;
    /** The launch session id. Present for agents launched with a known id (Claude). */
    sessionId?: string;
    cwd?: string;
    /**
     * Resolved actor id (`resolveActor().id`) stamped at spawn — who initiated this
     * run. A tailnet login/email for a resolved human, or `UNRESOLVED@<host>` when
     * it can't be determined. Read back by the active-sessions path to surface an
     * `owner` per session (RUSH-2018), so a co-located fleet shows who launched what.
     */
    actor?: string;
    /**
     * The actor's kind (`resolveActor().kind`): `'human'` for a person-initiated
     * run, `'agent'` for one an agent spawned. Pairs with {@link actor} the same way
     * `AGENTS_ACTOR` / `AGENTS_ACTOR_KIND` do on the exec env.
     */
    initiatedBy?: 'human' | 'agent';
    /**
     * The launch id minted by `ag run` and exported to the child as
     * `AGENT_LAUNCH_ID`. The agent's SessionStart hook records the SAME id in its
     * own state file (`terminals/sessions/<pid>.json`, `launch_id`), so the two
     * records reconcile by this key even when the hook runs under a DIFFERENT pid
     * (tmux pane leaf, cmd.exe wrapper) — see resolveHookSessionId in
     * session/hook-sessions.ts. This
     * is how a non-Claude launch (whose id we don't know at spawn) gets an exact
     * session id at listing time instead of the newest-jsonl heuristic.
     */
    launchId?: string;
    /**
     * `AGENT_TERMINAL_ID` when the launch inherited one (a Factory VS Code tab).
     * A secondary join key to the hook's `terminal_id`, for agents the extension
     * spawned. Best-effort — undefined outside the extension.
     */
    terminalId?: string;
    /**
     * `$TMUX_PANE` at launch — stored for diagnostics and possible future
     * disambiguation. NOT currently consulted on read: the listing path keys
     * purely on pid (stale entries are pruned when the pid dies), so this is
     * metadata, not an anti-collision key.
     */
    tmuxPane?: string;
    startedAtMs: number;
}
export declare function isSessionIdShape(value: string): boolean;
export declare function extractSessionIdArg(args: string[]): string | undefined;
/**
 * Read a live process's original argv (best-effort).
 *
 * Linux: NUL-separated `/proc/<pid>/cmdline`. Darwin: `ps -ww -o args=` then
 * whitespace-split (good enough for Claude's `--session-id <uuid>` tokens;
 * not a full shell-quote parser). Other platforms: undefined.
 *
 * RUSH-2384: the by-pid registry is often empty mid-run (launch pid was a
 * wrapper that exited, prune wiped it, or the agent was not launched via
 * `agents run`). The live process still carries `--session-id` on its argv —
 * the same signal the incident used to prove the session was alive — so the
 * active scan and `agents message` can recover identity without the registry.
 */
export declare function readProcessArgv(pid: number): string[] | undefined;
/**
 * Exact session id a live agent process was launched with, read from its
 * current argv. Undefined when the process is gone, the platform can't expose
 * argv, or the vector carries no `--session-id`.
 */
export declare function sessionIdFromLivePid(pid: number): string | undefined;
/** Record a launched agent process. Never throws — the registry is an optimization. */
export declare function writePidSessionEntry(entry: PidSessionEntry): void;
/** Look up a live pid's recorded session. Returns undefined if absent/corrupt. */
export declare function readPidSessionEntry(pid: number): PidSessionEntry | undefined;
/**
 * Every recorded launch, one entry per live-or-dead pid. Used to index launches
 * by their `tmuxPane` so the authoritative tmux source can attribute a pane it did
 * NOT wrap (an agent bare-spawned into an existing pane) to its exact launch —
 * the caller filters to live pids. Best-effort: unreadable/corrupt files are
 * skipped, a missing dir yields `[]`.
 */
export declare function listPidSessionEntries(): PidSessionEntry[];
/**
 * Remove entries whose pid is no longer alive. Best-effort housekeeping.
 *
 * `isAlive` receives the entry's recorded `startedAtMs` so it can reject a pid
 * that a newer process recycled (a "zombie" registry entry), not just one that
 * no longer exists. An unreadable/corrupt entry falls back to the pid-only
 * check.
 */
export declare function prunePidSessionRegistry(isAlive: (pid: number, startedAtMs?: number) => boolean): void;
