export declare const TMUX_SOCKET_PATH: string; export interface TmuxSessionInfo { sessionName: string; sessionId: string; createdAt: number; } /** * Generate a tmux session name from an auth token. * Uses SHA256 prefix to avoid leaking the token. */ export declare function tokenToSessionName(token: string): string; /** Validate sessionId: only allow alphanumeric, underscore, hyphen, max 32 chars */ export declare function isValidSessionId(sessionId: string): boolean; /** * Build a tmux session name from token + optional sessionId. * Without sessionId, behaves identically to tokenToSessionName (backward compat). */ export declare function buildSessionName(token: string, sessionId?: string): string; /** Check if a tmux session exists */ export declare function hasSession(name: string): Promise; /** Configure tmux session options for web terminal usage. * Note: set-option does NOT support the = exact-match prefix, so use bare name. */ export declare function configureSession(name: string): Promise; /** Create a new tmux session (detached) */ export declare function createSession(name: string, cols: number, rows: number, cwd: string): Promise; /** * Capture scrollback buffer with ANSI escape sequences preserved. * Returns the last 10000 lines of the pane. */ export declare function captureScrollback(name: string): Promise; /** Resize tmux window to match terminal dimensions */ export declare function resizeSession(name: string, cols: number, rows: number): Promise; /** Kill a tmux session */ export declare function killSession(name: string): Promise; /** List all tmux sessions belonging to a given token */ export declare function listSessions(token: string): Promise; /** Clean up idle tmux sessions whose last activity exceeds the given TTL (hours) */ export declare function cleanupStaleSessions(ttlHours: number): Promise; /** 获取 tmux session 当前活动 pane 的工作目录 */ export declare function getCwd(sessionName: string): Promise; /** 获取 tmux pane 当前运行的命令名称 */ export declare function getPaneCommand(sessionName: string): Promise; /** Check if tmux is available on the system (sync — startup only) */ export declare function isTmuxAvailable(): boolean; /** * Clean up orphaned process trees from dead tmux sessions. * * With KillMode=process, tmux child processes (bash → claude → plugins) survive * service restarts. When a tmux session is killed (by cleanup or manually), its * child processes may keep running as orphans. This function identifies tmux server * processes in the service cgroup whose sessions no longer exist and kills their * entire process trees. * * Called once at startup. */ export declare function cleanupOrphanedProcesses(): Promise;