/**
 * Resolve a remote-created session id back to an interactive `--device` launcher.
 *
 * A headless `--device` run captures the remote-coined id from the followed log
 * (the `--emit-session-id` marker — see session-marker.ts). An INTERACTIVE run
 * has no followed log: the local TTY is wired straight through `sshStream`
 * (stdio:'inherit'), so nothing can tap the stream for a marker without breaking
 * the agent's raw-mode TUI. Instead we correlate by AGENT_LAUNCH_ID.
 *
 * The launcher forwards a launch id it controls (`--env AGENT_LAUNCH_ID=<id>`);
 * the remote `agents run` adopts it (exec.ts `resolveLaunchId`), so the remote
 * SessionStart hook records the agent's REAL session id under that exact key in
 * `~/.agents/.cache/terminals/sessions/<pid>.json`. After the stream returns we
 * do ONE ssh read of that dir and pick the record whose `launch_id` matches —
 * the same launch-id join `agents sessions --active` uses locally
 * (session/hook-sessions.ts), just across the SSH hop.
 *
 * This gives the interactive path a real per-agent id to register in the local
 * session index and to reconnect against, for Codex/Kimi/Grok/Gemini — closing
 * the gap RUSH-2033 left for every non-Claude agent (Claude still forces its own
 * id up front and never reaches here).
 */
/**
 * Pick the real session id for `launchId` from the remote hook records.
 *
 * `recordsJson` is the newline-delimited JSON the remote read emits — one record
 * per line (a `cat` of every `sessions/*.json`). Scan for the record whose
 * `launch_id` matches and return its `session_id`; when several match (pid reuse,
 * a lingering file) the NEWEST by `ts` wins, mirroring the local reader's
 * keep-newest tie-break (session/hook-sessions.ts). Pure so the correlation is
 * unit-testable from fixtures with no SSH. Returns undefined when no record
 * carries the launch id (the hook hasn't landed yet, or a hookless harness).
 */
export declare function pickRemoteSessionId(recordsJson: string, launchId: string): string | undefined;
/**
 * Read the remote hook-session dir over ssh and resolve the real session id the
 * remote run recorded under `launchId`. One round-trip, best-effort: any ssh
 * failure, a missing dir, or an absent record yields undefined — the caller then
 * keeps the un-mapped run rather than a fabricated id.
 *
 * `$HOME` expands on the REMOTE login shell (never the local box). The glob is a
 * literal path with no user input, so it is injection-safe; a `2>/dev/null` on a
 * globless dir keeps the command quiet when the dir is empty or absent.
 */
export declare function resolveRemoteSessionId(target: string, launchId: string, timeoutMs?: number): string | undefined;
