# `MingaEditor.Renderer.State`
[🔗](https://github.com/jsmestad/minga/blob/main/lib/minga_editor/renderer/state.ex#L1)

Complete long-lived state owned by `MingaEditor.Renderer.Server`.

Renderer caches, font registration, frontend acknowledgement state, resident
windows, buffer monitors, and coalesced frame credit live here. Public
transitions centralize lifecycle cleanup so window close, buffer replacement,
reset, and exact monitor `:DOWN` all discard the same state.

# `ack_lease`

```elixir
@type ack_lease() :: %{
  generation: non_neg_integer(),
  seq: non_neg_integer(),
  timer_ref: reference(),
  output: MingaEditor.RenderPipeline.Input.t(),
  intent: MingaEditor.RenderPipeline.Intent.t(),
  pushed_at: integer()
}
```

# `editor_ref`

```elixir
@type editor_ref() :: pid() | atom() | nil
```

# `frame_work`

```elixir
@type frame_work() ::
  {MingaEditor.RenderPipeline.Intent.t(), non_neg_integer(), integer()}
```

# `pipeline`

```elixir
@type pipeline() :: (MingaEditor.RenderPipeline.Input.t() -&gt;
                 MingaEditor.RenderPipeline.Input.t())
```

# `t`

```elixir
@type t() :: %MingaEditor.Renderer.State{
  ack_timeout_ms: pos_integer(),
  awaiting_ack: ack_lease() | nil,
  buffer_monitors: %{optional(pid()) =&gt; reference()},
  buffer_versions: %{optional(pid()) =&gt; non_neg_integer()},
  caches: MingaEditor.Renderer.Caches.t(),
  editor_pid: editor_ref(),
  font_registry: MingaEditor.UI.FontRegistry.t(),
  in_flight: frame_work() | nil,
  message_store: MingaEditor.UI.Panel.MessageStore.t() | nil,
  pending: frame_work() | nil,
  pipeline: pipeline(),
  rejection_state: MingaEditor.Renderer.RejectionState.t(),
  render_token: reference() | nil,
  rendering?: boolean(),
  require_ack?: boolean(),
  resident_windows: %{
    optional(MingaEditor.Window.id()) =&gt;
      MingaEditor.Renderer.ResidentWindowState.t()
  },
  stale_retry_count: non_neg_integer()
}
```

# `accept_intent`

```elixir
@spec accept_intent(t(), MingaEditor.RenderPipeline.Intent.t()) ::
  {:accepted, t()} | {:blocked, t()}
```

Accepts changed semantic work and blocks an identical terminally rejected intent.

# `clear_rejection`

```elixir
@spec clear_rejection(t()) :: t()
```

Clears rejection visibility after reconnect or another external state change.

# `consume_adaptation`

```elixir
@spec consume_adaptation(t(), non_neg_integer(), non_neg_integer()) ::
  {:ok, t(), MingaEditor.RenderPipeline.Intent.t()} | :error
```

Consumes matching one-shot evidence and returns its concrete adapted intent.

# `drop_buffer_down`

```elixir
@spec drop_buffer_down(t(), reference(), pid()) :: {t(), boolean()}
```

Drops all state for the exact monitored buffer death.

# `new`

```elixir
@spec new(keyword()) :: t()
```

Constructs renderer state with injected process dependencies.

# `queue_frame`

```elixir
@spec queue_frame(t(), frame_work()) :: t()
```

Returns frame credit and queues the next semantic frame through the state owner.

# `reconcile_windows`

```elixir
@spec reconcile_windows(t(), MingaEditor.RenderPipeline.Intent.t()) :: t()
```

Drops windows absent from the latest intent and monitors each live buffer once.

# `record_adaptation`

```elixir
@spec record_adaptation(
  t(),
  non_neg_integer(),
  non_neg_integer(),
  MingaEditor.Frontend.ResourcePolicy.adaptation_descriptor(),
  MingaEditor.RenderPipeline.Intent.t()
) :: {:ok, t()} | {:error, t()}
```

Records adapted-retry evidence only for the matching outstanding transaction.

# `release_credit`

```elixir
@spec release_credit(t()) :: t()
```

Releases the outstanding acknowledgement lease without committing its output.

# `reset_frontend`

```elixir
@spec reset_frontend(t(), MingaEditor.Renderer.ResidentWindowState.hydration_reason()) ::
  t()
```

Resets frontend-retained state and re-hydrates every resident in a fresh epoch.

# `terminal_failure`

```elixir
@spec terminal_failure(t()) :: MingaEditor.Renderer.RejectionState.terminal() | nil
```

Returns the currently visible terminal frontend failure, if any.

# `terminal_failure`

```elixir
@spec terminal_failure(t(), non_neg_integer(), atom()) :: t()
```

Enters a visible terminal frontend failure while preserving acknowledged caches.

---

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