Terminal & 3D Phase

XtermOrchestrator

The abstraction layer between terminals and UI. Orchestrate layouts, manage sessions, and coordinate multiple xterm.js instances through a single control plane.

TypeScript Created Aug 6, 2025 120 KB
click layouts to orchestrate

XtermOrchestrator was born from the chaos of MultiTerminals. After building a monolithic multi-terminal app, it became clear that the orchestration logic -- how terminals are laid out, created, destroyed, and coordinated -- deserved to be its own module.

This is a pure abstraction layer. It does not render terminals or manage windows. It decides where terminals go, when they are created, and how layout transitions happen. Think of it as a tiling window manager's brain, extracted into a reusable library.

Layout Management

Split views, grid layouts, focused mode, and tabbed arrangements. Switch between layouts while preserving terminal state.

Split Views

Horizontal and vertical splits with draggable dividers. Recursive splitting creates complex arrangements from simple primitives.

Session Persistence

Serialize and restore complete terminal arrangements. Close the browser, reopen, and pick up exactly where you left off.

Orchestrated Creation

Terminals are not spawned ad-hoc. The orchestrator decides placement, sizing, and lifecycle based on layout rules and policies.

TypeScript xterm.js Layout Algorithm State Machine Event Emitter JSON Serialization Binary Split Trees
// The orchestration layer sits between UI and terminals Consumer App (any UI framework) | v Orchestrator ├── LayoutEngine -- binary split tree, grid solver │ ├── SplitNode -- recursive H/V splits │ ├── GridSolver -- N terminals -> optimal grid │ └── FocusMode -- maximize one, minimize rest ├── SessionManager -- create, destroy, persist sessions │ ├── serialize() -- layout + session state -> JSON │ └── restore() -- JSON -> rebuild layout └── EventBus -- layout:changed, session:created, etc. | v Terminal Instances (xterm.js, managed externally)
120
KB Total Size
TS
Primary Language
0
Runtime Deps
4
Layout Modes