# `H.Session.Server`
[🔗](https://github.com/parlant/harness/blob/v0.3.0/lib/h/session/server.ex#L1)

Single mutation authority and durable coordinator for one `H` session.

Never blocks on LLM calls, tool execution, or slow SSE consumers. Groups
ready mailbox mutations via drain-batch commits (`H.Storage.commit/2`),
fences effect workers by `{incarnation, task_id, attempt_id}`, and broadcasts
single-encoded `ProcBin` commit and ephemeral frames via `H.PubSub`.

# `abort_all`

```elixir
@spec abort_all(GenServer.server(), String.t()) :: {:ok, map()} | {:error, term()}
```

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `close`

```elixir
@spec close(GenServer.server(), term()) :: :ok
```

# `execute_command`

```elixir
@spec execute_command(GenServer.server(), map()) :: {:ok, map()} | {:error, term()}
```

# `export_branch`

```elixir
@spec export_branch(GenServer.server(), pos_integer(), nil | pos_integer()) ::
  {:ok, %{entries: [map()], agent: map()}} | {:error, term()}
```

# `get_detail`

```elixir
@spec get_detail(GenServer.server()) :: {:ok, map()} | {:error, term()}
```

# `get_seq`

```elixir
@spec get_seq(GenServer.server()) :: {:ok, non_neg_integer()}
```

# `get_submission_outcome`

```elixir
@spec get_submission_outcome(GenServer.server(), String.t()) ::
  {:ok, map()} | {:error, :not_found}
```

# `get_tree`

```elixir
@spec get_tree(GenServer.server()) :: {:ok, map()} | {:error, term()}
```

# `scan_entries`

```elixir
@spec scan_entries(GenServer.server(), pos_integer(), map()) ::
  {:ok, %{items: [map()], next_cursor: nil | pos_integer()}} | {:error, term()}
```

# `seed_entries`

```elixir
@spec seed_entries(GenServer.server(), [map()], pos_integer()) ::
  {:ok, %{seeded: non_neg_integer(), seq: non_neg_integer()}} | {:error, term()}
```

# `snapshot_or_replay`

```elixir
@spec snapshot_or_replay(GenServer.server(), pos_integer(), nil | non_neg_integer()) ::
  {:ok,
   {:snapshot, non_neg_integer(), binary()}
   | {:replay, [{non_neg_integer(), binary()}]}}
  | {:error, term()}
```

# `start_link`

```elixir
@spec start_link(keyword()) :: GenServer.on_start()
```

# `verify_visible_entry`

```elixir
@spec verify_visible_entry(GenServer.server(), pos_integer(), pos_integer()) ::
  {:ok, map()} | {:error, :not_found | :entry_not_visible}
```

---

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