term-session 0.9.3-alpha

Generic terminal session reproducer: run a PTY in a detached server and attach any number of terminals, locally or over SSH.
Documentation
# term-session

A layout-agnostic, headless terminal session host and multiplexer.

`term-session` provides the persistence layer for terminal applications. It operates similarly to `tmux` or `GNU screen`, ensuring that running processes survive client disconnects. Unlike traditional window managers, `term-session` enforces **no layout paradigm**. It is a pure session daemon.

## Usage

Build and run from source (Rust 1.85+, edition 2024; no extra toolchain needed):

```sh
cargo run --release --bin term-session -- term-wm                        # attach to default/main, auto-spawning a server
cargo run --release --bin term-session -- --channel work -- vim          # attach to (or spawn) the "work" channel
cargo run --release --bin term-session -- --server --channel work -- vim # start a dedicated server daemon
```

Multiple terminals can attach to the same channel to share one session.

In client mode `term-session` first probes the channel for a live server and, if none is running, spawns a detached one automatically (`connect_or_spawn_server`). The program to run is forwarded to the server at spawn time. The PTY starts at a default size and the server resizes it on demand to the smallest geometry across attached clients. The channel can also be set via the `TERM_WM_CHANNEL` environment variable.

## Architecture & Capabilities

* **Concurrent Display Heads:** Supports multiple independent clients connecting to and rendering a single running session simultaneously.
* **Muxio IPC Integration:** Utilizes the Muxio IPC framework and Bitcode serialization over OS-native transports (Linux abstract sockets, macOS `/tmp`, Windows named pipes) to route PTY state between the background server and attached clients.
* **Shared Mechanics:** Reuses a large part of `term-wm`'s internals — the PTY engine (`term-wm-pty-engine`: spawning, scrollback tracking, `vt100` parsing), the input event types (`term-wm-events`), and the crossterm input adapter (`term-wm-crossterm-adapter`). `term-session` does **not** produce the window manager: there is no layout engine, no tiling, and no window chrome — only the persistence and multiplexing layer.

## Platform Notes

* **macOS & Linux:** The auto-spawned server detaches into its own session via `setsid()`, so it survives terminal closure and client disconnects. (Other Unix-like systems have not been tested.)
* **Windows:** `term-session` works on Windows, but it does **not** currently auto-daemonize. The server is spawned with `CREATE_NO_WINDOW` (which suppresses the console window) rather than a full process-session detachment, so the server process does not fully detach from the launching console's lifetime the way it does on macOS and Linux.

## Integration with term-wm

To deploy a persistent, tiling terminal workspace, run `term-wm` as a child process inside `term-session`. This architecture guarantees that the window manager and its layout state survive terminal emulator restarts or SSH disconnects.