# `Parlora.ContextSnapshot`
[🔗](https://github.com/hfiguera/parlora/blob/v0.1.0/lib/parlora/context_snapshot.ex#L1)

Immutable context supplied to the application policy, not a persistence format.

Transcript entries are newest-arrival-first. `arrival_order` is a context
revision, not a turn identifier; timestamps may overlap. Delegations include
both pending and claimed entries. Task request IDs are newest-first and include
older revisions, not just running work. Inspect `Parlora.status/1` for job state.

Optional map keys are absent until observed. `clarification` is either a policy
submission attempt or a backend question; it is not proof the caller heard it.
Policy submissions carry `delivery: :unconfirmed`; their context revision marks
submission, not speech or playback. Synchronous rejections create no marker.
`confirmation` is reserved and currently nil; authorize business actions in the
application. Additional adapter payload keys are not coordinator guarantees.

`provider_speech` is `:unknown`, `:speaking`, or `:idle`. Changes revise context
so an in-flight policy judgment cannot apply to an older speech state. This is
the provider's reported state, not downstream playback or proof of hearing.

# `backend_clarification`

```elixir
@type backend_clarification() :: %{
  :task_revision =&gt; pos_integer(),
  optional(:question) =&gt; String.t(),
  optional(atom()) =&gt; term()
}
```

# `clarification`

```elixir
@type clarification() :: policy_clarification() | backend_clarification()
```

# `context_wait`

```elixir
@type context_wait() :: %{
  due_at_us: integer(),
  expired?: boolean(),
  recheck_key: String.t() | nil
}
```

# `delegation`

```elixir
@type delegation() :: %{
  :id =&gt; String.t(),
  :target =&gt; :client,
  :offset_ms =&gt; number() | nil,
  :provider_generation =&gt; non_neg_integer(),
  :status =&gt; :pending | :claimed | :cancelled,
  :received_at_us =&gt; integer(),
  optional(:task_id) =&gt; String.t(),
  optional(:task_revision) =&gt; pos_integer(),
  optional(:context_wait) =&gt; context_wait(),
  optional(:clarification) =&gt; policy_clarification(),
  optional(atom()) =&gt; term()
}
```

# `policy_clarification`

```elixir
@type policy_clarification() :: %{
  context_revision: non_neg_integer(),
  command_id: String.t(),
  delivery: :unconfirmed,
  message: String.t(),
  input: map()
}
```

# `progress`

```elixir
@type progress() :: %{
  :task_revision =&gt; pos_integer(),
  optional(:facts) =&gt; map(),
  optional(:summary) =&gt; String.t(),
  optional(atom()) =&gt; term()
}
```

# `speaker`

```elixir
@type speaker() :: :user | :assistant
```

# `t`

```elixir
@type t() :: %Parlora.ContextSnapshot{
  application_context: map(),
  pending_delegations: %{optional(String.t()) =&gt; delegation()},
  provider_generation: non_neg_integer(),
  provider_speech: :unknown | :speaking | :idle,
  revision: non_neg_integer(),
  session_id: String.t(),
  tasks: %{optional(String.t()) =&gt; task()},
  transcripts: [transcript()]
}
```

# `task`

```elixir
@type task() :: %{
  :id =&gt; String.t(),
  :revision =&gt; pos_integer(),
  :input =&gt; map(),
  :status =&gt; task_status(),
  :request_ids =&gt; [String.t()],
  :delegation_id =&gt; String.t() | nil,
  :confirmation =&gt; nil,
  optional(:context_wait) =&gt; context_wait(),
  optional(:clarification) =&gt; clarification(),
  optional(:progress) =&gt; progress()
}
```

# `task_status`

```elixir
@type task_status() :: :submitted | :uncertain | Parlora.BackendResult.status()
```

# `transcript`

```elixir
@type transcript() :: %{
  :speaker =&gt; speaker(),
  :delta =&gt; String.t(),
  :start_ms =&gt; number() | nil,
  :end_ms =&gt; number() | nil,
  :provider_generation =&gt; non_neg_integer(),
  :arrival_order =&gt; non_neg_integer(),
  optional(atom()) =&gt; term()
}
```

---

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