import type { Readable, Writable } from "node:stream"; import { type AgentProcess } from "../liveness.js"; /** * v2.1 Phase 4f.1: setter for `capturedSessionId` so `handleRegisterAgent` * can refresh it when a stdio process registers (or re-registers) itself * mid-lifetime via the MCP tool. Without this, an agent that registers via * MCP AFTER startStdioServer (no SessionStart hook) leaks its row on SIGTERM * because Phase 2a's null-guard correctly refuses to guess. * * Gate conditions (applied by the caller in src/tools/identity.ts): * - transport must be "stdio" * - newly-registered name must match process.env.RELAY_AGENT_NAME * Either failure → do not call this setter. */ export declare function updateCapturedSessionId(sid: string | null): void; /** Exposed for tests — read-only accessor on the module-local state. */ export declare function getCapturedSessionId(): string | null; /** * Stamp the detected agent process onto `name`'s row as its liveness anchor. * No-op unless this is a stdio process whose RELAY_AGENT_NAME matches `name` * AND an agent ancestor was detected. Called at startup (covers hook-first * registration) and on register (covers MCP-first / re-register) — mirroring * the capturedSessionId dual-capture so it's robust to ordering. */ export declare function stampDetectedAgentLiveness(name: string | undefined): void; /** Test-only: override the detected agent process. */ export declare function _setDetectedAgentProcessForTests(p: AgentProcess | null): void; /** * Pure logic for the SIGINT/SIGTERM auto-offline path. Exported so tests * can exercise the three branches (null / mismatch / match) without * spawning a process and sending real signals. * * v2.1.3 (I9 fix): renamed semantically from "unregister" to "mark offline." * The export name `performAutoUnregister` is retained for back-compat with * existing test imports + the index.ts signal wiring; the new semantics * are "mark this session offline, preserving agent identity." */ export declare function performAutoUnregister(name: string | undefined, capturedSid: string | null, signal: string): void; /** * v2.4.2 R1: optional `stdin` lets the TTY guard hand a PassThrough proxy * (already piped from process.stdin) to the SDK transport so the first * frame survives the guard's first-byte detection. When the guard is not * engaged (TTY attached, or RELAY_SKIP_TTY_CHECK=1), callers pass nothing * and the SDK defaults to process.stdin / process.stdout — unchanged. */ export declare function startStdioServer(stdin?: Readable, stdout?: Writable): Promise; //# sourceMappingURL=stdio.d.ts.map