Jidoka.Turn.State (Jidoka v0.9.0)

Copy Markdown View Source

Ephemeral data value passed through the Jidoka turn workflow.

Summary

Functions

Applies one interpreted effect result to turn state.

Removes the pending review interrupt from turn state.

Returns the next pending effect, if one exists.

Restores turn state from a compatible agent snapshot.

Builds turn state from keyword or map attributes.

Builds turn state and raises if the attributes are invalid.

Returns true when the turn has a pending effect.

Removes the current effect from the pending queue.

Stores the review interrupt that paused the turn.

Returns the Zoi schema for turn state.

Replaces the pending effect queue.

Types

t()

@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
}

Functions

apply_effect_result(state, result)

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

Applies one interpreted effect result to turn state.

clear_pending_interrupt(state)

@spec clear_pending_interrupt(t()) :: t()

Removes the pending review interrupt from turn state.

current_pending_effect(state)

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

Returns the next pending effect, if one exists.

from_snapshot(map)

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

Restores turn state from a compatible agent snapshot.

new(attrs)

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

Builds turn state from keyword or map attributes.

new!(attrs)

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

Builds turn state and raises if the attributes are invalid.

pending_effect?(state)

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

Returns true when the turn has a pending effect.

pop_pending_effect(state)

@spec pop_pending_effect(t()) :: t()

Removes the current effect from the pending queue.

put_pending_interrupt(state, interrupt)

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

Stores the review interrupt that paused the turn.

schema()

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

Returns the Zoi schema for turn state.

set_pending_effects(state, effects)

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

Replaces the pending effect queue.