An exact observed target bound to one server instance.
A window-link ID is its observed {session_id, index, window_id} binding,
not a unique lifetime identifier. Validation detects known stale instances;
it does not reserve an object or close a one-shot check/use race.
Summary
Types
The target kind; physical windows and session-relative links have different identities.
A native ID or observed session/index/window link binding; neither reserves an object's lifetime.
An exact observed identity bound to a tmux server incarnation, separate from a connection epoch.
Functions
Builds a reference from an observation's own identity and server instance.
Validates a native identity and binds it to a nonempty instance token.
Rejects malformed references and known server-instance mismatches.
Types
@type entity() :: :session | :window | :pane | :window_link | :client
The target kind; physical windows and session-relative links have different identities.
@type id() :: String.t() | {String.t(), non_neg_integer(), String.t()}
A native ID or observed session/index/window link binding; neither reserves an object's lifetime.
An exact observed identity bound to a tmux server incarnation, separate from a connection epoch.
Functions
@spec from_observation(LibTmux.Schema.observation()) :: {:ok, t()} | {:error, LibTmux.Error.t()}
Builds a reference from an observation's own identity and server instance.
Validates the identity with new/3 without I/O or a fresh observation.
Malformed identities and other inputs return an :invalid_target error.
Other captured fields may remain unloaded or unavailable. A reference does
not prove that its target still exists. Window links retain their tuple
binding and lifetime limitation; domain actions reject window-link refs.
Examples
iex> pane = %LibTmux.Pane{id: "%7", server_instance: "instance-a"}
iex> {:ok, ref} = LibTmux.Ref.from_observation(pane)
iex> {ref.entity, ref.id, ref.server_instance}
{:pane, "%7", "instance-a"}
@spec new(entity(), id(), String.t()) :: {:ok, t()} | {:error, LibTmux.Error.t()}
Validates a native identity and binds it to a nonempty instance token.
See the worked example.
@spec validate(t(), String.t()) :: :ok | {:error, LibTmux.Error.t()}
Rejects malformed references and known server-instance mismatches.
See the worked example.