# API reference

Source: https://libtmux.org/en/ocaml/latest/reference/

> Types, methods, and functions in libtmux for OCaml.

Browse the OCaml types and operations for working with tmux. Start with the core objects below, or search for a type or member.

Server 5 functions and constants

[Client](https://libtmux.org/en/ocaml/latest/reference/libtmux_unix-client/) module In Libtmux_unix 60 members

An explicit generation-bound connection. Applications retain ownership of the endpoint choice and resource lifetime.

[Client](https://libtmux.org/en/ocaml/latest/reference/libtmux_eio-client/) module In Libtmux_eio 60 members

An explicit generation-bound connection. Applications retain ownership of the endpoint choice and resource lifetime.

[Endpoint](https://libtmux.org/en/ocaml/latest/reference/libtmux-endpoint/) module 7 members

An explicit socket description. Constructing an endpoint neither reads the environment nor starts a daemon. [`Source.t`](https://libtmux.org/en/ocaml/latest/reference/libtmux-source-t/ "typealias") adds the observed daemon and connection generation.

[Source](https://libtmux.org/en/ocaml/latest/reference/libtmux-source/) module 6 members

Endpoint and observed daemon identity for one connection generation. Constructing metadata alone does not establish a live binding.

[Generation](https://libtmux.org/en/ocaml/latest/reference/libtmux-generation/) module 4 members

A random connection-generation identifier. Reconnecting creates a new generation even when the socket and server PID are unchanged.

Session 1 function or constant

[Session](https://libtmux.org/en/ocaml/latest/reference/libtmux-session/) module 15 members

A captured session and its ordered window-link contexts. A session can contain repeated links to the same global window.

Window 2 functions and constants

[Window](https://libtmux.org/en/ocaml/latest/reference/libtmux-window/) module 17 members

A global window shared by its session links. Window index and current state belong to a link, while panes and geometry belong to the window.

[Window_link](https://libtmux.org/en/ocaml/latest/reference/libtmux-window_link/) module 9 members

One captured session/index/window context. It is not a stable link incarnation across unlinking, movement or reindexing.

Pane 1 function or constant

[Pane](https://libtmux.org/en/ocaml/latest/reference/libtmux-pane/) module 23 members

A captured pane with local geometry, process metadata and a window relationship. Use [`Pane.target`](https://libtmux.org/en/ocaml/latest/reference/libtmux-pane-target-t3h1/ "function") for explicit actions; reading the observation never refreshes it.

Client 2 functions and constants

[Client_name](https://libtmux.org/en/ocaml/latest/reference/libtmux-client_name/) module 3 members

[Client_observation](https://libtmux.org/en/ocaml/latest/reference/libtmux-client_observation/) module 12 members

Hooks 1 function or constant

[Hook](https://libtmux.org/en/ocaml/latest/reference/libtmux-hook/) module 1 member

Options 1 function or constant

[Options](https://libtmux.org/en/ocaml/latest/reference/libtmux-options/) module 10 members

Version-aware option descriptors and captured scoped values. Sparse array indexes and inherited entries retain their tmux meaning.

Keys and bindings 1 function or constant

[Key](https://libtmux.org/en/ocaml/latest/reference/libtmux-key/) module 1 member

Layout and geometry 2 functions and constants

[Geometry](https://libtmux.org/en/ocaml/latest/reference/libtmux-geometry/) module 2 members

[Layout](https://libtmux.org/en/ocaml/latest/reference/libtmux-layout/) module 1 member

Environment 1 function or constant

[Environment](https://libtmux.org/en/ocaml/latest/reference/libtmux-environment/) module 5 members

Terminal capabilities 2 functions and constants

[Terminal](https://libtmux.org/en/ocaml/latest/reference/libtmux_eio-terminal/) module In Libtmux_eio 1 member

Interactive attachment using borrowed application streams. This utility addresses the current daemon explicitly and does not reuse captured targets.

[Terminal](https://libtmux.org/en/ocaml/latest/reference/libtmux_unix-terminal/) module In Libtmux_unix 1 member

Interactive attachment using borrowed application streams. This utility addresses the current daemon explicitly and does not reuse captured targets.

Commands 1 type, 5 functions and constants

[Libtmux](https://libtmux.org/en/ocaml/latest/reference/libtmux/) module 32 members

Native captured values, typed queries and explicit command descriptions.

[Command](https://libtmux.org/en/ocaml/latest/reference/libtmux-command/) module 4 members

Typed descriptions of explicit acquisition and mutation operations. Construction performs no I/O; a backend validates and admits the command.

[Created](https://libtmux.org/en/ocaml/latest/reference/libtmux-created/) module 1 member

IDs reported by a successful creation reply. Only the requested kind is newly created; the other fields can describe existing containers.

[ID](https://libtmux.org/en/ocaml/latest/reference/libtmux-id/) interface 6 members

[Operations](https://libtmux.org/en/ocaml/latest/reference/libtmux-operations/) module 49 members

Construct typed tmux operations for a backend client. Observations are immutable, mutations use explicit targets, and no command retries a mutation against another connection generation. Construction performs no I/O; the descriptions below state what execution does.

[Spawn](https://libtmux.org/en/ocaml/latest/reference/libtmux-spawn/) module 4 members

A process description with explicit argv or shell semantics, working directory and environment. Describing a process performs no I/O.

Control mode 6 functions and constants

[Output](https://libtmux.org/en/ocaml/latest/reference/libtmux-output/) module 5 members

Future observed pane bytes, local cursors and explicit continuity loss. Output cursors are unrelated to snapshot times or server-side history.

[Operation](https://libtmux.org/en/ocaml/latest/reference/libtmux_eio-operation/) module In Libtmux_eio 7 members

A retained admitted command. A cancelled waiter does not erase its eventual success, failure or uncertainty.

[Subscription](https://libtmux.org/en/ocaml/latest/reference/libtmux_eio-subscription/) module In Libtmux_eio 5 members

Bounded future-byte observation with Data/Gap/End and local cursors. Polling is local; waiting and admission belong to the backend.

[Cancellation](https://libtmux.org/en/ocaml/latest/reference/libtmux_unix-cancellation/) module 4 members

[Operation](https://libtmux.org/en/ocaml/latest/reference/libtmux_unix-operation/) module In Libtmux_unix 6 members

Retained outcomes remain inspectable after client closure, on the owning domain. Keep the handle from [`Client.submit`](https://libtmux.org/en/ocaml/latest/reference/libtmux_unix-client-submit/ "function") before [`Client.await`](https://libtmux.org/en/ocaml/latest/reference/libtmux_unix-client-await/ "function"), then read [`Operation.inspect`](https://libtmux.org/en/ocaml/latest/reference/libtmux_unix-operation-inspect/ "function"). The [hook recovery walkthrough](https://github.com/libtmux/libtmux-ocaml/blob/master/docs/hook-recovery.md) shows creation evidence after a later hook failure.

[Subscription](https://libtmux.org/en/ocaml/latest/reference/libtmux_unix-subscription/) module In Libtmux_unix 5 members

Bounded future-byte observation with Data/Gap/End and local cursors. Polling is local; waiting and admission belong to the backend.

Formats 1 function or constant

[Formats](https://libtmux.org/en/ocaml/latest/reference/libtmux-formats/) module 9 members

Queries 5 functions and constants

[Cardinality](https://libtmux.org/en/ocaml/latest/reference/libtmux-cardinality/) module 2 members

[Model](https://libtmux.org/en/ocaml/latest/reference/libtmux-model/) module 9 members

Built-in model witnesses and canonical field lookup for typed codecs. Untrusted field names must resolve against the selected model.

[Plan](https://libtmux.org/en/ocaml/latest/reference/libtmux-plan/) module 9 members

Explicit source-filter planning for a new acquisition. A plan separates supported tmux predicates from residual local evaluation; it never changes the I/O-free contract of [`Query.matching`](https://libtmux.org/en/ocaml/latest/reference/libtmux-query-matching/ "function"). Backend capture operations acquire a complete graph and do not consume these plans.

[Query](https://libtmux.org/en/ocaml/latest/reference/libtmux-query/) module 3 members

Sequence adapters and bounded cardinality checks over captured values. Matching preserves order and duplicates. Expected absence and ambiguity remain ordinary result values.

[Relation](https://libtmux.org/en/ocaml/latest/reference/libtmux-relation/) module 3 members

Typed edges in a captured graph. Many, one and optional relations are distinct; an unacquired relationship is never represented as an empty one.

Queries — Fields 1 function or constant

[Field](https://libtmux.org/en/ocaml/latest/reference/libtmux-field/) module 6 members

Sealed scalar descriptors carrying entity and value types. Descriptors read captured data and provide trusted identities for [`Expr`](https://libtmux.org/en/ocaml/latest/reference/libtmux-expr/ "module") values. Use [`Relation`](https://libtmux.org/en/ocaml/latest/reference/libtmux-relation/ "module") for graph edges.

Queries — Expressions 2 functions and constants

[Expr](https://libtmux.org/en/ocaml/latest/reference/libtmux-expr/) module In Libtmux 14 members

Inspectable predicates whose entity and operand types are checked by the compiler. Combine native closures separately with `Seq.filter`. Evaluation follows captured relationships without acquisition or hidden caches.

[Expr](https://libtmux.org/en/ocaml/latest/reference/libtmux_json-expr/) module In Libtmux_json 4 members

Portable scalar pane expressions. See the [wire subset](https://github.com/libtmux/libtmux-ocaml/blob/master/docs/query-interchange.md) for canonical fields, operators and bounds.

Snapshots 4 functions and constants

[Captured_text](https://libtmux.org/en/ocaml/latest/reference/libtmux-captured_text/) module 1 member

[Snapshot](https://libtmux.org/en/ocaml/latest/reference/libtmux-snapshot/) module 16 members

A complete immutable graph captured over an acquisition interval. Collections are replayable immutable arrays. Capturing several tmux commands does not establish an atomic transaction.

[Rendered](https://libtmux.org/en/ocaml/latest/reference/libtmux_eio-rendered/) module In Libtmux_eio

[Rendered](https://libtmux.org/en/ocaml/latest/reference/libtmux_unix-rendered/) module In Libtmux_unix

Blocking native Linux transport. No Eio scheduler is started.

Errors 5 functions and constants

[Error](https://libtmux.org/en/ocaml/latest/reference/libtmux-error/) module In Libtmux 2 members

Expected input, capture, capability and transport failures. Cancellation belongs to the chosen backend and is not converted into an ordinary error.

[Cleanup](https://libtmux.org/en/ocaml/latest/reference/libtmux_eio-cleanup/) module In Libtmux_eio

Domain-owned cleanup diagnostics shared with the blocking backend. Supply a report before setup to inspect secondary failures after native cancellation. No scheduler is needed to inspect a report.

[Decode_error](https://libtmux.org/en/ocaml/latest/reference/libtmux_json-decode_error/) module 3 members

[Error](https://libtmux.org/en/ocaml/latest/reference/libtmux_json-error/) module In Libtmux_json 1 member

Structured native failures for JSON consumers.

[Cleanup](https://libtmux.org/en/ocaml/latest/reference/libtmux_unix-cleanup/) module In Libtmux_unix 6 members

Retained failures from releasing processes and descriptors. Reports belong to their creating domain and remain readable after client closure. They preserve secondary failures without replacing a primary exception or cancellation.

Runtime adapters 3 types

[Libtmux_eio](https://libtmux.org/en/ocaml/latest/reference/libtmux_eio/) module 7 members

Concurrent Linux tmux clients using the application's Eio scheduler.

[Libtmux_json](https://libtmux.org/en/ocaml/latest/reference/libtmux_json/) module 4 members

Pure, bounded query and workspace JSON interchange.

[Libtmux_unix](https://libtmux.org/en/ocaml/latest/reference/libtmux_unix/) module 8 members

Blocking Linux tmux clients with explicit scoped cancellation.
