import type { ImageContent } from "@earendil-works/pi-ai/compat";
import type { ActivityWatchdogDiagnostic } from "../interactive-engine/activity-watchdog.ts";
import { type EngineKeybindingState, type InteractiveEngineCommand, type InteractiveEngineMessage } from "../interactive-engine/protocol.ts";
import { RpcClientApi, type RpcCommandBody } from "./rpc-client-api.ts";
import type { RpcExtensionUIRequest, RpcExtensionUIResponse, RpcEvent, RpcResponse } from "./rpc-types.ts";
export type { ModelInfo, RpcCommandBody } from "./rpc-client-api.ts";
export type { RpcContextWindowInfo, RpcEvent } from "./rpc-types.ts";
export interface RpcClientOptions {
    cliPath?: string;
    cwd?: string;
    env?: Record<string, string>;
    provider?: string;
    model?: string;
    contextWindow?: number | string;
    args?: string[];
    runtimeExecutable?: string;
    runtimeArgs?: string[];
    /**
     * Bounded deadline (ms) applied to short metadata/control requests. Long-lived
     * commands (see LONG_LIVED_COMMANDS) never use this timer. Defaults to 30s.
     */
    requestTimeoutMs?: number;
    interactiveEngine?: {
        onDiagnostic: (diagnostic: ActivityWatchdogDiagnostic) => void;
        onActivityChange?: (active: boolean) => void;
    };
}
export type RpcEventListener = (event: RpcEvent) => void;
export declare class RpcClient extends RpcClientApi {
    private process;
    private stopReadingStdout;
    private eventListeners;
    private extensionUIListeners;
    private pendingExtensionUIRequests;
    private engineMessageListeners;
    private latestEngineKeybindingState;
    private pendingEngineMessages;
    private pendingEngineMessageBytes;
    private pendingRequests;
    private requestId;
    private stderr;
    private exitError;
    private engineMonitor;
    private eventBuffer;
    private stdinWriter;
    private generation;
    private readonly activeActivityIds;
    private enginePid;
    private options;
    constructor(options?: RpcClientOptions);
    start(): Promise<void>;
    stop(): Promise<void>;
    /** Subscribe to agent events. */
    onEvent(listener: RpcEventListener): () => void;
    onExtensionUIRequest(listener: (request: RpcExtensionUIRequest) => void): () => void;
    respondExtensionUI(response: RpcExtensionUIResponse): Promise<void>;
    onInteractiveEngineMessage(listener: (message: InteractiveEngineMessage) => void): () => void;
    onInteractiveEngineKeybindingState(listener: (state: EngineKeybindingState) => void): () => void;
    sendInteractiveEngineCommand(command: InteractiveEngineCommand): void;
    waitForInteractiveEngineBound(): Promise<void>;
    getEnginePid(): number | undefined;
    getGeneration(): number;
    restart(sessionFile: string | undefined): Promise<void>;
    requestInternal<T>(command: RpcCommandBody): Promise<T>;
    getStderr(): string;
    waitForIdle(timeout?: number): Promise<void>;
    collectEvents(timeout?: number): Promise<RpcEvent[]>;
    promptAndWait(message: string, images?: ImageContent[], timeout?: number): Promise<RpcEvent[]>;
    private handleLine;
    private emitEvent;
    private emitInteractiveEngineMessage;
    private createProcessExitError;
    private invalidateEngineShortcuts;
    private observeInteractiveEngineMessage;
    private rejectPendingRequests;
    private failTransport;
    private requireWriter;
    private bestEffort;
    protected request(command: RpcCommandBody): Promise<RpcResponse>;
    private assertSuccess;
    protected data<T>(response: RpcResponse): T;
}
//# sourceMappingURL=rpc-client.d.ts.map