import type { BackendType, SessionBackend, SpawnOpts, SessionProbe } from './types.js';
export type PersistentBackendType = Exclude<BackendType, 'pty'>;
export interface HerdrExternalTarget {
    sessionName: string;
    target: string;
    paneId?: string;
}
export declare class HerdrBackend implements SessionBackend {
    private readonly sessionName;
    private readonly opts;
    private serverProcess;
    private pollTimer;
    private statusWaitProcesses;
    private readonly dataCbs;
    private readonly exitCbs;
    private readonly agentName;
    private paneId;
    private lastText;
    private exited;
    private started;
    private cols;
    private rows;
    private agentProbeFailures;
    private childEnv;
    claudeJsonlPath?: string;
    cliPid?: number;
    cliCwd?: string;
    constructor(sessionName: string, opts?: {
        createSession?: boolean;
        isReattach?: boolean;
        externalTarget?: HerdrExternalTarget;
    });
    static isAvailable(): boolean;
    static sessionName(sessionId: string): string;
    static hasSession(name: string): boolean;
    /**
     * Tri-state existence probe. A failed/timed-out `session list` (tryJsonCommand
     * → {ok:false}) yields 'unknown' rather than collapsing into 'missing', so a
     * transient herdr-server hiccup on restore can't be mistaken for a gone
     * session. A present-but-not-running row is a genuine zombie → 'missing'.
     */
    static probeSession(name: string): SessionProbe;
    static killSession(name: string): void;
    static listBotmuxSessions(): string[];
    get isReattach(): boolean;
    spawn(bin: string, args: string[], opts: SpawnOpts): void;
    write(data: string): void;
    sendText(text: string): void;
    sendSpecialKeys(...keys: string[]): void;
    pasteText(text: string): void;
    resize(cols: number, rows: number): void;
    onData(cb: (data: string) => void): void;
    onExit(cb: (code: number | null, signal: string | null) => void): void;
    kill(): void;
    destroySession(): void;
    getChildPid(): number | null;
    getAttachInfo(): null;
    captureCurrentScreen(): string;
    captureViewport(): string;
    getPaneSize(): {
        cols: number;
        rows: number;
    } | null;
    private ensureServer;
    private getAgent;
    private listAgents;
    private readVisibleAnsi;
    private readRecentAnsi;
    private startPolling;
    private stopPolling;
    private poll;
    /** Read herdr pane recent output and emit the delta vs. last snapshot. */
    private readAndEmitDelta;
    /**
     * Spawn one `herdr wait agent-status` child per "result settled" status
     * (done / blocked / idle). The first to fire wins → we read+emit, then
     * tear down the losers and re-arm a fresh cohort. Parallel watchers are
     * needed because the herdr CLI only accepts one --status at a time, and
     * we genuinely care about all three transitions: `done` is "turn finished
     * with output", `blocked` is "agent wants user input", `idle` is the
     * degraded form of done after herdr's UI marks it seen.
     */
    private startStatusWatcher;
    private stopStatusWatcher;
    private handleExit;
}
//# sourceMappingURL=herdr-backend.d.ts.map