/** * Environment check: is the system ssh present and what does it support * * The result is computed once per process: the client version doesn't * change on the fly, and spawning a process for every command would be wasteful. */ import { type RunnerConfig, type SshCapabilities } from './ssh-args.js'; /** Parsed OpenSSH version */ export interface SshVersion { major: number; minor: number; /** Original string, as printed by ssh -V */ raw: string; } /** What the detected client supports */ export interface SshRuntime { /** Whether the binary was found */ available: boolean; version?: SshVersion; /** Whether connection multiplexing is supported */ multiplexing: boolean; /** Why multiplexing is unavailable */ multiplexingDisabledReason?: string; /** Whether SSH_ASKPASS_REQUIRE=force is supported — without it a password can't be supplied */ askpassForce: boolean; /** * Whether file transfers run over SFTP rather than the classic scp protocol. * This determines the fate of the remote path: in the classic protocol * it's parsed by the server's shell, in SFTP mode the destination path is * taken literally. */ scpOverSftp: boolean; /** Directory for control sockets and the askpass script */ controlDir: string; } /** * Parse the output of `ssh -V` * * Examples: "OpenSSH_10.2p1, LibreSSL 3.3.6", * "OpenSSH_8.9p1 Ubuntu-3ubuntu0.4, OpenSSL 3.0.2", * "OpenSSH_for_Windows_8.6p1, LibreSSL 3.4.3" */ export declare function parseSshVersion(output: string): SshVersion | undefined; /** * Compute capabilities from version and platform — a pure function */ export declare function computeRuntime(input: { platform: NodeJS.Platform; version?: SshVersion; controlDir: string; }): SshRuntime; /** * Directory for control sockets. * * Not the system temp directory: a predictable name in a world-readable * location is an opportunity to plant a socket of one's own. 0700 * permissions leave access to the owner only. */ export declare function resolveControlDir(env?: NodeJS.ProcessEnv): string; /** * Detect the system ssh and its capabilities (result is cached) */ export declare function detectRuntime(options?: { force?: boolean; }): Promise; /** Reset the cache — used in tests */ export declare function resetRuntimeCache(): void; /** Capabilities in the shape expected by argument building */ export declare function toCapabilities(runtime: SshRuntime): SshCapabilities; /** * Check that the environment can handle this profile. * * @throws SSHUnsupportedConfigError if the profile needs secret input * and the client can't do that */ export declare function assertProfileSupported(config: RunnerConfig, runtime: SshRuntime): void;