/**
 * PiRpcClient — typed client for pi's RPC mode (`pi --mode rpc`).
 *
 * Protocol (verified hands-on in the P0.1 eval, pi 0.78.1, and per upstream
 * docs/rpc.md):
 *   - Commands: one JSON object per line on stdin.
 *   - Responses: `{"type":"response","command":…,"success":…,"id":…}` lines on
 *     stdout, correlated by the optional `id` we attach to every command.
 *   - Events: every other stdout line is an agent event (agent_start,
 *     turn_start, message_update, tool_execution_start|update|end, turn_end,
 *     agent_end, …), streamed asynchronously.
 *
 * FRAMING IS STRICT LF JSONL: split records on `\n` ONLY (tolerating a
 * trailing `\r`). Node's `readline` is NOT protocol-compliant — it also
 * splits on U+2028/U+2029, which are valid INSIDE JSON strings; using it
 * would corrupt any record whose payload contains those code points. The
 * splitter below buffers manually and is exported for direct unit testing.
 *
 * The subscription guard (policy.ts) is enforced by CALLERS at session/call
 * construction — this client is the dumb pipe.
 */
/** A parsed pi RPC response line. */
export interface PiRpcResponse {
    id?: string;
    type: 'response';
    command: string;
    success: boolean;
    data?: unknown;
    error?: string;
}
/** Any non-response pi event line (agent_start, message_update, …). */
export interface PiRpcEvent {
    type: string;
    [key: string]: unknown;
}
/**
 * Strict-LF JSONL splitter. Feed raw chunks; complete lines invoke `onLine`
 * with the line content (trailing `\r` stripped, empty lines skipped).
 * Returns a function to flush the trailing partial line (used at stream end).
 *
 * Exported for unit tests — the U+2028/U+2029-inside-string case is pinned
 * there so a refactor to `readline` (which would break it) fails loudly.
 */
export declare function createStrictLfSplitter(onLine: (line: string) => void): {
    push: (chunk: string) => void;
    flush: () => void;
};
export interface PiRpcClientOptions {
    /** Absolute path to the pi binary. */
    binaryPath: string;
    /** pi `--model` pattern (`provider/id`). Callers must pass policy first. */
    model?: string;
    /** `--session-dir` (durable transcripts). */
    sessionDir?: string;
    /** `--session-id` (create-or-resume a deterministic session). */
    sessionId?: string;
    /** Run ephemeral (`--no-session`). */
    noSession?: boolean;
    /** Working directory for the pi process (tool execution cwd). */
    cwd?: string;
    /** Extra env on top of the hardened child env (tests use this). */
    envOverrides?: Record<string, string>;
}
/**
 * One spawned `pi --mode rpc` process. Create with `PiRpcClient.spawn()`,
 * drive with the typed command methods, consume `events()`, then `close()`.
 */
export declare class PiRpcClient {
    private readonly child;
    private readonly pending;
    private readonly eventQueue;
    private eventWaiter;
    private closed;
    private exited;
    private nextId;
    static spawn(options: PiRpcClientOptions): PiRpcClient;
    private constructor();
    /** The underlying pid (HardKill primitive integration). */
    get pid(): number | undefined;
    get isExited(): boolean;
    private onLine;
    private enqueueEvent;
    private wakeEventWaiter;
    /** Send a raw command object (an `id` is attached automatically). */
    request(command: Record<string, unknown>, timeoutMs?: number): Promise<PiRpcResponse>;
    prompt(message: string, opts?: {
        streamingBehavior?: 'steer' | 'followUp';
    }): Promise<PiRpcResponse>;
    steer(message: string): Promise<PiRpcResponse>;
    followUp(message: string): Promise<PiRpcResponse>;
    abort(): Promise<PiRpcResponse>;
    getState(): Promise<PiRpcResponse>;
    /**
     * Async iterator over agent events (everything that isn't a correlated
     * response). Ends when the process exits and the queue drains.
     */
    events(): AsyncGenerator<PiRpcEvent>;
    /** End stdin, give pi a grace period, then escalate SIGTERM → SIGKILL. */
    close(): Promise<void>;
    /** Throw a typed error when spawn itself failed (no pid). */
    assertSpawned(): void;
}
//# sourceMappingURL=rpcClient.d.ts.map