/** Prefix for sessions the daemon spawned. Anything else is adopted, never owned. */ export declare const SPAWNED_PREFIX = "dcb-"; export declare function resolveTmux(): string; /** Test seam: forget the cached binary path. */ export declare function _resetTmuxPath(p?: string | null): void; /** * Two tmux servers are involved, and they are never mixed: * * owned `-L decibel` — the daemon's own server. Every spawned session lives * here. The daemon starts it, so it starts with the daemon's scrubbed * environment (see cleanEnv), and HQ-spawned sessions never appear in, * or collide with, the user's own tmux. * user the default socket — the user's tmux. Only ever read, attached to * and interrupted (adopt); never spawned into or killed. * * DECIBEL_TMUX_SOCKET / DECIBEL_TMUX_USER_SOCKET rename them, which is how the * tests run against private servers instead of real ones. */ export type TmuxServer = 'owned' | 'user'; export declare const OWNED_SOCKET_DEFAULT = "decibel"; export declare function socketArgs(server: TmuxServer): string[]; /** Which server a session key lives on: the prefix is the ownership mark. */ /** * Terminal title for clients of the owned server (set-titles): the repo, plus * the issue label, or else a branch other than main/master. Built from the * @dcb_* options the daemon sets at spawn, which cleanLabel has already * stripped of control characters. tmux sends it as OSC 2 to every attached * client, so a Ghostty tab is titled without any title text in its command * (ISS-0210). */ export declare const TITLE_FORMAT: string; export declare function serverFor(name: string): TmuxServer; export declare function isDaemonOnlyVar(name: string): boolean; /** Names in `base` that cleanEnv drops for being the daemon's. Names only, never values. */ export declare function daemonOnlyNames(base?: NodeJS.ProcessEnv): string[]; export declare function cleanEnv(base?: NodeJS.ProcessEnv): Record; /** * tmux keeps the environment its server started with as the GLOBAL * environment and copies it into every new session. A server started before * ISS-0225 already holds the daemon's variables, so cleaning the client env * is not enough: unset them there too. Applied before every spawn and at * daemon start. */ export declare function unsetDaemonEnvArgs(base?: NodeJS.ProcessEnv): string[]; export interface TmuxResult { ok: boolean; stdout: string; stderr: string; } export declare function tmux(server: TmuxServer, args: string[], timeoutMs?: number): Promise; /** * Exact-match session target, for commands that take a SESSION target: * has-session, kill-session, attach-session. */ export declare function sessionTarget(name: string): string; /** * Exact-match target for everything that parses -t as a pane or window: * set-option, show-options, send-keys, respawn-pane. tmux 3.5a rejects a bare * `=name` there with "no such session"; the trailing colon is required * (verified 2026-09-25, and hit independently by decibel-hq's mock). */ export declare function paneTarget(name: string): string; /** * Field separator for -F output. PRINTABLE on purpose: with no LANG/LC_* in * the environment — which is exactly the launchd daemon's environment — tmux * rewrites a TAB in format output as '_', every field collapsed into the * session name, and no spawned session ever matched its project. The tests * passed because the shell running them had a locale. Pinned by a test that * lists with the locale removed. */ export declare const FIELD_SEP = "|:dcb:|"; /** * Newlines and the field separator would corrupt list output, and a label has * no business being long. Applied to every value written into a tmux option. */ export declare function cleanLabel(v: string | undefined, max?: number): string | undefined; export interface TmuxSession { name: string; project_id?: string; branch?: string; issue_label?: string; claude_session_id?: string; created?: string; cwd?: string; /** The active pane's process has exited (remain-on-exit keeps the session). */ dead: boolean; } /** * "No server" is a normal answer; "could not ask" is not. A missing socket * means no server, so no sessions. Any other failure — a server that exists * but did not answer — must NOT read as an empty list, because HQ would render * a live session as gone. It gets one retry and then throws. (A spawned session * once went unlisted for minutes while its server was plainly up; the old check * swallowed every "error connecting to" as "no server". Cause unverified.) */ export declare function isNoServer(stderr: string): boolean; /** Every session on one server. Empty when that server is not running; throws when it cannot be read. */ export declare function listSessions(server: TmuxServer): Promise; export declare function parseSessions(stdout: string): TmuxSession[]; /** * pane tty (without /dev/) → session name, across BOTH servers, for matching * claude-peers ttys. A user-server session carrying the dcb- prefix is skipped: * the prefix means "owned", and honouring it on the wrong server would route * attach and kill to a session the daemon does not own. */ export declare function paneTtyMap(): Promise>; /** Find a session by key on the server its key says it lives on. */ export declare function findSession(name: string): Promise; //# sourceMappingURL=tmux.d.ts.map