/** * Windows psmux detection and tmux-binary resolution. * * Recent psmux releases (see docs/compatibility.md in the psmux repo) close * the round-trip gap for set-option / show-options user options and the * set-window-option profile values gjc emits, which is what unblocks the * native Windows gjc --tmux path. This module detects that capability so gjc * can pick psmux when tmux is missing on Windows, and so callers can decide * whether to treat a given tmux binary as psmux (affecting e.g. the untagged * diagnostic wording and namespace handling). * * The probe is intentionally lightweight: it runs a single tmux -V (or * --version) once per process and caches the verdict. Cache invalidation * knobs: * - force: true re-probes on every call (used by tests). * - GJC_PSMUX_FORCE_DETECT=1 re-probes each call. * - GJC_PSMUX_DETECTION=off skips probing entirely. */ export declare const GJC_PSMUX_COMMAND_ENV = "GJC_PSMUX_COMMAND"; export declare const GJC_PSMUX_DETECTION_ENV = "GJC_PSMUX_DETECTION"; export declare const GJC_PSMUX_FORCE_DETECT_ENV = "GJC_PSMUX_FORCE_DETECT"; /** Names that psmux installs as the canonical executable / alias. */ export declare const PSMUX_BINARY_NAMES: readonly ["psmux", "pmux", "tmux"]; export type PsmuxSpawnRunner = (command: string, args: string[]) => { exitCode: number | null; stdout?: string; stderr?: string; }; /** * Resolves a tmux-class binary name (e.g. "psmux", "tmux") to an absolute * filesystem path or returns null when the binary cannot be located. The * default implementation uses `Bun.which`; production callers leave it * alone and unit tests inject a stub via `__setBinaryResolverForTests` * so the version-banner probe can be exercised hermetically. */ export type BinaryResolver = (candidate: string) => string | null; /** @internal Test-only seam; production code never calls this. */ export declare function __setBinaryResolverForTests(resolver: BinaryResolver | null): void; export type ExecutableIdentityResolver = (path: string) => string | null; /** @internal Test-only seam; production code never calls this. */ export declare function __setExecutableIdentityResolverForTests(resolver: ExecutableIdentityResolver | null): void; export declare function envDisabled(value: string | undefined): boolean; /** Resolve through the same identity-aware seams used by Windows alias detection. */ export declare function resolveGjcTmuxExecutablePath(command: string): string | null; export declare function resolveGjcTmuxExecutableIdentity(executablePath: string): string | null; /** * Decide whether command resolves to a psmux binary by probing its version * output. The result is cached per process unless force is set or * GJC_PSMUX_FORCE_DETECT=1. */ export declare function detectPsmux(command: string, options?: { force?: boolean; env?: NodeJS.ProcessEnv; runner?: PsmuxSpawnRunner; }): boolean; export interface ResolveGjcTmuxBinaryOptions { platform?: NodeJS.Platform; env?: NodeJS.ProcessEnv; runner?: PsmuxSpawnRunner; } export interface ResolvedTmuxBinary { command: string; isPsmux: boolean; viaExplicitOverride: boolean; } /** * Resolve the tmux command GJC should invoke. Honors the existing * GJC_TMUX_COMMAND override; on Windows when no * override is set, psmux (installed as psmux, pmux, or tmux) is picked * automatically so the default gjc --tmux flow lands on a real multiplexer. */ export declare function resolveGjcTmuxBinary(options?: ResolveGjcTmuxBinaryOptions): ResolvedTmuxBinary; /** Test-only helper: drop the in-process detection cache. */ export declare function clearPsmuxDetectionCache(): void; export interface PsmuxProbe { command: string; versionOutput: string; isPsmux: boolean; } export declare function probePsmux(command: string, options?: { env?: NodeJS.ProcessEnv; runner?: PsmuxSpawnRunner; force?: boolean; }): PsmuxProbe;