/**
 * ProviderCliAdapter — Script-based CLI Adapter
 *
 * All CLI providers use versioned scripts (like IDE providers).
 * Scripts are Node.js functions that receive PTY buffer data and return structured results.
 *
 * Required scripts in scripts/{version}/scripts.js:
 *   - detectStatus(input)  → AgentStatus string ('idle' | 'generating' | 'waiting_approval')
 *   - parseSession(input)  → ReadChatResult { messages, status, activeModal, ... }
 *   - parseApproval(input) → ModalInfo | null
 *
 * provider.json contract:
 *   type, name, category: 'cli', binary, spawn, approvalKeys
 *   compatibility: [{ ideVersion, scriptDir }]  ← versioned scripts
 */
import type { CliAdapter } from '../cli-adapter-types.js';
import { type PtyRuntimeMetadata, type PtyTransportFactory } from './pty-transport.js';
import { type CliProviderModule, type CliScripts, type CliSessionStatus } from './provider-cli-shared.js';
import { type ProviderResolutionMeta } from './provider-cli-config.js';
export { normalizeCliProviderForRuntime, type CliApprovalInput, type CliChatMessage, type CliProviderModule, type CliScreenLine, type CliScreenSnapshot, type CliScriptInput, type CliScripts, type CliSessionStatus, type CliStatusInput, type CliTraceEntry, } from './provider-cli-shared.js';
export declare function appendBoundedText(current: string, chunk: string, maxChars: number): string;
export declare class ProviderCliAdapter implements CliAdapter {
    private extraArgs;
    readonly cliType: string;
    readonly cliName: string;
    workingDir: string;
    private provider;
    private ptyProcess;
    private transportFactory;
    private currentStatus;
    private onStatusChange;
    private responseBuffer;
    private recentOutputBuffer;
    private isWaitingForResponse;
    private activeModal;
    private parseErrorMessage;
    private responseTimeout;
    private idleTimeout;
    private ready;
    private startupBuffer;
    private startupParseGate;
    private startupSettleTimer;
    private spawnAt;
    private startupFirstOutputAt;
    private onPtyDataCallback;
    private pendingOutputParseChunks;
    private pendingOutputParseTimer;
    private ptyOutputChunks;
    private ptyOutputFlushTimer;
    private pendingTerminalQueryTail;
    private lastOutputAt;
    private lastNonEmptyOutputAt;
    private lastScreenChangeAt;
    private lastScreenSnapshot;
    private lastScreenText;
    private lastScreenSnapshotReadAt;
    private serverConn;
    private logBuffer;
    private lastApprovalResolvedAt;
    private approvalTransitionBuffer;
    private approvalExitTimeout;
    private pendingScriptStatus;
    private pendingScriptStatusSince;
    private pendingScriptStatusTimer;
    private settleTimer;
    private settledBuffer;
    private submitPendingUntil;
    private responseSettleIgnoreUntil;
    private responseEpoch;
    private submitRetryTimer;
    private submitRetryUsed;
    private submitRetryPromptSnippet;
    private idleFinishCandidate;
    private finishRetryTimer;
    private finishRetryCount;
    private resizeSuppressUntil;
    private statusHistory;
    private cliScripts;
    private runtimeSettings;
    /** Full accumulated ANSI-stripped PTY output */
    private accumulatedBuffer;
    /** Full accumulated raw PTY output (with ANSI) */
    private accumulatedRawBuffer;
    /** Current visible terminal screen snapshot */
    private terminalScreen;
    private static readonly MAX_RESPONSE_BUFFER;
    private static readonly MAX_RECENT_OUTPUT_BUFFER;
    private responseBufferDroppedChars;
    private recentOutputDroppedChars;
    private accumulatedBufferDroppedChars;
    private accumulatedRawBufferDroppedChars;
    /** Max accumulated buffer size. Sized to comfortably hold a single long
     *  Hermes turn (tool calls + reasoning + final bubble) without the
     *  rolling window pushing the turn's ╭─ opening line out of view. */
    private static readonly MAX_ACCUMULATED_BUFFER;
    private currentTurnScope;
    private traceEntries;
    private traceSeq;
    private traceSessionId;
    private parsedStatusCache;
    private static readonly SCREEN_SNAPSHOT_MIN_INTERVAL_MS;
    private static readonly MAX_TRACE_ENTRIES;
    private readonly providerResolutionMeta;
    private static readonly FINISH_RETRY_DELAY_MS;
    private static readonly MAX_FINISH_RETRIES;
    private getBufferState;
    private recordBoundedAppendDrop;
    private readTerminalScreenText;
    private shouldReadTerminalScreenSnapshot;
    private resetTerminalScreen;
    private getFreshParsedStatusCache;
    private providerOwnsTranscript;
    private shouldUseFullProviderTranscriptContext;
    private getIdleFinishConfirmMs;
    private getStatusActivityHoldMs;
    private setStatus;
    private clearIdleFinishCandidate;
    private armIdleFinishCandidate;
    private recordTrace;
    private resetTraceSession;
    private readonly timeouts;
    private readonly approvalKeys;
    private readonly sendDelayMs;
    private readonly sendKey;
    private readonly submitStrategy;
    private readonly requirePromptEchoBeforeSubmit;
    private static readonly SCRIPT_STATUS_DEBOUNCE_MS;
    constructor(provider: CliProviderModule, workingDir: string, extraArgs?: string[], transportFactory?: PtyTransportFactory);
    /** Inject CLI scripts after construction (e.g. when resolved by ProviderLoader) */
    setCliScripts(scripts: CliScripts): void;
    /** Refresh provider scripts/config used by this adapter without restarting the PTY runtime. */
    refreshProviderDefinition(provider: CliProviderModule): void;
    updateRuntimeSettings(settings: Record<string, any>): void;
    setServerConn(serverConn: any): void;
    setOnStatusChange(callback: () => void): void;
    setOnPtyData(callback: (data: string) => void): void;
    private flushPendingOutputParse;
    spawn(): Promise<void>;
    private handleOutput;
    private resolveStartupState;
    private scheduleStartupSettleCheck;
    private scheduleSettle;
    private armApprovalExitTimeout;
    private shouldRetryFinishResponse;
    private hasRecentInteractiveActivity;
    private shouldDeferIdleTimeoutFinish;
    private waitForInteractivePrompt;
    private clearAllTimers;
    private clearStaleIdleResponseGuard;
    private hasMeaningfulResponseBuffer;
    private evaluateSettled;
    private applyPendingScriptStatusDebounce;
    private applyHoldGenerating;
    private applyWaitingApproval;
    private applyGenerating;
    private applyIdle;
    private finishResponse;
    private maybeCommitVisibleIdleTranscript;
    private commitCurrentTranscript;
    private runParseSession;
    private runDetectStatus;
    private runParseApproval;
    private hasActionableApproval;
    private projectEffectiveStatus;
    getStatus(options?: {
        allowParse?: boolean;
    }): CliSessionStatus;
    /**
     * Script-based full parse — returns ReadChatResult.
     * Called by command handler / dashboard for rich content rendering.
     */
    getScriptParsedStatus(): any;
    invokeScript(scriptName: string, args?: Record<string, any>): Promise<any>;
    private parseCurrentTranscript;
    /** Whether this adapter has CLI scripts loaded */
    hasCliScripts(): boolean;
    /**
     * Resolves an action (like 'fix' lint error) from the dashboard.
     * Uses resolveAction script if available, otherwise falls back to standard text.
     */
    resolveAction(data: any): Promise<void>;
    private isSubmitStuck;
    private writeToPty;
    private resetPendingSendState;
    private commitSendUserTurn;
    private armResponseTimeout;
    private writeSubmitKeyForRetry;
    private retrySubmitIfStuck;
    private retryImmediateSubmitIfStuck;
    private submitSendKey;
    private submitImmediatePrompt;
    private waitForEchoAndSubmit;
    sendMessage(text: string): Promise<void>;
    getPartialResponse(): string;
    getDebugSnapshot(): Record<string, unknown>;
    getRuntimeMetadata(): PtyRuntimeMetadata | null;
    updateRuntimeMeta(meta: Record<string, unknown>, replace?: boolean): void;
    cancel(): void;
    saveAndStop(): Promise<void>;
    private waitForStopped;
    shutdown(): void;
    detach(): void;
    clearHistory(): void;
    isProcessing(): boolean;
    isReady(): boolean;
    writeRaw(data: string): Promise<void>;
    resolveModal(buttonIndex: number): void;
    resize(cols: number, rows: number): void;
    private getParsedDebugState;
    getDebugState(): Record<string, any>;
    getTraceState(limit?: number): Record<string, any>;
    getProviderResolutionMeta(): ProviderResolutionMeta;
}
