# engine.TmuxEngine

- **Module:** engine
- **Package:** libtmux
- **Language:** TypeScript
- **Kind:** typealias
- **Source:** https://github.com/libtmux/libtmux-ts/blob/46cccfef2a546de55ce8b308249b8c76339089a0/packages/libtmux/src/engine.ts#L148
- **Page:** https://libtmux.org/en/ts/latest/reference/engine-tmuxengine/

```ts
type TmuxEngine = {
  readonly endpoint?: string;
  execute(request: TmuxInvocationRequest): Promise<TmuxCommandResult>;
}
```

What runs a tmux command for a server.

Two obligations beyond returning bytes, and both are what the layers above
assume rather than check:

Every request is one tmux invocation and carries its ordered command list.
Keeping that structure at the seam prevents an engine from splitting a
snapshot into several clients or guessing where global flags end.
Environment, stdin, signal, and timeout apply once to the whole invocation.

`daemonGuard`, when a request carries one, must reach tmux — or the engine
must be bound to one daemon for its lifetime, the way a control connection
is. Ignoring it on a reconnecting engine means a handle read before a restart
addressing whatever now holds its id. `guardRequest` is what the built-in
engine calls to honour it, published so an implementer does not reproduce
the wrapper, its else branch, and the stderr that tells refusal from failure.
