import { type PackageManager, type PlatformInfo } from './detect-platform.js'; export interface TmuxResult { installed: boolean; version?: string; /** True iff we ran an installer (vs. tmux was already present). */ freshInstall: boolean; /** * False only when the version probe authoritatively returns ENOENT. True also * covers timeout/EMFILE/EACCES, where presence cannot be disproved and startup * must not hard-fail with a misleading PATH diagnosis. Lets the start-gate * distinguish "tmux genuinely absent" from "probe got no answer" (see * shouldHardFailStartupForMissingTmux). Set on every return. */ binaryPresent?: boolean; /** Which strategy actually ran the install. */ strategy?: PackageManager; /** When installed=false: human-readable reason for the caller's warning. */ reason?: string; /** When installed=false: the manual command we'd have run, for the warning. */ manualCommand?: string; } export type TmuxFunctionalProbe = { ok: true; version: string; } | { ok: false; reason: string; binaryPresent: boolean; retryable: boolean; version?: string; }; export declare function tmuxEnv(env?: NodeJS.ProcessEnv): NodeJS.ProcessEnv; export interface TmuxGlobalEnvScrubResult { /** False means no tmux server answered (or tmux was temporarily unavailable). */ serverFound: boolean; removed: string[]; failed: string[]; } /** * Remove botmux-managed values from an already-running tmux server's global * environment. This repairs servers started by pre-isolation botmux builds, * including a user-owned server that survives while no bmx-* session exists. * Running panes keep their process environments; only future panes inherit the * cleaned table. * * socketName exists for isolated tests. Production intentionally targets the * default server after tmuxEnv() strips a possibly-stale parent $TMUX pointer. */ export declare function scrubTmuxServerGlobalEnv(socketName?: string): TmuxGlobalEnvScrubResult; /** * Functional tmux probe — actually starts a tmux server and tears it down. * * `tmux -V` only checks the binary, not whether tmux can create a socket and * fork a session. Real-world failures we've seen: (1) /tmp owned by another * user, (2) broken ~/.tmux.conf, (3) the binary is a libc-mismatched dynamic * link, (4) tmux 1.x on minimal images missing libevent. All of those make * `tmux -V` succeed but every `new-session` / `attach-session` fail, which * floods daemon-error.log and leaves the worker with no working backend. * * Uses a unique `-L ` so the probe never clobbers an existing * user tmux server. Stderr is captured (not inherited) so the failure * reason can surface in the bootstrap warning without spilling onto the * user's terminal. */ export declare function probeTmuxFunctional(): TmuxFunctionalProbe; /** * Worker-side gate probe with a short exponential backoff. A daemon restart can * wake many worker processes at once; if the host is briefly under fd/process * pressure, one failed spawn must not immediately become a user-facing hard * gate. The retries stay local to the worker and callers should still stagger * their restart path so all workers do not retry in lockstep. */ export declare function probeTmuxFunctionalWithRetry(opts?: { attempts?: number; baseDelayMs?: number; }): TmuxFunctionalProbe; /** Build the install argv for a given package manager. Pure: returns argv[] * ready for spawnSync, no side effects. Returns undefined if escalation * isn't possible. */ export declare function buildInstallArgv(pm: PackageManager, pkg: string, info: PlatformInfo): string[] | undefined; /** apt-get specifically needs an updated package list on minimal images * before the install will find tmux. This is NOT part of buildInstallArgv * (which is pure) — it runs once just before the apt install attempt. * Failure here is non-fatal; the actual install will fail loudly if it * can't find the package. */ export declare function aptUpdateBeforeInstall(info: PlatformInfo): void; /** Suggest the manual command we'd have run, for the failure message. */ export declare function suggestManualCommand(pm: PackageManager, pkg: string): string; export declare function runInstall(argv: string[]): boolean; export declare function ensureTmux(info?: PlatformInfo): Promise; //# sourceMappingURL=ensure-tmux.d.ts.map