2026-02-12 10:29:57 +01:00
|
|
|
/**
|
2026-02-18 12:51:35 +01:00
|
|
|
* @fileoverview Factory for creating the terminal multiplexer (tmux).
|
2026-02-12 10:29:57 +01:00
|
|
|
*
|
|
|
|
|
* @module mux-factory
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import type { TerminalMultiplexer } from './mux-interface.js';
|
|
|
|
|
import { TmuxManager } from './tmux-manager.js';
|
|
|
|
|
|
|
|
|
|
/**
|
2026-02-18 12:51:35 +01:00
|
|
|
* Create a TerminalMultiplexer instance.
|
2026-02-12 10:29:57 +01:00
|
|
|
*
|
2026-02-18 12:51:35 +01:00
|
|
|
* Requires tmux to be installed. Throws with install instructions if not found.
|
2026-02-12 10:29:57 +01:00
|
|
|
*/
|
2026-02-18 12:51:35 +01:00
|
|
|
export function createMultiplexer(): TerminalMultiplexer {
|
|
|
|
|
if (!TmuxManager.isTmuxAvailable()) {
|
|
|
|
|
throw new Error('tmux not found. Install: sudo apt install tmux');
|
2026-02-12 10:29:57 +01:00
|
|
|
}
|
|
|
|
|
|
2026-02-18 12:51:35 +01:00
|
|
|
console.log('[MuxFactory] Using tmux backend');
|
|
|
|
|
return new TmuxManager();
|
2026-02-12 10:29:57 +01:00
|
|
|
}
|