type JsonRpcId = number | string; type JsonRpcRequest = { id: JsonRpcId; method: string; params?: unknown; }; type JsonRpcResponse = { id: JsonRpcId; result?: unknown; error?: { code: number; message: string; data?: unknown; }; }; type JsonRpcNotification = { method: string; params?: Record; }; export type ThreadStatus = { type: 'notLoaded'; } | { type: 'idle'; } | { type: 'systemError'; } | { type: 'active'; activeFlags: string[]; }; export type TurnStatus = 'completed' | 'interrupted' | 'failed' | 'inProgress'; export interface Turn { id: string; status: TurnStatus; startedAt: number | null; completedAt: number | null; } export interface Thread { id: string; cwd: string; status: ThreadStatus; updatedAt: number; preview: string; turns?: Turn[]; } export type ClientEvent = { type: 'notification'; message: JsonRpcNotification; } | { type: 'server-request'; message: JsonRpcRequest; } | { type: 'response'; message: JsonRpcResponse; }; export interface TurnStartResponse { turn: Turn; } export interface ThreadStartResponse { thread: Thread; } export interface ThreadResumeResponse { thread: Thread; } export interface ThreadReadResponse { thread: Thread; } export interface ThreadListResponse { data: Thread[]; nextCursor: string | null; } export interface ThreadLoadedListResponse { data: string[]; nextCursor: string | null; } export declare class CodexAppClient { private readonly url; private readonly log; private ws?; private nextId; private pending; private listeners; private connected; private connectionListeners; constructor(url: string, log?: (msg: string) => void); connect(): Promise; close(): void; isConnected(): boolean; initialize(): Promise; onEvent(listener: (event: ClientEvent) => void): () => void; onConnectionChange(listener: (connected: boolean) => void): () => void; settle(ms?: number): Promise; threadStart(params: Record): Promise; threadResume(params: Record): Promise; threadRead(threadId: string, includeTurns?: boolean): Promise; threadList(params: Record): Promise; threadLoadedList(limit?: number): Promise; turnStart(threadId: string, text: string): Promise; turnSteer(threadId: string, turnId: string, text: string): Promise<{ turnId: string; }>; turnInterrupt(threadId: string, turnId: string): Promise>; private request; private handleMessage; private record; private emitConnection; } export {};