import type { ImageContent, Model } from '../ai/types.js';
import type { AgentSessionEvent, SessionStats } from '../app/agent-session.js';
import type { ThinkingLevel } from '../core/core-types.js';
import type { PendingRemoteApproval, RemoteApprovalController } from './approval-controller.js';
import { type SequencedEvent } from './event-buffer.js';
import { type RemoteSessionRegistryOptions, type RemoteSessionSummary, type ResolveTargetResult } from './session-registry.js';
export interface DesktopRemoteControlSession {
    subscribe(listener: (event: AgentSessionEvent) => void | Promise<void>): () => void;
    prompt(text: string, options?: {
        images?: ImageContent[];
    }): Promise<void>;
    steer(text: string, images?: ImageContent[]): Promise<void>;
    followUp(text: string, images?: ImageContent[]): Promise<void>;
    abort(): Promise<void>;
    switchSession(sessionPath: string): Promise<boolean>;
    newSession(options?: {
        parentSession?: string;
    }): Promise<boolean>;
    setSessionName(name: string): void;
    getSessionStats(): SessionStats;
    getSteeringMessages(): readonly string[];
    getFollowUpMessages(): readonly string[];
    messages: readonly unknown[];
    model?: Model<any>;
    thinkingLevel: ThinkingLevel;
    isStreaming: boolean;
    isCompacting: boolean;
    pendingMessageCount: number;
    sessionFile?: string;
    sessionId: string;
    sessionName?: string;
}
export interface RemoteControlSnapshot {
    session: RemoteSessionSummary;
    state: {
        model?: Pick<Model<any>, 'provider' | 'id'>;
        thinkingLevel: ThinkingLevel;
        isStreaming: boolean;
        isCompacting: boolean;
        pendingMessageCount: number;
        steeringMessages: readonly string[];
        followUpMessages: readonly string[];
        sessionStats: SessionStats;
    };
    messages: readonly unknown[];
    pendingApprovals: Array<PendingRemoteApproval<unknown>>;
    latestSeq: number;
}
export type DesktopRemoteControlEvent = {
    type: 'session_event';
    event: AgentSessionEvent;
} | {
    type: 'approval_pending';
    approval: PendingRemoteApproval<unknown>;
} | {
    type: 'approval_resolved';
    approvalId: string;
    choice: string;
} | {
    type: 'session_snapshot';
    snapshot: RemoteControlSnapshot;
};
export type SequencedDesktopRemoteControlEvent = SequencedEvent<DesktopRemoteControlEvent>;
export type AttachResult = {
    kind: 'attached';
    snapshot: RemoteControlSnapshot;
    replay: SequencedDesktopRemoteControlEvent[];
} | Extract<ResolveTargetResult, {
    kind: 'picker' | 'create' | 'not_found';
}> | {
    kind: 'cancelled';
};
export type RemoteControlCommand = {
    type: 'get_snapshot';
} | {
    type: 'list_sessions';
} | {
    type: 'attach';
    lastSeq?: number;
    requestedSessionId?: string;
    requestedSessionPath?: string;
} | {
    type: 'select_session';
    sessionPath: string;
} | {
    type: 'new_session';
    parentSession?: string;
} | {
    type: 'prompt';
    message: string;
    images?: ImageContent[];
} | {
    type: 'steer';
    message: string;
    images?: ImageContent[];
} | {
    type: 'follow_up';
    message: string;
    images?: ImageContent[];
} | {
    type: 'abort';
} | {
    type: 'approval_response';
    approvalId: string;
    choice: string;
} | {
    type: 'set_session_name';
    name: string;
};
export type RemoteControlCommandResult = {
    kind: 'ok';
} | {
    kind: 'snapshot';
    snapshot: RemoteControlSnapshot;
} | {
    kind: 'sessions';
    sessions: RemoteSessionSummary[];
} | {
    kind: 'attached';
    snapshot: RemoteControlSnapshot;
    replay: SequencedDesktopRemoteControlEvent[];
} | {
    kind: 'picker';
    reason: 'ambiguous';
    sessions: RemoteSessionSummary[];
} | {
    kind: 'create';
} | {
    kind: 'not_found';
    requestedSessionId: string;
} | {
    kind: 'cancelled';
} | {
    kind: 'approval_missing';
    approvalId: string;
};
export interface DesktopRemoteControlRuntimeOptions extends RemoteSessionRegistryOptions {
    session: DesktopRemoteControlSession;
    approvalController: RemoteApprovalController<any>;
    eventCapacity?: number;
}
export declare class DesktopRemoteControlRuntime {
    private readonly session;
    private readonly approvalController;
    private readonly registry;
    private readonly eventBuffer;
    private readonly listeners;
    private controllerAttached;
    private remoteApprovalActive;
    private readonly unsubscribeSession;
    private readonly unsubscribeApprovals;
    constructor(options: DesktopRemoteControlRuntimeOptions);
    isControllerAttached(): boolean;
    shouldRouteApprovalsToRemote(): boolean;
    subscribe(listener: (event: SequencedDesktopRemoteControlEvent) => void): () => void;
    detach(): void;
    close(): void;
    attach(options: {
        lastSeq?: number;
        requestedSessionId?: string;
        requestedSessionPath?: string;
    }): Promise<AttachResult>;
    handleCommand(command: RemoteControlCommand): Promise<RemoteControlCommandResult>;
    private publish;
    private buildSnapshot;
    private listAvailableSessions;
    private buildLiveSessionSummary;
}
//# sourceMappingURL=desktop-runtime.d.ts.map