On this page
Swift API reference
983 symbols, extracted from source. Every type name in a signature links to its own entry; every cross-reference in a doc comment resolves against the same table.
Server 4 types
Session 2 types
Window 6 types
Where a new window goes relative to one that is already there.
WindowID 12 members A tmux window id such as @1.
The session-local identity of one link to a window.
Window 12 membersOne tmux window, independent of every session that links it.
WindowLink 10 membersOne session-local link to a window.
WindowAppearance 4 membersOne window and one session-local appearance, read from the same tmux reply.
Pane 4 types
Client 1 type
Hooks 2 types
Options 2 types
Buffers 1 type
Layout and geometry 1 type
Environment 2 types
Commands 3 types
Control mode 4 types
Formats 1 type
Queries 6 types
A value a filter can compare against.
Filterable 3 membersA model that can be filtered declaratively.
FilterOperation 10 membersHow a filter compares one field.
FilterLookup 1 members Builds a filter from a field__operator=value lookup written as text.
The filtering vocabulary, as a document.
RelationQuery 5 membersA quantified filter over a relation, as one value.
Queries — Operators 2 types
Queries — Expressions 1 type
Snapshots 4 types
Workspaces — Plans 4 types
Errors 11 types
Why a filter could not be built.
FilterValidationError 4 membersWhy a decoded filter cannot be evaluated safely.
FilterSelectionError 4 membersWhy selecting one result from a filter failed.
FilterLookupError 8 members RegexCompileError 14 members Why a RegexPattern could not be compiled.
Why a compiled RegexPattern could not finish matching.
Everything a tmux operation can fail with.
FormatDecodingError 5 membersA tmux reply that did not match its projection.
CardinalityError 4 membersWhy a lookup that expected exactly one match did not get one.
OutputWaitError 4 membersWhy waiting for pane output failed before it produced an outcome.
WorkspaceBuilderError 7 membersConstants and enums 1 type
MCP 15 types
Where this MCP server is itself running, when that is inside tmux.
ServerConfiguration 12 membersHow the executable is configured, read from the environment.
JSONValue 20 membersJust enough JSON to carry ids, arguments and results through without knowing their shape.
MCPRequestHandler 6 membersAnswers MCP requests, one line at a time, without touching a file descriptor.
ProgressReporter 2 membersSays that a call is still running, to a client that asked to be told.
MCPService 2 membersServes MCP over a stream of request lines.
TmuxTools 8 membersThe tmux tools an MCP client can call.
ToolOutcome 2 membersWhat a tool answers with.
ToolAuthority 4 membersThe tools this server is authorised to expose and run.
SafetyTier 17 membersHow much damage a tool can do.
ToolArgument 11 membersOne argument of a tool, in enough detail to generate its schema.
ToolDefinition 10 members ToolCall 4 membersOne tool call, as it arrives.
ToolError 16 membersWhy a call could not produce its normal result.
ToolOperation 42 membersThe stable protocol name of an MCP tool.
Testing utilities 2 types
Other 8 types
Finding the tmux servers already running on this machine.
Endpoint 7 membersWhere a tmux server listens.
RegexUnsupportedConstruct 9 membersA regular-expression feature this package deliberately does not execute.
RegexPattern 16 membersA compiled regular expression with bounded memory and matching work.
TmuxReply 8 membersWhat tmux said.
TmuxContext 9 membersWhere the tmux this process is running inside can be found.
OutputWait 11 membersWhat a wait on a pane's output ended on.
SubscriptionChange 10 membersOne report that a subscribed format's value changed.
Functions and constants 0 types
- namedSocketRoot : let namedSocketRoot: URL?
-
The directory a socket *name* resolves inside, when the run provides one.
tmux looks a name up in
TMUX_TMPDIR, whose default is shared with every other tmux on the machine — the other libtmux ports' included. A suite that addressed servers by name without moving that directory would put its sockets exactly where anything sweeping by prefix can reach them, which is what this whole root exists to prevent.So the directory is taken from the environment rather than set into it. The obvious alternative —
setenvfrom the fixture — writes toenvironwhile other cases are concurrently reading it to build a tmux environment, and that is a data race whether or not it has bitten yet. Cases that address a socket by path do not care either way,-Sbeing absolute.CONTRIBUTING.mdand CI name the directory;namedSocketsAvailableis what the suite checks so a run without one skips those cases rather than scattering sockets.
- namedSocketsAvailable : var namedSocketsAvailable: Bool
-
Whether this run can address servers by socket name inside the suite's root.
- reaperCommand(root:) ( root : URL ) TmuxCommand
-
A reaper that outlives this process, so a killed run leaves no server behind.
Arm it in the same invocation that creates the server's first session, and give it the directory holding the socket. Public because the benchmark provisions its own servers — with a counting shim standing in for tmux — and a second copy of this reasoning is a second copy to get wrong.
deferandkill-serverboth run *in the process that started the server*, which makes them useless in the one case that actually leaks: the run is killed outright by a harness timeout or an impatient operator, and every tmux server it started survives with no owner and no way to reach it. Cleanup that depends on the cleaner surviving is not deterministic.So the reaper lives inside the tmux server instead, as a background job. It watches the owning process and, once that is gone, removes the directory and kills the server. Three details carry the design:
- The directory goes first.
killends the server, and tmux kills its jobs when it exits, so anything sequenced after it would not run. - The server is addressed by pid, not by socket, because the socket is inside the directory just removed.
-
#{pid}is left for tmux to expand rather than asked for first, which is what lets arming ride in the same invocation that creates the session. Sent separately, a run killed in the gap between the two leaves a server no reaper ever covered — measurably, under load, about one server in six. - The interval is whole seconds. Fractions are a GNU and BSD extension that POSIX does not require, and a
sleepthat rejects its argument turns this into a busy loop per server rather than a slower one. Reaping a second later costs nothing here.
- Raises
- The directory goes first.
-
The lane binary when a matrix runner selected one, otherwise whatever
tmuxresolves to. Resolved to a path because the transport never searchesPATH.
-
Waits until a pane's shell has drawn its first prompt.
Keys sent before that are echoed with no prompt in front of them, which leaves the prompt to land on the row the command's own output wants. A case looking for a row equal to what it printed is then waiting for something that cannot arrive, and reports it as a timeout naming nothing. One capture settles it for every case that follows.
What the prompt *says* is not portable —
shis dash on Linux and bash on macOS, which printssh-3.2$— so readiness is that the pane has drawn anything at all. Until the shell starts it has drawn nothing.This reads the pane directly rather than through the wait machinery: a fixture that bootstrapped itself with the code under test would make every unrelated case depend on it.
-
-
Polls
conditionuntil it holds, and reports whether it did.Bounded in wall-clock rather than in attempts. What makes one of these polls slow is the tmux call inside it, so a count of attempts says nothing about how long the loop can run: on a contended machine a generous-looking budget outlives the case's time limit, and the failure reads as a timeout instead of naming the thing that never became true.
- Raises
-
Runs
bodyagainst a private tmux server addressed by socket *name*, and always kills it.The same guarantees as
withTmuxServer(_:)— its own server, killed on the way out and reaped if this process is killed outright — for the half ofEndpointthat a path-addressed fixture never exercises.- Raises
-
Runs
bodyagainst a private tmux server and always kills it — including when this process is killed outright.Each case gets its own socket, so cases never see each other's sessions and teardown never touches a server it did not start. The server is bootstrapped with one session named
bootstrap: a tmux server exits as soon as its last session goes away, so without one there is nothing to hold it open. Scope assertions to the objects the case created rather than to the server being otherwise empty.- Raises
- exactlyOne(_:) ( expression : FilterExpr<Element> ) Self.Element
-
The one element the filter matches.
Distinguishes "nothing matched" from "several matched", because a caller that meant to address one object needs to know which mistake it made.
- Raises
- filter(_:) ( expression : FilterExpr<Element> ) [Self.Element]
-
Every element the filter matches, in order.
Returns a plain array: ordered, replayable, and free of any live connection to tmux.
- Raises
- oneOrNil(_:) ( expression : FilterExpr<Element> ) Self.Element?
-
The one element the filter matches, or
nilif none did.Only ambiguity is an error here; absence is an ordinary answer.
- Raises
- SubscriptionChangeStream : typealias SubscriptionChangeStream
-
A lazy view of subscription changes from one bounded notification observer.