# `Jidoka.Turn.State`
[🔗](https://github.com/agentjido/jidoka/blob/v0.9.0/lib/jidoka/turn/state.ex#L1)

Ephemeral data value passed through the Jidoka turn workflow.

# `t`

```elixir
@type t() :: %Jidoka.Turn.State{
  agent_state: term(),
  diagnostics: [any()],
  events: [term()],
  journal: term(),
  llm_result: nil | nil | term(),
  loop_index: integer(),
  memory: nil | nil | term(),
  operation_plan: nil | nil | term(),
  pending_effects: [term()],
  pending_interrupt: nil | nil | term(),
  plan: term(),
  prompt: nil | nil | any(),
  request: term(),
  result: nil | nil | binary(),
  result_parts: [term()],
  result_repair_count: integer(),
  result_value: nil | nil | any(),
  spec: term(),
  started_at_ms: nil | nil | integer(),
  status: (:running | :waiting) | :finished
}
```

# `apply_effect_result`

```elixir
@spec apply_effect_result(t(), Jidoka.Effect.Result.t()) ::
  {:ok, t()} | {:error, term()}
```

Applies one interpreted effect result to turn state.

# `clear_pending_interrupt`

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

Removes the pending review interrupt from turn state.

# `current_pending_effect`

```elixir
@spec current_pending_effect(t()) :: Jidoka.Effect.Intent.t() | nil
```

Returns the next pending effect, if one exists.

# `from_snapshot`

```elixir
@spec from_snapshot(Jidoka.Snapshot.t()) :: {:ok, t()} | {:error, term()}
```

Restores turn state from a compatible agent snapshot.

# `new`

```elixir
@spec new(keyword() | map()) :: {:ok, t()} | {:error, term()}
```

Builds turn state from keyword or map attributes.

# `new!`

```elixir
@spec new!(keyword() | map()) :: t()
```

Builds turn state and raises if the attributes are invalid.

# `pending_effect?`

```elixir
@spec pending_effect?(t()) :: boolean()
```

Returns true when the turn has a pending effect.

# `pop_pending_effect`

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

Removes the current effect from the pending queue.

# `put_pending_interrupt`

```elixir
@spec put_pending_interrupt(t(), Jidoka.Review.Interrupt.t()) :: t()
```

Stores the review interrupt that paused the turn.

# `schema`

```elixir
@spec schema() :: Zoi.schema()
```

Returns the Zoi schema for turn state.

# `set_pending_effects`

```elixir
@spec set_pending_effects(t(), [Jidoka.Effect.Intent.t()]) :: t()
```

Replaces the pending effect queue.

---

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