import { type SessionNotification } from "@agentclientprotocol/sdk";
import type { CliProviderAdapter, ProviderEvent, ProviderAuthStatus, ProviderLoginResult, ProviderLogoutResult, ProviderId, ProviderInfo, ProviderModelInfo, ProviderSession, RuntimeMode, StartSessionOptions } from "./contracts.js";
type AcpProviderAuthKind = "acp";
export interface AcpProviderConfig {
    id: ProviderId;
    providerType?: ProviderId;
    ownerUserId?: string;
    name: string;
    description: string;
    command: string;
    args?: string[];
    env?: Record<string, string>;
    modes?: RuntimeMode[];
    auth?: AcpProviderAuthKind | false;
}
export declare class AcpProvider implements CliProviderAdapter {
    readonly id: ProviderId;
    readonly providerType: ProviderId;
    readonly ownerUserId?: string;
    readonly info: ProviderInfo;
    private readonly config;
    private readonly authKind;
    private readonly sessions;
    private readonly emitter;
    private replayableEvents;
    private authLoginProcess;
    private cachedModels;
    private cachedAuthStatus;
    private authProbeInFlight;
    private activeLoginAuthProbeInFlight;
    constructor(config: AcpProviderConfig);
    checkAvailability(): Promise<boolean>;
    listModels(): Promise<ProviderModelInfo[]>;
    getAuthStatus(): Promise<ProviderAuthStatus>;
    private _computeAuthStatus;
    startLogin(): Promise<ProviderLoginResult>;
    private startCodexDeviceLogin;
    private checkProviderAuthenticated;
    private getProviderCliAuthenticated;
    private hasProviderCliLogout;
    /**
     * Returns true when Codex has local auth.json credentials that can be cleared
     * from the UI.
     */
    private hasCodexAuthFile;
    private hasLocalProviderCredential;
    private hasEnvironmentCredential;
    sendLoginInput(input: string): void;
    logout(): Promise<ProviderLogoutResult>;
    startSession(options: StartSessionOptions): Promise<ProviderSession>;
    sendTurn(sessionId: string, message: string, attachments?: string[]): Promise<void>;
    interruptTurn(sessionId: string): Promise<void>;
    respondToApproval(sessionId: string, requestId: string, approved: boolean): Promise<void>;
    dispose(): Promise<void>;
    stopSession(sessionId: string): Promise<void>;
    onEvent(handler: (event: ProviderEvent) => void): () => void;
    emitEvent(event: ProviderEvent): void;
    private pruneReplayableEvents;
    handleSessionUpdate(sessionId: string, params: SessionNotification): void;
    private getSession;
    /**
     * Merge a `tool_call` / `tool_call_update` frame into the accumulated raw
     * object for that toolCallId and return the merged view. Per the ACP spec,
     * `content`/`locations` replace their collection while scalar fields update,
     * so we overwrite any field the frame actually carries (skipping null/absent).
     * Returns the raw update itself if the session state isn't tracked yet.
     */
    private mergeToolCall;
    private probeAcpAuth;
}
export declare function loadAcpProviderConfigs(): AcpProviderConfig[];
export {};
//# sourceMappingURL=acp-provider.d.ts.map