# `LibTmux.Capture`
[🔗](https://github.com/libtmux/libtmux-elixir/blob/86ad4ca80f157adb0c11f6bf7c371b04ca5aa688/lib/libtmux/capture.ex#L1)

Builds a bounded one-shot observation of one existing Linux tmux server.

Capture checks topology and OS server identity before and after field
reads. Attempts share the original deadline and work budgets; `attempts`
defaults to 2 and accepts 1–3. Only inconsistent topology or disappearing
read targets retry. Decoding and coverage errors remain visible.

Defaults: 1024 topology rows, 512 commands, 8 MiB total response bytes,
64 KiB per response and 5000 ms. Exhausted capture-wide budgets return an
error, never a partial success. Both topology scans count contextual linked rows.
Free-form fields use one encoded listing per entity kind. One successful
attempt uses 13 commands when those three listings fit. After a listing
exceeds the response ceiling and its client retires, capture reads that
kind's physical entities individually. The failed listing still consumes
commands, bytes and time. Duplicate linked text rows consume bytes.
Capture adds no control attachment. Hooks configured on list commands can
still have effects; retries do not replay application mutations.

# `option`

```elixir
@type option() ::
  {:timeout, pos_integer()}
  | {:deadline, LibTmux.Deadline.t()}
  | {:attempts, 1..3}
  | {:max_entities | :max_commands | :max_bytes | :max_response_bytes,
     pos_integer()}
```

Capture-wide budgets shared by all attempts and reads.

Each read uses the smaller of remaining `max_bytes` and `max_response_bytes`.
That effective ceiling must fit OneShot's 16 MiB stdout limit. The shared
deadline must have at most 600,000 ms remaining when OneShot validates a read.
Invalid combinations raise `ArgumentError` before that command executes.

# `fetch`

```elixir
@spec fetch(LibTmux.Server.t(), [option()]) ::
  {:ok, LibTmux.Snapshot.t()} | {:error, LibTmux.Error.t()}
```

Performs bounded capture through an explicit server descriptor.

See `t:option/0` for the composed work, response and remaining-deadline
constraints inherited from `LibTmux.Transport.OneShot.run/3`.

See the [worked example](first-task.html).

---

*Consult [api-reference.md](api-reference.md) for complete listing*
