import type { PtySpawnOptions, PtyRuntimeTransport } from './pty-transport.js';
import type { TerminalScreen } from './terminal-screen.js';
import { type CliProviderModule } from './provider-cli-shared.js';
export interface CliSpawnPlan {
    binaryPath: string;
    allArgs: string[];
    shellCmd: string;
    shellArgs: string[];
    ptyOptions: PtySpawnOptions;
    isWin: boolean;
    useShell: boolean;
}
export declare function resolveCliSpawnPlan(options: {
    provider: CliProviderModule;
    runtimeSettings: Record<string, any>;
    workingDir: string;
    extraArgs: string[];
    extraEnv?: Record<string, string>;
}): CliSpawnPlan;
/**
 * Cols/rows for a PTY spawn. Defaults to the session-host terminal size; the
 * spec driver may override per-instance.
 */
export interface CliSpawnGeometry {
    cols?: number;
    rows?: number;
}
/**
 * Core spawn-plan resolution from already-flattened spawn parts — the single
 * source of truth for binary resolution (findBinary: PATH + npm-global / Node
 * dir fallback), `{{workingDir}}` token substitution, shell wrapping
 * (script-shims / non-absolute / non-native binaries), and env sanitization +
 * TERMINAL_CWD. Both the legacy provider-module path (resolveCliSpawnPlan) and
 * the spec/FSM path (FsmDriver.buildAdapterOpts) feed into this so the two
 * spawn paths can never diverge.
 */
export declare function resolveCliSpawnPlanFromParts(options: {
    /** Raw command from the spec/provider (`binary` / `spawn.command`), or an
     *  operator-configured executable path override. */
    command: string;
    /** Base launch args declared by the spec/provider (`spawn_args` /
     *  `spawn.args`). */
    baseArgs?: string[];
    /** When true, always wrap the launch in a login shell. */
    shell?: boolean;
    /** Base env declared by the spec/provider (`env` / `spawn.env`). */
    baseEnv?: Record<string, string>;
    workingDir: string;
    /** Per-launch extra args (e.g. resume session id) appended after baseArgs. */
    extraArgs?: string[];
    extraEnv?: Record<string, string>;
    geometry?: CliSpawnGeometry;
}): CliSpawnPlan;
export declare function buildCliLoginShellRetry(plan: Pick<CliSpawnPlan, 'binaryPath' | 'allArgs'>): {
    shellCmd: string;
    shellArgs: string[];
};
export declare function getCliSpawnErrorHint(message: string, shellCmd: string, isWin: boolean): string | null;
export declare function respondToCliTerminalQueries(options: {
    ptyProcess: PtyRuntimeTransport | null;
    pendingTail: string;
    data: string;
    terminalScreen: TerminalScreen;
}): string;
