/** * Multiplexer abstraction layer * * Provides a unified interface for terminal multiplexers (tmux, zellij, etc.) * to spawn and manage panes for child agent sessions. */ import type { MultiplexerConfig, MultiplexerLayout } from '../config/schema'; export interface PaneResult { success: boolean; paneId?: string; } /** * Core multiplexer interface * Implementations: TmuxMultiplexer, ZellijMultiplexer */ export interface Multiplexer { readonly type: 'tmux' | 'zellij'; /** * Check if the multiplexer binary is available on the system */ isAvailable(): Promise; /** * Check if currently running inside a multiplexer session */ isInsideSession(): boolean; /** * Spawn a new pane running the given command * @param sessionId - The OpenCode session ID to attach to * @param description - Human-readable description for the pane * @param serverUrl - The OpenCode server URL to attach to * @param directory - The project directory to attach from */ spawnPane(sessionId: string, description: string, serverUrl: string, directory: string): Promise; /** * Close a pane by its ID * @param paneId - The pane ID returned by spawnPane * @returns true if successfully closed */ closePane(paneId: string): Promise; /** * Apply layout to rebalance panes * @param layout - The layout type to apply * @param mainPaneSize - Percentage for main pane (for main-* layouts) */ applyLayout(layout: MultiplexerLayout, mainPaneSize: number): Promise; } /** * Factory function type for creating multiplexer instances */ export type MultiplexerFactory = (config: MultiplexerConfig) => Multiplexer; /** * Server health check utility (shared across implementations) */ export declare function isServerRunning(serverUrl: string, timeoutMs?: number, maxAttempts?: number): Promise;