Tracks the agent's turn counter and checkpoint stack.
:index increments on every new LLM turn. :checkpoints is a
reversed list of message-list lengths recorded at the start of each
user prompt — used to detect messages appended mid-turn and to rebuild
state after a session reload.
Summary
Functions
Increment the turn counter.
Return a fresh turn state.
Push a checkpoint (current message-list length) onto the stack.
Rebuild checkpoints from a message list, preserving the current index.
Types
@type t() :: %Planck.Agent.TurnState{ checkpoints: [non_neg_integer()], index: non_neg_integer() }
:index— monotonically increasing turn counter:checkpoints— reversed stack of message-count checkpoints, one per user prompt
Functions
Increment the turn counter.
@spec new() :: t()
Return a fresh turn state.
@spec push_checkpoint(t(), non_neg_integer()) :: t()
Push a checkpoint (current message-list length) onto the stack.
Rebuild checkpoints from a message list, preserving the current index.