/** * Codex app-server LSP-style init handshake (required by codex 0.134+). * * Without this, every business RPC (`thread/start`, `turn/start`, …) is * answered with `Not initialized` and the daemon never moves. The sequence * is the canonical LSP one: * * 1. client → `initialize` request with ClientInfo + capabilities * 2. server → InitializeResponse (userAgent, codexHome, platform info) * 3. client → `initialized` notification (no params) * * Steps 1 + 3 are both required: codex's `Not initialized` guard is cleared * only once the notification arrives. Capabilities can be omitted (the spec * accepts `null`) — we pass an explicit default so the negotiation choices * are visible in the source. */ import type { CodexWsClient } from './rpc.js'; import type { ClientInfo, InitializeCapabilities, InitializeResponse } from './types.js'; export interface HandshakeOptions { clientInfo?: ClientInfo; capabilities?: InitializeCapabilities | null; /** * Hard ceiling on how long to wait for the daemon's InitializeResponse * before failing the handshake. Without this, a codex that accepts the * WebSocket upgrade but never replies (hang, crash mid-response, wrong * protocol version, …) would deadlock dispatcher startup indefinitely, * blocking both server boot and any retry path. Default: 10_000 ms, * which matches the spawn-readiness budget in CodexProcess. */ timeoutMs?: number | undefined; } /** * Drive the full `initialize` + `initialized` exchange. Returns the * server's InitializeResponse (userAgent, codexHome, platform) so callers * can log it or surface it via admin. * * Times out (rejects) if the daemon does not reply within * `options.timeoutMs`. The pending request stays in the client's `pending` * map after timeout — callers that recover by tearing down the client * (e.g. CodexRuntime's cleanupOnFailure) will then drop those * pending entries when the WS connection closes. */ export declare function performInitializeHandshake(client: CodexWsClient, options?: HandshakeOptions): Promise; //# sourceMappingURL=handshake.d.ts.map