/** True if tmux is installed and reachable on PATH. */ export declare function available(): boolean; /** Session name from the surrounding tmux environment. Throws if not inside tmux. */ export declare function currentSession(): string; /** Ensure a detached tmux session exists; creates it if absent. A detached session has no client * to size it, and some tmux builds then treat its window as sizeless — so `split-window` fails * with "size missing". Give it an explicit initial size; tmux resizes to the real client on attach. */ export declare function ensureSession(session: string, cwd: string): void; /** True if a window named `name` exists in `session`. Name-based — fragile under renames; prefer * {@link windowAliveRef} when you hold a stable `@N` ID. Kept for name-based discovery/cleanup. */ export declare function windowAlive(session: string, name: string): boolean; /** True if a window with the stable ID `windowId` (`@N`) still exists. Window IDs are server-global, * so we test exact membership in the full window list — surviving renames, unlike {@link windowAlive} * (name match). (Don't use `display-message -t`: for a stale target it silently falls back to the * current window instead of erroring, so it can't detect a closed window.) */ export declare function windowAliveRef(windowId: string): boolean; export type PaneState = "running" | "exited"; /** Authoritative process state for a stable pane ID. A successful full-server listing that no * longer contains the pane proves exit; `pane_dead=1` also handles `remain-on-exit` configurations. * Provider/permission failures throw instead of turning uncertainty into a false exit. */ export declare function paneState(paneId: string): PaneState; /** Bounded polling over tmux's authoritative pane inventory. */ export declare function waitForPaneExit(paneId: string, opts?: { timeoutMs?: number; pollMs?: number; }): Promise; /** The stable refs for a freshly-opened window: its window ID (`@N`) and the ID of its initial * (only) pane (`%N`). Both survive renames/reorders — drive later close/split/send/refs calls off * these, not the mutable `session:name` target or pane indexes. */ export interface WindowRefs { windowId: string; paneId: string; } /** Open a new tmux window `name` in `session` running `command` (a shell string). * Created detached (unfocused) by default; pass `focus: true` to switch to it. * Returns the stable window ID (`@N`) and its initial pane ID (`%N`). */ export declare function openWindow(session: string, name: string, command: string, cwd: string, opts?: { focus?: boolean; }): WindowRefs; /** Split `target` (a window ID `@N`, or session:window) creating a new pane running `command`. * Returns the new pane's stable ID (`%N`). Direction convention matches {@link Tab.split.direction}: * `"horizontal"` → stacked top/bottom rows (tmux `-v`, the default); * `"vertical"` → side-by-side columns (tmux `-h`). * `ratio` is the first pane's fraction — the new pane gets `(1 - ratio)`. */ export declare function splitWindow(target: string, command: string, cwd: string, direction: "vertical" | "horizontal", ratio?: number): string; /** Focus a window by target (`session:name` or window ID). */ export declare function selectWindow(target: string): void; /** Kill a tmux window by target (window ID `@N`, or `session:name`). Idempotent: already-gone is a no-op. */ export declare function closeWindow(target: string): void; /** Window names open in `session`, or `[]` if unreachable. */ export declare function listWindows(session: string): string[]; /** Stable window IDs (`@N`) of every window in `session` whose name is exactly `label`. */ export declare function windowRefs(session: string, label: string): string[]; /** Shell command string that runs `command args` with `env -i` isolation — only the given * `env` entries reach the process (the tmux server's inherited env is stripped). */ export declare function isolatedCommand(env: Record, command: string, args: string[]): string; /** Shell command string that runs `command args` with extra `env` merged into the inherited env. */ export declare function mergedCommand(env: Record, command: string, args: string[]): string; /** Wrap a secret-bearing command body (e.g. an {@link isolatedCommand} `env -i KEY='val' … cmd`) in a * private launcher script and return a `bash` invocation of it. tmux runs the command we hand it as a * process argument — visible to any local `ps`/`tmux list-panes` — so passing the rendered `env` * inline would leak the agent's creds + control token (and any model-provider key). Instead the body * lives in a fresh 0o700 temp dir as a 0o600 (owner-only) script; tmux only ever sees `bash `, * and the secrets are read from the file, never the command line. */ export declare function privateLaunch(commandBody: string): string; /** Type literal text into a tmux target. * `-l` bypasses tmux's key-name lookup; `--` guards against text starting with `-`. */ export declare function send(text: string, target: string): void; /** Send a named key sequence (e.g. `"Enter"`, `"C-c"`) to a tmux target. * `--` guards against key names starting with `-`. */ export declare function sendKey(key: string, target: string): void; //# sourceMappingURL=driver.d.ts.map